Q281820 - INFO: Specifying RunOnce in Device INF files

Somebody was looking for this information a while ago. Here is the draft of
an article soon to be published.
The information in this article applies to:
* Microsoft Windows 2000 Driver Development Kit (DDK)

SUMMARY
RunOnce entries are typically used for spawning application one-time only
during system startup or during user logon depending on where it’s added in
the registry. Refer to KB article Q137367. RunOnce entries can be used in
device INF files to invoke external code to run after installation. This
article discusses the limitation of using RunOnce in device INF files.
MORE INFORMATION
If you use RunOnce entries in an INF to invoke external code after
installation, you should restrict the usage to calling rundll32.exe
providing a DLL. This allows the DLL’s to be run during server-side install
of a signed INF. 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.”
Runonce shouldn’t be used to spawn setup or other monitoring application.
This prevents the system from doing server-side install of your device.

During server-side install of a signed INF, RunOnce is not invoked directly,
rather, the device installer (SetupAPI functions) intercepts these registry
entries in the INF and calls the DLL directly as if invoked by rundll32 via
RunOnce.

All RunOnce entries in registry will be executed in the following cases:
At the end of installation via InstallFromHinfSection even in the
cases where a reboot is required.

After default processing of DIF_INSTALLDEVICE even if reboot is
required (with exception of server-side processing).

After the system has been rebooted.

Programs that must be run once when the machine is rebooted should be
specified via RunOnceEx entries.

Note: Instead of using RunOnce, you should try to use coinstaller wherever
possible. That’s the preferred way.
REFERENCES
Q158022


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com