ReactOS 0.4.15-dev-5672-gf73ac17
netlogon.c File Reference
#include "precomp.h"
Include dependency graph for netlogon.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (netlogon)
 
static VOID UpdateServiceStatus (DWORD dwState)
 
static DWORD WINAPI ServiceControlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
static DWORD ServiceInit (VOID)
 
VOID WINAPI NlNetlogonMain (_In_ INT ArgCount, _In_ PWSTR *ArgVector)
 
BOOL WINAPI DllMain (_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ PVOID pvReserved)
 

Variables

HINSTANCE hDllInstance
 
static WCHAR ServiceName [] = L"netlogon"
 
static SERVICE_STATUS_HANDLE ServiceStatusHandle
 
static SERVICE_STATUS ServiceStatus
 

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( _In_ HINSTANCE  hinstDLL,
_In_ DWORD  fdwReason,
_In_ PVOID  pvReserved 
)

Definition at line 162 of file netlogon.c.

166{
168
169 switch (fdwReason)
170 {
173 hDllInstance = hinstDLL;
174 break;
175
177 break;
178 }
179
180 return TRUE;
181}
HINSTANCE hDllInstance
Definition: netlogon.c:17
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

◆ NlNetlogonMain()

VOID WINAPI NlNetlogonMain ( _In_ INT  ArgCount,
_In_ PWSTR ArgVector 
)

Definition at line 126 of file netlogon.c.

129{
130 DWORD dwError;
131
132 UNREFERENCED_PARAMETER(ArgCount);
133 UNREFERENCED_PARAMETER(ArgVector);
134
135 TRACE("NlNetlogonMain(%d %p)\n", ArgCount, ArgVector);
136
139 NULL);
141 {
142 ERR("RegisterServiceCtrlHandlerExW() failed! (Error %lu)\n", GetLastError());
143 return;
144 }
145
147
148 dwError = ServiceInit();
149 if (dwError != ERROR_SUCCESS)
150 {
151 ERR("Service stopped (dwError: %lu\n", dwError);
153 return;
154 }
155
157}
static WCHAR ServiceName[]
Definition: netlogon.c:19
static DWORD ServiceInit(VOID)
Definition: netlogon.c:102
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: netlogon.c:55
static VOID UpdateServiceStatus(DWORD dwState)
Definition: netlogon.c:29
static SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: netlogon.c:21
#define ERR(fmt,...)
Definition: debug.h:110
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:812
#define TRACE(s)
Definition: solgame.cpp:4
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24

◆ ServiceControlHandler()

static DWORD WINAPI ServiceControlHandler ( DWORD  dwControl,
DWORD  dwEventType,
LPVOID  lpEventData,
LPVOID  lpContext 
)
static

Definition at line 55 of file netlogon.c.

60{
61 TRACE("ServiceControlHandler()\n");
62
63 switch (dwControl)
64 {
66 TRACE(" SERVICE_CONTROL_STOP received\n");
67 /* Stop listening to incoming RPC messages */
70 return ERROR_SUCCESS;
71
73 TRACE(" SERVICE_CONTROL_PAUSE received\n");
75 return ERROR_SUCCESS;
76
78 TRACE(" SERVICE_CONTROL_CONTINUE received\n");
80 return ERROR_SUCCESS;
81
83 TRACE(" SERVICE_CONTROL_INTERROGATE received\n");
86 return ERROR_SUCCESS;
87
89 TRACE(" SERVICE_CONTROL_SHUTDOWN received\n");
91 return ERROR_SUCCESS;
92
93 default :
94 TRACE(" Control %lu received\n", dwControl);
96 }
97}
static SERVICE_STATUS ServiceStatus
Definition: netlogon.c:22
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1596
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40
#define SERVICE_PAUSED
Definition: winsvc.h:27
#define SERVICE_CONTROL_CONTINUE
Definition: winsvc.h:38
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_CONTROL_PAUSE
Definition: winsvc.h:37
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39

Referenced by NlNetlogonMain().

◆ ServiceInit()

static DWORD ServiceInit ( VOID  )
static

Definition at line 102 of file netlogon.c.

103{
105
107 0,
109 NULL,
110 0,
111 NULL);
112
113 if (!hThread)
114 {
115 ERR("Can't create PortThread\n");
116 return GetLastError();
117 }
118 else
120
121 return ERROR_SUCCESS;
122}
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
Definition: rpcserver.c:20
#define CloseHandle
Definition: compat.h:739
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:137
HANDLE hThread
Definition: wizard.c:28
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:729

Referenced by NlNetlogonMain().

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( DWORD  dwState)
static

Definition at line 29 of file netlogon.c.

31{
38
39 if (dwState == SERVICE_START_PENDING ||
40 dwState == SERVICE_STOP_PENDING ||
41 dwState == SERVICE_PAUSE_PENDING ||
42 dwState == SERVICE_CONTINUE_PENDING)
44 else
46
49}
DWORD dwServiceType
Definition: winsvc.h:99
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD dwControlsAccepted
Definition: winsvc.h:101
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwCurrentState
Definition: winsvc.h:100
DWORD dwCheckPoint
Definition: winsvc.h:104
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
#define SERVICE_PAUSE_PENDING
Definition: winsvc.h:26
#define SERVICE_CONTINUE_PENDING
Definition: winsvc.h:25
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962

Referenced by NlNetlogonMain(), and ServiceControlHandler().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( netlogon  )

Variable Documentation

◆ hDllInstance

HINSTANCE hDllInstance

Definition at line 17 of file netlogon.c.

Referenced by DllMain().

◆ ServiceName

WCHAR ServiceName[] = L"netlogon"
static

Definition at line 19 of file netlogon.c.

Referenced by NlNetlogonMain().

◆ ServiceStatus

SERVICE_STATUS ServiceStatus
static

Definition at line 22 of file netlogon.c.

Referenced by ServiceControlHandler(), and UpdateServiceStatus().

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle
static

Definition at line 21 of file netlogon.c.

Referenced by NlNetlogonMain(), ServiceControlHandler(), and UpdateServiceStatus().