summaryrefslogtreecommitdiff
path: root/vdservice
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-05-11 16:24:24 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-05-24 13:55:31 +0200
commit2ab4fb7832d4630aced7e125a68af93f6f0079a9 (patch)
treea72eab01669e21268c42bede7e361d932e2b9aa9 /vdservice
parent1aa23d698ab8ca36ce67e14a4cd5d9cf8bfd8e96 (diff)
Allow running as a normal process again
The service code should be commented out if DEBUG_VDSERVICE. Otherwise it fails to run as a standalone process.
Diffstat (limited to 'vdservice')
-rw-r--r--vdservice/vdservice.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index 9c5f569..3c35609 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -412,13 +412,12 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[])
status->dwServiceSpecificExitCode = NO_ERROR;
status->dwCheckPoint = 0;
status->dwWaitHint = 0;
+#ifndef DEBUG_VDSERVICE
s->_status_handle = RegisterServiceCtrlHandlerEx(VD_SERVICE_NAME, &VDService::control_handler,
NULL);
if (!s->_status_handle) {
- printf("RegisterServiceCtrlHandler failed\n");
-#ifndef DEBUG_VDSERVICE
+ vd_printf("RegisterServiceCtrlHandler failed\n");
return;
-#endif // DEBUG_VDSERVICE
}
// service is starting
@@ -429,10 +428,12 @@ VOID WINAPI VDService::main(DWORD argc, TCHAR* argv[])
status->dwControlsAccepted |= VDSERVICE_ACCEPTED_CONTROLS;
status->dwCurrentState = SERVICE_RUNNING;
SetServiceStatus(s->_status_handle, status);
+#endif //DEBUG_VDSERVICE
s->_running = true;
s->execute();
+#ifndef DEBUG_VDSERVICE
// service was stopped
status->dwCurrentState = SERVICE_STOP_PENDING;
SetServiceStatus(s->_status_handle, status);
@@ -440,7 +441,6 @@ 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
vd_printf("***Service stopped***");