Writing Class Installers and Co-Installers
For more information about how to write a co-installer, see Writing a Co-installer.
For more information about how to write a class installer, see Writing a Class Installer.
Device installation mostly runs in a system (noninteractive) service. Therefore, a user cannot see or respond to any user interface that appears in this context. Any dialog box that is provided in a class installer or co-installer during the processing of a device installation function (DIF) code causes the device installation to stop responding.
In most cases, class installers and co-installers should not interact with the user except during the processing of a finish-install wizard or, starting with Windows Vista, finish-install action. Finish-install wizards and actions are run in an interactive context.
Note Class installers and co-installers should not fail a DIF code with ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION because that causes the device installation to fail. If the device installation requires user interaction, class installers and co-installers should support either a finish-install wizard or finish-install action.
Do not save device installation state within the class installer or co-installer dynamic-link library (DLL). Because Windows generally unloads the DLL after a DIF code is handled by the installer, any state information that is saved within the DLL would not persist.
To safely preserve device installer state, class installers or co-installers should save the state information as properties within the device?s driver key in the registry. To do this, follow these steps:
Use SetupDiSetDeviceProperty to save the device instance property key.
If your class installer or co-installer attempts to load an unsigned executable file or DLL on a Windows 64-bit platform, the operating systems prevents it from being loaded in this secure environment.
To safely load an executable file or DLL by a class installer or co-installer, we highly recommended that the executable file or DLL is included in your digitally signed driver package. For more information about how to sign driver packages, see Driver Signing.
Note Class installers and co-installers must not load DLL modules by explicit function calls, such as LoadLibrary, or by creating link dependencies.
During device installation, Windows cannot track additional processes and is unable to determine what they are doing or when they are finished. For example, Windows could start or stop the device or initiate a system restart while the process is performing a critical action.
In most cases, class installers and co-installers should not start other processes or services. However, installers can start other processes safely by calling CreateProcess from a function of dialog that is displayed through a finish-install wizard or, starting with Windows Vista, finish-install action. The installer must not let the user continue in the dialog procedure until the created process has finished.