User32.dll or Kernel32.dll does not initialize - Application Developer (2024)

  • Article

This article describes an issue where an application that is executed by CreateProcess or CreateProcessAsUser may fail.

Applies to: Microsoft Windows
Original KB number: 184802

Symptoms

An application that is executed by CreateProcess or CreateProcessAsUser may fail, and you receive one of the following error messages:

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.

Additionally, the failed process returns exit code 128 or the following:

error:ERROR_WAIT_NO_CHILDREN

Cause

This failure occurs for one of the following reasons:

  • The executed process does not have correct security access to the window station and desktop that are associated with the process.

  • The system ran out of desktop heap.

More information

  • Cause 1

    The executed process does not have correct security access to the window station and desktop that are associated with the process.

    The lpDesktop member of the STARTUPINFO structure that is passed to CreateProcess or CreateProcessAsUser specifies the window station and desktop that are associated with the executed process. The executed process must have correct security access to the specified window station and desktop.

  • Cause 2

    The system ran out of desktop heap.

    Every desktop object on the system has a desktop heap that is associated with it. The desktop object uses the heap to store menus, hooks, strings, and windows. In Windows Server 2003 and Windows XP 32-bit, the system allocates desktop heap from a system-wide 48 megabytes (MB) buffer. In addition to desktop heaps, printer drivers and font drivers also use this buffer.

    Desktops are associated with window stations. A window station can contain zero or more desktops. You can change the size of the desktop heap that is allocated for a desktop that is associated with a window station by changing the following registry value.

    Note

    We do not recommend that you use the /3GB switch. The /3GB switch is specified in the Boot.ini file. The /3GB switch is supported only for 32-bit operating systems.HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows

In Windows Server 2003 and Windows XP 32-bit, the default data for this registry value will resemble the following (all on one line):

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

In different versions of Windows, the default data for this registry value will resemble the following:

  • For Windows Vista RTM (32-bit)

    SharedSection=1024,3072,512
  • For Windows Vista SP1, Windows 7, Windows 8, Windows 8.1 (32-bit), and Windows Server 2008 (32-bit)

    SharedSection=1024,12288,512
  • For Windows Vista, Windows 7, Windows 8, Windows 8.1 (64-bit), Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 (64-bit)

    SharedSection=1024,20480,768

The numeric values that following SharedSection= control how the desktop heap is allocated. These SharedSection values are specified in kilobytes. There are separate settings for desktops that are associated with interactive and noninteractive window stations.

Note

If you change the SharedSection values in the registry, you must restart the system for the changes to take effect.

Important

This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, see How to back up and restore the registry in Windows.

The first SharedSection value (1024) is the shared heap size common to all desktops. This includes the global handle table. This table holds handles to windows, menus, icons, cursors, and so on, and shared system settings. It is unlikely that you would ever have to change this value.

The second SharedSection value is the size of the desktop heap for each desktop that is associated with the interactive window station WinSta0. User objects such as hooks, menus, strings, and windows consume memory in this desktop heap. It is unlikely that you would ever have to change this value.

Each desktop that is created in the interactive window station uses the default desktop heap of 3,072 KB. By default, the system creates the following three desktops in Winsta0:

  • Winlogon

  • Default

    The Default application desktop will be used by all the processes for which Winsta0\default is specified in the STARTUPINFO.lpDesktop structure member. When the lpDesktop structure member is NULL, the window station and desktop are inherited from the parent process. All services that are executed under the LocalSystem account with the Allow Service to Interact with Desktop startup option selected will use Winsta0\Default. All these processes will share the desktop heap that is associated with the Default application desktop.

  • Screen saver

    The screen saver desktop is created in the interactive window station (WinSta0) when a screen saver is displayed.

The third SharedSection value is the size of the desktop heap for each desktop that is associated with a noninteractive window station. If this value is not present, the size of the desktop heap for noninteractive window stations will be same as the size that is specified for interactive window stations (that is, the second SharedSection value).

If only two SharedSection values are present, you can add a third value to specify the size of the desktop heap for desktops that are created in noninteractive window stations.

Every service process that is executed under a user account will receive a new desktop in a noninteractive window station that is created by the Service Control Manager (SCM). Therefore, each service that is executed under a user account will consume the number of kilobytes of desktop heap that is specified in the third SharedSection value. All services that are executed under the LocalSystem account when Allow Service to Interact with the Desktop is not selected share the desktop heap of the Default desktop in the noninteractive service windows station (Service-0x0-3e7$).

