21#pragma warning( disable: 4127 )
23#pragma warning( push )
24#pragma warning( disable: 4201 )
25#pragma warning( disable: 4214 )
38#define INLINE __inline
46#ifdef CDFS_TELEMETRY_DATA
49#include <TraceLoggingProvider.h>
50#include <telemetry\MicrosoftTelemetry.h>
60#undef MdlMappingNoExecute
61#define MdlMappingNoExecute 0
62#define NonPagedPoolNx NonPagedPool
63#define NonPagedPoolNxCacheAligned NonPagedPoolCacheAligned
70#define Int64ShraMod32(a, b) ((LONGLONG)(a) >> (b))
74#define Min(a, b) ((a) < (b) ? (a) : (b))
78#define Max(a, b) ((a) > (b) ? (a) : (b))
86#define TAG_CDROM_TOC 'ctdC'
87#define TAG_DIRENT_NAME 'nddC'
88#define TAG_ENUM_EXPRESSION 'eedC'
89#define TAG_FCB_DATA 'dfdC'
90#define TAG_FCB_INDEX 'ifdC'
91#define TAG_FCB_NONPAGED 'nfdC'
92#define TAG_FCB_TABLE 'tfdC'
93#define TAG_FILE_NAME 'nFdC'
94#define TAG_GEN_SHORT_NAME 'sgdC'
95#define TAG_IO_BUFFER 'fbdC'
96#define TAG_IO_CONTEXT 'oidC'
97#define TAG_IRP_CONTEXT 'cidC'
98#define TAG_IRP_CONTEXT_LITE 'lidC'
99#define TAG_MCB_ARRAY 'amdC'
100#define TAG_PATH_ENTRY_NAME 'nPdC'
101#define TAG_PREFIX_ENTRY 'epdC'
102#define TAG_PREFIX_NAME 'npdC'
103#define TAG_SPANNING_PATH_TABLE 'psdC'
104#define TAG_UPCASE_NAME 'nudC'
105#define TAG_VOL_DESC 'dvdC'
106#define TAG_VPB 'pvdC'
114#undef FsRtlAllocatePool
115#undef FsRtlAllocatePoolWithQuota
116#define FsRtlAllocatePool(a,b) FsRtlAllocatePoolWithTag(a,b,'sfdC')
117#define FsRtlAllocatePoolWithQuota(a,b) FsRtlAllocatePoolWithQuotaTag(a,b,'sfdC')
135#define CdIllegalFcbAccess(IC,T,DA) ( \
136 BooleanFlagOn( (DA), \
137 ((T) != UserVolumeOpen ? \
138 (FILE_WRITE_ATTRIBUTES | \
142 FILE_ADD_SUBDIRECTORY | \
143 FILE_APPEND_DATA) : 0) | \
144 FILE_DELETE_CHILD | \
269#define CdUnpinData(IC,B) \
270 if (*(B) != NULL) { CcUnpinData( *(B) ); *(B) = NULL; }
383#define CdMapUserBuffer(IC, UB) { \
384 *(UB) = (PVOID) ( ((IC)->Irp->MdlAddress == NULL) ? \
385 (IC)->Irp->UserBuffer : \
386 (MmGetSystemAddressForMdlSafe( (IC)->Irp->MdlAddress, NormalPagePriority | MdlMappingNoExecute))); \
387 if (NULL == *(UB)) { \
388 CdRaiseStatus( (IC), STATUS_INSUFFICIENT_RESOURCES); \
393#define CdLockUserBuffer(IC,BL,OP) { \
394 if ((IC)->Irp->MdlAddress == NULL) { \
395 (VOID) CdCreateUserMdl( (IC), (BL), TRUE, (OP) ); \
422CdUpdateDirentFromRawDirent (
457CdFindFileByShortName (
527#define CdInitializeFileContext(IC,FC) { \
528 RtlZeroMemory( FC, sizeof( FILE_ENUM_CONTEXT )); \
529 (FC)->PriorDirent = &(FC)->Dirents[0]; \
530 (FC)->InitialDirent = &(FC)->Dirents[1]; \
531 (FC)->CurrentDirent = &(FC)->Dirents[2]; \
532 (FC)->ShortName.FileName.MaximumLength = BYTE_COUNT_8_DOT_3; \
533 (FC)->ShortName.FileName.Buffer = (FC)->ShortNameBuffer; \
536#define CdInitializeDirent(IC,D) \
537 RtlZeroMemory( D, sizeof( DIRENT ))
539#define CdInitializeDirContext(IC,DC) \
540 RtlZeroMemory( DC, sizeof( DIRENT_ENUM_CONTEXT ))
542#define CdCleanupDirent(IC,D) { \
543 if (FlagOn( (D)->Flags, DIRENT_FLAG_ALLOC_BUFFER )) { \
544 CdFreePool( &(D)->CdFileName.FileName.Buffer ); \
548#define CdCleanupDirContext(IC,DC) \
549 CdUnpinData( (IC), &(DC)->Bcb )
551#define CdLookupInitialFileDirent(IC,F,FC,DO) \
552 CdLookupDirent( IC, \
555 &(FC)->InitialDirent->DirContext ); \
556 CdUpdateDirentFromRawDirent( IC, \
558 &(FC)->InitialDirent->DirContext, \
559 &(FC)->InitialDirent->Dirent )
620CdConvertNameToCdName (
698CdLockVolumeInternal (
763#define CdInitializeCompoundPathEntry(IC,CP) \
764 RtlZeroMemory( CP, sizeof( COMPOUND_PATH_ENTRY ))
766#define CdCleanupCompoundPathEntry(IC,CP) { \
767 CdUnpinData( (IC), &(CP)->PathContext.Bcb ); \
768 if ((CP)->PathContext.AllocatedData) { \
769 CdFreePool( &(CP)->PathContext.Data ); \
771 if (FlagOn( (CP)->PathEntry.Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER )) { \
772 CdFreePool( &(CP)->PathEntry.CdDirName.FileName.Buffer ); \
961#define CdAcquireCacheForRead( IC) \
962 ExAcquireResourceSharedLite( &(IC)->Vcb->SectorCacheResource, TRUE)
964#define CdAcquireCacheForUpdate( IC) \
965 ExAcquireResourceExclusiveLite( &(IC)->Vcb->SectorCacheResource, TRUE)
967#define CdReleaseCache( IC) \
968 ExReleaseResourceLite( &(IC)->Vcb->SectorCacheResource);
970#define CdConvertCacheToShared( IC) \
971 ExConvertExclusiveToSharedLite( &(IC)->Vcb->SectorCacheResource);
973#define CdAcquireCdData(IC) \
974 ExAcquireResourceExclusiveLite( &CdData.DataResource, TRUE )
976#define CdReleaseCdData(IC) \
977 ExReleaseResourceLite( &CdData.DataResource )
979#define CdAcquireVcbExclusive(IC,V,I) \
980 CdAcquireResource( (IC), &(V)->VcbResource, (I), AcquireExclusive )
982#define CdAcquireVcbShared(IC,V,I) \
983 CdAcquireResource( (IC), &(V)->VcbResource, (I), AcquireShared )
985#define CdReleaseVcb(IC,V) \
986 ExReleaseResourceLite( &(V)->VcbResource )
988#define CdAcquireAllFiles(IC,V) \
989 CdAcquireResource( (IC), &(V)->FileResource, FALSE, AcquireExclusive )
991#define CdReleaseAllFiles(IC,V) \
992 ExReleaseResourceLite( &(V)->FileResource )
994#define CdAcquireFileExclusive(IC,F) \
995 CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireExclusive )
997#define CdAcquireFileShared(IC,F) \
998 CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireShared )
1000#define CdAcquireFileSharedStarveExclusive(IC,F) \
1001 CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireSharedStarveExclusive )
1003#define CdReleaseFile(IC,F) \
1004 ExReleaseResourceLite( (F)->Resource )
1006#define CdAcquireFcbExclusive(IC,F,I) \
1007 CdAcquireResource( (IC), &(F)->FcbNonpaged->FcbResource, (I), AcquireExclusive )
1009#define CdAcquireFcbShared(IC,F,I) \
1010 CdAcquireResource( (IC), &(F)->FcbNonpaged->FcbResource, (I), AcquireShared )
1012#define CdReleaseFcb(IC,F) \
1013 ExReleaseResourceLite( &(F)->FcbNonpaged->FcbResource )
1015#define CdLockCdData() \
1016 ExAcquireFastMutex( &CdData.CdDataMutex ); \
1017 CdData.CdDataLockThread = PsGetCurrentThread()
1019#define CdUnlockCdData() \
1020 CdData.CdDataLockThread = NULL; \
1021 ExReleaseFastMutex( &CdData.CdDataMutex )
1023#define CdLockVcb(IC,V) \
1024 ExAcquireFastMutex( &(V)->VcbMutex ); \
1025 NT_ASSERT( NULL == (V)->VcbLockThread); \
1026 (V)->VcbLockThread = PsGetCurrentThread()
1028#define CdUnlockVcb(IC,V) \
1029 NT_ASSERT( NULL != (V)->VcbLockThread); \
1030 (V)->VcbLockThread = NULL; \
1031 ExReleaseFastMutex( &(V)->VcbMutex )
1033#if defined(_PREFAST_)
1044#define CdLockFcb(IC,F) { \
1045 PVOID _CurrentThread = PsGetCurrentThread(); \
1046 if (_CurrentThread != (F)->FcbLockThread) { \
1047 ExAcquireFastMutex( &(F)->FcbNonpaged->FcbMutex ); \
1048 NT_ASSERT( (F)->FcbLockCount == 0 ); \
1049 _Analysis_assume_( (F)->FcbLockCount == 0 ); \
1050 (F)->FcbLockThread = _CurrentThread; \
1054 _Analysis_assume_lock_held_( (F)->FcbNonpaged->FcbMutex ); \
1055 _Analysis_assume_(FALSE != DummySaveIrql(&(F)->FcbNonpaged->FcbMutex)); \
1057 (F)->FcbLockCount += 1; \
1060#define CdUnlockFcb(IC,F) { \
1061 (F)->FcbLockCount -= 1; \
1062 if ((F)->FcbLockCount == 0) { \
1063 (F)->FcbLockThread = NULL; \
1064 ExReleaseFastMutex( &(F)->FcbNonpaged->FcbMutex ); \
1068 _Analysis_assume_lock_not_held_( (F)->FcbNonpaged->FcbMutex ); \
1069 _Analysis_assume_(FALSE != DummyRestoreIrql(&(F)->FcbNonpaged->FcbMutex)); \
1079#if (NTDDI_VERSION >= NTDDI_WIN8)
1081#define CdGetFcbOplock(F) &(F)->Header.Oplock
1085#define CdGetFcbOplock(F) &(F)->Oplock
1122CdFilterCallbackAcquireForCreateSection (
1131CdReleaseForCreateSection (
1249#define CdCreateIrpContextLite(IC) \
1250 ExAllocatePoolWithTag( CdNonPagedPool, sizeof( IRP_CONTEXT_LITE ), TAG_IRP_CONTEXT_LITE )
1252#define CdFreeIrpContextLite(ICL) \
1253 CdFreePool( &(ICL) )
1257CdTeardownStructures (
1305#define CdIncrementCleanupCounts(IC,F) { \
1306 ASSERT_LOCKED_VCB( (F)->Vcb ); \
1307 (F)->FcbCleanup += 1; \
1308 (F)->Vcb->VcbCleanup += 1; \
1311#define CdDecrementCleanupCounts(IC,F) { \
1312 ASSERT_LOCKED_VCB( (F)->Vcb ); \
1313 (F)->FcbCleanup -= 1; \
1314 (F)->Vcb->VcbCleanup -= 1; \
1317#define CdIncrementReferenceCounts(IC,F,C,UC) { \
1318 ASSERT_LOCKED_VCB( (F)->Vcb ); \
1319 (F)->FcbReference += (C); \
1320 (F)->FcbUserReference += (UC); \
1321 (F)->Vcb->VcbReference += (C); \
1322 (F)->Vcb->VcbUserReference += (UC); \
1325#define CdDecrementReferenceCounts(IC,F,C,UC) { \
1326 ASSERT_LOCKED_VCB( (F)->Vcb ); \
1327 (F)->FcbReference -= (C); \
1328 (F)->FcbUserReference -= (UC); \
1329 (F)->Vcb->VcbReference -= (C); \
1330 (F)->Vcb->VcbUserReference -= (UC); \
1344#define CdAllocateIoContext() \
1345 FsRtlAllocatePoolWithTag( CdNonPagedPool, \
1346 sizeof( CD_IO_CONTEXT ), \
1349#define CdFreeIoContext(IO) CdFreePool( (PVOID) &(IO) )
1380#define CdPagedPool PagedPool
1381#define CdNonPagedPool NonPagedPoolNx
1382#define CdNonPagedPoolCacheAligned NonPagedPoolNxCacheAligned
1448#define CdUpdateMediaChangeCount( V, C) (V)->MediaChangeCount = (C)
1449#define CdUpdateVcbCondition( V, C) (V)->VcbCondition = (C)
1451#define CdMarkRealDevForVerify( DO) SetFlag( (DO)->Flags, DO_VERIFY_VOLUME)
1453#define CdMarkRealDevVerifyOk( DO) ClearFlag( (DO)->Flags, DO_VERIFY_VOLUME)
1456#define CdRealDevNeedsVerify( DO) BooleanFlagOn( (DO)->Flags, DO_VERIFY_VOLUME)
1466#define CdIsRawDevice(IC,S) ( \
1467 ((S) == STATUS_DEVICE_NOT_READY) || \
1468 ((S) == STATUS_NO_MEDIA_IN_DEVICE) \
1545#define Add2Ptr(PTR,INC,CAST) ((CAST)((PUCHAR)(PTR) + (INC)))
1547#define PtrOffset(BASE,OFFSET) ((ULONG)((ULONG_PTR)(OFFSET) - (ULONG_PTR)(BASE)))
1554#define WordAlign(Ptr) ( \
1555 ((((ULONG)(Ptr)) + 1) & 0xfffffffe) \
1563#define LongAlign(Ptr) ( \
1564 ((((ULONG)(Ptr)) + 3) & 0xfffffffc) \
1572#define QuadAlign(Ptr) ( \
1573 ((((ULONG)(Ptr)) + 7) & 0xfffffff8) \
1580#define SectorAlign(L) ( \
1581 ((((ULONG)(L)) + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1)) \
1584#define LlSectorAlign(L) ( \
1585 ((((LONGLONG)(L)) + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1)) \
1588#define SectorTruncate(L) ( \
1589 ((ULONG)(L)) & ~(SECTOR_SIZE - 1) \
1592#define LlSectorTruncate(L) ( \
1593 ((LONGLONG)(L)) & ~(SECTOR_SIZE - 1) \
1596#define BytesFromSectors(L) ( \
1597 ((ULONG) (L)) << SECTOR_SHIFT \
1600#define SectorsFromBytes(L) ( \
1601 ((ULONG) (L)) >> SECTOR_SHIFT \
1614#define LlBytesFromSectors(L) ( \
1615 Int64ShllMod32( (LONGLONG)(L), SECTOR_SHIFT ) \
1618#define LlSectorsFromBytes(L) ( \
1619 Int64ShraMod32( (LONGLONG)(L), SECTOR_SHIFT ) \
1622#define SectorOffset(L) ( \
1623 ((ULONG)(ULONG_PTR) (L)) & SECTOR_MASK \
1626#define SectorBlockOffset(V,LB) ( \
1627 ((ULONG) (LB)) & ((V)->BlocksPerSector - 1) \
1630#define BytesFromBlocks(V,B) ( \
1631 (ULONG) (B) << (V)->BlockToByteShift \
1634#define LlBytesFromBlocks(V,B) ( \
1635 Int64ShllMod32( (LONGLONG) (B), (V)->BlockToByteShift ) \
1638#define BlockAlign(V,L) ( \
1639 ((ULONG)(L) + (V)->BlockMask) & (V)->BlockInverseMask \
1646#define LlBlockAlign(V,L) ( \
1647 ((LONGLONG)(L) + (V)->BlockMask) & (LONGLONG)((LONG)(V)->BlockInverseMask) \
1650#define BlockOffset(V,L) ( \
1651 ((ULONG) (L)) & (V)->BlockMask \
1654#define RawSectorAlign( B) ((((B)+(RAW_SECTOR_SIZE - 1)) / RAW_SECTOR_SIZE) * RAW_SECTOR_SIZE)
1685#define CopyUchar1(Dst,Src) { \
1686 *((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
1693#define CopyUchar2(Dst,Src) { \
1694 *((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
1701#define CopyUchar4(Dst,Src) { \
1702 *((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
1710#define CopyUshort2(Dst,Src) { \
1711 *((USHORT2 *)(Dst)) = *((UNALIGNED USHORT2 *)(Src));\
1719#define SwapCopyUchar4(Dst,Src) { \
1720 *((UNALIGNED UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src) + 3); \
1721 *((UNALIGNED UCHAR1 *)(Dst) + 1) = *((UNALIGNED UCHAR1 *)(Src) + 2); \
1722 *((UNALIGNED UCHAR1 *)(Dst) + 2) = *((UNALIGNED UCHAR1 *)(Src) + 1); \
1723 *((UNALIGNED UCHAR1 *)(Dst) + 3) = *((UNALIGNED UCHAR1 *)(Src)); \
1798#define AssertVerifyDevice(C, S) \
1799 NT_ASSERT( (C) == NULL || \
1800 FlagOn( (C)->Flags, IRP_CONTEXT_FLAG_IN_FSP ) || \
1801 !((S) == STATUS_VERIFY_REQUIRED && \
1802 IoGetDeviceToVerify( PsGetCurrentThread() ) == NULL ));
1804#define AssertVerifyDeviceIrp(I) \
1805 NT_ASSERT( (I) == NULL || \
1806 !(((I)->IoStatus.Status) == STATUS_VERIFY_REQUIRED && \
1807 ((I)->Tail.Overlay.Thread == NULL || \
1808 IoGetDeviceToVerify( (I)->Tail.Overlay.Thread ) == NULL )));
1810#define AssertVerifyDevice(C, S)
1811#define AssertVerifyDeviceIrp(I)
1843 if (NormalizeStatus) {
1849 IrpContext->ExceptionStatus =
Status;
1852 IrpContext->RaisedAtLineFile = (Fileid << 16) |
Line;
1859#define CdRaiseStatus( IC, S) CdRaiseStatusEx( (IC), (S), FALSE, BugCheckFileId, __LINE__);
1860#define CdNormalizeAndRaiseStatus( IC, S) CdRaiseStatusEx( (IC), (S), TRUE, BugCheckFileId, __LINE__);
1983#define CdRestoreThreadContext(IC) \
1984 (IC)->ThreadContext->Cdfs = 0; \
1985 IoSetTopLevelIrp( (IC)->ThreadContext->SavedTopLevelIrp ); \
1986 (IC)->ThreadContext = NULL
2001#define CanFsdWait(I) IoIsOperationSynchronous(I)
2015#define CdIsFastIoPossible(F) ((BOOLEAN) \
2016 ((((F)->Vcb->VcbCondition != VcbMounted ) || \
2017 !FsRtlOplockIsFastIoPossible( CdGetFcbOplock(F) )) ? \
2019 FastIoIsNotPossible : \
2021 ((((F)->FileLock != NULL) && FsRtlAreThereCurrentFileLocks( (F)->FileLock )) ? \
2023 FastIoIsQuestionable : \
2025 FastIoIsPossible)) \
2096CdCommonQueryVolInfo (
2179#define try_return(S) { S; goto try_exit; }
2180#define try_leave(S) { S; leave; }
2182#define try_return(S) { S; goto try_exit; }
2183#define try_leave(S) { S; _SEH2_LEAVE; }
2190#define CdFreePool(x) _CdFreePool((PVOID*)(x))
2206#ifdef CDFS_TELEMETRY_DATA
2218TRACELOGGING_DECLARE_PROVIDER( CdTelemetryProvider );
2221CdInitializeTelemetry (
2240#define CDFS_TELEMETRY_STACK_THRESHOLD_DEFAULT 512
2241#define CDFS_TELEMETRY_STACK_THRESHOLD_LARGE 2048
2265 ASSERT( IoGetRemainingStackSize() >= StackSpaceNeeded );
2267 if (CdTelemetryProvider->LevelPlus1 <= 5) {
2276 if (IoGetRemainingStackSize() < StackSpaceNeeded) {
2291#define CdTelemetryMountSafe( VolumeGuid, Status, Vcb ) \
2292 if (CdTelemetryGuard( CDFS_TELEMETRY_STACK_THRESHOLD_LARGE )) { \
2293 CdTelemetryMount( VolumeGuid, Status, Vcb ); \
2297#define CDFS_TELEMETRY_PERIODIC_INTERVAL CdTelemetryData.PeriodicInterval
2299#define CDFS_TELEMETRY_PERIODIC_INTERVAL INTERVAL_ONE_DAY
2312#define CdTelemetryMountSafe( ... ) NOTHING
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define InterlockedIncrement
#define BYTE_COUNT_8_DOT_3
FAST_IO_QUERY_NETWORK_OPEN_INFO CdFastQueryNetworkInfo
_In_ PFCB _In_ LONGLONG _Out_ PLONGLONG DiskOffset
VOID CdUpdatePathEntryName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PPATH_ENTRY PathEntry, _In_ BOOLEAN IgnoreCase)
_In_ PFCB _In_ LONGLONG FileOffset
static INLINE VOID CdVerifyOrCreateDirStreamFile(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
enum _TYPE_OF_ACQUIRE * PTYPE_OF_ACQUIRE
VOID CdInitializeStackIrpContext(_Out_ PIRP_CONTEXT IrpContext, _In_ PIRP_CONTEXT_LITE IrpContextLite)
VOID CdInitializeFcbFromFileContext(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ PFCB ParentFcb, _In_ PFILE_ENUM_CONTEXT FileContext)
VOID CdCleanupIrpContext(_In_ PIRP_CONTEXT IrpContext, _In_ BOOLEAN Post)
BOOLEAN CdMarkDevForVerifyIfVcbMounted(_Inout_ PVCB Vcb)
BOOLEAN CdLookupNextPathEntry(_In_ PIRP_CONTEXT IrpContext, _Inout_ PPATH_ENUM_CONTEXT PathContext, _Inout_ PPATH_ENTRY PathEntry)
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
PCCB CdCreateCcb(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG Flags)
VOID NTAPI CdNoopRelease(_In_ PVOID Fcb)
VOID CdFspClose(_In_opt_ PVCB Vcb)
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
VOID CdTruncateAllocation(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ LONGLONG StartingFileOffset)
FAST_IO_QUERY_STANDARD_INFO CdFastQueryStdInfo
_Inout_ PVCB _In_ BOOLEAN Force
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PCOMPOUND_PATH_ENTRY CompoundPathEntry
FSRTL_COMPARISON_RESULT CdFullCompareNames(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING NameA, _In_ PUNICODE_STRING NameB)
VOID CdConvertBigToLittleEndian(_In_ PIRP_CONTEXT IrpContext, _In_reads_bytes_(ByteCount) PCHAR BigEndian, _In_ ULONG ByteCount, _Out_writes_bytes_(ByteCount) PCHAR LittleEndian)
NTSTATUS CdHijackIrpAndFlushDevice(_In_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp, _In_ PDEVICE_OBJECT TargetDeviceObject)
VOID CdDissectName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PUNICODE_STRING RemainingName, _Out_ PUNICODE_STRING FinalName)
INLINE DECLSPEC_NORETURN VOID CdRaiseStatusEx(_In_ PIRP_CONTEXT IrpContext, _In_ NTSTATUS Status, _In_ BOOLEAN NormalizeStatus, _In_ ULONG Fileid, _In_ ULONG Line)
VOID CdCreateInternalStream(_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _Inout_ PFCB Fcb, _In_ PUNICODE_STRING Name)
FAST_IO_CHECK_IF_POSSIBLE CdFastIoCheckIfPossible
static INLINE BOOLEAN CdOperationIsDasdOpen(_In_ PIRP_CONTEXT IrpContext)
VOID CdDeleteFileLock(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFILE_LOCK FileLock)
enum _TYPE_OF_ACQUIRE TYPE_OF_ACQUIRE
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT _Out_ PCD_NAME * MatchingName
VOID CdAddAllocationFromDirent(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ ULONG McbEntryOffset, _In_ LONGLONG StartingFileOffset, _In_ PDIRENT Dirent)
VOID CdVerifyVcb(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb)
VOID CdLookupLastFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PFILE_ENUM_CONTEXT FileContext)
_Inout_ PFCB _In_ BOOLEAN RaiseOnError
NTSTATUS CdUnlockVolumeInternal(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb, _In_opt_ PFILE_OBJECT FileObject)
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
VOID CdDeleteCcb(_In_ PIRP_CONTEXT IrpContext, _In_ __drv_freesMem(Pool) PCCB Ccb)
FAST_IO_UNLOCK_SINGLE CdFastUnlockSingle
_In_ PFCB _In_ PCD_NAME DirName
_Inout_ PFCB _Inout_ PUNICODE_STRING RemainingName
VOID CdUpcaseName(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME Name, _Inout_ PCD_NAME UpcaseName)
ULONG CdSerial32(_In_reads_bytes_(ByteCount) PCHAR Buffer, _In_ ULONG ByteCount)
PFCB CdLookupFcbTable(_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _In_ FILE_ID FileId)
TYPE_OF_OPEN CdFastDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Out_ PFCB *Fcb)
_Inout_ PFCB _Out_ PBOOLEAN RemovedStartingFcb
VOID CdUpdateDirentName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT FileContext
LONG CdExceptionFilter(_Inout_ PIRP_CONTEXT IrpContext, _In_ PEXCEPTION_POINTERS ExceptionPointer)
_In_ PVCB _In_ BOOLEAN DismountUnderway
@ AcquireSharedStarveExclusive
VOID CdInitializeVcb(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb, _In_ __drv_aliasesMem PDEVICE_OBJECT TargetDeviceObject, _In_ __drv_aliasesMem PVPB Vpb, _In_ __drv_aliasesMem PCDROM_TOC_LARGE CdromToc, _In_ ULONG TocLength, _In_ ULONG TocTrackCount, _In_ ULONG TocDiskFlags, _In_ ULONG BlockFactor, _In_ ULONG MediaChangeCount)
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)
union _USHORT2 * PUSHORT2
BOOLEAN CdIsNameInExpression(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME CurrentName, _In_ PCD_NAME SearchExpression, _In_ ULONG WildcardFlags, _In_ BOOLEAN CheckVersion)
_In_ PFCB _In_ LONGLONG StartingOffset
VOID CdInitializeFcbFromPathEntry(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_opt_ PFCB ParentFcb, _In_ PPATH_ENTRY PathEntry)
VOID CdDeleteInternalStream(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb)
FAST_IO_QUERY_BASIC_INFO CdFastQueryBasicInfo
VOID CdLbnToMmSsFf(_In_ ULONG Blocks, _Out_writes_(3) PUCHAR Msf)
VOID CdDeleteVcb(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb)
BOOLEAN CdReadSectors(_In_ PIRP_CONTEXT IrpContext, _In_ LONGLONG StartingOffset, _In_ ULONG ByteCount, _In_ BOOLEAN ReturnError, _Out_writes_bytes_(ByteCount) PVOID Buffer, _In_ PDEVICE_OBJECT TargetDeviceObject)
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)
BOOLEAN CdLookupNextInitialFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Inout_ PFILE_ENUM_CONTEXT FileContext)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
NTSTATUS CdCompleteMdl(_In_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
NTSTATUS CdCreateUserMdl(_In_ PIRP_CONTEXT IrpContext, _In_ ULONG BufferLength, _In_ BOOLEAN RaiseOnError, _In_ LOCK_OPERATION Operation)
_Inout_ PIRP _In_ PDEVICE_OBJECT DeviceToVerify
BOOLEAN CdVerifyFcbOperation(_In_opt_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
NTSTATUS CdPerformDevIoCtrlEx(_In_ PIRP_CONTEXT IrpContext, _In_ ULONG IoControlCode, _In_ PDEVICE_OBJECT Device, _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _In_ BOOLEAN InternalDeviceIoControl, _In_ BOOLEAN OverrideVerify, _Out_opt_ PIO_STATUS_BLOCK Iosb)
VOID CdLookupDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG DirentOffset, _Out_ PDIRENT_ENUM_CONTEXT DirContext)
WORKER_THREAD_ROUTINE CdFspDispatch
static INLINE ULONG SectorsFromLlBytes(ULONGLONG Bytes)
BOOLEAN CdIsLegalName(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING FileName)
PFCB CdCreateFcb(_In_ PIRP_CONTEXT IrpContext, _In_ FILE_ID FileId, _In_ NODE_TYPE_CODE NodeTypeCode, _Out_opt_ PBOOLEAN FcbExisted)
NTSTATUS CdProcessToc(_In_ PIRP_CONTEXT IrpContext, _In_ PDEVICE_OBJECT TargetDeviceObject, _In_ PCDROM_TOC_LARGE CdromToc, _Inout_ PULONG Length, _Out_ PULONG TrackCount, _Inout_ PULONG DiskFlags)
NTSTATUS CdCommonLockControl(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE _In_ BOOLEAN IgnoreWait
VOID CdSetThreadContext(_Inout_ PIRP_CONTEXT IrpContext, _In_ PTHREAD_CONTEXT ThreadContext)
FAST_IO_UNLOCK_ALL CdFastUnlockAll
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN IgnoreCase
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
enum _TYPE_OF_OPEN TYPE_OF_OPEN
NTSTATUS FASTCALL CdPerformDevIoCtrl(_In_ PIRP_CONTEXT IrpContext, _In_ ULONG IoControlCode, _In_ PDEVICE_OBJECT Device, _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _In_ BOOLEAN InternalDeviceIoControl, _In_ BOOLEAN OverrideVerify, _Out_opt_ PIO_STATUS_BLOCK Iosb)
_Inout_ PFCB * CurrentFcb
ULONG CdShortNameDirentOffset(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING Name)
TYPE_OF_OPEN * PTYPE_OF_OPEN
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG ShortNameDirentOffset
NTSTATUS CdCommonDevControl(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
FAST_IO_UNLOCK_ALL_BY_KEY CdFastUnlockAllByKey
VOID CdInsertPrefix(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ PCD_NAME Name, _In_ BOOLEAN IgnoreCase, _In_ BOOLEAN ShortNameMatch, _Inout_ PFCB ParentFcb)
_Ret_valid_ PIRP_CONTEXT CdCreateIrpContext(_In_ PIRP Irp, _In_ BOOLEAN Wait)
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
VOID CdAddInitialAllocation(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ ULONG StartingBlock, _In_ LONGLONG DataLength)
VOID CdLookupPathEntry(_In_ PIRP_CONTEXT IrpContext, _In_ ULONG PathEntryOffset, _In_ ULONG Ordinal, _In_ BOOLEAN VerifyBounds, _Inout_ PCOMPOUND_PATH_ENTRY CompoundPathEntry)
BOOLEAN NTAPI CdNoopAcquire(_In_ PVOID Fcb, _In_ BOOLEAN Wait)
VOID CdCleanupFileContext(_In_ PIRP_CONTEXT IrpContext, _In_ PFILE_ENUM_CONTEXT FileContext)
PFCB CdGetNextFcb(_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _In_ PVOID *RestartKey)
_In_ PFCB _In_ LONGLONG _Out_ PLONGLONG _Out_ PULONG ByteCount
BOOLEAN CdIs8dot3Name(_In_ PIRP_CONTEXT IrpContext, _In_ UNICODE_STRING FileName)
static INLINE VOID _CdFreePool(_Inout_ _At_(*Pool, __drv_freesMem(Mem) _Post_null_) PVOID *Pool)
VOID CdRemovePrefix(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb)
VOID CdUpdateVcbFromVolDescriptor(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb, _In_reads_bytes_opt_(SECTOR_SIZE) PCHAR RawIsoVd)
_Acquires_shared_lock_ Fcb BOOLEAN NTAPI CdAcquireForCache(_Inout_ PFCB Fcb, _In_ BOOLEAN Wait)
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
#define _Requires_lock_held_(lock)
#define _Acquires_exclusive_lock_(lock)
#define _Acquires_shared_lock_(lock)
#define _Releases_lock_(lock)
#define CDFS_NTC_FCB_PATH_TABLE
#define CDFS_NTC_FCB_INDEX
#define CDFS_NTC_FCB_DATA
_In_ PIO_STACK_LOCATION IrpSp
#define __drv_freesMem(kind)
#define __drv_dispatchType(x)
#define _IRQL_requires_max_(irql)
#define _IRQL_saves_global_(kind, param)
#define _IRQL_restores_global_(kind, param)
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
enum _FSRTL_COMPARISON_RESULT FSRTL_COMPARISON_RESULT
#define _Function_class_(x)
#define _In_reads_bytes_(size)
#define _Out_writes_bytes_(size)
#define _Out_writes_bytes_to_(size, count)
#define _Out_writes_(size)
#define _At_(target, annos)
#define _Inout_updates_bytes_(size)
#define _When_(expr, annos)
#define _In_reads_bytes_opt_(size)
#define _Post_satisfies_(cond)
#define _In_range_(lb, ub)
#define _Out_writes_bytes_opt_(size)
DRIVER_DISPATCH(nfs41_FsdDispatch)
#define DECLSPEC_NOINLINE
#define DECLSPEC_NORETURN
__GNU_EXTENSION typedef __int64 * PLONGLONG
_In_ ULONG _In_ ULONG _In_ ULONG Length
NTSTATUS NTAPI FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize, IN NTSTATUS NormalizedNtStatus)
#define STATUS_UNEXPECTED_IO_ERROR
#define IRP_MJ_DIRECTORY_CONTROL
#define IRP_MJ_DEVICE_CONTROL
#define IRP_MJ_QUERY_VOLUME_INFORMATION
#define IRP_MJ_LOCK_CONTROL
#define IRP_MJ_SET_INFORMATION
#define IRP_MJ_QUERY_INFORMATION
#define _Unreferenced_parameter_
PREFIX_ENTRY FileNamePrefix
#define FIELD_OFFSET(t, f)
_Must_inspect_result_ _In_ WDFDEVICE Device
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_In_ WDFDPC _In_ BOOLEAN Wait
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
_In_ WDFREQUEST _In_ size_t OutputBufferLength
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE _In_opt_ __drv_aliasesMem WDFCONTEXT CompletionContext
_Must_inspect_result_ _In_ ULONG Flags
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID _In_ ULONG _In_ BOOLEAN InternalDeviceIoControl
#define IRP_MJ_FILE_SYSTEM_CONTROL
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
enum _LOCK_OPERATION LOCK_OPERATION