Compartilhar via


Configuring Services.exe to Load a Standalone Service (Windows CE 5.0)

Send Feedback

By default, all service DLLs are loaded into the same copy of Services.exe that is started on device initialization. In certain cases it may be preferable to isolate a service by having a new copy of Services.exe created explicitly for it. The main reason for isolating a service is to ensure that it will not corrupt other services.

Isolating a service is useful for debugging because locating a corruption in a process with only one service running is easier than trying to find a problem with multiple services running concurrently. Running a standalone services also provides increased reliability.

For Windows CE .NET 4.2 and later you can configure Services.exe to load a service into a separate copy of Services.exe by setting the service's context flag in the registry.

To configure Services.exe to load a service in standalone mode

  1. Under the HKEY_LOCAL_MACHINE\Services\<Service Name> registry key for your service, set the Context value of type REG_DWORD to SERVICE_INIT_STANDALONE (0x02). The following example shows the registry settings for a service named "MyService":

    HKEY_LOCAL_MACHINE\Services\MyService\Context=dword:0x00000002

  2. Services.exe will pass the context flags to the service's xxx_Init (Services.exe) function in the dwData parameter. If the service does not support running in standalone mode, xxx_Init should return FALSE if the SERVICE_INIT_STANDALONE flag is passed on startup.

See Also

Services.exe | Shutting down a Standalone Service | xxx_Init (Services.exe) | Limitations to Standalone Services

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.