ReactOS 0.4.15-dev-7788-g1ad9096
dirsup.c File Reference
#include "cdprocs.h"
Include dependency graph for dirsup.c:

Go to the source code of this file.

Macros

#define BugCheckFileId   (CDFS_BUG_CHECK_DIRSUP)
 
#define CdRawDirent(IC, DC)    Add2Ptr( (DC)->Sector, (DC)->SectorOffset, PRAW_DIRENT )
 

Functions

ULONG CdCheckRawDirentBounds (_In_ PIRP_CONTEXT IrpContext, _In_ PDIRENT_ENUM_CONTEXT DirContext)
 
XA_EXTENT_TYPE CdCheckForXAExtent (_In_ PIRP_CONTEXT IrpContext, _In_ PRAW_DIRENT RawDirent, _Inout_ PDIRENT Dirent)
 
VOID CdLookupDirent (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG DirentOffset, _Out_ PDIRENT_ENUM_CONTEXT DirContext)
 
BOOLEAN CdLookupNextDirent (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PDIRENT_ENUM_CONTEXT CurrentDirContext, _Inout_ PDIRENT_ENUM_CONTEXT NextDirContext)
 
 _At_ (Dirent->CdTime, _Post_notnull_) VOID CdUpdateDirentFromRawDirent(_In_ PIRP_CONTEXT IrpContext
 
 PAGED_CODE ()
 
 UNREFERENCED_PARAMETER (Fcb)
 
 ClearFlag (Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
 
 if (RawDirent->IntLeaveSize !=0)
 
 if (RawDirent->FileIdLen==0)
 
 if (!FlagOn(Dirent->DirentFlags, CD_ATTRIBUTE_DIRECTORY) &&(Dirent->DirentLength >((FIELD_OFFSET(RAW_DIRENT, FileId)+Dirent->FileNameLen)+1)))
 
VOID CdUpdateDirentName (_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
 
 _Success_ (return !=FALSE)
 
BOOLEAN CdFindDirectory (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PCD_NAME Name, _In_ BOOLEAN IgnoreCase, _Inout_ PFILE_ENUM_CONTEXT FileContext)
 
 _At_ (FileContext->ShortName.FileName.MaximumLength, _In_range_(>=, BYTE_COUNT_8_DOT_3)) BOOLEAN CdFindFileByShortName(_In_ PIRP_CONTEXT IrpContext
 
 CdVerifyOrCreateDirStreamFile (IrpContext, Fcb)
 
 CdLookupInitialFileDirent (IrpContext, Fcb, FileContext, Fcb->StreamOffset)
 
 if (ThisShortNameDirentOffset > ShortNameDirentOffset)
 
 if (ThisShortNameDirentOffset==ShortNameDirentOffset)
 
 while (CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
 
 if (Found)
 
BOOLEAN CdLookupNextInitialFileDirent (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Inout_ PFILE_ENUM_CONTEXT FileContext)
 
VOID CdLookupLastFileDirent (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PFILE_ENUM_CONTEXT FileContext)
 
VOID CdCleanupFileContext (_In_ PIRP_CONTEXT IrpContext, _In_ PFILE_ENUM_CONTEXT FileContext)
 

Variables

_In_ PFCB Fcb
 
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
 
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
 
Dirent DirentOffset = DirContext->BaseOffset + DirContext->SectorOffset
 
Dirent DirentLength = RawDirent->DirLen
 
Dirent StartingOffset = RawDirent->XarLen
 
Dirent CdTime = (PCHAR)RawDirent->RecordTime
 
Dirent DirentFlags = CdRawDirentFlags( IrpContext, RawDirent )
 
Dirent FileUnitSize
 
Dirent FileNameLen = RawDirent->FileIdLen
 
Dirent FileName = (PCHAR)RawDirent->FileId
 
Dirent XAAttributes = 0
 
Dirent XAFileNumber = 0
 
Dirent ExtentType = Form1Data
 
Dirent SystemUseOffset = 0
 
 return
 
_In_ PFCB _In_ PCD_NAME Name
 
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN IgnoreCase
 
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG ShortNameDirentOffset
 
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG _Inout_ PFILE_ENUM_CONTEXT FileContext
 
ULONG ThisShortNameDirentOffset = Dirent->DirentOffset >> SHORT_NAME_SHIFT
 
 do
 
return Found
 

Macro Definition Documentation

◆ BugCheckFileId

#define BugCheckFileId   (CDFS_BUG_CHECK_DIRSUP)

Definition at line 74 of file dirsup.c.

◆ CdRawDirent

#define CdRawDirent (   IC,
  DC 
)     Add2Ptr( (DC)->Sector, (DC)->SectorOffset, PRAW_DIRENT )

Definition at line 88 of file dirsup.c.

Function Documentation

◆ _At_() [1/2]

_At_ ( Dirent->  CdTime,
_Post_notnull_   
)

◆ _At_() [2/2]

_At_ ( FileContext->ShortName.FileName.  MaximumLength,
_In_range_(>=, BYTE_COUNT_8_DOT_3  
)

◆ _Success_()

_Success_ ( return = FALSE)

Definition at line 823 of file dirsup.c.

864{
867
869
870 PAGED_CODE();
871
872 //
873 // Make sure there is a stream file for this Fcb.
874 //
875
877
878 //
879 // Check to see whether we need to check for a possible short name.
880 //
881
882 ShortNameDirentOffset = CdShortNameDirentOffset( IrpContext, &Name->FileName );
883
884 //
885 // Position ourselves at the first entry.
886 //
887
888 CdLookupInitialFileDirent( IrpContext, Fcb, FileContext, Fcb->StreamOffset );
889
890 //
891 // Loop while there are more entries in this directory.
892 //
893
894 do {
895
896 Dirent = &FileContext->InitialDirent->Dirent;
897
898 //
899 // We only consider files which don't have the associated bit set.
900 // We also only look for files. All directories would already
901 // have been found.
902 //
903
904 if (!FlagOn( Dirent->DirentFlags, CD_ATTRIBUTE_ASSOC | CD_ATTRIBUTE_DIRECTORY )) {
905
906 //
907 // Update the name in the current dirent.
908 //
909
910 CdUpdateDirentName( IrpContext, Dirent, IgnoreCase );
911
912 //
913 // Don't bother with constant entries.
914 //
915
917
918 continue;
919 }
920
921 //
922 // Now check whether we have a name match.
923 // We exit the loop if we have a match.
924 //
925
926 if (CdIsNameInExpression( IrpContext,
927 &Dirent->CdCaseFileName,
928 Name,
929 0,
930 TRUE )) {
931
932 *MatchingName = &Dirent->CdCaseFileName;
933 Found = TRUE;
934 break;
935 }
936
937 //
938 // The names didn't match. If the input name is a possible short
939 // name and we are at the correct offset in the directory then
940 // check if the short names match.
941 //
942
943 if (((Dirent->DirentOffset >> SHORT_NAME_SHIFT) == ShortNameDirentOffset) &&
944 (Name->VersionString.Length == 0) &&
945 !CdIs8dot3Name( IrpContext,
946 Dirent->CdFileName.FileName )) {
947
948 //
949 // Create the short name and check for a match.
950 //
951
952 CdGenerate8dot3Name( IrpContext,
953 &Dirent->CdCaseFileName.FileName,
954 Dirent->DirentOffset,
955 FileContext->ShortName.FileName.Buffer,
956 &FileContext->ShortName.FileName.Length );
957
958 //
959 // Now check whether we have a name match.
960 // We exit the loop if we have a match.
961 //
962
963 if (CdIsNameInExpression( IrpContext,
965 Name,
966 0,
967 FALSE )) {
968
970 Found = TRUE;
971 break;
972 }
973 }
974 }
975
976 //
977 // Go to the next initial dirent for a file.
978 //
979
980 } while (CdLookupNextInitialFileDirent( IrpContext, Fcb, FileContext ));
981
982 //
983 // If we find the file then collect all of the dirents.
984 //
985
986 if (Found) {
987
988 CdLookupLastFileDirent( IrpContext, Fcb, FileContext );
989
990 }
991
992 return Found;
993}
unsigned char BOOLEAN
#define CD_ATTRIBUTE_DIRECTORY
Definition: cd.h:354
#define CD_ATTRIBUTE_ASSOC
Definition: cd.h:355
#define SHORT_NAME_SHIFT
Definition: cd.h:364
_In_ PFCB Fcb
Definition: dirsup.c:398
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN IgnoreCase
Definition: dirsup.c:1112
VOID CdLookupLastFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PFILE_ENUM_CONTEXT FileContext)
Definition: dirsup.c:1426
PAGED_CODE()
VOID CdUpdateDirentName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
Definition: dirsup.c:534
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG _Inout_ PFILE_ENUM_CONTEXT FileContext
Definition: dirsup.c:1148
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: dirsup.c:425
CdVerifyOrCreateDirStreamFile(IrpContext, Fcb)
BOOLEAN CdLookupNextInitialFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Inout_ PFILE_ENUM_CONTEXT FileContext)
Definition: dirsup.c:1275
return Found
Definition: dirsup.c:1270
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG ShortNameDirentOffset
Definition: dirsup.c:1113
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT _Out_ PCD_NAME * MatchingName
Definition: cdprocs.h:444
BOOLEAN CdIsNameInExpression(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME CurrentName, _In_ PCD_NAME SearchExpression, _In_ ULONG WildcardFlags, _In_ BOOLEAN CheckVersion)
Definition: namesup.c:844
#define CdLookupInitialFileDirent(IC, F, FC, DO)
Definition: cdprocs.h:551
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)
Definition: namesup.c:550
ULONG CdShortNameDirentOffset(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING Name)
Definition: namesup.c:955
BOOLEAN CdIs8dot3Name(_In_ PIRP_CONTEXT IrpContext, _In_ UNICODE_STRING FileName)
Definition: namesup.c:429
#define DIRENT_FLAG_CONSTANT_ENTRY
Definition: cdstruc.h:1671
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
ULONG Flags
Definition: ntfs.h:536
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1115
uint32_t ULONG
Definition: typedefs.h:59

◆ CdCheckForXAExtent()

XA_EXTENT_TYPE CdCheckForXAExtent ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PRAW_DIRENT  RawDirent,
_Inout_ PDIRENT  Dirent 
)

