PRB: "Failed initialization on Comctl32.dll" from a Service

ID: Q225102


The information in this article applies to:


SYMPTOMS

When creating a console-mode application via CreateProcess() or CreateProcessAsUser() from a service, a large number of instances may cause failure when initializing Comctl32.dll.


CAUSE

This is a result of the behavior of CreateProcess() when invoked from a service. By default, CreateProcess() and CreateProcessAsUser() create a new console window that has its own instance of Comctl32.dll. Because the desktop heap is fixed to only 48 MB in size, this can rapidly consume the entire desktop heap. Even though this console window may be completely invisible, and on its own (phantom) desktop, it still loads its own instance of Comctl32.dll.


RESOLUTION

The console-mode application must be created as a detached process, if possible, and with the CREATE_NO_WINDOW flag. This method prevents the creation of the window and consumes far fewer resources.


STATUS

This behavior is by design.

Additional query words:


Keywords          : kbCtrl kbNTOS400 kbSDKPlatform kbSDKWin32 kbGrpUser 
Version           : winnt:4.0,4.0 SP4
Platform          : winnt 
Issue type        : kbprb 

Last Reviewed: June 30, 1999