Step 2 for a PnP ReactOS: add some (little) hacks
authorHervé Poussineau <hpoussin@reactos.org>
Fri, 14 Oct 2005 18:14:19 +0000 (18:14 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Fri, 14 Oct 2005 18:14:19 +0000 (18:14 +0000)
svn path=/trunk/; revision=18447

reactos/lib/advapi32/service/scm.c
reactos/lib/setupapi/install.c
reactos/ntoskrnl/io/driver.c

index 47f7c4f..23b33bc 100644 (file)
@@ -262,12 +262,14 @@ CreateServiceW(SC_HANDLE hSCManager,
 {
     SC_HANDLE hService = NULL;
     DWORD dwError;
+    HKEY hEnumKey, hKey;
 
     DPRINT1("CreateServiceW() called\n");
 
     HandleBind();
 
     /* Call to services.exe using RPC */
+#if 0
     dwError = ScmrCreateServiceW(BindingHandle,
                                  (unsigned int)hSCManager,
                                  (LPWSTR)lpServiceName,
@@ -285,6 +287,19 @@ CreateServiceW(SC_HANDLE hSCManager,
                                  NULL,              /* FIXME: lpPassword */
                                  0,                 /* FIXME: dwPasswordLength */
                                  (unsigned int *)&hService);
+#else
+    RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services", 0, KEY_ENUMERATE_SUB_KEYS, &hEnumKey);
+    RegCreateKeyExW(hEnumKey, lpServiceName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, NULL);
+    RegCloseKey(hEnumKey);
+    if (lpLoadOrderGroup)
+      RegSetValueExW(hKey, L"Group", 0, REG_SZ, (const BYTE*)lpLoadOrderGroup, (wcslen(lpLoadOrderGroup) + 1) * sizeof(WCHAR));
+    RegSetValueExW(hKey, L"ImagePath", 0, REG_EXPAND_SZ, (const BYTE*)lpBinaryPathName, (wcslen(lpBinaryPathName) + 1) * sizeof(WCHAR));
+    RegSetValueExW(hKey, L"ErrorControl", 0, REG_DWORD, (const BYTE*)&dwErrorControl, sizeof(dwErrorControl));
+    RegSetValueExW(hKey, L"Start", 0, REG_DWORD, (const BYTE*)&dwStartType, sizeof(dwStartType));
+    RegSetValueExW(hKey, L"Type", 0, REG_DWORD, (const BYTE*)&dwStartType, sizeof(dwStartType));
+    RegCloseKey(hKey);
+    hService = INVALID_HANDLE_VALUE; dwError = ERROR_SUCCESS;
+#endif
     if (dwError != ERROR_SUCCESS)
     {
         DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError);
index a91282a..639259d 100644 (file)
@@ -1104,7 +1104,12 @@ BOOL WINAPI SetupInstallServicesFromInfSectionExW( HINF hinf, PCWSTR sectionname
         ServiceType,
         StartType,
         ErrorControl,
-        ServiceBinary,
+        /* BIG HACK!!! As GetLineText() give us a full path, ignore the
+         * first letters which should be the OS directory. If that's not
+         * the case, the file name written to registry will be bad and
+         * the driver will not load...
+         */
+        ServiceBinary + GetWindowsDirectoryW(NULL, 0),
         LoadOrderGroup,
         NULL,
         Dependencies,
@@ -1119,7 +1124,7 @@ BOOL WINAPI SetupInstallServicesFromInfSectionExW( HINF hinf, PCWSTR sectionname
         CloseServiceHandle(hSCManager);
         return FALSE;
     }
-    CloseServiceHandle(hService);
+    //CloseServiceHandle(hService);
 
     return CloseServiceHandle(hSCManager);
 }
index 71bb6c2..c9b6b42 100644 (file)
@@ -465,7 +465,7 @@ IopLoadServiceModule(
       return Status;
    }
    
-   IopDisplayLoadingMessage(ServiceName->Buffer, TRUE);
+   //IopDisplayLoadingMessage(ServiceName->Buffer, TRUE);
 
    /*
     * Normalize the image path for all later processing.