mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
79 lines
2.8 KiB
Diff
79 lines
2.8 KiB
Diff
From b0160bd38c99d74d4f9edee766e1247856b443ca 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 fa4036b..42cf5dd 100644
|
|
--- a/dlls/setupapi/devinst.c
|
|
+++ b/dlls/setupapi/devinst.c
|
|
@@ -2819,9 +2819,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
|
|
@@ -2830,6 +2827,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;
|
|
}
|
|
|
|
@@ -2874,9 +2875,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
|
|
@@ -2885,6 +2883,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 38be0a7..f523ef4 100644
|
|
--- a/dlls/setupapi/tests/devinst.c
|
|
+++ b/dlls/setupapi/tests/devinst.c
|
|
@@ -725,6 +725,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
|
|
|