****** 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:
winesync 2024-01-05 22:06:58 +01:00 committed by Hermès Bélusca-Maïto
parent 3bcb3c2839
commit 9529377905
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 13 additions and 20 deletions

View file

@ -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 const WCHAR fmt[] = {'{','%','0','8','X','-','%','0','4','X','-',
@ -1679,9 +1686,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
}
else
{
DeviceInfoData->ClassGuid = *ClassGuid;
DeviceInfoData->DevInst = deviceInfo->dnDevInst;
DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
copy_device_data(DeviceInfoData, deviceInfo);
ret = TRUE;
}
}
@ -1849,9 +1854,7 @@ BOOL WINAPI SetupDiEnumDeviceInfo(
else
{
struct DeviceInfo *DevInfo = CONTAINING_RECORD(ItemList, struct DeviceInfo, ListEntry);
info->ClassGuid = DevInfo->ClassGuid;
info->DevInst = DevInfo->dnDevInst;
info->Reserved = (ULONG_PTR)DevInfo;
copy_device_data(info, DevInfo);
ret = TRUE;
}
}
@ -3109,11 +3112,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
strcpyW(DeviceInterfaceDetailData->DevicePath, devName);
TRACE("DevicePath is %s\n", debugstr_w(DeviceInterfaceDetailData->DevicePath));
if (DeviceInfoData)
{
DeviceInfoData->ClassGuid = deviceInterface->DeviceInfo->ClassGuid;
DeviceInfoData->DevInst = deviceInterface->DeviceInfo->dnDevInst;
DeviceInfoData->Reserved = (ULONG_PTR)deviceInterface->DeviceInfo;
}
copy_device_data(DeviceInfoData, deviceInterface->DeviceInfo);
ret = TRUE;
}
}
@ -4934,11 +4933,7 @@ SetupDiOpenDeviceInfoW(
}
if (ret && deviceInfo && DeviceInfoData)
{
DeviceInfoData->ClassGuid = deviceInfo->ClassGuid;
DeviceInfoData->DevInst = deviceInfo->dnDevInst;
DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
}
copy_device_data(DeviceInfoData, deviceInfo);
}
cleanup:
@ -4973,9 +4968,7 @@ SetupDiGetSelectedDevice(
SetLastError(ERROR_INVALID_USER_BUFFER);
else
{
DeviceInfoData->ClassGuid = list->SelectedDevice->ClassGuid;
DeviceInfoData->DevInst = list->SelectedDevice->dnDevInst;
DeviceInfoData->Reserved = (ULONG_PTR)list->SelectedDevice;
copy_device_data(DeviceInfoData, list->SelectedDevice);
ret = TRUE;
}

View file

@ -5,4 +5,4 @@ files:
dlls/setupapi/misc.c: dll/win32/setupapi/misc.c
dlls/setupapi/stubs.c: dll/win32/setupapi/stubs.c
tags:
wine: 5d7b123d094ba2de40237f310ec43f4b06b560a3
wine: 11d09c299e5df47cadda7473d03a49244c846634