Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / base / setup / usetup / interface / devinst.c
index 8ea6444..bdda5a2 100644 (file)
@@ -6,15 +6,11 @@
  * PROGRAMMER:      HervĂ© Poussineau (hpoussin@reactos.org)
  */
 
-#include "usetup.h"
+#include <usetup.h>
 
 #define NDEBUG
 #include <debug.h>
 
-#define INITGUID
-#include <guiddef.h>
-#include <libs/umpnpmgr/sysguid.h>
-
 BOOLEAN
 ResetDevice(
     IN LPCWSTR DeviceId)
@@ -55,6 +51,9 @@ InstallDriver(
     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,8 +64,16 @@ InstallDriver(
     /* Find associated driver name */
     /* FIXME: check in other sections too! */
     if (!SetupFindFirstLineW(hInf, L"BootBusExtenders.Load", Driver, &Context)
-     && !SetupFindFirstLineW(hInf, L"Keyboard.Load", Driver, &Context))
-        return FALSE;
+     && !SetupFindFirstLineW(hInf, L"BusExtenders.Load", Driver, &Context)
+     && !SetupFindFirstLineW(hInf, L"SCSI.Load", Driver, &Context)
+        && !SetupFindFirstLineW(hInf, L"InputDevicesSupport.Load", Driver, &Context))
+    {
+        if (!SetupFindFirstLineW(hInf, L"Keyboard.Load", Driver, &Context))
+            return FALSE;
+
+        keyboardDevice = TRUE;
+    }
+
     if (!INF_GetDataField(&Context, 1, &ImagePath))
         return FALSE;
 
@@ -81,7 +88,7 @@ InstallDriver(
     RtlCopyMemory(FullImagePath, PathPrefix.Buffer, PathPrefix.MaximumLength);
     wcscat(FullImagePath, ImagePath);
 
-    DPRINT("Using driver '%S' for device '%S'\n", ImagePath, DeviceId);
+    DPRINT1("Using driver '%S' for device '%S'\n", ImagePath, DeviceId);
 
     /* Create service key */
     RtlInitUnicodeString(&StringU, Driver);
@@ -131,6 +138,17 @@ InstallDriver(
         ImagePath,
         (wcslen(ImagePath) + 1) * sizeof(WCHAR));
 
+    if (keyboardDevice)
+    {
+        DPRINT1("Installing keyboard class driver for '%S'\n", DeviceId);
+        NtSetValueKey(hDeviceKey,
+                      &UpperFiltersU,
+                      0,
+                      REG_MULTI_SZ,
+                      keyboardClass,
+                      (wcslen(keyboardClass) + 2) * sizeof(WCHAR));
+    }
+
     /* Associate device with the service we just filled */
     Status = NtSetValueKey(
         hDeviceKey,