mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
****** Heavily adapted for ReactOS
[WINESYNC] setupapi: Don't use SP_DEVINFO_DATA in internal structs. And especially don't use a pointer to one, since there's no guarantee it'll remain stable. Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 11d09c299e5df47cadda7473d03a49244c846634 by Zebediah Figura <z.figura12@gmail.com> SYNC NOTE: Only changes applicable to ReactOS have been added: namely, the copy_device_data() inline helper. Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
This commit is contained in:
parent
3bcb3c2839
commit
9529377905
|
@ -78,6 +78,13 @@ struct GetSectionCallbackInfo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static inline void copy_device_data(SP_DEVINFO_DATA *data, const struct DeviceInfo *devinfo)
|
||||||
|
{
|
||||||
|
data->ClassGuid = devinfo->ClassGuid;
|
||||||
|
data->DevInst = devinfo->dnDevInst;
|
||||||
|
data->Reserved = (ULONG_PTR)devinfo;
|
||||||
|
}
|
||||||
|
|
||||||
static void SETUPDI_GuidToString(const GUID *guid, LPWSTR guidStr)
|
static void SETUPDI_GuidToString(const GUID *guid, LPWSTR guidStr)
|
||||||
{
|
{
|
||||||
static const WCHAR fmt[] = {'{','%','0','8','X','-','%','0','4','X','-',
|
static const WCHAR fmt[] = {'{','%','0','8','X','-','%','0','4','X','-',
|
||||||
|
@ -1679,9 +1686,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DeviceInfoData->ClassGuid = *ClassGuid;
|
copy_device_data(DeviceInfoData, deviceInfo);
|
||||||
DeviceInfoData->DevInst = deviceInfo->dnDevInst;
|
|
||||||
DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1849,9 +1854,7 @@ BOOL WINAPI SetupDiEnumDeviceInfo(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct DeviceInfo *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
|
struct DeviceInfo *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
|
||||||
info->ClassGuid = DevInfo->ClassGuid;
|
copy_device_data(info, DevInfo);
|
||||||
info->DevInst = DevInfo->dnDevInst;
|
|
||||||
info->Reserved = (ULONG_PTR)DevInfo;
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3109,11 +3112,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
||||||
strcpyW(DeviceInterfaceDetailData->DevicePath, devName);
|
strcpyW(DeviceInterfaceDetailData->DevicePath, devName);
|
||||||
TRACE("DevicePath is %s\n", debugstr_w(DeviceInterfaceDetailData->DevicePath));
|
TRACE("DevicePath is %s\n", debugstr_w(DeviceInterfaceDetailData->DevicePath));
|
||||||
if (DeviceInfoData)
|
if (DeviceInfoData)
|
||||||
{
|
copy_device_data(DeviceInfoData, deviceInterface->DeviceInfo);
|
||||||
DeviceInfoData->ClassGuid = deviceInterface->DeviceInfo->ClassGuid;
|
|
||||||
DeviceInfoData->DevInst = deviceInterface->DeviceInfo->dnDevInst;
|
|
||||||
DeviceInfoData->Reserved = (ULONG_PTR)deviceInterface->DeviceInfo;
|
|
||||||
}
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4934,11 +4933,7 @@ SetupDiOpenDeviceInfoW(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret && deviceInfo && DeviceInfoData)
|
if (ret && deviceInfo && DeviceInfoData)
|
||||||
{
|
copy_device_data(DeviceInfoData, deviceInfo);
|
||||||
DeviceInfoData->ClassGuid = deviceInfo->ClassGuid;
|
|
||||||
DeviceInfoData->DevInst = deviceInfo->dnDevInst;
|
|
||||||
DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -4973,9 +4968,7 @@ SetupDiGetSelectedDevice(
|
||||||
SetLastError(ERROR_INVALID_USER_BUFFER);
|
SetLastError(ERROR_INVALID_USER_BUFFER);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DeviceInfoData->ClassGuid = list->SelectedDevice->ClassGuid;
|
copy_device_data(DeviceInfoData, list->SelectedDevice);
|
||||||
DeviceInfoData->DevInst = list->SelectedDevice->dnDevInst;
|
|
||||||
DeviceInfoData->Reserved = (ULONG_PTR)list->SelectedDevice;
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,4 +5,4 @@ files:
|
||||||
dlls/setupapi/misc.c: dll/win32/setupapi/misc.c
|
dlls/setupapi/misc.c: dll/win32/setupapi/misc.c
|
||||||
dlls/setupapi/stubs.c: dll/win32/setupapi/stubs.c
|
dlls/setupapi/stubs.c: dll/win32/setupapi/stubs.c
|
||||||
tags:
|
tags:
|
||||||
wine: 5d7b123d094ba2de40237f310ec43f4b06b560a3
|
wine: 11d09c299e5df47cadda7473d03a49244c846634
|
||||||
|
|
Loading…
Reference in a new issue