- userinit, usetup, vmwinst, welcome, winefile, winlogon, winver.
[reactos.git] / reactos / subsys / system / usetup / settings.c
index c5944ee..c28882f 100644 (file)
@@ -16,8 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id$
- * COPYRIGHT:       See COPYING in the top level directory
+/* COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS text-mode setup
  * FILE:            subsys/system/usetup/settings.c
  * PURPOSE:         Device settings support functions
 
 /* INCLUDES *****************************************************************/
 
-#include "precomp.h"
-#include <ntdll/rtl.h>
-#include <ntos/minmax.h>
-#include <rosrtl/string.h>
-
-#include "usetup.h"
-#include "infcache.h"
-#include "genlist.h"
-#include "settings.h"
+#include <usetup.h>
 
 #define NDEBUG
 #include <debug.h>
 
-
 /* FUNCTIONS ****************************************************************/
 
+static BOOLEAN
+GetComputerIdentifier(PWSTR Identifier,
+                      ULONG IdentifierLength)
+{
+  OBJECT_ATTRIBUTES ObjectAttributes;
+  UNICODE_STRING KeyName;
+  LPCWSTR ComputerIdentifier;
+  HANDLE ProcessorsKey;
+  PKEY_FULL_INFORMATION pFullInfo;
+  ULONG Size, SizeNeeded;
+  NTSTATUS Status;
+
+  DPRINT("GetComputerIdentifier() called\n");
+
+  Size = sizeof(KEY_FULL_INFORMATION);
+  pFullInfo = (PKEY_FULL_INFORMATION)RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);
+  if (!pFullInfo)
+    {
+      DPRINT("RtlAllocateHeap() failed\n");
+      return FALSE;
+    }
+
+  /* Open the processors key */
+  RtlInitUnicodeString(&KeyName,
+                       L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor");
+  InitializeObjectAttributes(&ObjectAttributes,
+                             &KeyName,
+                             OBJ_CASE_INSENSITIVE,
+                             NULL,
+                             NULL);
+  Status = NtOpenKey(&ProcessorsKey,
+                     KEY_QUERY_VALUE ,
+                     &ObjectAttributes);
+  if (!NT_SUCCESS(Status))
+    {
+      DPRINT("NtOpenKey() failed (Status 0x%lx)\n", Status);
+      RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
+      return FALSE;
+    }
+
+  /* Get number of subkeys */
+  Status = NtQueryKey(
+    ProcessorsKey,
+    KeyFullInformation,
+    pFullInfo,
+    Size,
+    &Size);
+  NtClose(ProcessorsKey);
+  if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW)
+    {
+      DPRINT("NtQueryKey() failed (Status 0x%lx)\n", Status);
+      RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
+      return FALSE;
+    }
+
+  /* Find computer identifier */
+  if (pFullInfo->SubKeys == 0)
+    {
+      /* Something strange happened. No processor detected */
+      RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
+      return FALSE;
+    }
+
+  if (pFullInfo->SubKeys == 1)
+    {
+      /* Computer is mono-CPU */
+      ComputerIdentifier = L"PC UP";
+    }
+  else
+    {
+      /* Computer is multi-CPUs */
+      ComputerIdentifier = L"PC MP";
+    }
+  RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
+
+  /* Copy computer identifier to return buffer */
+  SizeNeeded = (wcslen(ComputerIdentifier) + 1) * sizeof(WCHAR);
+  if (SizeNeeded > IdentifierLength)
+    return FALSE;
+  RtlCopyMemory(Identifier, ComputerIdentifier, SizeNeeded);
+  return TRUE;
+}
+
+
 PGENERIC_LIST
 CreateComputerTypeList(HINF InfFile)
 {
   CHAR Buffer[128];
   PGENERIC_LIST List;
-  INFCONTEXT Context;
+  PINFCONTEXT Context;
   PWCHAR KeyName;
   PWCHAR KeyValue;
   PWCHAR UserData;
+  WCHAR ComputerIdentifier[128];
+  WCHAR ComputerKey[32];
+
+  /* Get the computer identification */
+  if (!GetComputerIdentifier(ComputerIdentifier, 128))
+    {
+      ComputerIdentifier[0] = 0;
+    }
+
+  DPRINT("Computer identifier: '%S'\n", ComputerIdentifier);
+
+  /* Search for matching device identifier */
+  if (!InfFindFirstLine(InfFile, L"Map.Computer", NULL, &Context))
+    {
+      /* FIXME: error message */
+      return NULL;
+    }
+
+  do
+    {
+      if (!InfGetDataField(Context, 1, &KeyValue))
+        {
+          /* FIXME: Handle error! */
+          DPRINT("InfGetDataField() failed\n");
+          return NULL;
+        }
+
+      DPRINT("KeyValue: %S\n", KeyValue);
+      if (wcsstr(ComputerIdentifier, KeyValue))
+        {
+          if (!InfGetDataField(Context, 0, &KeyName))
+            {
+              /* FIXME: Handle error! */
+              DPRINT("InfGetDataField() failed\n");
+              return NULL;
+            }
+
+          DPRINT("Computer key: %S\n", KeyName);
+          wcscpy(ComputerKey, KeyName);
+        }
+    }
+  while (InfFindNextLine(Context, Context));
+  InfFreeContext(Context);
 
   List = CreateGenericList();
   if (List == NULL)
@@ -64,7 +181,7 @@ CreateComputerTypeList(HINF InfFile)
 
   do
     {
-      if (!InfGetData (&Context, &KeyName, &KeyValue))
+      if (!InfGetData (Context, &KeyName, &KeyValue))
        {
          /* FIXME: Handle error! */
          DPRINT("InfGetData() failed\n");
@@ -82,9 +199,11 @@ CreateComputerTypeList(HINF InfFile)
       wcscpy(UserData, KeyName);
 
       sprintf(Buffer, "%S", KeyValue);
-      AppendGenericListEntry(List, Buffer, UserData, FALSE);
+      AppendGenericListEntry(List, Buffer, UserData,
+                             _wcsicmp(KeyName, ComputerKey) ? FALSE : TRUE);
     }
-  while (InfFindNextLine(&Context, &Context));
+  while (InfFindNextLine(Context, Context));
+  InfFreeContext(Context);
 
   return List;
 }
@@ -254,7 +373,7 @@ CreateDisplayDriverList(HINF InfFile)
 {
   CHAR Buffer[128];
   PGENERIC_LIST List;
-  INFCONTEXT Context;
+  PINFCONTEXT Context;
   PWCHAR KeyName;
   PWCHAR KeyValue;
   PWCHAR UserData;
@@ -278,7 +397,7 @@ CreateDisplayDriverList(HINF InfFile)
 
   do
     {
-      if (!InfGetDataField(&Context, 1, &KeyValue))
+      if (!InfGetDataField(Context, 1, &KeyValue))
        {
          /* FIXME: Handle error! */
          DPRINT("InfGetDataField() failed\n");
@@ -288,7 +407,7 @@ CreateDisplayDriverList(HINF InfFile)
       DPRINT("KeyValue: %S\n", KeyValue);
       if (wcsstr(DisplayIdentifier, KeyValue))
        {
-         if (!InfGetDataField(&Context, 0, &KeyName))
+         if (!InfGetDataField(Context, 0, &KeyName))
            {
              /* FIXME: Handle error! */
              DPRINT("InfGetDataField() failed\n");
@@ -299,7 +418,8 @@ CreateDisplayDriverList(HINF InfFile)
          wcscpy(DisplayKey, KeyName);
        }
     }
-  while (InfFindNextLine(&Context, &Context));
+  while (InfFindNextLine(Context, Context));
+  InfFreeContext(Context);
 
 
   List = CreateGenericList();
@@ -314,13 +434,13 @@ CreateDisplayDriverList(HINF InfFile)
 
   do
     {
-      if (!InfGetDataField(&Context, 0, &KeyName))
+      if (!InfGetDataField(Context, 0, &KeyName))
        {
          DPRINT1("InfGetDataField() failed\n");
          break;
        }
 
-      if (!InfGetDataField(&Context, 1, &KeyValue))
+      if (!InfGetDataField(Context, 1, &KeyValue))
        {
          DPRINT1("InfGetDataField() failed\n");
          break;
@@ -344,7 +464,8 @@ CreateDisplayDriverList(HINF InfFile)
                             UserData,
                             _wcsicmp(KeyName, DisplayKey) ? FALSE : TRUE);
     }
-  while (InfFindNextLine(&Context, &Context));
+  while (InfFindNextLine(Context, Context));
+  InfFreeContext(Context);
 
 #if 0
   AppendGenericListEntry(List, "Other display driver", NULL, TRUE);
@@ -358,20 +479,20 @@ ProcessComputerFiles(HINF InfFile, PGENERIC_LIST List, PWCHAR* AdditionalSection
 {
        PGENERIC_LIST_ENTRY Entry;
        static WCHAR SectionName[128];
-       
+
        DPRINT("ProcessComputerFiles() called\n");
-       
+
        Entry = GetGenericListEntry(List);
        if (Entry == NULL)
        {
                DPRINT("GetGenericListEntry() failed\n");
                return FALSE;
        }
-       
+
        wcscpy(SectionName, L"Files.");
        wcscat(SectionName, Entry->UserData);
        *AdditionalSectionName = SectionName;
-       
+
        return TRUE;
 }
 
@@ -380,10 +501,13 @@ BOOLEAN
 ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
 {
   PGENERIC_LIST_ENTRY Entry;
-  INFCONTEXT Context;
+  PINFCONTEXT Context;
   PWCHAR ServiceName;
   ULONG StartValue;
   NTSTATUS Status;
+  WCHAR RegPath [255];
+  PWCHAR Buffer;
+  ULONG Width, Hight, Bpp;
 
   DPRINT("ProcessDisplayRegistry() called\n");
 
@@ -400,12 +524,14 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
       return FALSE;
     }
 
-  if (!InfGetDataField(&Context, 3, &ServiceName))
+  /* Enable the right driver */
+  if (!InfGetDataField(Context, 3, &ServiceName))
     {
       DPRINT("InfGetDataField() failed\n");
       return FALSE;
     }
 
+  ASSERT(wcslen(ServiceName) < 10);
   DPRINT("Service name: %S\n", ServiceName);
 
   StartValue = 1;
@@ -415,12 +541,73 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
                                 REG_DWORD,
                                 &StartValue,
                                 sizeof(ULONG));
+
+  if (!NT_SUCCESS(Status))
+    {
+      DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
+      return FALSE;
+    }
+
+  /* Set the resolution */
+  swprintf(RegPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0", ServiceName);
+
+  if (!InfGetDataField(Context, 4, &Buffer))
+    {
+      DPRINT("InfGetDataField() failed\n");
+      return FALSE;
+    }
+  Width = wcstoul(Buffer, NULL, 10);
+  Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
+                                RegPath, 
+                                L"DefaultSettings.XResolution",
+                                REG_DWORD,
+                                &Width,
+                                sizeof(ULONG));
+  if (!NT_SUCCESS(Status))
+    {
+      DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
+      return FALSE;
+    }
+
+  
+  if (!InfGetDataField(Context, 5, &Buffer))
+    {
+      DPRINT("InfGetDataField() failed\n");
+      return FALSE;
+    }
+  Hight = wcstoul(Buffer, 0, 0);
+  Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
+                                RegPath,
+                                L"DefaultSettings.YResolution",
+                                REG_DWORD,
+                                &Hight,
+                                sizeof(ULONG));
+  if (!NT_SUCCESS(Status))
+    {
+      DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
+      return FALSE;
+    }
+
+  if (!InfGetDataField(Context, 6, &Buffer))
+    {
+      DPRINT("InfGetDataField() failed\n");
+      return FALSE;
+    }
+  Bpp = wcstoul(Buffer, 0, 0);
+  Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
+                                RegPath,
+                                L"DefaultSettings.BitsPerPel",
+                                REG_DWORD,
+                                &Bpp,
+                                sizeof(ULONG));
   if (!NT_SUCCESS(Status))
     {
       DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
       return FALSE;
     }
 
+  InfFreeContext(Context);
+
   DPRINT("ProcessDisplayRegistry() done\n");
 
   return TRUE;
@@ -432,7 +619,7 @@ CreateKeyboardDriverList(HINF InfFile)
 {
   CHAR Buffer[128];
   PGENERIC_LIST List;
-  INFCONTEXT Context;
+  PINFCONTEXT Context;
   PWCHAR KeyName;
   PWCHAR KeyValue;
   PWCHAR UserData;
@@ -449,7 +636,7 @@ CreateKeyboardDriverList(HINF InfFile)
 
   do
     {
-      if (!InfGetData (&Context, &KeyName, &KeyValue))
+      if (!InfGetData (Context, &KeyName, &KeyValue))
        {
          /* FIXME: Handle error! */
          DPRINT("InfGetData() failed\n");
@@ -469,7 +656,8 @@ CreateKeyboardDriverList(HINF InfFile)
       sprintf(Buffer, "%S", KeyValue);
       AppendGenericListEntry(List, Buffer, UserData, FALSE);
     }
-  while (InfFindNextLine(&Context, &Context));
+  while (InfFindNextLine(Context, Context));
+  InfFreeContext(Context);
 
   return List;
 }
@@ -480,7 +668,7 @@ CreateKeyboardLayoutList(HINF InfFile)
 {
   CHAR Buffer[128];
   PGENERIC_LIST List;
-  INFCONTEXT Context;
+  PINFCONTEXT Context;
   PWCHAR KeyName;
   PWCHAR KeyValue;
   PWCHAR UserData;
@@ -490,10 +678,14 @@ CreateKeyboardLayoutList(HINF InfFile)
   if (!InfFindFirstLine (InfFile, L"NLS", L"DefaultLayout", &Context))
     return NULL;
 
-  if (!InfGetData (&Context, NULL, &KeyValue))
-    return NULL;
+  if (!InfGetData (Context, NULL, &KeyValue))
+    {
+      InfFreeContext(Context);
+      return NULL;
+    }
 
   wcscpy(DefaultLayout, KeyValue);
+  InfFreeContext(Context);
 
   List = CreateGenericList();
   if (List == NULL)
@@ -502,12 +694,13 @@ CreateKeyboardLayoutList(HINF InfFile)
   if (!InfFindFirstLine (InfFile, L"KeyboardLayout", NULL, &Context))
     {
       DestroyGenericList(List, FALSE);
+      InfFreeContext(Context);
       return NULL;
     }
 
   do
     {
-      if (!InfGetData (&Context, &KeyName, &KeyValue))
+      if (!InfGetData (Context, &KeyName, &KeyValue))
        {
          /* FIXME: Handle error! */
          DPRINT("InfGetData() failed\n");
@@ -530,7 +723,8 @@ CreateKeyboardLayoutList(HINF InfFile)
                             UserData,
                             _wcsicmp(KeyName, DefaultLayout) ? FALSE : TRUE);
     }
-  while (InfFindNextLine(&Context, &Context));
+  while (InfFindNextLine(Context, Context));
+  InfFreeContext(Context);
 
   return List;
 }
@@ -618,386 +812,4 @@ ProcessKeyboardLayoutFiles(PGENERIC_LIST List)
 }
 #endif
 
-
-static BOOLEAN
-GetMouseIdentifier(PWSTR ControllerType,
-                  PWSTR Identifier,
-                  ULONG IdentifierLength)
-{
-  OBJECT_ATTRIBUTES ObjectAttributes;
-  UNICODE_STRING KeyName;
-  WCHAR Buffer[32];
-  HANDLE BusKey;
-  HANDLE BusInstanceKey;
-  HANDLE ControllerKey;
-  HANDLE ControllerInstanceKey;
-  HANDLE PeripheralKey;
-  HANDLE PeripheralInstanceKey;
-  ULONG BusInstance;
-  ULONG ControllerInstance;
-  ULONG PeripheralInstance;
-  ULONG BufferLength;
-  ULONG ReturnedLength;
-  PKEY_VALUE_PARTIAL_INFORMATION ValueInfo;
-  NTSTATUS Status;
-
-  DPRINT("GetMouseIdentifier() called\n");
-
-  /* Open the bus key */
-  RtlInitUnicodeString(&KeyName,
-                      L"\\Registry\\Machine\\HARDWARE\\Description\\System\\MultifunctionAdapter");
-  InitializeObjectAttributes(&ObjectAttributes,
-                            &KeyName,
-                            OBJ_CASE_INSENSITIVE,
-                            NULL,
-                            NULL);
-  Status = NtOpenKey(&BusKey,
-                    KEY_ALL_ACCESS,
-                    &ObjectAttributes);
-  if (!NT_SUCCESS(Status))
-    {
-      DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
-      return FALSE;
-    }
-
-  BusInstance = 0;
-  while (TRUE)
-    {
-      swprintf(Buffer, L"%lu", BusInstance);
-      RtlInitUnicodeString(&KeyName,
-                          Buffer);
-      InitializeObjectAttributes(&ObjectAttributes,
-                                &KeyName,
-                                OBJ_CASE_INSENSITIVE,
-                                BusKey,
-                                NULL);
-      Status = NtOpenKey(&BusInstanceKey,
-                        KEY_ALL_ACCESS,
-                        &ObjectAttributes);
-      if (!NT_SUCCESS(Status))
-       {
-         DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
-         NtClose(BusKey);
-         return FALSE;
-       }
-
-      /* Open the controller type key */
-      RtlInitUnicodeString(&KeyName,
-                          ControllerType);
-      InitializeObjectAttributes(&ObjectAttributes,
-                                &KeyName,
-                                OBJ_CASE_INSENSITIVE,
-                                BusInstanceKey,
-                                NULL);
-      Status = NtOpenKey(&ControllerKey,
-                        KEY_ALL_ACCESS,
-                        &ObjectAttributes);
-      if (NT_SUCCESS(Status))
-       {
-         ControllerInstance = 0;
-         while (TRUE)
-           {
-             /* Open the pointer controller instance key */
-             swprintf(Buffer, L"%lu", ControllerInstance);
-             RtlInitUnicodeString(&KeyName,
-                                  Buffer);
-             InitializeObjectAttributes(&ObjectAttributes,
-                                        &KeyName,
-                                        OBJ_CASE_INSENSITIVE,
-                                        ControllerKey,
-                                        NULL);
-             Status = NtOpenKey(&ControllerInstanceKey,
-                                KEY_ALL_ACCESS,
-                                &ObjectAttributes);
-             if (!NT_SUCCESS(Status))
-               {
-                 DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
-                 NtClose(ControllerKey);
-                 NtClose(BusInstanceKey);
-                 NtClose(BusKey);
-                 return FALSE;
-               }
-
-             /* Open the 'PointerPeripheral' key */
-             RtlInitUnicodeString(&KeyName,
-                                  L"PointerPeripheral");
-             InitializeObjectAttributes(&ObjectAttributes,
-                                        &KeyName,
-                                        OBJ_CASE_INSENSITIVE,
-                                        ControllerInstanceKey,
-                                        NULL);
-             Status = NtOpenKey(&PeripheralKey,
-                                KEY_ALL_ACCESS,
-                                &ObjectAttributes);
-             if (NT_SUCCESS(Status))
-               {
-                 PeripheralInstance = 0;
-                 while (TRUE)
-                   {
-                     /* Open the pointer peripheral instance key */
-                     swprintf(Buffer, L"%lu", PeripheralInstance);
-                     RtlInitUnicodeString(&KeyName,
-                                          Buffer);
-                     InitializeObjectAttributes(&ObjectAttributes,
-                                                &KeyName,
-                                                OBJ_CASE_INSENSITIVE,
-                                                PeripheralKey,
-                                                NULL);
-                     Status = NtOpenKey(&PeripheralInstanceKey,
-                                        KEY_ALL_ACCESS,
-                                        &ObjectAttributes);
-                     if (!NT_SUCCESS(Status))
-                       {
-                         DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
-                         NtClose(PeripheralKey);
-                         NtClose(ControllerInstanceKey);
-                         NtClose(ControllerKey);
-                         NtClose(BusInstanceKey);
-                         NtClose(BusKey);
-                         return FALSE;
-                       }
-
-                     /* Get peripheral identifier */
-                     RtlInitUnicodeString(&KeyName,
-                                          L"Identifier");
-
-                     BufferLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) +
-                                    256 * sizeof(WCHAR);
-                     ValueInfo = RtlAllocateHeap(RtlGetProcessHeap(),
-                                                 0,
-                                                 BufferLength);
-                     if (ValueInfo == NULL)
-                       {
-                         DPRINT("RtlAllocateHeap() failed\n");
-                         NtClose(PeripheralInstanceKey);
-                         NtClose(PeripheralKey);
-                         NtClose(ControllerInstanceKey);
-                         NtClose(ControllerKey);
-                         NtClose(BusInstanceKey);
-                         NtClose(BusKey);
-                         return FALSE;
-                       }
-
-                     Status = NtQueryValueKey(PeripheralInstanceKey,
-                                              &KeyName,
-                                              KeyValuePartialInformation,
-                                              ValueInfo,
-                                              BufferLength,
-                                              &ReturnedLength);
-                     if (NT_SUCCESS(Status))
-                       {
-                         DPRINT("Identifier: %S\n", (PWSTR)ValueInfo->Data);
-
-                         BufferLength = min(ValueInfo->DataLength / sizeof(WCHAR), IdentifierLength);
-                         RtlCopyMemory (Identifier,
-                                        ValueInfo->Data,
-                                        BufferLength * sizeof(WCHAR));
-                         Identifier[BufferLength] = 0;
-
-                         RtlFreeHeap(RtlGetProcessHeap(),
-                                     0,
-                                     ValueInfo);
-                         NtClose(PeripheralInstanceKey);
-                         NtClose(PeripheralKey);
-                         NtClose(ControllerInstanceKey);
-                         NtClose(ControllerKey);
-                         NtClose(BusInstanceKey);
-                         NtClose(BusKey);
-                         return TRUE;
-                       }
-
-                     RtlFreeHeap(RtlGetProcessHeap(),
-                                 0,
-                                 ValueInfo);
-
-                     NtClose(PeripheralInstanceKey);
-
-                     PeripheralInstance++;
-                   }
-
-                 NtClose(PeripheralKey);
-               }
-
-             NtClose(ControllerInstanceKey);
-
-             ControllerInstance++;
-           }
-
-         NtClose(ControllerKey);
-       }
-
-      NtClose(BusInstanceKey);
-
-      BusInstance++;
-    }
-
-  NtClose(BusKey);
-
-  return FALSE;
-}
-
-
-PGENERIC_LIST
-CreateMouseDriverList(HINF InfFile)
-{
-  CHAR Buffer[128];
-  PGENERIC_LIST List;
-  INFCONTEXT Context;
-  PWCHAR KeyName;
-  PWCHAR KeyValue;
-  PWCHAR UserData;
-  WCHAR MouseIdentifier[128];
-  WCHAR MouseKey[32];
-
-  /* Get the mouse identification */
-  if (!GetMouseIdentifier(L"SerialController", MouseIdentifier, 128))
-    {
-      if (!GetMouseIdentifier(L"PointerController", MouseIdentifier, 128))
-       {
-         wcscpy (MouseIdentifier, L"NO MOUSE");
-       }
-    }
-
-  DPRINT("Mouse identifier: '%S'\n", MouseIdentifier);
-
-  /* Search for matching device identifier */
-  if (!InfFindFirstLine(InfFile, L"Map.Mouse", NULL, &Context))
-    {
-      /* FIXME: error message */
-      return NULL;
-    }
-
-  do
-    {
-      if (!InfGetDataField(&Context, 1, &KeyValue))
-       {
-         /* FIXME: Handle error! */
-         DPRINT("InfGetDataField() failed\n");
-         return NULL;
-       }
-
-      DPRINT("KeyValue: %S\n", KeyValue);
-      if (wcsstr(MouseIdentifier, KeyValue))
-       {
-         if (!InfGetDataField(&Context, 0, &KeyName))
-           {
-             /* FIXME: Handle error! */
-             DPRINT("InfGetDataField() failed\n");
-             return NULL;
-           }
-
-         DPRINT("Mouse key: %S\n", KeyName);
-         wcscpy(MouseKey, KeyName);
-       }
-    }
-  while (InfFindNextLine(&Context, &Context));
-
-
-  List = CreateGenericList();
-  if (List == NULL)
-    return NULL;
-
-  if (!InfFindFirstLine(InfFile, L"Mouse", NULL, &Context))
-    {
-      DestroyGenericList(List, FALSE);
-      return NULL;
-    }
-
-  do
-    {
-      if (!InfGetDataField(&Context, 0, &KeyName))
-       {
-         DPRINT1("InfGetDataField() failed\n");
-         break;
-       }
-
-      if (!InfGetDataField(&Context, 1, &KeyValue))
-       {
-         DPRINT1("InfGetDataField() failed\n");
-         break;
-       }
-
-      UserData = RtlAllocateHeap(ProcessHeap,
-                                0,
-                                (wcslen(KeyName) + 1) * sizeof(WCHAR));
-      if (UserData == NULL)
-       {
-         DPRINT1("RtlAllocateHeap() failed\n");
-         DestroyGenericList(List, TRUE);
-         return NULL;
-       }
-
-      wcscpy(UserData, KeyName);
-
-      sprintf(Buffer, "%S", KeyValue);
-      AppendGenericListEntry(List,
-                            Buffer,
-                            UserData,
-                            _wcsicmp(KeyName, MouseKey) ? FALSE : TRUE);
-    }
-  while (InfFindNextLine(&Context, &Context));
-
-  return List;
-}
-
-
-BOOLEAN
-ProcessMouseRegistry(HINF InfFile, PGENERIC_LIST List)
-{
-  PGENERIC_LIST_ENTRY Entry;
-  INFCONTEXT Context;
-  PWCHAR ServiceName;
-  ULONG StartValue;
-  NTSTATUS Status;
-
-  DPRINT("ProcessMouseRegistry() called\n");
-
-  Entry = GetGenericListEntry(List);
-  if (Entry == NULL)
-    {
-      DPRINT("GetGenericListEntry() failed\n");
-      return FALSE;
-    }
-
-  if (!InfFindFirstLine(InfFile, L"Mouse", Entry->UserData, &Context))
-    {
-      DPRINT("InfFindFirstLine() failed\n");
-      return FALSE;
-    }
-
-  if (!InfGetDataField(&Context, 3, &ServiceName))
-    {
-      DPRINT("InfGetDataField() failed\n");
-      return FALSE;
-    }
-
-  DPRINT("Service name: %S\n", ServiceName);
-
-  StartValue = 1;
-  Status = RtlWriteRegistryValue(RTL_REGISTRY_SERVICES,
-                                ServiceName,
-                                L"Start",
-                                REG_DWORD,
-                                &StartValue,
-                                sizeof(ULONG));
-  if (!NT_SUCCESS(Status))
-    {
-      DPRINT("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
-      return FALSE;
-    }
-
-  DPRINT("ProcessMouseRegistry() done\n");
-
-  return TRUE;
-}
-
-
-#if 0
-BOOLEAN
-ProcessMouseFiles(PGENERIC_LIST List)
-{
-  return TRUE;
-}
-#endif
-
 /* EOF */