How Finish-Install Actions are Processed
Finish-install actions for a device are processed in the same way by an installer (a class installer, class co-installer, or device co-installer), regardless of how device installation is achieved. For example, devices that are installed by inserting hardware into the computer (hardware-first installation) or by software from the user-mode context (Found New Hardware Wizard, Update Driver Software, or a program that calls a device installation function) are processed the same way.
Finish-install actions for a device run after all other installation operations are finished and the device has been started. These installation operations include core device installation (also known as server-side installation), in which the driver for the device is installed and loaded by the system's Plug and Play (PnP) manager components. Also, all finish-install wizard pages that are provided by the installers for the device have been shown to the user.
Windows processes finish-install actions based on the following system-supplied items:
The DI_FLAGSEX_FINISHINSTALL_ACTION device installation flag.
The device is flagged to perform a finish install action..
Windows completes the following steps to processes an installer's finish-install actions:
DIF_NEWDEVICEWIZARD_FINISHINSTALL is the only DIF code that is sent in both the context of core device installation and in the client context. Therefore, a class installer, class co-installer, or device co-installer must indicate that it has finish-install actions during DIF_NEWDEVICEWIZARD_FINISHINSTALL processing, instead of during DIF_INSTALLDEVICE processing.
If an installer provides finish-install actions, it sets the DIF_FLAGSEX_FINISHINSTALL_ACTION flag in response to a DIF_NEWDEVICEWIZARD_FINISHINSTALL request. If the DIF_FLAGSEX_FINISHINSTALL_ACTION flag is set after all the installers have processed a DIF_NEWDEVICEWIZARD_FINISHINSTALL request, the device is flagged to perform a finish install action.
For more information about this operation, see Marking a Device as Needing to Perform a Finish Install Action.
After core device installation is complete for a device, Windows checks whether the device has been flagged to perform a finish install action. If it has, Windows queues a finish-install process that performs the finish-install actions specific to the device. The process executes in the user's context.
The finish-install process runs only in the context of a user with administrator credentials at one of the following times:
- The next time that a user who has administrator credentials logs on while the device is attached.
- When the device is reattached.
- When the user selects Scan for hardware changes in Device Manager.
If a user is logged on without administrative privileges, Windows prompts the user for consent and credentials to run the finish-install actions in an administrator context.
If the device has been flagged to perform a finish install action, the finish-install process starts and completes any finish-install wizard pages for the device, and then calls SetupDiCallClassInstaller to send a DIF_FINISHINSTALL_ACTION request to all installers for the device, as described in Running Finish-Install Actions.
After the installers have completed their finish-install actions, Windows runs the default finish-install action, as described in Running the Default Finish-Install Action.
Build date: 5/16/2013