Definition at line 1790 of file dirsup.c.

1817{
1819 PSYSTEM_USE_XA SystemUseArea;
1820
1821 PAGED_CODE();
1822
1823 UNREFERENCED_PARAMETER( IrpContext );
1824
1825 //
1826 // Check if there is enough space for the XA system use area.
1827 //
1828
1829 if (Dirent->DirentLength - Dirent->SystemUseOffset >= sizeof( SYSTEM_USE_XA )) {
1830
1831 SystemUseArea = Add2Ptr( RawDirent, Dirent->SystemUseOffset, PSYSTEM_USE_XA );
1832
1833 //
1834 // Check for a valid signature.
1835 //
1836
1837 if (SystemUseArea->Signature == SYSTEM_XA_SIGNATURE) {
1838
1839 //
1840 // Check for an audio track.
1841 //
1842
1843 if (FlagOn( SystemUseArea->Attributes, SYSTEM_USE_XA_DA )) {
1844
1846
1847 } else if (FlagOn( SystemUseArea->Attributes, SYSTEM_USE_XA_FORM2 )) {
1848
1849 //
1850 // Check for XA data. Note that a number of discs (video CDs)
1851 // have files marked as type XA Mode 2 Form 1 (2048 bytes of
1852 // user data), but actually record these sectors as Mode2 Form 2
1853 // (2352). We will fail to read these files, since for M2F1,
1854 // a normal read CD command is issued (as per SCSI specs).
1855 //
1856
1858 }
1859
1860 Dirent->XAAttributes = SystemUseArea->Attributes;
1861 Dirent->XAFileNumber = SystemUseArea->FileNumber;
1862 }
1863 }
1864
1865 Dirent->ExtentType = ExtentType;
1866 return ExtentType;
1867}
enum _XA_EXTENT_TYPE XA_EXTENT_TYPE
@ Form1Data
Definition: cd.h:524
@ Mode2Form2Data
Definition: cd.h:525
@ CDAudio
Definition: cd.h:526
#define SYSTEM_XA_SIGNATURE
Definition: cd.h:520
#define SYSTEM_USE_XA_DA
Definition: cd.h:518
#define SYSTEM_USE_XA_FORM2
Definition: cd.h:517
Dirent ExtentType
Definition: dirsup.c:520
#define Add2Ptr(PTR, INC)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
UCHAR XAFileNumber
Definition: cdstruc.h:989
USHORT XAAttributes
Definition: cdstruc.h:983
USHORT Attributes
Definition: cd.h:493
UCHAR FileNumber
Definition: cd.h:505
USHORT Signature
Definition: cd.h:499

Referenced by CdLookupLastFileDirent().

◆ CdCheckRawDirentBounds()

ULONG CdCheckRawDirentBounds ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PDIRENT_ENUM_CONTEXT  DirContext 
)

Definition at line 1688 of file dirsup.c.