The total desktop heap that is being used in the interactive and noninteractive window stations must fit in the buffer.

Decreasing the second or third SharedSection value will increase the number of desktops that can be created in the corresponding window stations. Smaller values will limit the number of hooks, menus, strings, and windows that can be created in a desktop. On the other hand, increasing the second or third SharedSection value will decrease the number of desktops that can be created. However, this will also increase the number of hooks, menus, strings, and windows that can be created in a desktop.

Because the SCM creates a new desktop in the noninteractive window station for every service process that is running under a user account, a larger third SharedSection value will reduce the number of user account services that can run successfully on the system. The minimum that can be specified for the second or third SharedSection value is 128. Any attempt to use a smaller value will instead use 128.

Desktop heap is allocated by User32.dll when a process needs user objects. If an application is not dependent on User32.dll, it will not consume desktop heap.

Note

In Windows Server 2003, the specific event is logged in the System log when one of the following conditions is true:

  • If the desktop heap becomes full, the following event is logged:

    Event Type: WarningEvent Source: Win32kEvent Category: NoneEvent ID: 243Date: DateTime: TimeUser: N/AComputer: ServerNameDescription: A desktop heap allocation failed.

    In this case, increase the desktop heap size.

  • If the total desktop heap becomes the system-wide buffer size, the following event is logged:

    Event Type: WarningEvent Source: Win32kEvent Category: NoneEvent ID: 244Date: DateTime: TimeUser: N/AComputer: ServerNameDescription: Failed to create a desktop due to desktop heap exhaustion.

    In this case, decrease the desktop heap size.

In Windows Server 2003, a system-wide buffer is 20 MB when one of the following conditions is true:

  • You are in a Terminal Services environment.
  • The /3GB switch is specified in the Boot.ini file.

Applies to

  • Microsoft Windows XP Professional
  • Microsoft Windows XP Home Edition
  • Windows Vista Ultimate
  • Windows Vista Enterprise
  • Windows Vista Business
  • Windows Vista Home Premium
  • Windows 7 Ultimate
  • Windows 7 Enterprise
  • Windows 7 Professional
  • Windows 7 Home Premium
  • Windows 8 Enterprise
  • Windows 8 Pro, Windows 8
  • Windows 8.1 Enterprise
  • Windows 8.1 Pro
  • Windows 8.1
  • Microsoft Windows Server 2003 Datacenter Edition (32-bit x86)
  • Microsoft Windows Server 2003 Datacenter x64 Edition
  • Microsoft Windows Server 2003 Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003 Enterprise x64 Edition
  • Microsoft Windows Server 2003 Standard Edition (32-bit x86)
  • Microsoft Windows Server 2003 Standard x64 Edition
  • Windows Server 2008 Datacenter
  • Windows Server 2008 Enterprise
  • Windows Server 2008 R2 Datacenter
  • Windows Server 2008 R2 Enterprise
  • Windows Server 2008 Standard
  • Windows Server 2012 Datacenter
  • Windows Server 2012 Standard
  • Windows Server 2012 R2 Datacenter
  • Windows Server 2012 R2 Standard
User32.dll or Kernel32.dll does not initialize - Application Developer (2024)

FAQs

How do I fix USER32 dll error? ›

If the User32. dll error message appeared during or after you installed a program, a hardware component, or a driver, uninstall the program, the hardware component, or the driver. Then restart Windows, and reinstall the program, the hardware component, or the driver.

How do I fix kernel32.dll error in Windows 7 32 bit? ›

How to Fix Kernel32. dll Errors
  1. Restart your computer. ...
  2. Reinstall the program if the "invalid page fault in module kernel32. ...
  3. Use Windows Update to update your computer with any new Windows-related patches or service packs that might be available. ...
  4. Repair potentially damaged password list files. ...
  5. Repair corrupted thumbs.
Sep 15, 2022

How to fix missing DLL files in Windows 7 32 bit? ›

Here are the available solutions to fix dll files not found errors on Windows 10, 8, and 7 PCs.
  1. Solution one: Re-install the software. ...
  2. Solution two: Run malware scanning. ...
  3. Solution three: Use system file checker. ...
  4. Solution four: Check for Windows Update. ...
  5. Solution five: System Restore.

How do I fix kernel32.dll entry point not found? ›

