[SETUPAPI] Fix SetupDiDeleteDeviceInfo (#9436)

SetupDiDeleteDeviceInfo always returned FALSE as it used the SP_DEVINFO_DATA structure internally rather than accessing the DeviceInfo structure. Needed for latest XP Nvidia installer.

CORE-20472
This commit is contained in:
Mikhail Tyukin
2026-08-28 20:22:34 -04:00
committed by GitHub
parent 62de6b33a2
commit b0845da65b
2 changed files with 6 additions and 6 deletions

View File

@@ -4999,11 +4999,10 @@ IsDeviceInfoInDeviceInfoSet(
*/
BOOL WINAPI
SetupDiDeleteDeviceInfo(
IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData)
_In_ HDEVINFO DeviceInfoSet,
_In_ PSP_DEVINFO_DATA DeviceInfoData)
{
struct DeviceInfoSet *deviceInfoSet;
struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData;
BOOL ret = FALSE;
TRACE("%s(%p %p)\n", __FUNCTION__, DeviceInfoSet, DeviceInfoData);
@@ -5012,12 +5011,13 @@ SetupDiDeleteDeviceInfo(
SetLastError(ERROR_INVALID_HANDLE);
else if ((deviceInfoSet = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC)
SetLastError(ERROR_INVALID_HANDLE);
else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
else if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(*DeviceInfoData) || !DeviceInfoData->Reserved)
SetLastError(ERROR_INVALID_USER_BUFFER);
else if (!IsDeviceInfoInDeviceInfoSet(deviceInfoSet, deviceInfo))
else if (!IsDeviceInfoInDeviceInfoSet(deviceInfoSet, (struct DeviceInfo *)DeviceInfoData->Reserved))
SetLastError(ERROR_INVALID_PARAMETER);
else
{
struct DeviceInfo *deviceInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
RemoveEntryList(&deviceInfo->ListEntry);
DestroyDeviceInfo(deviceInfo);
ret = TRUE;

View File

@@ -311,7 +311,7 @@
@ stdcall SetupDiCreateDeviceInterfaceRegKeyW(ptr ptr long long ptr ptr)
@ stdcall SetupDiCreateDeviceInterfaceW(ptr ptr ptr wstr long ptr)
@ stdcall SetupDiDeleteDevRegKey(ptr ptr long long long)
@ stdcall SetupDiDeleteDeviceInfo(long ptr)
@ stdcall SetupDiDeleteDeviceInfo(ptr ptr)
@ stdcall SetupDiDeleteDeviceInterfaceData(ptr ptr)
@ stdcall SetupDiDeleteDeviceInterfaceRegKey(ptr ptr long)
@ stdcall SetupDiDestroyClassImageList(ptr)