Ignore:
Timestamp:
08/24/10 15:00:17 (21 months ago)
Author:
jay
Message:

-- fixed bug in starting server normally.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/win32service/win32service/src/svc/serviceregistry.cpp

    r97 r101  
    88#define MAX_VALUE_NAME 16383 
    99 
    10 char * GetSvcRegistry() 
     10char * SvcRegistry(int action) 
    1111{ 
    1212        HKEY hTestKey; 
    1313        HKEY hSvcKey; 
    1414        DWORD retCode; 
    15         char * config_path = "path"; 
     15        char * config_path = ""; 
    1616 
    1717        retCode = RegOpenKeyEx( HKEY_LOCAL_MACHINE, 
     
    2323   if( retCode == ERROR_SUCCESS) 
    2424   { 
    25            hSvcKey = AddKey(); 
    26            if(hSvcKey != NULL) 
     25           hSvcKey = AddKey();//Creates the key if the key does not exist. If it does, it reads the key value. 
     26           if(hSvcKey != NULL){ 
     27                   switch (action) 
     28                   { 
     29                   case ADD_KEY: 
     30                           if(SetKeyValue(hSvcKey) != ERROR_SUCCESS) 
     31                                   return REGIST_ERROR; 
     32                           else { 
     33                                   RegCloseKey(hTestKey); 
     34                                   return REGIST_SUCCESS; 
     35                           } 
     36                           break; 
     37 
     38                   case GET_KEY_VALUE: 
     39                           config_path = QueryKey(hSvcKey); 
     40                           printf("\n configuration path: %s\n", config_path); 
     41                           RegCloseKey(hTestKey); 
     42                           return config_path; //Return the config file path 
     43                           break; 
     44                   } 
     45           }else 
    2746           { 
    28                    SetKeyValue(hSvcKey); 
    29                    config_path = QueryKey(AddKey()); 
    30                    printf("\n configuration path: %s\n", config_path); 
     47                   return REGIST_ERROR; 
    3148           } 
     49 
    3250   } else 
    3351   { 
     
    3553           return REGIST_ERROR; 
    3654   } 
    37     
    38    RegCloseKey(hTestKey); 
    39     
    40    return config_path; 
    41  
    4255} 
    4356 
     
    6780} 
    6881 
    69 void SetKeyValue(HKEY hKey) 
     82DWORD SetKeyValue(HKEY hKey) 
    7083{ 
    7184        DWORD retCode; 
     
    7790        else 
    7891           printf("\n ERROR setting path as key value (%d): %s\n", retCode, FormatWindowsError(retCode)); 
     92 
     93        return retCode; 
    7994} 
    8095 
Note: See TracChangeset for help on using the changeset viewer.