Install the Latest Windows Updates. If your Windows system gets out of date, some bugs and virus infections can cause the DLL files to become corrupted. So, we highly recommend you install the latest Windows updates, which may fix the “the procedure entry point could not be located in the dynamic link library kernel32.

How do I manually fix DLL errors? ›

How to Fix DLL "Not Found" & "Missing" Errors
  1. Restart your computer. ...
  2. Restore the deleted DLL file from the Recycle Bin. ...
  3. Recover the deleted DLL file with a free file recovery program. ...
  4. Run a virus/malware scan of your entire system. ...
  5. Use System Restore to undo recent system changes.
Nov 1, 2022

What is USER32.DLL used for? ›

In this article
DLLDescription of Contents
Kernel32.dllLow-level operating system functions for memory management and resource handling.
User32.dllWindows management functions for message handling, timers, menus, and communications.
1 more row
Mar 11, 2022

What does KERNEL32.dll mean? ›

Kernel32. dll is the 32-bit dynamic link library found in the Windows operating system kernel. It handles memory management, input/output operations, and interrupts.

How do I register a DLL file in Windows 7 32-bit? ›

An alternative method using Windows Explorer:
  1. Find the dll to register or unregister.
  2. Go to Start button and select Run.
  3. In the run box, type the command regsvr32 or regsvr32 /u.
  4. Highlight the dll.
  5. Drag it to the run box and drop it into the box after regsvr32 or regsvr32 /u.
  6. Select Go.

How do I replace Kernelbase dll in Windows 7? ›

Execute the sfc/scannow command to replace a missing or corrupt copy of the kernelbase. dll file. Fortunately, the kernelbase. dll file is provided by Microsoft in at least some versions of Windows, so the System File Checker tool (the sfc command) should restore it.

Where is USER32.DLL located? ›

The USER32. DLL file, which is usually located at the Windows\system32 folder, implements the Windows USER component that creates and manipulates the standard elements of the Windows user interface, such as the desktop, windows, and menus.

How to check if a DLL is corrupted? ›

Scan for corrupt files

The SFC utility scans the machine hard disk to check for potential corrupt files that may cause the error. In the Windows Search box, type cmd. Right-click Command Prompt and click Run as Administrator. Type: sfc /scannow, and press Enter.

How do I resolve a DLL problem? ›

If DLP policy tips don't work as expected, use a Fiddler trace to troubleshoot DLP policy tips.
  1. Collect the Fiddler trace file when you reproduce the issue. ...
  2. In the POST request, check whether the GetDLPPolicyTip call is made in the trace file. ...
  3. In the response, check the DetectedClassificationIds value.

Can I replace kernel32 DLL? ›

Replace the corrupted kernel32. dll file: you can copy a genuine kernel32. dll file from another Windows 10 PC to a USB flash drive, then paste it into your computer. Delete the kernel32.

Why is kernel DLL missing from my computer? ›

dll DLL error occurs when you use a particular program, reinstalling the program should replace the file. Try your best to complete this step. Reinstalling the program that provides the kernel. dll file, if possible, is a likely solution to this DLL error.

Is kernel32 always loaded? ›

kernel32 is always available to user mode application, it is loaded into process address space even if not linked at all.

How to remove DLL error message on startup? ›

Follow the steps:
  1. Launch the "Run" box using the "Windows+R" buttons simultaneously. ...
  2. In "Registry Editor," you need to find the file name shown in the RunDLL error. ...
  3. Right-click on that entry, click "Delete" to delete associated with the missing DLL file, and close Registry Editor.
Apr 22, 2024

How do I fix run DLL error on startup? ›

Fix the Rundll error by downloading a copy of Rundll file from the internet. Most of the DLL files are available to download online. You can replace the missing or corrupted Rundll files with the new ones and fix Rundll errors after restarting your computer.

Top Articles
Latest Posts
Article information

Author: Wyatt Volkman LLD

Last Updated:

Views: 5317

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Wyatt Volkman LLD

Birthday: 1992-02-16

Address: Suite 851 78549 Lubowitz Well, Wardside, TX 98080-8615

Phone: +67618977178100

Job: Manufacturing Director

Hobby: Running, Mountaineering, Inline skating, Writing, Baton twirling, Computer programming, Stone skipping

Introduction: My name is Wyatt Volkman LLD, I am a handsome, rich, comfortable, lively, zealous, graceful, gifted person who loves writing and wants to share my knowledge and understanding with you.