mirror of
https://github.com/reactos/wine.git
synced 2025-02-18 03:48:01 +00:00
setupapi: When enumerating an interface, add the interface to its device.
This commit is contained in:
parent
be863b07ff
commit
50a4039037
@ -85,6 +85,7 @@ static const WCHAR UINumber[] = {'U','I','N','u','m','b','e','r',0};
|
|||||||
static const WCHAR UpperFilters[] = {'U','p','p','e','r','F','i','l','t','e','r','s',0};
|
static const WCHAR UpperFilters[] = {'U','p','p','e','r','F','i','l','t','e','r','s',0};
|
||||||
static const WCHAR LowerFilters[] = {'L','o','w','e','r','F','i','l','t','e','r','s',0};
|
static const WCHAR LowerFilters[] = {'L','o','w','e','r','F','i','l','t','e','r','s',0};
|
||||||
static const WCHAR Phantom[] = {'P','h','a','n','t','o','m',0};
|
static const WCHAR Phantom[] = {'P','h','a','n','t','o','m',0};
|
||||||
|
static const WCHAR SymbolicLink[] = {'S','y','m','b','o','l','i','c','L','i','n','k',0};
|
||||||
|
|
||||||
/* is used to identify if a DeviceInfoSet pointer is
|
/* is used to identify if a DeviceInfoSet pointer is
|
||||||
valid or not */
|
valid or not */
|
||||||
@ -103,6 +104,7 @@ struct DeviceInfoSet
|
|||||||
struct InterfaceInfo
|
struct InterfaceInfo
|
||||||
{
|
{
|
||||||
LPWSTR referenceString;
|
LPWSTR referenceString;
|
||||||
|
LPWSTR symbolicLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A device may have multiple instances of the same interface, so this holds
|
/* A device may have multiple instances of the same interface, so this holds
|
||||||
@ -137,6 +139,7 @@ static void SETUPDI_FreeInterfaceInstances(struct InterfaceInstances *instances)
|
|||||||
(struct InterfaceInfo *)instances->instances[i].Reserved;
|
(struct InterfaceInfo *)instances->instances[i].Reserved;
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, ifaceInfo->referenceString);
|
HeapFree(GetProcessHeap(), 0, ifaceInfo->referenceString);
|
||||||
|
HeapFree(GetProcessHeap(), 0, ifaceInfo->symbolicLink);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, instances->instances);
|
HeapFree(GetProcessHeap(), 0, instances->instances);
|
||||||
}
|
}
|
||||||
@ -282,6 +285,7 @@ static BOOL SETUPDI_AddInterfaceInstance(struct DeviceInfo *devInfo,
|
|||||||
if (ifaceInfo)
|
if (ifaceInfo)
|
||||||
{
|
{
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
ifaceInfo->symbolicLink = NULL;
|
||||||
if (ReferenceString)
|
if (ReferenceString)
|
||||||
{
|
{
|
||||||
ifaceInfo->referenceString =
|
ifaceInfo->referenceString =
|
||||||
@ -333,6 +337,26 @@ static BOOL SETUPDI_AddInterfaceInstance(struct DeviceInfo *devInfo,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL SETUPDI_SetInterfaceSymbolicLink(SP_DEVICE_INTERFACE_DATA *iface,
|
||||||
|
LPCWSTR symbolicLink)
|
||||||
|
{
|
||||||
|
struct InterfaceInfo *info = (struct InterfaceInfo *)iface->Reserved;
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
if (info)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, info->symbolicLink);
|
||||||
|
info->symbolicLink = HeapAlloc(GetProcessHeap(), 0,
|
||||||
|
(lstrlenW(symbolicLink) + 1) * sizeof(WCHAR));
|
||||||
|
if (info->symbolicLink)
|
||||||
|
{
|
||||||
|
lstrcpyW(info->symbolicLink, symbolicLink);
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(LPCWSTR instanceId,
|
static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(LPCWSTR instanceId,
|
||||||
BOOL phantom)
|
BOOL phantom)
|
||||||
{
|
{
|
||||||
@ -1692,6 +1716,44 @@ end:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SETUPDI_AddDeviceInterfaces(SP_DEVINFO_DATA *dev, HKEY key,
|
||||||
|
const GUID *interface)
|
||||||
|
{
|
||||||
|
struct DeviceInfo *devInfo = (struct DeviceInfo *)dev->Reserved;
|
||||||
|
DWORD i, len;
|
||||||
|
WCHAR subKeyName[MAX_PATH];
|
||||||
|
LONG l = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
for (i = 0; !l; i++)
|
||||||
|
{
|
||||||
|
len = sizeof(subKeyName) / sizeof(subKeyName[0]);
|
||||||
|
l = RegEnumKeyExW(key, i, subKeyName, &len, NULL, NULL, NULL, NULL);
|
||||||
|
if (!l)
|
||||||
|
{
|
||||||
|
HKEY subKey;
|
||||||
|
SP_DEVICE_INTERFACE_DATA *iface = NULL;
|
||||||
|
|
||||||
|
/* The subkey name is the reference string, with a '#' prepended */
|
||||||
|
SETUPDI_AddInterfaceInstance(devInfo, interface, subKeyName + 1,
|
||||||
|
&iface);
|
||||||
|
l = RegOpenKeyExW(key, subKeyName, 0, KEY_READ, &subKey);
|
||||||
|
if (!l)
|
||||||
|
{
|
||||||
|
WCHAR symbolicLink[MAX_PATH];
|
||||||
|
DWORD dataType;
|
||||||
|
|
||||||
|
len = sizeof(symbolicLink);
|
||||||
|
l = RegQueryValueExW(subKey, SymbolicLink, NULL, &dataType,
|
||||||
|
(BYTE *)symbolicLink, &len);
|
||||||
|
if (!l && dataType == REG_SZ)
|
||||||
|
SETUPDI_SetInterfaceSymbolicLink(iface, symbolicLink);
|
||||||
|
RegCloseKey(subKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* FIXME: find and add all the device's interfaces to the device */
|
||||||
|
}
|
||||||
|
|
||||||
static void SETUPDI_EnumerateMatchingInterfaces(HDEVINFO DeviceInfoSet,
|
static void SETUPDI_EnumerateMatchingInterfaces(HDEVINFO DeviceInfoSet,
|
||||||
HKEY key, const GUID *interface, LPCWSTR enumstr)
|
HKEY key, const GUID *interface, LPCWSTR enumstr)
|
||||||
{
|
{
|
||||||
@ -1748,12 +1810,11 @@ static void SETUPDI_EnumerateMatchingInterfaces(HDEVINFO DeviceInfoSet,
|
|||||||
deviceClassStr[37] = 0;
|
deviceClassStr[37] = 0;
|
||||||
UuidFromStringW(&deviceClassStr[1],
|
UuidFromStringW(&deviceClassStr[1],
|
||||||
&deviceClass);
|
&deviceClass);
|
||||||
SETUPDI_AddDeviceToSet(set, &deviceClass,
|
if (SETUPDI_AddDeviceToSet(set, &deviceClass,
|
||||||
0 /* FIXME: DevInst */, deviceInst,
|
0 /* FIXME: DevInst */, deviceInst,
|
||||||
FALSE, &dev);
|
FALSE, &dev))
|
||||||
/* FIXME: add this interface, and all the
|
SETUPDI_AddDeviceInterfaces(dev, subKey,
|
||||||
* device's interfaces, to the device
|
interface);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
RegCloseKey(deviceKey);
|
RegCloseKey(deviceKey);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user