[USETUP] Remove one special case for keyboard devices
[reactos.git] / reactos / base / setup / usetup / interface / devinst.c
index b19e5bf..354be13 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS text-mode setup
- * FILE:            subsys/system/usetup/interface/devinst.c
+ * FILE:            base/setup/usetup/interface/devinst.c
  * PURPOSE:         Device installation
  * PROGRAMMER:      HervĂ© Poussineau (hpoussin@reactos.org)
  */
@@ -50,14 +50,13 @@ InstallDriver(
     OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE hService;
     INFCONTEXT Context;
-    LPWSTR Driver, ImagePath, FullImagePath;
+    LPWSTR Driver, ClassGuid, ImagePath, FullImagePath;
     ULONG dwValue;
     ULONG Disposition;
     NTSTATUS Status;
     BOOLEAN deviceInstalled = FALSE;
     UNICODE_STRING UpperFiltersU = RTL_CONSTANT_STRING(L"UpperFilters");
     LPWSTR keyboardClass = L"kbdclass\0";
-    BOOLEAN keyboardDevice = FALSE;
 
     /* Check if we know the hardware */
     if (!SetupFindFirstLineW(hInf, L"HardwareIdsDatabase", HardwareId, &Context))
@@ -65,17 +64,19 @@ InstallDriver(
     if (!INF_GetDataField(&Context, 1, &Driver))
         return FALSE;
 
+    /* Get associated class GUID (if any) */
+    if (!INF_GetDataField(&Context, 2, &ClassGuid))
+        ClassGuid = NULL;
+
     /* Find associated driver name */
     /* FIXME: check in other sections too! */
     if (!SetupFindFirstLineW(hInf, L"BootBusExtenders.Load", Driver, &Context)
      && !SetupFindFirstLineW(hInf, L"BusExtenders.Load", Driver, &Context)
      && !SetupFindFirstLineW(hInf, L"SCSI.Load", Driver, &Context)
-        && !SetupFindFirstLineW(hInf, L"InputDevicesSupport.Load", Driver, &Context))
+     && !SetupFindFirstLineW(hInf, L"InputDevicesSupport.Load", Driver, &Context)
+     && !SetupFindFirstLineW(hInf, L"Keyboard.Load", Driver, &Context))
     {
-        if (!SetupFindFirstLineW(hInf, L"Keyboard.Load", Driver, &Context))
-            return FALSE;
-
-        keyboardDevice = TRUE;
+        return FALSE;
     }
 
     if (!INF_GetDataField(&Context, 1, &ImagePath))
@@ -142,7 +143,7 @@ InstallDriver(
         ImagePath,
         (wcslen(ImagePath) + 1) * sizeof(WCHAR));
 
-    if (keyboardDevice)
+    if (ClassGuid &&_wcsicmp(ClassGuid, L"{4D36E96B-E325-11CE-BFC1-08002BE10318}") == 0)
     {
         DPRINT1("Installing keyboard class driver for '%S'\n", DeviceId);
         NtSetValueKey(hDeviceKey,
@@ -163,7 +164,7 @@ InstallDriver(
         (wcslen(Driver) + 1) * sizeof(WCHAR));
     if (NT_SUCCESS(Status))
     {
-        /* Restart the device, so it will use the driver we registred */
+        /* Restart the device, so it will use the driver we registered */
         deviceInstalled = ResetDevice(DeviceId);
     }
 
@@ -341,7 +342,7 @@ EventThread(IN LPVOID lpParameter)
     }
 
     InitializeObjectAttributes(&ObjectAttributes, &ServicesU, OBJ_CASE_INSENSITIVE, NULL, NULL);
-    Status = NtCreateKey(&hServices, 0, &ObjectAttributes, 0, NULL, 0, NULL);
+    Status = NtCreateKey(&hServices, KEY_ALL_ACCESS, &ObjectAttributes, 0, NULL, 0, NULL);
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("NtCreateKey('%wZ') failed with status 0x%08lx\n", &ServicesU, Status);