ServiceEntry

A service DLL that uses SERVICES as a host process exports this function as its entry point for starting services.

Declaration

VOID
WINAPI
ServiceEntry (
    DWORD dwArgc,
    LPWSTR *lpszArgv,
    SVCS_GLOBAL_DATA *lpGlobalData,
    PVOID lpDllReference);

Parameters

The dwArgc argument is the number of null-terminated Unicode strings described by the lpszArgv argument. The first such string is the (case-insensitive) name of the service that is being started.

The lpGlobalData argument provides the address of a structure through which to access both code and data that are shared among all hosted services. The format of this SVCS_GLOBAL_DATA structure is given separately.

The lpDllReference argument provides the address of a structure that describes the service DLL, or is NULL.

Behaviour

The ServiceEntry function is essentially the same as a ServiceMain function in a service program. The essential differences are that:

SERVICES.EXE versions before 5.0 require that the name be ServiceEntry. Later versions provide for each service to have its own name for the ServiceEntry function, though still hard-coded in the SERVICES executable.

In SERVICES version 5.0 and higher, the lpDllReference argument is always NULL.

Availability

The ServiceEntry function in service DLLs is supported by SERVICES.EXE in versions from 3.51 to 5.2 inclusive.

Use of SERVICES as a host for service DLLs is not a general feature. Names for the services and their corresponding DLLs must be hard-coded in the SERVICES executable. If you like, the feature is technologically internal to Microsoft. Contrast with the generality of running service DLLs in a SVCHOST process, which also is private to Microsoft, but only by being undocumented. This article exists for historical reference.