You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by iv...@apache.org on 2019/05/05 09:36:28 UTC

svn commit: r1858659 - in /apr/apr/trunk: file_io/win32/filestat.c include/arch/win32/apr_arch_misc.h

Author: ivan
Date: Sun May  5 09:36:28 2019
New Revision: 1858659

URL: http://svn.apache.org/viewvc?rev=1858659&view=rev
Log:
Use documented GetFileInformationByHandleEx() instead of
ZwQueryInformationFile() to allocated size of file.

* file_io/win32/filestat.c
  (more_finfo): Use GetFileInformationByHandleEx(FileAllocationInfo).

* include/arch/win32/apr_arch_misc.h
  (IOSB, FSI, apr_winapi_ZwQueryInformationFile): Remove.

Modified:
    apr/apr/trunk/file_io/win32/filestat.c
    apr/apr/trunk/include/arch/win32/apr_arch_misc.h

Modified: apr/apr/trunk/file_io/win32/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filestat.c?rev=1858659&r1=1858658&r2=1858659&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filestat.c (original)
+++ apr/apr/trunk/file_io/win32/filestat.c Sun May  5 09:36:28 2019
@@ -362,18 +362,9 @@ apr_status_t more_finfo(apr_finfo_t *fin
                                        && (finfo->filetype == APR_REG))
     {
         if (whatfile == MORE_OF_HANDLE) {
-            /* Not available for development and implementation under
-             * a reasonable license; if you review the licensing
-             * terms and conditions of;
-             *   http://go.microsoft.com/fwlink/?linkid=84083
-             * you probably understand why APR chooses not to implement.
-             */
-            IOSB sb;
-            FSI fi;
-            if ((ZwQueryInformationFile((HANDLE)ufile, &sb, 
-                                       &fi, sizeof(fi), 5) == 0) 
-                    && (sb.Status == 0)) {
-                finfo->csize = fi.AllocationSize;
+            FILE_ALLOCATION_INFO fi;
+            if (GetFileInformationByHandleEx((HANDLE)ufile, FileAllocationInfo, &fi, sizeof(fi))) {
+                finfo->csize = fi.AllocationSize.QuadPart;
                 finfo->valid |= APR_FINFO_CSIZE;
             }
         }

Modified: apr/apr/trunk/include/arch/win32/apr_arch_misc.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_arch_misc.h?rev=1858659&r1=1858658&r2=1858659&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/win32/apr_arch_misc.h (original)
+++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Sun May  5 09:36:28 2019
@@ -292,31 +292,6 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, LON
     (hObject, info, pOI, LenOI, pSizeOI));
 #define QueryObject apr_winapi_NtQueryObject
 
-typedef struct IOSB {
-    union {
-    UINT Status;
-    PVOID reserved;
-    };
-    apr_uintptr_t Information; /* Varies by op, consumed buffer size for FSI below */
-} IOSB, *PIOSB;
-
-typedef struct FSI {
-    LONGLONG AllocationSize;
-    LONGLONG EndOfFile;
-    ULONG    NumberOfLinks;
-    BOOL     DeletePending;
-    BOOL     Directory;
-} FSI, *PFSI;
-
-APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, LONG, WINAPI, ZwQueryInformationFile, 0, (
-    HANDLE hObject,    /* Obvious */
-    PVOID  pIOSB,      /* Point to the IOSB buffer for detailed return results */
-    PVOID  pFI,        /* The buffer, using FIB above */
-    ULONG  LenFI,      /* Use sizeof(FI) */
-    ULONG  info),      /* Use 5 for FSI documented above*/
-    (hObject, pIOSB, pFI, LenFI, info));
-#define ZwQueryInformationFile apr_winapi_ZwQueryInformationFile
-
 #ifdef CreateToolhelp32Snapshot
 #undef CreateToolhelp32Snapshot
 #endif