Changeset 97


Ignore:
Timestamp:
08/24/10 08:57:23 (18 months ago)
Author:
jay
Message:

-- Added svcregistry module. This is the initial commit for using the windows registry to store the configuration file's path. The config path is hard-coded

Location:
trunk/sources/win32service/win32service
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/win32service/win32service/include/rtmpserver/rtmpserver.h

    r64 r97  
    77void Run(); 
    88void Cleanup(); 
    9 void rtmpserver(); 
     9void rtmpserver(char * config_filePath); 
  • trunk/sources/win32service/win32service/include/svc/svcdefines.h

    r86 r97  
    33#define SVCNAME TEXT("evo") //name of the service 
    44 
     5//For Registry. Everything is set manually, NOT following any convention. 
     6#define ADD_KEY 1 
     7#define GET_KEY_VALUE 2 
     8#define REGIST_SUCCESS "reg_success" 
     9#define REGIST_ERROR "reg_error" 
    510 
    611// The following are message definitions. 
  • trunk/sources/win32service/win32service/src/rtmpserver/rtmpserver.cpp

    r72 r97  
    3232struct RunningStatus { 
    3333    // startup parameters 
    34     int argc; 
    35  //   char **argv; 
     34 //   int argc; 
     35    char * configPath; 
    3636 
    3737    //Configuration file 
     
    5050RunningStatus gRs = {0}; 
    5151 
    52 void rtmpserver() { 
     52void rtmpserver(char * config_filePath) { 
    5353        InitNetworking(); 
    5454 
     55        gRs.configPath = config_filePath; 
    5556    do { 
    5657        //2. Reset the run flag 
     
    8283 
    8384    gRs.pConfigFile = new ConfigFile(); 
    84         string configFilePath = "C:\\rtmpd-clean\\builders\\VS2010\\Debug\\rtmpserver.lua"/*"rtmpserver.lua"*/; 
     85        string configFilePath = gRs.configPath/*"C:\\rtmpd-clean\\builders\\VS2010\\Debug\\rtmpserver.lua"*/; 
    8586    string fileName; 
    8687    string extension; 
  • trunk/sources/win32service/win32service/src/svc/svc.cpp

    r86 r97  
    2828    if( lstrcmpi( argv[1], TEXT("installService")) == 0 ) 
    2929    { 
    30                 SvcInstall(); 
    31                 //OpenRegistry(); 
     30                if(GetSvcRegistry() != REGIST_ERROR) 
     31                        SvcInstall(); 
     32                else 
     33                        printf("\n The service is not installed because of error(s) in registry\n"); 
    3234        return; 
    3335    }else if( lstrcmpi( argv[1], TEXT("uninstallService")) == 0) 
     
    6567                        if (!DoQuerySvc){ 
    6668                                printf("Server will start normally.\n\n"); 
    67                                 rtmpserver(); 
     69                                rtmpserver(GetSvcRegistry()); 
    6870                                return; 
    6971                        }else{ 
    70                                 printf("\nERROR: Server cannot be started normally.\n\n"); 
    71                                 printf("Service described above is already installed.\n"); 
     72                                printf("\nERROR: Server cannot be started normally because the service described above is already installed. .\n\n"); 
    7273                                printf("Start/Stop the server by starting/stopping the service.\n\n"); 
    7374                                printf("To start server normally, enter 'uninstallService' command to delete the service.\n\n"); 
     
    392393DWORD WINAPI ThreadProc( __in  LPVOID lpParameter) 
    393394{ 
    394         rtmpserver(); 
     395        rtmpserver(SvcRegistry(GET_KEY_VALUE)); 
    395396        //the lines below works too. 
    396397        /*if(Initialize()) 
Note: See TracChangeset for help on using the changeset viewer.