1718{
1719 ULONG NextDirentOffset;
1720 PRAW_DIRENT RawDirent;
1721
1722 PAGED_CODE();
1723
1724 UNREFERENCED_PARAMETER( IrpContext );
1725
1726 //
1727 // We should always have at least a byte still available in the
1728 // current buffer.
1729 //
1730
1731 NT_ASSERT( (DirContext->DataLength - DirContext->SectorOffset) >= 1 );
1732
1733 //
1734 // Get a pointer to the current dirent.
1735 //
1736
1737 RawDirent = CdRawDirent( IrpContext, DirContext );
1738
1739 //
1740 // If the dirent length is non-zero then look at the current dirent.
1741 //
1742
1743 if (RawDirent->DirLen != 0) {
1744
1745 //
1746 // Check the following bound for the dirent length.
1747 //
1748 // - Fits in the available bytes in the sector.
1749 // - Is at least the minimal dirent size.
1750 // - Is large enough to hold the file name.
1751 //
1752
1753 if ((RawDirent->DirLen > (DirContext->DataLength - DirContext->SectorOffset)) ||
1754 (RawDirent->DirLen < MIN_RAW_DIRENT_LEN) ||
1755 (RawDirent->DirLen < (MIN_RAW_DIRENT_LEN - 1 + RawDirent->FileIdLen))) {
1756
1758 }
1759
1760 //
1761 // Copy the dirent length field.
1762 //
1763
1764 NextDirentOffset = RawDirent->DirLen;
1765
1766 //
1767 // If we are exactly at the next sector then tell our caller by
1768 // returning zero.
1769 //
1770
1771 if (NextDirentOffset == (DirContext->DataLength - DirContext->SectorOffset)) {
1772
1773 NextDirentOffset = 0;
1774 }
1775
1776 } else {
1777
1778 NextDirentOffset = 0;
1779 }
1780
1781 return NextDirentOffset;
1782}
#define MIN_RAW_DIRENT_LEN
Definition: cd.h:360
#define CdRawDirent(IC, DC)
Definition: dirsup.c:88
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
Definition: dirsup.c:399
#define CdRaiseStatus(IC, S)
Definition: cdprocs.h:1859
UCHAR FileIdLen
Definition: cd.h:345
UCHAR DirLen
Definition: cd.h:332
#define STATUS_FILE_CORRUPT_ERROR
Definition: udferr_usr.h:168
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by CdLookupDirent(), and CdLookupNextDirent().

◆ CdCleanupFileContext()

VOID CdCleanupFileContext ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFILE_ENUM_CONTEXT  FileContext 
)

Definition at line 1636 of file dirsup.c.

1659{
1660 PCOMPOUND_DIRENT CurrentCompoundDirent;
1661 ULONG Count = 2;
1662
1663 PAGED_CODE();
1664
1665 UNREFERENCED_PARAMETER( IrpContext );
1666
1667 //
1668 // Cleanup the individual compound dirents.
1669 //
1670
1671 do {
1672
1673 CurrentCompoundDirent = &FileContext->Dirents[ Count ];
1674 CdCleanupDirContext( IrpContext, &CurrentCompoundDirent->DirContext );
1675 CdCleanupDirent( IrpContext, &CurrentCompoundDirent->Dirent );
1676
1677 } while (Count--);
1678
1679 return;
1680}
#define CdCleanupDirContext(IC, DC)
Definition: cdprocs.h:548
#define CdCleanupDirent(IC, D)
Definition: cdprocs.h:542
int Count
Definition: noreturn.cpp:7
DIRENT_ENUM_CONTEXT DirContext
Definition: cdstruc.h:1683

Referenced by _Requires_lock_held_(), and CdInitializeEnumeration().

◆ CdFindDirectory()

BOOLEAN CdFindDirectory ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_In_ PCD_NAME  Name,
_In_ BOOLEAN  IgnoreCase,
_Inout_ PFILE_ENUM_CONTEXT  FileContext 
)

Definition at line 997 of file dirsup.c.

1031{
1033
1035
1036 PAGED_CODE();
1037
1038 //
1039 // Make sure there is a stream file for this Fcb.
1040 //
1041
1042 CdVerifyOrCreateDirStreamFile( IrpContext, Fcb);
1043
1044 //
1045 // Position ourselves at the first entry.
1046 //
1047
1048 CdLookupInitialFileDirent( IrpContext, Fcb, FileContext, Fcb->StreamOffset );
1049
1050 //
1051 // Loop while there are more entries in this directory.
1052 //
1053
1054 do {
1055
1056 Dirent = &FileContext->InitialDirent->Dirent;
1057
1058 //
1059 // We only look for directories. Directories cannot have the
1060 // associated bit set.
1061 //
1062
1063 if (FlagOn( Dirent->DirentFlags, CD_ATTRIBUTE_DIRECTORY )) {
1064
1065 //
1066 // Update the name in the current dirent.
1067 //
1068
1069 CdUpdateDirentName( IrpContext, Dirent, IgnoreCase );
1070
1071 //
1072 // Don't bother with constant entries.
1073 //
1074
1076
1077 continue;
1078 }
1079
1080 //
1081 // Now check whether we have a name match.
1082 // We exit the loop if we have a match.
1083 //
1084
1085 if (CdIsNameInExpression( IrpContext,
1086 &Dirent->CdCaseFileName,
1087 Name,
1088 0,
1089 TRUE )) {
1090
1091 Found = TRUE;
1092 break;
1093 }
1094 }
1095
1096 //
1097 // Go to the next initial dirent.
1098 //
1099
1100 } while (CdLookupNextInitialFileDirent( IrpContext, Fcb, FileContext ));
1101
1102 return Found;
1103}

◆ CdLookupDirent()

VOID CdLookupDirent ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_In_ ULONG  DirentOffset,
_Out_ PDIRENT_ENUM_CONTEXT  DirContext 
)

Definition at line 125 of file dirsup.c.

160{
161 LONGLONG BaseOffset;
162
163 PAGED_CODE();
164
165 //
166 // Initialize the offset of the first dirent we want to map.
167 //
168
169 DirContext->BaseOffset = SectorTruncate( DirentOffset );
170 BaseOffset = DirContext->BaseOffset;
171
172 DirContext->DataLength = SECTOR_SIZE;
173
174 DirContext->SectorOffset = SectorOffset( DirentOffset );
175
176 //
177 // Truncate the data length if we are at the end of the file.
178 //
179
180 if (DirContext->DataLength > (Fcb->FileSize.QuadPart - BaseOffset)) {
181
182 DirContext->DataLength = (ULONG) (Fcb->FileSize.QuadPart - BaseOffset);
183 }
184
185 //
186 // Now map the data at this offset.
187 //
188
190 (PLARGE_INTEGER) &BaseOffset,
191 DirContext->DataLength,
192 TRUE,
193 &DirContext->Bcb,
194 &DirContext->Sector );
195
196 //
197 // Verify the dirent bounds.
198 //
199
200 DirContext->NextDirentOffset = CdCheckRawDirentBounds( IrpContext,
201 DirContext );
202
203 return;
204}
#define SECTOR_SIZE
Definition: fs.h:22
ULONG CdCheckRawDirentBounds(_In_ PIRP_CONTEXT IrpContext, _In_ PDIRENT_ENUM_CONTEXT DirContext)
Definition: dirsup.c:1688
Dirent DirentOffset
Definition: dirsup.c:444
#define SectorTruncate(L)
Definition: cdprocs.h:1588
#define SectorOffset(L)
Definition: cdprocs.h:1622
BOOLEAN NTAPI CcMapData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *BcbResult, OUT PVOID *Buffer)
Definition: pinsup.c:694
PFILE_OBJECT FileObject
Definition: ntfs.h:520
int64_t LONGLONG
Definition: typedefs.h:68

Referenced by _Requires_lock_held_(), and CdCreateInternalStream().

◆ CdLookupInitialFileDirent()

CdLookupInitialFileDirent ( IrpContext  ,
Fcb  ,
FileContext  ,
Fcb->  StreamOffset 
)

◆ CdLookupLastFileDirent()

VOID CdLookupLastFileDirent ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_In_ PFILE_ENUM_CONTEXT  FileContext 
)

