Step 2 for a PnP ReactOS: add some (little) hacks

svn path=/trunk/; revision=18447
This commit is contained in:
Hervé Poussineau 2005-10-14 18:14:19 +00:00
parent 8325af0b6a
commit f747f1de8c
3 changed files with 23 additions and 3 deletions

View 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);

View 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);
}

View file

@ -465,7 +465,7 @@ IopLoadServiceModule(
return Status;
}
IopDisplayLoadingMessage(ServiceName->Buffer, TRUE);
//IopDisplayLoadingMessage(ServiceName->Buffer, TRUE);
/*
* Normalize the image path for all later processing.