httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/winnt mpm_winnt.c nt_eventlog.c service.c
Date Tue, 02 Jul 2002 19:03:16 GMT
wrowe       2002/07/02 12:03:16

  Modified:    server/mpm/winnt mpm_winnt.c nt_eventlog.c service.c
  Log:
    A bit more ap_regkey and apr-ization.  Fixes some new bugs where the
    AP_REGKEY_CREATE flag wasn't passed for ap_regkey_open (when the key
    is expected to not yet exist), and adds the new flags arg to value_set.
  
  Revision  Changes    Path
  1.285     +1 -1      httpd-2.0/server/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.284
  retrieving revision 1.285
  diff -u -r1.284 -r1.285
  --- mpm_winnt.c	1 Jul 2002 20:51:00 -0000	1.284
  +++ mpm_winnt.c	2 Jul 2002 19:03:15 -0000	1.285
  @@ -2157,7 +2157,7 @@
            * without a drive letter.  Change to the default root
            * (path to apache root, above /bin) for safety.
            */
  -        SetCurrentDirectory(def_server_root);
  +        apr_filepath_set(def_server_root, process->pool);
           
           /* Any other process has a console, so we don't to begin
            * a Win9x service until the configuration is parsed and
  
  
  
  1.4       +20 -11    httpd-2.0/server/mpm/winnt/nt_eventlog.c
  
  Index: nt_eventlog.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/nt_eventlog.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- nt_eventlog.c	23 Jun 2002 06:16:05 -0000	1.3
  +++ nt_eventlog.c	2 Jul 2002 19:03:15 -0000	1.4
  @@ -63,6 +63,7 @@
   #include "mpm_winnt.h"
   #include "apr_strings.h"
   #include "apr_lib.h"
  +#include "ap_regkey.h"
   
   static char  *display_name  = NULL;
   static HANDLE stderr_thread = NULL;
  @@ -76,8 +77,12 @@
       char *errmsg = errbuf;
       const char *errarg[9];
       DWORD errres;
  -    HKEY hk;
  +    ap_regkey_t *regkey;
  +    apr_status_t rv;
  +    apr_pool_t *p;
       
  +    apr_pool_sub_make(&p, NULL, NULL);
  +
       errarg[0] = "The Apache service named";
       errarg[1] = display_name;
       errarg[2] = "reported the following error:\r\n>>>";
  @@ -89,23 +94,26 @@
       errarg[8] = NULL;
   
       /* What are we going to do in here, bail on the user?  not. */
  -    if (!RegCreateKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services"
  -                      "\\EventLog\\Application\\Apache Service", &hk)) 
  +    if ((rv = ap_regkey_open(&regkey, AP_REGKEY_LOCAL_MACHINE, 
  +                             "SYSTEM\\CurrentControlSet\\Services\\"
  +                             "EventLog\\Application\\Apache Service",
  +                             APR_READ | APR_WRITE | APR_CREATE, p)) 
  +            == APR_SUCCESS)
       {
  -        /* The stock message file */
  -        char *netmsgkey = "%SystemRoot%\\System32\\netmsg.dll";
           DWORD dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | 
                          EVENTLOG_INFORMATION_TYPE; 
    
  -        RegSetValueEx(hk, "EventMessageFile", 0, REG_EXPAND_SZ,
  -                          (LPBYTE) netmsgkey, strlen(netmsgkey) + 1);
  +        /* The stock message file */
  +        ap_regkey_value_set(regkey, "EventMessageFile", 
  +                            "%SystemRoot%\\System32\\netmsg.dll", 
  +                            AP_REGKEY_EXPAND, p);
           
  -        RegSetValueEx(hk, "TypesSupported", 0, REG_DWORD,
  -                          (LPBYTE) &dwData, sizeof(dwData));
  -        RegCloseKey(hk);
  +        ap_regkey_value_raw_set(regkey, "TypesSupported", &dwData, 
  +                                sizeof(dwData), REG_DWORD, p);
  +        ap_regkey_close(regkey);
       }
   
  -    hEventSource = RegisterEventSource(NULL, "Apache Service");
  +    hEventSource = RegisterEventSourceW(NULL, L"Apache Service");
   
       SetEvent(stderr_ready);
   
  @@ -145,6 +153,7 @@
       DeregisterEventSource(hEventSource);
       CloseHandle(stderr_thread);
       stderr_thread = NULL;
  +    apr_pool_destroy(p);
       return 0;
   }
   
  
  
  
  1.56      +11 -9     httpd-2.0/server/mpm/winnt/service.c
  
  Index: service.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/service.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- service.c	24 Jun 2002 07:53:50 -0000	1.55
  +++ service.c	2 Jul 2002 19:03:15 -0000	1.56
  @@ -513,12 +513,12 @@
                        "SYSTEM\\CurrentControlSet\\Services\\%s", 
                        mpm_service_name);
           rv = ap_regkey_open(&svckey, AP_REGKEY_LOCAL_MACHINE, szPath,
  -                            APR_WRITE, pconf);
  +                            APR_READ | APR_WRITE, pconf);
           if (rv != APR_SUCCESS) {
               return;
           }
           /* Attempt to set the Description value for our service */
  -        ap_regkey_value_set(svckey, "Description", full_description, pconf);
  +        ap_regkey_value_set(svckey, "Description", full_description, 0, pconf);
           ap_regkey_close(svckey);
       }
   }
  @@ -933,9 +933,10 @@
           launch_cmd = apr_psprintf(ptemp, "\"%s\" -n %s -k runservice", 
                                    exe_path, mpm_service_name);
           rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, SERVICECONFIG9X, 
  -                            APR_READ, pconf);
  +                            APR_READ | APR_WRITE | APR_CREATE, pconf);
           if (rv == APR_SUCCESS) {
  -            rv = ap_regkey_value_set(key, mpm_service_name, launch_cmd, pconf);
  +            rv = ap_regkey_value_set(key, mpm_service_name, 
  +                                     launch_cmd, 0, pconf);
               ap_regkey_close(key);
           }
           if (rv != APR_SUCCESS) {
  @@ -947,14 +948,14 @@
   
           apr_snprintf(key_name, sizeof(key_name), SERVICECONFIG, mpm_service_name);
           rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, key_name, 
  -                            APR_READ, pconf);
  +                            APR_READ | APR_WRITE | APR_CREATE, pconf);
           if (rv != APR_SUCCESS) {
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
                            "%s: Failed to create the registry service key.", 
                            mpm_display_name);
               return (rv);
           }
  -        rv = ap_regkey_value_set(key, "ImagePath", launch_cmd, pconf);
  +        rv = ap_regkey_value_set(key, "ImagePath", launch_cmd, 0, pconf);
           if (rv != APR_SUCCESS) {
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
                            "%s: Failed to store ImagePath in the registry.", 
  @@ -962,7 +963,8 @@
               ap_regkey_close(key);
               return (rv);
           }
  -        rv = ap_regkey_value_set(key, "DisplayName", mpm_display_name, pconf);
  +        rv = ap_regkey_value_set(key, "DisplayName", 
  +                                 mpm_display_name, 0, pconf);
           ap_regkey_close(key);
           if (rv != APR_SUCCESS) {
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
  @@ -978,7 +980,7 @@
        */
       apr_snprintf(key_name, sizeof(key_name), SERVICEPARAMS, mpm_service_name);
       rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, key_name, 
  -                        APR_READ, pconf);
  +                        APR_READ | APR_WRITE | APR_CREATE, pconf);
       if (rv == APR_SUCCESS) {
           rv = ap_regkey_value_array_set(key, "ConfigArgs", argc, argv, pconf);
           ap_regkey_close(key);
  @@ -1055,7 +1057,7 @@
           /* TODO: assure the service is stopped before continuing */
   
           rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, SERVICECONFIG9X, 
  -                            APR_WRITE, pconf);
  +                            APR_READ | APR_WRITE | APR_CREATE, pconf);
           if (rv == APR_SUCCESS) {
               rv = ap_regkey_value_remove(key, mpm_service_name, pconf);
               ap_regkey_close(key);
  
  
  

Mime
View raw message