Definition at line 1426 of file dirsup.c.

1460{
1462 PCOMPOUND_DIRENT CurrentCompoundDirent;
1463 PDIRENT CurrentDirent = NULL;
1464
1465 BOOLEAN FirstPass = TRUE;
1466 BOOLEAN FoundDirent;
1467
1468 PAGED_CODE();
1469
1470 //
1471 // The current dirent to look at is the initial dirent for the file.
1472 //
1473
1474 CurrentCompoundDirent = FileContext->InitialDirent;
1475
1476 //
1477 // Loop until we reach the last dirent for the file.
1478 //
1479
1480 while (TRUE) {
1481
1482 CurrentDirent = &CurrentCompoundDirent->Dirent;
1483
1484 //
1485 // Check if this extent has XA sectors.
1486 //
1487
1488 if ((CurrentDirent->SystemUseOffset != 0) &&
1490 CdCheckForXAExtent( IrpContext,
1491 CdRawDirent( IrpContext, &CurrentCompoundDirent->DirContext ),
1492 CurrentDirent )) {
1493
1494 //
1495 // Any previous dirent must describe XA sectors as well.
1496 //
1497
1498 if (!FirstPass && (ExtentType != CurrentDirent->ExtentType)) {
1499
1501 }
1502
1503 //
1504 // If there are XA sectors then the data on the disk must
1505 // be correctly aligned on sectors and be an integral number of
1506 // sectors. Only an issue if the logical block size is not
1507 // 2048.
1508 //
1509
1510 if (Fcb->Vcb->BlockSize != SECTOR_SIZE) {
1511
1512 //
1513 // We will do the following checks.
1514 //
1515 // Data must start on a sector boundary.
1516 // Data length must be integral number of sectors.
1517 //
1518
1519 if ((SectorBlockOffset( Fcb->Vcb, CurrentDirent->StartingOffset ) != 0) ||
1520 (SectorBlockOffset( Fcb->Vcb, CurrentDirent->DataLength ) != 0)) {
1521
1523 }
1524
1525 //
1526 // If interleaved then both the file unit and interleave
1527 // gap must be integral number of sectors.
1528 //
1529
1530 if ((CurrentDirent->FileUnitSize != 0) &&
1531 ((SectorBlockOffset( Fcb->Vcb, CurrentDirent->FileUnitSize ) != 0) ||
1532 (SectorBlockOffset( Fcb->Vcb, CurrentDirent->InterleaveGapSize ) != 0))) {
1533
1535 }
1536 }
1537
1538 //
1539 // If this is the first dirent then add the bytes for the RIFF
1540 // header.
1541 //
1542
1543 if (FirstPass) {
1544
1545 FileContext->FileSize = sizeof( RIFF_HEADER );
1546 }
1547
1548 //
1549 // Add the size of the mode2-form2 sector for each sector
1550 // we have here.
1551 //
1552
1553 FileContext->FileSize += Int32x32To64( CurrentDirent->DataLength >> SECTOR_SHIFT,
1555
1556 } else {
1557
1558 //
1559 // This extent does not have XA sectors. Any previous dirent
1560 // better not have XA sectors.
1561 //
1562
1563 if (!FirstPass && (ExtentType != CurrentDirent->ExtentType)) {
1564
1566 }
1567
1568 //
1569 // Add these bytes to the file size.
1570 //
1571
1572 FileContext->FileSize += CurrentDirent->DataLength;
1573 }
1574
1575 //
1576 // If we are at the last dirent then exit.
1577 //
1578
1579 if (!FlagOn( CurrentDirent->DirentFlags, CD_ATTRIBUTE_MULTI )) {
1580
1581 break;
1582 }
1583
1584 //
1585 // Remember the extent type of the current extent.
1586 //
1587
1588 ExtentType = CurrentDirent->ExtentType;
1589
1590 //
1591 // Look for the next dirent of the file.
1592 //
1593
1594 FoundDirent = CdLookupNextDirent( IrpContext,
1595 Fcb,
1596 &CurrentCompoundDirent->DirContext,
1597 &FileContext->CurrentDirent->DirContext );
1598
1599 //
1600 // If we didn't find the entry then this is a corrupt directory.
1601 //
1602
1603 if (!FoundDirent) {
1604
1606 }
1607
1608 //
1609 // Remember the dirent we just found.
1610 //
1611
1612 CurrentCompoundDirent = FileContext->CurrentDirent;
1613 FirstPass = FALSE;
1614
1615 //
1616 // Look up all of the dirent information for the given dirent.
1617 //
1618
1619 CdUpdateDirentFromRawDirent( IrpContext,
1620 Fcb,
1621 &CurrentCompoundDirent->DirContext,
1622 &CurrentCompoundDirent->Dirent );
1623
1624 //
1625 // Set flag to show there were multiple extents.
1626 //
1627
1629 }
1630
1631 return;
1632}
#define SECTOR_SHIFT
Definition: cd.h:32
#define CD_ATTRIBUTE_MULTI
Definition: cd.h:356
#define XA_SECTOR_SIZE
Definition: cd.h:35
BOOLEAN CdLookupNextDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PDIRENT_ENUM_CONTEXT CurrentDirContext, _Inout_ PDIRENT_ENUM_CONTEXT NextDirContext)
Definition: dirsup.c:208
XA_EXTENT_TYPE CdCheckForXAExtent(_In_ PIRP_CONTEXT IrpContext, _In_ PRAW_DIRENT RawDirent, _Inout_ PDIRENT Dirent)
Definition: dirsup.c:1790
#define SectorBlockOffset(V, LB)
Definition: cdprocs.h:1626
#define VCB_STATE_CDXA
Definition: cdstruc.h:711
struct _RIFF_HEADER RIFF_HEADER
#define FILE_CONTEXT_MULTIPLE_DIRENTS
Definition: cdstruc.h:1739
#define NULL
Definition: types.h:112
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define Int32x32To64(a, b)
UCHAR DirentFlags
Definition: cdstruc.h:1613
ULONG StartingOffset
Definition: cdstruc.h:1593
ULONG InterleaveGapSize
Definition: cdstruc.h:1627
XA_EXTENT_TYPE ExtentType
Definition: cdstruc.h:1663
ULONG FileUnitSize
Definition: cdstruc.h:1626
ULONG DataLength
Definition: cdstruc.h:1600
ULONG SystemUseOffset
Definition: cdstruc.h:1633
PVCB Vcb
Definition: cdstruc.h:933
ULONG BlockSize
Definition: cdstruc.h:620
ULONG VcbState
Definition: cdstruc.h:540

Referenced by _Requires_lock_held_(), _Success_(), CdEnumerateIndex(), and if().

◆ CdLookupNextDirent()

BOOLEAN CdLookupNextDirent ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_In_ PDIRENT_ENUM_CONTEXT  CurrentDirContext,
_Inout_ PDIRENT_ENUM_CONTEXT  NextDirContext 
)

Definition at line 208 of file dirsup.c.

