Virtual Developer Workshop: Containerized Development with Docker
Microsoft. Windows NT. supports a service application type which conforms to the interface rules of the Service Control Manager (SCM). Services can be installed, configured and controlled by applications using the service functions included in the Microsoft. Win32. application programming interface (API).
CSysService is a C++ class which wraps methods around several of the Win32. API service functions, providing an object-oriented interface to these functions, grouping common variables and structures in a single class object. The result is an extensible base class capable of installing, enumerating, modifying, controlling and removing a service application in the Service Control Manager.
CSysService contains the following methods, fully documented in the download file.
||Initializes the class.|
|Control||Stop, continue or pause a service.|
|Error||Get error code.|
|ErrorMessage||Translate an error code.|
|LocalHostName||Get name of local host computer.|
|NewService||Create a new service|
|Open||Opens a connection to the SCM on the specified host.|
|RemoveService||Remove a service|
|Result||Get operation result.|
|ServiceDisplayName||Returns service's display name.|
|ServiceError||Get service error code.|
|ServiceErrorMessage||Translate a service error code.|
|ServiceHostName||Returns connected host name.|
|ServiceName||Get a service name.|
|ServiceStartName||Returns account service started under.|
|ServiceState||Return current service state.|
|ServiceType||Get type of service.|
|SetAccount||Set service start account.|
|SetDisplayName||Set service display name.|
|SetErrorControl||Set error control code.|
|SetPassword||Set password for a service.|
|SetPath||Set path to a service.|
|SetServiceName||Set a service name.|
|SetServiceType||Set service type.|
|SetStartType||Set start type.|
|StartType||Get startup type.|
|StartupString||Translate a service startup code.|
|StatusString||Translate a service status code.|
|ServiceConfig||Pointer to QUERY_SERVICE_CONFIG structure.|
|ServiceStatus||Pointer to SERVICE_STATUS structure.|
NTServiceSetup is a Microsoft. Windows NT. program to manage service applications in the Service Control Manager database.
- Create, modify, control and remove service applications.
- VisualC++ project and source code.
- Based on CSysService class.
- Allows creation of parameter registry entries for use with Microsoft's SrvAny.
Double-clicking (or selecting and pressing Enter) on a row in the list will display the service properties in an edit dialog window. Selecting the add button will display an empty edit dialog window to allow a new service to be added.
NTServiceSetup was originally part of a larger Windows NT. console-based control application project. The modularity employed in the design of the control application allowed extraction of NTServiceSetup to a stand alone executable program.
NTServiceSetup can only access the host upon which it is running. However, since it is based upon the CSysService class, this functionality can be easily added.
The algorithms for creating and sorting the treeview control in this project are based on those presented by Sardaukar in his article titled "NT Simple Service Manager", also on CodeGuru.
DownloadsDownload demo project - 258 Kb
Download source code - 34 Kb