Castanet Communications banner image
 
 

 
How to fix screen saver trouble with User32.dll
Author: Craig "hachiroku" Mercer
Date Created:2001-06-22
Operating System(s):Windows Logo imageWindows NT 4.0

Message: "Initialization of USER32.dll or KERNEL32.dll failed."

Problem: This error message can occur when starting a service, or it can occur when an application that makes calls to other programs has been running for some time.

Cause: 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 etc. and the system has run out of memory to create a new desktop heap for the service being started.

Solution: Because there is a soft limit on desktop heap size at 128kb, it must be expanded in the registry by starting the registry editor (Regedit or Regedt32) and go to:

HKEY_LOCAL_MACHINE
\SYSTEM
\CurrentControlSet
\Control\Session Manager
\Subsystem
\Windows

There you will find something that looks like this (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

Here we will concentrate about the value "SharedSection=xxxx,yyyy" where xxxx defines the maximum size of the system-wide heap (in kilobytes) and yyyy defines the size of the per desktop heap.
Add ",zzzz" immediately after yyyy where zzzz is the size of the hidden desktop heap created by non-interactive processes. Setting this to 512 will often solve your problem. When you are done, this string will look like this: "SharedSection=xxxx,yyyy,zzzz".

If you still get out of memory errors, try increasing yyyy by 256 until the application runs.

If you try and set the value to anything less than 128 then a default of 128 will be used by the system, ignoring you value.

The system has to be rebooted for the changes to take effect.

 

References:
Microsoft TechNet, Article Q142676

The Usual Disclaimer: Modifying the registry can cause serious problems that may require you to reinstall your operating system. Use the information provided at your own risk.