253{
254 LONGLONG CurrentBaseOffset = CurrentDirContext->BaseOffset;
255 ULONG TempUlong;
256
257 BOOLEAN FoundDirent = FALSE;
258
259 PAGED_CODE();
260
261 //
262 // Check if a different sector is mapped. If so then move our target
263 // enumeration context to the same sector.
264 //
265
266 if ((CurrentDirContext->BaseOffset != NextDirContext->BaseOffset) ||
267 (NextDirContext->Bcb == NULL)) {
268
269 //
270 // Unpin the current target Bcb and map the next sector.
271 //
272
273 CdUnpinData( IrpContext, &NextDirContext->Bcb );
274
276 (PLARGE_INTEGER) &CurrentBaseOffset,
277 CurrentDirContext->DataLength,
278 TRUE,
279 &NextDirContext->Bcb,
280 &NextDirContext->Sector );
281
282 //
283 // Copy the data length and sector offset.
284 //
285
286 NextDirContext->DataLength = CurrentDirContext->DataLength;
287 NextDirContext->BaseOffset = CurrentDirContext->BaseOffset;
288 }
289
290 //
291 // Now move to the same offset in the sector.
292 //
293
294 NextDirContext->SectorOffset = CurrentDirContext->SectorOffset;
295
296 //
297 // If the value is zero then unmap the current sector and set up
298 // the base offset to the beginning of the next sector.
299 //
300
301 if (CurrentDirContext->NextDirentOffset == 0) {
302
303 CurrentBaseOffset = NextDirContext->BaseOffset + NextDirContext->DataLength;
304
305 //
306 // Unmap the current sector. We test the value of the Bcb in the
307 // loop below to see if we need to read in another sector.
308 //
309
310 CdUnpinData( IrpContext, &NextDirContext->Bcb );
311
312 //
313 // There is another possible dirent in the current sector. Update the
314 // enumeration context to reflect this.
315 //
316
317 } else {
318
319 NextDirContext->SectorOffset += CurrentDirContext->NextDirentOffset;
320 }
321
322 //
323 // Now loop until we find the next possible dirent or walk off the directory.
324 //
325
326 while (TRUE) {
327
328 //
329 // If we don't currently have a sector mapped then map the
330 // directory at the current offset.
331 //
332
333 if (NextDirContext->Bcb == NULL) {
334
335 TempUlong = SECTOR_SIZE;
336
337 if (TempUlong > (ULONG) (Fcb->FileSize.QuadPart - CurrentBaseOffset)) {
338
339 TempUlong = (ULONG) (Fcb->FileSize.QuadPart - CurrentBaseOffset);
340
341 //
342 // If the length is zero then there is no dirent.
343 //
344
345 if (TempUlong == 0) {
346
347 break;
348 }
349 }
350
352 (PLARGE_INTEGER) &CurrentBaseOffset,
353 TempUlong,
354 TRUE,
355 &NextDirContext->Bcb,
356 &NextDirContext->Sector );
357
358 NextDirContext->BaseOffset = (ULONG) CurrentBaseOffset;
359 NextDirContext->SectorOffset = 0;
360 NextDirContext->DataLength = TempUlong;
361 }
362
363 //
364 // The CDFS spec allows for sectors in a directory to contain all zeroes.
365 // In this case we need to move to the next sector. So look at the
366 // current potential dirent for a zero length. Move to the next
367 // dirent if length is zero.
368 //
369
370 if (*((PCHAR) CdRawDirent( IrpContext, NextDirContext )) != 0) {
371
372 FoundDirent = TRUE;
373 break;
374 }
375
376 CurrentBaseOffset = NextDirContext->BaseOffset + NextDirContext->DataLength;
377 CdUnpinData( IrpContext, &NextDirContext->Bcb );
378 }
379
380 //
381 // Check the dirent bounds if we found a dirent.
382 //
383
384 if (FoundDirent) {
385
386 NextDirContext->NextDirentOffset = CdCheckRawDirentBounds( IrpContext,
387 NextDirContext );
388 }
389
390 return FoundDirent;
391}
#define CdUnpinData(IC, B)
Definition: cdprocs.h:269
char * PCHAR
Definition: typedefs.h:51

Referenced by _Requires_lock_held_(), CdInitializeFcbFromFileContext(), CdLookupLastFileDirent(), and CdLookupNextInitialFileDirent().

◆ CdLookupNextInitialFileDirent()

BOOLEAN CdLookupNextInitialFileDirent ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_Inout_ PFILE_ENUM_CONTEXT  FileContext 
)

Definition at line 1275 of file dirsup.c.

1310{
1311 PRAW_DIRENT RawDirent;
1312
1313 PDIRENT_ENUM_CONTEXT CurrentDirContext;
1314 PDIRENT_ENUM_CONTEXT TargetDirContext;
1315 PCOMPOUND_DIRENT TempDirent;
1316
1317 BOOLEAN FoundDirent = FALSE;
1318 BOOLEAN FoundLastDirent;
1319
1320 PAGED_CODE();
1321
1322 //
1323 // Start by saving the initial dirent of the current file as the
1324 // previous file.
1325 //
1326
1327 TempDirent = FileContext->PriorDirent;
1328 FileContext->PriorDirent = FileContext->InitialDirent;
1329 FileContext->InitialDirent = TempDirent;
1330
1331 //
1332 // We will use the initial dirent of the prior file unless the
1333 // previous search returned multiple extents.
1334 //
1335
1336 CurrentDirContext = &FileContext->PriorDirent->DirContext;
1337
1339
1340 CurrentDirContext = &FileContext->CurrentDirent->DirContext;
1341 }
1342
1343 //
1344 // Clear all of the flags and file size for the next file.
1345 //
1346
1347 FileContext->Flags = 0;
1348 FileContext->FileSize = 0;
1349
1350 FileContext->ShortName.FileName.Length = 0;
1351
1352 //
1353 // We always want to store the result into the updated initial dirent
1354 // context.
1355 //
1356
1357 TargetDirContext = &FileContext->InitialDirent->DirContext;
1358
1359 //
1360 // Loop until we find the first dirent after the last dirent of the
1361 // current file. We may not be at the last dirent for the current file yet
1362 // so we may walk forward looking for the last and then find the
1363 // initial dirent for the next file after that.
1364 //
1365
1366 while (TRUE) {
1367
1368 //
1369 // Remember if the last dirent we visited was the last dirent for
1370 // a file.
1371 //
1372
1373 RawDirent = CdRawDirent( IrpContext, CurrentDirContext );
1374
1375 FoundLastDirent = !FlagOn( CdRawDirentFlags( IrpContext, RawDirent ), CD_ATTRIBUTE_MULTI );
1376
1377 //
1378 // Try to find another dirent.
1379 //
1380
1381 FoundDirent = CdLookupNextDirent( IrpContext,
1382 Fcb,
1383 CurrentDirContext,
1384 TargetDirContext );
1385
1386 //
1387 // Exit the loop if no entry found.
1388 //
1389
1390 if (!FoundDirent) {
1391
1392 break;
1393
1394 }
1395
1396 //
1397 // Update the in-memory dirent.
1398 //
1399
1400 CdUpdateDirentFromRawDirent( IrpContext,
1401 Fcb,
1402 TargetDirContext,
1403 &FileContext->InitialDirent->Dirent );
1404
1405 //
1406 // Exit the loop if we had the end for the previous file.
1407 //
1408
1409 if (FoundLastDirent) {
1410
1411 break;
1412 }
1413
1414 //
1415 // Always use a single dirent from this point on.
1416 //
1417
1418 CurrentDirContext = TargetDirContext;
1419 }
1420
1421 return FoundDirent;
1422}
#define CdRawDirentFlags(IC, RD)
Definition: cd.h:370

