4. 10. 2007

WIN - How To Create a User-Defined Service

To create a Windows NT user-defined service, perform the following steps:

1. At a MS-DOS command prompt(running CMD.EXE), type the following command:

path\INSTSRV.EXE My Service path\SRVANY.EXE

where path is the drive and directory of the Windows NT Resource Kit (i.e., C:\RESKIT) and My Service is the name of the service you are creating.


Example:
C:\Program Files\Resource Kit\Instsrv.exe Notepad C:\Program Files\Resource Kit\Srvany.exe
NOTE: To verify that the service was created correctly, check the registry to verify that the ImagePath value under

MK >>> "C:\Program Files\Windows Resource Kits\Tools\Instsrv.exe" PrnLog "C:\Program Files\Windows Resource Kits\Tools\Srvany.exe"

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\service name
is set to point to SRVANY.EXE. If this is not set correctly, the service will stop shortly after it starts and return an Event ID 7000 "The service name failed to start."

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the "Changing Keys And Values" online Help topic or the "Add and Delete Information in the Registry" and "Edit Registry Data" online Help topics in Registry Editor.

NOTE: You should back up the registry before you edit it.

2. Run Registry Editor (Regedt32.exe)and locate the following subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\

3. From the Edit menu, click Add Key. Type the following and click OK:

Key Name: Parameters
Class :
4. Select the Parameters key.

5. From the Edit menu, click Add Value. Type the following and click OK:

Value Name: Application
Data Type : REG_SZ
String : \

MK >>> c:\Program Files\PrnLog\PrnLog.exe

where \ is the drive and full path to the application executable including the extension (i.e., C:\WinNT\Notepad.exe)

6. Close Registry Editor.

Žádné komentáře: