diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-08-09 17:27:46 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-08-09 17:27:46 +0000 |
commit | bec6ea866b973c9661b4b2d4a7d342fa0a075185 (patch) | |
tree | d15ccb961e88018f7b23da269920de9c0274fdd3 /bin/bbackupd/Win32ServiceFunctions.cpp | |
parent | 52dfab19cd69b6423af80c7276caa5b65fdd6545 (diff) |
* bin/bbackupd/Win32ServiceFunctions.h
* bin/bbackupd/Win32ServiceFunctions.cpp
- InstallService() and OurService() take the config file name as a
parameter
- InstallService() returns an integer status code like RemoveService()
- OurService() sets the global static config file name to pass into
the main thread later
* bin/bbackupd/bbackupd.cpp
- Call InstallService() and OurService() with the config file name as a
parameter
Diffstat (limited to 'bin/bbackupd/Win32ServiceFunctions.cpp')
-rw-r--r-- | bin/bbackupd/Win32ServiceFunctions.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/bbackupd/Win32ServiceFunctions.cpp b/bin/bbackupd/Win32ServiceFunctions.cpp index ca8bc1ca..4a54fd1c 100644 --- a/bin/bbackupd/Win32ServiceFunctions.cpp +++ b/bin/bbackupd/Win32ServiceFunctions.cpp @@ -161,8 +161,10 @@ VOID ServiceMain(DWORD argc, LPTSTR *argv) } } -void OurService(void) +void OurService(char* pConfigFileName) { + spConfigFileName = pConfigFileName; + SERVICE_TABLE_ENTRY serviceTable[] = { { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION) ServiceMain }, @@ -181,7 +183,7 @@ void OurService(void) } } -void InstallService(void) +int InstallService(const char* pConfigFileName) { SC_HANDLE newService, scm; @@ -191,7 +193,7 @@ void InstallService(void) { syslog(LOG_ERR, "Failed to open service control manager: " "error %d", GetLastError()); - return; + return 1; } char cmd[MAX_PATH]; @@ -217,7 +219,7 @@ void InstallService(void) { ::syslog(LOG_ERR, "Failed to create Box Backup service: " "error %d", GetLastError()); - return; + return 1; } ::syslog(LOG_INFO, "Created Box Backup service"); @@ -234,6 +236,8 @@ void InstallService(void) CloseServiceHandle(newService); CloseServiceHandle(scm); + + return 0; } int RemoveService(void) |