Referenced by _Requires_lock_held_(), _Success_(), CdEnumerateIndex(), CdFindDirectory(), and CdInitializeEnumeration().

◆ CdUpdateDirentName()

VOID CdUpdateDirentName ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PDIRENT  Dirent,
_In_ ULONG  IgnoreCase 
)

Definition at line 534 of file dirsup.c.

562{
563 UCHAR DirectoryValue;
565
567
568 PAGED_CODE();
569
570 //
571 // Check if this is a self or parent entry. There is no version number
572 // in these cases. We use a fixed string for these.
573 //
574 // Self-Entry - Length is 1, value is 0.
575 // Parent-Entry - Length is 1, value is 1.
576 //
577
578 if ((Dirent->FileNameLen == 1) &&
579 FlagOn( Dirent->DirentFlags, CD_ATTRIBUTE_DIRECTORY )) {
580
581 DirectoryValue = *((PCHAR) Dirent->FileName);
582
583 if ((DirectoryValue == 0) || (DirectoryValue == 1)) {
584
585 //
586 // We should not have allocated a name by the time we see these cases.
587 // If we have, this means that the image is in violation of ISO 9660 7.6.2,
588 // which states that the ./.. entries must be the first two in the directory.
589 //
590
592
594 }
595
596 //
597 // Now use one of the hard coded directory names.
598 //
599
600 Dirent->CdFileName.FileName = CdUnicodeDirectoryNames[DirectoryValue];
601
602 //
603 // Show that there is no version number.
604 //
605
606 Dirent->CdFileName.VersionString.Length = 0;
607
608 //
609 // The case name is the same as the exact name.
610 //
611
612 Dirent->CdCaseFileName = Dirent->CdFileName;
613
614 //
615 // Mark this as a constant value entry.
616 //
617
619
620 //
621 // Return now.
622 //
623
624 return;
625 }
626 }
627
628 //
629 // Mark this as a non-constant value entry.
630 //
631
633
634 //
635 // Compute how large a buffer we will need. If this is an ignore
636 // case operation then we will want a double size buffer. If the disk is not
637 // a Joliet disk then we might need two bytes for each byte in the name.
638 //
639
640 Length = Dirent->FileNameLen;
641
642 if (IgnoreCase) {
643
644 Length *= 2;
645 }
646
647 if (!FlagOn( IrpContext->Vcb->VcbState, VCB_STATE_JOLIET )) {
648
649 Length *= sizeof( WCHAR );
650 }
651
652 //
653 // Now decide if we need to allocate a new buffer. We will if
654 // this name won't fit in the embedded name buffer and it is
655 // larger than the current allocated buffer. We always use the
656 // allocated buffer if present.
657 //
658 // If we haven't allocated a buffer then use the embedded buffer if the data
659 // will fit. This is the typical case.
660 //
661
663 (Length <= sizeof( Dirent->NameBuffer ))) {
664
665 Dirent->CdFileName.FileName.MaximumLength = sizeof( Dirent->NameBuffer );
666 Dirent->CdFileName.FileName.Buffer = Dirent->NameBuffer;
667
668 } else {
669
670 //
671 // We need to use an allocated buffer. Check if the current buffer
672 // is large enough.
673 //
674
675 if (Length > Dirent->CdFileName.FileName.MaximumLength) {
676
677 //
678 // Free any allocated buffer.
679 //
680
682
683 CdFreePool( &Dirent->CdFileName.FileName.Buffer );
685 }
686
687 Dirent->CdFileName.FileName.Buffer = FsRtlAllocatePoolWithTag( CdPagedPool,
688 Length,
690
692
693 Dirent->CdFileName.FileName.MaximumLength = (USHORT) Length;
694 }
695 }
696
697 //
698 // We now have a buffer for the name. We need to either convert the on-disk bigendian
699 // to little endian or covert the name to Unicode.
700 //
701
702 if (!FlagOn( IrpContext->Vcb->VcbState, VCB_STATE_JOLIET )) {
703
704 Status = RtlOemToUnicodeN( Dirent->CdFileName.FileName.Buffer,
705 Dirent->CdFileName.FileName.MaximumLength,
706 &Length,
707 Dirent->FileName,
708 Dirent->FileNameLen );
709
712 Dirent->CdFileName.FileName.Length = (USHORT) Length;
713
714 } else {
715
716 //
717 // Convert this string to little endian.
718 //
719
720 CdConvertBigToLittleEndian( IrpContext,
721 Dirent->FileName,
722 Dirent->FileNameLen,
723 (PCHAR) Dirent->CdFileName.FileName.Buffer );
724
725 Dirent->CdFileName.FileName.Length = (USHORT) Dirent->FileNameLen;
726 }
727
728 //
729 // Split the name into name and version strings.
730 //
731
732 CdConvertNameToCdName( IrpContext,
733 &Dirent->CdFileName );
734
735 //
736 // The name length better be non-zero.
737 //
738
739 if (Dirent->CdFileName.FileName.Length == 0) {
740
742 }
743
744 //
745 // If the filename ends with a period then back up one character.
746 //
747
748 if (Dirent->CdFileName.FileName.Buffer[(Dirent->CdFileName.FileName.Length - sizeof( WCHAR )) / 2] == L'.') {
749
750 //
751 // Slide the version string down.
752 //
753
754 if (Dirent->CdFileName.VersionString.Length != 0) {
755
756 PWCHAR NewVersion;
757
758 //
759 // Start from the position currently containing the separator.
760 //
761
762 NewVersion = Add2Ptr( Dirent->CdFileName.FileName.Buffer,
763 Dirent->CdFileName.FileName.Length,
764 PWCHAR );
765
766 //
767 // Now overwrite the period.
768 //
769
770 RtlMoveMemory( NewVersion - 1,
771 NewVersion,
772 Dirent->CdFileName.VersionString.Length + sizeof( WCHAR ));
773
774 //
775 // Now point to the new version string.
776 //
777
778 Dirent->CdFileName.VersionString.Buffer = NewVersion;
779 }
780
781 //
782 // Shrink the filename length.
783 //
784
785 Dirent->CdFileName.FileName.Length -= sizeof( WCHAR );
786 }
787
788 if (!CdIsLegalName( IrpContext, &Dirent->CdFileName.FileName )) {
789
791 }
792
793 //
794 // If this an exact case operation then use the filename exactly.
795 //
796
797 if (!IgnoreCase) {
798
799 Dirent->CdCaseFileName = Dirent->CdFileName;
800
801 //
802 // Otherwise perform our upcase operation. We already have guaranteed the buffers are
803 // there.
804 //
805
806 } else {
807
808 Dirent->CdCaseFileName.FileName.Buffer = Add2Ptr( Dirent->CdFileName.FileName.Buffer,
809 Dirent->CdFileName.FileName.MaximumLength / 2,
810 PWCHAR);
811
812 Dirent->CdCaseFileName.FileName.MaximumLength = Dirent->CdFileName.FileName.MaximumLength / 2;
813
814 CdUpcaseName( IrpContext,
815 &Dirent->CdFileName,
816 &Dirent->CdCaseFileName );
817 }
818
819 return;
820}
LONG NTSTATUS
Definition: precomp.h:26
UNICODE_STRING CdUnicodeDirectoryNames[]
Definition: cddata.c:52
VOID CdConvertBigToLittleEndian(_In_ PIRP_CONTEXT IrpContext, _In_reads_bytes_(ByteCount) PCHAR BigEndian, _In_ ULONG ByteCount, _Out_writes_bytes_(ByteCount) PCHAR LittleEndian)
Definition: namesup.c:110
VOID CdUpcaseName(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME Name, _Inout_ PCD_NAME UpcaseName)
Definition: namesup.c:194
BOOLEAN CdIsLegalName(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING FileName)
Definition: namesup.c:377
#define CdFreePool(x)
Definition: cdprocs.h:2190
#define CdPagedPool
Definition: cdprocs.h:1380
#define TAG_DIRENT_NAME
Definition: cdprocs.h:87
#define VCB_STATE_JOLIET
Definition: cdstruc.h:708
#define DIRENT_FLAG_ALLOC_BUFFER
Definition: cdstruc.h:1670
#define ClearFlag(_F, _SF)
Definition: ext2fs.h:191
Status
Definition: gdiplustypes.h:25
#define PCHAR
Definition: match.c:90
_Use_decl_annotations_ NTSTATUS NTAPI RtlOemToUnicodeN(_Out_ PWCHAR UnicodeString, _In_ ULONG UnicodeSize, _Out_opt_ PULONG ResultSize, _In_ PCCH OemString, _In_ ULONG OemSize)
Definition: nlsboot.c:282
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:229
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
#define __analysis_assert(e)
Definition: specstrings.h:259
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint16_t * PWCHAR
Definition: typedefs.h:56
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by _Success_(), CdCreateInternalStream(), CdEnumerateIndex(), CdFindDirectory(), CdInitializeEnumeration(), and if().

