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