From 61e35141e8dafec355cd8cd96e060a82c0b3155c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 28 Feb 2018 20:14:28 +0100 Subject: [PATCH] [SETUPAPI] Use ClassInstallReserved field instead of Reserved to store a pointer. The Reserved field is ULONG and we need ULONG_PTR. ClassInstallReserved was unused so far. I have no idea whether this is correct, but it cannot be more incorrect than what we had. --- dll/win32/setupapi/devinst.c | 4 ++-- dll/win32/setupapi/driver.c | 22 +++++++++++----------- dll/win32/setupapi/interface.c | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dll/win32/setupapi/devinst.c b/dll/win32/setupapi/devinst.c index f9a307e07ca..e396b5ddfc4 100644 --- a/dll/win32/setupapi/devinst.c +++ b/dll/win32/setupapi/devinst.c @@ -5233,7 +5233,7 @@ SetupDiRegisterCoDeviceInstallers( if (!Result) goto cleanup; - SelectedDriver = (struct DriverInfoElement *)InstallParams.Reserved; + SelectedDriver = (struct DriverInfoElement *)InstallParams.ClassInstallReserved; if (SelectedDriver == NULL) { SetLastError(ERROR_NO_DRIVER_SELECTED); @@ -5436,7 +5436,7 @@ SetupDiInstallDevice( goto cleanup; } - SelectedDriver = (struct DriverInfoElement *)InstallParams.Reserved; + SelectedDriver = (struct DriverInfoElement *)InstallParams.ClassInstallReserved; if (SelectedDriver == NULL) { SetLastError(ERROR_NO_DRIVER_SELECTED); diff --git a/dll/win32/setupapi/driver.c b/dll/win32/setupapi/driver.c index 2b4476df1a0..3ead218522b 100644 --- a/dll/win32/setupapi/driver.c +++ b/dll/win32/setupapi/driver.c @@ -1247,7 +1247,7 @@ SetupDiDestroyDriverInfoList( driverInfo = CONTAINING_RECORD(ListEntry, struct DriverInfoElement, ListEntry); DestroyDriverInfoElement(driverInfo); } - InstallParams.Reserved = 0; + InstallParams.ClassInstallReserved = 0; InstallParams.Flags &= ~(DI_DIDCLASS | DI_MULTMFGS); InstallParams.FlagsEx &= ~DI_FLAGSEX_DIDINFOLIST; ret = SetupDiSetDeviceInstallParamsW(DeviceInfoSet, NULL, &InstallParams); @@ -1265,14 +1265,14 @@ SetupDiDestroyDriverInfoList( { ListEntry = RemoveHeadList(&deviceInfo->DriverListHead); driverInfo = CONTAINING_RECORD(ListEntry, struct DriverInfoElement, ListEntry); - if ((PVOID)InstallParamsSet.Reserved == driverInfo) + if ((PVOID)InstallParamsSet.ClassInstallReserved == driverInfo) { - InstallParamsSet.Reserved = 0; + InstallParamsSet.ClassInstallReserved = 0; SetupDiSetDeviceInstallParamsW(DeviceInfoSet, NULL, &InstallParamsSet); } DestroyDriverInfoElement(driverInfo); } - InstallParams.Reserved = 0; + InstallParams.ClassInstallReserved = 0; InstallParams.Flags &= ~DI_DIDCOMPAT; InstallParams.FlagsEx &= ~DI_FLAGSEX_DIDCOMPATINFO; ret = SetupDiSetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams); @@ -1503,7 +1503,7 @@ SetupDiGetSelectedDriverW( if (SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams)) { struct DriverInfoElement *driverInfo; - driverInfo = (struct DriverInfoElement *)InstallParams.Reserved; + driverInfo = (struct DriverInfoElement *)InstallParams.ClassInstallReserved; if (driverInfo == NULL) SetLastError(ERROR_NO_DRIVER_SELECTED); else @@ -1613,12 +1613,12 @@ SetupDiSetSelectedDriverW( if (DeviceInfoData) { - pDriverInfo = (struct DriverInfoElement **)&((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams.Reserved; + pDriverInfo = (struct DriverInfoElement **)&((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams.ClassInstallReserved; ListHead = &((struct DeviceInfo *)DeviceInfoData->Reserved)->DriverListHead; } else { - pDriverInfo = (struct DriverInfoElement **)&((struct DeviceInfoSet *)DeviceInfoSet)->InstallParams.Reserved; + pDriverInfo = (struct DriverInfoElement **)&((struct DeviceInfoSet *)DeviceInfoSet)->InstallParams.ClassInstallReserved; ListHead = &((struct DeviceInfoSet *)DeviceInfoSet)->DriverListHead; } @@ -2032,7 +2032,7 @@ SetupDiGetDriverInstallParamsW( if (SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams)) { struct DriverInfoElement *driverInfo; - driverInfo = (struct DriverInfoElement *)InstallParams.Reserved; + driverInfo = (struct DriverInfoElement *)InstallParams.ClassInstallReserved; if (driverInfo == NULL) SetLastError(ERROR_NO_DRIVER_SELECTED); else @@ -2106,9 +2106,9 @@ SetupDiInstallDriverFiles( SetLastError(ERROR_INVALID_HANDLE); else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)) SetLastError(ERROR_INVALID_USER_BUFFER); - else if (DeviceInfoData && ((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams.Reserved == 0) + else if (DeviceInfoData && ((struct DeviceInfo *)DeviceInfoData->Reserved)->InstallParams.ClassInstallReserved == 0) SetLastError(ERROR_NO_DRIVER_SELECTED); - else if (!DeviceInfoData && ((struct DeviceInfoSet *)DeviceInfoSet)->InstallParams.Reserved == 0) + else if (!DeviceInfoData && ((struct DeviceInfoSet *)DeviceInfoSet)->InstallParams.ClassInstallReserved == 0) SetLastError(ERROR_NO_DRIVER_SELECTED); else { @@ -2125,7 +2125,7 @@ SetupDiInstallDriverFiles( if (!ret) goto done; - SelectedDriver = (struct DriverInfoElement *)InstallParams.Reserved; + SelectedDriver = (struct DriverInfoElement *)InstallParams.ClassInstallReserved; if (!SelectedDriver) { SetLastError(ERROR_NO_DRIVER_SELECTED); diff --git a/dll/win32/setupapi/interface.c b/dll/win32/setupapi/interface.c index f080d518285..09b84d519a4 100644 --- a/dll/win32/setupapi/interface.c +++ b/dll/win32/setupapi/interface.c @@ -454,7 +454,7 @@ SetupDiInstallDeviceInterfaces( if (!Result) goto cleanup; - SelectedDriver = (struct DriverInfoElement *)InstallParams.Reserved; + SelectedDriver = (struct DriverInfoElement *)InstallParams.ClassInstallReserved; if (SelectedDriver == NULL) { SetLastError(ERROR_NO_DRIVER_SELECTED); -- 2.17.1