Ignore:
Timestamp:
08/20/10 12:19:08 (21 months ago)
Author:
jay
Message:
  • Replaced sample.h with svcdefines.h.
  • Changes the function calling for uninstall, start, and stop service to avoid declaration of global array variable (to avoid common memory leaks)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/win32service/svcconfig/src/svcconfig.cpp

    r78 r86  
    44#include <stdio.h> 
    55#include "svcconfig.h" 
     6#include "svc/svcdefines.h" 
    67 
    78#pragma comment(lib, "advapi32.lib") 
    89 
    9 TCHAR szConfigCommand[TEXT_SIZE]; 
    10 TCHAR szConfigSvcName[TEXT_SIZE]; 
     10//TCHAR szConfigCommand[TEXT_SIZE]; 
     11//TCHAR ConfigSvcName[TEXT_SIZE]; 
    1112 
    1213 
     
    2122//   None 
    2223// 
    23 //void __cdecl _tmain(int argc, TCHAR *argv[]) 
    24 bool svcconfig (TCHAR * argv[]) 
     24/*void __cdecl _tmain(int argc, TCHAR *argv[]) 
    2525{ 
    2626        bool result = true; 
     
    3333        return; 
    3434    } 
    35         */ 
     35         
    3636    StringCchCopy(szConfigCommand, TEXT_SIZE, argv[1]); 
    3737    StringCchCopy(szConfigSvcName, TEXT_SIZE, argv[2]); 
     
    5555        return result; 
    5656} 
    57 /* 
     57 
    5858VOID __stdcall DisplayUsage() 
    5959{ 
     
    105105    schService = OpenService(  
    106106        schSCManager,          // SCM database  
    107         szConfigSvcName,             // name of service  
     107        /*szConfigSvcName*/SVCNAME,             // name of service  
    108108        SERVICE_QUERY_CONFIG); // need query config access  
    109109  
     
    183183    // Print the configuration information. 
    184184  
    185     _tprintf(TEXT("%s configuration: \n"), szConfigSvcName); 
     185    _tprintf(TEXT("%s configuration: \n"), /*szConfigSvcName*/SVCNAME); 
    186186    _tprintf(TEXT("  Type: 0x%x\n"), lpsc->dwServiceType); 
    187187    _tprintf(TEXT("  Start Type: 0x%x\n"), lpsc->dwStartType); 
     
    239239    schService = OpenService(  
    240240        schSCManager,            // SCM database  
    241         szConfigSvcName,               // name of service  
     241        /*szConfigSvcName*/SVCNAME,               // name of service  
    242242        SERVICE_CHANGE_CONFIG);  // need change config access  
    243243  
     
    304304    schService = OpenService(  
    305305        schSCManager,            // SCM database  
    306         szConfigSvcName,               // name of service  
     306        /*szConfigSvcName*/SVCNAME,               // name of service  
    307307        SERVICE_CHANGE_CONFIG);  // need change config access  
    308308  
     
    371371    schService = OpenService(  
    372372        schSCManager,            // SCM database  
    373         szConfigSvcName,               // name of service  
     373        /*szConfigSvcName*/SVCNAME,               // name of service  
    374374        SERVICE_CHANGE_CONFIG);  // need change config access  
    375375  
     
    431431    schService = OpenService(  
    432432        schSCManager,       // SCM database  
    433         szConfigSvcName,          // name of service  
     433        /*szConfigSvcName*/SVCNAME,          // name of service  
    434434        DELETE);            // need delete access  
    435435  
Note: See TracChangeset for help on using the changeset viewer.