A service DLL exports this function to learn of code and data in the service host.


VOID WINAPI SvchostPushServiceGlobals (SVCHOST_GLOBAL_DATA *lpGlobalData); 


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


A service DLL is not required to export a function named SvchostPushServiceGlobals, but if it does, then each time that SVCHOST receives a request to start a service that is implemented in that DLL, it calls this function before calling the DLL’s ServiceMain function.


The SvchostPushServiceGlobals function in service DLLs is supported by SVCHOST.EXE version 5.1 and higher.

Microsoft does not formally document either this function or the structure that it exposes—or, for that matter, how to write a service DLL to run in a SVCHOST process. That said, the function does rate a mention in Guidelines for Services (Windows) which is otherwise about the Restart Manager.