[PATCHv2 win-agent 7/9] Allow running as a normal process again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The service code should be commented out if DEBUG_VDSERVICE.
Otherwise it fails to run as a standalone process.
---
 vdservice/vdservice.cpp |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index 48ebd7b..e6b707e 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***");
-- 
1.7.10.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]