Rebase against ccf6211c0ae6e86218f7e6c1f2fe725a23e568b9.

This commit is contained in:
Zebediah Figura
2018-08-16 23:11:33 -05:00
parent 06c1bde586
commit 93e4c328d7
20 changed files with 142 additions and 955 deletions

View File

@@ -1,59 +1,65 @@
From 687fc3ff0c5ea37f782bd0f02c7fe856cab583a5 Mon Sep 17 00:00:00 2001
From e9a6546ce13c09f63a180aceb7181d8145c120d3 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: setupapi: SetupDiGetDeviceInterfaceDetail should fill out
DeviceInfoData even if the buffer for DeviceInterfaceData is too small.
---
dlls/setupapi/devinst.c | 8 ++++----
dlls/setupapi/tests/devinst.c | 6 +++++-
2 files changed, 9 insertions(+), 5 deletions(-)
dlls/setupapi/devinst.c | 14 ++++++++------
dlls/setupapi/tests/devinst.c | 6 +++++-
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 02e75b6..4dac40d 100644
index 9f77669..f8c347b 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -2956,8 +2956,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
NULL, NULL);
@@ -2844,9 +2844,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
else
DeviceInterfaceDetailData->DevicePath[0] = '\0';
- if (DeviceInfoData && DeviceInfoData->cbSize == sizeof(SP_DEVINFO_DATA))
- *DeviceInfoData = *info->device;
- if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
- copy_device_data(device_data, iface->device);
-
ret = TRUE;
}
else
@@ -2966,6 +2964,8 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
@@ -2855,6 +2852,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
*RequiredSize = bytesNeeded;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
}
+ if (DeviceInfoData && DeviceInfoData->cbSize == sizeof(SP_DEVINFO_DATA))
+ *DeviceInfoData = *info->device;
+
+ if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
+ copy_device_data(device_data, iface->device);
+
return ret;
}
@@ -3024,8 +3024,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
lstrcpyW(DeviceInterfaceDetailData->DevicePath, info->symbolicLink);
@@ -2914,9 +2915,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
else
DeviceInterfaceDetailData->DevicePath[0] = '\0';
- if (DeviceInfoData && DeviceInfoData->cbSize == sizeof(SP_DEVINFO_DATA))
- *DeviceInfoData = *info->device;
- if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
- copy_device_data(device_data, iface->device);
-
ret = TRUE;
}
else
@@ -3034,6 +3032,8 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
@@ -2925,6 +2923,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
*RequiredSize = bytesNeeded;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
}
+ if (DeviceInfoData && DeviceInfoData->cbSize == sizeof(SP_DEVINFO_DATA))
+ *DeviceInfoData = *info->device;
+
+ 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 319bb31..d349917 100644
index 9a8ecbc..187e022 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -833,6 +833,7 @@ static void testGetDeviceInterfaceDetail(void)
@@ -674,6 +674,7 @@ static void testGetDeviceInterfaceDetail(void)
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
static const char path_w2k[] =
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\";
@@ -61,7 +67,7 @@ index 319bb31..d349917 100644
LPBYTE buf = HeapAlloc(GetProcessHeap(), 0, size);
SP_DEVICE_INTERFACE_DETAIL_DATA_A *detail =
(SP_DEVICE_INTERFACE_DETAIL_DATA_A *)buf;
@@ -860,9 +861,12 @@ static void testGetDeviceInterfaceDetail(void)
@@ -701,9 +702,12 @@ static void testGetDeviceInterfaceDetail(void)
!lstrcmpiA(path_w2k, detail->DevicePath), "Unexpected path %s\n",
detail->DevicePath);
/* Check SetupDiGetDeviceInterfaceDetailW */
@@ -76,5 +82,5 @@ index 319bb31..d349917 100644
(expectedsize + sizeof(WCHAR)) == size /* W2K adds a backslash */,
"SetupDiGetDeviceInterfaceDetailW returned wrong reqsize, got %d\n",
--
2.9.0
2.7.4