◆ CdVerifyOrCreateDirStreamFile()

CdVerifyOrCreateDirStreamFile ( IrpContext  ,
Fcb   
)

Referenced by _Success_(), and CdFindDirectory().

◆ ClearFlag()

ClearFlag ( Dirent->  Flags,
DIRENT_FLAG_NOT_PERSISTENT   
)

◆ if() [1/6]

if ( FlagOnDirent->DirentFlags, CD_ATTRIBUTE_DIRECTORY) &&(Dirent->DirentLength >((FIELD_OFFSET(RAW_DIRENT, FileId)+Dirent->FileNameLen)+1))

Definition at line 523 of file dirsup.c.

524 {
525
526 Dirent->SystemUseOffset = WordAlign( FIELD_OFFSET( RAW_DIRENT, FileId ) + Dirent->FileNameLen );
527 }
#define WordAlign(Ptr)
Definition: cdprocs.h:1554
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

◆ if() [2/6]

if ( Found  )

Definition at line 1264 of file dirsup.c.

1264 {
1265
1266 CdLookupLastFileDirent( IrpContext, Fcb, FileContext );
1267
1268 }

◆ if() [3/6]

if ( RawDirent->  FileIdLen = = 0)

Definition at line 501 of file dirsup.c.

501 {
502
504 }

◆ if() [4/6]

if ( RawDirent->IntLeaveSize !  = 0)

Definition at line 487 of file dirsup.c.

487 {
488
489 Dirent->FileUnitSize = RawDirent->IntLeaveSize;
490 Dirent->InterleaveGapSize = RawDirent->IntLeaveSkip;
491 }

◆ if() [5/6]

Definition at line 1186 of file dirsup.c.

1186 {
1187
1188 break;
1189 }

◆ if() [6/6]

Definition at line 1196 of file dirsup.c.

1196 {
1197
1198 //
1199 // If this is an associated file then get out.
1200 //
1201
1202 if (FlagOn( Dirent->DirentFlags, CD_ATTRIBUTE_ASSOC )) {
1203
1204 break;
1205 }
1206
1207 //
1208 // Update the name in the dirent and check if it is not
1209 // an 8.3 name.
1210 //
1211
1212 CdUpdateDirentName( IrpContext, Dirent, IgnoreCase );
1213
1214 if (CdIs8dot3Name( IrpContext,
1215 Dirent->CdFileName.FileName )) {
1216
1217 break;
1218 }
1219
1220 //
1221 // Generate the 8.3 name see if it matches our input name.
1222 //
1223
1224 CdGenerate8dot3Name( IrpContext,
1225 &Dirent->CdCaseFileName.FileName,
1226 Dirent->DirentOffset,
1227 FileContext->ShortName.FileName.Buffer,
1228 &FileContext->ShortName.FileName.Length );
1229
1230 //
1231 // Check if this name matches.
1232 //
1233
1234 if (CdIsNameInExpression( IrpContext,
1235 Name,
1237 0,
1238 FALSE )) {
1239
1240 //
1241 // Let our caller know we found an entry.
1242 //
1243
1244 Found = TRUE;
1245 }
1246
1247 //
1248 // Break out of the loop.
1249 //
1250
1251 break;
1252 }

◆ PAGED_CODE()

◆ UNREFERENCED_PARAMETER()

UNREFERENCED_PARAMETER ( Fcb  )

◆ while()

while ( CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext )

