mirror of
https://github.com/reactos/reactos.git
synced 2024-08-12 14:16:30 +00:00
Revert code specific to Wine to enumerate serial ports, and allow generic enumeration of interfaces like in ReactOS.
Serial ports will still be enumerated in Wine (using GUID_DEVINTERFACE_COMPORT or GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR) if the following registry entries are present: HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{4d36e978-e325-11ce-bfc1-08002be10318}\COM1 DeviceInstance REG_SZ SERIAL\COM1 HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{4d36e978-e325-11ce-bfc1-08002be10318}\COM1\# SymbolicLink REG_SZ COM1: HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{4d36e978-e325-11ce-bfc1-08002be10318}\COM1\#\Control Linked REG_DWORD 1 HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{86e0d1e0-8089-11d0-9ce4-08003e301f73}\COM1 DeviceInstance REG_SZ COM1 HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{86e0d1e0-8089-11d0-9ce4-08003e301f73}\COM1\# SymbolicLink REG_SZ COM1: HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{86e0d1e0-8089-11d0-9ce4-08003e301f73}\COM1\#\Control Linked REG_DWORD 1 HKLM\SYSTEM\CurrentControlSet\Enum\SERIAL\COM1 ClassGUID REG_SZ {4D36E978-E325-11CE-BFC1-08002BE10318} svn path=/trunk/; revision=20369
This commit is contained in:
parent
286c45ef35
commit
79daaf2303
|
@ -1586,85 +1586,6 @@ static LONG SETUP_CreateDevList(
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef __REACTOS__
|
||||
static LONG SETUP_CreateSerialDeviceList(
|
||||
struct DeviceInfoSet *list,
|
||||
PCWSTR MachineName,
|
||||
LPGUID InterfaceGuid,
|
||||
PCWSTR DeviceInstanceW)
|
||||
{
|
||||
static const size_t initialSize = 100;
|
||||
size_t size;
|
||||
WCHAR buf[initialSize];
|
||||
LPWSTR devices;
|
||||
static const WCHAR devicePrefixW[] = { 'C','O','M',0 };
|
||||
LPWSTR ptr;
|
||||
struct DeviceInfoElement *deviceInfo;
|
||||
|
||||
if (MachineName)
|
||||
WARN("'MachineName' is ignored on Wine!\n");
|
||||
if (DeviceInstanceW)
|
||||
WARN("'DeviceInstanceW' can't be set on Wine!\n");
|
||||
|
||||
devices = buf;
|
||||
size = initialSize;
|
||||
while (TRUE)
|
||||
{
|
||||
if (QueryDosDeviceW(NULL, devices, size) != 0)
|
||||
break;
|
||||
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
size *= 2;
|
||||
if (devices != buf)
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
devices = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
|
||||
if (!devices)
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
*devices = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (devices != buf)
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
return GetLastError();
|
||||
}
|
||||
}
|
||||
|
||||
/* 'devices' is a MULTI_SZ string */
|
||||
for (ptr = devices; *ptr; ptr += strlenW(ptr) + 1)
|
||||
{
|
||||
if (strncmpW(devicePrefixW, ptr, sizeof(devicePrefixW) / sizeof(devicePrefixW[0]) - 1) == 0)
|
||||
{
|
||||
/* We have found a device */
|
||||
struct DeviceInterface *interfaceInfo;
|
||||
TRACE("Adding %s to list\n", debugstr_w(ptr));
|
||||
/* Step 1. Create a device info element */
|
||||
if (!CreateDeviceInfoElement(list, ptr, &GUID_SERENUM_BUS_ENUMERATOR, &deviceInfo))
|
||||
{
|
||||
if (devices != buf)
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
return GetLastError();
|
||||
}
|
||||
InsertTailList(&list->ListHead, &deviceInfo->ListEntry);
|
||||
|
||||
/* Step 2. Create an interface list for this element */
|
||||
if (!CreateDeviceInterface(deviceInfo, ptr, InterfaceGuid, &interfaceInfo))
|
||||
{
|
||||
if (devices != buf)
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
return GetLastError();
|
||||
}
|
||||
interfaceInfo->Flags |= SPINT_ACTIVE | SPINT_DEFAULT;
|
||||
InsertTailList(&deviceInfo->InterfaceListHead, &interfaceInfo->ListEntry);
|
||||
}
|
||||
}
|
||||
if (devices != buf)
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
#else /* __REACTOS__ */
|
||||
|
||||
static LONG SETUP_CreateInterfaceList(
|
||||
struct DeviceInfoSet *list,
|
||||
PCWSTR MachineName,
|
||||
|
@ -1927,7 +1848,6 @@ static LONG SETUP_CreateInterfaceList(
|
|||
RegCloseKey(hInterfaceKey);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
#endif /* __REACTOS__ */
|
||||
|
||||
/***********************************************************************
|
||||
* SetupDiGetClassDevsExW (SETUPAPI.@)
|
||||
|
@ -2002,20 +1922,7 @@ HDEVINFO WINAPI SetupDiGetClassDevsExW(
|
|||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
#ifndef __REACTOS__
|
||||
/* Special case: find serial ports by calling QueryDosDevice */
|
||||
if (IsEqualIID(class, &GUID_DEVINTERFACE_COMPORT))
|
||||
rc = SETUP_CreateSerialDeviceList(list, machine, (LPGUID)class, enumstr);
|
||||
if (IsEqualIID(class, &GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR))
|
||||
rc = SETUP_CreateSerialDeviceList(list, machine, (LPGUID)class, enumstr);
|
||||
else
|
||||
{
|
||||
ERR("Wine can only enumerate serial devices at the moment!\n");
|
||||
rc = ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
#else /* __REACTOS__ */
|
||||
rc = SETUP_CreateInterfaceList(list, machine, (LPGUID)class, enumstr);
|
||||
#endif /* __REACTOS__ */
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError(rc);
|
||||
|
|
Loading…
Reference in a new issue