summaryrefslogtreecommitdiff
path: root/vdservice
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-08-23 15:09:28 +0300
committerAlon Levy <alevy@redhat.com>2010-08-23 18:54:12 +0300
commitf3277bd9b7760476966615f3a496db32dd37f717 (patch)
tree5836a174522ff07e1e23f139741d8c433796cba6 /vdservice
parenta32359a4dd7c9bdd0642fa3fc9f61a79218f3395 (diff)
vdservice: add debug only define for standalone executable
Diffstat (limited to 'vdservice')
-rw-r--r--vdservice/vdservice.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index c608317..d30e305 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -24,6 +24,8 @@
#include "vdcommon.h"
#include "vdi_port.h"
+//#define DEBUG_VDSERVICE
+
#define VD_SERVICE_DISPLAY_NAME TEXT("RHEV Spice Agent")
#define VD_SERVICE_NAME TEXT("vdservice")
#define VD_SERVICE_DESCRIPTION TEXT("Enables Spice event injection and display configuration.")
@@ -171,8 +173,13 @@ VDService::~VDService()
bool VDService::run()
{
+#ifndef DEBUG_VDSERVICE
SERVICE_TABLE_ENTRY service_table[] = {{VD_SERVICE_NAME, main}, {0, 0}};
return !!StartServiceCtrlDispatcher(service_table);
+#else
+ main(0, NULL);
+ return true;
+#endif
}
bool VDService::install()
@@ -336,7 +343,9 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[])
NULL);
if (!s->_status_handle) {
printf("RegisterServiceCtrlHandler failed\n");
+#ifndef DEBUG_VDSERVICE
return;
+#endif // DEBUG_VDSERVICE
}
// service is starting
@@ -358,7 +367,9 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[])
// service is stopped
status->dwControlsAccepted &= ~VDSERVICE_ACCEPTED_CONTROLS;
status->dwCurrentState = SERVICE_STOPPED;
+#ifndef DEBUG_VDSERVICE
SetServiceStatus(s->_status_handle, status);
+#endif //DEBUG_VDSERVICE
}
typedef __declspec (align(1)) struct VDAgentDataChunk {