HWPnP WinBuilder Script
This is a winbuilder script to install my HWPnP utility which is used to detect and install devices which currently have no driver installed. By default it will install devices with device ids that start with:
- PCI\VEN
- ACPI_HAL\
- ACPI\
- IDE\
- PCIIDE\
- ISAPNP\
- LPTENUM\
- ROOT\ACPI
- ROOT\DMIO
- ROOT\SYSTEM
- SERENUM\
- STORAGE\
- SW\
- USB\
- USBSTOR\
If the installation of a device results in the popup of the 'Found New Device' dialog then the <next> and <finish> buttons will automatically be clicked so that no user intervention is required for device detection to continue. The buttons are identified in the dialog by looking for controls with particular control ids so hopefully this will work in all languages. Its only been tested in US English.
Note that under XP you can find the device ids of installed devices by setting the environment variable DEVMGR_SHOW_DETAILS=1. Then In Device Manager the properties for a device should now provide a Details tab that contains additional information about the device. Another way to obtain the current device ids from XP is to run the HWPnP program but specify the following parameters:
HWPnP -all /logcon
The program is called as follows:
HWPnP {+all|-all} {+<DeviceID_0>|+<@Class_0>| -<DeviceID_0>|-<@Class_0>| =<DeviceID_0>|=<@Class_0>} ... {+<DeviceID_N>|+<@Class_N>| -<DeviceID_0>|-<@Class_N>| =<DeviceID_0>|=<@Class_N>} {/a} {/cid} {/d|/d+} {/dp=<DrivePath>} {/h} {/hid} {/n} {/nf} {/log|/log+|/logcon} {/p} {/r} {/rs} {/s} {/u} {/v=<offset>}
If +all is specified then all devices, which currently do not have a device driver loaded and for which a device driver is available, will have an attempt made to load the driver.
If -all is specified then all built in device id strings will be removed and only devices which match device ids specified in program parameters will have their device drivers loaded. If this parameter is used then it should precede any explicit device id parameters.
The <DeviceID_N> can be the device id or part of the device ID e.g. ROOT\DMIO.
The <@Class_N> is the name of a device class e.g. NET.
If +<DeviceID_N> is specified then any device with a device id that starts with the specified string will be attempted to have its device driver loaded. The device driver will only be attempted to be loaded if the device status reports that the device is not currently running.
If +<@Class_N> is specified then any device with a device class that is equal to the specified string will be attempted to have its device driver loaded. The device driver will only be attempted to be loaded if the device status reports that the device is not currently running.
If =<DeviceID_N> is specified then any device with a device id that starts with the specified string will be attempted to have its device driver loaded regardless of the current status of the device. This option should be used carefully as most of the system devices require a reboot ( which obviously in PE will not work ) to start the device driver and in some cause a machine lockup if any attempt is made to start them.
If =<@Class_N> is specified then any device with a device class that is equal to the specified string will be attempted to have its device driver loaded regardless of the current status of the device. This option should be used carefully as most of the system devices require a reboot ( which obviously in PE will not work ) to start the device driver and in some cause a machine lockup if any attempt is made to start them.
If -<DeviceID_N> is specified then any device with a device id that starts with the specified string is excluded from the list of devices which may have their device driver loaded. Usually this will be used in conjunction with the +all option but it may also be used to eliminate some of the built in device id prefixes.
If -<@Class_N> is specified then any device with a device class that is equal to the specified string is excluded from the list of devices which may have their device driver loaded. Usually this will be used in conjunction with the +all option.
So for example if you wanted to disable installation of device ids that started with ROOT\ACPI or ROOT\DMIO and you wanted to add installation of device ids that start with ROOT\MEDIA you would call the program by:
HWPnP -ROOT\ACPI -ROOT\DMIO +ROOT\MEDIA
If you wanted to install all devices except devices of class NET then you would call the program by:
HWPnP +all -@NET
If /log is specified then the diagnostic trace information will be logged to %ramdrv%\HWPnP.log.
If /log+ is specified then the diagnostic trace information will be appended to %ramdrv%\HWPnP.log.
If /logcon is specified then the diagnostic tracing will be logged to a new console. When the hardware scan finishes the program will wait for user input before closing the console.
If /a is specified then the devices will be rescanned until no new devices are installed. I use the following command for installing new USB storage devices:
HWPnP.exe -all /log /p +STORAGE\VOLUME +USB\ +USBSTOR\ /a /u
If /cid is specified then compatible device identifiers for a device will be scanned when searching for a device id match.
If /d is specified then driver signing is suppressed by updating the registry with the appropriate values. Note this only works after at least one device is installed e.g. if networking is installed prior to running HWPnP then /d should suppress any further driver signing popups.
If /dp=<DriverPath> is specified then the SetupDiSetDeviceInstallParams API is used to set the driver install path to the specified value.
If /d+ is specified then driver signing is suppressed by updating the registry with the appropriate values after installing one device.
If /h is specified then any "Found New Device"
dialogs that appear will be hidden ( they will very briefly appear )
- should not be used - it will cause HWPnP to hang.
If /hid is specified then all hardware identifiers
for a device will be scanned when searching for a device id match.
If /n is specified then the background message hook is disabled. This is used to automatically dismiss dialogs that appear during the driver install. These are supressed by a registry setting ( MinimizeFootprint ) these days.
If /nf is specified then FindFile interception is suppressed. FindFile interception is used to limit searching to the windows inf directory.
If /p is specified then a progress dialog box will be displayed which is very similar to the one displayed by the Sherpya AutoRamResizer program. It will show the device id of devices as they are enumerated.
If /r is specified then the SystemSetupInProgress registry flag will be cleared before performing the plug and play detection scan. If will be reset back to 1 after the scan is performed.
If /rs is specified then this forces a rescan ( CM_Reenumerate_DevNode_Ex ) after a pass that installs a driver. I found this was necessary on win7pe when installing the MS Nvidia drivers to ensure that the monitor was redetected so that all resolutions were available.
If /s is specified then setupapi logging to the ram drive will be enabled prior to hardware detection.If /u is specified then any 'unknown devices' will have an attempt made to load a device driver. This option should be used with care - a lock up may result. Note that some of the devices require a reboot to become fully operational ( of course in the context of PE this will have no effect).
If /v=<Offset> is specified then this specifies the vertical offset from the center of the screen used to show the installation progress dialog. This is used if hwpnp is launched from a loader program that displays a dialog in the center of the screen. I use a 100 but you will need to experiment to get a value that works for you.
Note the load of network adaptors will fail unless netcfgx.dll is registered first with regsvr32.