Microsoft KB Archive/184802

From BetaArchive Wiki

INFO: User32.dll or Kernel32.dll Fails to Initialize

Q184802



The information in this article applies to:


  • Microsoft Win32 Application Programming Interface (API), used with:
    • the operating system: Microsoft Windows NT 4.0
    • the operating system: Microsoft Windows 2000





SUMMARY

Sometimes an application launched by either CreateProcess() or CreateProcessAsUser() fails, and one of the following error messages appears:

Initialization of the dynamic library <system>\system32\user32.dll failed. The process is terminating abnormally.

Initialization of the dynamic library <system>\system32\kernel32.dll failed. The process is terminating abnormally.

The failed process returns the exit code 128 or

ERROR_WAIT_NO_CHILDREN

The failure is caused by one of the following:

  • The launched process does not have proper security access to the Window station and desktop associated with the process.
  • The system has run out of desktop heap.



MORE INFORMATION

Cause 1: The launched process does not have proper security access to the Window station and desktop associated with the process.

The lpDesktop member of the STARTUPINFO structure passed to CreateProcess() or CreateProcessAsUser()specifies which window station and desktop is associated with the launched process. The launched process must have proper security access to the specified window station and desktop.

For more information on resolving security problems with window stations and desktops, please see the following article in the Microsoft Knowledge Base:

Q165194 INFO: CreateProcessAsUser, Windowstations and Desktops

Cause 2: The system has run out of desktop heap.

Every desktop object on the system has a desktop heap associated with it. The desktop object uses the heap to store menus, hooks, strings, and windows. Windows NT allocates desktop heap from a system-wide 48-MB buffer. In addition to desktop heaps, printer and font drivers also use this buffer.

Desktops are associated with window stations. A window station can contain zero or more desktops. By default, 3 MB of heap is allocated for any desktop associated with either an interactive or non-interactive window station. This setting can be changed through the registry. There are separate settings for desktops associated with interactive and non- interactive window stations. After the registry changes have been made, the system needs to be restarted.

WARNING: Using Registry Editor incorrectly can cause serious, system-wide problems that may require you to reinstall Windows NT to correct them. Microsoft cannot guarantee that any problems resulting from the use of Registry Editor can be solved. Use this tool at your own risk.

  1. Run the Registry Editor (RegEdt32.exe).
  2. Under the HKEY_LOCAL_MACHINE subtree, go to the following subkey:

    \System\CurrentControlSet\Control\SessionManager\ 
              SubSystems\Windows 

The default data for this value will look something like the following (all on one line):

   %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows
   SharedSection=1024,3072 Windows=On SubSystemType=Windows
   ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3
   ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off
   MaxRequestThreads=16 

In SharedSection=1024,3072, 3072 represents the heap size for desktops associated with the interactive Window station. Scan along the line until you reach the part that defines the SharedSection values and add ",512" after the second number. This value should now look something like the following:

   %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows
   SharedSection=1024,3072,512 Windows=On SubSystemType=Windows
   ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3
   ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off
   MaxRequestThreads=16 

The 512 specifies the desktop heap for desktops associated with non- interactive window stations. This tells the system to allocate 512 KB of heap for each desktop.

After making this change, close Regedt32 and restart the server.

Since, the system has approximately 48 MB of desktop heap for all desktops. A smaller desktop heap value will increase the number of desktops that can be created on a system, but this will limit the number of hooks, menus, strings, and windows that can be created in a desktop that is in a window station. On the other hand, a larger desktop heap value will decrease the number of desktops that can be created, but it will increase the number of hooks, menus, strings, and windows that can be created for a desktop.

The minimum value that the heap can be set to is 128 KB. Any attempt to use a smaller value will default to 128.

Additional query words:

Keywords : kbDLL kbKernBase kbOSWinNT400 kbOSWin2000 kbSecurity kbDSupport kbGrpDSKernBase
Issue type : kbinfo
Technology : kbAudDeveloper kbWin32sSearch kbWin32API


Last Reviewed: October 22, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.