mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
Active functions related to interfaces enumeration: SETUP_CreateSerialDeviceList, SETUP_CreateInterfaceList, SetupDiGetDeviceInterfaceDetailW. They were disabled since r17210
Replace ERROR_NO_SYSTEM_RESOURCES by ERROR_NOT_ENOUGH_MEMORY Replace #ifdef __WINESRC__ by #ifndef __REACTOS__, as ReactOS also defines __WINESRC__ Minor fixes svn path=/trunk/; revision=17251
This commit is contained in:
parent
7217d69487
commit
ce28abcbca
1 changed files with 106 additions and 66 deletions
|
@ -82,11 +82,13 @@ DEFINE_GUID(GUID_NULL,
|
||||||
|
|
||||||
#define SETUP_DEV_INFO_SET_MAGIC 0xd00ff057
|
#define SETUP_DEV_INFO_SET_MAGIC 0xd00ff057
|
||||||
|
|
||||||
struct DeviceInterface /* Element of DeviceInfoElement.InterfaceHead */
|
struct DeviceInterface /* Element of DeviceInfoElement.InterfaceListHead */
|
||||||
{
|
{
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
|
|
||||||
|
struct DeviceInfoElement* DeviceInfo;
|
||||||
GUID InterfaceClassGuid;
|
GUID InterfaceClassGuid;
|
||||||
|
|
||||||
|
|
||||||
/* SPINT_ACTIVE : the interface is active/enabled
|
/* SPINT_ACTIVE : the interface is active/enabled
|
||||||
* SPINT_DEFAULT: the interface is the default interface for the device class FIXME???
|
* SPINT_DEFAULT: the interface is the default interface for the device class FIXME???
|
||||||
|
@ -157,7 +159,7 @@ struct DeviceInfoElement /* Element of DeviceInfoSet.ListHead */
|
||||||
struct DriverInfoElement *SelectedDriver;
|
struct DriverInfoElement *SelectedDriver;
|
||||||
|
|
||||||
/* List of interfaces implemented by this device */
|
/* List of interfaces implemented by this device */
|
||||||
LIST_ENTRY InterfaceHead; /* List of struct DeviceInterface */
|
LIST_ENTRY InterfaceListHead; /* List of struct DeviceInterface */
|
||||||
|
|
||||||
WCHAR Data[0];
|
WCHAR Data[0];
|
||||||
};
|
};
|
||||||
|
@ -1167,11 +1169,12 @@ CreateDeviceInfoElement(
|
||||||
struct DeviceInfoElement *deviceInfo;
|
struct DeviceInfoElement *deviceInfo;
|
||||||
|
|
||||||
*pDeviceInfo = NULL;
|
*pDeviceInfo = NULL;
|
||||||
|
if (IsEqualIID(&pClassGuid, &GUID_NULL)) { FIXME("Bad argument!!!"); return FALSE; }/* FIXME: remove */
|
||||||
|
|
||||||
deviceInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInfoElement) + (wcslen(InstancePath) + 1) * sizeof(WCHAR));
|
deviceInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInfoElement) + (wcslen(InstancePath) + 1) * sizeof(WCHAR));
|
||||||
if (!deviceInfo)
|
if (!deviceInfo)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NO_SYSTEM_RESOURCES);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
wcscpy(deviceInfo->Data, InstancePath);
|
wcscpy(deviceInfo->Data, InstancePath);
|
||||||
|
@ -1185,12 +1188,39 @@ CreateDeviceInfoElement(
|
||||||
deviceInfo->FlagsEx = 0; /* FIXME */
|
deviceInfo->FlagsEx = 0; /* FIXME */
|
||||||
deviceInfo->SelectedDriver = NULL;
|
deviceInfo->SelectedDriver = NULL;
|
||||||
InitializeListHead(&deviceInfo->DriverListHead);
|
InitializeListHead(&deviceInfo->DriverListHead);
|
||||||
InitializeListHead(&deviceInfo->InterfaceHead);
|
InitializeListHead(&deviceInfo->InterfaceListHead);
|
||||||
|
|
||||||
*pDeviceInfo = deviceInfo;
|
*pDeviceInfo = deviceInfo;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
CreateDeviceInterface(
|
||||||
|
IN struct DeviceInfoElement* deviceInfo,
|
||||||
|
IN LPCWSTR SymbolicLink,
|
||||||
|
IN LPCGUID pInterfaceGuid,
|
||||||
|
OUT struct DeviceInterface **pDeviceInterface)
|
||||||
|
{
|
||||||
|
struct DeviceInterface *deviceInterface;
|
||||||
|
|
||||||
|
*pDeviceInterface = NULL;
|
||||||
|
if (IsEqualIID(&pInterfaceGuid, &GUID_NULL)) { FIXME("Bad argument!!!"); return FALSE; }/* FIXME: remove */
|
||||||
|
|
||||||
|
deviceInterface = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInterface) + (wcslen(SymbolicLink) + 1) * sizeof(WCHAR));
|
||||||
|
if (!deviceInterface)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
deviceInterface->DeviceInfo = deviceInfo;
|
||||||
|
wcscpy(deviceInterface->SymbolicLink, SymbolicLink);
|
||||||
|
deviceInterface->Flags = 0; /* FIXME */
|
||||||
|
memcpy(&deviceInterface->InterfaceClassGuid, pInterfaceGuid, sizeof(GUID));
|
||||||
|
|
||||||
|
*pDeviceInterface = deviceInterface;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static LONG SETUP_CreateDevListFromEnumerator(
|
static LONG SETUP_CreateDevListFromEnumerator(
|
||||||
struct DeviceInfoSet *list,
|
struct DeviceInfoSet *list,
|
||||||
LPCGUID pClassGuid OPTIONAL,
|
LPCGUID pClassGuid OPTIONAL,
|
||||||
|
@ -1393,7 +1423,7 @@ static LONG SETUP_CreateDevList(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WINESRC__
|
#ifndef __REACTOS__
|
||||||
static LONG SETUP_CreateSerialDeviceList(
|
static LONG SETUP_CreateSerialDeviceList(
|
||||||
struct DeviceInfoSet *list,
|
struct DeviceInfoSet *list,
|
||||||
PCWSTR MachineName,
|
PCWSTR MachineName,
|
||||||
|
@ -1406,7 +1436,7 @@ static LONG SETUP_CreateSerialDeviceList(
|
||||||
LPWSTR devices;
|
LPWSTR devices;
|
||||||
static const WCHAR devicePrefixW[] = { 'C','O','M',0 };
|
static const WCHAR devicePrefixW[] = { 'C','O','M',0 };
|
||||||
LPWSTR ptr;
|
LPWSTR ptr;
|
||||||
//DeviceInfo *deviceInfo;
|
struct DeviceInfoElement *deviceInfo;
|
||||||
|
|
||||||
if (MachineName)
|
if (MachineName)
|
||||||
WARN("'MachineName' is ignored on Wine!\n");
|
WARN("'MachineName' is ignored on Wine!\n");
|
||||||
|
@ -1426,7 +1456,7 @@ static LONG SETUP_CreateSerialDeviceList(
|
||||||
HeapFree(GetProcessHeap(), 0, devices);
|
HeapFree(GetProcessHeap(), 0, devices);
|
||||||
devices = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
devices = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
||||||
if (!devices)
|
if (!devices)
|
||||||
return ERROR_NO_SYSTEM_RESOURCES;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
*devices = '\0';
|
*devices = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1443,24 +1473,25 @@ static LONG SETUP_CreateSerialDeviceList(
|
||||||
if (strncmpW(devicePrefixW, ptr, sizeof(devicePrefixW) / sizeof(devicePrefixW[0]) - 1) == 0)
|
if (strncmpW(devicePrefixW, ptr, sizeof(devicePrefixW) / sizeof(devicePrefixW[0]) - 1) == 0)
|
||||||
{
|
{
|
||||||
/* We have found a device */
|
/* We have found a device */
|
||||||
|
struct DeviceInterface *interfaceInfo;
|
||||||
TRACE("Adding %s to list\n", debugstr_w(ptr));
|
TRACE("Adding %s to list\n", debugstr_w(ptr));
|
||||||
#if 0
|
/* Step 1. Create a device info element */
|
||||||
deviceInfo = HeapAlloc(GetProcessHeap(), 0,
|
if (!CreateDeviceInfoElement(ptr, &GUID_SERENUM_BUS_ENUMERATOR, &deviceInfo))
|
||||||
FIELD_OFFSET(DeviceInfo, Interface.Data) + (strlenW(ptr) + 1) * sizeof(WCHAR));
|
|
||||||
if (!deviceInfo)
|
|
||||||
{
|
{
|
||||||
if (devices != buf)
|
if (devices != buf)
|
||||||
HeapFree(GetProcessHeap(), 0, devices);
|
HeapFree(GetProcessHeap(), 0, devices);
|
||||||
return ERROR_NO_SYSTEM_RESOURCES;
|
return GetLastError();
|
||||||
}
|
}
|
||||||
deviceInfo->IsDevice = FALSE;
|
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
|
||||||
deviceInfo->Interface.pSymbolicLink = &deviceInfo->Interface.Data[0];
|
|
||||||
memcpy(&deviceInfo->Interface.InterfaceGuid, InterfaceGuid, sizeof(GUID));
|
/* Step 2. Create an interface list for this element */
|
||||||
wcscpy(deviceInfo->Interface.pSymbolicLink, ptr);
|
if (!CreateDeviceInterface(deviceInfo, ptr, InterfaceGuid, &interfaceInfo))
|
||||||
InsertTailList(&list->ListHead, &deviceInfo->ItemEntry);
|
{
|
||||||
#else
|
if (devices != buf)
|
||||||
FIXME("not implemented\n");
|
HeapFree(GetProcessHeap(), 0, devices);
|
||||||
#endif
|
return GetLastError();
|
||||||
|
}
|
||||||
|
InsertTailList(&deviceInfo->InterfaceListHead, &interfaceInfo->ListEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (devices != buf)
|
if (devices != buf)
|
||||||
|
@ -1468,7 +1499,7 @@ static LONG SETUP_CreateSerialDeviceList(
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* __WINESRC__ */
|
#else /* __REACTOS__ */
|
||||||
|
|
||||||
static LONG SETUP_CreateInterfaceList(
|
static LONG SETUP_CreateInterfaceList(
|
||||||
struct DeviceInfoSet *list,
|
struct DeviceInfoSet *list,
|
||||||
|
@ -1488,7 +1519,7 @@ static LONG SETUP_CreateInterfaceList(
|
||||||
DWORD dwLength, dwInstancePathLength;
|
DWORD dwLength, dwInstancePathLength;
|
||||||
DWORD dwRegType;
|
DWORD dwRegType;
|
||||||
GUID ClassGuid;
|
GUID ClassGuid;
|
||||||
DeviceInfo *deviceInfo;
|
struct DeviceInfoElement *deviceInfo;
|
||||||
|
|
||||||
/* Open registry key related to this interface */
|
/* Open registry key related to this interface */
|
||||||
hInterfaceKey = SetupDiOpenClassRegKeyExW(InterfaceGuid, KEY_ENUMERATE_SUB_KEYS, DIOCR_INTERFACE, MachineName, NULL);
|
hInterfaceKey = SetupDiOpenClassRegKeyExW(InterfaceGuid, KEY_ENUMERATE_SUB_KEYS, DIOCR_INTERFACE, MachineName, NULL);
|
||||||
|
@ -1537,7 +1568,7 @@ static LONG SETUP_CreateInterfaceList(
|
||||||
{
|
{
|
||||||
RegCloseKey(hDeviceInstanceKey);
|
RegCloseKey(hDeviceInstanceKey);
|
||||||
RegCloseKey(hInterfaceKey);
|
RegCloseKey(hInterfaceKey);
|
||||||
return ERROR_NO_SYSTEM_RESOURCES;
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
}
|
}
|
||||||
rc = RegQueryValueExW(hDeviceInstanceKey, DeviceInstance, NULL, NULL, (LPBYTE)InstancePath, &dwInstancePathLength);
|
rc = RegQueryValueExW(hDeviceInstanceKey, DeviceInstance, NULL, NULL, (LPBYTE)InstancePath, &dwInstancePathLength);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
|
@ -1622,6 +1653,9 @@ static LONG SETUP_CreateInterfaceList(
|
||||||
j = 0;
|
j = 0;
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
LPWSTR pSymbolicLink;
|
||||||
|
struct DeviceInterface *interfaceInfo;
|
||||||
|
|
||||||
dwLength = sizeof(KeyBuffer) / sizeof(KeyBuffer[0]);
|
dwLength = sizeof(KeyBuffer) / sizeof(KeyBuffer[0]);
|
||||||
rc = RegEnumKeyExW(hDeviceInstanceKey, j, KeyBuffer, &dwLength, NULL, NULL, NULL, NULL);
|
rc = RegEnumKeyExW(hDeviceInstanceKey, j, KeyBuffer, &dwLength, NULL, NULL, NULL, NULL);
|
||||||
if (rc == ERROR_NO_MORE_ITEMS)
|
if (rc == ERROR_NO_MORE_ITEMS)
|
||||||
|
@ -1663,45 +1697,55 @@ static LONG SETUP_CreateInterfaceList(
|
||||||
RegCloseKey(hInterfaceKey);
|
RegCloseKey(hInterfaceKey);
|
||||||
return ERROR_GEN_FAILURE;
|
return ERROR_GEN_FAILURE;
|
||||||
}
|
}
|
||||||
deviceInfo = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(DeviceInfo, Interface.Data) + dwInstancePathLength + dwLength + 2 * sizeof(WCHAR));
|
|
||||||
if (!deviceInfo)
|
/* We have found a device */
|
||||||
|
/* Step 1. Create a device info element */
|
||||||
|
if (!CreateDeviceInfoElement(InstancePath, &ClassGuid, &deviceInfo))
|
||||||
{
|
{
|
||||||
RegCloseKey(hReferenceKey);
|
RegCloseKey(hReferenceKey);
|
||||||
RegCloseKey(hDeviceInstanceKey);
|
RegCloseKey(hDeviceInstanceKey);
|
||||||
RegCloseKey(hInterfaceKey);
|
RegCloseKey(hInterfaceKey);
|
||||||
return ERROR_NO_SYSTEM_RESOURCES;
|
return GetLastError();
|
||||||
}
|
}
|
||||||
deviceInfo->Interface.pInstancePath = &deviceInfo->Interface.Data[0];
|
TRACE("Adding device %s to list\n", debugstr_w(InstancePath));
|
||||||
deviceInfo->Interface.pSymbolicLink = &deviceInfo->Interface.Data[dwInstancePathLength + 1];
|
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
|
||||||
rc = RegQueryValueExW(hReferenceKey, SymbolicLink, NULL, NULL, (LPBYTE)deviceInfo->Interface.pSymbolicLink, &dwLength);
|
|
||||||
|
/* Step 2. Create an interface list for this element */
|
||||||
|
pSymbolicLink = HeapAlloc(GetProcessHeap(), 0, (dwLength + 1) * sizeof(WCHAR));
|
||||||
|
if (!pSymbolicLink)
|
||||||
|
{
|
||||||
|
RegCloseKey(hReferenceKey);
|
||||||
|
RegCloseKey(hDeviceInstanceKey);
|
||||||
|
RegCloseKey(hInterfaceKey);
|
||||||
|
return ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
}
|
||||||
|
rc = RegQueryValueExW(hReferenceKey, SymbolicLink, NULL, NULL, (LPBYTE)pSymbolicLink, &dwLength);
|
||||||
|
pSymbolicLink[dwLength / sizeof(WCHAR)] = '\0';
|
||||||
RegCloseKey(hReferenceKey);
|
RegCloseKey(hReferenceKey);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, deviceInfo);
|
HeapFree(GetProcessHeap(), 0, pSymbolicLink);
|
||||||
RegCloseKey(hDeviceInstanceKey);
|
RegCloseKey(hDeviceInstanceKey);
|
||||||
RegCloseKey(hInterfaceKey);
|
RegCloseKey(hInterfaceKey);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
deviceInfo->Interface.pSymbolicLink[dwLength / sizeof(WCHAR)] = '\0';
|
if (!CreateDeviceInterface(deviceInfo, pSymbolicLink, InterfaceGuid, &interfaceInfo))
|
||||||
TRACE("Symbolic link %s\n", debugstr_w(deviceInfo->Interface.pSymbolicLink));
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, pSymbolicLink);
|
||||||
/* Add this entry to the list */
|
RegCloseKey(hDeviceInstanceKey);
|
||||||
TRACE("Entry found\n");
|
RegCloseKey(hInterfaceKey);
|
||||||
deviceInfo->IsDevice = FALSE;
|
return GetLastError();
|
||||||
memcpy(
|
}
|
||||||
&deviceInfo->Interface.InterfaceGuid,
|
TRACE("Adding interface %s to list\n", debugstr_w(pSymbolicLink));
|
||||||
InterfaceGuid,
|
HeapFree(GetProcessHeap(), 0, pSymbolicLink);
|
||||||
sizeof(deviceInfo->Interface.InterfaceGuid));
|
InsertTailList(&deviceInfo->InterfaceListHead, &interfaceInfo->ListEntry);
|
||||||
wcscpy(deviceInfo->Interface.pInstancePath, InstancePath);
|
|
||||||
InsertTailList(&list->ListHead, &deviceInfo->ItemEntry);
|
|
||||||
list->numberOfEntries++;
|
|
||||||
}
|
}
|
||||||
RegCloseKey(hDeviceInstanceKey);
|
RegCloseKey(hDeviceInstanceKey);
|
||||||
}
|
}
|
||||||
RegCloseKey(hInterfaceKey);
|
RegCloseKey(hInterfaceKey);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif /* __WINESRC__ */
|
#endif /* __REACTOS__ */
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* SetupDiGetClassDevsExW (SETUPAPI.@)
|
* SetupDiGetClassDevsExW (SETUPAPI.@)
|
||||||
|
@ -1776,7 +1820,7 @@ HDEVINFO WINAPI SetupDiGetClassDevsExW(
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WINESRC__
|
#ifndef __REACTOS__
|
||||||
/* Special case: find serial ports by calling QueryDosDevice */
|
/* Special case: find serial ports by calling QueryDosDevice */
|
||||||
if (IsEqualIID(class, &GUID_DEVINTERFACE_COMPORT))
|
if (IsEqualIID(class, &GUID_DEVINTERFACE_COMPORT))
|
||||||
rc = SETUP_CreateSerialDeviceList(list, machine, (LPGUID)class, enumstr);
|
rc = SETUP_CreateSerialDeviceList(list, machine, (LPGUID)class, enumstr);
|
||||||
|
@ -1787,9 +1831,9 @@ HDEVINFO WINAPI SetupDiGetClassDevsExW(
|
||||||
ERR("Wine can only enumerate serial devices at the moment!\n");
|
ERR("Wine can only enumerate serial devices at the moment!\n");
|
||||||
rc = ERROR_INVALID_PARAMETER;
|
rc = ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
#else /* __WINESRC__ */
|
#else /* __REACTOS__ */
|
||||||
rc = SETUP_CreateInterfaceList(list, machine, (LPGUID)class, enumstr);
|
rc = SETUP_CreateInterfaceList(list, machine, (LPGUID)class, enumstr);
|
||||||
#endif /* __WINESRC__ */
|
#endif /* __REACTOS__ */
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
SetLastError(rc);
|
SetLastError(rc);
|
||||||
|
@ -1825,7 +1869,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
TRACE("%p, %p, %s, 0x%08lx, %p\n", DeviceInfoSet, DeviceInfoData,
|
TRACE("%p, %p, %s, %ld, %p\n", DeviceInfoSet, DeviceInfoData,
|
||||||
debugstr_guid(InterfaceClassGuid), MemberIndex, DeviceInterfaceData);
|
debugstr_guid(InterfaceClassGuid), MemberIndex, DeviceInterfaceData);
|
||||||
|
|
||||||
if (!DeviceInterfaceData)
|
if (!DeviceInterfaceData)
|
||||||
|
@ -1850,8 +1894,8 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
|
||||||
ItemList = ItemList->Flink;
|
ItemList = ItemList->Flink;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
InterfaceListEntry = DevInfo->InterfaceHead.Flink;
|
InterfaceListEntry = DevInfo->InterfaceListHead.Flink;
|
||||||
while (InterfaceListEntry != &DevInfo->InterfaceHead && !Found)
|
while (InterfaceListEntry != &DevInfo->InterfaceListHead && !Found)
|
||||||
{
|
{
|
||||||
struct DeviceInterface *DevItf = (struct DeviceInterface *)InterfaceListEntry;
|
struct DeviceInterface *DevItf = (struct DeviceInterface *)InterfaceListEntry;
|
||||||
if (!IsEqualIID(&DevItf->InterfaceClassGuid, InterfaceClassGuid))
|
if (!IsEqualIID(&DevItf->InterfaceClassGuid, InterfaceClassGuid))
|
||||||
|
@ -1874,7 +1918,7 @@ BOOL WINAPI SetupDiEnumDeviceInterfaces(
|
||||||
DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf;
|
DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf;
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
}
|
}
|
||||||
MemberIndex--;
|
InterfaceListEntry = InterfaceListEntry->Flink;
|
||||||
}
|
}
|
||||||
ItemList = ItemList->Flink;
|
ItemList = ItemList->Flink;
|
||||||
}
|
}
|
||||||
|
@ -1911,9 +1955,9 @@ BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
|
||||||
{
|
{
|
||||||
ListEntry = RemoveHeadList(&list->ListHead);
|
ListEntry = RemoveHeadList(&list->ListHead);
|
||||||
deviceInfo = (struct DeviceInfoElement *)ListEntry;
|
deviceInfo = (struct DeviceInfoElement *)ListEntry;
|
||||||
while (!IsListEmpty(&deviceInfo->InterfaceHead))
|
while (!IsListEmpty(&deviceInfo->InterfaceListHead))
|
||||||
{
|
{
|
||||||
InterfaceEntry = RemoveHeadList(&deviceInfo->InterfaceHead);
|
InterfaceEntry = RemoveHeadList(&deviceInfo->InterfaceListHead);
|
||||||
HeapFree(GetProcessHeap(), 0, InterfaceEntry);
|
HeapFree(GetProcessHeap(), 0, InterfaceEntry);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, ListEntry);
|
HeapFree(GetProcessHeap(), 0, ListEntry);
|
||||||
|
@ -1928,6 +1972,8 @@ BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SetLastError(ERROR_INVALID_HANDLE);
|
SetLastError(ERROR_INVALID_HANDLE);
|
||||||
|
|
||||||
|
TRACE("Returning %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2036,11 +2082,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
struct DeviceInterface *deviceInterface = (struct DeviceInterface *)DeviceInterfaceData->Reserved;
|
||||||
DeviceInfo *deviceInfo = (DeviceInfo *)DeviceInterfaceData->Reserved;
|
LPCWSTR devName = deviceInterface->SymbolicLink;
|
||||||
LPCWSTR devName = deviceInfo->Interface.pSymbolicLink;
|
|
||||||
DWORD sizeRequired = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) +
|
DWORD sizeRequired = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) +
|
||||||
lstrlenW(devName);
|
(lstrlenW(devName) + 1) * sizeof(WCHAR);
|
||||||
|
|
||||||
if (sizeRequired > DeviceInterfaceDetailDataSize)
|
if (sizeRequired > DeviceInterfaceDetailDataSize)
|
||||||
{
|
{
|
||||||
|
@ -2055,7 +2100,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
||||||
if (DeviceInfoData)
|
if (DeviceInfoData)
|
||||||
{
|
{
|
||||||
memcpy(&DeviceInfoData->ClassGuid,
|
memcpy(&DeviceInfoData->ClassGuid,
|
||||||
&deviceInfo->Interface.ClassGuid,
|
&deviceInterface->DeviceInfo->ClassGuid,
|
||||||
sizeof(GUID));
|
sizeof(GUID));
|
||||||
DeviceInfoData->DevInst = 0; /* FIXME */
|
DeviceInfoData->DevInst = 0; /* FIXME */
|
||||||
/* Note: this appears to be dangerous, passing a private
|
/* Note: this appears to be dangerous, passing a private
|
||||||
|
@ -2063,15 +2108,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
|
||||||
* expected lifetime of the device data is the same as the
|
* expected lifetime of the device data is the same as the
|
||||||
* HDEVINFO; once that is closed, the data are no longer valid.
|
* HDEVINFO; once that is closed, the data are no longer valid.
|
||||||
*/
|
*/
|
||||||
DeviceInfoData->Reserved = (ULONG_PTR)deviceInfo;
|
DeviceInfoData->Reserved = (ULONG_PTR)deviceInterface->DeviceInfo;
|
||||||
}
|
}
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
FIXME("not implemented\n");
|
|
||||||
SetLastError(ERROR_GEN_FAILURE);
|
|
||||||
ret = FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Returning %d\n", ret);
|
TRACE("Returning %d\n", ret);
|
||||||
|
@ -2643,7 +2683,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
|
||||||
lpFullGuidString = HeapAlloc(GetProcessHeap(), 0, (dwLength + 3) * sizeof(WCHAR));
|
lpFullGuidString = HeapAlloc(GetProcessHeap(), 0, (dwLength + 3) * sizeof(WCHAR));
|
||||||
if (!lpFullGuidString)
|
if (!lpFullGuidString)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_NO_SYSTEM_RESOURCES);
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
RpcStringFreeW(&lpGuidString);
|
RpcStringFreeW(&lpGuidString);
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
@ -2864,7 +2904,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
|
||||||
{
|
{
|
||||||
struct DeviceInfoElement *deviceInfo;
|
struct DeviceInfoElement *deviceInfo;
|
||||||
|
|
||||||
if (CreateDeviceInfoElement(DeviceName, &GUID_NULL /* FIXME */, &deviceInfo))
|
if (CreateDeviceInfoElement(DeviceName, ClassGuid, &deviceInfo))
|
||||||
{
|
{
|
||||||
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
|
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue