ReactOS  0.4.12-dev-43-g63b00d8
wlansvc.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * FILE: base/services/wlansvc/wlansvc.c
5  * PURPOSE: WLAN Service
6  * PROGRAMMER: Christoph von Wittich
7  */
8 
9 /* INCLUDES *****************************************************************/
10 
11 #include "precomp.h"
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* GLOBALS ******************************************************************/
17 
18 #define SERVICE_NAME L"WLAN Service"
19 
22 static WCHAR ServiceName[] = L"WlanSvc";
23 
25 
26 /* FUNCTIONS *****************************************************************/
27 
29 {
30  if (Increment > 0)
31  SvcStatus.dwCheckPoint += Increment;
32  else
33  SvcStatus.dwCheckPoint = 0;
34 
35  SvcStatus.dwCurrentState = NewStatus;
36  SetServiceStatus(hServiceStatus, &SvcStatus);
37 }
38 
39 static DWORD WINAPI
41  DWORD dwEventType,
42  LPVOID lpEventData,
43  LPVOID lpContext)
44 {
45  switch (dwControl)
46  {
52  break;
54  return NO_ERROR;
55  default:
57  }
58  return NO_ERROR;
59 }
60 
61 static VOID CALLBACK
63 {
65 
68 
69  DPRINT("ServiceMain() called\n");
70 
74  SvcStatus.dwCheckPoint = 0;
75  SvcStatus.dwWin32ExitCode = NO_ERROR;
76  SvcStatus.dwServiceSpecificExitCode = 0;
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 }
105 
106 int
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 }
128 
129 /* EOF */
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
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1599
DWORD dwCurrentState
Definition: winsvc.h:100
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
__wchar_t WCHAR
Definition: xmlstorage.h:180
static VOID CALLBACK ServiceMain(DWORD argc, LPWSTR *argv)
Definition: wlansvc.c:62
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define CALLBACK
Definition: compat.h:27
#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
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1094
static char ** argv
Definition: ServiceArgs.c:11
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:957
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_CONTROL_INTERROGATE
Definition: winsvc.h:39
VOID WINAPI ExitThread(IN DWORD uExitCode)
Definition: thread.c:327
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwWin32ExitCode
Definition: winsvc.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
Definition: rpc.c:26
DWORD dwServiceType
Definition: winsvc.h:99
static const WCHAR L[]
Definition: oid.c:1087
LPVOID lpParameter
Definition: kernel32.h:232
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:773
SERVICE_STATUS_HANDLE hServiceStatus
Definition: main.c:10
#define WINAPI
Definition: msvc.h:20
static WCHAR ServiceName[]
Definition: wlansvc.c:22
static SERVICE_TABLE_ENTRYW ServiceTable[2]
Definition: eventlog.c:24
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
int wmain(int argc, WCHAR *argv[])
Definition: wlansvc.c:107
HANDLE hThread
Definition: wizard.c:27
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
WCHAR * LPWSTR
Definition: xmlstorage.h:184
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40