[ADVAPI32][SERVICES] Add (dummy) password encryption/decryption functions to CreateSe...
[reactos.git] / base / system / services / services.h
index 8e13a3e..ce1b46e 100644 (file)
@@ -2,22 +2,30 @@
  * services.h
  */
 
+#ifndef _SERVICES_H
+#define _SERVICES_H
+
 #include <stdio.h>
-#include <time.h>
+#include <stdlib.h>
 
 #define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
 #include <windef.h>
 #include <winbase.h>
 #include <winsvc.h>
+#include <winreg.h>
+#include <winuser.h>
 #include <netevent.h>
 #define NTOS_MODE_USER
-#include <ndk/iofuncs.h>
 #include <ndk/obfuncs.h>
 #include <ndk/rtlfuncs.h>
-#include <ndk/setypes.h>
 #include <services/services.h>
 #include <svcctl_s.h>
 
+#include "resource.h"
+
 typedef struct _SERVICE_GROUP
 {
     LIST_ENTRY GroupListEntry;
@@ -35,13 +43,15 @@ typedef struct _SERVICE_GROUP
 typedef struct _SERVICE_IMAGE
 {
     LIST_ENTRY ImageListEntry;
+    LPWSTR pszImagePath;
+    LPWSTR pszAccountName;
     DWORD dwImageRunCount;
 
     HANDLE hControlPipe;
     HANDLE hProcess;
     DWORD dwProcessId;
-
-    WCHAR szImagePath[1];
+    HANDLE hToken;
+    HANDLE hProfile;
 } SERVICE_IMAGE, *PSERVICE_IMAGE;
 
 
@@ -61,9 +71,11 @@ typedef struct _SERVICE
     DWORD dwErrorControl;
     DWORD dwTag;
 
+    DWORD dwServiceBits;
+
     ULONG Flags;
 
-    PSECURITY_DESCRIPTOR lpSecurityDescriptor;
+    PSECURITY_DESCRIPTOR pSecurityDescriptor;
 
     BOOLEAN ServiceVisited;
 
@@ -77,7 +89,7 @@ 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 */
+    PSID LockOwnerSid;     /* It is NULL if the SCM acquired the lock */
 } START_LOCK, *PSTART_LOCK;
 
 
@@ -86,6 +98,7 @@ typedef struct _START_LOCK
 extern LIST_ENTRY ServiceListHead;
 extern LIST_ENTRY GroupListHead;
 extern LIST_ENTRY ImageListHead;
+extern BOOL ScmInitialize;
 extern BOOL ScmShutdown;
 
 
@@ -117,6 +130,32 @@ ScmReadDependencies(HKEY hServiceKey,
                     LPWSTR *lpDependencies,
                     DWORD *lpdwDependenciesLength);
 
+DWORD
+ScmSetServicePassword(
+    IN PCWSTR pszServiceName,
+    IN PCWSTR pszPassword);
+
+DWORD
+ScmWriteSecurityDescriptor(
+    _In_ HKEY hServiceKey,
+    _In_ PSECURITY_DESCRIPTOR pSecurityDescriptor);
+
+DWORD
+ScmReadSecurityDescriptor(
+    _In_ HKEY hServiceKey,
+    _Out_ PSECURITY_DESCRIPTOR *ppSecurityDescriptor);
+
+DWORD
+ScmDeleteRegKey(
+    _In_ HKEY hKey,
+    _In_ PCWSTR pszSubKey);
+
+DWORD
+ScmDecryptPassword(
+    _In_ PBYTE pPassword,
+    _In_ DWORD dwPasswordSize,
+    _Out_ PWSTR *pDecryptedPassword);
+
 
 /* controlset.c */
 
@@ -134,15 +173,20 @@ DWORD ScmStartService(PSERVICE Service,
                       DWORD argc,
                       LPWSTR *argv);
 
+VOID ScmRemoveServiceImage(PSERVICE_IMAGE pServiceImage);
 PSERVICE ScmGetServiceEntryByName(LPCWSTR lpServiceName);
 PSERVICE ScmGetServiceEntryByDisplayName(LPCWSTR lpDisplayName);
 PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount);
 DWORD ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
-                                PSERVICE *lpServiceRecord);
+                                PSERVICE *lpServiceRecord,
+                                DWORD dwServiceType,
+                                DWORD dwStartType);
 VOID ScmDeleteServiceRecord(PSERVICE lpService);
 DWORD ScmMarkServiceForDelete(PSERVICE pService);
 
-DWORD ScmControlService(PSERVICE Service,
+DWORD ScmControlService(HANDLE hControlPipe,
+                        PWSTR pServiceName,
+                        SERVICE_STATUS_HANDLE hServiceStatus,
                         DWORD dwControl);
 
 BOOL ScmLockDatabaseExclusive(VOID);
@@ -155,8 +199,7 @@ VOID ScmDeleteNamedPipeCriticalSection(VOID);
 
 /* driver.c */
 
-DWORD ScmLoadDriver(PSERVICE lpService);
-DWORD ScmUnloadDriver(PSERVICE lpService);
+DWORD ScmStartDriver(PSERVICE lpService);
 DWORD ScmControlDriver(PSERVICE lpService,
                        DWORD dwControl,
                        LPSERVICE_STATUS lpServiceStatus);
@@ -164,12 +207,17 @@ DWORD ScmControlDriver(PSERVICE lpService,
 
 /* groupdb.c */
 
+PSERVICE_GROUP
+ScmGetServiceGroupByName(
+    _In_ LPCWSTR lpGroupName);
+
 DWORD ScmCreateGroupList(VOID);
 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);
@@ -182,12 +230,23 @@ VOID ScmQueryServiceLockStatusA(OUT LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus);
 VOID ScmStartRpcServer(VOID);
 
 
+/* security.c */
+
+DWORD ScmInitializeSecurity(VOID);
+VOID ScmShutdownSecurity(VOID);
+
+DWORD
+ScmCreateDefaultServiceSD(
+    PSECURITY_DESCRIPTOR *ppSecurityDescriptor);
+
+
 /* services.c */
 
 VOID PrintString(LPCSTR fmt, ...);
-VOID ScmLogError(DWORD dwEventId,
+VOID ScmLogEvent(DWORD dwEventId,
+                 WORD wType,
                  WORD wStrings,
                  LPCWSTR *lpStrings);
 VOID ScmWaitForLsa(VOID);
 
-/* EOF */
+#endif /* _SERVICES_H */