Bewerken

Delen via


DIF_DETECT

A DIF_DETECT request directs an installer to detect non-PnP devices of a particular class and add the devices to the device information set. This request is used for non-PnP devices.

When Sent

When the Add Hardware Wizard is detecting non-PnP devices.

Who Handles

Class Co-installer

Can handle

Device Co-installer

Does not handle

Class Installer

Can handle

Installer Input

DeviceInfoSet
Supplies a handle to the device information set. There is a device setup class associated with the DeviceInfoSet.

DeviceInfoData
None

Device Installation Parameters
There are device installation parameters associated with the DeviceInfoSet.

Class Installation Parameters
An SP_DETECTDEVICE_PARAMS structure is associated with the DeviceInfoSet. The parameters contain a callback routine that the class installer calls to indicate the progress of the detection operation.

Installer Output

DeviceInfoSet
An installer adds a device information element to the DeviceInfoSet for each device it detects, regardless of whether a device was previously detected and installed.

Device Installation Parameters
An installer can modify the device installation parameters for the DeviceInfoSet or for new device information elements it creates.

Installer Return Value

If a co-installer does not detect devices, it returns NO_ERROR from its preprocessing pass. If a co-installer detects devices, it can do so during preprocessing or postprocessing and return NO_ERROR or a Win32 error code.

If a class installer detects devices, it returns NO_ERROR or an appropriate Win32 error code. If a class installer does not handle this DIF request, it returns ERROR_DI_DO_DEFAULT.

Default DIF Code Handler

None

Installer Operation

In response to a DIF_DETECT request an installer can detect devices of its setup class.

If an installer detects devices, it should do at least the following:

  • Call the DetectProgressNotify callback routine in the SP_DETECTDEVICE_PARAMS class installation parameters, if detection will potentially take a noticeable amount of time.

  • For each device the installer detects, it should:

    • Create a device information element (SetupDiCreateDeviceInfo).

    • Provide information for driver selection.

      The installer can manually select the driver for the device or the installer can set the device's hardware ID that Windows will use to find an INF for the device. An installer sets the hardware ID by calling SetupDiSetDeviceRegistryProperty with a Property value of SPDRP_HARDWAREID.

    • Possibly set some device installation parameters.

  • Return NO_ERROR for successful detection or return a Win32 error code.

If one or more installers detects device(s) in response to this DIF code, Windows compares the list of detected devices to its current list of devices. If the installers detected a new device, Windows attempts to install the device. If the installers omitted a device that appears in Setup's list, Windows typically removes the device.

To detect non-PnP devices during GUI-mode setup, an installer must handle the DIF_FIRSTTIMESETUP request. GUI-mode setup does not send a DIF_DETECT request to the installer.

For more information about DIF codes, see Handling DIF Codes.

Requirements

Version

Supported in Microsoft Windows 2000 and later versions of Windows.

Header

Setupapi.h (include Setupapi.h)

See also

DIF_DETECT

DIF_FIRSTTIMESETUP

SetupDiCreateDeviceInfo

SP_DETECTDEVICE_PARAMS

SP_DEVINSTALL_PARAMS