2018-11-22 16:24:39 -08:00
|
|
|
From 181e8775404470eef952667261555d960e636585 Mon Sep 17 00:00:00 2001
|
2016-08-20 14:26:28 -07:00
|
|
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
|
|
|
Date: Fri, 19 Aug 2016 00:47:08 +0200
|
2018-11-22 16:24:39 -08:00
|
|
|
Subject: [PATCH] setupapi: SetupDiGetDeviceInterfaceDetail should fill out
|
2016-08-20 14:26:28 -07:00
|
|
|
DeviceInfoData even if the buffer for DeviceInterfaceData is too small.
|
|
|
|
|
|
|
|
---
|
2018-08-16 21:11:33 -07:00
|
|
|
dlls/setupapi/devinst.c | 14 ++++++++------
|
2018-11-22 16:24:39 -08:00
|
|
|
dlls/setupapi/tests/devinst.c | 7 +++++++
|
|
|
|
2 files changed, 15 insertions(+), 6 deletions(-)
|
2016-08-20 14:26:28 -07:00
|
|
|
|
|
|
|
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
|
2018-11-22 16:24:39 -08:00
|
|
|
index 93c26ce..b2fc7f8 100644
|
2016-08-20 14:26:28 -07:00
|
|
|
--- a/dlls/setupapi/devinst.c
|
|
|
|
+++ b/dlls/setupapi/devinst.c
|
2018-11-22 16:24:39 -08:00
|
|
|
@@ -2873,9 +2873,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
|
2016-08-20 14:26:28 -07:00
|
|
|
else
|
|
|
|
DeviceInterfaceDetailData->DevicePath[0] = '\0';
|
2018-08-16 21:11:33 -07:00
|
|
|
|
|
|
|
- if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
|
|
|
|
- copy_device_data(device_data, iface->device);
|
|
|
|
-
|
2016-08-20 14:26:28 -07:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
else
|
2018-11-22 16:24:39 -08:00
|
|
|
@@ -2884,6 +2881,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
|
2016-08-20 14:26:28 -07:00
|
|
|
*RequiredSize = bytesNeeded;
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
}
|
2018-08-16 21:11:33 -07:00
|
|
|
+
|
|
|
|
+ if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
|
|
|
|
+ copy_device_data(device_data, iface->device);
|
|
|
|
+
|
2016-08-20 14:26:28 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-11-22 16:24:39 -08:00
|
|
|
@@ -2943,9 +2944,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
2016-08-20 14:26:28 -07:00
|
|
|
else
|
|
|
|
DeviceInterfaceDetailData->DevicePath[0] = '\0';
|
2018-08-16 21:11:33 -07:00
|
|
|
|
|
|
|
- if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
|
|
|
|
- copy_device_data(device_data, iface->device);
|
|
|
|
-
|
2016-08-20 14:26:28 -07:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
else
|
2018-11-22 16:24:39 -08:00
|
|
|
@@ -2954,6 +2952,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
2016-08-20 14:26:28 -07:00
|
|
|
*RequiredSize = bytesNeeded;
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
}
|
2018-08-16 21:11:33 -07:00
|
|
|
+
|
|
|
|
+ if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
|
|
|
|
+ copy_device_data(device_data, iface->device);
|
|
|
|
+
|
2016-08-20 14:26:28 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
|
2018-11-22 16:24:39 -08:00
|
|
|
index 7d485dd..ba4fe80 100644
|
2016-08-20 14:26:28 -07:00
|
|
|
--- a/dlls/setupapi/tests/devinst.c
|
|
|
|
+++ b/dlls/setupapi/tests/devinst.c
|
2018-11-22 16:24:39 -08:00
|
|
|
@@ -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);
|
|
|
|
|
2016-08-20 14:26:28 -07:00
|
|
|
--
|
2018-11-22 16:24:39 -08:00
|
|
|
1.9.1
|
2016-08-20 14:26:28 -07:00
|
|
|
|