mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
****** Heavily adapted for ReactOS -- TODO: Investigate: Code around copy_device_iface_data may be simplified?
[WINESYNC] setupapi: Merge the InterfaceInfo and InterfaceInstances structs. It seems the original motivation for separating these was to facilitate easy enumeration of specific classes using SetupDiEnumDeviceInterfaces(), but it makes other things unnecessarily complex [including an eventual implementation of SetupDiRemoveDeviceInterface()] and the implementation provided here seems quite simple enough. Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 86d26dded5560d6d8adb195372f0676d1f7229b0 by Zebediah Figura <z.figura12@gmail.com> SYNC NOTE: Only changes applicable to ReactOS have been added: namely, the copy_device_iface_data() inline helper. Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
This commit is contained in:
parent
dc578f4808
commit
334d173305
3 changed files with 16 additions and 21 deletions
|
@ -85,6 +85,14 @@ static inline void copy_device_data(SP_DEVINFO_DATA *data, const struct DeviceIn
|
|||
data->Reserved = (ULONG_PTR)devinfo;
|
||||
}
|
||||
|
||||
static inline void copy_device_iface_data(SP_DEVICE_INTERFACE_DATA *data,
|
||||
const struct DeviceInterface *iface)
|
||||
{
|
||||
data->InterfaceClassGuid = iface->InterfaceClassGuid;
|
||||
data->Flags = iface->Flags;
|
||||
data->Reserved = (ULONG_PTR)iface;
|
||||
}
|
||||
|
||||
static void SETUPDI_GuidToString(const GUID *guid, LPWSTR guidStr)
|
||||
{
|
||||
static const WCHAR fmt[] = {'{','%','0','8','X','-','%','0','4','X','-',
|
||||
|
@ -2866,9 +2874,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
|
|||
if (MemberIndex-- == 0)
|
||||
{
|
||||
/* return this item */
|
||||
DeviceInterfaceData->InterfaceClassGuid = DevItf->InterfaceClassGuid;
|
||||
DeviceInterfaceData->Flags = DevItf->Flags;
|
||||
DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf;
|
||||
copy_device_iface_data(DeviceInterfaceData, DevItf);
|
||||
found = TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
@ -2898,9 +2904,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
|
|||
if (MemberIndex-- == 0)
|
||||
{
|
||||
/* return this item */
|
||||
DeviceInterfaceData->InterfaceClassGuid = DevItf->InterfaceClassGuid;
|
||||
DeviceInterfaceData->Flags = DevItf->Flags;
|
||||
DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf;
|
||||
copy_device_iface_data(DeviceInterfaceData, DevItf);
|
||||
found = TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
@ -3910,19 +3914,13 @@ BOOL WINAPI SetupDiOpenDeviceInterfaceW(
|
|||
if (!wcsicmp(deviceInterface->SymbolicLink, DevicePath))
|
||||
{
|
||||
if (DeviceInterfaceData)
|
||||
{
|
||||
DeviceInterfaceData->Reserved = (ULONG_PTR)deviceInterface;
|
||||
DeviceInterfaceData->Flags = deviceInterface->Flags;
|
||||
CopyMemory(&DeviceInterfaceData->InterfaceClassGuid, &ClassId, sizeof(GUID));
|
||||
}
|
||||
copy_device_iface_data(DeviceInterfaceData, deviceInterface);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dwIndex = 0;
|
||||
do
|
||||
{
|
||||
|
@ -3978,8 +3976,7 @@ BOOL WINAPI SetupDiOpenDeviceInterfaceW(
|
|||
deviceInterface = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInterface) + (wcslen(SymBuffer) + 1) * sizeof(WCHAR));
|
||||
if (deviceInterface)
|
||||
{
|
||||
|
||||
CopyMemory(&deviceInterface->InterfaceClassGuid, &ClassId, sizeof(GUID));
|
||||
deviceInterface->InterfaceClassGuid = ClassId;
|
||||
deviceInterface->DeviceInfo = deviceInfo;
|
||||
deviceInterface->Flags = SPINT_ACTIVE; //FIXME
|
||||
|
||||
|
@ -3988,12 +3985,9 @@ BOOL WINAPI SetupDiOpenDeviceInterfaceW(
|
|||
InsertTailList(&deviceInfo->InterfaceListHead, &deviceInterface->ListEntry);
|
||||
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
|
||||
|
||||
|
||||
if (DeviceInterfaceData)
|
||||
{
|
||||
DeviceInterfaceData->Reserved = (ULONG_PTR)deviceInterface;
|
||||
DeviceInterfaceData->Flags = deviceInterface->Flags;
|
||||
CopyMemory(&DeviceInterfaceData->InterfaceClassGuid, &ClassId, sizeof(GUID));
|
||||
copy_device_iface_data(DeviceInterfaceData, deviceInterface);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -363,8 +363,9 @@ InstallOneInterface(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
DeviceInterfaceData.cbSize = sizeof(DeviceInterfaceData);
|
||||
// copy_device_iface_data(&DeviceInterfaceData, DevItf);
|
||||
DeviceInterfaceData.InterfaceClassGuid = DevItf->InterfaceClassGuid;
|
||||
DeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
|
||||
DeviceInterfaceData.Flags = DevItf->Flags;
|
||||
DeviceInterfaceData.Reserved = (ULONG_PTR)DevItf;
|
||||
|
||||
|
|
|
@ -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: ad9e1883ef558886607037592f48e6c5d216d4e1
|
||||
wine: 86d26dded5560d6d8adb195372f0676d1f7229b0
|
||||
|
|
Loading…
Reference in a new issue