Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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 Contextvalue 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 dwDataparameter. If the service does not support running in standalone mode, xxx_Initshould return FALSE if the SERVICE_INIT_STANDALONE flag is passed on startup.

See Also