Ignore:
Timestamp:
23/09/2007 10:18:20 (5 years ago)
Author:
chris
Message:

Use the specified service name when installing and removing the service.

Pass the service name on the service command line, and use it for event
log messages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/general/bin/bbackupd/Win32ServiceFunctions.cpp

    r1853 r1856  
    200200} 
    201201 
    202 int InstallService(const char* pConfigFileName) 
     202int InstallService(const char* pConfigFileName, const std::string& rServiceName) 
    203203{ 
    204204        if (pConfigFileName != NULL) 
     
    236236 
    237237        std::string cmdWithArgs(cmd); 
    238         cmdWithArgs += " -s"; 
     238        cmdWithArgs += " -s -S \"" + rServiceName + "\""; 
    239239 
    240240        if (pConfigFileName != NULL) 
     
    245245        } 
    246246 
     247        std::string serviceDesc = "Box Backup (" + rServiceName + ")"; 
     248 
    247249        SC_HANDLE newService = CreateService( 
    248250                scm,  
    249                 SERVICE_NAME,  
    250                 "Box Backup",  
     251                rServiceName.c_str(), 
     252                serviceDesc.c_str(), 
    251253                SERVICE_ALL_ACCESS,  
    252254                SERVICE_WIN32_OWN_PROCESS,  
     
    313315} 
    314316 
    315 int RemoveService(void) 
     317int RemoveService(const std::string& rServiceName) 
    316318{ 
    317319        SC_HANDLE scm = OpenSCManager(0,0,SC_MANAGER_CREATE_SERVICE); 
     
    324326        } 
    325327 
    326         SC_HANDLE service = OpenService(scm, SERVICE_NAME,  
     328        SC_HANDLE service = OpenService(scm, rServiceName.c_str(),  
    327329                SERVICE_ALL_ACCESS|DELETE); 
    328330        DWORD err = GetLastError(); 
Note: See TracChangeset for help on using the changeset viewer.