From: Michael Müller michael@fds-team.de
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 14 ++++++++------ dlls/setupapi/tests/devinst.c | 7 +++++++ 2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index c1e1251cdc..fbc8900229 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -2653,9 +2653,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(HDEVINFO devinfo, SP_DEVICE_INTERFA else DeviceInterfaceDetailData->DevicePath[0] = '\0';
- if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA)) - copy_device_data(device_data, iface->device); - ret = TRUE; } else @@ -2664,6 +2661,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(HDEVINFO devinfo, SP_DEVICE_INTERFA *RequiredSize = bytesNeeded; SetLastError(ERROR_INSUFFICIENT_BUFFER); } + + if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA)) + copy_device_data(device_data, iface->device); + return ret; }
@@ -2708,9 +2709,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO devinfo, SP_DEVICE_INTERFA else DeviceInterfaceDetailData->DevicePath[0] = '\0';
- if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA)) - copy_device_data(device_data, iface->device); - ret = TRUE; } else @@ -2719,6 +2717,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO devinfo, SP_DEVICE_INTERFA *RequiredSize = bytesNeeded; SetLastError(ERROR_INSUFFICIENT_BUFFER); } + + if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA)) + copy_device_data(device_data, iface->device); + return ret; }
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index b73af781d1..886957fe19 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -764,6 +764,13 @@ static void test_device_iface_detail(void) ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError()); ok(size == expectedsize, "Got unexpected size %d.\n", size);
+ memset(&device, 0, sizeof(device)); + device.cbSize = sizeof(device); + ret = SetupDiGetDeviceInterfaceDetailW(set, &iface, NULL, 0, &size, &device); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError()); + ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid)); + heap_free(detail); SetupDiDestroyDeviceInfoList(set); }