- Mark service for delete in the registry.
Modified: trunk/reactos/subsys/system/services/config.c
Modified: trunk/reactos/subsys/system/services/database.c
Modified: trunk/reactos/subsys/system/services/services.h

Modified: trunk/reactos/subsys/system/services/config.c
--- trunk/reactos/subsys/system/services/config.c	2005-11-01 13:47:40 UTC (rev 18929)
+++ trunk/reactos/subsys/system/services/config.c	2005-11-01 13:52:22 UTC (rev 18930)
@@ -11,7 +11,38 @@
 
 /* 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,
                      DWORD dwDependenciesLength)

Modified: trunk/reactos/subsys/system/services/database.c
--- trunk/reactos/subsys/system/services/database.c	2005-11-01 13:47:40 UTC (rev 18929)
+++ trunk/reactos/subsys/system/services/database.c	2005-11-01 13:52:22 UTC (rev 18930)
@@ -987,9 +987,28 @@
 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 */

Modified: trunk/reactos/subsys/system/services/services.h
--- trunk/reactos/subsys/system/services/services.h	2005-11-01 13:47:40 UTC (rev 18929)
+++ trunk/reactos/subsys/system/services/services.h	2005-11-01 13:52:22 UTC (rev 18930)
@@ -43,6 +43,10 @@
 
 /* config.c */
 
+DWORD ScmOpenServiceKey(LPWSTR lpServiceName,
+                        REGSAM samDesired,
+                        PHKEY phKey);
+
 DWORD ScmWriteDependencies(HKEY hServiceKey,
                            LPWSTR lpDependencies,
                            DWORD dwDependenciesLength);