summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-03-28 08:28:30 +0100
committerAndreas Baumann <abaumann@yahoo.com>2009-03-28 08:28:30 +0100
commit03d693a59e880e33e895b29f5cc1ff849c8945fe (patch)
tree12467fd14ba7b1eaacd6ee3010ad3c9809ee78c7 /src
parent8cd8c5a31ccd476ec943253a70e17f19aaa8c873 (diff)
downloadwolfbones-03d693a59e880e33e895b29f5cc1ff849c8945fe.tar.gz
wolfbones-03d693a59e880e33e895b29f5cc1ff849c8945fe.tar.bz2
fixed foreground mode of testservice, can detect console mode now
Diffstat (limited to 'src')
-rw-r--r--src/service/service.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/service/service.c b/src/service/service.c
index 48a32e4..e1d11c1 100644
--- a/src/service/service.c
+++ b/src/service/service.c
@@ -467,6 +467,13 @@ wolf_error_t wolf_service_start( LPTSTR service_name,
*/
res = StartServiceCtrlDispatcher( dispatch_table );
if( !res ) {
+ /* this is as far as I know the only way to determine
+ * whether the binary runs not as a service..
+ */
+ if( GetLastError( ) == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT ) {
+ return WOLF_ERR_INVALID_STATE;
+ }
+
WOLF_LOG_GET_LAST_ERROR( GetLastError( ), errbuf, 512 );
wolf_log( WOLF_LOG_ERR, WOLF_CATEGORY_SERVICE, WOLF_MSG_SERVICE_CANT_DISPATCH_SERVICE,
_( "Unable to dispatch service '%s': %s (%d)" ),