Device Installation Scheduled as Part of GUIRunOnce Stops Responding (Hangs) (813838)



The information in this article applies to:

  • Microsoft Windows Server 2003, 64-Bit Datacenter Edition
  • Microsoft Windows Server 2003, 64-Bit Enterprise Edition
  • Microsoft Windows Server 2003, Datacenter Edition
  • Microsoft Windows Server 2003, Enterprise Edition
  • Microsoft Windows Server 2003, Standard Edition
  • Microsoft Windows Server 2003, Web Edition
  • Microsoft Windows XP 64-Bit Edition
  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows Small Business Server 2003, Standard Edition
  • Microsoft Windows Small Business Server 2003, Premium Edition

SYMPTOMS

On a Microsoft Windows XP-based or Windows Server 2003-based computer, a device installation that is scheduled as part of the GUIRunOnce process may appear to stop responding (hang). Also, other GUIRunOnce entries may appear to be processed out of order.

CAUSE

This issue occurs because on a Windows XP-based or Windows Server 2003-based computer, a device installation that is scheduled as part of the GUIRunOnce process must wait until all the GUIRunOnce entries are processed before it returns. This behavior is different than from Microsoft Windows 2000. In Windows 2000, a device installation that is scheduled as part of GUIRunOnce does not process any additional GUIRunOnce entries, and because of this, returns immediately.

WORKAROUND

To work around this issue if you must install a device during GUIRunOnce processing, use a single GUIRunOnce entry. This single GUIRunOnce entry can specify an .inf file that contains all the tasks that must be performed during GUIRunOnce processing. To use a single GUIRunOnce entry:
  1. Create an .inf file that includes a [DefaultInstall] section that contains one or more RegisterDlls entries, and lists the executable files to run in the referenced sections. RegisterDlls is documented in the Driver Development Kit (DDK), and runs executable files (.exe) and Dynamic Link Library files.
  2. Add a GUIRunOnce entry that calls Rundll32.exe to process the .inf file:

    %WINDIR%\System32\Runonce.exe %WINDIR%\System32\Setupapi.dll,InstallHinfSection 132 c:\gui_runonce_name\.inf_file_name

MORE INFORMATION

In Windows XP and Windows Server 2003, GUIRunOnce entries are added to the runonce registry key as REG_EXPAND_SZ values. Windows processes runonce entries in the following two locations in the Windows code:
  • In Explorer.exe, which processes runonce entries during the logon process. This includes the first operating system start-up after Setup completes, which is when GUI-RunOnce entries are processed.
  • In Runonce.exe, which is initiated by the SetupAPI component that performs device installations, and that may be initiated by other components.
In Windows 2000, Runonce.exe and Windows Explorer's runonce processing behaves differently because they are two different and independent sets of code. Among the differences:
  • Windows 2000 Explorer.exe processes both REG_SZ and REG_EXPAND_SZ runonce entries.
  • Runonce.exe processes REG_SZ runonce entries, but not REG_EXPAND_SZ entries.
GUIRunOnce entries are written as REG_EXPAND_SZ entries, and so on Windows 2000, are processed by Explorer.exe's runonce processing, but are skipped by Runonce.exe.

In Windows XP and Windows Server 2003, the runonce processing code was consolidated so that now Runonce.exe also processes REG_EXPAND_SZ entries.

For additional information about how to use RunOnce entries for device driver installation, click the following article number to view the article in the Microsoft Knowledge Base:

281820 INFO: Specifying RunOnce in Device INF Files


Modification Type:MajorLast Reviewed:3/1/2004
Keywords:kbprb KB813838