DIF_REGISTERDEVICE

The DIF_REGISTERDEVICE request allows an installer to participate in registering a newly created device instance with the PnP manager. Windows sends this DIF request for non-PnP devices.

When Sent

When an installer reports a previously unknown device in response to a DIF_DETECT request. Windows sends this DIF request in the analyze phase of the Add Hardware Wizard before it installs the device. Windows also sends this request during non-PnP detection.

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 that contains the device.

DeviceInfoData
Supplies a pointer to an SP_DEVINFO_DATA structure that identifies the device in the device information set.

Device Installation Parameters
There are device installation parameters (SP_DEVINSTALL_PARAMS) associated with the DeviceInfoData.

Class Installation Parameters
None

Installer Output

None

Installer Return Value

A co-installer can return NO_ERROR or a Win32 error code. A co-installer should not return ERROR_DI_POSTPROCESSING_REQUIRED for this DIF request.

If an installer determines that the device is a duplicate it returns ERROR_DUPLICATE_FOUND.

If a class installer successfully handles this request and SetupDiCallClassInstaller should subsequently call the default handler, the class installer returns ERROR_DI_DO_DEFAULT.

If the class installer successfully handles this request, including directly calling the default handler, the class installer should return NO_ERROR and SetupDiCallClassInstaller will not subsequently call the default handler again.

Note  The class installer can directly call the default handler, but the class installer should never attempt to supersede the operations of the default handler.

For more information about calling the default handler, see Calling Default DIF Code Handlers.

If the class installer encounters an error, the installer should return an appropriate Win32 error code and SetupDiCallClassInstaller will not subsequently call the default handler.

If the installer determines that the device is a duplicate, the installer returns ERROR_DUPLICATE_FOUND.

Default DIF Code Handler

SetupDiRegisterDeviceInfo

Installer Operation

A device installation application typically sends this DIF request to register a non-PnP device with the PnP manager. Starting with Microsoft Windows 2000, non-PnP devices must be registered before they can be installed.

An installer typically handles this DIF request to do duplicate detection. Such an installer typically calls the default handler (SetupDiRegisterDeviceInfo) and specifies its detection routine. If the registration is successful and the installer determines that the device is not a duplicate, the installer returns NO_ERROR.

A co-installer should perform any operations to handle this DIF request in its preprocessing pass. When the co-installer is called for postprocessing, the device instance has already been registered by either the class installer or the default handler.

If an installer returns an error for this DIF code, typically ERROR_DUPLICATE_FOUND, Windows deletes the device from the device information set.

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

SetupDiRegisterDeviceInfo

SP_DEVINFO_DATA

SP_DEVINSTALL_PARAMS