From f747f1de8c1ef72d9be20bfbba22bfdc68186a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Fri, 14 Oct 2005 18:14:19 +0000 Subject: [PATCH] Step 2 for a PnP ReactOS: add some (little) hacks svn path=/trunk/; revision=18447 --- reactos/lib/advapi32/service/scm.c | 15 +++++++++++++++ reactos/lib/setupapi/install.c | 9 +++++++-- reactos/ntoskrnl/io/driver.c | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/reactos/lib/advapi32/service/scm.c b/reactos/lib/advapi32/service/scm.c index 47f7c4f27bf..23b33bcebc1 100644 --- a/reactos/lib/advapi32/service/scm.c +++ b/reactos/lib/advapi32/service/scm.c @@ -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); diff --git a/reactos/lib/setupapi/install.c b/reactos/lib/setupapi/install.c index a91282a5b9e..639259dc2bd 100644 --- a/reactos/lib/setupapi/install.c +++ b/reactos/lib/setupapi/install.c @@ -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); } diff --git a/reactos/ntoskrnl/io/driver.c b/reactos/ntoskrnl/io/driver.c index 71bb6c2ada0..c9b6b424f65 100644 --- a/reactos/ntoskrnl/io/driver.c +++ b/reactos/ntoskrnl/io/driver.c @@ -465,7 +465,7 @@ IopLoadServiceModule( return Status; } - IopDisplayLoadingMessage(ServiceName->Buffer, TRUE); + //IopDisplayLoadingMessage(ServiceName->Buffer, TRUE); /* * Normalize the image path for all later processing.