The HandlerEx control handler is DWORD WINAPI, not VOID WINAPI .
Patch by Hermes BELUSCA - MAITO.
Fixes ROSAPPS-243.
svn path=/trunk/; revision=57324
ServerCtrlHandler(DWORD dwControl,
DWORD dwEventType,
LPVOID lpEventData,
ServerCtrlHandler(DWORD dwControl,
DWORD dwEventType,
LPVOID lpEventData,
pServInfo->servStatus.dwWin32ExitCode = 0;
pServInfo->servStatus.dwWaitHint = 0;
UpdateStatus(pServInfo, SERVICE_STOP_PENDING, 1);
pServInfo->servStatus.dwWin32ExitCode = 0;
pServInfo->servStatus.dwWaitHint = 0;
UpdateStatus(pServInfo, SERVICE_STOP_PENDING, 1);
case SERVICE_CONTROL_PAUSE:
LogEvent(_T("Setting the service to SERVICE_PAUSED"), 0, 0, LOG_FILE);
InterlockedExchange((LONG *)&bPause, TRUE);
UpdateStatus(pServInfo, SERVICE_PAUSED, 0);
case SERVICE_CONTROL_PAUSE:
LogEvent(_T("Setting the service to SERVICE_PAUSED"), 0, 0, LOG_FILE);
InterlockedExchange((LONG *)&bPause, TRUE);
UpdateStatus(pServInfo, SERVICE_PAUSED, 0);
case SERVICE_CONTROL_CONTINUE:
LogEvent(_T("Setting the service to SERVICE_RUNNING"), 0, 0, LOG_FILE);
InterlockedExchange((LONG *)&bPause, FALSE);
UpdateStatus(pServInfo, SERVICE_RUNNING, 0);
case SERVICE_CONTROL_CONTINUE:
LogEvent(_T("Setting the service to SERVICE_RUNNING"), 0, 0, LOG_FILE);
InterlockedExchange((LONG *)&bPause, FALSE);
UpdateStatus(pServInfo, SERVICE_RUNNING, 0);
case SERVICE_CONTROL_INTERROGATE:
case SERVICE_CONTROL_INTERROGATE:
- if (dwControl > 127 && dwControl < 256) /* user defined */
+ if (dwControl >= 128 && dwControl <= 255) /* User defined */
+ {
LogEvent(_T("User defined control code"), 0, 0, LOG_FILE);
LogEvent(_T("User defined control code"), 0, 0, LOG_FILE);
+ return ERROR_SUCCESS;
+ }
LogEvent(_T("ERROR: Bad control code"), 0, 0, LOG_FILE);
LogEvent(_T("ERROR: Bad control code"), 0, 0, LOG_FILE);
+ return ERROR_INVALID_SERVICE_CONTROL;
+ }