ReactOS  0.4.14-dev-606-g14ebc0b
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.

Function Documentation

◆ RpcThreadRoutine()

DWORD WINAPI RpcThreadRoutine ( LPVOID  lpParameter)

Definition at line 16 of file rpcserver.c.

17 {
19 
20  Status = RpcServerUseProtseqEpW(L"ncalrpc", 20, L"DNSResolver", NULL);
21  if (Status != RPC_S_OK)
22  {
23  DPRINT("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
24  return 0;
25  }
26 
27  Status = RpcServerRegisterIf(DnsResolver_v2_0_s_ifspec, NULL, NULL);
28  if (Status != RPC_S_OK)
29  {
30  DPRINT("RpcServerRegisterIf() failed (Status %lx)\n", Status);
31  return 0;
32  }
33 
35  if (Status != RPC_S_OK)
36  {
37  DPRINT("RpcServerListen() failed (Status %lx)\n", Status);
38  }
39 
40  DPRINT("RpcServerListen finished\n");
41  return 0;
42 }
long RPC_STATUS
Definition: rpc.h:52
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1520
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1116
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:927
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by ServiceMain().

◆ ServiceControlHandler()

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

Definition at line 40 of file wlansvc.c.

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:1596
#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

Referenced by ServiceMain().

◆ ServiceMain()

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

Definition at line 62 of file wlansvc.c.

63 {
65 
68 
69  DPRINT("ServiceMain() called\n");
70 
77  SvcStatus.dwWaitHint = 4000;
78 
81  NULL);
82 
84 
86  0,
89  NULL,
90  0,
91  NULL);
92 
93  if (!hThread)
94  {
95  DPRINT("Can't create RpcThread\n");
97  }
98  else
99  {
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:406
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 argv
Definition: mplay32.c:18
#define NO_ERROR
Definition: dderror.h:5
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: wlansvc.c:40
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:136
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: rpcserver.c:16
DWORD dwServiceType
Definition: winsvc.h:99
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:810
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

Referenced by wmain().

◆ UpdateServiceStatus()

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

Definition at line 28 of file wlansvc.c.

29 {
30  if (Increment > 0)
32  else
34 
35  SvcStatus.dwCurrentState = NewStatus;
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:995
DWORD dwCheckPoint
Definition: winsvc.h:104
SERVICE_STATUS_HANDLE hServiceStatus
Definition: main.c:10
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42

Referenced by ServiceControlHandler(), and ServiceMain().

◆ 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 
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
#define argv
Definition: mplay32.c:18
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1132
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID WINAPI ExitThread(IN DWORD uExitCode)
Definition: thread.c:364
static WCHAR ServiceName[]
Definition: wlansvc.c:22
SERVICE_TABLE_ENTRYW ServiceTable[]
Definition: service.c:18

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.

Referenced by ServiceMain(), and UpdateServiceStatus().