Changeset 2d69ab6 in nscp for helpers


Ignore:
Timestamp:
03/26/11 21:10:52 (2 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
c391984
Parents:
7443b58
Message:

Added ability to rename service (automagically so you can run 0.4.x and 0.3.x side by side)

Location:
helpers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • helpers/installer-dlls/main_dll/main_dll.cpp

    r197b263 r2d69ab6  
    1313 
    1414LPCWSTR vcsServiceQuery = 
    15 L"SELECT `ShortName`, `LongName`, `Description`, `Program`, `Attributes`, `Component_` FROM `Services`"; 
    16 enum eServiceQuery { feqShortName = 1, feqLongName, feqDesc, feqProgram, feqAttributes, feqComponent }; 
     15L"SELECT `ShortName`, `LongName`, `Description`, `Program`, `Dependencies`, `Attributes`, `Component_` FROM `Services`"; 
     16enum eServiceQuery { feqShortName = 1, feqLongName, feqDesc, feqProgram, feqDeps, feqAttributes, feqComponent }; 
    1717enum eFirewallExceptionAttributes { feaIgnoreFailures = 1 }; 
    1818 
    19 bool install(msi_helper &h, std::wstring exe, std::wstring service_short_name, std::wstring service_long_name, std::wstring service_description); 
     19bool install(msi_helper &h, std::wstring exe, std::wstring service_short_name, std::wstring service_long_name, std::wstring service_description, std::wstring service_deps); 
    2020bool uninstall(msi_helper &h, std::wstring service_name); 
    2121UINT SchedServiceMgmt(__in MSIHANDLE hInstall, msi_helper::WCA_TODO todoSched); 
     
    5353      std::wstring longname = data.get_next_string(); 
    5454      std::wstring desc = data.get_next_string(); 
     55      std::wstring deps = data.get_next_string(); 
    5556      int attr = data.get_next_int(); 
    5657      BOOL fIgnoreFailures = feaIgnoreFailures == (attr & feaIgnoreFailures); 
     
    6061      case msi_helper::WCA_TODO_REINSTALL: 
    6162        h.logMessage(_T("Installing service install: ") + shortname + _T(", ") + file); 
    62         install(h, file, shortname, longname, desc); 
     63        install(h, file, shortname, longname, desc, deps); 
    6364        break; 
    6465 
     
    109110      std::wstring longname = h.get_record_formatted_string(hRec, feqLongName); 
    110111      std::wstring desc = h.get_record_formatted_string(hRec, feqDesc); 
     112      std::wstring deps = h.get_record_formatted_string(hRec, feqDeps); 
    111113      std::wstring program = h.get_record_formatted_string(hRec, feqProgram); 
    112114      int attributes = h.get_record_integer(hRec, feqAttributes); 
     
    127129      custom_data.write_string(longname); 
    128130      custom_data.write_string(desc); 
     131      custom_data.write_string(deps); 
    129132      custom_data.write_int(attributes); 
    130133      //custom_data.write_int(fetApplication); 
     
    274277 
    275278 
    276 bool install(msi_helper &h, std::wstring exe, std::wstring service_short_name, std::wstring service_long_name, std::wstring service_description) { 
     279bool install(msi_helper &h, std::wstring exe, std::wstring service_short_name, std::wstring service_long_name, std::wstring service_desc, std::wstring service_deps) { 
    277280  h.updateProgress(_T("Preparing to install service"), service_short_name); 
    278281  try { 
     
    286289    } 
    287290    h.updateProgress(_T("Installing service"), service_short_name); 
    288     serviceControll::Install(service_short_name, service_long_name, SZDEPENDENCIES, SERVICE_WIN32_OWN_PROCESS, exe); 
     291    serviceControll::Install(service_short_name, service_long_name, service_deps, SERVICE_WIN32_OWN_PROCESS, exe); 
    289292  } catch (const serviceControll::SCException& e) { 
    290293    h.errorMessage(_T("Failed to install service: ") + e.error_); 
     
    292295  } 
    293296  try { 
    294     serviceControll::SetDescription(service_short_name, service_description); 
     297    serviceControll::SetDescription(service_short_name, service_desc); 
    295298  } catch (const serviceControll::SCException& e) { 
    296299    h.errorMessage(_T("Failed to set description of service: ") + e.error_); 
     
    453456 
    454457 
    455 bool start(msi_helper &h, std::wstring service_name = _T("")) { 
    456   if (service_name.empty()) 
    457     service_name = SZSERVICENAME; 
     458bool start(msi_helper &h, std::wstring service_name) { 
    458459  if (!serviceControll::isInstalled(service_name)) { 
    459460    h.logMessage(_T("Service was not installed (so we cannot start it): ")+ service_name); 
     
    474475} 
    475476 
    476 bool stop(msi_helper &h, std::wstring service_name = _T("")) { 
    477   if (service_name.empty()) 
    478     service_name = SZSERVICENAME; 
     477bool stop(msi_helper &h, std::wstring service_name) { 
    479478  h.updateProgress(_T("Preparing to stopp service"), service_name); 
    480479  try { 
  • helpers/installers/installer/Product.wxs

    r197b263 r2d69ab6  
    266266      <Column Id="Program"  Category="Formatted"  PrimaryKey="no"   Type="string" Width="255" Modularize="Property" Nullable="yes" 
    267267          Description="Exception for a program (formatted path name)."/> 
     268      <Column Id="Dependencies" Category="Formatted"  PrimaryKey="no"   Type="string" Width="255" Modularize="Property" Nullable="yes" 
     269          Description="Service Dependencies"/> 
    268270      <Column Id="Attributes" Category="Integer"    PrimaryKey="no"   Type="int"    Width="4"             Nullable="yes" MinValue="0" MaxValue="65536"  
    269271          Description="Vital=1"/> 
     
    277279        <Data Column="Component_">ServiceRegistration</Data> 
    278280        <Data Column="Program">[#NSClientEXE]</Data> 
     281        <Data Column="Dependencies"></Data> 
    279282      </Row> 
    280283    </CustomTable> 
Note: See TracChangeset for help on using the changeset viewer.