Esempio n. 1
0
DWORD
CNdasDDUService::OnServiceDeviceEvent(
	DWORD dwEventType, 
	LPVOID lpEventData)
{
	LRESULT lResult = OnDeviceEvent((WPARAM)dwEventType, (LPARAM)lpEventData);
	return (lResult == TRUE) ? NO_ERROR : lResult;
}
Esempio n. 2
0
DWORD Service::_HandlerEx(DWORD dwOpcode,DWORD dwEventType,LPVOID lpEventData,LPVOID lpContext)
{
	m_dbgMsg(L"Service::Handler(%lu)", dwOpcode);
    switch (dwOpcode) {
    case SERVICE_CONTROL_STOP: // 1
        SetStatus(SERVICE_STOP_PENDING);
        OnStop();
        m_bIsRunning = FALSE;
		EVLOG_INFO(EVMSG_STOPPED);
        break;

    case SERVICE_CONTROL_PAUSE: // 2
        OnPause();
        break;

    case SERVICE_CONTROL_CONTINUE: // 3
        OnContinue();
        break;

    case SERVICE_CONTROL_INTERROGATE: // 4
        OnInterrogate();
        break;

    case SERVICE_CONTROL_SHUTDOWN: // 5
        OnShutdown();
        break;

    case SERVICE_CONTROL_DEVICEEVENT:
        OnDeviceEvent(dwEventType,lpEventData);
        break;

    default:
        if (dwOpcode >= SERVICE_CONTROL_USER) {
            if (!OnUserControl(dwOpcode)) {
				EVLOG_ERROR(EVMSG_BADREQUEST);
            }
        } else {
            EVLOG_ERROR(EVMSG_BADREQUEST);
        }
        break;
    }

    // Report current status
	m_dbgMsg(L"Updating status (%lu, %lu)", m_hServiceStatus, m_Status.dwCurrentState);

    ::SetServiceStatus(m_hServiceStatus, &m_Status);

#ifdef HANDLEREX
    return NO_ERROR;
#endif HANDLEREX
}