diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-08-09 17:45:36 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-08-09 17:45:36 +0000 |
commit | 432985db4c66b30874af49af456eba5189aa25db (patch) | |
tree | 56195509b59d04cdd1715cfb070b92c163cf77d3 | |
parent | 56a8d711ecbcb5f0c034c26eb0bf9a00cfa27ea5 (diff) |
* bbackupd/Win32BackupService.cpp
- Revert to trunk
-rw-r--r-- | bin/bbackupd/Win32BackupService.cpp | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/bin/bbackupd/Win32BackupService.cpp b/bin/bbackupd/Win32BackupService.cpp index 7cbf4828..aa3bf55c 100644 --- a/bin/bbackupd/Win32BackupService.cpp +++ b/bin/bbackupd/Win32BackupService.cpp @@ -12,51 +12,40 @@ #include "Win32BackupService.h" -Win32BackupService* gpDaemonService = NULL; +Win32BackupService gDaemonService; extern HANDLE gStopServiceEvent; unsigned int WINAPI RunService(LPVOID lpParameter) { - DWORD retVal = gpDaemonService->WinService((const char*) lpParameter); - SetEvent(gStopServiceEvent); + DWORD retVal = gDaemonService.WinService(); + SetEvent( gStopServiceEvent ); return retVal; } void TerminateService(void) { - gpDaemonService->SetTerminateWanted(); + gDaemonService.SetTerminateWanted(); } -DWORD Win32BackupService::WinService(const char* pConfigFileName) +DWORD Win32BackupService::WinService(void) { - char exepath[MAX_PATH]; - GetModuleFileName(NULL, exepath, sizeof(exepath)); - - std::string configfile; + int argc = 2; + //first off get the path name for the default + char buf[MAX_PATH]; - if (pConfigFileName != NULL) - { - configfile = pConfigFileName; - } - else - { - // make the default config file name, - // based on the program path - configfile = exepath; - configfile = configfile.substr(0, - configfile.rfind(DIRECTORY_SEPARATOR_ASCHAR)); - configfile += DIRECTORY_SEPARATOR "bbackupd.conf"; - } - - const char *argv[] = {exepath, "-c", configfile.c_str()}; - int argc = sizeof(argv) / sizeof(*argv); - DWORD ret; + GetModuleFileName(NULL, buf, sizeof(buf)); + std::string buffer(buf); + std::string conf( "-c"); + std::string cfile(buffer.substr(0,(buffer.find("bbackupd.exe"))) + + "bbackupd.conf"); + + const char *argv[] = {conf.c_str(), cfile.c_str()}; MAINHELPER_START - ret = this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); - MAINHELPER_END - return ret; + return this->Main(BOX_FILE_BBACKUPD_DEFAULT_CONFIG, argc, argv); + + MAINHELPER_END } #endif // WIN32 |