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/os/win32 main_win32.c mod_isapi.c
Date Fri, 06 Oct 2000 17:24:45 GMT
wrowe       00/10/06 10:24:43

  Modified:    src/lib/apr/dso/win32 dso.c
               src/lib/apr/file_io/win32 dir.c filedup.c filestat.c open.c
                        pipe.c readwrite.c seek.c
               src/lib/apr/locks/win32 locks.c
               src/lib/apr/misc/win32 rand.c
               src/lib/apr/network_io/win32 poll.c sendrecv.c sockaddr.c
                        sockets.c sockopt.c
               src/lib/apr/threadproc/win32 proc.c signals.c thread.c
                        threadpriv.c
               src/main http_core.c
               src/modules/mpm/winnt mpm_winnt.c registry.c service.c
               src/os/win32 main_win32.c mod_isapi.c
  Log:
    Here it is, the Win32 part of the big canonical errors patch.
  
    The reason is really, really simple.  If we ever choose to mix clib and
    dos error codes, they criss-cross and don't line up, but they share the
    same number space.  As I wrote the new APR_IS_ERROR macros, I realized
    we were about to shoot ourselves in the foot.
  
    These changes nearly entirely affect Win32 only.  The next big patch will
    affect all of the rv == APR_ENOENT type problems throughout the system.
  
  Revision  Changes    Path
  1.11      +7 -5      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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- dso.c	2000/08/02 05:25:43	1.10
  +++ dso.c	2000/10/06 17:24:37	1.11
  @@ -59,11 +59,13 @@
   apr_status_t apr_dso_load(struct apr_dso_handle_t **res_handle, const char *path, 
                           apr_pool_t *ctx)
   {
  +    /* XXX: Must convert path from / to \ notation
  +     */
       HINSTANCE os_handle = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
       *res_handle = apr_pcalloc(ctx, sizeof(*res_handle));
   
       if(os_handle == NULL) {
  -        (*res_handle)->load_error = GetLastError();
  +        (*res_handle)->load_error = apr_get_os_error();
           return (*res_handle)->load_error;
       }
   
  @@ -76,18 +78,18 @@
   apr_status_t apr_dso_unload(struct apr_dso_handle_t *handle)
   {
       if (!FreeLibrary(handle->handle)) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       return APR_SUCCESS;
   }
   
   apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym, 
  -                       struct apr_dso_handle_t *handle, 
  -                       const char *symname)
  +                         struct apr_dso_handle_t *handle, 
  +                         const char *symname)
   {
       FARPROC retval = GetProcAddress(handle->handle, symname);
       if (!retval) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       
       *ressym = retval;
  
  
  
  1.27      +6 -6      apache-2.0/src/lib/apr/file_io/win32/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- dir.c	2000/08/06 06:07:05	1.26
  +++ dir.c	2000/10/06 17:24:38	1.27
  @@ -76,7 +76,7 @@
   {
       apr_dir_t *dir = thedir;
       if (!CloseHandle(dir->dirhand)) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       return APR_SUCCESS;
   } 
  @@ -103,7 +103,7 @@
   apr_status_t apr_closedir(apr_dir_t *thedir)
   {
       if (!FindClose(thedir->dirhand)) {
  -        return GetLastError();   
  +        return apr_get_os_error();   
       }
       apr_kill_cleanup(thedir->cntxt, thedir, dir_cleanup);
       return APR_SUCCESS;
  @@ -115,12 +115,12 @@
           thedir->entry = apr_pcalloc(thedir->cntxt, sizeof(WIN32_FIND_DATA));
           thedir->dirhand = FindFirstFile(thedir->dirname, thedir->entry);
           if (thedir->dirhand == INVALID_HANDLE_VALUE) {
  -            return GetLastError();
  +            return apr_get_os_error();
           }
           return APR_SUCCESS;
       }
       if (!FindNextFile(thedir->dirhand, thedir->entry)) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       return APR_SUCCESS;
   }
  @@ -146,7 +146,7 @@
   apr_status_t apr_make_dir(const char *path, apr_fileperms_t perm, apr_pool_t *cont)
   {
       if (!CreateDirectory(path, NULL)) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       return APR_SUCCESS;
   }
  @@ -155,7 +155,7 @@
   {
       char *temp = canonical_filename(cont, path);
       if (!RemoveDirectory(temp)) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       return APR_SUCCESS;
   }
  
  
  
  1.21      +4 -4      apache-2.0/src/lib/apr/file_io/win32/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/filedup.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- filedup.c	2000/08/02 05:25:55	1.20
  +++ filedup.c	2000/10/06 17:24:38	1.21
  @@ -77,7 +77,7 @@
                                hCurrentProcess,
                                &(*new_file)->filehand, 0, FALSE, 
                                DUPLICATE_SAME_ACCESS)) {
  -            return GetLastError();
  +            return apr_get_os_error();
           }
       } else {
           HANDLE hFile = (*new_file)->filehand;
  @@ -87,17 +87,17 @@
           if (hFile == GetStdHandle(STD_ERROR_HANDLE)) {
               isStdHandle = TRUE;
               if (!SetStdHandle(STD_ERROR_HANDLE, old_file->filehand))
  -                return GetLastError();
  +                return apr_get_os_error();
           }
           else if (hFile == GetStdHandle(STD_OUTPUT_HANDLE)) {
               isStdHandle = TRUE;
               if (!SetStdHandle(STD_OUTPUT_HANDLE, old_file->filehand))
  -                return GetLastError();
  +                return apr_get_os_error();
           }
           else if (hFile == GetStdHandle(STD_INPUT_HANDLE)) {
               isStdHandle = TRUE;
               if (!SetStdHandle(STD_INPUT_HANDLE, old_file->filehand))
  -                return GetLastError();
  +                return apr_get_os_error();
           }
           else
               return APR_ENOTIMPL;
  
  
  
  1.26      +23 -21    apache-2.0/src/lib/apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/filestat.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- filestat.c	2000/08/09 14:49:14	1.25
  +++ filestat.c	2000/10/06 17:24:38	1.26
  @@ -79,7 +79,11 @@
   
       return type;
   }
  +
   BOOLEAN is_exe(const char* fname, apr_pool_t *cont) {
  +    /*
  +     *  Sleeping code, see notes under apr_stat()
  +     */
       const char* exename;
       const char* ext;
       exename = strrchr(fname, '/');
  @@ -107,12 +111,12 @@
       DWORD FileType;
   
       if (!GetFileInformationByHandle(thefile->filehand, &FileInformation)) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
   
       FileType = GetFileType(thefile->filehand);
       if (!FileType) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
   
       /* If my rudimentary knowledge of posix serves... inode is the absolute
  @@ -195,8 +199,7 @@
       WIN32_FIND_DATA FileInformation;
       HANDLE hFind;
       apr_oslevel_e os_level;
  -    apr_status_t rv = APR_SUCCESS;
  -
  +    
       memset(finfo,'\0', sizeof(*finfo));
   
   	/* We need to catch the case where fname length == MAX_PATH since for
  @@ -206,38 +209,30 @@
   	 * and this is not such a case.
   	 */
       if (strlen(fname) >= MAX_PATH) {
  -        rv = ERROR_FILENAME_EXCED_RANGE;
  +        return APR_ENAMETOOLONG;
       }
       else if (!apr_get_oslevel(cont, &os_level) && os_level >= APR_WIN_98) {
           if (!GetFileAttributesEx(fname, GetFileExInfoStandard, 
                                    (WIN32_FILE_ATTRIBUTE_DATA*) &FileInformation)) {
  -            rv = GetLastError();
  +            return apr_get_os_error();
           }
       }
       else {
  -        /*  The question remains, can we assume fname is not a wildcard?
  -         *  Must we test it?
  +        /*  XXX: The question remains, can we assume fname is not a wildcard?
  +         *  Must we test it?  Absolutely YES.
            */
           hFind = FindFirstFile(fname, &FileInformation);
           if (hFind == INVALID_HANDLE_VALUE) {
  -            rv = GetLastError();
  +            return apr_get_os_error();
       	} else {
               FindClose(hFind);
           }
       }
   
  -    if (rv != APR_SUCCESS) {
  -        /* a little ad-hoc canonicalization to the most common
  -         * error conditions
  -         */
  -        if (rv == ERROR_FILE_NOT_FOUND || rv == ERROR_PATH_NOT_FOUND)
  -            return APR_ENOENT;
  -       return rv;
  -    }
  -
       /* Filetype - Directory or file?
        * Short of opening the handle to the file, the 'FileType' appears
  -     * to be unknowable (in any trustworthy or consistent sense.)
  +     * to be unknowable (in any trustworthy or consistent sense), that
  +     * is, as far as PIPE, CHR, etc.
        */
       if (FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
           finfo->protection = S_IFDIR;
  @@ -264,6 +259,11 @@
        * This is a rather silly test, IMHO... we are looking to test
        * if the user 'may' execute a file (permissions), 
        * not if the filetype is executable.
  +     * XXX: We need to find a solution, for real.  Or provide some
  +     * new mechanism for control.  Note that the PATHEXT env var,
  +     * in the format .ext[;.ext]... actually lists the 'executable'
  +     * types (invoking without an extension.)  Perhaps a registry
  +     * key test is even appropriate here.
        */
   /*  if (is_exe(fname, cont)) {
    *       finfo->protection |= S_IEXEC;
  @@ -276,7 +276,9 @@
       FileTimeToAprTime(&finfo->mtime, &FileInformation.ftLastWriteTime);
   
       /* File size 
  -     * Note: This cannot handle files greater than can be held by an int */
  +     * Note: This cannot handle files greater than can be held by an int 
  +     * XXX: Do we want to tag if nFileSizeHigh as -1 (or 0x7fffffff?)
  +     */
       finfo->size = FileInformation.nFileSizeLow;
   
       return APR_SUCCESS;
  @@ -285,7 +287,7 @@
   apr_status_t apr_lstat(apr_finfo_t *finfo, const char *fname, apr_pool_t *cont)
   {
       /* TODO: determine if apr_lstat is a true NT symlink what the stats of the
  -     * link are, rather than the target.
  +     * link are, rather than the target.  NT5 (W2K) only.
        */
       return apr_stat(finfo, fname, cont);
   }
  
  
  
  1.49      +11 -11    apache-2.0/src/lib/apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/open.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- open.c	2000/09/11 18:27:58	1.48
  +++ open.c	2000/10/06 17:24:38	1.49
  @@ -161,7 +161,7 @@
                                        NULL, createflags, attributes, 0);
   
       if ((*new)->filehand == INVALID_HANDLE_VALUE) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       if (flag & APR_APPEND) {
           SetFilePointer((*new)->filehand, 0, NULL, FILE_END);
  @@ -205,7 +205,7 @@
           return APR_SUCCESS;
       }
       else {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
   }
   
  @@ -216,21 +216,21 @@
       const char *to_canon = canonical_filename(p, to_path);
       DWORD err;
   
  -    /* ### would be nice to use MoveFileEx() here, but it isn't available
  -       ### on Win95/98. MoveFileEx could theoretically help prevent the
  -       ### case where we delete the target but don't move the file(!).
  -       ### it can also copy across devices...
  -    */
  +    /* TODO: would be nice to use MoveFileEx() here, but it isn't available
  +     * on Win95/98. MoveFileEx could theoretically help prevent the
  +     * case where we delete the target but don't move the file(!).
  +     * it can also copy across devices...
  +     */
   
       if (MoveFile(from_canon, to_canon)) {
           return APR_SUCCESS;
       }
  -    err = GetLastError();
  -    if (err == ERROR_FILE_EXISTS || err == ERROR_ALREADY_EXISTS) {
  +    err = apr_get_os_error();
  +    if (APR_STATUS_IS_EEXIST(err)) {
           (void) DeleteFile(to_canon);
           if (MoveFile(from_canon, to_canon))
               return APR_SUCCESS;
  -        err = GetLastError();
  +        err = apr_get_os_error();
       }
       return err;
   }
  @@ -275,7 +275,7 @@
       }
       (*thefile)->filehand = GetStdHandle(STD_ERROR_HANDLE);
       if ((*thefile)->filehand == INVALID_HANDLE_VALUE)
  -        return GetLastError();
  +        return apr_get_os_error();
       (*thefile)->cntxt = cont;
       (*thefile)->fname = "STD_ERROR_HANDLE";
       (*thefile)->eof_hit = 0;
  
  
  
  1.28      +2 -2      apache-2.0/src/lib/apr/file_io/win32/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/pipe.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- pipe.c	2000/08/06 06:07:05	1.27
  +++ pipe.c	2000/10/06 17:24:38	1.28
  @@ -102,7 +102,7 @@
       (*out)->direction = 0;
   
       if (!CreatePipe(&(*in)->filehand, &(*out)->filehand, &sa, 0)) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
   
       return APR_SUCCESS;
  @@ -211,7 +211,7 @@
       else {
           /* Pipes on Win9* are blocking. Live with it. */
           if (!CreatePipe(&(*in)->filehand, &(*out)->filehand, &sa, 0)) {
  -            return GetLastError();
  +            return apr_get_os_error();
           }
       }
   
  
  
  
  1.46      +9 -8      apache-2.0/src/lib/apr/file_io/win32/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readwrite.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- readwrite.c	2000/08/18 04:49:13	1.45
  +++ readwrite.c	2000/10/06 17:24:38	1.46
  @@ -86,8 +86,8 @@
                                  &dwBytesRead,           // pointer to number of bytes read
                                  &dwBytesAvail,          // pointer to total number of bytes available
                                  &dwBytesLeftThisMsg)) { // pointer to unread bytes in this message
  -                rv = GetLastError();
  -                if (rv = ERROR_BROKEN_PIPE)
  +                rv = apr_get_os_error();
  +                if (rv = APR_FROM_OS_ERROR(ERROR_BROKEN_PIPE))
                       return APR_SUCCESS;
               }
               else {
  @@ -107,8 +107,8 @@
       rv = ReadFile(file->filehand, buf, len, nbytes, file->pOverlapped);
   
       if (!rv) {
  -        rv = GetLastError();
  -        if (rv == ERROR_IO_PENDING) {
  +        rv = apr_get_os_error();
  +        if (rv == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
               /* Wait for the pending i/o */
               if (file->timeout > 0) {
                   rv = WaitForSingleObject(file->pOverlapped->hEvent, file->timeout/1000); // timeout in milliseconds...
  @@ -125,7 +125,7 @@
                   rv = APR_TIMEUP;
                   break;
               case WAIT_FAILED:
  -                rv = GetLastError();
  +                rv = apr_get_os_error();
                   break;
               default:
                   break;
  @@ -134,7 +134,7 @@
                   CancelIo(file->filehand);
               }
           }
  -        else if (rv == ERROR_BROKEN_PIPE) {
  +        else if (rv == APR_FROM_OS_ERROR(ERROR_BROKEN_PIPE)) {
               /* Assume ERROR_BROKEN_PIPE signals an EOF reading from a pipe */
               rv = APR_SUCCESS; /* APR_EOF? */
           }
  @@ -263,7 +263,7 @@
           }
           else {
               (*nbytes) = 0;
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
           }
       }
   
  @@ -365,7 +365,8 @@
           apr_status_t rc = 0;
   
           if (thefile->direction == 1 && thefile->bufpos) {
  -            rc = WriteFile(thefile->filehand, thefile->buffer, thefile->bufpos, &written, NULL ) ? 0 : GetLastError();
  +            if (!WriteFile(thefile->filehand, thefile->buffer, thefile->bufpos, &written, NULL))
  +                rc = apr_get_os_error();
               thefile->filePtr += written;
   
               if (rc == 0)
  
  
  
  1.10      +2 -2      apache-2.0/src/lib/apr/file_io/win32/seek.c
  
  Index: seek.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/seek.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- seek.c	2000/08/02 05:25:57	1.9
  +++ seek.c	2000/10/06 17:24:38	1.10
  @@ -76,7 +76,7 @@
           rc = SetFilePointer(thefile->filehand, pos, NULL, FILE_BEGIN);
   
           if ( rc == 0xFFFFFFFF )
  -            rc = GetLastError();
  +            rc = apr_get_os_error();
           else
               rc = thefile->bufpos = thefile->dataRead = 0;
       }
  @@ -132,7 +132,7 @@
           rv = SetFilePointer(thefile->filehand, *offset, NULL, howmove);
           if (rv == -1) {
               *offset = -1;
  -            return GetLastError();
  +            return apr_get_os_error();
           }
           else {
               *offset = rv;
  
  
  
  1.31      +4 -4      apache-2.0/src/lib/apr/locks/win32/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/win32/locks.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- locks.c	2000/08/02 05:26:22	1.30
  +++ locks.c	2000/10/06 17:24:39	1.31
  @@ -107,7 +107,7 @@
       (*lock)->mutex = OpenMutex(MUTEX_ALL_ACCESS, TRUE, fname);
       
       if ((*lock)->mutex == NULL) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       return APR_SUCCESS;
   }
  @@ -125,7 +125,7 @@
               return APR_SUCCESS;
           }
       }
  -    return GetLastError();
  +    return apr_get_os_error();
   }
   
   apr_status_t apr_unlock(apr_lock_t *lock)
  @@ -135,7 +135,7 @@
           return APR_SUCCESS;
       } else {
           if (ReleaseMutex(lock->mutex) == 0) {
  -            return GetLastError();
  +            return apr_get_os_error();
           }
       }
       return APR_SUCCESS;
  @@ -148,7 +148,7 @@
           return APR_SUCCESS;
       } else {
           if (CloseHandle(lock->mutex) == 0) {
  -            return GetLastError();
  +            return apr_get_os_error();
           }
       }
       return APR_SUCCESS;
  
  
  
  1.8       +2 -2      apache-2.0/src/lib/apr/misc/win32/rand.c
  
  Index: rand.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/win32/rand.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- rand.c	2000/09/20 15:37:52	1.7
  +++ rand.c	2000/10/06 17:24:39	1.8
  @@ -62,10 +62,10 @@
       apr_status_t res = APR_SUCCESS;
   
       if (!CryptAcquireContext(&hProv,NULL,NULL,PROV_RSA_FULL,0)) {
  -	return GetLastError();
  +	return apr_get_os_error();
       }
       if (!CryptGenRandom(hProv,length,buf)) {
  -    	res = GetLastError();
  +    	res = apr_get_os_error();
       }
       CryptReleaseContext(hProv, 0);
       return res;
  
  
  
  1.21      +1 -1      apache-2.0/src/lib/apr/network_io/win32/poll.c
  
  Index: poll.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/poll.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- poll.c	2000/08/06 06:07:24	1.20
  +++ poll.c	2000/10/06 17:24:39	1.21
  @@ -135,7 +135,7 @@
   
       (*nsds) = rv;    
       if ((*nsds) < 0) {
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       }
       return APR_SUCCESS;
   }
  
  
  
  1.27      +6 -6      apache-2.0/src/lib/apr/network_io/win32/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sendrecv.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- sendrecv.c	2000/08/18 18:29:39	1.26
  +++ sendrecv.c	2000/10/06 17:24:39	1.27
  @@ -82,7 +82,7 @@
   
       rv = WSASend(sock->sock, &wsaData, 1, &dwBytes, 0, NULL, NULL);
       if (rv == SOCKET_ERROR) {
  -        lasterror = WSAGetLastError();
  +        lasterror = apr_get_netos_error();
           return lasterror;
       }
   
  @@ -104,7 +104,7 @@
   
       rv = WSARecv(sock->sock, &wsaData, 1, &dwBytes, &flags, NULL, NULL);
       if (rv == SOCKET_ERROR) {
  -        lasterror = WSAGetLastError();
  +        lasterror = apr_get_netos_error();
           *len = 0;
           return lasterror;
       }
  @@ -134,7 +134,7 @@
   
       rv = WSASend(sock->sock, pWsaData, nvec, &dwBytes, 0, NULL, NULL);
       if (rv == SOCKET_ERROR) {
  -        lasterror = WSAGetLastError();
  +        lasterror = apr_get_netos_error();
           free(pWsaData);
           return lasterror;
       }
  @@ -270,8 +270,8 @@
                             ptfb,           /* header and trailer buffers */
                             dwFlags);       /* flags to control various aspects of TransmitFile */
           if (!rv) {
  -            status = WSAGetLastError();
  -            if (status == ERROR_IO_PENDING) {
  +            status = apr_get_netos_error();
  +            if (status == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
   #ifdef WAIT_FOR_EVENT
                   rv = WaitForSingleObject(overlapped.hEvent, 
                                            sock->timeout >= 0 ? sock->timeout : INFINITE);
  @@ -286,7 +286,7 @@
                   else if (rv == WAIT_ABANDONED)
                       status = WAIT_ABANDONED;
                   else
  -                    status = GetLastError();
  +                    status = apr_get_os_error();
               }
           }
           if (status != APR_SUCCESS)
  
  
  
  1.12      +1 -1      apache-2.0/src/lib/apr/network_io/win32/sockaddr.c
  
  Index: sockaddr.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sockaddr.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- sockaddr.c	2000/08/02 05:26:31	1.11
  +++ sockaddr.c	2000/10/06 17:24:39	1.12
  @@ -64,7 +64,7 @@
   
       if (getsockname(sock->sock, (struct sockaddr *)sock->local_addr,
                       &namelen) < 0) {
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       }
       else {
           sock->local_port_unknown = sock->local_interface_unknown = 0;
  
  
  
  1.38      +11 -11    apache-2.0/src/lib/apr/network_io/win32/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sockets.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- sockets.c	2000/08/06 06:07:24	1.37
  +++ sockets.c	2000/10/06 17:24:40	1.38
  @@ -66,7 +66,7 @@
   
       if (thesocket->sock != INVALID_SOCKET) {
           if (closesocket(thesocket->sock) == SOCKET_ERROR) {
  -            return WSAGetLastError();
  +            return apr_get_netos_error();
           }
           thesocket->sock = INVALID_SOCKET;
       }
  @@ -94,7 +94,7 @@
        */
       (*new)->sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
       if ((*new)->sock == INVALID_SOCKET) {
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       }
   
       (*new)->local_addr->sin_family = AF_INET;
  @@ -135,7 +135,7 @@
           return APR_SUCCESS;
       }
       else {
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       }
   }
   
  @@ -148,7 +148,7 @@
   apr_status_t apr_bind(apr_socket_t *sock)
   {
       if (bind(sock->sock, (struct sockaddr *)sock->local_addr, sock->addr_len) == -1) {
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       }
       else {
           if (sock->local_addr->sin_port == 0) {
  @@ -161,7 +161,7 @@
   apr_status_t apr_listen(apr_socket_t *sock, apr_int32_t backlog)
   {
       if (listen(sock->sock, backlog) == SOCKET_ERROR)
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       else
           return APR_SUCCESS;
   }
  @@ -186,7 +186,7 @@
                           &(*new)->addr_len);
   
       if ((*new)->sock == INVALID_SOCKET) {
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       }
   
       *(*new)->local_addr = *sock->local_addr;
  @@ -215,7 +215,7 @@
   apr_status_t apr_connect(apr_socket_t *sock, char *hostname)
   {
       struct hostent *hp;
  -    int lasterror;
  +    apr_status_t lasterror;
       fd_set temp;
   
       if ((sock->sock == INVALID_SOCKET) || (!sock->local_addr)) {
  @@ -230,7 +230,7 @@
           else {
               hp = gethostbyname(hostname);
               if (!hp)  {
  -                return WSAGetLastError();
  +                return apr_get_netos_error();
               }
               memcpy((char *)&sock->remote_addr->sin_addr, hp->h_addr_list[0], hp->h_length);
               sock->addr_len = sizeof(*sock->remote_addr);
  @@ -241,15 +241,15 @@
   
       if (connect(sock->sock, (const struct sockaddr *)sock->remote_addr, 
                   sock->addr_len) == SOCKET_ERROR) {
  -        lasterror = WSAGetLastError();
  -        if (lasterror != WSAEWOULDBLOCK) {
  +        lasterror = apr_get_netos_error();
  +        if (lasterror != APR_FROM_OS_ERROR(WSAEWOULDBLOCK)) {
               return lasterror;
           }
           /* wait for the connect to complete */
           FD_ZERO(&temp);
           FD_SET(sock->sock, &temp);
           if (select(sock->sock+1, NULL, &temp, NULL, NULL) == SOCKET_ERROR) {
  -            return WSAGetLastError();
  +            return apr_get_netos_error();
           }
       }
       /* connect was OK .. amazing */
  
  
  
  1.26      +9 -9      apache-2.0/src/lib/apr/network_io/win32/sockopt.c
  
  Index: sockopt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sockopt.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- sockopt.c	2000/08/22 15:09:24	1.25
  +++ sockopt.c	2000/10/06 17:24:40	1.26
  @@ -63,7 +63,7 @@
       int zero = 0;
   
       if (ioctlsocket(sd, FIONBIO, &zero) == SOCKET_ERROR) {
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       }
       return APR_SUCCESS;
   }
  @@ -73,7 +73,7 @@
       int one = 1;
   
       if (ioctlsocket(sd, FIONBIO, &one) == SOCKET_ERROR) {
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       }
       return APR_SUCCESS;
   }
  @@ -124,17 +124,17 @@
       }
       case APR_SO_KEEPALIVE:
           if (setsockopt(sock->sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&one, sizeof(int)) == -1) {
  -            return WSAGetLastError();
  +            return apr_get_netos_error();
           }
           break;
       case APR_SO_DEBUG:
           if (setsockopt(sock->sock, SOL_SOCKET, SO_DEBUG, (void *)&one, sizeof(int)) == -1) {
  -            return WSAGetLastError();
  +            return apr_get_netos_error();
           }
           break;
       case APR_SO_REUSEADDR:
           if (setsockopt(sock->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int)) == -1) {
  -            return WSAGetLastError();
  +            return apr_get_netos_error();
           }
           break;
       case APR_SO_NONBLOCK:
  @@ -153,13 +153,13 @@
           li.l_onoff = on;
           li.l_linger = MAX_SECS_TO_LINGER;
           if (setsockopt(sock->sock, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(struct linger)) == -1) {
  -            return WSAGetLastError();
  +            return apr_get_netos_error();
           }
           break;
       }
       case APR_TCP_NODELAY:
           if (setsockopt(sock->sock, IPPROTO_TCP, TCP_NODELAY, (void *)&on, sizeof(int)) == -1) {
  -            return WSAGetLastError();
  +            return apr_get_netos_error();
           }
           break;
       default:
  @@ -196,7 +196,7 @@
   apr_status_t apr_gethostname(char *buf, int len, apr_pool_t *cont)
   {
       if (gethostname(buf, len) == -1)
  -        return WSAGetLastError();
  +        return apr_get_netos_error();
       else
           return APR_SUCCESS;
   }
  @@ -216,7 +216,7 @@
           return APR_ENOMEM;
       }
   
  -    return WSAGetLastError();
  +    return apr_get_netos_error();
   }
   
   
  
  
  
  1.37      +2 -2      apache-2.0/src/lib/apr/threadproc/win32/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/win32/proc.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- proc.c	2000/08/06 06:07:32	1.36
  +++ proc.c	2000/10/06 17:24:41	1.37
  @@ -333,7 +333,7 @@
   	|| (attr->child_err && !DuplicateHandle(hCurrentProcess, attr->parent_err->filehand,
                                                   hCurrentProcess, &hParenterrdup,
                                                   0, FALSE, DUPLICATE_SAME_ACCESS))) {
  -        rv = GetLastError();
  +        rv = apr_get_os_error();
           if (attr->child_in) {
               apr_close(attr->child_in);
               apr_close(attr->parent_in);
  @@ -423,7 +423,7 @@
           return APR_SUCCESS;
       }
   
  -    return GetLastError();
  +    return apr_get_os_error();
   }
   
   apr_status_t apr_wait_proc(apr_proc_t *proc, apr_wait_how_e wait)
  
  
  
  1.9       +1 -1      apache-2.0/src/lib/apr/threadproc/win32/signals.c
  
  Index: signals.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/win32/signals.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- signals.c	2000/08/06 06:07:32	1.8
  +++ signals.c	2000/10/06 17:24:41	1.9
  @@ -67,7 +67,7 @@
   apr_status_t apr_kill(apr_proc_t *proc, int signal)
   {
       if (TerminateProcess((HANDLE)proc->pid, signal) == 0) {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       return APR_SUCCESS;
   }
  
  
  
  1.24      +3 -3      apache-2.0/src/lib/apr/threadproc/win32/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/win32/thread.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- thread.c	2000/08/02 05:26:43	1.23
  +++ thread.c	2000/10/06 17:24:41	1.24
  @@ -113,7 +113,7 @@
        */
       if (((*new)->td = (HANDLE *)_beginthreadex(NULL, 0, (unsigned int (APR_THREAD_FUNC *)(void *))func,
                                                  data, 0, &temp)) == 0) {
  -        lasterror = GetLastError();
  +        lasterror = apr_get_os_error();
           return APR_EEXIST; /* MSVC++ doc doesn't mention any additional error info */
       }
   
  @@ -139,7 +139,7 @@
           if (GetExitCodeThread(thd->td, retval) == 0) {
               return APR_SUCCESS;
           }
  -        return GetLastError();
  +        return apr_get_os_error();
       }
       else {
           return stat;
  @@ -152,7 +152,7 @@
           return APR_SUCCESS;
       }
       else {
  -        return GetLastError();
  +        return apr_get_os_error();
       }
   }
   
  
  
  
  1.20      +4 -4      apache-2.0/src/lib/apr/threadproc/win32/threadpriv.c
  
  Index: threadpriv.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/win32/threadpriv.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- threadpriv.c	2000/08/02 05:26:43	1.19
  +++ threadpriv.c	2000/10/06 17:24:41	1.20
  @@ -65,7 +65,7 @@
       if (((*key)->key = TlsAlloc()) != 0xFFFFFFFF) {
   	return APR_SUCCESS;
       }
  -    return GetLastError();
  +    return apr_get_os_error();
   }
   
   apr_status_t apr_get_thread_private(void **new, apr_threadkey_t *key)
  @@ -73,7 +73,7 @@
       if ((*new) = TlsGetValue(key->key)) {
           return APR_SUCCESS;
       }
  -    return GetLastError();
  +    return apr_get_os_error();
   }
   
   apr_status_t apr_set_thread_private(void *priv, apr_threadkey_t *key)
  @@ -81,7 +81,7 @@
       if (TlsSetValue(key->key, priv)) {
           return APR_SUCCESS;
       }
  -    return GetLastError();
  +    return apr_get_os_error();
   }
   
   apr_status_t apr_delete_thread_private(apr_threadkey_t *key)
  @@ -89,7 +89,7 @@
       if (TlsFree(key->key)) {
           return APR_SUCCESS; 
       }
  -    return GetLastError();
  +    return apr_get_os_error();
   }
   
   apr_status_t apr_get_threadkeydata(void **data, const char *key,
  
  
  
  1.147     +5 -4      apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- http_core.c	2000/10/06 06:07:07	1.146
  +++ http_core.c	2000/10/06 17:24:41	1.147
  @@ -795,8 +795,9 @@
   }
   
   #ifdef WIN32
  -static DWORD get_win32_registry_default_value(apr_pool_t *p, HKEY hkey, 
  -                                              char* relativepath, char **value)
  +static apr_status_t get_win32_registry_default_value(apr_pool_t *p, HKEY hkey,
  +                                                     char* relativepath, 
  +                                                     char **value)
   {
       HKEY hkeyOpen;
       DWORD type;
  @@ -805,7 +806,7 @@
                                   KEY_QUERY_VALUE, &hkeyOpen);
       
       if (result != ERROR_SUCCESS) 
  -        return result;
  +        return APR_FROM_OS_ERROR(result);
   
       /* Read to NULL buffer to determine value size */
       result = RegQueryValueEx(hkeyOpen, "", 0, &type, NULL, &size);
  @@ -836,7 +837,7 @@
       }
   
       RegCloseKey(hkeyOpen);
  -    return result;
  +    return APR_FROM_OS_ERROR(result);
   }
   
   static char* get_interpreter_from_win32_registry(apr_pool_t *p, const char* ext,
  
  
  
  1.102     +44 -43    apache-2.0/src/modules/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- mpm_winnt.c	2000/10/02 22:32:57	1.101
  +++ mpm_winnt.c	2000/10/06 17:24:42	1.102
  @@ -198,14 +198,15 @@
       if (pSD == NULL || sa == NULL) {
           return NULL;
       }
  +    apr_set_os_error(0);
       if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)
  -	|| GetLastError()) {
  +	|| apr_get_os_error()) {
           LocalFree( pSD );
           LocalFree( sa );
           return NULL;
       }
       if (!SetSecurityDescriptorDacl(pSD, TRUE, (PACL) NULL, FALSE)
  -	|| GetLastError()) {
  +	|| apr_get_os_error()) {
           LocalFree( pSD );
           LocalFree( sa );
           return NULL;
  @@ -314,13 +315,13 @@
   	/* Um, problem, can't signal the parent, which means we can't
   	 * signal ourselves to die. Ignore for now...
   	 */
  -	ap_log_error(APLOG_MARK, APLOG_EMERG, GetLastError(), server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), server_conf,
                        "OpenEvent on %s event", signal_name);
   	return;
       }
       if (SetEvent(e) == 0) {
   	/* Same problem as above */
  -	ap_log_error(APLOG_MARK, APLOG_EMERG, GetLastError(), server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), server_conf,
                        "SetEvent on %s event", signal_name);
   	CloseHandle(e);
   	return;
  @@ -467,7 +468,7 @@
       for (lr = ap_listeners; lr; lr = lr->next) {
           if (!ReadFile(pipe, &WSAProtocolInfo, sizeof(WSAPROTOCOL_INFO), 
                         &BytesRead, (LPOVERLAPPED) NULL)) {
  -            ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                            "setup_inherited_listeners: Unable to read socket data from parent");
               signal_parent(0);	/* tell parent to die */
               exit(1);
  @@ -477,7 +478,7 @@
           nsd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
                           &WSAProtocolInfo, 0, 0);
           if (nsd == INVALID_SOCKET) {
  -            ap_log_error(APLOG_MARK, APLOG_CRIT, WSAGetLastError(), server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_netos_error(), server_conf,
                            "Child %d: setup_inherited_listeners(), WSASocket failed to open the inherited socket.", my_pid);
               signal_parent(0);	/* tell parent to die */
               exit(1);
  @@ -758,7 +759,7 @@
           /* allocate the completion context and the transaction pool */
           context = apr_pcalloc(pconf, sizeof(COMP_CONTEXT));
           if (!context) {
  -            ap_log_error(APLOG_MARK,APLOG_ERR, GetLastError(), server_conf,
  +            ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf,
                            "win9x_get_connection: apr_pcalloc() failed. Process will exit.");
               return NULL;
           }
  @@ -776,7 +777,7 @@
           context->sa_server = apr_palloc(context->ptrans, len);
           if (getsockname(context->accept_socket, 
                           context->sa_server, &len)== SOCKET_ERROR) {
  -            ap_log_error(APLOG_MARK, APLOG_WARNING, WSAGetLastError(), server_conf, 
  +            ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), server_conf, 
                            "getsockname failed");
               continue;
           }
  @@ -784,7 +785,7 @@
           context->sa_client = apr_palloc(context->ptrans, len);
           if ((getpeername(context->accept_socket,
                            context->sa_client, &len)) == SOCKET_ERROR) {
  -            ap_log_error(APLOG_MARK, APLOG_WARNING, WSAGetLastError(), server_conf, 
  +            ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), server_conf, 
                            "getpeername failed");
               memset(&context->sa_client, '\0', sizeof(context->sa_client));
           }
  @@ -819,8 +820,8 @@
           rc = GetQueuedCompletionStatus(hComplPort, &BytesRead, &CompKey,
                                          &pol, 1000);
           if (!rc) {
  -            rc = GetLastError();
  -            if (rc == ERROR_OPERATION_ABORTED) {
  +            rc = apr_get_os_error();
  +            if (rc == APR_FROM_OS_ERROR(ERROR_OPERATION_ABORTED)) {
                   ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, server_conf,
                                "Child %d: - Draining an ABORTED packet off "
                                "the AcceptEx completion port.", my_pid);
  @@ -849,7 +850,7 @@
       /* allocate the completion context */
       context = apr_pcalloc(_pconf, sizeof(COMP_CONTEXT));
       if (!context) {
  -        ap_log_error(APLOG_MARK,APLOG_ERR, GetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf,
                        "create_acceptex_context: apr_pcalloc() failed. Process will exit.");
           return -1;
       }
  @@ -858,7 +859,7 @@
       context->lr = lr;
       context->Overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); 
       if (context->Overlapped.hEvent == NULL) {
  -        ap_log_error(APLOG_MARK,APLOG_ERR, GetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf,
                        "create_acceptex_context: CreateEvent() failed. Process will exit.");
           return -1;
       }
  @@ -867,7 +868,7 @@
       apr_get_os_sock(&nsd, context->lr->sd);
       context->accept_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
       if (context->accept_socket == INVALID_SOCKET) {
  -        ap_log_error(APLOG_MARK,APLOG_ERR, WSAGetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_netos_error(), server_conf,
                        "create_acceptex_context: socket() failed. Process will exit.");
           return -1;
       }
  @@ -876,7 +877,7 @@
       if (setsockopt(context->accept_socket, SOL_SOCKET,
                      SO_UPDATE_ACCEPT_CONTEXT, (char *)&nsd,
                      sizeof(nsd))) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, WSAGetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_netos_error(), server_conf,
                        "setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed.");
           /* Not a failure condition. Keep running. */
       }
  @@ -895,9 +896,9 @@
                     PADDED_ADDR_SIZE, PADDED_ADDR_SIZE,
                     &BytesRead,
                     (LPOVERLAPPED) context)) {
  -        lasterror = WSAGetLastError();
  -        if (lasterror != ERROR_IO_PENDING) {
  -            ap_log_error(APLOG_MARK,APLOG_ERR, WSAGetLastError(), server_conf,
  +        lasterror = apr_get_netos_error();
  +        if (lasterror != APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
  +            ap_log_error(APLOG_MARK,APLOG_ERR, lasterror, server_conf,
                            "create_acceptex_context: AcceptEx failed. Process will exit.");
               return -1;
           }
  @@ -935,7 +936,7 @@
           if (context->accept_socket == INVALID_SOCKET) {
               context->accept_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
               if (context->accept_socket == INVALID_SOCKET) {
  -                rc = WSAGetLastError();
  +                rc = apr_get_netos_error();
                   ap_log_error(APLOG_MARK,APLOG_ERR, rc, server_conf,
                                "reset_acceptex_context: socket() failed. Process will exit.");
                   return rc;
  @@ -944,7 +945,7 @@
               /* SO_UPDATE_ACCEPT_CONTEXT is required for shutdown() to work */
               if (setsockopt(context->accept_socket, SOL_SOCKET,
                              SO_UPDATE_ACCEPT_CONTEXT, (char *)&nsd, sizeof(nsd))) {
  -                ap_log_error(APLOG_MARK, APLOG_WARNING, WSAGetLastError(),
  +                ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(),
                                server_conf,
                                "setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed.");
               }
  @@ -953,8 +954,8 @@
           if (!AcceptEx(nsd, context->accept_socket, context->recv_buf, 0,
                         PADDED_ADDR_SIZE, PADDED_ADDR_SIZE, &BytesRead, 
                         (LPOVERLAPPED) context)) {
  -            rc = WSAGetLastError();
  -            if (rc != ERROR_IO_PENDING) {
  +            rc = apr_get_netos_error();
  +            if (rc != APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
                   ap_log_error(APLOG_MARK, APLOG_INFO, rc, server_conf,
                                "reset_acceptex_context: AcceptEx failed for "
                                "listening socket: %d and accept socket: %d", 
  @@ -1012,8 +1013,8 @@
           rc = GetQueuedCompletionStatus(AcceptExCompPort, &BytesRead, &CompKey,
                                          &pol, INFINITE);
           if (!rc) {
  -            rc = GetLastError();
  -            if (rc != ERROR_OPERATION_ABORTED) {
  +            rc = apr_get_os_error();
  +            if (rc != APR_FROM_OS_ERROR(ERROR_OPERATION_ABORTED)) {
                   /* Is this a deadly condition? 
                    * We sometimes get ERROR_NETNAME_DELETED when a client
                    * disconnects when attempting to reuse sockets. Not sure why 
  @@ -1188,7 +1189,7 @@
       for (lr = ap_listeners; lr != NULL; lr = lr->next) {
           while (lr->count < NUM_LISTENERS) {
               if (create_acceptex_context(pconf, lr) == -1) {
  -                ap_log_error(APLOG_MARK,APLOG_ERR, GetLastError(), server_conf,
  +                ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf,
                                "Unable to create an AcceptEx completion context -- process will exit");
                   signal_parent(0);	/* tell parent to die */
               }
  @@ -1309,7 +1310,7 @@
           cld = rv - WAIT_OBJECT_0;
           if (rv == WAIT_FAILED) {
               /* Something serious is wrong */
  -            ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                            "Child %d: WAIT_FAILED -- shutting down server");
               break;
           }
  @@ -1506,7 +1507,7 @@
                        "Parent: Path to Apache process too long");
           return -1;
       } else if (rv == 0) {
  -        ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                        "Parent: GetModuleFileName() returned NULL for current process.");
           return -1;
       }
  @@ -1544,7 +1545,7 @@
       pEnvVar = '\0';
       /* Create a pipe to send socket info to the child */
       if (!CreatePipe(&hPipeRead, &hPipeWrite, &sa, 0)) {
  -        ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                        "Parent: Unable to create pipe to child process.");
           return -1;
       }
  @@ -1565,7 +1566,7 @@
                          pEnvBlock,          /* Environment block */
                          NULL,
                          &si, &pi)) {
  -        ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                        "Parent: Not able to create the child process.");
           /*
            * We must close the handles to the new process and its main thread
  @@ -1587,7 +1588,7 @@
       sa.lpSecurityDescriptor = NULL;        
       kill_event = CreateEvent(&sa, TRUE, FALSE, apr_psprintf(pconf,"apC%d", pi.dwProcessId));
       if (!kill_event) {
  -        ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                        "Parent: Could not create exit event for child process");
           CloseHandle(pi.hProcess);
           CloseHandle(pi.hThread);
  @@ -1622,7 +1623,7 @@
           if (!WriteFile(hPipeWrite, lpWSAProtocolInfo, (DWORD) sizeof(WSAPROTOCOL_INFO),
                          &BytesWritten,
                          (LPOVERLAPPED) NULL)) {
  -            ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                            "Parent: Unable to write duplicated socket %d to the child.", lr->sd );
               return -1;
           }
  @@ -1634,7 +1635,7 @@
           if (!DuplicateHandle(GetCurrentProcess(), AcceptExCompPort, 
                                pi.hProcess, &hDupedCompPort,  0,
                                TRUE, DUPLICATE_SAME_ACCESS)) {
  -            ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                            "Parent: Unable to duplicate AcceptEx completion port. Shutting down.");
               return -1;
           }
  @@ -1670,7 +1671,7 @@
       while (remaining_children_to_start--) {
           if (create_process(pconf, process_handles, process_kill_events, 
                              &current_live_processes) < 0) {
  -            ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                            "master_main: create child process failed. Exiting.");
               shutdown_pending = 1;
               goto die_now;
  @@ -1691,13 +1692,13 @@
       cld = rv - WAIT_OBJECT_0;
       if (rv == WAIT_FAILED) {
           /* Something serious is wrong */
  -        ap_log_error(APLOG_MARK,APLOG_CRIT, GetLastError(), server_conf,
  +        ap_log_error(APLOG_MARK,APLOG_CRIT, apr_get_os_error(), server_conf,
                        "master_main: WaitForMultipeObjects WAIT_FAILED -- doing server shutdown");
           shutdown_pending = 1;
       }
       else if (rv == WAIT_TIMEOUT) {
           /* Hey, this cannot happen */
  -        ap_log_error(APLOG_MARK, APLOG_ERR, GetLastError(), s,
  +        ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s,
                        "master_main: WaitForMultipeObjects with INFINITE wait exited with WAIT_TIMEOUT");
           shutdown_pending = 1;
       }
  @@ -1708,7 +1709,7 @@
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, s, 
                        "master_main: Shutdown event signaled -- doing server shutdown.");
           if (ResetEvent(shutdown_event) == 0) {
  -            ap_log_error(APLOG_MARK, APLOG_ERR, GetLastError(), s,
  +            ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s,
                            "ResetEvent(shutdown_event)");
           }
   
  @@ -1720,7 +1721,7 @@
           ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, s, 
                        "master_main: Restart event signaled. Doing a graceful restart.");
           if (ResetEvent(restart_event) == 0) {
  -            ap_log_error(APLOG_MARK, APLOG_ERR, GetLastError(), s,
  +            ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s,
                            "master_main: ResetEvent(restart_event) failed.");
           }
           /* Signal each child process to die 
  @@ -1731,7 +1732,7 @@
            */
           for (i = 0; i < children_to_kill; i++) {
               if (SetEvent(process_kill_events[i]) == 0)
  -                ap_log_error(APLOG_MARK, APLOG_ERR, GetLastError(), s,
  +                ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s,
                                "master_main: SetEvent for child process in slot #%d failed", i);
               cleanup_process(process_handles, process_kill_events, i, &current_live_processes);
           }
  @@ -1772,7 +1773,7 @@
           for (i = 0; i < current_live_processes; i++) {
               printf("SetEvent handle = %d\n", process_kill_events[i]);
               if (SetEvent(process_kill_events[i]) == 0)
  -                ap_log_error(APLOG_MARK,APLOG_ERR, GetLastError(), server_conf,
  +                ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf,
                                "master_main: SetEvent for child process in slot #%d failed", i);
           }
   
  @@ -1877,7 +1878,7 @@
           /* WARNING: There is an implict assumption here that the
            * executable resides in the ServerRoot!
            */
  -        rv = GetLastError();
  +        rv = apr_get_os_error();
           ap_log_error(APLOG_MARK,APLOG_ERR, rv, NULL, 
                        "Failed to get the running module's file name");
           exit(1);
  @@ -2112,7 +2113,7 @@
                                                             0,
                                                             0); /* CONCURRENT ACTIVE THREADS */
                   if (AcceptExCompPort == NULL) {
  -                    ap_log_error(APLOG_MARK,APLOG_ERR, GetLastError(), server_conf,
  +                    ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_os_error(), server_conf,
                                    "Parent: Unable to create the AcceptExCompletionPort -- process will exit");
                       exit(1);
                   }
  @@ -2125,7 +2126,7 @@
                */
               shutdown_event = CreateEvent(sa, FALSE, FALSE, signal_shutdown_name);
               if (!shutdown_event) {
  -                ap_log_error(APLOG_MARK, APLOG_EMERG, GetLastError(), server_conf,
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), server_conf,
                                "Parent: Cannot create shutdown event %s", signal_shutdown_name);
                   CleanNullACL((void *)sa);
                   exit(1);
  @@ -2137,7 +2138,7 @@
               restart_event = CreateEvent(sa, FALSE, FALSE, signal_restart_name);
               if (!restart_event) {
                   CloseHandle(shutdown_event);
  -                ap_log_error(APLOG_MARK, APLOG_EMERG, GetLastError(), server_conf,
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, apr_get_os_error(), server_conf,
                                "Parent: Cannot create restart event %s", signal_restart_name);
                   CleanNullACL((void *)sa);
                   exit(1);
  
  
  
  1.28      +2 -1      apache-2.0/src/modules/mpm/winnt/registry.c
  
  Index: registry.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/registry.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- registry.c	2000/10/02 22:34:07	1.27
  +++ registry.c	2000/10/06 17:24:42	1.28
  @@ -95,7 +95,8 @@
    * with SetLastError() before calling the aplog_error() function.
    * Because this is common, let's have a macro.
    */
  -#define return_error(rv) return (SetLastError(rv), rv);
  +#define return_error(rv) return (apr_set_os_error(APR_FROM_OS_ERROR(rv)),\
  +                                 APR_FROM_OS_ERROR(rv));
   
   apr_status_t ap_registry_create_key(const char *key)
   {
  
  
  
  1.24      +20 -20    apache-2.0/src/modules/mpm/winnt/service.c
  
  Index: service.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/service.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- service.c	2000/10/02 22:34:07	1.23
  +++ service.c	2000/10/06 17:24:42	1.24
  @@ -238,7 +238,7 @@
   
       if (!RegisterClass(&wc)) 
       {
  -        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, GetLastError(), 
  +        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), 
                        NULL, "Could not register window class for WatchWindow");
           SetEvent(globdat.signal_monitor);
           globdat.service_thread_id = 0;
  @@ -254,7 +254,7 @@
                               
       if (!hwndMain)
       {
  -        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, GetLastError(), 
  +        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), 
                        NULL, "Could not create WatchWindow");
           SetEvent(globdat.signal_monitor);
           globdat.service_thread_id = 0;
  @@ -535,7 +535,7 @@
   
       if(!(globdat.hServiceStatus = RegisterServiceCtrlHandler(argv[0], service_nt_ctrl)))
       {
  -        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, GetLastError(), 
  +        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), 
                        NULL, "Failure registering service handler");
           PulseEvent(globdat.signal_monitor);
           return;
  @@ -635,7 +635,7 @@
       if (!StartServiceCtrlDispatcher(dispatchTable))
       {
           /* This is a genuine failure of the SCM. */
  -        rv = GetLastError();
  +        rv = apr_get_os_error();
           ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                        "Error starting service control dispatcher");
       }
  @@ -822,7 +822,7 @@
   
       if (GetModuleFileName(NULL, exe_path, sizeof(exe_path)) == 0)
       {
  -        apr_status_t rv = GetLastError();
  +        apr_status_t rv = apr_get_os_error();
           ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                        "GetModuleFileName failed");
           return rv;
  @@ -837,7 +837,7 @@
           schSCManager = OpenSCManager(NULL, NULL, /* local, default database */
                                        SC_MANAGER_ALL_ACCESS);
           if (!schSCManager) {
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                            "Failed to open the WinNT service manager");
               return (rv);
  @@ -866,7 +866,7 @@
   
           if (!schService) 
           {
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
                            "Failed to create WinNT Service Profile");
               CloseServiceHandle(schSCManager);
  @@ -929,7 +929,7 @@
           schSCManager = OpenSCManager(NULL, NULL, /* local, default database */
                                        SC_MANAGER_ALL_ACCESS);
           if (!schSCManager) {
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                            "Failed to open the WinNT service manager.");
               return (rv);
  @@ -938,7 +938,7 @@
           schService = OpenService(schSCManager, service_name, SERVICE_ALL_ACCESS);
   
           if (!schService) {
  -           rv = GetLastError();
  +           rv = apr_get_os_error();
              ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
   			"%s: OpenService failed", display_name);
              return (rv);
  @@ -955,7 +955,7 @@
           // ap_stop_service(schService);
   
           if (DeleteService(schService) == 0) {
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
   	    ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                            "%s: Failed to delete the service.", display_name);
               return (rv);
  @@ -971,7 +971,7 @@
           /* TODO: assure the service is stopped before continuing */
   
           if (ap_registry_delete_value(SERVICECONFIG9X, service_name)) {
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
   	    ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                            "%s: Failed to remove the RunServices registry "
                            "entry.", display_name);
  @@ -982,7 +982,7 @@
           apr_snprintf(key_name, sizeof(key_name), SERVICECONFIG, service_name);
           if (ap_registry_delete_key(key_name)) 
           {
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                            "%s: Failed to remove the service config from the "
                            "registry.", display_name);
  @@ -1033,7 +1033,7 @@
           schSCManager = OpenSCManager(NULL, NULL, /* local, default database */
                                        SC_MANAGER_ALL_ACCESS);
           if (!schSCManager) {
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                            "Failed to open the WinNT service manager");
               return (rv);
  @@ -1042,7 +1042,7 @@
           schService = OpenService(schSCManager, service_name, 
                                    SERVICE_START | SERVICE_QUERY_STATUS);
           if (!schService) {
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                            "%s: Failed to open the service.", display_name);
               CloseServiceHandle(schSCManager);
  @@ -1072,7 +1072,7 @@
                   rv = APR_SUCCESS;
   
           if (rv != APR_SUCCESS)
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
           
           CloseServiceHandle(schService);
           CloseServiceHandle(schSCManager);
  @@ -1103,7 +1103,7 @@
           
           if (GetModuleFileName(NULL, exe_path, sizeof(exe_path)) == 0)
           {
  -            apr_status_t rv = GetLastError();
  +            apr_status_t rv = apr_get_os_error();
               ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                            "GetModuleFileName failed");
               return rv;
  @@ -1137,7 +1137,7 @@
           }
           
           if (rv != APR_SUCCESS)
  -            rv = GetLastError();
  +            rv = apr_get_os_error();
           
           CloseHandle(pi.hProcess);
           CloseHandle(pi.hThread);
  @@ -1169,7 +1169,7 @@
                                        SC_MANAGER_ALL_ACCESS);
           
           if (!schSCManager) {
  -            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, GetLastError(), NULL,
  +            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL,
                            "Failed to open the NT Service Manager");
               return;
           }
  @@ -1179,14 +1179,14 @@
   
           if (schService == NULL) {
               /* Could not open the service */
  -            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, GetLastError(), NULL,
  +            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL,
                            "Failed to open the %s Service", display_name);
               CloseServiceHandle(schSCManager);
               return;
           }
           
           if (!QueryServiceStatus(schService, &globdat.ssStatus)) {
  -            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, GetLastError(), NULL,
  +            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL,
                            "Query of Service %s failed", display_name);
               CloseServiceHandle(schService);
               CloseServiceHandle(schSCManager);
  
  
  
  1.21      +1 -1      apache-2.0/src/os/win32/main_win32.c
  
  Index: main_win32.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/os/win32/main_win32.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- main_win32.c	2000/08/06 06:07:53	1.20
  +++ main_win32.c	2000/10/06 17:24:43	1.21
  @@ -302,7 +302,7 @@
   
       /* Set up default server_root */
       if (!GetCurrentDirectory(sizeof(cwd),cwd)) {
  -        ap_log_error(APLOG_MARK,APLOG_ERR, GetLastError(), NULL, "GetCurrentDirectory() failure");
  +        ap_log_error(APLOG_MARK,APLOG_ERR, ap_get_os_error(), NULL, "GetCurrentDirectory() failure");
           cleanup_and_exit();
       }
       server_root = ap_os_canonical_filename(pwincmd, cwd);
  
  
  
  1.25      +7 -7      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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- mod_isapi.c	2000/10/03 06:08:36	1.24
  +++ mod_isapi.c	2000/10/06 17:24:43	1.25
  @@ -280,8 +280,8 @@
   
       if (!(*isa)->handle)
       {
  -        apr_status_t rv = GetLastError();
  -        ap_log_rerror(APLOG_MARK, APLOG_ALERT, GetLastError(), r,
  +        apr_status_t rv = apr_get_os_error();
  +        ap_log_rerror(APLOG_MARK, APLOG_ALERT, apr_get_os_error(), r,
                         "ISAPI %s failed to load", fpath);
           (*isa)->handle = NULL;
           return rv;
  @@ -290,7 +290,7 @@
       if (!((*isa)->GetExtensionVersion = (void *)(GetProcAddress((*isa)->handle,
                                                         "GetExtensionVersion"))))
       {
  -        apr_status_t rv = GetLastError();
  +        apr_status_t rv = apr_get_os_error();
           ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r,
                         "ISAPI %s is missing GetExtensionVersion()",
                         fpath);
  @@ -302,7 +302,7 @@
       if (!((*isa)->HttpExtensionProc = (void *)(GetProcAddress((*isa)->handle,
                                                          "HttpExtensionProc")))) 
       {
  -        apr_status_t rv = GetLastError();
  +        apr_status_t rv = apr_get_os_error();
           ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r,
                         "ISAPI %s is missing HttpExtensionProc()",
                         fpath);
  @@ -318,7 +318,7 @@
   
       /* Run GetExtensionVersion() */
       if (!((*isa)->GetExtensionVersion)((*isa)->pVer)) {
  -        apr_status_t rv = GetLastError();
  +        apr_status_t rv = apr_get_os_error();
           ap_log_rerror(APLOG_MARK, APLOG_ALERT, rv, r,
                         "ISAPI %s call GetExtensionVersion() failed", 
                         fpath);
  @@ -688,8 +688,8 @@
                                          *lpdwSize - read)) > 0)) {
           if (res < 0) {
               *lpdwSize = 0;
  -            if (!GetLastError())
  -                SetLastError(TODO_ERROR); /* XXX: Find the right error code */
  +            if (!apr_get_os_error())
  +                apr_set_os_error(TODO_ERROR); /* XXX: Find the right error code */
               return FALSE;
           }
   
  
  
  

Mime
View raw message