Microsoft KB Archive/281820

From BetaArchive Wiki

INFO: Specifying RunOnce in Device INF Files

Q281820



The information in this article applies to:


  • Microsoft Windows 2000 Driver Development Kit (DDK)





SUMMARY

You typically use RunOnce entries to open applications one-time only, either when a system startup occurs or when a user logs on, depending on where the RunOnce entry is added in the registry. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

Q137367 Definition of the RunOnce Keys in the Registry

You can use RunOnce entries in device INF files to invoke external code to run after an installation completes. This article discusses the limitations of using RunOnce in device INF files.



MORE INFORMATION

If you use RunOnce entries in an INF file to invoke external code after an installation completes, you must restrict the usage to calling Rundll32.exe to provide a DLL file. This allows the DLLs to run during a server-side installation of a signed INF file. For example:

[DeviceInstall.RunOnce.AddReg]
HKLM,%RunOnce%,"Name_Of_The_Entry",,"rundll32.exe Name_Of_The_dll,Entry_Point_In_To_The_DLL Argument1, Argument2,..etc." 

You should not use RunOnce to start a setup or to start other monitoring applications because RunOnce prevents the system from performing a server-side installation of your device.

During a server-side installation of a signed INF file, RunOnce is not invoked directly; rather, the device installer (SetupAPI functions) intercepts the registry entries in the INF file, and then calls the DLL directly as if invoked by the Rundll32.exe file through a RunOnce entry.

All RunOnce entries in the registry are run in the following cases:

  1. At the end of installation through InstallFromHinfSection even in the cases where you must restart the computer.
  2. After the default processing of DIF_INSTALLDEVICE even if you must restart the computer (with the exception of server-side processing).
  3. After the system has been restarted.

Programs that must run once when the computer is restarted should be specified through RunOnceEx entries.

NOTE: Instead of using RunOnce entries, the preferred way is to use the coinstaller wherever possible.



REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

Q158022 RunOnce Registry Key Runs Program at Every Startup

Additional query words:

Keywords : kbDDK kbOSWin2000 kbDSupport kbGrpDSNTDDK kbWDM
Issue type : kbinfo
Technology : kbwin2000Search kbwin2000DDK kbAudDeveloper kbWinDDKSearch


Last Reviewed: June 21, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.