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/win32service/src/svc/svc.cpp

    r78 r86  
    33#include <tchar.h> 
    44#include <strsafe.h> 
    5 #include "svc/Svc.h" 
     5#include "svc/svc.h" 
     6#include "svc/svcdefines.h" 
     7#include "svc/serviceregistry.h" 
    68#include "rtmpserver/rtmpserver.h" 
    79#include "svccontrol.h" 
     
    911 
    1012#pragma comment(lib, "advapi32.lib") 
    11  
    12 #define SVCNAME TEXT("evo") //name of the service 
    13  
    1413 
    1514// 
     
    3029    { 
    3130                SvcInstall(); 
     31                //OpenRegistry(); 
    3232        return; 
    3333    }else if( lstrcmpi( argv[1], TEXT("uninstallService")) == 0) 
    3434    { 
    35                 AddSvcCommand(argv[1]); 
    36                 bool result = svcconfig(svcCommand);//Delete service 
     35                DoDeleteSvc(); 
    3736        return; 
    3837    }  
     
    5251    }  
    5352 
    54         // Control the service 
    55         if( lstrcmpi( argv[1], TEXT("startService")) == 0 || lstrcmpi( argv[1], TEXT("stopService")) == 0) 
    56     { 
    57         AddSvcCommand(argv[1]); 
    58                 svccontrol(svcCommand);//Start/Stop service 
    59         return; 
    60     } else { 
     53        // Control the service and start the server normally 
     54        if( lstrcmpi( argv[1], TEXT("startService")) == 0) 
     55    { 
     56                DoStartSvc(); 
     57        return; 
     58    } else if( lstrcmpi( argv[1], TEXT("stopService")) == 0) 
     59    { 
     60                DoStopSvc(); 
     61        return; 
     62    }else { 
    6163                if ( argc == 1 ) //if no argument, assume that rtmpserver is started normally 
    6264                { 
    63                         AddSvcCommand(TEXT("query")); 
    64                         if (!svcconfig(svcCommand)){ 
     65                        if (!DoQuerySvc){ 
    6566                                printf("Server will start normally.\n\n"); 
    6667                                rtmpserver(); 
     
    7677        } 
    7778 
    78 } 
    79  
    80 //Populates the svcCommand array 
    81 VOID AddSvcCommand(TCHAR * command) 
    82 { 
    83         svcCommand[0] = TEXT(""); 
    84         svcCommand[1] = command; 
    85         svcCommand[2] = SVCNAME; 
    8679} 
    8780 
Note: See TracChangeset for help on using the changeset viewer.