BOOLEAN
SetupDiRegisterDeviceInfo(
IN HDEVINFO DeviceInfoSet,
IN OUT PSP_DEVINFO_DATA DeviceInfoData,
IN DWORD Flags,
IN PSP_DETSIG_CMPPROC CompareProc, /* optional */
IN PVOID CompareContext, /* optional */
OUT PSP_DEVINFO_DATA DupDeviceInfoData /* optional */
);
SetupDiRegisterDeviceInfo registers a device instance with the Plug and Play Manager.
typedef DWORD (CALLBACK* PSP_DETSIG_CMPPROC) (
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA NewDeviceData,
IN PSP_DEVINFO_DATA ExistingDeviceData,
IN PVOID CompareContext /* optional */
);
The compare function must return ERROR_DUPLICATE_FOUND if it finds that the two devices are duplicates. Otherwise it should return NO_ERROR. If some other error is encountered, the callback function should return the appropriate ERROR_* code to indicate the failure.
If CompareProc is not specified and duplication detection is requested,
a default comparison behavior is used. The default is to compare the new
device’s detect signature with the detect signature of all other devices in
the class. The detect signature is contained in the class-specific resource
descriptor of the device’s bootlog configuration.
The function returns TRUE if it is successful. Otherwise it returns FALSE and the logged error can be retrieved with a call to GetLastError.
After registering a device information element, the caller should refresh any stored copies of the DevInst handle associated with this device. This is necessary because the handle value might have changed during registration. The caller need not retrieve the SP_DEVINFO_DATA structure again because the DevInst field of the structure is updated to reflect the current value of the handle. The SP_DEVINSTALL_PARAMS structure should be retrieved because registering a device information element may require a system reboot (if the DI_NEEDREBOOT flag is set).