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
9 /* INCLUDES *****************************************************************/
16 /* GLOBALS ******************************************************************/
18 #define SERVICE_NAME L"WLAN Service"
20 SERVICE_STATUS_HANDLE ServiceStatusHandle
;
21 SERVICE_STATUS SvcStatus
;
22 static WCHAR ServiceName
[] = L
"WlanSvc";
24 DWORD WINAPI
RpcThreadRoutine(LPVOID lpParameter
);
26 /* FUNCTIONS *****************************************************************/
28 static void UpdateServiceStatus(HANDLE hServiceStatus
, DWORD NewStatus
, DWORD Increment
)
31 SvcStatus
.dwCheckPoint
+= Increment
;
33 SvcStatus
.dwCheckPoint
= 0;
35 SvcStatus
.dwCurrentState
= NewStatus
;
36 SetServiceStatus(hServiceStatus
, &SvcStatus
);
40 ServiceControlHandler(DWORD dwControl
,
47 case SERVICE_CONTROL_SHUTDOWN
:
48 case SERVICE_CONTROL_STOP
:
49 UpdateServiceStatus(ServiceStatusHandle
, SERVICE_STOP_PENDING
, 1);
50 RpcMgmtStopServerListening(NULL
);
51 UpdateServiceStatus(ServiceStatusHandle
, SERVICE_STOPPED
, 0);
53 case SERVICE_CONTROL_INTERROGATE
:
56 return ERROR_CALL_NOT_IMPLEMENTED
;
62 ServiceMain(DWORD argc
, LPWSTR
*argv
)
66 UNREFERENCED_PARAMETER(argc
);
67 UNREFERENCED_PARAMETER(argv
);
69 DPRINT("ServiceMain() called\n");
71 SvcStatus
.dwServiceType
= SERVICE_WIN32_OWN_PROCESS
;
72 SvcStatus
.dwCurrentState
= SERVICE_START_PENDING
;
73 SvcStatus
.dwControlsAccepted
= SERVICE_ACCEPT_STOP
| SERVICE_ACCEPT_SHUTDOWN
;
74 SvcStatus
.dwCheckPoint
= 0;
75 SvcStatus
.dwWin32ExitCode
= NO_ERROR
;
76 SvcStatus
.dwServiceSpecificExitCode
= 0;
77 SvcStatus
.dwWaitHint
= 4000;
79 ServiceStatusHandle
= RegisterServiceCtrlHandlerExW(ServiceName
,
80 ServiceControlHandler
,
83 UpdateServiceStatus(ServiceStatusHandle
, SERVICE_RUNNING
, 0);
85 hThread
= CreateThread(NULL
,
87 (LPTHREAD_START_ROUTINE
)
95 DPRINT("Can't create RpcThread\n");
96 UpdateServiceStatus(ServiceStatusHandle
, SERVICE_STOPPED
, 0);
100 CloseHandle(hThread
);
103 DPRINT("ServiceMain() done\n");
107 wmain(int argc
, WCHAR
*argv
[])
109 SERVICE_TABLE_ENTRYW ServiceTable
[2] =
111 {ServiceName
, ServiceMain
},
115 UNREFERENCED_PARAMETER(argc
);
116 UNREFERENCED_PARAMETER(argv
);
118 DPRINT("wlansvc: main() started\n");
120 StartServiceCtrlDispatcherW(ServiceTable
);
122 DPRINT("wlansvc: main() done\n");