ReactOS  0.4.14-dev-838-g99f979d
service.c File Reference
#include "lsasrv.h"
#include <winsvc.h>
Include dependency graph for service.c:

Go to the source code of this file.

Functions

VOID WINAPI I_ScIsSecurityProcess (VOID)
 
static VOID WINAPI SamSsServiceMain (DWORD dwArgc, PWSTR *pszArgv)
 
static VOID WINAPI SamSsControlHandler (_In_ DWORD fdwControl)
 
static VOID WINAPI SamSsServiceMain (_In_ DWORD dwArgc, _In_ PWSTR *pszArgv)
 
static DWORD WINAPI DispatcherThread (_In_ PVOID pParameter)
 
NTSTATUS WINAPI ServiceInit (VOID)
 

Variables

SERVICE_TABLE_ENTRYW ServiceTable []
 

Function Documentation

◆ DispatcherThread()

static DWORD WINAPI DispatcherThread ( _In_ PVOID  pParameter)
static

Definition at line 75 of file service.c.

77 {
78  HANDLE hEvent;
79  DWORD dwError;
80 
81  TRACE("DispatcherThread(%p)\n", pParameter);
82 
83  /* Create or open the SECURITY_SERVICES_STARTED event */
85  TRUE,
86  FALSE,
87  L"SECURITY_SERVICES_STARTED");
88  if (hEvent == NULL)
89  {
90  dwError = GetLastError();
91  if (dwError != ERROR_ALREADY_EXISTS)
92  return dwError;
93 
95  FALSE,
96  L"SECURITY_SERVICES_STARTED");
97  if (hEvent == NULL)
98  return GetLastError();
99  }
100 
101  /* Wait for the SECURITY_SERVICES_STARTED event to be signaled */
102  TRACE("Waiting for the SECURITY_SERVICES_STARTED event!\n");
103  dwError = WaitForSingleObject(hEvent, INFINITE);
104  TRACE("WaitForSingleObject returned %lu\n", dwError);
105 
106  /* Close the event handle */
108 
109  /* Fail, if the event was not signaled */
110  if (dwError != WAIT_OBJECT_0)
111  {
112  ERR("Wait failed!\n");
113  return dwError;
114  }
115 
116  /* This is the security process */
118 
119  /* Start the services */
120  TRACE("Start the security services!\n");
122  return GetLastError();
123 
124  TRACE("Done!\n");
125 
126  return ERROR_SUCCESS;
127 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1132
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:682
static HANDLE hEvent
Definition: comm.c:54
VOID WINAPI I_ScIsSecurityProcess(VOID)
Definition: sctrl.c:851
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define WAIT_OBJECT_0
Definition: winbase.h:387
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define SYNCHRONIZE
Definition: nt_native.h:61
#define ERR(fmt,...)
Definition: debug.h:109
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define INFINITE
Definition: serial.h:102
SERVICE_TABLE_ENTRYW ServiceTable[]
Definition: service.c:18

Referenced by ServiceInit().

◆ I_ScIsSecurityProcess()

VOID WINAPI I_ScIsSecurityProcess ( VOID  )

Definition at line 851 of file sctrl.c.

852 {
853  TRACE("I_ScIsSecurityProcess()\n");
855 }
#define TRUE
Definition: types.h:120
static BOOL bSecurityServiceProcess
Definition: sctrl.c:61
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by DispatcherThread().

◆ SamSsControlHandler()

static VOID WINAPI SamSsControlHandler ( _In_ DWORD  fdwControl)
static

Definition at line 30 of file service.c.

32 {
33  TRACE("SamSsControlHandler(%lu)\n", fdwControl);
34 }
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by SamSsServiceMain().

◆ SamSsServiceMain() [1/2]

static VOID WINAPI SamSsServiceMain ( DWORD  dwArgc,
PWSTR pszArgv 
)
static

◆ SamSsServiceMain() [2/2]

static VOID WINAPI SamSsServiceMain ( _In_ DWORD  dwArgc,
_In_ PWSTR pszArgv 
)
static

Definition at line 40 of file service.c.

43 {
46 
47  TRACE("SamSsServiceMain(%lu %p)\n", dwArgc, pszArgv);
48 
51  if (hStatus == NULL)
52  return;
53 
60  ServiceStatus.dwWaitHint = 0x7530;
61 
63 
67 
69 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD dwCurrentState
Definition: winsvc.h:100
static SERVICE_STATUS ServiceStatus
Definition: dcomlaunch.c:27
#define SERVICE_START_PENDING
Definition: winsvc.h:22
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc)
Definition: sctrl.c:740
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:995
SERVICE_STATUS_HANDLE hStatus
Definition: w32time.c:14
DWORD dwCheckPoint
Definition: winsvc.h:104
#define SERVICE_RUNNING
Definition: winsvc.h:24
smooth NULL
Definition: ftsmooth.c:416
static VOID WINAPI SamSsControlHandler(_In_ DWORD fdwControl)
Definition: service.c:30
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD dwServiceType
Definition: winsvc.h:99
#define SERVICE_WIN32_SHARE_PROCESS
Definition: cmtypes.h:961
static const WCHAR L[]
Definition: oid.c:1250
DWORD dwControlsAccepted
Definition: winsvc.h:101
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR

◆ ServiceInit()

NTSTATUS WINAPI ServiceInit ( VOID  )

Definition at line 132 of file service.c.

133 {
134  HANDLE hThread;
136 
137  TRACE("ServiceInit()\n");
138 
140  0,
142  NULL,
143  0,
144  &dwThreadId);
145  if (hThread == NULL)
146  return (NTSTATUS)GetLastError();
147 
148  return STATUS_SUCCESS;
149 }
LONG NTSTATUS
Definition: precomp.h:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwThreadId
Definition: fdebug.c:31
static DWORD WINAPI DispatcherThread(_In_ PVOID pParameter)
Definition: service.c:75
HANDLE hThread
Definition: wizard.c:27
return STATUS_SUCCESS
Definition: btrfs.c:2938

Variable Documentation

◆ ServiceTable

SERVICE_TABLE_ENTRYW ServiceTable[]
Initial value:
=
{
{L"SAMSS", SamSsServiceMain},
}
static VOID WINAPI SamSsServiceMain(DWORD dwArgc, PWSTR *pszArgv)
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 18 of file service.c.

Referenced by _tmain(), DispatcherThread(), KiSystemService(), START_TEST(), and wmain().