BOOLEAN
SetupDiCreateDeviceInfo(
IN HDEVINFO DeviceInfoSet,
IN PCTSTR DeviceName,
IN LPGUID ClassGuid,
IN PCTSTR DeviceDescription, /* optional */
IN HWND hwndParent, /* optional */
IN DWORD CreationFlags,
OUT PSP_DEVINFO_DATA DeviceInfoData /* optional */
);
SetupDiCreateDeviceInfo creates a new device information element and adds it as a new member to the specified device information set.
Enum\Root\DeviceName\InstanceID
where InstanceID is a four-digit, base-10 number that is unique
among all subkeys under Enum\Root\DeviceName. Call SetupDiGetDeviceInstanceId
to find out what ID was generated for this device information element.
The function returns TRUE if it is successful. Otherwise it returns FALSE and the logged error can be retrieved with a call to GetLastError.
If this device instance is being added to a set that has an associated class, the device class must be the same or the call fails. In this case, a call to GetLastError returns ERROR_CLASS_MISMATCH.
If the specified device instance is the same as an existing device instance key in the registry, the call fails. In this case, a call to GetLastError returns ERROR_DEVINST_ALREADY_EXISTS. This occurs only if the DCID_GENERATE_ID flag is not set.
If the new device information element was successfully created but the caller-supplied DeviceInfoData buffer is invalid, the function returns FALSE. In this case, a call to GetLastError returns ERROR_INVALID_USER_BUFFER. However, the device information element will have been added as a new member of the set already.
SetupDiDeleteDeviceInfo, SetupDiEnumDeviceInfo, SetupDiOpenDeviceInfo