Step 2 for a PnP ReactOS: add some (little) hacks
Modified: trunk/reactos/lib/advapi32/service/scm.c
Modified: trunk/reactos/lib/setupapi/install.c
Modified: trunk/reactos/ntoskrnl/io/driver.c
_____
Modified: trunk/reactos/lib/advapi32/service/scm.c
--- trunk/reactos/lib/advapi32/service/scm.c 2005-10-14 18:09:17 UTC
(rev 18446)
+++ trunk/reactos/lib/advapi32/service/scm.c 2005-10-14 18:14:19 UTC
(rev 18447)
@@ -262,12 +262,14 @@
{
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 @@
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);
_____
Modified: trunk/reactos/lib/setupapi/install.c
--- trunk/reactos/lib/setupapi/install.c 2005-10-14 18:09:17 UTC
(rev 18446)
+++ trunk/reactos/lib/setupapi/install.c 2005-10-14 18:14:19 UTC
(rev 18447)
@@ -1104,7 +1104,12 @@
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 @@
CloseServiceHandle(hSCManager);
return FALSE;
}
- CloseServiceHandle(hService);
+ //CloseServiceHandle(hService);
return CloseServiceHandle(hSCManager);
}
_____
Modified: trunk/reactos/ntoskrnl/io/driver.c
--- trunk/reactos/ntoskrnl/io/driver.c 2005-10-14 18:09:17 UTC (rev
18446)
+++ trunk/reactos/ntoskrnl/io/driver.c 2005-10-14 18:14:19 UTC (rev
18447)
@@ -465,7 +465,7 @@
return Status;
}
- IopDisplayLoadingMessage(ServiceName->Buffer, TRUE);
+ //IopDisplayLoadingMessage(ServiceName->Buffer, TRUE);
/*
* Normalize the image path for all later processing.