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



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • Microsoft Windows NT Server 4.0
    • Microsoft Windows NT Server 4.0 SP4
    • Microsoft Windows NT Workstation 4.0
    • Microsoft Windows NT Workstation 4.0 SP4

This article was previously published under Q225102

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.

Modification Type:MinorLast Reviewed:5/1/2004
Keywords:kbCtrl kbprb KB225102