Friedrich Dominicus wrote:
#if APR_HAS_ANSI_FS
    ELSE_WIN_OS_IS_ANSI
    {
/* This code path is always be invoked by apr_dir_open or * apr_dir_rewind, so return without filling out the finfo.
         */
        if (thedir->dirhand == INVALID_HANDLE_VALUE) {
            /* '/' terminated, so add the '*' and pop it when we finish */
            char *eop = strchr(thedir->dirname, '\0');
            eop[0] = '*';
            eop[1] = '\0';
thedir->dirhand = FindFirstFileA(thedir->dirname, thedir->n.entry);
            eop[0] = '\0';
            if (thedir->dirhand == INVALID_HANDLE_VALUE) {
                return apr_get_os_error();
            }
            thedir->bof = 1;
            return APR_SUCCESS;
        }
        else if (thedir->bof) {
            /* Noop - we already called FindFirstFileW from
             * either apr_dir_open or apr_dir_rewind ... use
             * that first record.
             */
thedir->bof = 0; }
        else if (!FindNextFile(thedir->dirhand, thedir->n.entry)) {
            return apr_get_os_error();
        }
        while (thedir->rootlen &&
               thedir->rootlen + strlen(thedir->n.entry->cFileName) >= MAX_PATH)
        {
            if (!FindNextFileW(thedir->dirhand, thedir->w.entry)) {
                                                        ^ shouldn't
that be n?

Not enough, does the attached patch work for you?


Index: apr-1.x/file_io/win32/dir.c
===================================================================
--- apr-1.x/file_io/win32/dir.c	(revision 673550)
+++ apr-1.x/file_io/win32/dir.c	(working copy)
@@ -195,13 +195,13 @@
              */
             thedir->bof = 0; 
         }
-        else if (!FindNextFile(thedir->dirhand, thedir->n.entry)) {
+        else if (!FindNextFileA(thedir->dirhand, thedir->n.entry)) {
             return apr_get_os_error();
         }
         while (thedir->rootlen &&
                thedir->rootlen + strlen(thedir->n.entry->cFileName) >= MAX_PATH)
         {
-            if (!FindNextFileW(thedir->dirhand, thedir->w.entry)) {
+            if (!FindNextFileA(thedir->dirhand, thedir->n.entry)) {
                 return apr_get_os_error();
             }
         }

Reply via email to