Changeset 1853
- Timestamp:
- 22/09/2007 00:03:10 (16 months ago)
- Location:
- box/chris/general/bin/bbackupd
- Files:
-
- 3 modified
-
Win32BackupService.cpp (modified) (1 diff)
-
Win32ServiceFunctions.cpp (modified) (5 diffs)
-
Win32ServiceFunctions.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbackupd/Win32BackupService.cpp
r1813 r1853 15 15 Win32BackupService* gpDaemonService = NULL; 16 16 extern HANDLE gStopServiceEvent; 17 extern DWORD gServiceReturnCode; 17 18 18 19 unsigned int WINAPI RunService(LPVOID lpParameter) 19 20 { 20 21 DWORD retVal = gpDaemonService->WinService((const char*) lpParameter); 22 gServiceReturnCode = retVal; 21 23 SetEvent(gStopServiceEvent); 22 24 return retVal; -
box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp
r1813 r1853 31 31 SERVICE_STATUS_HANDLE gServiceStatusHandle = 0; 32 32 HANDLE gStopServiceEvent = 0; 33 DWORD gServiceReturnCode = 0; 33 34 34 35 #define SERVICE_NAME "boxbackup" … … 44 45 char buf[256]; 45 46 memset(buf, 0, sizeof(buf)); 46 _snprintf(buf, sizeof(buf)-1, "%s (%d)", s, err); 47 _snprintf(buf, sizeof(buf)-1, "%s: %s", s, 48 GetErrorMessage(err).c_str()); 47 49 BOX_ERROR(buf); 48 50 MessageBox(0, buf, "Error", … … 157 159 gServiceStatus.dwControlsAccepted &= 158 160 ~(SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); 161 159 162 gServiceStatus.dwCurrentState = SERVICE_STOPPED; 163 164 if (gServiceReturnCode != 0) 165 { 166 gServiceStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR; 167 gServiceStatus.dwServiceSpecificExitCode = gServiceReturnCode; 168 } 169 160 170 SetServiceStatus(gServiceStatusHandle, &gServiceStatus); 161 171 } 162 172 } 163 173 164 int OurService(c har* pConfigFileName)165 { 166 spConfigFileName = pConfigFileName;174 int OurService(const char* pConfigFileName) 175 { 176 spConfigFileName = strdup(pConfigFileName); 167 177 168 178 SERVICE_TABLE_ENTRY serviceTable[] = … … 176 186 success = StartServiceCtrlDispatcher(serviceTable); 177 187 188 free(spConfigFileName); 189 spConfigFileName = NULL; 190 178 191 if (!success) 179 192 { … … 223 236 224 237 std::string cmdWithArgs(cmd); 225 cmdWithArgs += " - -service";238 cmdWithArgs += " -s"; 226 239 227 240 if (pConfigFileName != NULL) -
box/chris/general/bin/bbackupd/Win32ServiceFunctions.h
r1813 r1853 15 15 int RemoveService (void); 16 16 int InstallService (const char* pConfigFilePath); 17 int OurService (c har* pConfigFileName);17 int OurService (const char* pConfigFileName); 18 18 19 19 #endif
