diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-03-26 17:41:16 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-03-26 17:41:16 +0100 |
commit | b43d170a167d0f21ab98a051cf97942f76dbf76f (patch) | |
tree | bb3ab69daa72145d203a7aeae89ec58e4761a8a9 /src | |
parent | 54a4e0cb75fc68948178249f45e0c11c8dc33401 (diff) | |
download | wolfbones-b43d170a167d0f21ab98a051cf97942f76dbf76f.tar.gz wolfbones-b43d170a167d0f21ab98a051cf97942f76dbf76f.tar.bz2 |
moved service dispatcher into libwolf
Diffstat (limited to 'src')
-rw-r--r-- | src/service/service.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/service/service.c b/src/service/service.c index 1252c52..bbef383 100644 --- a/src/service/service.c +++ b/src/service/service.c @@ -340,3 +340,22 @@ SERVICE_END: return; } + +wolf_error_t wolf_service_start( LPTSTR service_name ) { + BOOL res; + char errbuf[512]; + SERVICE_TABLE_ENTRY dispatch_table[2] = + { { service_name, wolf_service_main }, + { NULL, NULL } }; + + res = StartServiceCtrlDispatcher( dispatch_table ); + if( !res ) { + 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)" ), + service_name, errbuf, GetLastError( ) ); + return WOLF_ERR_INTERNAL; + } + + return WOLF_OK; +} |