74#define BugCheckFileId (CDFS_BUG_CHECK_DIRSUP)
88#define CdRawDirent(IC,DC) \
89 Add2Ptr( (DC)->Sector, (DC)->SectorOffset, PRAW_DIRENT )
109#pragma alloc_text(PAGE, CdCheckForXAExtent)
110#pragma alloc_text(PAGE, CdCheckRawDirentBounds)
111#pragma alloc_text(PAGE, CdCleanupFileContext)
112#pragma alloc_text(PAGE, CdFindFile)
113#pragma alloc_text(PAGE, CdFindDirectory)
114#pragma alloc_text(PAGE, CdFindFileByShortName)
115#pragma alloc_text(PAGE, CdLookupDirent)
116#pragma alloc_text(PAGE, CdLookupLastFileDirent)
117#pragma alloc_text(PAGE, CdLookupNextDirent)
118#pragma alloc_text(PAGE, CdLookupNextInitialFileDirent)
119#pragma alloc_text(PAGE, CdUpdateDirentFromRawDirent)
120#pragma alloc_text(PAGE, CdUpdateDirentName)
180 if (
DirContext->DataLength > (
Fcb->FileSize.QuadPart - BaseOffset)) {
254 LONGLONG CurrentBaseOffset = CurrentDirContext->BaseOffset;
266 if ((CurrentDirContext->BaseOffset != NextDirContext->BaseOffset) ||
267 (NextDirContext->Bcb ==
NULL)) {
277 CurrentDirContext->DataLength,
279 &NextDirContext->Bcb,
280 &NextDirContext->Sector );
286 NextDirContext->DataLength = CurrentDirContext->DataLength;
287 NextDirContext->BaseOffset = CurrentDirContext->BaseOffset;
294 NextDirContext->SectorOffset = CurrentDirContext->SectorOffset;
301 if (CurrentDirContext->NextDirentOffset == 0) {
303 CurrentBaseOffset = NextDirContext->BaseOffset + NextDirContext->DataLength;
319 NextDirContext->SectorOffset += CurrentDirContext->NextDirentOffset;
333 if (NextDirContext->Bcb ==
NULL) {
337 if (TempUlong > (
ULONG) (
Fcb->FileSize.QuadPart - CurrentBaseOffset)) {
339 TempUlong = (
ULONG) (
Fcb->FileSize.QuadPart - CurrentBaseOffset);
345 if (TempUlong == 0) {
355 &NextDirContext->Bcb,
356 &NextDirContext->Sector );
358 NextDirContext->BaseOffset = (
ULONG) CurrentBaseOffset;
359 NextDirContext->SectorOffset = 0;
360 NextDirContext->DataLength = TempUlong;
376 CurrentBaseOffset = NextDirContext->BaseOffset + NextDirContext->DataLength;
396CdUpdateDirentFromRawDirent (
485 Dirent->InterleaveGapSize = 0;
563 UCHAR DirectoryValue;
578 if ((
Dirent->FileNameLen == 1) &&
583 if ((DirectoryValue == 0) || (DirectoryValue == 1)) {
606 Dirent->CdFileName.VersionString.Length = 0;
665 Dirent->CdFileName.FileName.MaximumLength =
sizeof(
Dirent->NameBuffer );
666 Dirent->CdFileName.FileName.Buffer =
Dirent->NameBuffer;
675 if (
Length >
Dirent->CdFileName.FileName.MaximumLength) {
705 Dirent->CdFileName.FileName.MaximumLength,
732 CdConvertNameToCdName( IrpContext,
739 if (
Dirent->CdFileName.FileName.Length == 0) {
748 if (
Dirent->CdFileName.FileName.Buffer[(
Dirent->CdFileName.FileName.Length -
sizeof(
WCHAR )) / 2] ==
L'.') {
754 if (
Dirent->CdFileName.VersionString.Length != 0) {
763 Dirent->CdFileName.FileName.Length,
772 Dirent->CdFileName.VersionString.Length +
sizeof(
WCHAR ));
778 Dirent->CdFileName.VersionString.Buffer = NewVersion;
785 Dirent->CdFileName.FileName.Length -=
sizeof(
WCHAR );
809 Dirent->CdFileName.FileName.MaximumLength / 2,
812 Dirent->CdCaseFileName.FileName.MaximumLength =
Dirent->CdFileName.FileName.MaximumLength / 2;
816 &
Dirent->CdCaseFileName );
944 (
Name->VersionString.Length == 0) &&
946 Dirent->CdFileName.FileName )) {
953 &
Dirent->CdCaseFileName.FileName,
1108CdFindFileByShortName (
1215 Dirent->CdFileName.FileName )) {
1225 &
Dirent->CdCaseFileName.FileName,
1336 CurrentDirContext = &
FileContext->PriorDirent->DirContext;
1340 CurrentDirContext = &
FileContext->CurrentDirent->DirContext;
1357 TargetDirContext = &
FileContext->InitialDirent->DirContext;
1373 RawDirent =
CdRawDirent( IrpContext, CurrentDirContext );
1400 CdUpdateDirentFromRawDirent( IrpContext,
1409 if (FoundLastDirent) {
1418 CurrentDirContext = TargetDirContext;
1474 CurrentCompoundDirent =
FileContext->InitialDirent;
1482 CurrentDirent = &CurrentCompoundDirent->
Dirent;
1612 CurrentCompoundDirent =
FileContext->CurrentDirent;
1619 CdUpdateDirentFromRawDirent( IrpContext,
1622 &CurrentCompoundDirent->
Dirent );
1719 ULONG NextDirentOffset;
1743 if (RawDirent->
DirLen != 0) {
1764 NextDirentOffset = RawDirent->
DirLen;
1773 NextDirentOffset = 0;
1778 NextDirentOffset = 0;
1781 return NextDirentOffset;
enum _XA_EXTENT_TYPE XA_EXTENT_TYPE
#define SYSTEM_XA_SIGNATURE
#define CD_ATTRIBUTE_DIRECTORY
#define CD_ATTRIBUTE_ASSOC
#define SYSTEM_USE_XA_FORM2
#define CD_ATTRIBUTE_MULTI
#define CdRawDirentFlags(IC, RD)
#define MIN_RAW_DIRENT_LEN
#define BYTE_COUNT_8_DOT_3
UNICODE_STRING CdUnicodeDirectoryNames[]
ULONG CdCheckRawDirentBounds(_In_ PIRP_CONTEXT IrpContext, _In_ PDIRENT_ENUM_CONTEXT DirContext)
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN IgnoreCase
#define CdRawDirent(IC, DC)
VOID CdLookupLastFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PFILE_ENUM_CONTEXT FileContext)
VOID CdUpdateDirentName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG _Inout_ PFILE_ENUM_CONTEXT FileContext
BOOLEAN CdLookupNextDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PDIRENT_ENUM_CONTEXT CurrentDirContext, _Inout_ PDIRENT_ENUM_CONTEXT NextDirContext)
BOOLEAN CdFindDirectory(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PCD_NAME Name, _In_ BOOLEAN IgnoreCase, _Inout_ PFILE_ENUM_CONTEXT FileContext)
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
CdVerifyOrCreateDirStreamFile(IrpContext, Fcb)
BOOLEAN CdLookupNextInitialFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Inout_ PFILE_ENUM_CONTEXT FileContext)
VOID CdLookupDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG DirentOffset, _Out_ PDIRENT_ENUM_CONTEXT DirContext)
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG ShortNameDirentOffset
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
VOID CdCleanupFileContext(_In_ PIRP_CONTEXT IrpContext, _In_ PFILE_ENUM_CONTEXT FileContext)
XA_EXTENT_TYPE CdCheckForXAExtent(_In_ PIRP_CONTEXT IrpContext, _In_ PRAW_DIRENT RawDirent, _Inout_ PDIRENT Dirent)
ULONG ThisShortNameDirentOffset
#define CdUnpinData(IC, B)
VOID CdConvertBigToLittleEndian(_In_ PIRP_CONTEXT IrpContext, _In_reads_bytes_(ByteCount) PCHAR BigEndian, _In_ ULONG ByteCount, _Out_writes_bytes_(ByteCount) PCHAR LittleEndian)
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT _Out_ PCD_NAME * MatchingName
#define CopyUchar4(Dst, Src)
VOID CdUpcaseName(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME Name, _Inout_ PCD_NAME UpcaseName)
#define CdCleanupDirContext(IC, DC)
BOOLEAN CdIsNameInExpression(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME CurrentName, _In_ PCD_NAME SearchExpression, _In_ ULONG WildcardFlags, _In_ BOOLEAN CheckVersion)
#define SectorBlockOffset(V, LB)
#define CdLookupInitialFileDirent(IC, F, FC, DO)
VOID CdGenerate8dot3Name(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING FileName, _In_ ULONG DirentOffset, _Out_writes_bytes_to_(BYTE_COUNT_8_DOT_3, *ShortByteCount) PWCHAR ShortFileName, _Out_ PUSHORT ShortByteCount)
#define SectorTruncate(L)
#define CdCleanupDirent(IC, D)
BOOLEAN CdIsLegalName(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING FileName)
ULONG CdShortNameDirentOffset(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING Name)
BOOLEAN CdIs8dot3Name(_In_ PIRP_CONTEXT IrpContext, _In_ UNICODE_STRING FileName)
#define CdRaiseStatus(IC, S)
#define DIRENT_FLAG_CONSTANT_ENTRY
#define DIRENT_FLAG_ALLOC_BUFFER
struct _RIFF_HEADER RIFF_HEADER
#define FILE_CONTEXT_MULTIPLE_DIRENTS
#define DIRENT_FLAG_NOT_PERSISTENT
#define ClearFlag(_F, _SF)
#define Add2Ptr(PTR, INC)
_Use_decl_annotations_ NTSTATUS NTAPI RtlOemToUnicodeN(_Out_ PWCHAR UnicodeString, _In_ ULONG UnicodeSize, _Out_opt_ PULONG ResultSize, _In_ PCCH OemString, _In_ ULONG OemSize)
#define Int32x32To64(a, b)
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG _In_ ULONG Length
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
BOOLEAN NTAPI CcMapData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *BcbResult, OUT PVOID *Buffer)
#define __analysis_assert(e)
DIRENT_ENUM_CONTEXT DirContext
XA_EXTENT_TYPE ExtentType
UCHAR FileId[MAX_FILE_ID_LENGTH]
#define FIELD_OFFSET(t, f)
#define RtlMoveMemory(Destination, Source, Length)
#define STATUS_FILE_CORRUPT_ERROR