Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / base / system / services / services.h
index 8371ad1..20afb30 100644 (file)
@@ -3,12 +3,20 @@
  */
 
 #include <stdio.h>
+#include <time.h>
+
 #define WIN32_NO_STATUS
-#include <windows.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winsvc.h>
+#include <netevent.h>
 #define NTOS_MODE_USER
-#include <ndk/ntndk.h>
+#include <ndk/iofuncs.h>
+#include <ndk/obfuncs.h>
+#include <ndk/rtlfuncs.h>
+#include <ndk/setypes.h>
 #include <services/services.h>
-
+#include <svcctl_s.h>
 
 typedef struct _SERVICE_GROUP
 {
@@ -26,8 +34,14 @@ typedef struct _SERVICE_GROUP
 
 typedef struct _SERVICE_IMAGE
 {
-    DWORD dwServiceRefCount;  // Number of running services of this image
-    DWORD Dummy;
+    LIST_ENTRY ImageListEntry;
+    DWORD dwImageRunCount;
+
+    HANDLE hControlPipe;
+    HANDLE hProcess;
+    DWORD dwProcessId;
+
+    WCHAR szImagePath[1];
 } SERVICE_IMAGE, *PSERVICE_IMAGE;
 
 
@@ -53,18 +67,26 @@ typedef struct _SERVICE
 
     BOOLEAN ServiceVisited;
 
-    HANDLE ControlPipeHandle;
-    ULONG ProcessId;
-    ULONG ThreadId;
-
     WCHAR szServiceName[1];
 } SERVICE, *PSERVICE;
 
 
+#define LOCK_TAG 0x4C697041 /* 'ApiL' */
+
+typedef struct _START_LOCK
+{
+    DWORD Tag;             /* Must be LOCK_TAG */
+    DWORD TimeWhenLocked;  /* Number of seconds since 1970 */
+    PSID LockOwnerSid;     /* It is NULL if the SCM aquired the lock */
+} START_LOCK, *PSTART_LOCK;
+
+
 /* VARIABLES ***************************************************************/
 
 extern LIST_ENTRY ServiceListHead;
 extern LIST_ENTRY GroupListHead;
+extern LIST_ENTRY ImageListHead;
+extern BOOL ScmInitialize;
 extern BOOL ScmShutdown;
 
 
@@ -81,14 +103,14 @@ DWORD ScmCreateServiceKey(LPCWSTR lpServiceName,
                           PHKEY phKey);
 
 DWORD ScmWriteDependencies(HKEY hServiceKey,
-                           LPWSTR lpDependencies,
+                           LPCWSTR lpDependencies,
                            DWORD dwDependenciesLength);
 
 DWORD ScmMarkServiceForDelete(PSERVICE pService);
 BOOL ScmIsDeleteFlagSet(HKEY hServiceKey);
 
 DWORD ScmReadString(HKEY hServiceKey,
-                    LPWSTR lpValueName,
+                    LPCWSTR lpValueName,
                     LPWSTR *lpValue);
 
 DWORD
@@ -97,6 +119,11 @@ ScmReadDependencies(HKEY hServiceKey,
                     DWORD *lpdwDependenciesLength);
 
 
+/* controlset.c */
+
+BOOL ScmGetControlSetValues(VOID);
+
+
 /* database.c */
 
 DWORD ScmCreateServiceDatabase(VOID);
@@ -123,6 +150,9 @@ BOOL ScmLockDatabaseExclusive(VOID);
 BOOL ScmLockDatabaseShared(VOID);
 VOID ScmUnlockDatabase(VOID);
 
+VOID ScmInitNamedPipeCriticalSection(VOID);
+VOID ScmDeleteNamedPipeCriticalSection(VOID);
+
 
 /* driver.c */
 
@@ -140,6 +170,14 @@ DWORD ScmSetServiceGroup(PSERVICE lpService,
                          LPCWSTR lpGroupName);
 
 
+/* lock.c */
+DWORD ScmAcquireServiceStartLock(IN BOOL IsServiceController,
+                                 OUT LPSC_RPC_LOCK lpLock);
+DWORD ScmReleaseServiceStartLock(IN OUT LPSC_RPC_LOCK lpLock);
+VOID ScmQueryServiceLockStatusW(OUT LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus);
+VOID ScmQueryServiceLockStatusA(OUT LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus);
+
+
 /* rpcserver.c */
 
 VOID ScmStartRpcServer(VOID);
@@ -148,6 +186,9 @@ VOID ScmStartRpcServer(VOID);
 /* services.c */
 
 VOID PrintString(LPCSTR fmt, ...);
+VOID ScmLogError(DWORD dwEventId,
+                 WORD wStrings,
+                 LPCWSTR *lpStrings);
+VOID ScmWaitForLsa(VOID);
 
 /* EOF */
-