ReactOS  0.4.12-dev-57-g7050ac4
wlansvc.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for wlansvc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define SERVICE_NAME   L"WLAN Service"
 

Functions

DWORD WINAPI RpcThreadRoutine (LPVOID lpParameter)
 
static void UpdateServiceStatus (HANDLE hServiceStatus, DWORD NewStatus, DWORD Increment)
 
static DWORD WINAPI ServiceControlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
static VOID CALLBACK ServiceMain (DWORD argc, LPWSTR *argv)
 
int wmain (int argc, WCHAR *argv[])
 

Variables

SERVICE_STATUS_HANDLE ServiceStatusHandle
 
SERVICE_STATUS SvcStatus
 
static WCHAR ServiceName [] = L"WlanSvc"
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file wlansvc.c.

◆ SERVICE_NAME

#define SERVICE_NAME   L"WLAN Service"

Definition at line 18 of file wlansvc.c.

Referenced by _RunRemoteTest(), _ServiceMain(), ServiceMain(), START_TEST(), and wmain().

Function Documentation

◆ RpcThreadRoutine()

DWORD WINAPI RpcThreadRoutine ( LPVOID  lpParameter)

Definition at line 26 of file rpc.c.

Referenced by ServiceMain().

27 {
29 
32 
33  Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\EventLog", NULL);
34  if (Status != RPC_S_OK)
35  {
36  DPRINT("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
37  goto Quit;
38  }
39 
40  Status = RpcServerRegisterIf(eventlog_v0_0_s_ifspec, NULL, NULL);
41  if (Status != RPC_S_OK)
42  {
43  DPRINT("RpcServerRegisterIf() failed (Status %lx)\n", Status);
44  goto Quit;
45  }
46 
48  if (Status != RPC_S_OK)
49  {
50  DPRINT("RpcServerListen() failed (Status %lx)\n", Status);
51  }
52 
55  {
57  ElfDeleteEventLogHandle(&LogHandle);
58  }
60 
61 Quit:
63 
64  return 0;
65 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
long RPC_STATUS
Definition: rpc.h:52
static LIST_ENTRY LogHandleListHead
Definition: rpc.c:18
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1527
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
smooth NULL
Definition: ftsmooth.c:416
static NTSTATUS ElfDeleteEventLogHandle(PIELF_HANDLE LogHandle)
Definition: rpc.c:264
static CRITICAL_SECTION LogHandleListCs
Definition: rpc.c:19
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1123
static const WCHAR L[]
Definition: oid.c:1087
PVOID IELF_HANDLE
Definition: eventlogrpc.idl:22
Status
Definition: gdiplustypes.h:24
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:934
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
_In_ UINT _Out_ PNDIS_HANDLE LogHandle
Definition: ndis.h:5363
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ ServiceControlHandler()

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

Definition at line 40 of file wlansvc.c.

Referenced by ServiceMain().

44 {
45  switch (dwControl)
46  {
52  break;
54  return NO_ERROR;
55  default:
57  }
58  return NO_ERROR;
59 }
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1599
#define NO_ERROR
Definition: dderror.h:5
#define SERVICE_STOPPED
Definition: winsvc.h:21
smooth NULL
Definition: ftsmooth.c:416
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39
SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: wlansvc.c:20
static void UpdateServiceStatus(HANDLE hServiceStatus, DWORD NewStatus, DWORD Increment)
Definition: wlansvc.c:28
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40

◆ ServiceMain()

static VOID CALLBACK ServiceMain ( DWORD  argc,
LPWSTR argv 
)
static

Definition at line 62 of file wlansvc.c.

Referenced by wmain().

63 {
65 
68 
69  DPRINT("ServiceMain() called\n");
70 
77  SvcStatus.dwWaitHint = 4000;
78 
81  NULL);
82 
84 
85  hThread = CreateThread(NULL,
86  0,
89  NULL,
90  0,
91  NULL);
92 
93  if (!hThread)
94  {
95  DPRINT("Can't create RpcThread\n");
97  }
98  else
99  {
100  CloseHandle(hThread);
101  }
102 
103  DPRINT("ServiceMain() done\n");
104 }
static int argc
Definition: ServiceArgs.c:12
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:707
#define CloseHandle
Definition: compat.h:398
SERVICE_STATUS SvcStatus
Definition: wlansvc.c:21
DWORD dwCurrentState
Definition: winsvc.h:100
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_START_PENDING
Definition: winsvc.h:22
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
#define NO_ERROR
Definition: dderror.h:5
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: wlansvc.c:40
static char ** argv
Definition: ServiceArgs.c:11
DWORD dwCheckPoint
Definition: winsvc.h:104
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_RUNNING
Definition: winsvc.h:24
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:112
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
Definition: rpc.c:26
DWORD dwServiceType
Definition: winsvc.h:99
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:773
static WCHAR ServiceName[]
Definition: wlansvc.c:22
SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: wlansvc.c:20
DWORD dwControlsAccepted
Definition: winsvc.h:101
static void UpdateServiceStatus(HANDLE hServiceStatus, DWORD NewStatus, DWORD Increment)
Definition: wlansvc.c:28
HANDLE hThread
Definition: wizard.c:27

◆ UpdateServiceStatus()

static void UpdateServiceStatus ( HANDLE  hServiceStatus,
DWORD  NewStatus,
DWORD  Increment 
)
static

Definition at line 28 of file wlansvc.c.

Referenced by ServiceControlHandler(), and ServiceMain().

29 {
30  if (Increment > 0)
32  else
34 
35  SvcStatus.dwCurrentState = NewStatus;
36  SetServiceStatus(hServiceStatus, &SvcStatus);
37 }
SERVICE_STATUS SvcStatus
Definition: wlansvc.c:21
DWORD dwCurrentState
Definition: winsvc.h:100
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:957
DWORD dwCheckPoint
Definition: winsvc.h:104
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42

◆ wmain()

int wmain ( int  argc,
WCHAR argv[] 
)

Definition at line 107 of file wlansvc.c.

108 {
110  {
112  {NULL, NULL}
113  };
114 
117 
118  DPRINT("wlansvc: main() started\n");
119 
120  StartServiceCtrlDispatcherW(ServiceTable);
121 
122  DPRINT("wlansvc: main() done\n");
123 
124  ExitThread(0);
125 
126  return 0;
127 }
static int argc
Definition: ServiceArgs.c:12
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static VOID CALLBACK ServiceMain(DWORD argc, LPWSTR *argv)
Definition: wlansvc.c:62
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1094
static char ** argv
Definition: ServiceArgs.c:11
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID WINAPI ExitThread(IN DWORD uExitCode)
Definition: thread.c:327
static WCHAR ServiceName[]
Definition: wlansvc.c:22
static SERVICE_TABLE_ENTRYW ServiceTable[2]
Definition: eventlog.c:24

Variable Documentation

◆ ServiceName

WCHAR ServiceName[] = L"WlanSvc"
static

Definition at line 22 of file wlansvc.c.

Referenced by ServiceMain(), and wmain().

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle

Definition at line 20 of file wlansvc.c.

Referenced by ServiceControlHandler(), and ServiceMain().

◆ SvcStatus

SERVICE_STATUS SvcStatus

Definition at line 21 of file wlansvc.c.