diff options
author | ivan <ivan@13f79535-47bb-0310-9956-ffa450edef68> | 2019-05-05 09:36:28 +0000 |
---|---|---|
committer | ivan <ivan@13f79535-47bb-0310-9956-ffa450edef68> | 2019-05-05 09:36:28 +0000 |
commit | 59f22dbd05ed1c5bf8286f3b1192c898c338e703 (patch) | |
tree | 36fab42dbd0e0a588e8941c3b699eec95718e99f | |
parent | f74052ee2ddb50604ef3da9a09d27c796945c301 (diff) | |
download | libapr-59f22dbd05ed1c5bf8286f3b1192c898c338e703.tar.gz |
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.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1858659 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/win32/filestat.c | 15 | ||||
-rw-r--r-- | include/arch/win32/apr_arch_misc.h | 25 |
2 files changed, 3 insertions, 37 deletions
diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c index 0c9ae5618..cb0a32595 100644 --- a/file_io/win32/filestat.c +++ b/file_io/win32/filestat.c @@ -362,18 +362,9 @@ apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile, && (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; } } diff --git a/include/arch/win32/apr_arch_misc.h b/include/arch/win32/apr_arch_misc.h index 5e87b6bb4..b872b6ce5 100644 --- a/include/arch/win32/apr_arch_misc.h +++ b/include/arch/win32/apr_arch_misc.h @@ -292,31 +292,6 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, LONG, WINAPI, NtQueryObject, 0, ( (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 |