- Mark service for delete in the registry.

svn path=/trunk/; revision=18930
This commit is contained in:
Eric Kohl 2005-11-01 13:52:22 +00:00
parent 9c843bd352
commit b4693503e5
3 changed files with 56 additions and 2 deletions

View file

@ -11,6 +11,37 @@
/* FUNCTIONS *****************************************************************/
DWORD
ScmOpenServiceKey(LPWSTR lpServiceName,
REGSAM samDesired,
PHKEY phKey)
{
HKEY hServicesKey = NULL;
DWORD dwError;
*phKey = NULL;
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"System\\CurrentControlSet\\Services",
0,
KEY_READ,
&hServicesKey);
if (dwError != ERROR_SUCCESS)
return dwError;
dwError = RegOpenKeyExW(hServicesKey,
lpServiceName,
0,
samDesired,
phKey);
RegCloseKey(hServicesKey);
return dwError;
}
DWORD
ScmWriteDependencies(HKEY hServiceKey,
LPWSTR lpDependencies,

View file

@ -987,9 +987,28 @@ ScmAutoStartServices(VOID)
DWORD
ScmMarkServiceForDelete(PSERVICE pService)
{
DPRINT1("ScmMarkServiceForDelete() called\n");
HKEY hServiceKey = NULL;
DWORD dwValue = 1;
DWORD dwError;
return ERROR_SUCCESS;
DPRINT("ScmMarkServiceForDelete() called\n");
dwError = ScmOpenServiceKey(pService->lpServiceName,
KEY_WRITE,
&hServiceKey);
if (dwError != ERROR_SUCCESS)
return dwError;
dwError = RegSetValueExW(hServiceKey,
L"DeleteFlag",
0,
REG_DWORD,
(LPBYTE)&dwValue,
sizeof(DWORD));
RegCloseKey(hServiceKey);
return dwError;
}
/* EOF */

View file

@ -43,6 +43,10 @@ extern BOOL ScmShutdown;
/* config.c */
DWORD ScmOpenServiceKey(LPWSTR lpServiceName,
REGSAM samDesired,
PHKEY phKey);
DWORD ScmWriteDependencies(HKEY hServiceKey,
LPWSTR lpDependencies,
DWORD dwDependenciesLength);