How To Pass Arguments to a Service (171143)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), when used with:
- the operating system: Microsoft Windows NT 3.51
- the operating system: Microsoft Windows NT 4.0
- the operating system: Microsoft Windows 2000
- the operating system: Microsoft Windows XP
This article was previously published under Q171143 SUMMARY
A Microsoft Windows NT service can receive arguments. A demand-started service may receive arguments (also known as service arguments) through the
StartService API. The service receives the arguments via its
Service_Main(), which can be defined as follows:
void Service_Main(DWORD dwArgc, LPTSTR *lpszArgv)
NOTE: The Service_Main() entry point is user defined through the
SERVICE_TABLE_ENTRY structure. The first argument passed to the
Service_Main() indicates the number of parameters passed to the service
while the second parameter contains an array of strings containing the
arguments. The first string in the array will always be the name of the
service. Any additional strings in the array will contain the arguments
passed to the service through the StartService API.
Modification Type: | Minor | Last Reviewed: | 7/1/2004 |
---|
Keywords: | kbhowto kbKernBase kbProgramming kbService KB171143 |
---|
|