mirror of
https://github.com/reactos/reactos.git
synced 2025-01-11 16:51:06 +00:00
[WLANSVC]
Correctly start and report status to the service manager. svn path=/trunk/; revision=46099
This commit is contained in:
parent
8e7d72058b
commit
f4e17f00cb
1 changed files with 8 additions and 6 deletions
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
SERVICE_STATUS_HANDLE ServiceStatusHandle;
|
SERVICE_STATUS_HANDLE ServiceStatusHandle;
|
||||||
SERVICE_STATUS SvcStatus;
|
SERVICE_STATUS SvcStatus;
|
||||||
|
static WCHAR ServiceName[] = L"WlanSvc";
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
static DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
|
static DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
|
||||||
|
@ -94,13 +95,14 @@ ServiceMain(DWORD argc, LPWSTR *argv)
|
||||||
DPRINT("ServiceMain() called\n");
|
DPRINT("ServiceMain() called\n");
|
||||||
|
|
||||||
SvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
SvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
||||||
|
SvcStatus.dwCurrentState = SERVICE_START_PENDING;
|
||||||
SvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
|
SvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
|
||||||
SvcStatus.dwCheckPoint = 0;
|
SvcStatus.dwCheckPoint = 0;
|
||||||
SvcStatus.dwWin32ExitCode = 0;
|
SvcStatus.dwWin32ExitCode = NO_ERROR;
|
||||||
SvcStatus.dwServiceSpecificExitCode = 0;
|
SvcStatus.dwServiceSpecificExitCode = 0;
|
||||||
SvcStatus.dwWaitHint = 4000;
|
SvcStatus.dwWaitHint = 4000;
|
||||||
|
|
||||||
ServiceStatusHandle = RegisterServiceCtrlHandlerExW(SERVICE_NAME,
|
ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName,
|
||||||
ServiceControlHandler,
|
ServiceControlHandler,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@ -115,15 +117,15 @@ ServiceMain(DWORD argc, LPWSTR *argv)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!hThread)
|
if (!hThread)
|
||||||
|
{
|
||||||
DPRINT("Can't create RpcThread\n");
|
DPRINT("Can't create RpcThread\n");
|
||||||
|
UpdateServiceStatus(ServiceStatusHandle, SERVICE_STOPPED, 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitForSingleObject(hThread, INFINITE);
|
|
||||||
CloseHandle(hThread);
|
CloseHandle(hThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateServiceStatus(ServiceStatusHandle, SERVICE_STOPPED, 0);
|
|
||||||
|
|
||||||
DPRINT("ServiceMain() done\n");
|
DPRINT("ServiceMain() done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +134,7 @@ wmain(int argc, WCHAR *argv[])
|
||||||
{
|
{
|
||||||
SERVICE_TABLE_ENTRYW ServiceTable[2] =
|
SERVICE_TABLE_ENTRYW ServiceTable[2] =
|
||||||
{
|
{
|
||||||
{SERVICE_NAME, ServiceMain},
|
{ServiceName, ServiceMain},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue