httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/dso/win32 dso.c
Date Sun, 08 Oct 2000 06:00:27 GMT
wrowe       00/10/07 23:00:27

  Modified:    src/os/win32 mod_isapi.c
               src/lib/apr/dso/win32 dso.c
  Log:
    Movin on over from 1.3.13-dev : this patch fixes the problem of nasty
    popup windows alerting an Admin that the isapi isn't working, and
    simplifies mod_isapi by relying on dso.
  
  Revision  Changes    Path
  1.27      +18 -35    apache-2.0/src/os/win32/mod_isapi.c
  
  Index: mod_isapi.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/os/win32/mod_isapi.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_isapi.c	2000/10/06 22:33:44	1.26
  +++ mod_isapi.c	2000/10/08 06:00:26	1.27
  @@ -136,7 +136,7 @@
   
   typedef struct {
       const char *filename;
  -    HINSTANCE handle;
  +    apr_dso_handle_t *handle;
       HSE_VERSION_INFO *pVer;
       PFN_GETEXTENSIONVERSION GetExtensionVersion;
       PFN_HTTPEXTENSIONPROC   HttpExtensionProc;
  @@ -225,8 +225,7 @@
                                  isapi_loaded** isa)
   {
       isapi_loaded **found = (isapi_loaded **)sconf->loaded->elts;
  -    char *fspec;
  -    char *ch;
  +    apr_status_t rv;
       int n;
   
       for (n = 0; n < sconf->loaded->nelts; ++n) {
  @@ -261,59 +260,43 @@
           (*isa)->fakeasync = TRUE;
           (*isa)->reportversion = MAKELONG(0, 5); /* Revision 5.0 */
       }
  -        
  -    /* Per PR2555, the LoadLibraryEx function is very picky about slashes.
  -     * Debugging on NT 4 SP 6a reveals First Chance Exception within NTDLL.
  -     * LoadLibrary in the MS PSDK also reveals that it -explicitly- states
  -     * that backslashes must be used.
  -     *
  -     * Transpose '\' for '/' in the filename.
  -     */
  -    ch = fspec = apr_pstrdup(p, fpath);
  -    while (*ch) {
  -        if (*ch == '/')
  -            *ch = '\\';
  -        ++ch;
  -    }
  -
  -    (*isa)->handle = LoadLibraryEx(fspec, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
  -
  -    if (!(*isa)->handle)
  +    
  +    rv = apr_dso_load(&(*isa)->handle, fpath, p);
  +    if (rv)
       {
  -        apr_status_t rv = apr_get_os_error();
  -        ap_log_rerror(APLOG_MARK, APLOG_ALERT, apr_get_os_error(), r,
  +        ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r,
                         "ISAPI %s failed to load", fpath);
           (*isa)->handle = NULL;
           return rv;
       }
   
  -    if (!((*isa)->GetExtensionVersion = (void *)(GetProcAddress((*isa)->handle,
  -                                                      "GetExtensionVersion"))))
  +    rv = apr_dso_sym((void**)&(*isa)->GetExtensionVersion, (*isa)->handle,
  +                     "GetExtensionVersion");
  +    if (rv)
       {
  -        apr_status_t rv = apr_get_os_error();
           ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r,
                         "ISAPI %s is missing GetExtensionVersion()",
                         fpath);
  -        FreeLibrary((*isa)->handle);
  +        apr_dso_unload((*isa)->handle);
           (*isa)->handle = NULL;
           return rv;
       }
   
  -    if (!((*isa)->HttpExtensionProc = (void *)(GetProcAddress((*isa)->handle,
  -                                                       "HttpExtensionProc")))) 
  +    rv = apr_dso_sym((void**)&(*isa)->HttpExtensionProc, (*isa)->handle,
  +                     "HttpExtensionProc");
  +    if (rv)
       {
  -        apr_status_t rv = apr_get_os_error();
           ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r,
                         "ISAPI %s is missing HttpExtensionProc()",
                         fpath);
  -        FreeLibrary((*isa)->handle);
  +        apr_dso_unload((*isa)->handle);
           (*isa)->handle = NULL;
           return rv;
       }
   
       /* TerminateExtension() is an optional interface */
  -    (*isa)->TerminateExtension = (void *)(GetProcAddress((*isa)->handle, 
  -                                                       "TerminateExtension"));
  +    rv = apr_dso_sym((void**)&(*isa)->TerminateExtension, (*isa)->handle,
  +                     "TerminateExtension");
       SetLastError(0);
   
       /* Run GetExtensionVersion() */
  @@ -322,7 +305,7 @@
           ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r,
                         "ISAPI %s call GetExtensionVersion() failed", 
                         fpath);
  -        FreeLibrary((*isa)->handle);
  +        apr_dso_unload((*isa)->handle);
           (*isa)->handle = NULL;
           return rv;
       }
  @@ -347,7 +330,7 @@
           else if (!(*isa->TerminateExtension)(HSE_TERM_ADVISORY_UNLOAD))
               return FALSE;
       }
  -    FreeLibrary(isa->handle);
  +    apr_dso_unload(isa->handle);
       isa->handle = NULL;
       return TRUE;
   }
  
  
  
  1.13      +9 -4      apache-2.0/src/lib/apr/dso/win32/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/dso/win32/dso.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- dso.c	2000/10/06 22:02:00	1.12
  +++ dso.c	2000/10/08 06:00:27	1.13
  @@ -61,7 +61,8 @@
                           apr_pool_t *ctx)
   {
       HINSTANCE os_handle;
  -    char fspec[MAX_PATH], *p;
  +    char fspec[MAX_PATH], *p = fspec;
  +    UINT em;
   
       /* Must convert path from / to \ notation.
        * Per PR2555, the LoadLibraryEx function is very picky about slashes.
  @@ -70,11 +71,15 @@
        * that backslashes must be used for the LoadLibrary family of calls.
        */
       apr_cpystrn(fspec, path, MAX_PATH);
  -    for (p = fspec; *p; ++p)
  -        if (*p == '/')
  -            *p = '\\';
  +    while (p = strchr(p, '/'))
  +        *p = '\\';
           
  +    /* Prevent ugly popups from killing our app */
  +    em = SetErrorMode(SEM_FAILCRITICALERRORS);
       os_handle = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
  +    if (!os_handle)
  +        os_handle = LoadLibraryEx(path, NULL, 0);
  +    SetErrorMode(em);
       *res_handle = apr_pcalloc(ctx, sizeof(*res_handle));
   
       if(os_handle == NULL) {
  
  
  

Mime
View raw message