mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Step 2 for a PnP ReactOS: add some (little) hacks
svn path=/trunk/; revision=18447
This commit is contained in:
parent
8325af0b6a
commit
f747f1de8c
3 changed files with 23 additions and 3 deletions
|
@ -262,12 +262,14 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
{
|
{
|
||||||
SC_HANDLE hService = NULL;
|
SC_HANDLE hService = NULL;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
HKEY hEnumKey, hKey;
|
||||||
|
|
||||||
DPRINT1("CreateServiceW() called\n");
|
DPRINT1("CreateServiceW() called\n");
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
/* Call to services.exe using RPC */
|
/* Call to services.exe using RPC */
|
||||||
|
#if 0
|
||||||
dwError = ScmrCreateServiceW(BindingHandle,
|
dwError = ScmrCreateServiceW(BindingHandle,
|
||||||
(unsigned int)hSCManager,
|
(unsigned int)hSCManager,
|
||||||
(LPWSTR)lpServiceName,
|
(LPWSTR)lpServiceName,
|
||||||
|
@ -285,6 +287,19 @@ CreateServiceW(SC_HANDLE hSCManager,
|
||||||
NULL, /* FIXME: lpPassword */
|
NULL, /* FIXME: lpPassword */
|
||||||
0, /* FIXME: dwPasswordLength */
|
0, /* FIXME: dwPasswordLength */
|
||||||
(unsigned int *)&hService);
|
(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)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError);
|
DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError);
|
||||||
|
|
|
@ -1104,7 +1104,12 @@ BOOL WINAPI SetupInstallServicesFromInfSectionExW( HINF hinf, PCWSTR sectionname
|
||||||
ServiceType,
|
ServiceType,
|
||||||
StartType,
|
StartType,
|
||||||
ErrorControl,
|
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,
|
LoadOrderGroup,
|
||||||
NULL,
|
NULL,
|
||||||
Dependencies,
|
Dependencies,
|
||||||
|
@ -1119,7 +1124,7 @@ BOOL WINAPI SetupInstallServicesFromInfSectionExW( HINF hinf, PCWSTR sectionname
|
||||||
CloseServiceHandle(hSCManager);
|
CloseServiceHandle(hSCManager);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
CloseServiceHandle(hService);
|
//CloseServiceHandle(hService);
|
||||||
|
|
||||||
return CloseServiceHandle(hSCManager);
|
return CloseServiceHandle(hSCManager);
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,7 +465,7 @@ IopLoadServiceModule(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
IopDisplayLoadingMessage(ServiceName->Buffer, TRUE);
|
//IopDisplayLoadingMessage(ServiceName->Buffer, TRUE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normalize the image path for all later processing.
|
* Normalize the image path for all later processing.
|
||||||
|
|
Loading…
Reference in a new issue