mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
79 lines
2.7 KiB
Diff
79 lines
2.7 KiB
Diff
From 181e8775404470eef952667261555d960e636585 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
|
Date: Fri, 19 Aug 2016 00:47:08 +0200
|
|
Subject: [PATCH] setupapi: SetupDiGetDeviceInterfaceDetail should fill out
|
|
DeviceInfoData even if the buffer for DeviceInterfaceData is too small.
|
|
|
|
---
|
|
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 93c26ce..b2fc7f8 100644
|
|
--- a/dlls/setupapi/devinst.c
|
|
+++ b/dlls/setupapi/devinst.c
|
|
@@ -2873,9 +2873,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
|
|
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
|
|
@@ -2884,6 +2881,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
|
|
*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;
|
|
}
|
|
|
|
@@ -2943,9 +2944,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
|
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
|
|
@@ -2954,6 +2952,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
|
*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 7d485dd..ba4fe80 100644
|
|
--- a/dlls/setupapi/tests/devinst.c
|
|
+++ b/dlls/setupapi/tests/devinst.c
|
|
@@ -815,6 +815,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 && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
|
+ "Expected ERROR_INSUFFICIENT_BUFFER, got error code: %d\n", GetLastError());
|
|
+ ok(device.DevInst, "Expected DevInst to be set\n");
|
|
+
|
|
heap_free(detail);
|
|
SetupDiDestroyDeviceInfoList(set);
|
|
|
|
--
|
|
1.9.1
|
|
|