forked from msysgit/git
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request git-for-windows#1937 from benpeart/fscache-NtQuery…
…DirectoryFile-gfw fscache: teach fscache to use NtQueryDirectoryFile
- Loading branch information
Showing
2 changed files
with
218 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#ifndef _NTIFS_ | ||
#define _NTIFS_ | ||
|
||
/* | ||
* Copy necessary structures and definitions out of the Windows DDK | ||
* to enable calling NtQueryDirectoryFile() | ||
*/ | ||
|
||
typedef _Return_type_success_(return >= 0) LONG NTSTATUS; | ||
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0) | ||
|
||
typedef struct _UNICODE_STRING { | ||
USHORT Length; | ||
USHORT MaximumLength; | ||
#ifdef MIDL_PASS | ||
[size_is(MaximumLength / 2), length_is((Length) / 2)] USHORT * Buffer; | ||
#else // MIDL_PASS | ||
_Field_size_bytes_part_(MaximumLength, Length) PWCH Buffer; | ||
#endif // MIDL_PASS | ||
} UNICODE_STRING; | ||
typedef UNICODE_STRING *PUNICODE_STRING; | ||
typedef const UNICODE_STRING *PCUNICODE_STRING; | ||
|
||
typedef enum _FILE_INFORMATION_CLASS { | ||
FileDirectoryInformation = 1, | ||
FileFullDirectoryInformation, | ||
FileBothDirectoryInformation, | ||
FileBasicInformation, | ||
FileStandardInformation, | ||
FileInternalInformation, | ||
FileEaInformation, | ||
FileAccessInformation, | ||
FileNameInformation, | ||
FileRenameInformation, | ||
FileLinkInformation, | ||
FileNamesInformation, | ||
FileDispositionInformation, | ||
FilePositionInformation, | ||
FileFullEaInformation, | ||
FileModeInformation, | ||
FileAlignmentInformation, | ||
FileAllInformation, | ||
FileAllocationInformation, | ||
FileEndOfFileInformation, | ||
FileAlternateNameInformation, | ||
FileStreamInformation, | ||
FilePipeInformation, | ||
FilePipeLocalInformation, | ||
FilePipeRemoteInformation, | ||
FileMailslotQueryInformation, | ||
FileMailslotSetInformation, | ||
FileCompressionInformation, | ||
FileObjectIdInformation, | ||
FileCompletionInformation, | ||
FileMoveClusterInformation, | ||
FileQuotaInformation, | ||
FileReparsePointInformation, | ||
FileNetworkOpenInformation, | ||
FileAttributeTagInformation, | ||
FileTrackingInformation, | ||
FileIdBothDirectoryInformation, | ||
FileIdFullDirectoryInformation, | ||
FileValidDataLengthInformation, | ||
FileShortNameInformation, | ||
FileIoCompletionNotificationInformation, | ||
FileIoStatusBlockRangeInformation, | ||
FileIoPriorityHintInformation, | ||
FileSfioReserveInformation, | ||
FileSfioVolumeInformation, | ||
FileHardLinkInformation, | ||
FileProcessIdsUsingFileInformation, | ||
FileNormalizedNameInformation, | ||
FileNetworkPhysicalNameInformation, | ||
FileIdGlobalTxDirectoryInformation, | ||
FileIsRemoteDeviceInformation, | ||
FileAttributeCacheInformation, | ||
FileNumaNodeInformation, | ||
FileStandardLinkInformation, | ||
FileRemoteProtocolInformation, | ||
FileMaximumInformation | ||
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; | ||
|
||
typedef struct _FILE_FULL_DIR_INFORMATION { | ||
ULONG NextEntryOffset; | ||
ULONG FileIndex; | ||
LARGE_INTEGER CreationTime; | ||
LARGE_INTEGER LastAccessTime; | ||
LARGE_INTEGER LastWriteTime; | ||
LARGE_INTEGER ChangeTime; | ||
LARGE_INTEGER EndOfFile; | ||
LARGE_INTEGER AllocationSize; | ||
ULONG FileAttributes; | ||
ULONG FileNameLength; | ||
ULONG EaSize; | ||
WCHAR FileName[1]; | ||
} FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION; | ||
|
||
typedef struct _IO_STATUS_BLOCK { | ||
union { | ||
NTSTATUS Status; | ||
PVOID Pointer; | ||
} DUMMYUNIONNAME; | ||
ULONG_PTR Information; | ||
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; | ||
|
||
typedef VOID | ||
(NTAPI *PIO_APC_ROUTINE)( | ||
IN PVOID ApcContext, | ||
IN PIO_STATUS_BLOCK IoStatusBlock, | ||
IN ULONG Reserved); | ||
|
||
NTSYSCALLAPI | ||
NTSTATUS | ||
NTAPI | ||
NtQueryDirectoryFile( | ||
_In_ HANDLE FileHandle, | ||
_In_opt_ HANDLE Event, | ||
_In_opt_ PIO_APC_ROUTINE ApcRoutine, | ||
_In_opt_ PVOID ApcContext, | ||
_Out_ PIO_STATUS_BLOCK IoStatusBlock, | ||
_Out_writes_bytes_(Length) PVOID FileInformation, | ||
_In_ ULONG Length, | ||
_In_ FILE_INFORMATION_CLASS FileInformationClass, | ||
_In_ BOOLEAN ReturnSingleEntry, | ||
_In_opt_ PUNICODE_STRING FileName, | ||
_In_ BOOLEAN RestartScan | ||
); | ||
|
||
#define STATUS_NO_MORE_FILES ((NTSTATUS)0x80000006L) | ||
|
||
#endif |