README,v 1.1 1999/02/23 19:02:11 shuston Exp How to use the NT_Service example. The NT_Service program has the following usage: -in -r -s -k -tn -d -i: Install this program as an NT service, with specified startup -r: Remove this program from the Service Manager -s: Start the service -k: Kill the service -t: Set startup for an existing service -d: Debug; run as a regular application In order to see different stages of an NT service application, you have to run the program several times, with different options. Please note: run with only one option at a time. 1. Make executable NT_Service. 2. First, you must initialize the service in the NT SCM database. Run NT_Service with -in, where n is one of the following startup options: // // Start Type (from WinNT.h) // #define SERVICE_SYSTEM_START 0x00000001 #define SERVICE_AUTO_START 0x00000002 #define SERVICE_DEMAND_START 0x00000003 #define SERVICE_DISABLED 0x00000004 If only -i is specified, SERVICE_AUTO_START is default option. 3. Now you are ready to run the actual service. Run NT_Service again, this time with -s option. If the service starts successfully, it will ring the system bell every second or so until the service is stopped. 4. To stop service execution, run NT_Service with the -k option. 5. To remove the service from the Service Control Manager database, run NT_Service with -r. In addition, once you have initialized this service (by using the -i option) you can change its startup type to one of the other values above. To do this, run NT_Service with -tn option. n is as explained above for -i. In order to debug the service's execution itself, use the -d option.