Revert code specific to Wine to enumerate serial ports, and allow generic enumeration...
authorHervé Poussineau <hpoussin@reactos.org>
Tue, 27 Dec 2005 11:39:43 +0000 (11:39 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Tue, 27 Dec 2005 11:39:43 +0000 (11:39 +0000)
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

reactos/lib/setupapi/devinst.c

index 2fb9465..3bf7cd6 100644 (file)
@@ -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);