[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 17/20] Add event log entries for suspend and error
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/liteagent/LiteAgent.cpp | 29 ++++++++++++++++++++++++++++- src/liteagent/LiteAgent.h | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/liteagent/LiteAgent.cpp b/src/liteagent/LiteAgent.cpp index 739acbb..568a2cb 100644 --- a/src/liteagent/LiteAgent.cpp +++ b/src/liteagent/LiteAgent.cpp @@ -38,6 +38,8 @@ #include "LiteAgent.h" #include "xeniface_ioctls.h" +#include "messages.h" + #define XENTOOLS_INSTALL_REG_KEY "SOFTWARE\\Citrix\\XenTools" #ifdef _WIN64 @@ -177,7 +179,7 @@ static CLiteAgent s_service; CLiteAgent::CLiteAgent() : m_handle(NULL), m_devs(GUID_INTERFACE_XENIFACE), m_dev(NULL), - m_ctxt_shutdown(NULL), m_ctxt_suspend(NULL), m_update(0) + m_ctxt_shutdown(NULL), m_ctxt_suspend(NULL), m_update(0), m_evtlog(NULL) { m_status.dwServiceType = SERVICE_WIN32; m_status.dwCurrentState = SERVICE_START_PENDING; @@ -290,10 +292,32 @@ bool CLiteAgent::ServiceMainLoop() break; case WAIT_OBJECT_0+2: + if (m_evtlog) { + ReportEvent(m_evtlog, + EVENTLOG_SUCCESS, + 0, + EVENT_XENUSER_UNSUSPENDED, + NULL, + 0, + 0, + NULL, + NULL); + } OnSuspend(); break; default: + if (m_evtlog) { + ReportEvent(m_evtlog, + EVENTLOG_SUCCESS, + 0, + EVENT_XENUSER_UNEXPECTED, + NULL, + 0, + 0, + NULL, + NULL); + } break; } return true; // keep looping @@ -533,10 +557,13 @@ void WINAPI CLiteAgent::__ServiceMain(int argc, char** argv) if (m_handle == NULL) return; + m_evtlog = RegisterEventSource(NULL, SVC_NAME); SetServiceStatus(SERVICE_RUNNING); OnServiceStart(); while (ServiceMainLoop()) ; OnServiceStop(); + DeregisterEventSource(m_evtlog); + m_evtlog = NULL; SetServiceStatus(SERVICE_STOPPED); } diff --git a/src/liteagent/LiteAgent.h b/src/liteagent/LiteAgent.h index 5855416..bb3a22f 100644 --- a/src/liteagent/LiteAgent.h +++ b/src/liteagent/LiteAgent.h @@ -87,6 +87,7 @@ private: // service support HANDLE m_svc_stop; HANDLE m_shutdown; HANDLE m_suspend; + HANDLE m_evtlog; CRITICAL_SECTION m_crit; CDeviceList m_devs; -- 1.9.4.msysgit.1 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |