21#pragma alloc_text(PAGE, Ext2GetInfoLength)
22#pragma alloc_text(PAGE, Ext2ProcessEntry)
23#pragma alloc_text(PAGE, Ext2QueryDirectory)
24#pragma alloc_text(PAGE, Ext2NotifyChangeDirectory)
25#pragma alloc_text(PAGE, Ext2DirectoryControl)
26#pragma alloc_text(PAGE, Ext2IsDirectoryEmpty)
88 struct inode Inode = { 0 };
102 NameLength =
pName->Length;
103 ASSERT((UsedLength & 7) == 0);
106 if (InfoLength == 0) {
107 DEBUG(
DL_ERR, (
"Ext2ProcessDirEntry: Invalid Info Class %xh for %wZ in %wZ\n",
112 if (InfoLength + NameLength >
Length) {
113 DEBUG(
DL_INF, (
"Ext2PricessDirEntry: Buffer is not enough.\n"));
115 if (UsedLength || InfoLength >
Length) {
116 DEBUG(
DL_CP, (
"Ext2ProcessDirEntry: Buffer overflows for %wZ in %wZ\n",
135 DEBUG(
DL_ERR, (
"Ext2PricessDirEntry: Loading inode %xh (%wZ) error.\n",
144 DEBUG(
DL_RES, (
"Ext2ProcessDirEntry: SymLink: %wZ\\%wZ\n",
183 IsEntrySymlink =
TRUE;
198 IsEntrySymlink =
TRUE;
225 if ((
pName->Length >= 4 &&
pName->Buffer[0] ==
L'.') &&
226 ((
pName->Length == 4 &&
pName->Buffer[1] !=
L'.') ||
227 pName->Length >= 6 )) {
266 if (InfoLength + NameLength >
Length) {
267 NameLength =
Length - InfoLength;
272 if (IsEntrySymlink) {
277 if (IsEntrySymlink) {
320 if (InfoLength + NameLength >
Length) {
321 NameLength =
Length - InfoLength;
326 if (IsEntrySymlink) {
345 if (InfoLength + NameLength >
Length) {
346 NameLength =
Length - InfoLength;
364 DEBUG(
DL_CP, (
"Ext2ProcessDirEntry: Status = %xh for %wZ in %wZ\n",
384 }
else if (
OemName->Length == 1) {
390 if (
Vcb->bHidingPrefix) {
392 if (PatLen > 0 && PatLen <= OemName->
Length) {
402 if (
Vcb->bHidingSuffix) {
404 if (PatLen > 0 && PatLen <= OemName->
Length) {
406 Vcb->sHidingSuffix, PatLen ) == 0) {
432 if (
fc->efc_start > 0 && (
fc->efc_single || (
fc->efc_size <
439 Oem.Buffer = (
void *)
name;
440 Oem.Length = namlen & 0xFF;
441 Oem.MaximumLength = Oem.Length;
444 if ((Oem.Length == 1 &&
name[0] ==
'.') || (Oem.Length == 2 &&
445 name[0] ==
'.' &&
name[1] ==
'.' )) {
468 "allocate InodeFileName.\n"));
478 DEBUG(
DL_ERR, (
"Ex2QueryDirectory: Ext2OEMtoUnicode failed with %xh.\n",
Status));
502 if (
fc->efc_start == 0) {
632 Irp = IrpContext->Irp;
648 IoStackLocation)->
Parameters.QueryDirectory.FileInformationClass;
651 IoStackLocation)->
Parameters.QueryDirectory.Length;
654 IoStackLocation)->
Parameters.QueryDirectory.FileName;
657 IoStackLocation)->
Parameters.QueryDirectory.FileIndex;
686 FcbResourceAcquired =
TRUE;
690 if (
Ccb->DirectorySearchPattern.Buffer !=
NULL) {
698 Ccb->DirectorySearchPattern.Length =
699 Ccb->DirectorySearchPattern.MaximumLength =
702 Ccb->DirectorySearchPattern.Buffer =
706 if (
Ccb->DirectorySearchPattern.Buffer ==
NULL) {
707 DEBUG(
DL_ERR, (
"Ex2QueryDirectory: failed to allocate SerarchPattern.\n"));
713 Ccb->DirectorySearchPattern.Buffer,
714 Ccb->DirectorySearchPattern.MaximumLength);
717 &(
Ccb->DirectorySearchPattern),
726 }
else if (
Ccb->DirectorySearchPattern.Buffer !=
NULL) {
735 Ccb->DirectorySearchPattern.Length =
736 Ccb->DirectorySearchPattern.MaximumLength = 2;
738 Ccb->DirectorySearchPattern.Buffer =
741 if (
Ccb->DirectorySearchPattern.Buffer ==
NULL) {
742 DEBUG(
DL_ERR, (
"Ex2QueryDirectory: failed to allocate SerarchPattern (1st).\n"));
748 Ccb->DirectorySearchPattern.Buffer,
749 Ccb->DirectorySearchPattern.MaximumLength);
753 Ccb->DirectorySearchPattern.Buffer,
757 if (IndexSpecified) {
758 Ccb->filp.f_pos = FileIndex;
761 Ccb->filp.f_pos = FileIndex = 0;
769 fc.efc_irp = IrpContext;
777#ifdef EXT2_HTREE_INDEX
785 if (rc != ERR_BAD_DX_DIR) {
792 EXT3_I(&
Mcb->Inode)->i_flags &= ~EXT3_INDEX_FL;
796 if (
Mcb->Inode.i_size <=
Ccb->filp.f_pos) {
808 DEBUG(
DL_ERR, (
"Ex2QueryDirectory: failed to allocate pDir.\n"));
816 DEBUG(
DL_CP, (
"Ex2QueryDirectory: Dir: %wZ Index=%xh Pattern : %wZ.\n",
817 &
Fcb->
Mcb->FullName, FileIndex, &
Ccb->DirectorySearchPattern));
819 while ((ByteOffset < Mcb->Inode.i_size) &&
839 if (pDir->rec_len == 0) {
846 goto ProcessNextEntry;
850 if ((pDir->name_len == 1 && pDir->name[0] ==
'.') ||
851 (pDir->name_len == 2 && pDir->name[0] ==
'.' && pDir->name[1] ==
'.' )) {
852 goto ProcessNextEntry;
855 Oem.Buffer = pDir->name;
856 Oem.Length = (pDir->name_len & 0xff);
857 Oem.MaximumLength = Oem.Length;
860 goto ProcessNextEntry;
866 DEBUG(
DL_CP, (
"Ext2QueryDirectory: failed to count unicode length for inode: %xh\n",
889 "allocate InodeFileName.\n"));
901 DEBUG(
DL_ERR, (
"Ex2QueryDirectory: Ext2OEMtoUnicode failed with %xh.\n",
Status));
906 DEBUG(
DL_CP, (
"Ex2QueryDirectory: process inode: %xh / %wZ (%d).\n",
907 pDir->inode, &Unicode, Unicode.
Length));
910 &(
Ccb->DirectorySearchPattern)) ?
912 &(
Ccb->DirectorySearchPattern),
917 &(
Ccb->DirectorySearchPattern),
945 if (
fc.efc_start == 0) {
975 }
else if (!
fc.efc_start) {
989 if (FcbResourceAcquired) {
1003 if (!IrpContext->ExceptionInProgress) {
1019 IrpContext->Irp->IoStatus.Information =
fc.efc_start;
1103 bFcbAcquired =
TRUE;
1109 Irp = IrpContext->Irp;
1121 IrpSp)->Parameters.NotifyDirectory.CompletionFilter;
1191 if (!IrpContext->ExceptionInProgress) {
1199 IrpContext->Irp =
NULL;
1219 Mcb->ShortName.Length);
1245 switch (IrpContext->MinorFunction) {
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
ACPI_SIZE strlen(const char *String)
BOOLEAN Ext2ReadInode(PEXT2_VOLUME_INFO Volume, ULONG Inode, PEXT2_INODE InodeBuffer)
BOOLEAN Ext2LookupFile(PEXT2_VOLUME_INFO Volume, PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfo)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
#define IRP_CONTEXT_FLAG_WAIT
#define NT_SUCCESS(StatCode)
#define _strnicmp(_String1, _String2, _MaxCount)
#define FILE_ATTRIBUTE_NORMAL
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
_In_ PIO_STACK_LOCATION IrpSp
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
UNICODE_STRING * PUNICODE_STRING
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
#define ExAcquireResourceExclusiveLite(res, wait)
#define ExAcquireResourceSharedLite(res, wait)
BOOLEAN Ext2IsWearingCloak(IN PEXT2_VCB Vcb, IN POEM_STRING OemName)
static int Ext2FillEntry(void *context, const char *name, int namlen, ULONG offset, __u32 ino, unsigned int d_type)
NTSTATUS Ext2DirectoryControl(IN PEXT2_IRP_CONTEXT IrpContext)
NTSTATUS Ext2QueryDirectory(IN PEXT2_IRP_CONTEXT IrpContext)
VOID Ext2NotifyReportChange(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Mcb, IN ULONG Filter, IN ULONG Action)
NTSTATUS Ext2NotifyChangeDirectory(IN PEXT2_IRP_CONTEXT IrpContext)
BOOLEAN Ext2IsDirectoryEmpty(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb, PEXT2_MCB Mcb)
NTSTATUS Ext2ProcessEntry(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_FCB Dcb, IN FILE_INFORMATION_CLASS FileInformationClass, IN ULONG in, IN PVOID Buffer, IN ULONG UsedLength, IN ULONG Length, IN ULONG FileIndex, IN PUNICODE_STRING pName, OUT PULONG EntrySize, IN BOOLEAN Single)
ULONG Ext2GetInfoLength(IN FILE_INFORMATION_CLASS FileInformationClass)
VOID Ext2FreePool(IN PVOID P, IN ULONG Tag)
#define ClearFlag(_F, _SF)
#define VCB_VOLUME_LOCKED
#define IsMcbSymLink(Mcb)
#define IsMcbSpecialFile(Mcb)
PVOID Ext2AllocatePool(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
#define IsFileDeleted(Mcb)
LARGE_INTEGER Ext2NtTime(IN ULONG i_time)
#define IsExt2FsDevice(DO)
NTSTATUS Ext2QueueRequest(IN PEXT2_IRP_CONTEXT IrpContext)
#define DEC_MEM_COUNT(_i, _p, _s)
int ext3_is_dir_empty(struct ext2_icb *icb, struct inode *inode)
int ext3_dx_readdir(struct file *filp, filldir_t filldir, void *context)
BOOLEAN Ext2IsSpecialSystemFile(IN PUNICODE_STRING FileName, IN BOOLEAN bDirectory)
NTSTATUS Ext2OEMToUnicode(IN PEXT2_VCB Vcb, IN OUT PUNICODE_STRING Oem, IN POEM_STRING Unicode)
NTSTATUS Ext2LockUserBuffer(IN PIRP Irp, IN ULONG Length, IN LOCK_OPERATION Operation)
#define Ext2DerefMcb(Mcb)
#define EXT2_DENTRY_MAGIC
PVOID Ext2GetUserBuffer(IN PIRP Irp)
#define IsMcbDirectory(Mcb)
#define IsInodeSymLink(I)
#define FCB_DELETE_PENDING
struct _EXT2_VCB * PEXT2_VCB
BOOLEAN Ext2LoadInode(IN PEXT2_VCB Vcb, IN struct inode *Inode)
int Ext2CheckInodeAccess(PEXT2_VCB Vcb, struct inode *in, int attempt)
struct _EXT2_CCB * PEXT2_CCB
PEXT2_MCB Ext2SearchMcb(PEXT2_VCB Vcb, PEXT2_MCB Parent, PUNICODE_STRING FileName)
struct _EXT2_FCB * PEXT2_FCB
#define CEILING_ALIGNED(T, A, B)
ULONG Ext2OEMToUnicodeSize(IN PEXT2_VCB Vcb, IN PANSI_STRING Oem)
NTSTATUS Ext2CompleteIrpContext(IN PEXT2_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
#define INC_MEM_COUNT(_i, _p, _s)
NTSTATUS Ext2FollowLink(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Parent, IN PEXT2_MCB Mcb, IN ULONG Linkdep)
#define EXT3_FEATURE_COMPAT_DIR_INDEX
#define EXT3_HAS_COMPAT_FEATURE(sb, mask)
static unsigned ext3_rec_len_from_disk(__le16 dlen)
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
IN PDCB IN POEM_STRING OemName
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
struct _FileName FileName
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN _In_ ULONG _In_opt_ PULONG _In_ BOOLEAN RestartScan
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE _In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG FileAttributes
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN ReturnSingleEntry
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
_Inout_ PLIST_ENTRY _In_ PVOID _In_ PSTRING _In_ BOOLEAN _In_ BOOLEAN _In_ ULONG CompletionFilter
_Inout_ PLIST_ENTRY _In_ PVOID _In_ PSTRING _In_ BOOLEAN WatchTree
struct _FILE_BOTH_DIR_INFORMATION * PFILE_BOTH_DIR_INFORMATION
@ FileDirectoryInformation
@ FileIdBothDirectoryInformation
@ FileFullDirectoryInformation
@ FileBothDirectoryInformation
@ FileIdFullDirectoryInformation
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
struct _FILE_NAMES_INFORMATION * PFILE_NAMES_INFORMATION
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
struct _FILE_FULL_DIRECTORY_INFORMATION * PFILE_FULL_DIR_INFORMATION
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
#define FILE_ATTRIBUTE_READONLY
#define FILE_ATTRIBUTE_HIDDEN
#define FILE_ATTRIBUTE_SYSTEM
#define FILE_ATTRIBUTE_DIRECTORY
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define FILE_ATTRIBUTE_REPARSE_POINT
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
BOOLEAN NTAPI FsRtlIsNameInExpression(IN PUNICODE_STRING Expression, IN PUNICODE_STRING Name, IN BOOLEAN IgnoreCase, IN PWCHAR UpcaseTable OPTIONAL)
BOOLEAN NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
VOID NTAPI FsRtlNotifyFullReportChange(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PSTRING FullTargetName, IN USHORT TargetNameOffset, IN PSTRING StreamName OPTIONAL, IN PSTRING NormalizedParentName OPTIONAL, IN ULONG FilterMatch, IN ULONG Action, IN PVOID TargetContext)
VOID NTAPI FsRtlNotifyFullChangeDirectory(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext, IN PSTRING FullDirectoryName, IN BOOLEAN WatchTree, IN BOOLEAN IgnoreBuffer, IN ULONG CompletionFilter, IN PIRP NotifyIrp, IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL)
#define STATUS_DELETE_PENDING
#define STATUS_VOLUME_DISMOUNTED
#define STATUS_INVALID_INFO_CLASS
#define IRP_MN_QUERY_DIRECTORY
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY
#define STATUS_BUFFER_OVERFLOW
NTFSIDENTIFIER Identifier
struct _IO_STACK_LOCATION::@3974::@3981 NotifyDirectory
union _IO_STACK_LOCATION::@1575 Parameters
struct _IO_STACK_LOCATION::@3974::@3980 QueryDirectory
struct super_block * i_sb
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_NOT_A_DIRECTORY
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_NO_SUCH_FILE
#define STATUS_FILE_DELETED
#define STATUS_INVALID_USER_BUFFER
#define STATUS_INSUFFICIENT_RESOURCES
#define STATUS_NO_MORE_FILES
#define PEXTENDED_IO_STACK_LOCATION
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
_Must_inspect_result_ _In_ ULONG Flags
#define SL_INDEX_SPECIFIED
struct _FILE_ID_BOTH_DIR_INFORMATION * PFILE_ID_BOTH_DIR_INFORMATION
#define SL_RETURN_SINGLE_ENTRY
#define IO_REPARSE_TAG_SYMLINK
struct _FILE_ID_FULL_DIR_INFORMATION * PFILE_ID_FULL_DIR_INFORMATION