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/os/win32 os.h util_win32.c
Date Mon, 01 Jul 2002 17:48:47 GMT
wrowe       2002/07/01 10:48:47

  Modified:    os/win32 os.h util_win32.c
  Log:
    Add ap_os_proc_filepath and clean up the win32/os.h file structure.
  
  Revision  Changes    Path
  1.52      +18 -14    httpd-2.0/os/win32/os.h
  
  Index: os.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/os/win32/os.h,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- os.h	23 Jun 2002 10:24:07 -0000	1.51
  +++ os.h	1 Jul 2002 17:48:47 -0000	1.52
  @@ -56,22 +56,15 @@
    * University of Illinois, Urbana-Champaign.
    */
   
  -#ifndef APACHE_OS_H
  -#define APACHE_OS_H
  -/* 
  - * Compile the server including all the Windows NT 4.0 header files by 
  - * default. We still want the server to run on Win95/98 so use 
  - * runtime checks before calling NT specific functions to verify we are 
  - * really running on an NT system.
  - *
  - * Delegate windows include to the apr.h header, if USER or GDI declarations
  +#ifdef WIN32
  +
  +#ifndef AP_OS_H
  +#define AP_OS_H
  +/* Delegate windows include to the apr.h header, if USER or GDI declarations
    * are required (for a window rather than console application), include
    * windows.h prior to any other Apache header files.
    */
  -
  -#ifndef ap_os_h
  -#define ap_os_h
  -#endif
  +#include "apr_pools.h"
   
   #include <io.h>
   #include <fcntl.h>
  @@ -87,6 +80,10 @@
   
   #include <stddef.h>
   
  +#ifdef __cplusplus
  +extern "C" {
  +#endif
  +
   /* BIG RED WARNING: exit() is mapped to allow us to capture the exit
    * status.  This header must only be included from modules linked into
    * the ApacheCore.dll - since it's a horrible behavior to exit() from
  @@ -100,4 +97,11 @@
   #define exit(status) ((exit)((real_exit_code==2) ? (real_exit_code = (status)) \
                                                    : ((real_exit_code = 0), (status))))
   
  -#endif   /* ! ap_os_h */
  +AP_DECLARE(apr_status_t) ap_os_proc_filepath(char **binpath, apr_pool_t *p);
  +
  +#ifdef __cplusplus
  +}
  +#endif
  +
  +#endif  /* ndef AP_OS_H */
  +#endif  /* def WIN32 */
  
  
  
  1.27      +41 -0     httpd-2.0/os/win32/util_win32.c
  
  Index: util_win32.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/os/win32/util_win32.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- util_win32.c	13 Mar 2002 20:47:59 -0000	1.26
  +++ util_win32.c	1 Jul 2002 17:48:47 -0000	1.27
  @@ -59,10 +59,51 @@
   #include "httpd.h"
   #include "http_log.h"
   #include "apr_strings.h"
  +#include "arch/win32/fileio.h"
  +#include "arch/win32/misc.h"
   
   #include <stdarg.h>
   #include <time.h>
   #include <stdlib.h>
  +
  +
  +AP_DECLARE(apr_status_t) ap_os_proc_filepath(char **binpath, apr_pool_t *p)
  +{
  +    apr_wchar_t wbinpath[APR_PATH_MAX];
  +
  +#if APR_HAS_UNICODE_FS
  +    IF_WIN_OS_IS_UNICODE 
  +    {
  +        apr_size_t binlen;
  +        apr_size_t wbinlen;
  +        apr_status_t rv;
  +        if (!GetModuleFileNameW(NULL, wbinpath, sizeof(wbinpath) 
  +                                              / sizeof(apr_wchar_t))) {
  +            return apr_get_os_error();
  +        }
  +        wbinlen = wcslen(wbinpath) + 1;
  +        binlen = (wbinlen - 1) * 3 + 1;
  +        *binpath = apr_palloc(p, binlen);
  +        rv = apr_conv_ucs2_to_utf8(wbinpath, &wbinlen, *binpath, &binlen);
  +        if (rv != APR_SUCCESS)
  +            return rv;
  +        else if (wbinlen)
  +            return APR_ENAMETOOLONG;
  +    }
  +#endif /* APR_HAS_UNICODE_FS */
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
  +    {
  +        /* share the same scratch buffer */
  +        char *pathbuf = (char*) wbinpath;
  +        if (!GetModuleFileName(NULL, pathbuf, sizeof(wbinpath))) {
  +            return apr_get_os_error();
  +        }
  +        *binpath = apr_pstrdup(p, pathbuf);
  +    }
  +#endif
  +    return APR_SUCCESS;
  +}
   
   
   AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
  
  
  

Mime
View raw message