Referenced by __attribute__(), _DibFunction(), _Function_class_(), add_dirent_to_buf(), arith_decode(), BmpFrameDecode_ReadRLE4(), BmpFrameDecode_ReadRLE8(), CabinetExtractFile(), cmyk_ycck_convert(), codeview_add_type_enum_field_list(), codeview_add_type_struct_field_list(), convert_hex_csv_to_hex(), d3dx_effect_ApplyParameterBlock(), deflate(), delete_stat_item(), DrawTextFromClipboard(), duplicate_extents(), EfiVmCloseProtocol(), EfiVmOpenProtocol(), Ext2ReadGroupDescriptors(), Ext2SetLinkInfo(), Ext2SetRenameInfo(), ext3_delete_entry(), fill_pnpentity(), find_revoke_record(), fixup_buffer_cr(), FltRegisterFilter(), free_parameter_block(), FxUsbCreateConfigRequest(), get_retrieval_pointers(), GetDmiString(), gl_DrawArrays(), GuiConsoleInputThread(), HalpAcpiGetTableFromBios(), HalpParseApicTables(), Heap32First(), InfFindNextMatchLine(), InfGetMultiSzField(), InfpGetMultiSzField(), int_upsample(), IntSetClassMenuName(), load_chunk_root(), load_mesh_data(), MiInsertInSystemSpace(), MmAlterRegion(), NtfsReadAttribute(), ObQueryNameString(), open_fcb(), ParseSMBiosTables(), partial_stripe_read(), PciFindParentPciFdoExtension(), PciFindPdoByLocation(), pdb_process_symbol_imports(), pre_process_data(), prepare_png_alpha(), process_data_simple_main(), query_filesystems(), read_data(), rgb1_gray_convert(), rgb_gray_convert(), rgb_ycc_convert(), RtlNumberOfSetBits(), ScanForUnpartitionedDiskSpace(), scrub_raid6_stripe(), search_dirblock(), send_inode_extref(), send_inode_ref(), SetDiskSignature(), SetupDiDestroyDriverInfoList(), SetupDiEnumDeviceInterfaces(), sinc_hex_vari_process(), sinc_mono_vari_process(), sinc_multichan_vari_process(), sinc_quad_vari_process(), sinc_stereo_vari_process(), SmpApiLoop(), stabs_pts_read_range_value(), TIFFReadDirectoryFindFieldInfo(), UnhandledExceptionFilter(), unzReadCurrentFile(), update_chunk_cache_tree(), USBPORT_ParseConfigurationDescriptor(), vfatReleaseFCB(), VgaInterpretCmdStream(), write_metadata_items(), xsltCheckExtPrefix(), xsltCheckExtURI(), xsltGetKey(), xsltInitAllDocKeys(), xsltInitCtxtKey(), xsltInitCtxtKeys(), xsltInitDocKeyTable(), xsltRegisterExtPrefix(), XXH64_digest_endian(), ycc_rgb_convert(), and ycck_cmyk_convert().

Variable Documentation

◆ CdTime

Dirent CdTime = (PCHAR)RawDirent->RecordTime

Definition at line 471 of file dirsup.c.

Referenced by main().

◆ DirContext

Definition at line 399 of file dirsup.c.

Referenced by CdCheckRawDirentBounds(), and CdLookupDirent().

◆ Dirent

◆ DirentFlags

Dirent DirentFlags = CdRawDirentFlags( IrpContext, RawDirent )

Definition at line 477 of file dirsup.c.

Referenced by main().

◆ DirentLength

Dirent DirentLength = RawDirent->DirLen

Definition at line 450 of file dirsup.c.

Referenced by main().

◆ DirentOffset

◆ do

do
Initial value:
{
Dirent = &FileContext->InitialDirent->Dirent

Definition at line 1173 of file dirsup.c.

◆ ExtentType

Dirent ExtentType = Form1Data

Definition at line 520 of file dirsup.c.

Referenced by CdCheckForXAExtent(), CdLookupLastFileDirent(), and main().

◆ Fcb

◆ FileContext

◆ FileName

Dirent FileName = (PCHAR)RawDirent->FileId

Definition at line 507 of file dirsup.c.

◆ FileNameLen

Dirent FileNameLen = RawDirent->FileIdLen

Definition at line 506 of file dirsup.c.

Referenced by FatXSearchDirectoryBufferForFile(), main(), and VfatCreateFile().

◆ FileUnitSize

Dirent FileUnitSize
Initial value:
=
Dirent->InterleaveGapSize = 0

Definition at line 484 of file dirsup.c.

Referenced by main().

◆ Found

return Found

Definition at line 1270 of file dirsup.c.

Referenced by _Requires_lock_held_(), _Success_(), AcpiNsGetDeviceCallback(), AddrSearchNext(), BlockIoEfiGetDeviceInformation(), CcpFindBcb(), CdEnumerateIndex(), CdFindDirectory(), CdInitializeEnumeration(), cff_parser_run(), ChanMgrGetChannelByName(), CheckForCurrentHostname(), cid_parser_new(), CmpFindSubKeyByName(), CmpGetNameControlBlock(), CmSetValueKey(), DeviceTableCompare(), DGRemoveIRP(), FileTableCompareWithSameAttributes(), FileTableCompareWithSubsetAttributes(), CHString::Find(), FindAttribute(), FindCheckItemByIndex(), FindCheckItemIndexByAccessMask(), FindExpectedFile(), FindFile(), DriveVolume::FindFreeRange(), FindLFNorSFN_U(), CHString::FindOneOf(), FindSymbolicLinkEntry(), FsRtlCheckLockForReadAccess(), FsRtlCheckLockForWriteAccess(), FsRtlFastCheckLockForRead(), FsRtlFastCheckLockForWrite(), GetFontPenalty(), GetLongPathNameW(), GetNextDosSesId(), GetShortPathNameW(), gray_record_cell(), HidParser_AddMainItem(), HidParser_UpdateCurrentCollectionReport(), if(), InterfacePciDevicePresent(), InterfacePciDevicePresentEx(), IsBatteryAlreadyOnList(), KdbSymInit(), KsFilterFactoryUpdateCacheData(), KspValidateConnectRequest(), LookupSidCache(), LsarEnumerateAccountsWithUserRight(), CDeviceManager::MainWndMenuHint(), MainWndMenuHint(), MiQueryMemoryBasicInformation(), MmGetSystemRoutineAddress(), MountMgrVolumeMountPointCreated(), NdisOpenAdapter(), NetGroupSetUsers(), NSP_GetServiceByNameHeapAllocW(), pfr_face_get_kerning(), ProcessRelocations(), QueryDosDeviceW(), CCabinet::ReadString(), RouterRemoveRoute(), RtlFindCharInUnicodeString(), RtlpDphRemoveFromAvailableList(), RxIsMemberOfTopLevelIrpAllocatedContextsList(), SamrLookupDomainInSamServer(), SpiCreatePortConfig(), SpQueryDeviceCallout(), SRomFindMasterAdapter(), START_TEST(), SubstituteFontRecurse(), T1_Get_Private_Dict(), T1_Set_MM_Design(), TCPAbortListenForSocket(), TCPRemoveIRP(), test_tcp(), test_udp(), tt_face_get_kerning(), UDFLoadPartDesc(), UDFVerifyPartDesc(), USBAudioSelectAudioStreamingInterface(), USBD_ParseConfigurationDescriptorEx(), and VideoPortScanRom().

◆ IgnoreCase

Definition at line 1112 of file dirsup.c.

Referenced by _Success_(), CdFindDirectory(), CdUpdateDirentName(), and if().

◆ Name

Definition at line 1111 of file dirsup.c.

◆ return

◆ ShortNameDirentOffset

_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG ShortNameDirentOffset

Definition at line 1113 of file dirsup.c.

Referenced by _Success_().

◆ StartingOffset

Dirent StartingOffset = RawDirent->XarLen

Definition at line 459 of file dirsup.c.

◆ SystemUseOffset

Dirent SystemUseOffset = 0

Definition at line 521 of file dirsup.c.

Referenced by main().

◆ ThisShortNameDirentOffset

ThisShortNameDirentOffset = Dirent->DirentOffset >> SHORT_NAME_SHIFT

Definition at line 1152 of file dirsup.c.

◆ XAAttributes

Dirent XAAttributes = 0

Definition at line 518 of file dirsup.c.

Referenced by main().

◆ XAFileNumber

Dirent XAFileNumber = 0

Definition at line 519 of file dirsup.c.

Referenced by main().