ReactOS 0.4.15-dev-7788-g1ad9096
cdprocs.h File Reference
#include <ntifs.h>
#include <ntddcdrm.h>
#include <ntdddisk.h>
#include <ntddscsi.h>
#include "nodetype.h"
#include "cd.h"
#include "cdstruc.h"
#include "cddata.h"
Include dependency graph for cdprocs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  _UCHAR1
 
union  _UCHAR2
 
union  _UCHAR4
 
union  _USHORT2
 

Macros

#define INLINE   __inline
 
#define Min(a, b)   ((a) < (b) ? (a) : (b))
 
#define Max(a, b)   ((a) > (b) ? (a) : (b))
 
#define TAG_CCB   'ccdC'
 
#define TAG_CDROM_TOC   'ctdC'
 
#define TAG_DIRENT_NAME   'nddC'
 
#define TAG_ENUM_EXPRESSION   'eedC'
 
#define TAG_FCB_DATA   'dfdC'
 
#define TAG_FCB_INDEX   'ifdC'
 
#define TAG_FCB_NONPAGED   'nfdC'
 
#define TAG_FCB_TABLE   'tfdC'
 
#define TAG_FILE_NAME   'nFdC'
 
#define TAG_GEN_SHORT_NAME   'sgdC'
 
#define TAG_IO_BUFFER   'fbdC'
 
#define TAG_IO_CONTEXT   'oidC'
 
#define TAG_IRP_CONTEXT   'cidC'
 
#define TAG_IRP_CONTEXT_LITE   'lidC'
 
#define TAG_MCB_ARRAY   'amdC'
 
#define TAG_PATH_ENTRY_NAME   'nPdC'
 
#define TAG_PREFIX_ENTRY   'epdC'
 
#define TAG_PREFIX_NAME   'npdC'
 
#define TAG_SPANNING_PATH_TABLE   'psdC'
 
#define TAG_UPCASE_NAME   'nudC'
 
#define TAG_VOL_DESC   'dvdC'
 
#define TAG_VPB   'pvdC'
 
#define CdIllegalFcbAccess(IC, T, DA)
 
#define CdUnpinData(IC, B)    if (*(B) != NULL) { CcUnpinData( *(B) ); *(B) = NULL; }
 
#define CdMapUserBuffer(IC, UB)
 
#define CdLockUserBuffer(IC, BL, OP)
 
#define CdInitializeFileContext(IC, FC)
 
#define CdInitializeDirent(IC, D)    RtlZeroMemory( D, sizeof( DIRENT ))
 
#define CdInitializeDirContext(IC, DC)    RtlZeroMemory( DC, sizeof( DIRENT_ENUM_CONTEXT ))
 
#define CdCleanupDirent(IC, D)
 
#define CdCleanupDirContext(IC, DC)    CdUnpinData( (IC), &(DC)->Bcb )
 
#define CdLookupInitialFileDirent(IC, F, FC, DO)
 
#define CdInitializeCompoundPathEntry(IC, CP)    RtlZeroMemory( CP, sizeof( COMPOUND_PATH_ENTRY ))
 
#define CdCleanupCompoundPathEntry(IC, CP)
 
#define CdAcquireCacheForRead(IC)    ExAcquireResourceSharedLite( &(IC)->Vcb->SectorCacheResource, TRUE)
 
#define CdAcquireCacheForUpdate(IC)    ExAcquireResourceExclusiveLite( &(IC)->Vcb->SectorCacheResource, TRUE)
 
#define CdReleaseCache(IC)    ExReleaseResourceLite( &(IC)->Vcb->SectorCacheResource);
 
#define CdConvertCacheToShared(IC)    ExConvertExclusiveToSharedLite( &(IC)->Vcb->SectorCacheResource);
 
#define CdAcquireCdData(IC)    ExAcquireResourceExclusiveLite( &CdData.DataResource, TRUE )
 
#define CdReleaseCdData(IC)    ExReleaseResourceLite( &CdData.DataResource )
 
#define CdAcquireVcbExclusive(IC, V, I)    CdAcquireResource( (IC), &(V)->VcbResource, (I), AcquireExclusive )
 
#define CdAcquireVcbShared(IC, V, I)    CdAcquireResource( (IC), &(V)->VcbResource, (I), AcquireShared )
 
#define CdReleaseVcb(IC, V)    ExReleaseResourceLite( &(V)->VcbResource )
 
#define CdAcquireAllFiles(IC, V)    CdAcquireResource( (IC), &(V)->FileResource, FALSE, AcquireExclusive )
 
#define CdReleaseAllFiles(IC, V)    ExReleaseResourceLite( &(V)->FileResource )
 
#define CdAcquireFileExclusive(IC, F)    CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireExclusive )
 
#define CdAcquireFileShared(IC, F)    CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireShared )
 
#define CdAcquireFileSharedStarveExclusive(IC, F)    CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireSharedStarveExclusive )
 
#define CdReleaseFile(IC, F)    ExReleaseResourceLite( (F)->Resource )
 
#define CdAcquireFcbExclusive(IC, F, I)    CdAcquireResource( (IC), &(F)->FcbNonpaged->FcbResource, (I), AcquireExclusive )
 
#define CdAcquireFcbShared(IC, F, I)    CdAcquireResource( (IC), &(F)->FcbNonpaged->FcbResource, (I), AcquireShared )
 
#define CdReleaseFcb(IC, F)    ExReleaseResourceLite( &(F)->FcbNonpaged->FcbResource )
 
#define CdLockCdData()
 
#define CdUnlockCdData()
 
#define CdLockVcb(IC, V)
 
#define CdUnlockVcb(IC, V)
 
#define CdLockFcb(IC, F)
 
#define CdUnlockFcb(IC, F)
 
#define CdGetFcbOplock(F)   &(F)->Header.Oplock
 
#define CdCreateIrpContextLite(IC)    ExAllocatePoolWithTag( CdNonPagedPool, sizeof( IRP_CONTEXT_LITE ), TAG_IRP_CONTEXT_LITE )
 
#define CdFreeIrpContextLite(ICL)    CdFreePool( &(ICL) )
 
#define CdIncrementCleanupCounts(IC, F)
 
#define CdDecrementCleanupCounts(IC, F)
 
#define CdIncrementReferenceCounts(IC, F, C, UC)
 
#define CdDecrementReferenceCounts(IC, F, C, UC)
 
#define CdAllocateIoContext()
 
#define CdFreeIoContext(IO)   CdFreePool( (PVOID) &(IO) ) /* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */
 
#define CdPagedPool   PagedPool
 
#define CdNonPagedPool   NonPagedPoolNx
 
#define CdNonPagedPoolCacheAligned   NonPagedPoolNxCacheAligned
 
#define CdUpdateMediaChangeCount(V, C)   (V)->MediaChangeCount = (C)
 
#define CdUpdateVcbCondition(V, C)   (V)->VcbCondition = (C)
 
#define CdMarkRealDevForVerify(DO)   SetFlag( (DO)->Flags, DO_VERIFY_VOLUME)
 
#define CdMarkRealDevVerifyOk(DO)   ClearFlag( (DO)->Flags, DO_VERIFY_VOLUME)
 
#define CdRealDevNeedsVerify(DO)   BooleanFlagOn( (DO)->Flags, DO_VERIFY_VOLUME)
 
#define CdIsRawDevice(IC, S)
 
#define Add2Ptr(PTR, INC, CAST)   ((CAST)((PUCHAR)(PTR) + (INC)))
 
#define PtrOffset(BASE, OFFSET)   ((ULONG)((ULONG_PTR)(OFFSET) - (ULONG_PTR)(BASE)))
 
#define WordAlign(Ptr)
 
#define LongAlign(Ptr)
 
#define QuadAlign(Ptr)
 
#define SectorAlign(L)
 
#define LlSectorAlign(L)
 
#define SectorTruncate(L)
 
#define LlSectorTruncate(L)
 
#define BytesFromSectors(L)
 
#define SectorsFromBytes(L)
 
#define LlBytesFromSectors(L)
 
#define LlSectorsFromBytes(L)
 
#define SectorOffset(L)
 
#define SectorBlockOffset(V, LB)
 
#define BytesFromBlocks(V, B)
 
#define LlBytesFromBlocks(V, B)
 
#define BlockAlign(V, L)
 
#define LlBlockAlign(V, L)
 
#define BlockOffset(V, L)
 
#define RawSectorAlign(B)   ((((B)+(RAW_SECTOR_SIZE - 1)) / RAW_SECTOR_SIZE) * RAW_SECTOR_SIZE)
 
#define CopyUchar1(Dst, Src)
 
#define CopyUchar2(Dst, Src)
 
#define CopyUchar4(Dst, Src)
 
#define CopyUshort2(Dst, Src)
 
#define SwapCopyUchar4(Dst, Src)
 
#define AssertVerifyDevice(C, S)
 
#define AssertVerifyDeviceIrp(I)
 
#define CdRaiseStatus(IC, S)   CdRaiseStatusEx( (IC), (S), FALSE, BugCheckFileId, __LINE__);
 
#define CdNormalizeAndRaiseStatus(IC, S)   CdRaiseStatusEx( (IC), (S), TRUE, BugCheckFileId, __LINE__);
 
#define CdRestoreThreadContext(IC)
 
#define CanFsdWait(I)   IoIsOperationSynchronous(I)
 
#define CdIsFastIoPossible(F)
 
#define try_return(S)   { S; goto try_exit; }
 
#define try_leave(S)   { S; leave; }
 
#define CdFreePool(x)   _CdFreePool((PVOID*)(x))
 
#define CdTelemetryMountSafe(...)   NOTHING
 

Typedefs

typedef enum _TYPE_OF_OPEN TYPE_OF_OPEN
 
typedef TYPE_OF_OPENPTYPE_OF_OPEN
 
typedef enum _TYPE_OF_ACQUIRE TYPE_OF_ACQUIRE
 
typedef enum _TYPE_OF_ACQUIREPTYPE_OF_ACQUIRE
 
typedef union _UCHAR1 UCHAR1
 
typedef union _UCHAR1PUCHAR1
 
typedef union _UCHAR2 UCHAR2
 
typedef union _UCHAR2PUCHAR2
 
typedef union _UCHAR4 UCHAR4
 
typedef union _UCHAR4PUCHAR4
 
typedef union _USHORT2 USHORT2
 
typedef union _USHORT2PUSHORT2
 

Enumerations

enum  _TYPE_OF_OPEN {
  UnopenedFileObject = 0 , StreamFileOpen , UserVolumeOpen , UserDirectoryOpen ,
  UserFileOpen , BeyondValidType , UnopenedFileObject = 1 , UserFileOpen ,
  UserDirectoryOpen , UserVolumeOpen , VirtualVolumeFile , DirectoryFile ,
  EaFile
}
 
enum  _TYPE_OF_ACQUIRE { AcquireExclusive , AcquireShared , AcquireSharedStarveExclusive }
 

Functions

 _Requires_lock_held_ (_Global_critical_region_) VOID CdLookupAllocation(_In_ PIRP_CONTEXT IrpContext
 
VOID CdAddAllocationFromDirent (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ ULONG McbEntryOffset, _In_ LONGLONG StartingFileOffset, _In_ PDIRENT Dirent)
 
VOID CdAddInitialAllocation (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ ULONG StartingBlock, _In_ LONGLONG DataLength)
 
VOID CdTruncateAllocation (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ LONGLONG StartingFileOffset)
 
 _At_ (Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET(FCB, FcbType))) VOID CdInitializeMcb(_In_ PIRP_CONTEXT IrpContext
 
 _Inout_updates_bytes_ (Fcb->NodeByteSize) PFCB Fcb)
 
VOID CdCreateInternalStream (_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _Inout_ PFCB Fcb, _In_ PUNICODE_STRING Name)
 
VOID CdDeleteInternalStream (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb)
 
NTSTATUS CdCompleteMdl (_In_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
 
static INLINE VOID CdVerifyOrCreateDirStreamFile (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
 
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)
 
NTSTATUS CdCreateUserMdl (_In_ PIRP_CONTEXT IrpContext, _In_ ULONG BufferLength, _In_ BOOLEAN RaiseOnError, _In_ LOCK_OPERATION Operation)
 
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)
 
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)
 
NTSTATUS CdHijackIrpAndFlushDevice (_In_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp, _In_ PDEVICE_OBJECT TargetDeviceObject)
 
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
 
VOID CdUpdateDirentName (_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
 
 _Success_ (return !=FALSE) BOOLEAN CdFindFile(_In_ PIRP_CONTEXT IrpContext
 
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
 
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)
 
 _When_ (TypeOfOpen==UnopenedFileObject, _At_(Fcb, _In_opt_)) _When_(TypeOfOpen !
 
 _At_ (Fcb, _In_)) VOID CdSetFileObject(_In_ PIRP_CONTEXT IrpContext
 
 _When_ (return==UnopenedFileObject, _At_(*Fcb, _Post_null_)) _When_(return !
 
 _At_ (Fcb, _Outptr_)) _When_(return
 
_At_ Ccb _When_ (return !=UnopenedFileObject, _At_(Ccb, _Outptr_)) TYPE_OF_OPEN CdDecodeFileObject(_In_ PIRP_CONTEXT IrpContext
 
TYPE_OF_OPEN CdFastDecodeFileObject (_In_ PFILE_OBJECT FileObject, _Out_ PFCB *Fcb)
 
 _Post_satisfies_ (_Old_(CdName->FileName.Length) >=CdName->FileName.Length+CdName->VersionString.Length) VOID CdConvertNameToCdName(_In_ PIRP_CONTEXT IrpContext
 
VOID CdConvertBigToLittleEndian (_In_ PIRP_CONTEXT IrpContext, _In_reads_bytes_(ByteCount) PCHAR BigEndian, _In_ ULONG ByteCount, _Out_writes_bytes_(ByteCount) PCHAR LittleEndian)
 
VOID CdUpcaseName (_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME Name, _Inout_ PCD_NAME UpcaseName)
 
VOID CdDissectName (_In_ PIRP_CONTEXT IrpContext, _Inout_ PUNICODE_STRING RemainingName, _Out_ PUNICODE_STRING FinalName)
 
BOOLEAN CdIsLegalName (_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING FileName)
 
BOOLEAN CdIs8dot3Name (_In_ PIRP_CONTEXT IrpContext, _In_ UNICODE_STRING FileName)
 
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 CdIsNameInExpression (_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME CurrentName, _In_ PCD_NAME SearchExpression, _In_ ULONG WildcardFlags, _In_ BOOLEAN CheckVersion)
 
ULONG CdShortNameDirentOffset (_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING Name)
 
FSRTL_COMPARISON_RESULT CdFullCompareNames (_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING NameA, _In_ PUNICODE_STRING NameB)
 
NTSTATUS CdUnlockVolumeInternal (_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb, _In_opt_ PFILE_OBJECT FileObject)
 
VOID CdLookupPathEntry (_In_ PIRP_CONTEXT IrpContext, _In_ ULONG PathEntryOffset, _In_ ULONG Ordinal, _In_ BOOLEAN VerifyBounds, _Inout_ PCOMPOUND_PATH_ENTRY CompoundPathEntry)
 
BOOLEAN CdLookupNextPathEntry (_In_ PIRP_CONTEXT IrpContext, _Inout_ PPATH_ENUM_CONTEXT PathContext, _Inout_ PPATH_ENTRY PathEntry)
 
VOID CdUpdatePathEntryName (_In_ PIRP_CONTEXT IrpContext, _Inout_ PPATH_ENTRY PathEntry, _In_ BOOLEAN IgnoreCase)
 
VOID CdInsertPrefix (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ PCD_NAME Name, _In_ BOOLEAN IgnoreCase, _In_ BOOLEAN ShortNameMatch, _Inout_ PFCB ParentFcb)
 
VOID CdRemovePrefix (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb)
 
_Acquires_exclusive_lock_ Resource _When_ (Type==AcquireShared &&return !=FALSE, _Acquires_shared_lock_(*Resource)) _When_(Type
 
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _When_ (IgnoreWait==FALSE, _Post_satisfies_(return==TRUE)) BOOLEAN CdAcquireResource(_In_ PIRP_CONTEXT IrpContext
 
BOOLEAN NTAPI CdNoopAcquire (_In_ PVOID Fcb, _In_ BOOLEAN Wait)
 
VOID NTAPI CdNoopRelease (_In_ PVOID Fcb)
 
_Acquires_shared_lock_ Fcb BOOLEAN NTAPI CdAcquireForCache (_Inout_ PFCB Fcb, _In_ BOOLEAN Wait)
 
 _Function_class_ (FAST_IO_RELEASE_FILE) _Requires_lock_held_(_Global_critical_region_) VOID NTAPI CdReleaseForCreateSection(_In_ PFILE_OBJECT FileObject)
 
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)
 
VOID CdUpdateVcbFromVolDescriptor (_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb, _In_reads_bytes_opt_(SECTOR_SIZE) PCHAR RawIsoVd)
 
VOID CdDeleteVcb (_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb)
 
PFCB CdCreateFcb (_In_ PIRP_CONTEXT IrpContext, _In_ FILE_ID FileId, _In_ NODE_TYPE_CODE NodeTypeCode, _Out_opt_ PBOOLEAN FcbExisted)
 
VOID CdInitializeFcbFromPathEntry (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_opt_ PFCB ParentFcb, _In_ PPATH_ENTRY PathEntry)
 
VOID CdInitializeFcbFromFileContext (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ PFCB ParentFcb, _In_ PFILE_ENUM_CONTEXT FileContext)
 
PCCB CdCreateCcb (_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG Flags)
 
VOID CdDeleteCcb (_In_ PIRP_CONTEXT IrpContext, _In_ __drv_freesMem(Pool) PCCB Ccb)
 
 _When_ (RaiseOnError||return, _At_(Fcb->FileLock, _Post_notnull_)) _When_(RaiseOnError
 
 _At_ (IrpContext, _Pre_notnull_)) BOOLEAN CdCreateFileLock(_In_opt_ PIRP_CONTEXT IrpContext
 
VOID CdDeleteFileLock (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFILE_LOCK FileLock)
 
_Ret_valid_ PIRP_CONTEXT CdCreateIrpContext (_In_ PIRP Irp, _In_ BOOLEAN Wait)
 
VOID CdCleanupIrpContext (_In_ PIRP_CONTEXT IrpContext, _In_ BOOLEAN Post)
 
VOID CdInitializeStackIrpContext (_Out_ PIRP_CONTEXT IrpContext, _In_ PIRP_CONTEXT_LITE IrpContextLite)
 
PFCB CdLookupFcbTable (_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _In_ FILE_ID FileId)
 
PFCB CdGetNextFcb (_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _In_ PVOID *RestartKey)
 
NTSTATUS CdProcessToc (_In_ PIRP_CONTEXT IrpContext, _In_ PDEVICE_OBJECT TargetDeviceObject, _In_ PCDROM_TOC_LARGE CdromToc, _Inout_ PULONG Length, _Out_ PULONG TrackCount, _Inout_ PULONG DiskFlags)
 
static INLINE BOOLEAN CdOperationIsDasdOpen (_In_ PIRP_CONTEXT IrpContext)
 
BOOLEAN CdMarkDevForVerifyIfVcbMounted (_Inout_ PVCB Vcb)
 
VOID CdVerifyVcb (_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb)
 
BOOLEAN CdVerifyFcbOperation (_In_opt_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
 
static INLINE ULONG SectorsFromLlBytes (ULONGLONG Bytes)
 
VOID CdLbnToMmSsFf (_In_ ULONG Blocks, _Out_writes_(3) PUCHAR Msf)
 
 _IRQL_requires_max_ (APC_LEVEL) __drv_dispatchType(DRIVER_DISPATCH) __drv_dispatchType(IRP_MJ_CREATE) __drv_dispatchType(IRP_MJ_CLOSE) __drv_dispatchType(IRP_MJ_READ) __drv_dispatchType(IRP_MJ_WRITE) __drv_dispatchType(IRP_MJ_QUERY_INFORMATION) __drv_dispatchType(IRP_MJ_SET_INFORMATION) __drv_dispatchType(IRP_MJ_QUERY_VOLUME_INFORMATION) __drv_dispatchType(IRP_MJ_DIRECTORY_CONTROL) __drv_dispatchType(IRP_MJ_FILE_SYSTEM_CONTROL) __drv_dispatchType(IRP_MJ_DEVICE_CONTROL) __drv_dispatchType(IRP_MJ_LOCK_CONTROL) __drv_dispatchType(IRP_MJ_CLEANUP) __drv_dispatchType(IRP_MJ_PNP) __drv_dispatchType(IRP_MJ_SHUTDOWN) NTSTATUS NTAPI CdFsdDispatch(_In_ PDEVICE_OBJECT DeviceObject
 
LONG CdExceptionFilter (_Inout_ PIRP_CONTEXT IrpContext, _In_ PEXCEPTION_POINTERS ExceptionPointer)
 
VOID CdCompleteRequest (_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
 
INLINE DECLSPEC_NORETURN VOID CdRaiseStatusEx (_In_ PIRP_CONTEXT IrpContext, _In_ NTSTATUS Status, _In_ BOOLEAN NormalizeStatus, _In_ ULONG Fileid, _In_ ULONG Line)
 
VOID CdSetThreadContext (_Inout_ PIRP_CONTEXT IrpContext, _In_ PTHREAD_CONTEXT ThreadContext)
 
ULONG CdSerial32 (_In_reads_bytes_(ByteCount) PCHAR Buffer, _In_ ULONG ByteCount)
 
VOID CdFspClose (_In_opt_ PVCB Vcb)
 
NTSTATUS CdCommonDevControl (_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
 
NTSTATUS CdCommonLockControl (_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
 
static INLINE VOID _CdFreePool (_Inout_ _At_(*Pool, __drv_freesMem(Mem) _Post_null_) PVOID *Pool)
 

Variables

_In_ PFCB Fcb
 
_In_ PFCB _In_ LONGLONG FileOffset
 
_In_ PFCB _In_ LONGLONG _Out_ PLONGLONG DiskOffset
 
_In_ PFCB _In_ LONGLONG _Out_ PLONGLONG _Out_ PULONG ByteCount
 
_In_ PVCB Vcb
 
_In_ PVCB _In_ BOOLEAN DismountUnderway
 
_In_ PFCB _In_ LONGLONG StartingOffset
 
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
 
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
 
_In_ PFCB _In_ PCD_NAME Name
 
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN IgnoreCase
 
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT FileContext
 
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT _Out_ PCD_NAMEMatchingName
 
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG ShortNameDirentOffset
 
_Inout_ PFILE_OBJECT FileObject
 
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
 
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
 
_Inout_ PCD_NAME CdName
 
_In_ PFCB ParentFcb
 
_In_ PFCB _In_ PCD_NAME DirName
 
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PCOMPOUND_PATH_ENTRY CompoundPathEntry
 
_Inout_ PFCBCurrentFcb
 
_Inout_ PFCB _Inout_ PUNICODE_STRING RemainingName
 
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
 
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE _In_ BOOLEAN IgnoreWait
 
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE _In_ BOOLEAN _In_ TYPE_OF_ACQUIRE Type
 
_Unreferenced_parameter_ PVOIDCompletionContext
 
_Inout_ PFCB _In_ BOOLEAN RaiseOnError
 
_Inout_ PFCB StartingFcb
 
_Inout_ PFCB _Out_ PBOOLEAN RemovedStartingFcb
 
_Inout_ PIRP Irp
 
_Inout_ PIRP _In_ PDEVICE_OBJECT DeviceToVerify
 
_Inout_ PVCB _In_ BOOLEAN Force
 
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
 
FAST_IO_QUERY_BASIC_INFO CdFastQueryBasicInfo
 
FAST_IO_QUERY_STANDARD_INFO CdFastQueryStdInfo
 
FAST_IO_LOCK CdFastLock
 
FAST_IO_UNLOCK_SINGLE CdFastUnlockSingle
 
FAST_IO_UNLOCK_ALL CdFastUnlockAll
 
FAST_IO_UNLOCK_ALL_BY_KEY CdFastUnlockAllByKey
 
FAST_IO_CHECK_IF_POSSIBLE CdFastIoCheckIfPossible
 
FAST_IO_QUERY_NETWORK_OPEN_INFO CdFastQueryNetworkInfo
 
WORKER_THREAD_ROUTINE CdFspDispatch
 

Macro Definition Documentation

◆ Add2Ptr

#define Add2Ptr (   PTR,
  INC,
  CAST 
)    ((CAST)((PUCHAR)(PTR) + (INC)))

Definition at line 1545 of file cdprocs.h.

◆ AssertVerifyDevice

#define AssertVerifyDevice (   C,
  S 
)

Definition at line 1810 of file cdprocs.h.

◆ AssertVerifyDeviceIrp

#define AssertVerifyDeviceIrp (   I)

Definition at line 1811 of file cdprocs.h.

◆ BlockAlign

#define BlockAlign (   V,
  L 
)
Value:
( \
((ULONG)(L) + (V)->BlockMask) & (V)->BlockInverseMask \
)
#define V(i, a, b, c, d)
Definition: jaricom.c:29
#define L(x)
Definition: ntvdm.h:50
uint32_t ULONG
Definition: typedefs.h:59

Definition at line 1638 of file cdprocs.h.

◆ BlockOffset

#define BlockOffset (   V,
  L 
)
Value:
( \
((ULONG) (L)) & (V)->BlockMask \
)

Definition at line 1650 of file cdprocs.h.

◆ BytesFromBlocks

#define BytesFromBlocks (   V,
  B 
)
Value:
( \
(ULONG) (B) << (V)->BlockToByteShift \
)
Definition: ehthrow.cxx:54

Definition at line 1630 of file cdprocs.h.

◆ BytesFromSectors

#define BytesFromSectors (   L)
Value:
( \
((ULONG) (L)) << SECTOR_SHIFT \
)
#define SECTOR_SHIFT
Definition: cd.h:32

Definition at line 1596 of file cdprocs.h.

◆ CanFsdWait

#define CanFsdWait (   I)    IoIsOperationSynchronous(I)

Definition at line 2001 of file cdprocs.h.

◆ CdAcquireAllFiles

#define CdAcquireAllFiles (   IC,
  V 
)     CdAcquireResource( (IC), &(V)->FileResource, FALSE, AcquireExclusive )

Definition at line 988 of file cdprocs.h.

◆ CdAcquireCacheForRead

#define CdAcquireCacheForRead (   IC)     ExAcquireResourceSharedLite( &(IC)->Vcb->SectorCacheResource, TRUE)

Definition at line 961 of file cdprocs.h.

◆ CdAcquireCacheForUpdate

#define CdAcquireCacheForUpdate (   IC)     ExAcquireResourceExclusiveLite( &(IC)->Vcb->SectorCacheResource, TRUE)

Definition at line 964 of file cdprocs.h.

◆ CdAcquireCdData

#define CdAcquireCdData (   IC)     ExAcquireResourceExclusiveLite( &CdData.DataResource, TRUE )

Definition at line 973 of file cdprocs.h.

◆ CdAcquireFcbExclusive

#define CdAcquireFcbExclusive (   IC,
  F,
  I 
)     CdAcquireResource( (IC), &(F)->FcbNonpaged->FcbResource, (I), AcquireExclusive )

Definition at line 1006 of file cdprocs.h.

◆ CdAcquireFcbShared

#define CdAcquireFcbShared (   IC,
  F,
  I 
)     CdAcquireResource( (IC), &(F)->FcbNonpaged->FcbResource, (I), AcquireShared )

Definition at line 1009 of file cdprocs.h.

◆ CdAcquireFileExclusive

#define CdAcquireFileExclusive (   IC,
  F 
)     CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireExclusive )

Definition at line 994 of file cdprocs.h.

◆ CdAcquireFileShared

#define CdAcquireFileShared (   IC,
  F 
)     CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireShared )

Definition at line 997 of file cdprocs.h.

◆ CdAcquireFileSharedStarveExclusive

#define CdAcquireFileSharedStarveExclusive (   IC,
  F 
)     CdAcquireResource( (IC), (F)->Resource, FALSE, AcquireSharedStarveExclusive )

Definition at line 1000 of file cdprocs.h.

◆ CdAcquireVcbExclusive

#define CdAcquireVcbExclusive (   IC,
  V,
  I 
)     CdAcquireResource( (IC), &(V)->VcbResource, (I), AcquireExclusive )

Definition at line 979 of file cdprocs.h.

◆ CdAcquireVcbShared

#define CdAcquireVcbShared (   IC,
  V,
  I 
)     CdAcquireResource( (IC), &(V)->VcbResource, (I), AcquireShared )

Definition at line 982 of file cdprocs.h.

◆ CdAllocateIoContext

#define CdAllocateIoContext ( )
Value:
sizeof( CD_IO_CONTEXT ), \
#define CdNonPagedPool
Definition: cdprocs.h:1381
#define TAG_IO_CONTEXT
Definition: cdprocs.h:96
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:229

Definition at line 1344 of file cdprocs.h.

◆ CdCleanupCompoundPathEntry

#define CdCleanupCompoundPathEntry (   IC,
  CP 
)
Value:
{ \
CdUnpinData( (IC), &(CP)->PathContext.Bcb ); \
if ((CP)->PathContext.AllocatedData) { \
CdFreePool( &(CP)->PathContext.Data ); \
} \
if (FlagOn( (CP)->PathEntry.Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER )) { \
CdFreePool( &(CP)->PathEntry.CdDirName.FileName.Buffer ); \
} \
}
#define PATH_ENTRY_FLAG_ALLOC_BUFFER
Definition: cdstruc.h:1517
#define CP
Definition: debug.h:64
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179

Definition at line 766 of file cdprocs.h.

◆ CdCleanupDirContext

#define CdCleanupDirContext (   IC,
  DC 
)     CdUnpinData( (IC), &(DC)->Bcb )

Definition at line 548 of file cdprocs.h.

◆ CdCleanupDirent

#define CdCleanupDirent (   IC,
  D 
)
Value:
{ \
CdFreePool( &(D)->CdFileName.FileName.Buffer ); \
} \
}
#define D(d)
Definition: builtin.c:4557
#define DIRENT_FLAG_ALLOC_BUFFER
Definition: cdstruc.h:1670
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Definition at line 542 of file cdprocs.h.

◆ CdConvertCacheToShared

#define CdConvertCacheToShared (   IC)     ExConvertExclusiveToSharedLite( &(IC)->Vcb->SectorCacheResource);

Definition at line 970 of file cdprocs.h.

◆ CdCreateIrpContextLite

Definition at line 1249 of file cdprocs.h.

◆ CdDecrementCleanupCounts

#define CdDecrementCleanupCounts (   IC,
  F 
)
Value:
{ \
ASSERT_LOCKED_VCB( (F)->Vcb ); \
(F)->FcbCleanup -= 1; \
(F)->Vcb->VcbCleanup -= 1; \
}
_In_ PVCB Vcb
Definition: cdprocs.h:235
#define F(x, y, z)
Definition: md5.c:51
ULONG VcbCleanup
Definition: cdstruc.h:551

Definition at line 1311 of file cdprocs.h.

◆ CdDecrementReferenceCounts

#define CdDecrementReferenceCounts (   IC,
  F,
  C,
  UC 
)
Value:
{ \
ASSERT_LOCKED_VCB( (F)->Vcb ); \
(F)->FcbReference -= (C); \
(F)->FcbUserReference -= (UC); \
(F)->Vcb->VcbReference -= (C); \
(F)->Vcb->VcbUserReference -= (UC); \
}
#define UC(b)
Definition: terminate.cpp:24
__volatile LONG VcbUserReference
Definition: cdstruc.h:553
__volatile LONG VcbReference
Definition: cdstruc.h:552

Definition at line 1325 of file cdprocs.h.

◆ CdFreeIoContext

#define CdFreeIoContext (   IO)    CdFreePool( (PVOID) &(IO) ) /* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */

Definition at line 1349 of file cdprocs.h.

◆ CdFreeIrpContextLite

#define CdFreeIrpContextLite (   ICL)     CdFreePool( &(ICL) )

Definition at line 1252 of file cdprocs.h.

◆ CdFreePool

#define CdFreePool (   x)    _CdFreePool((PVOID*)(x))

Definition at line 2190 of file cdprocs.h.

◆ CdGetFcbOplock

#define CdGetFcbOplock (   F)    &(F)->Header.Oplock

Definition at line 1081 of file cdprocs.h.

◆ CdIllegalFcbAccess

#define CdIllegalFcbAccess (   IC,
  T,
  DA 
)
Value:
( \
BooleanFlagOn( (DA), \
((T) != UserVolumeOpen ? \
FILE_APPEND_DATA) : 0) | \
DELETE | \
@ UserVolumeOpen
Definition: cdprocs.h:575
#define T
Definition: mbstring.h:31
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define WRITE_DAC
Definition: nt_native.h:59
#define FILE_DELETE_CHILD
Definition: nt_native.h:645
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define FILE_APPEND_DATA
Definition: nt_native.h:634
#define DELETE
Definition: nt_native.h:57
#define FILE_ADD_SUBDIRECTORY
Definition: nt_native.h:635
#define FILE_ADD_FILE
Definition: nt_native.h:632
#define FILE_WRITE_EA
Definition: nt_native.h:640

Definition at line 135 of file cdprocs.h.

◆ CdIncrementCleanupCounts

#define CdIncrementCleanupCounts (   IC,
  F 
)
Value:
{ \
ASSERT_LOCKED_VCB( (F)->Vcb ); \
(F)->FcbCleanup += 1; \
(F)->Vcb->VcbCleanup += 1; \
}

Definition at line 1305 of file cdprocs.h.

◆ CdIncrementReferenceCounts

#define CdIncrementReferenceCounts (   IC,
  F,
  C,
  UC 
)
Value:
{ \
ASSERT_LOCKED_VCB( (F)->Vcb ); \
(F)->FcbReference += (C); \
(F)->FcbUserReference += (UC); \
(F)->Vcb->VcbReference += (C); \
(F)->Vcb->VcbUserReference += (UC); \
}

Definition at line 1317 of file cdprocs.h.

◆ CdInitializeCompoundPathEntry

#define CdInitializeCompoundPathEntry (   IC,
  CP 
)     RtlZeroMemory( CP, sizeof( COMPOUND_PATH_ENTRY ))

Definition at line 763 of file cdprocs.h.

◆ CdInitializeDirContext

#define CdInitializeDirContext (   IC,
  DC 
)     RtlZeroMemory( DC, sizeof( DIRENT_ENUM_CONTEXT ))

Definition at line 539 of file cdprocs.h.

◆ CdInitializeDirent

#define CdInitializeDirent (   IC,
  D 
)     RtlZeroMemory( D, sizeof( DIRENT ))

Definition at line 536 of file cdprocs.h.

◆ CdInitializeFileContext

#define CdInitializeFileContext (   IC,
  FC 
)
Value:
{ \
RtlZeroMemory( FC, sizeof( FILE_ENUM_CONTEXT )); \
(FC)->PriorDirent = &(FC)->Dirents[0]; \
(FC)->InitialDirent = &(FC)->Dirents[1]; \
(FC)->CurrentDirent = &(FC)->Dirents[2]; \
(FC)->ShortName.FileName.MaximumLength = BYTE_COUNT_8_DOT_3; \
(FC)->ShortName.FileName.Buffer = (FC)->ShortNameBuffer; \
}
#define BYTE_COUNT_8_DOT_3
Definition: cd.h:362
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING ShortName
Definition: fatprocs.h:1306

Definition at line 527 of file cdprocs.h.

◆ CdIsFastIoPossible

#define CdIsFastIoPossible (   F)
Value:
((BOOLEAN) \
((((F)->Vcb->VcbCondition != VcbMounted ) || \
\
\
((((F)->FileLock != NULL) && FsRtlAreThereCurrentFileLocks( (F)->FileLock )) ? \
\
\
)
#define CdGetFcbOplock(F)
Definition: cdprocs.h:1081
@ VcbMounted
Definition: cdstruc.h:492
#define NULL
Definition: types.h:112
#define FsRtlAreThereCurrentFileLocks(FL)
Definition: fsrtlfuncs.h:1584
@ FastIoIsQuestionable
Definition: fsrtltypes.h:242
@ FastIoIsNotPossible
Definition: fsrtltypes.h:240
@ FastIoIsPossible
Definition: fsrtltypes.h:241
BOOLEAN NTAPI FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
Definition: oplock.c:1564
#define BOOLEAN
Definition: pedump.c:73
VCB_CONDITION VcbCondition
Definition: cdstruc.h:541

Definition at line 2015 of file cdprocs.h.

◆ CdIsRawDevice

#define CdIsRawDevice (   IC,
  S 
)
Value:
( \
)
#define S(x)
Definition: test.h:217
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
#define STATUS_NO_MEDIA_IN_DEVICE
Definition: udferr_usr.h:141

Definition at line 1466 of file cdprocs.h.

◆ CdLockCdData

#define CdLockCdData ( )
Value:
CD_DATA CdData
Definition: cddata.c:42
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
PVOID CdDataLockThread
Definition: cdstruc.h:395
FAST_MUTEX CdDataMutex
Definition: cdstruc.h:396

Definition at line 1015 of file cdprocs.h.

◆ CdLockFcb

#define CdLockFcb (   IC,
  F 
)
Value:
{ \
PVOID _CurrentThread = PsGetCurrentThread(); \
if (_CurrentThread != (F)->FcbLockThread) { \
ExAcquireFastMutex( &(F)->FcbNonpaged->FcbMutex ); \
NT_ASSERT( (F)->FcbLockCount == 0 ); \
_Analysis_assume_( (F)->FcbLockCount == 0 ); \
(F)->FcbLockThread = _CurrentThread; \
} \
else \
{ \
_Analysis_assume_lock_held_( (F)->FcbNonpaged->FcbMutex ); \
_Analysis_assume_(FALSE != DummySaveIrql(&(F)->FcbNonpaged->FcbMutex)); \
} \
(F)->FcbLockCount += 1; \
}
#define FALSE
Definition: types.h:117

Definition at line 1044 of file cdprocs.h.

◆ CdLockUserBuffer

#define CdLockUserBuffer (   IC,
  BL,
  OP 
)
Value:
{ \
if ((IC)->Irp->MdlAddress == NULL) { \
(VOID) CdCreateUserMdl( (IC), (BL), TRUE, (OP) ); \
} \
}
OP
Definition: DragDrop.cpp:27
#define VOID
Definition: acefi.h:82
NTSTATUS CdCreateUserMdl(_In_ PIRP_CONTEXT IrpContext, _In_ ULONG BufferLength, _In_ BOOLEAN RaiseOnError, _In_ LOCK_OPERATION Operation)
Definition: deviosup.c:1221
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define BL
Definition: i386-dis.c:419

Definition at line 393 of file cdprocs.h.

◆ CdLockVcb

#define CdLockVcb (   IC,
  V 
)
Value:
ExAcquireFastMutex( &(V)->VcbMutex ); \
NT_ASSERT( NULL == (V)->VcbLockThread); \
(V)->VcbLockThread = PsGetCurrentThread()

Definition at line 1023 of file cdprocs.h.

◆ CdLookupInitialFileDirent

#define CdLookupInitialFileDirent (   IC,
  F,
  FC,
  DO 
)
Value:
F, \
DO, \
&(FC)->InitialDirent->DirContext ); \
CdUpdateDirentFromRawDirent( IC, \
F, \
&(FC)->InitialDirent->DirContext, \
&(FC)->InitialDirent->Dirent )
VOID CdLookupDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG DirentOffset, _Out_ PDIRENT_ENUM_CONTEXT DirContext)
Definition: dirsup.c:125
#define DO
Definition: ftp_var.h:15

Definition at line 551 of file cdprocs.h.

◆ CdMapUserBuffer

#define CdMapUserBuffer (   IC,
  UB 
)
Value:
{ \
*(UB) = (PVOID) ( ((IC)->Irp->MdlAddress == NULL) ? \
(IC)->Irp->UserBuffer : \
(MmGetSystemAddressForMdlSafe( (IC)->Irp->MdlAddress, NormalPagePriority | MdlMappingNoExecute))); \
if (NULL == *(UB)) { \
CdRaiseStatus( (IC), STATUS_INSUFFICIENT_RESOURCES); \
} \
}
@ NormalPagePriority
Definition: imports.h:56
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)

Definition at line 383 of file cdprocs.h.

◆ CdMarkRealDevForVerify

#define CdMarkRealDevForVerify (   DO)    SetFlag( (DO)->Flags, DO_VERIFY_VOLUME)

Definition at line 1451 of file cdprocs.h.

◆ CdMarkRealDevVerifyOk

#define CdMarkRealDevVerifyOk (   DO)    ClearFlag( (DO)->Flags, DO_VERIFY_VOLUME)

Definition at line 1453 of file cdprocs.h.

◆ CdNonPagedPool

#define CdNonPagedPool   NonPagedPoolNx

Definition at line 1381 of file cdprocs.h.

◆ CdNonPagedPoolCacheAligned

#define CdNonPagedPoolCacheAligned   NonPagedPoolNxCacheAligned

Definition at line 1382 of file cdprocs.h.

◆ CdNormalizeAndRaiseStatus

#define CdNormalizeAndRaiseStatus (   IC,
  S 
)    CdRaiseStatusEx( (IC), (S), TRUE, BugCheckFileId, __LINE__);

Definition at line 1860 of file cdprocs.h.

◆ CdPagedPool

#define CdPagedPool   PagedPool

Definition at line 1380 of file cdprocs.h.

◆ CdRaiseStatus

#define CdRaiseStatus (   IC,
  S 
)    CdRaiseStatusEx( (IC), (S), FALSE, BugCheckFileId, __LINE__);

Definition at line 1859 of file cdprocs.h.

◆ CdRealDevNeedsVerify

#define CdRealDevNeedsVerify (   DO)    BooleanFlagOn( (DO)->Flags, DO_VERIFY_VOLUME)

Definition at line 1456 of file cdprocs.h.

◆ CdReleaseAllFiles

#define CdReleaseAllFiles (   IC,
  V 
)     ExReleaseResourceLite( &(V)->FileResource )

Definition at line 991 of file cdprocs.h.

◆ CdReleaseCache

#define CdReleaseCache (   IC)     ExReleaseResourceLite( &(IC)->Vcb->SectorCacheResource);

Definition at line 967 of file cdprocs.h.

◆ CdReleaseCdData

#define CdReleaseCdData (   IC)     ExReleaseResourceLite( &CdData.DataResource )

Definition at line 976 of file cdprocs.h.

◆ CdReleaseFcb

#define CdReleaseFcb (   IC,
  F 
)     ExReleaseResourceLite( &(F)->FcbNonpaged->FcbResource )

Definition at line 1012 of file cdprocs.h.

◆ CdReleaseFile

#define CdReleaseFile (   IC,
  F 
)     ExReleaseResourceLite( (F)->Resource )

Definition at line 1003 of file cdprocs.h.

◆ CdReleaseVcb

#define CdReleaseVcb (   IC,
  V 
)     ExReleaseResourceLite( &(V)->VcbResource )

Definition at line 985 of file cdprocs.h.

◆ CdRestoreThreadContext

#define CdRestoreThreadContext (   IC)
Value:
(IC)->ThreadContext->Cdfs = 0; \
IoSetTopLevelIrp( (IC)->ThreadContext->SavedTopLevelIrp ); \
(IC)->ThreadContext = NULL
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000

Definition at line 1983 of file cdprocs.h.

◆ CdTelemetryMountSafe

#define CdTelemetryMountSafe (   ...)    NOTHING

Definition at line 2312 of file cdprocs.h.

◆ CdUnlockCdData

#define CdUnlockCdData ( )
Value:
ExReleaseFastMutex( &CdData.CdDataMutex )

Definition at line 1019 of file cdprocs.h.

◆ CdUnlockFcb

#define CdUnlockFcb (   IC,
  F 
)
Value:
{ \
(F)->FcbLockCount -= 1; \
if ((F)->FcbLockCount == 0) { \
(F)->FcbLockThread = NULL; \
ExReleaseFastMutex( &(F)->FcbNonpaged->FcbMutex ); \
} \
else \
{ \
_Analysis_assume_lock_not_held_( (F)->FcbNonpaged->FcbMutex ); \
_Analysis_assume_(FALSE != DummyRestoreIrql(&(F)->FcbNonpaged->FcbMutex)); \
} \
}

Definition at line 1060 of file cdprocs.h.

◆ CdUnlockVcb

#define CdUnlockVcb (   IC,
  V 
)
Value:
NT_ASSERT( NULL != (V)->VcbLockThread); \
(V)->VcbLockThread = NULL; \
ExReleaseFastMutex( &(V)->VcbMutex )
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Definition at line 1028 of file cdprocs.h.

◆ CdUnpinData

#define CdUnpinData (   IC,
  B 
)     if (*(B) != NULL) { CcUnpinData( *(B) ); *(B) = NULL; }

Definition at line 269 of file cdprocs.h.

◆ CdUpdateMediaChangeCount

#define CdUpdateMediaChangeCount (   V,
  C 
)    (V)->MediaChangeCount = (C)

Definition at line 1448 of file cdprocs.h.

◆ CdUpdateVcbCondition

#define CdUpdateVcbCondition (   V,
  C 
)    (V)->VcbCondition = (C)

Definition at line 1449 of file cdprocs.h.

◆ CopyUchar1

#define CopyUchar1 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
}
#define UNALIGNED
Definition: crtdefs.h:144
#define Dst
Definition: mesh.h:153

Definition at line 1685 of file cdprocs.h.

◆ CopyUchar2

#define CopyUchar2 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
}

Definition at line 1693 of file cdprocs.h.

◆ CopyUchar4

#define CopyUchar4 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
}

Definition at line 1701 of file cdprocs.h.

◆ CopyUshort2

#define CopyUshort2 (   Dst,
  Src 
)
Value:
{ \
*((USHORT2 *)(Dst)) = *((UNALIGNED USHORT2 *)(Src));\
}

Definition at line 1710 of file cdprocs.h.

◆ INLINE

#define INLINE   __inline

Definition at line 38 of file cdprocs.h.

◆ LlBlockAlign

#define LlBlockAlign (   V,
  L 
)
Value:
( \
((LONGLONG)(L) + (V)->BlockMask) & (LONGLONG)((LONG)(V)->BlockInverseMask) \
)
long LONG
Definition: pedump.c:60
int64_t LONGLONG
Definition: typedefs.h:68

Definition at line 1646 of file cdprocs.h.

◆ LlBytesFromBlocks

#define LlBytesFromBlocks (   V,
  B 
)
Value:
( \
Int64ShllMod32( (LONGLONG) (B), (V)->BlockToByteShift ) \
)

Definition at line 1634 of file cdprocs.h.

◆ LlBytesFromSectors

#define LlBytesFromSectors (   L)
Value:
( \
Int64ShllMod32( (LONGLONG)(L), SECTOR_SHIFT ) \
)

Definition at line 1614 of file cdprocs.h.

◆ LlSectorAlign

#define LlSectorAlign (   L)
Value:
( \
((((LONGLONG)(L)) + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1)) \
)
#define SECTOR_SIZE
Definition: fs.h:22

Definition at line 1584 of file cdprocs.h.

◆ LlSectorsFromBytes

#define LlSectorsFromBytes (   L)
Value:
( \
Int64ShraMod32( (LONGLONG)(L), SECTOR_SHIFT ) \
)

Definition at line 1618 of file cdprocs.h.

◆ LlSectorTruncate

#define LlSectorTruncate (   L)
Value:
( \
((LONGLONG)(L)) & ~(SECTOR_SIZE - 1) \
)

Definition at line 1592 of file cdprocs.h.

◆ LongAlign

#define LongAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 3) & 0xfffffffc) \
)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898

Definition at line 1563 of file cdprocs.h.

◆ Max

#define Max (   a,
  b 
)    ((a) > (b) ? (a) : (b))

Definition at line 78 of file cdprocs.h.

◆ Min

#define Min (   a,
  b 
)    ((a) < (b) ? (a) : (b))

Definition at line 74 of file cdprocs.h.

◆ PtrOffset

#define PtrOffset (   BASE,
  OFFSET 
)    ((ULONG)((ULONG_PTR)(OFFSET) - (ULONG_PTR)(BASE)))

Definition at line 1547 of file cdprocs.h.

◆ QuadAlign

#define QuadAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 7) & 0xfffffff8) \
)

Definition at line 1572 of file cdprocs.h.

◆ RawSectorAlign

#define RawSectorAlign (   B)    ((((B)+(RAW_SECTOR_SIZE - 1)) / RAW_SECTOR_SIZE) * RAW_SECTOR_SIZE)

Definition at line 1654 of file cdprocs.h.

◆ SectorAlign

#define SectorAlign (   L)
Value:
( \
((((ULONG)(L)) + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1)) \
)

Definition at line 1580 of file cdprocs.h.

◆ SectorBlockOffset

#define SectorBlockOffset (   V,
  LB 
)
Value:
( \
((ULONG) (LB)) & ((V)->BlocksPerSector - 1) \
)

Definition at line 1626 of file cdprocs.h.

◆ SectorOffset

#define SectorOffset (   L)
Value:
( \
)
#define SECTOR_MASK
Definition: cd.h:28
uint32_t ULONG_PTR
Definition: typedefs.h:65

Definition at line 1622 of file cdprocs.h.

◆ SectorsFromBytes

#define SectorsFromBytes (   L)
Value:
( \
((ULONG) (L)) >> SECTOR_SHIFT \
)

Definition at line 1600 of file cdprocs.h.

◆ SectorTruncate

#define SectorTruncate (   L)
Value:
( \
((ULONG)(L)) & ~(SECTOR_SIZE - 1) \
)

Definition at line 1588 of file cdprocs.h.

◆ SwapCopyUchar4

#define SwapCopyUchar4 (   Dst,
  Src 
)
Value:
{ \
*((UNALIGNED UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src) + 3); \
*((UNALIGNED UCHAR1 *)(Dst) + 1) = *((UNALIGNED UCHAR1 *)(Src) + 2); \
*((UNALIGNED UCHAR1 *)(Dst) + 2) = *((UNALIGNED UCHAR1 *)(Src) + 1); \
*((UNALIGNED UCHAR1 *)(Dst) + 3) = *((UNALIGNED UCHAR1 *)(Src)); \
}

Definition at line 1719 of file cdprocs.h.

◆ TAG_CCB

#define TAG_CCB   'ccdC'

Definition at line 85 of file cdprocs.h.

◆ TAG_CDROM_TOC

#define TAG_CDROM_TOC   'ctdC'

Definition at line 86 of file cdprocs.h.

◆ TAG_DIRENT_NAME

#define TAG_DIRENT_NAME   'nddC'

Definition at line 87 of file cdprocs.h.

◆ TAG_ENUM_EXPRESSION

#define TAG_ENUM_EXPRESSION   'eedC'

Definition at line 88 of file cdprocs.h.

◆ TAG_FCB_DATA

#define TAG_FCB_DATA   'dfdC'

Definition at line 89 of file cdprocs.h.

◆ TAG_FCB_INDEX

#define TAG_FCB_INDEX   'ifdC'

Definition at line 90 of file cdprocs.h.

◆ TAG_FCB_NONPAGED

#define TAG_FCB_NONPAGED   'nfdC'

Definition at line 91 of file cdprocs.h.

◆ TAG_FCB_TABLE

#define TAG_FCB_TABLE   'tfdC'

Definition at line 92 of file cdprocs.h.

◆ TAG_FILE_NAME

#define TAG_FILE_NAME   'nFdC'

Definition at line 93 of file cdprocs.h.

◆ TAG_GEN_SHORT_NAME

#define TAG_GEN_SHORT_NAME   'sgdC'

Definition at line 94 of file cdprocs.h.

◆ TAG_IO_BUFFER

#define TAG_IO_BUFFER   'fbdC'

Definition at line 95 of file cdprocs.h.

◆ TAG_IO_CONTEXT

#define TAG_IO_CONTEXT   'oidC'

Definition at line 96 of file cdprocs.h.

◆ TAG_IRP_CONTEXT

#define TAG_IRP_CONTEXT   'cidC'

Definition at line 97 of file cdprocs.h.

◆ TAG_IRP_CONTEXT_LITE

#define TAG_IRP_CONTEXT_LITE   'lidC'

Definition at line 98 of file cdprocs.h.

◆ TAG_MCB_ARRAY

#define TAG_MCB_ARRAY   'amdC'

Definition at line 99 of file cdprocs.h.

◆ TAG_PATH_ENTRY_NAME

#define TAG_PATH_ENTRY_NAME   'nPdC'

Definition at line 100 of file cdprocs.h.

◆ TAG_PREFIX_ENTRY

#define TAG_PREFIX_ENTRY   'epdC'

Definition at line 101 of file cdprocs.h.

◆ TAG_PREFIX_NAME

#define TAG_PREFIX_NAME   'npdC'

Definition at line 102 of file cdprocs.h.

◆ TAG_SPANNING_PATH_TABLE

#define TAG_SPANNING_PATH_TABLE   'psdC'

Definition at line 103 of file cdprocs.h.

◆ TAG_UPCASE_NAME

#define TAG_UPCASE_NAME   'nudC'

Definition at line 104 of file cdprocs.h.

◆ TAG_VOL_DESC

#define TAG_VOL_DESC   'dvdC'

Definition at line 105 of file cdprocs.h.

◆ TAG_VPB

#define TAG_VPB   'pvdC'

Definition at line 106 of file cdprocs.h.

◆ try_leave

#define try_leave (   S)    { S; leave; }

Definition at line 2180 of file cdprocs.h.

◆ try_return

#define try_return (   S)    { S; goto try_exit; }

Definition at line 2179 of file cdprocs.h.

◆ WordAlign

#define WordAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 1) & 0xfffffffe) \
)

Definition at line 1554 of file cdprocs.h.

Typedef Documentation

◆ PTYPE_OF_ACQUIRE

◆ PTYPE_OF_OPEN

Definition at line 581 of file cdprocs.h.

◆ PUCHAR1

typedef union _UCHAR1 * PUCHAR1

◆ PUCHAR2

typedef union _UCHAR2 * PUCHAR2

◆ PUCHAR4

typedef union _UCHAR4 * PUCHAR4

◆ PUSHORT2

typedef union _USHORT2 * PUSHORT2

◆ TYPE_OF_ACQUIRE

◆ TYPE_OF_OPEN

◆ UCHAR1

typedef union _UCHAR1 UCHAR1

◆ UCHAR2

typedef union _UCHAR2 UCHAR2

◆ UCHAR4

typedef union _UCHAR4 UCHAR4

◆ USHORT2

typedef union _USHORT2 USHORT2

Enumeration Type Documentation

◆ _TYPE_OF_ACQUIRE

Enumerator
AcquireExclusive 
AcquireShared 
AcquireSharedStarveExclusive 

Definition at line 827 of file cdprocs.h.

827 {
828
832
enum _TYPE_OF_ACQUIRE * PTYPE_OF_ACQUIRE
enum _TYPE_OF_ACQUIRE TYPE_OF_ACQUIRE
@ AcquireShared
Definition: cdprocs.h:830
@ AcquireExclusive
Definition: cdprocs.h:829
@ AcquireSharedStarveExclusive
Definition: cdprocs.h:831

◆ _TYPE_OF_OPEN

Enumerator
UnopenedFileObject 
StreamFileOpen 
UserVolumeOpen 
UserDirectoryOpen 
UserFileOpen 
BeyondValidType 
UnopenedFileObject 
UserFileOpen 
UserDirectoryOpen 
UserVolumeOpen 
VirtualVolumeFile 
DirectoryFile 
EaFile 

Definition at line 571 of file cdprocs.h.

571 {
572
579
@ BeyondValidType
Definition: cdprocs.h:578
@ UnopenedFileObject
Definition: cdprocs.h:573
@ StreamFileOpen
Definition: cdprocs.h:574
@ UserDirectoryOpen
Definition: cdprocs.h:576
@ UserFileOpen
Definition: cdprocs.h:577
enum _TYPE_OF_OPEN TYPE_OF_OPEN

Function Documentation

◆ _At_() [1/6]

_At_ ( Dirent->  CdTime,
_Post_notnull_   
)

◆ _At_() [2/6]

_At_ ( Fcb  ,
_In_   
)

◆ _At_() [3/6]

_At_ ( Fcb  ,
_Outptr_   
)

◆ _At_() [4/6]

_At_ ( Fcb->  NodeByteSize,
_In_range_(>=, FIELD_OFFSET(FCB, FcbType))   
)

◆ _At_() [5/6]

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

◆ _At_() [6/6]

_At_ ( IrpContext  ,
_Pre_notnull_   
)

◆ _CdFreePool()

static INLINE VOID _CdFreePool ( _Inout_ _At_(*, Mem  _Post_null_)
static

Definition at line 2195 of file cdprocs.h.

2198{
2199 if (*Pool != NULL) {
2200
2201 ExFreePool(*Pool);
2202 *Pool = NULL;
2203 }
2204}
Definition: bufpool.h:50
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

◆ _Function_class_()

_Function_class_ ( FAST_IO_RELEASE_FILE  )

Definition at line 366 of file resrcsup.c.

391{
392 PAGED_CODE();
393
394 //
395 // Release the resources.
396 //
397
398 ExReleaseResourceLite( &((PFCB) FileObject->FsContext)->FcbNonpaged->FcbResource );
399 ExReleaseResourceLite( ((PFCB) FileObject->FsContext)->Resource);
400}
#define PAGED_CODE()
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
Definition: cdstruc.h:902
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550

◆ _Inout_updates_bytes_()

_Inout_updates_bytes_ ( Fcb->  NodeByteSize)

Definition at line 631 of file allocsup.c.

654{
655 PAGED_CODE();
656
657 UNREFERENCED_PARAMETER( IrpContext );
658
659 ASSERT_IRP_CONTEXT( IrpContext );
660 ASSERT_FCB( Fcb );
661
662 //
663 // Set the entry counts to show there is one entry in the array and
664 // it is unused.
665 //
666
669
671
672 return;
673}
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:248
#define ASSERT_FCB(F)
Definition: cddata.h:243
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
ULONG CurrentEntryCount
Definition: cdstruc.h:189
ULONG MaximumEntryCount
Definition: cdstruc.h:188
struct _CD_MCB_ENTRY * McbArray
Definition: cdstruc.h:195
CD_MCB Mcb
Definition: cdstruc.h:1016
CD_MCB_ENTRY McbEntry
Definition: cdstruc.h:1015

◆ _IRQL_requires_max_()

_IRQL_requires_max_ ( APC_LEVEL  )

Definition at line 37 of file cddata.c.

254{
255 THREAD_CONTEXT ThreadContext = {0};
256 PIRP_CONTEXT IrpContext = NULL;
258
259#ifdef CD_SANITY
260 PVOID PreviousTopLevel;
261#endif
262
264
265#if DBG
266
267 KIRQL SaveIrql = KeGetCurrentIrql();
268
269#endif
270
272
274
276
277#ifdef CD_SANITY
278 PreviousTopLevel = IoGetTopLevelIrp();
279#endif
280
281 //
282 // Loop until this request has been completed or posted.
283 //
284
285 do {
286
287 //
288 // Use a try-except to handle the exception cases.
289 //
290
291 _SEH2_TRY {
292
293 //
294 // If the IrpContext is NULL then this is the first pass through
295 // this loop.
296 //
297
298 if (IrpContext == NULL) {
299
300 //
301 // Decide if this request is waitable an allocate the IrpContext.
302 // If the file object in the stack location is NULL then this
303 // is a mount which is always waitable. Otherwise we look at
304 // the file object flags.
305 //
306
308
309 Wait = TRUE;
310
311 } else {
312
313 Wait = CanFsdWait( Irp );
314 }
315
316 IrpContext = CdCreateIrpContext( Irp, Wait );
317
318 //
319 // Update the thread context information.
320 //
321
322 CdSetThreadContext( IrpContext, &ThreadContext );
323
324#ifdef CD_SANITY
325 NT_ASSERT( !CdTestTopLevel ||
326 SafeNodeType( IrpContext->TopLevel ) == CDFS_NTC_IRP_CONTEXT );
327#endif
328
329 //
330 // Otherwise cleanup the IrpContext for the retry.
331 //
332
333 } else {
334
335 //
336 // Set the MORE_PROCESSING flag to make sure the IrpContext
337 // isn't inadvertently deleted here. Then cleanup the
338 // IrpContext to perform the retry.
339 //
340
341 SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_MORE_PROCESSING );
342 CdCleanupIrpContext( IrpContext, FALSE );
343 }
344
345 //
346 // Case on the major irp code.
347 //
348
349 switch (IrpContext->MajorFunction) {
350
351 case IRP_MJ_CREATE :
352
353 Status = CdCommonCreate( IrpContext, Irp );
354 break;
355
356 case IRP_MJ_CLOSE :
357
358 Status = CdCommonClose( IrpContext, Irp );
359 break;
360
361 case IRP_MJ_READ :
362
363 //
364 // If this is an Mdl complete request, don't go through
365 // common read.
366 //
367
368 if (FlagOn( IrpContext->MinorFunction, IRP_MN_COMPLETE )) {
369
370 Status = CdCompleteMdl( IrpContext, Irp );
371
372 } else {
373
374 Status = CdCommonRead( IrpContext, Irp );
375 }
376
377 break;
378
379 case IRP_MJ_WRITE :
380
381 Status = CdCommonWrite( IrpContext, Irp );
382 break;
383
385
386 Status = CdCommonQueryInfo( IrpContext, Irp );
387 break;
388
390
391 Status = CdCommonSetInfo( IrpContext, Irp );
392 break;
393
395
396 Status = CdCommonQueryVolInfo( IrpContext, Irp );
397 break;
398
400
401 Status = CdCommonDirControl( IrpContext, Irp );
402 break;
403
405
406 Status = CdCommonFsControl( IrpContext, Irp );
407 break;
408
410
411 Status = CdCommonDevControl( IrpContext, Irp );
412 break;
413
415
416 Status = CdCommonLockControl( IrpContext, Irp );
417 break;
418
419 case IRP_MJ_CLEANUP :
420
421 Status = CdCommonCleanup( IrpContext, Irp );
422 break;
423
424 case IRP_MJ_PNP :
425
426 Status = CdCommonPnp( IrpContext, Irp );
427 break;
428
429 case IRP_MJ_SHUTDOWN :
430
431 Status = CdCommonShutdown( IrpContext, Irp );
432 break;
433
434 default :
435
437 CdCompleteRequest( IrpContext, Irp, Status );
438 }
439
441
442 Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() );
443 } _SEH2_END;
444
445 } while (Status == STATUS_CANT_WAIT);
446
447#ifdef CD_SANITY
448 NT_ASSERT( !CdTestTopLevel ||
449 (PreviousTopLevel == IoGetTopLevelIrp()) );
450#endif
451
453
454 NT_ASSERT( SaveIrql == KeGetCurrentIrql( ));
455
456 return Status;
457}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
Definition: cddata.c:914
LONG CdExceptionFilter(_Inout_ PIRP_CONTEXT IrpContext, _In_ PEXCEPTION_POINTERS ExceptionPointer)
Definition: cddata.c:525
VOID CdSetThreadContext(_Inout_ PIRP_CONTEXT IrpContext, _In_ PTHREAD_CONTEXT ThreadContext)
Definition: cddata.c:981
#define ASSERT_OPTIONAL_IRP(I)
Definition: cddata.h:251
NTSTATUS CdCompleteMdl(_In_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: cachesup.c:411
VOID CdCleanupIrpContext(_In_ PIRP_CONTEXT IrpContext, _In_ BOOLEAN Post)
Definition: strucsup.c:1733
#define CanFsdWait(I)
Definition: cdprocs.h:2001
NTSTATUS CdCommonLockControl(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: lockctrl.c:35
NTSTATUS CdCommonDevControl(_Inout_ PIRP_CONTEXT IrpContext, _Inout_ PIRP Irp)
Definition: devctrl.c:46
_Ret_valid_ PIRP_CONTEXT CdCreateIrpContext(_In_ PIRP Irp, _In_ BOOLEAN Wait)
Definition: strucsup.c:1573
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define IRP_CONTEXT_FLAG_MORE_PROCESSING
Definition: cdstruc.h:1214
#define CDFS_NTC_IRP_CONTEXT
Definition: nodetype.h:34
#define SafeNodeType(Ptr)
Definition: nodetype.h:54
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
Status
Definition: gdiplustypes.h:25
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
#define STATUS_CANT_WAIT
Definition: ntstatus.h:452
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:158
#define IRP_MJ_DIRECTORY_CONTROL
Definition: rdpdr.c:51
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_QUERY_VOLUME_INFORMATION
Definition: rdpdr.c:50
#define IRP_MJ_LOCK_CONTROL
Definition: rdpdr.c:53
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define IRP_MJ_SET_INFORMATION
Definition: rdpdr.c:49
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define IRP_MJ_QUERY_INFORMATION
Definition: rdpdr.c:48
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IRP_MN_COMPLETE
Definition: iotypes.h:4420
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MJ_SHUTDOWN
#define IRP_MJ_CLEANUP

◆ _Post_satisfies_()

_Post_satisfies_ ( _Old_(CdName->FileName.Length) >=CdName->FileName.Length+CdName->VersionString.  Length)

◆ _Requires_lock_held_()

_Requires_lock_held_ ( _Global_critical_region_  )

◆ _Success_()

_Success_ ( return = FALSE)
Initial value:
BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3139
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REG_SZ
Definition: layer.c:22
#define _Out_opt_
Definition: ms_sal.h:346
#define _Post_valid_
Definition: ms_sal.h:694
#define _At_(target, annos)
Definition: ms_sal.h:244
#define _When_(expr, annos)
Definition: ms_sal.h:254
#define _Out_writes_bytes_to_opt_(size, count)
Definition: ms_sal.h:361
#define _In_
Definition: ms_sal.h:308
#define REG_MULTI_SZ
Definition: nt_native.h:1501
_NullNull_terminated_ CHAR * PZZSTR
Definition: ntbasedef.h:399
BYTE * PBYTE
Definition: pedump.c:66
DWORD * PDWORD
Definition: pedump.c:68
_In_ DWORD _Out_opt_ PDWORD PropertyRegDataType
Definition: setupapi.h:1551
#define WINSETUPAPI
Definition: setupapi.h:15
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1528
_In_ DWORD _Out_opt_ PDWORD _In_ DWORD PropertyBufferSize
Definition: setupapi.h:1553
char * PSTR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4437
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4439
#define WINAPI
Definition: msvc.h:6

Definition at line 3139 of file fsctrl.c.

3189{
3191
3192 PVPB Vpb = Vcb->Vpb;
3193 PVPB OldVpb;
3194
3195 BOOLEAN Remount = FALSE;
3196
3197 PAGED_CODE();
3198
3199 UNREFERENCED_PARAMETER( IrpContext );
3200
3201 //
3202 // Check whether we are looking for a device only Mvcb.
3203 //
3204
3205 for (Link = CdData.VcbQueue.Flink;
3206 Link != &CdData.VcbQueue;
3207 Link = Link->Flink) {
3208
3209 *OldVcb = CONTAINING_RECORD( Link, VCB, VcbLinks );
3210
3211 //
3212 // Skip ourselves.
3213 //
3214
3215 if (Vcb == *OldVcb) { continue; }
3216
3217 //
3218 // Look at the Vpb and state of the previous Vcb.
3219 //
3220
3221 OldVpb = (*OldVcb)->Vpb;
3222
3223 if ((OldVpb != Vpb) &&
3224 (OldVpb->RealDevice == Vpb->RealDevice) &&
3225 ((*OldVcb)->VcbCondition == VcbNotMounted)) {
3226
3227 //
3228 // If the current disk is a raw disk then it can match a previous music or
3229 // raw disk.
3230 //
3231
3232 if (FlagOn( Vcb->VcbState, VCB_STATE_AUDIO_DISK)) {
3233
3234 if (FlagOn( (*OldVcb)->VcbState, VCB_STATE_AUDIO_DISK )) {
3235
3236 //
3237 // If we have both TOC then fail the remount if the lengths
3238 // are different or they don't match.
3239 //
3240
3241 if ((Vcb->TocLength != (*OldVcb)->TocLength) ||
3242 ((Vcb->TocLength != 0) &&
3243 !RtlEqualMemory( Vcb->CdromToc,
3244 (*OldVcb)->CdromToc,
3245 Vcb->TocLength ))) {
3246
3247 continue;
3248 }
3249
3250 Remount = TRUE;
3251 break;
3252 }
3253
3254 //
3255 // The current disk is not a raw disk. Go ahead and compare
3256 // serial numbers, volume label and TOC.
3257 //
3258
3259 }
3260 else if ((OldVpb->SerialNumber == Vpb->SerialNumber) &&
3261 (Vcb->TocLength == (*OldVcb)->TocLength) &&
3262 ((Vcb->TocLength == 0) || RtlEqualMemory( Vcb->CdromToc,
3263 (*OldVcb)->CdromToc,
3264 Vcb->TocLength )) &&
3265 (Vpb->VolumeLabelLength == OldVpb->VolumeLabelLength) &&
3266 (RtlEqualMemory( OldVpb->VolumeLabel,
3267 Vpb->VolumeLabel,
3268 Vpb->VolumeLabelLength ))) {
3269 //
3270 // Remember the old Vcb. Then set the return value to
3271 // TRUE and break.
3272 //
3273
3274 Remount = TRUE;
3275 break;
3276 }
3277 }
3278 }
3279
3280 return Remount;
3281}
#define VCB_STATE_AUDIO_DISK
Definition: cdstruc.h:712
@ VcbNotMounted
Definition: cdstruc.h:490
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1675
#define RtlEqualMemory(a, b, c)
Definition: kdvm.h:18
#define Vcb
Definition: cdprocs.h:1415
LIST_ENTRY VcbQueue
Definition: cdstruc.h:334
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: cdstruc.h:498
Definition: iotypes.h:189
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH/sizeof(WCHAR)]
Definition: iotypes.h:198
USHORT VolumeLabelLength
Definition: iotypes.h:193
ULONG SerialNumber
Definition: iotypes.h:196
struct _DEVICE_OBJECT * RealDevice
Definition: iotypes.h:195
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
static int Link(const char **args)
Definition: vfdcmd.c:2414

◆ _When_() [1/6]

◆ _When_() [2/6]

_When_ ( RaiseOnError||  return,
_At_(Fcb->FileLock, _Post_notnull_  
)

◆ _When_() [3/6]

_At_ Ccb _When_ ( return = UnopenedFileObject,
_At_(Ccb, _Outptr_  
)

◆ _When_() [4/6]

_When_ ( return  = UnopenedFileObject,
_At_ *,  _Post_null_ 
)

◆ _When_() [5/6]

◆ _When_() [6/6]

_When_ ( TypeOfOpen  = UnopenedFileObject,
_At_(Fcb, _In_opt_  
)

◆ CdAcquireForCache()

_Acquires_shared_lock_ Fcb BOOLEAN NTAPI CdAcquireForCache ( _Inout_ PFCB  Fcb,
_In_ BOOLEAN  Wait 
)

Referenced by CdInitializeGlobalData().

◆ CdAddAllocationFromDirent()

VOID CdAddAllocationFromDirent ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFCB  Fcb,
_In_ ULONG  McbEntryOffset,
_In_ LONGLONG  StartingFileOffset,
_In_ PDIRENT  Dirent 
)

Definition at line 335 of file allocsup.c.

368{
369 ULONG NewArraySize;
370 PVOID NewMcbArray;
371 PCD_MCB_ENTRY McbEntry;
372
373 PAGED_CODE();
374
375 UNREFERENCED_PARAMETER( IrpContext );
376
377 ASSERT_IRP_CONTEXT( IrpContext );
378 ASSERT_FCB( Fcb );
380
381 //
382 // If we need to grow the Mcb then do it now.
383 //
384
385 if (McbEntryOffset >= Fcb->Mcb.MaximumEntryCount) {
386
387 //
388 // Allocate a new buffer and copy the old data over.
389 //
390
391 NewArraySize = Fcb->Mcb.MaximumEntryCount * 2 * sizeof( CD_MCB_ENTRY );
392
394 NewArraySize,
396
397 RtlZeroMemory( NewMcbArray, NewArraySize );
398 RtlCopyMemory( NewMcbArray,
401
402 //
403 // Deallocate the current array unless it is embedded in the Fcb.
404 //
405
406 if (Fcb->Mcb.MaximumEntryCount != 1) {
407
409 }
410
411 //
412 // Now update the Mcb with the new array.
413 //
414
416 Fcb->Mcb.McbArray = NewMcbArray;
417 }
418
419 //
420 // Update the new entry with the input data.
421 //
422
423 McbEntry = Fcb->Mcb.McbArray + McbEntryOffset;
424
425 //
426 // Start with the location and length on disk.
427 //
428
429 McbEntry->DiskOffset = LlBytesFromBlocks( Fcb->Vcb, Dirent->StartingOffset );
430 McbEntry->ByteCount = Dirent->DataLength;
431
432 //
433 // Round the byte count up to a logical block boundary if this is
434 // the last extent.
435 //
436
437 if (!FlagOn( Dirent->DirentFlags, CD_ATTRIBUTE_MULTI )) {
438
439 McbEntry->ByteCount = BlockAlign( Fcb->Vcb, McbEntry->ByteCount );
440 }
441
442 //
443 // The file offset is the logical position within this file.
444 // We know this is correct regardless of whether we bias the
445 // file size or disk offset.
446 //
447
448 McbEntry->FileOffset = StartingFileOffset;
449
450 //
451 // Convert the interleave information from logical blocks to
452 // bytes.
453 //
454
455 if (Dirent->FileUnitSize != 0) {
456
457 McbEntry->DataBlockByteCount = LlBytesFromBlocks( Fcb->Vcb, Dirent->FileUnitSize );
458 McbEntry->TotalBlockByteCount = McbEntry->DataBlockByteCount +
459 LlBytesFromBlocks( Fcb->Vcb, Dirent->InterleaveGapSize );
460
461 //
462 // If the file is not interleaved then the size of the data block
463 // and total block are the same as the byte count.
464 //
465
466 } else {
467
468 McbEntry->DataBlockByteCount =
469 McbEntry->TotalBlockByteCount = McbEntry->ByteCount;
470 }
471
472 //
473 // Update the number of entries in the Mcb. The Mcb is never sparse
474 // so whenever we add an entry it becomes the last entry in the Mcb.
475 //
476
477 Fcb->Mcb.CurrentEntryCount = McbEntryOffset + 1;
478
479 return;
480}
#define CD_ATTRIBUTE_MULTI
Definition: cd.h:356
#define ASSERT_LOCKED_FCB(F)
Definition: cddata.h:266
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: cdprocs.h:427
#define BlockAlign(V, L)
Definition: cdprocs.h:1638
#define TAG_MCB_ARRAY
Definition: cdprocs.h:99
#define LlBytesFromBlocks(V, B)
Definition: cdprocs.h:1634
#define CdFreePool(x)
Definition: cdprocs.h:2190
#define CdPagedPool
Definition: cdprocs.h:1380
struct _CD_MCB_ENTRY CD_MCB_ENTRY
Definition: cdstruc.h:200
LONGLONG ByteCount
Definition: cdstruc.h:209
LONGLONG TotalBlockByteCount
Definition: cdstruc.h:224
LONGLONG DiskOffset
Definition: cdstruc.h:208
LONGLONG DataBlockByteCount
Definition: cdstruc.h:223
LONGLONG FileOffset
Definition: cdstruc.h:215
PVCB Vcb
Definition: cdstruc.h:933
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by _Requires_lock_held_(), and CdInitializeFcbFromFileContext().

◆ CdAddInitialAllocation()

VOID CdAddInitialAllocation ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFCB  Fcb,
_In_ ULONG  StartingBlock,
_In_ LONGLONG  DataLength 
)

Definition at line 484 of file allocsup.c.

519{
520 PCD_MCB_ENTRY McbEntry;
521
522 PAGED_CODE();
523
524 UNREFERENCED_PARAMETER( IrpContext );
525
526 ASSERT_IRP_CONTEXT( IrpContext );
527 ASSERT_FCB( Fcb );
530 NT_ASSERT( CDFS_NTC_FCB_DATA != Fcb->NodeTypeCode);
531
532 //
533 // Update the new entry with the input data.
534 //
535
536 McbEntry = Fcb->Mcb.McbArray;
537
538 //
539 // Start with the location and length on disk.
540 //
541
542 McbEntry->DiskOffset = LlBytesFromBlocks( Fcb->Vcb, StartingBlock );
543 McbEntry->DiskOffset -= Fcb->StreamOffset;
544
545 McbEntry->ByteCount = DataLength;
546
547 //
548 // The file offset is the logical position within this file.
549 // We know this is correct regardless of whether we bias the
550 // file size or disk offset.
551 //
552
553 McbEntry->FileOffset = 0;
554
555 //
556 // If the file is not interleaved then the size of the data block
557 // and total block are the same as the byte count.
558 //
559
560 McbEntry->DataBlockByteCount =
561 McbEntry->TotalBlockByteCount = McbEntry->ByteCount;
562
563 //
564 // Update the number of entries in the Mcb. The Mcb is never sparse
565 // so whenever we add an entry it becomes the last entry in the Mcb.
566 //
567
569
570 return;
571}
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
#define CDFS_NTC_FCB_DATA
Definition: nodetype.h:31

Referenced by CdCreateInternalStream(), CdInitializeFcbFromPathEntry(), and CdUpdateVcbFromVolDescriptor().

◆ 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}
PAGED_CODE()
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG _Inout_ PFILE_ENUM_CONTEXT FileContext
Definition: dirsup.c:1148
#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().

◆ CdCleanupIrpContext()

VOID CdCleanupIrpContext ( _In_ PIRP_CONTEXT  IrpContext,
_In_ BOOLEAN  Post 
)

Definition at line 1733 of file strucsup.c.

1757{
1758 PAGED_CODE();
1759
1760 //
1761 // If we aren't doing more processing then deallocate this as appropriate.
1762 //
1763
1764 if (!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_MORE_PROCESSING)) {
1765
1766 //
1767 // If this context is the top level CDFS context then we need to
1768 // restore the top level thread context.
1769 //
1770
1771 if (IrpContext->ThreadContext != NULL) {
1772
1773 CdRestoreThreadContext( IrpContext );
1774 }
1775
1776 //
1777 // Deallocate the Io context if allocated.
1778 //
1779
1780 if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_ALLOC_IO )) {
1781
1782 CdFreeIoContext( IrpContext->IoContext );
1783 }
1784
1785 //
1786 // Deallocate the IrpContext if not from the stack.
1787 //
1788
1789 if (!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_ON_STACK )) {
1790
1792
1793 CdLockCdData();
1794
1797
1799
1800 } else {
1801
1802 //
1803 // We couldn't add this to our lookaside list so free it to
1804 // pool.
1805 //
1806
1807 CdFreePool( &IrpContext );
1808 }
1809 }
1810
1811 //
1812 // Clear the appropriate flags.
1813 //
1814
1815 } else if (Post) {
1816
1817 //
1818 // If this context is the top level CDFS context then we need to
1819 // restore the top level thread context.
1820 //
1821
1822 if (IrpContext->ThreadContext != NULL) {
1823
1824 CdRestoreThreadContext( IrpContext );
1825 }
1826
1827 ClearFlag( IrpContext->Flags, IRP_CONTEXT_FLAGS_CLEAR_ON_POST );
1828
1829 } else {
1830
1831 ClearFlag( IrpContext->Flags, IRP_CONTEXT_FLAGS_CLEAR_ON_RETRY );
1832 }
1833
1834 return;
1835}
#define CdUnlockCdData()
Definition: cdprocs.h:1019
#define CdLockCdData()
Definition: cdprocs.h:1015
#define CdFreeIoContext(IO)
Definition: cdprocs.h:1349
#define CdRestoreThreadContext(IC)
Definition: cdprocs.h:1983
#define IRP_CONTEXT_FLAG_ON_STACK
Definition: cdstruc.h:1213
#define IRP_CONTEXT_FLAG_ALLOC_IO
Definition: cdstruc.h:1221
#define IRP_CONTEXT_FLAGS_CLEAR_ON_RETRY
Definition: cdstruc.h:1251
#define IRP_CONTEXT_FLAGS_CLEAR_ON_POST
Definition: cdstruc.h:1236
#define ClearFlag(_F, _SF)
Definition: ext2fs.h:191
ULONG IrpContextDepth
Definition: cdstruc.h:342
ULONG IrpContextMaxDepth
Definition: cdstruc.h:343
SINGLE_LIST_ENTRY IrpContextList
Definition: cdstruc.h:344
Definition: ntbasedef.h:628
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)
Definition: rtlfuncs.h:253

Referenced by _IRQL_requires_max_(), CdCompleteRequest(), CdFspDispatch(), and CdQueueClose().

◆ CdCommonDevControl()

NTSTATUS CdCommonDevControl ( _Inout_ PIRP_CONTEXT  IrpContext,
_Inout_ PIRP  Irp 
)

Definition at line 46 of file devctrl.c.

61{
63
65 PFCB Fcb;
66 PCCB Ccb;
67
69 PIO_STACK_LOCATION NextIrpSp;
70
71 PAGED_CODE();
72
73 //
74 // Extract and decode the file object.
75 //
76
78
79 TypeOfOpen = CdDecodeFileObject( IrpContext,
81 &Fcb,
82 &Ccb );
83
84 //
85 // The only type of opens we accept are user volume opens.
86 //
87
89
92 }
93
94 if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_CDROM_READ_TOC) {
95
96 //
97 // Verify the Vcb in this case to detect if the volume has changed.
98 //
99
100 CdVerifyVcb( IrpContext, Fcb->Vcb );
101
102 //
103 // Handle the case of the disk type ourselves.
104 //
105
106 } else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_CDROM_DISK_TYPE) {
107
108 //
109 // Verify the Vcb in this case to detect if the volume has changed.
110 //
111
112 CdVerifyVcb( IrpContext, Fcb->Vcb );
113
114 //
115 // Check the size of the output buffer.
116 //
117
118 if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof( CDROM_DISK_DATA )) {
119
122 }
123
124 //
125 // Copy the data from the Vcb.
126 //
127
128 ((PCDROM_DISK_DATA) Irp->AssociatedIrp.SystemBuffer)->DiskData = Fcb->Vcb->DiskFlags;
129
130 Irp->IoStatus.Information = sizeof( CDROM_DISK_DATA );
131 CdCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
132 return STATUS_SUCCESS;
133 }
134
135 //
136 // Get the next stack location, and copy over the stack parameter
137 // information.
138 //
139
140 NextIrpSp = IoGetNextIrpStackLocation( Irp );
141
142 *NextIrpSp = *IrpSp;
143
144 //
145 // Set up the completion routine
146 //
147
150 NULL,
151 TRUE,
152 TRUE,
153 TRUE );
154
155 //
156 // Send the request.
157 //
158
159 Status = IoCallDriver( IrpContext->Vcb->TargetDeviceObject, Irp );
160
161 //
162 // Cleanup our Irp Context. The driver has completed the Irp.
163 //
164
165 CdCompleteRequest( IrpContext, NULL, STATUS_SUCCESS );
166
167 return Status;
168}
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:589
VOID CdVerifyVcb(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb)
Definition: verfysup.c:411
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
IO_COMPLETION_ROUTINE CdDevCtrlCompletionRoutine
Definition: devctrl.c:30
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
struct _CDROM_DISK_DATA * PCDROM_DISK_DATA
#define IOCTL_CDROM_DISK_TYPE
Definition: ntddcdrm.h:70
struct _CDROM_DISK_DATA CDROM_DISK_DATA
#define IOCTL_CDROM_READ_TOC
Definition: ntddcdrm.h:34
#define IoCallDriver
Definition: irp.c:1225
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
Definition: cdstruc.h:1067
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
ULONG DiskFlags
Definition: cdstruc.h:640
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695

Referenced by _IRQL_requires_max_(), and CdFspDispatch().

◆ CdCommonLockControl()

NTSTATUS CdCommonLockControl ( _Inout_ PIRP_CONTEXT  IrpContext,
_Inout_ PIRP  Irp 
)

Definition at line 35 of file lockctrl.c.

57{
60
62 PFCB Fcb;
63 PCCB Ccb;
64
65 PAGED_CODE();
66
67 //
68 // Extract and decode the type of file object we're being asked to process
69 //
70
71 TypeOfOpen = CdDecodeFileObject( IrpContext, IrpSp->FileObject, &Fcb, &Ccb );
72
73 //
74 // If the file is not a user file open then we reject the request
75 // as an invalid parameter
76 //
77
78 if (TypeOfOpen != UserFileOpen) {
79
82 }
83
84 //
85 // We check whether we can proceed based on the state of the file oplocks.
86 // This call might post the irp for us.
87 //
88
90 Irp,
91 IrpContext,
92 (PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
93 NULL );
94
95 //
96 // If we don't get success then the oplock package completed the request.
97 //
98
99 if (Status != STATUS_SUCCESS) {
100
101 return Status;
102 }
103
104 //
105 // Verify the Fcb.
106 //
107
108 CdVerifyFcbOperation( IrpContext, Fcb );
109
110 //
111 // If we don't have a file lock, then get one now.
112 //
113
114 if (Fcb->FileLock == NULL) { CdCreateFileLock( IrpContext, Fcb, TRUE ); }
115
116 //
117 // Now call the FsRtl routine to do the actual processing of the
118 // Lock request
119 //
120
122
123 //
124 // Set the flag indicating if Fast I/O is possible
125 //
126
127 CdLockFcb( IrpContext, Fcb );
128 Fcb->IsFastIoPossible = CdIsFastIoPossible( Fcb );
129 CdUnlockFcb( IrpContext, Fcb );
130
131 //
132 // Complete the request.
133 //
134
135 CdCompleteRequest( IrpContext, NULL, Status );
136 return Status;
137}
#define CdLockFcb(IC, F)
Definition: cdprocs.h:1044
BOOLEAN CdVerifyFcbOperation(_In_opt_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
Definition: verfysup.c:615
#define CdIsFastIoPossible(F)
Definition: cdprocs.h:2015
#define CdUnlockFcb(IC, F)
Definition: cdprocs.h:1060
NTSTATUS NTAPI FsRtlProcessFileLock(IN PFILE_LOCK FileLock, IN PIRP Irp, IN PVOID Context OPTIONAL)
Definition: filelock.c:1152
NTSTATUS NTAPI FsRtlCheckOplock(IN POPLOCK Oplock, IN PIRP Irp, IN PVOID Context, IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL, IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL)
Definition: oplock.c:1170
FILE_LOCK FileLock
Definition: fatstruc.h:1071

Referenced by _IRQL_requires_max_(), and CdFspDispatch().

◆ CdCompleteMdl()

NTSTATUS CdCompleteMdl ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PIRP  Irp 
)

Definition at line 411 of file cachesup.c.

433{
435
436 PAGED_CODE();
437
438 //
439 // Do completion processing.
440 //
441
443
444 CcMdlReadComplete( FileObject, Irp->MdlAddress );
445
446 //
447 // Mdl is now deallocated.
448 //
449
450 Irp->MdlAddress = NULL;
451
452 //
453 // Complete the request and exit right away.
454 //
455
456 CdCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
457
458 return STATUS_SUCCESS;
459}
VOID NTAPI CcMdlReadComplete(IN PFILE_OBJECT FileObject, IN PMDL MdlChain)
Definition: mdlsup.c:75
* PFILE_OBJECT
Definition: iotypes.h:1998

Referenced by _IRQL_requires_max_().

◆ CdCompleteRequest()

VOID CdCompleteRequest ( _Inout_opt_ PIRP_CONTEXT  IrpContext,
_Inout_opt_ PIRP  Irp,
_In_ NTSTATUS  Status 
)

Definition at line 914 of file cddata.c.

939{
940 ASSERT_OPTIONAL_IRP_CONTEXT( IrpContext );
942
943 //
944 // Cleanup the IrpContext if passed in here.
945 //
946
947 if (ARGUMENT_PRESENT( IrpContext )) {
948
949 CdCleanupIrpContext( IrpContext, FALSE );
950 }
951
952 //
953 // If we have an Irp then complete the irp.
954 //
955
956 if (ARGUMENT_PRESENT( Irp )) {
957
958 //
959 // Clear the information field in case we have used this Irp
960 // internally.
961 //
962
963 if (NT_ERROR( Status ) &&
964 FlagOn( Irp->Flags, IRP_INPUT_OPERATION )) {
965
966 Irp->IoStatus.Information = 0;
967 }
968
969 Irp->IoStatus.Status = Status;
970
972
974 }
975
976 return;
977}
#define ASSERT_OPTIONAL_IRP_CONTEXT(IC)
Definition: cddata.h:249
#define AssertVerifyDeviceIrp(I)
Definition: cdprocs.h:1811
#define ARGUMENT_PRESENT(ArgumentPointer)
#define IoCompleteRequest
Definition: irp.c:1240
#define NT_ERROR(Status)
Definition: umtypes.h:106
#define IRP_INPUT_OPERATION
#define IO_CD_ROM_INCREMENT
Definition: iotypes.h:599

Referenced by _IRQL_requires_max_(), _Requires_lock_held_(), _Success_(), CdAllowExtendedDasdIo(), CdCommonDevControl(), CdCommonLockControl(), CdCompleteMdl(), CdFspDispatch(), CdIsPathnameValid(), CdIsVolumeDirty(), CdIsVolumeMounted(), and CdQueueClose().

◆ CdConvertBigToLittleEndian()

VOID CdConvertBigToLittleEndian ( _In_ PIRP_CONTEXT  IrpContext,
_In_reads_bytes_(ByteCount) PCHAR  BigEndian,
_In_ ULONG  ByteCount,
_Out_writes_bytes_(ByteCount) PCHAR  LittleEndian 
)

Definition at line 110 of file namesup.c.

140{
141 ULONG RemainingByteCount = ByteCount;
142
143 PCHAR Source = BigEndian;
144 PCHAR Destination = LittleEndian;
145
146 PAGED_CODE();
147
148 //
149 // If the byte count isn't an even number then the disk is corrupt.
150 //
151
152 if (FlagOn( ByteCount, 1 )) {
153
155 }
156
157 //
158 // Start by copy the low-order bytes into the correct position. Do
159 // this by skipping the first byte in the BigEndian string.
160 //
161
163 Source + 1,
164 RemainingByteCount - 1 );
165
166 //
167 // Now move the high-order bytes into position.
168 //
169
170 Destination += 1;
171
172 while (RemainingByteCount != 0) {
173
174#ifdef _MSC_VER
175#pragma prefast(push)
176#pragma prefast(suppress:26014, "RemainingByteCount is even")
177#endif
179#ifdef _MSC_VER
180#pragma prefast(pop)
181#endif
182
183 Source += 2;
184 Destination += 2;
185
186 RemainingByteCount -= 2;
187 }
188
189 return;
190}
PAGED_CODE()
#define CdRaiseStatus(IC, S)
Definition: cdprocs.h:1859
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3004
char * PCHAR
Definition: typedefs.h:51
#define STATUS_DISK_CORRUPT_ERROR
Definition: udferr_usr.h:147
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1099

Referenced by CdFindActiveVolDescriptor(), CdUpdateDirentName(), and CdUpdatePathEntryName().

◆ CdCreateCcb()

PCCB CdCreateCcb ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb,
_In_ ULONG  Flags 
)

Definition at line 1405 of file strucsup.c.

1429{
1430 PCCB NewCcb;
1431 PAGED_CODE();
1432
1433 UNREFERENCED_PARAMETER( IrpContext );
1434
1435 //
1436 // Allocate and initialize the structure.
1437 //
1438
1439 NewCcb = CdAllocateCcb( IrpContext );
1440
1441 RtlZeroMemory( NewCcb, sizeof( CCB ));
1442
1443 //
1444 // Set the proper node type code and node byte size
1445 //
1446
1447 NewCcb->NodeTypeCode = CDFS_NTC_CCB;
1448 NewCcb->NodeByteSize = sizeof( CCB );
1449
1450 //
1451 // Set the initial value for the flags and Fcb
1452 //
1453
1454 NewCcb->Flags = Flags;
1455 NewCcb->Fcb = Fcb;
1456
1457 return NewCcb;
1458}
#define CdAllocateCcb(IC)
Definition: strucsup.c:93
struct _CCB CCB
#define CDFS_NTC_CCB
Definition: nodetype.h:33
PFCB Fcb
Definition: cdstruc.h:1086
ULONG Flags
Definition: cdstruc.h:1080
NODE_BYTE_SIZE NodeByteSize
Definition: cdstruc.h:1074
NODE_TYPE_CODE NodeTypeCode
Definition: fatstruc.h:1366

◆ CdCreateFcb()

PFCB CdCreateFcb ( _In_ PIRP_CONTEXT  IrpContext,
_In_ FILE_ID  FileId,
_In_ NODE_TYPE_CODE  NodeTypeCode,
_Out_opt_ PBOOLEAN  FcbExisted 
)

Definition at line 986 of file strucsup.c.

1018{
1019 PFCB NewFcb;
1020 BOOLEAN LocalFcbExisted;
1021
1022 PAGED_CODE();
1023
1024 //
1025 // Use the local boolean if one was not passed in.
1026 //
1027
1028 if (!ARGUMENT_PRESENT( FcbExisted )) {
1029
1030 FcbExisted = &LocalFcbExisted;
1031 }
1032
1033 //
1034 // Maybe this is already in the table.
1035 //
1036
1037 NewFcb = CdLookupFcbTable( IrpContext, IrpContext->Vcb, FileId );
1038
1039 //
1040 // If not then create the Fcb is requested by our caller.
1041 //
1042
1043 if (NewFcb == NULL) {
1044
1045 //
1046 // Allocate and initialize the structure depending on the
1047 // type code.
1048 //
1049
1050 switch (NodeTypeCode) {
1051
1053 case CDFS_NTC_FCB_INDEX:
1054
1055 NewFcb = CdAllocateFcbIndex( IrpContext );
1056
1058
1059 NewFcb->NodeByteSize = SIZEOF_FCB_INDEX;
1060
1061 InitializeListHead( &NewFcb->FcbQueue );
1062
1063 break;
1064
1065 case CDFS_NTC_FCB_DATA :
1066
1067 NewFcb = CdAllocateFcbData( IrpContext );
1068
1069 RtlZeroMemory( NewFcb, SIZEOF_FCB_DATA );
1070
1071 NewFcb->NodeByteSize = SIZEOF_FCB_DATA;
1072
1073 break;
1074
1075 default:
1076
1077#ifdef _MSC_VER
1078#pragma prefast( suppress: __WARNING_USE_OTHER_FUNCTION, "This is a bug." )
1079#endif
1080 CdBugCheck( 0, 0, 0 );
1081 }
1082
1083 //
1084 // Now do the common initialization.
1085 //
1086
1087 NewFcb->NodeTypeCode = NodeTypeCode;
1088
1089 NewFcb->Vcb = IrpContext->Vcb;
1090 NewFcb->FileId = FileId;
1091
1092 CdInitializeMcb( IrpContext, NewFcb );
1093
1094 //
1095 // Now create the non-paged section object.
1096 //
1097
1098 NewFcb->FcbNonpaged = CdCreateFcbNonpaged( IrpContext );
1099
1100 //
1101 // Deallocate the Fcb and raise if the allocation failed.
1102 //
1103
1104 if (NewFcb->FcbNonpaged == NULL) {
1105
1106 CdFreePool( &NewFcb );
1107
1109 }
1110
1111 *FcbExisted = FALSE;
1112
1113 //
1114 // Initialize Advanced FCB Header fields
1115 //
1116
1118 FsRtlSetupAdvancedHeader( &NewFcb->Header,
1120
1121 if (NodeTypeCode == CDFS_NTC_FCB_DATA) {
1122
1124 }
1125
1126 } else {
1127
1128 *FcbExisted = TRUE;
1129 }
1130
1131 return NewFcb;
1132}
PFCB_NONPAGED CdCreateFcbNonpaged(_In_ PIRP_CONTEXT IrpContext)
Definition: strucsup.c:2555
PFCB CdLookupFcbTable(_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _In_ FILE_ID FileId)
Definition: strucsup.c:2107
#define CdAllocateFcbData(IC)
Definition: strucsup.c:75
#define CdAllocateFcbIndex(IC)
Definition: strucsup.c:81
#define SIZEOF_FCB_DATA
Definition: cdstruc.h:1056
#define SIZEOF_FCB_INDEX
Definition: cdstruc.h:1059
#define CdBugCheck(A, B, C)
Definition: nodetype.h:103
#define CDFS_NTC_FCB_PATH_TABLE
Definition: nodetype.h:29
#define CDFS_NTC_FCB_INDEX
Definition: nodetype.h:30
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
VOID NTAPI FsRtlInitializeOplock(IN OUT POPLOCK Oplock)
Definition: oplock.c:1400
FAST_MUTEX AdvancedFcbHeaderMutex
Definition: cdstruc.h:892
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:925
FILE_ID FileId
Definition: cdstruc.h:952
PFCB_NONPAGED FcbNonpaged
Definition: cdstruc.h:1003
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274

Referenced by _Requires_lock_held_(), and CdUpdateVcbFromVolDescriptor().

◆ CdCreateInternalStream()

VOID CdCreateInternalStream ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PVCB  Vcb,
_Inout_ PFCB  Fcb,
_In_ PUNICODE_STRING  Name 
)

Definition at line 38 of file cachesup.c.

66{
67 PFILE_OBJECT StreamFile = NULL;
68 BOOLEAN DecrementReference = FALSE;
69
70 BOOLEAN CleanupDirContext = FALSE;
71 BOOLEAN UpdateFcbSizes = FALSE;
72
73 DIRENT Dirent = {0};
75
76 PAGED_CODE();
77
78 ASSERT_IRP_CONTEXT( IrpContext );
79 ASSERT_FCB( Fcb );
80
81 //
82 // We may only have the Fcb shared. Lock the Fcb and do a
83 // safe test to see if we need to really create the file object.
84 //
85
86 CdLockFcb( IrpContext, Fcb );
87
88 if (Fcb->FileObject != NULL) {
89
90 CdUnlockFcb( IrpContext, Fcb );
91 return;
92 }
93
94 //
95 // Use a try-finally to facilitate cleanup.
96 //
97
98 _SEH2_TRY {
99
100 //
101 // Create the internal stream. The Vpb should be pointing at our volume
102 // device object at this point.
103 //
104
105 StreamFile = IoCreateStreamFileObjectLite( NULL, Vcb->Vpb->RealDevice );
106
107 if (StreamFile == NULL) {
108
110 }
111
112 //
113 // Initialize the fields of the file object.
114 //
115
116 StreamFile->ReadAccess = TRUE;
117 StreamFile->WriteAccess = FALSE;
118 StreamFile->DeleteAccess = FALSE;
119
120 StreamFile->SectionObjectPointer = &Fcb->FcbNonpaged->SegmentObject;
121
122 //
123 // Set the file object type and increment the Vcb counts.
124 //
125
126 CdSetFileObject( IrpContext,
127 StreamFile,
129 Fcb,
130 NULL );
131
132 //
133 // We'll give stream file objects a name to aid IO profiling etc. We
134 // NULL this in CdDeleteInternalStream before OB deletes the file object,
135 // and before CdRemovePrefix is called (which frees Fcb names).
136 //
137
138 StreamFile->FileName = *Name;
139
140 //
141 // We will reference the current Fcb twice to keep it from going
142 // away in the error path. Otherwise if we dereference it
143 // below in the finally clause a close could cause the Fcb to
144 // be deallocated.
145 //
146
147 CdLockVcb( IrpContext, Vcb );
148 CdIncrementReferenceCounts( IrpContext, Fcb, 2, 0 );
149 CdUnlockVcb( IrpContext, Vcb );
150 DecrementReference = TRUE;
151
152 //
153 // Initialize the cache map for the file.
154 //
155
156 CcInitializeCacheMap( StreamFile,
157 (PCC_FILE_SIZES)&Fcb->AllocationSize,
158 TRUE,
160 Fcb );
161
162 //
163 // Go ahead and store the stream file into the Fcb.
164 //
165
166 Fcb->FileObject = StreamFile;
167 StreamFile = NULL;
168
169 //
170 // If this is the first file object for a directory then we need to
171 // read the self entry for this directory and update the sizes
172 // in the Fcb. We know that the Fcb has been initialized so
173 // that we have a least one sector available to read.
174 //
175
177
178 ULONG NewDataLength;
179
180 //
181 // Initialize the search structures.
182 //
183
184 CdInitializeDirContext( IrpContext, &DirContext );
185 CdInitializeDirent( IrpContext, &Dirent );
186 CleanupDirContext = TRUE;
187
188 //
189 // Read the dirent from disk and transfer the data to the
190 // in-memory dirent.
191 //
192
193 CdLookupDirent( IrpContext,
194 Fcb,
195 Fcb->StreamOffset,
196 &DirContext );
197
198 CdUpdateDirentFromRawDirent( IrpContext, Fcb, &DirContext, &Dirent );
199
200 //
201 // Verify that this really for the self entry. We do this by
202 // updating the name in the dirent and then checking that it matches
203 // one of the hard coded names.
204 //
205
206 CdUpdateDirentName( IrpContext, &Dirent, FALSE );
207
208 if (Dirent.CdFileName.FileName.Buffer != CdUnicodeSelfArray) {
209
211 }
212
213 //
214 // If the data sizes are different then update the header
215 // and Mcb for this Fcb.
216 //
217
218 NewDataLength = BlockAlign( Vcb, Dirent.DataLength + Fcb->StreamOffset );
219
220 if (NewDataLength == 0) {
221
223 }
224
225 if (NewDataLength != Fcb->FileSize.QuadPart) {
226
227 Fcb->AllocationSize.QuadPart =
228 Fcb->FileSize.QuadPart =
229 Fcb->ValidDataLength.QuadPart = NewDataLength;
230
231 CcSetFileSizes( Fcb->FileObject, (PCC_FILE_SIZES) &Fcb->AllocationSize );
232
233 CdTruncateAllocation( IrpContext, Fcb, 0 );
234 CdAddInitialAllocation( IrpContext,
235 Fcb,
236 Dirent.StartingOffset,
237 NewDataLength );
238
239 UpdateFcbSizes = TRUE;
240 }
241
242 //
243 // Check for the existence flag and transform to hidden.
244 //
245
246 if (FlagOn( Dirent.DirentFlags, CD_ATTRIBUTE_HIDDEN )) {
247
249 }
250
251 //
252 // Convert the time to NT time.
253 //
254
255 CdConvertCdTimeToNtTime( IrpContext,
256 Dirent.CdTime,
258
259 //
260 // Update the Fcb flags to indicate we have read the
261 // self entry.
262 //
263
265
266 //
267 // If we updated the sizes then we want to purge the file. Go
268 // ahead and unpin and then purge the first page.
269 //
270
271 CdCleanupDirContext( IrpContext, &DirContext );
272 CdCleanupDirent( IrpContext, &Dirent );
273 CleanupDirContext = FALSE;
274
275 if (UpdateFcbSizes) {
276
278 NULL,
279 0,
280 FALSE );
281 }
282 }
283
284 } _SEH2_FINALLY {
285
286 //
287 // Cleanup any dirent structures we may have used.
288 //
289
290 if (CleanupDirContext) {
291
292 CdCleanupDirContext( IrpContext, &DirContext );
293 CdCleanupDirent( IrpContext, &Dirent );
294 }
295
296 //
297 // If we raised then we need to dereference the file object.
298 //
299
300 if (StreamFile != NULL) {
301
302 //
303 // Null the name pointer, since the stream file object never actually
304 // 'owns' the names, we just point it to existing ones.
305 //
306
307 StreamFile->FileName.Buffer = NULL;
308 StreamFile->FileName.MaximumLength = StreamFile->FileName.Length = 0;
309
310 ObDereferenceObject( StreamFile );
312 }
313
314 //
315 // Dereference and unlock the Fcb.
316 //
317
318 if (DecrementReference) {
319
320 CdLockVcb( IrpContext, Vcb );
321 CdDecrementReferenceCounts( IrpContext, Fcb, 1, 0 );
322 CdUnlockVcb( IrpContext, Vcb );
323 }
324
325 CdUnlockFcb( IrpContext, Fcb );
326 } _SEH2_END;
327
328 return;
329}
struct NameRec_ * Name
Definition: cdprocs.h:460
#define CD_ATTRIBUTE_HIDDEN
Definition: cd.h:353
#define CdConvertCdTimeToNtTime(IC, CD, NT)
Definition: cd.h:394
WCHAR CdUnicodeSelfArray[]
Definition: cddata.c:49
VOID CdTruncateAllocation(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ LONGLONG StartingFileOffset)
Definition: allocsup.c:575
VOID CdAddInitialAllocation(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ ULONG StartingBlock, _In_ LONGLONG DataLength)
Definition: allocsup.c:484
#define CdInitializeDirent(IC, D)
Definition: cdprocs.h:536
#define CdLockVcb(IC, V)
Definition: cdprocs.h:1023
VOID CdUpdateDirentName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
Definition: dirsup.c:534
#define CdUnlockVcb(IC, V)
Definition: cdprocs.h:1028
#define CdInitializeDirContext(IC, DC)
Definition: cdprocs.h:539
#define CdDecrementReferenceCounts(IC, F, C, UC)
Definition: cdprocs.h:1325
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
Definition: cdprocs.h:425
#define CdIncrementReferenceCounts(IC, F, C, UC)
Definition: cdprocs.h:1317
#define FCB_STATE_INITIALIZED
Definition: cdstruc.h:1042
#define _SEH2_FINALLY
Definition: filesup.c:21
VOID NTAPI CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
Definition: fssup.c:356
VOID NTAPI CcInitializeCacheMap(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes, IN BOOLEAN PinAccess, IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext)
Definition: fssup.c:195
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:386
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
PFILE_OBJECT NTAPI IoCreateStreamFileObjectLite(IN PFILE_OBJECT FileObject OPTIONAL, IN PDEVICE_OBJECT DeviceObject OPTIONAL)
Definition: file.c:3199
CACHE_MANAGER_CALLBACKS CacheManagerCallbacks
Definition: cdstruc.h:409
SECTION_OBJECT_POINTERS SegmentObject
Definition: cdstruc.h:873
LONGLONG CreationTime
Definition: cdstruc.h:1030
ULONG FcbState
Definition: cdstruc.h:971
ULONG FileAttributes
Definition: cdstruc.h:977
PFILE_OBJECT FileObject
Definition: ntfs.h:520
#define STATUS_FILE_CORRUPT_ERROR
Definition: udferr_usr.h:168
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by CdUpdateVcbFromVolDescriptor(), and CdVerifyOrCreateDirStreamFile().

◆ CdCreateIrpContext()

_Ret_valid_ PIRP_CONTEXT CdCreateIrpContext ( _In_ PIRP  Irp,
_In_ BOOLEAN  Wait 
)

Definition at line 1573 of file strucsup.c.

1598{
1599 PIRP_CONTEXT NewIrpContext = NULL;
1601
1602 PAGED_CODE();
1603
1604 //
1605 // The only operations a filesystem device object should ever receive
1606 // are create/teardown of fsdo handles and operations which do not
1607 // occur in the context of fileobjects (i.e., mount).
1608 //
1609
1610#ifndef __REACTOS__
1612#else
1614 IrpSp->DeviceObject == CdData.HddFileSystemDeviceObject) {
1615#endif
1616
1617 if (IrpSp->FileObject != NULL &&
1621
1623 }
1624
1626
1629 IrpSp->Parameters.FileSystemControl.FsControlCode == FSCTL_INVALIDATE_VOLUMES) ||
1630
1633
1635 }
1636
1637 //
1638 // Look in our lookaside list for an IrpContext.
1639 //
1640
1641 if (CdData.IrpContextDepth) {
1642
1643 CdLockCdData();
1644 NewIrpContext = (PIRP_CONTEXT) PopEntryList( &CdData.IrpContextList );
1645 if (NewIrpContext != NULL) {
1646
1648 }
1649
1651 }
1652
1653 if (NewIrpContext == NULL) {
1654
1655 //
1656 // We didn't get it from our private list so allocate it from pool.
1657 //
1658
1660 }
1661
1662 RtlZeroMemory( NewIrpContext, sizeof( IRP_CONTEXT ));
1663
1664 //
1665 // Set the proper node type code and node byte size
1666 //
1667
1668 NewIrpContext->NodeTypeCode = CDFS_NTC_IRP_CONTEXT;
1669 NewIrpContext->NodeByteSize = sizeof( IRP_CONTEXT );
1670
1671 //
1672 // Set the originating Irp field
1673 //
1674
1675 NewIrpContext->Irp = Irp;
1676
1677 //
1678 // Copy RealDevice for workque algorithms. We will update this in the Mount or
1679 // Verify since they have no file objects to use here.
1680 //
1681
1682 if (IrpSp->FileObject != NULL) {
1683
1684 NewIrpContext->RealDevice = IrpSp->FileObject->DeviceObject;
1685 }
1686
1687 //
1688 // Locate the volume device object and Vcb that we are trying to access.
1689 // This may be our filesystem device object. In that case don't initialize
1690 // the Vcb field.
1691 //
1692
1693#ifndef __REACTOS__
1695#else
1697 IrpSp->DeviceObject != CdData.HddFileSystemDeviceObject) {
1698#endif
1699
1700 NewIrpContext->Vcb = &((PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject)->Vcb;
1701
1702 }
1703
1704 //
1705 // Major/Minor Function codes
1706 //
1707
1708 NewIrpContext->MajorFunction = IrpSp->MajorFunction;
1709 NewIrpContext->MinorFunction = IrpSp->MinorFunction;
1710
1711 //
1712 // Set the wait parameter
1713 //
1714
1715 if (Wait) {
1716
1717 SetFlag( NewIrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
1718
1719 } else {
1720
1721 SetFlag( NewIrpContext->Flags, IRP_CONTEXT_FLAG_FORCE_POST );
1722 }
1723
1724 //
1725 // return and tell the caller
1726 //
1727
1728 return NewIrpContext;
1729}
#define TAG_IRP_CONTEXT
Definition: cdprocs.h:97
#define IRP_CONTEXT_FLAG_FORCE_POST
Definition: cdstruc.h:1216
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1215
VOLUME_DEVICE_OBJECT * PVOLUME_DEVICE_OBJECT
Definition: cdstruc.h:769
IRP_CONTEXT * PIRP_CONTEXT
Definition: cdstruc.h:1211
#define FSCTL_INVALIDATE_VOLUMES
Definition: nt_native.h:847
#define ExRaiseStatus
Definition: ntoskrnl.h:114
PIRP Irp
Definition: usbstor.h:99
PDEVICE_OBJECT FileSystemDeviceObject
Definition: cdstruc.h:350
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
#define IRP_MN_USER_FS_REQUEST
Definition: iotypes.h:4403
#define IRP_MN_MOUNT_VOLUME
Definition: iotypes.h:4404
FORCEINLINE PSINGLE_LIST_ENTRY PopEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead)
Definition: rtlfuncs.h:240

Referenced by _IRQL_requires_max_().

◆ CdCreateUserMdl()

NTSTATUS CdCreateUserMdl ( _In_ PIRP_CONTEXT  IrpContext,
_In_ ULONG  BufferLength,
_In_ BOOLEAN  RaiseOnError,
_In_ LOCK_OPERATION  Operation 
)

Definition at line 1221 of file deviosup.c.

1255{
1257 PMDL Mdl;
1258
1259 PAGED_CODE();
1260
1262 UNREFERENCED_PARAMETER( IrpContext );
1263
1264 ASSERT_IRP_CONTEXT( IrpContext );
1265 ASSERT_IRP( IrpContext->Irp );
1266 NT_ASSERT( IrpContext->Irp->MdlAddress == NULL );
1267
1268 //
1269 // Allocate the Mdl, and Raise if we fail.
1270 //
1271
1272 Mdl = IoAllocateMdl( IrpContext->Irp->UserBuffer,
1274 FALSE,
1275 FALSE,
1276 IrpContext->Irp );
1277
1278 if (Mdl != NULL) {
1279
1280 //
1281 // Now probe the buffer described by the Irp. If we get an exception,
1282 // deallocate the Mdl and return the appropriate "expected" status.
1283 //
1284
1285 _SEH2_TRY {
1286
1287 MmProbeAndLockPages( Mdl, IrpContext->Irp->RequestorMode, IoWriteAccess );
1288
1290
1291#ifdef _MSC_VER
1292#pragma warning(suppress: 6320)
1293#endif
1295
1297
1298 IoFreeMdl( Mdl );
1299 IrpContext->Irp->MdlAddress = NULL;
1300
1302
1304 }
1305 } _SEH2_END;
1306 }
1307
1308 //
1309 // Check if we are to raise or return
1310 //
1311
1312 if (Status != STATUS_SUCCESS) {
1313
1314 if (RaiseOnError) {
1315
1316 CdRaiseStatus( IrpContext, Status );
1317 }
1318 }
1319
1320 //
1321 // Return the status code.
1322 //
1323
1324 return Status;
1325}
#define ASSERT_IRP(I)
Definition: cddata.h:250
_Inout_ PFCB _In_ BOOLEAN RaiseOnError
Definition: cdprocs.h:1211
FP_OP Operation
Definition: fpcontrol.c:150
#define IoFreeMdl
Definition: fxmdl.h:89
#define IoAllocateMdl
Definition: fxmdl.h:88
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
Definition: filter.c:61
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
@ IoWriteAccess
Definition: ketypes.h:864

◆ CdDeleteCcb()

VOID CdDeleteCcb ( _In_ PIRP_CONTEXT  IrpContext,
_In_ __drv_freesMem(Pool) PCCB  Ccb 
)

Definition at line 1462 of file strucsup.c.

1482{
1483 PAGED_CODE();
1484
1485 UNREFERENCED_PARAMETER( IrpContext );
1486
1487 if (Ccb->SearchExpression.FileName.Buffer != NULL) {
1488
1489 CdFreePool( &Ccb->SearchExpression.FileName.Buffer );
1490 }
1491
1492 CdDeallocateCcb( IrpContext, Ccb );
1493 return;
1494}
#define CdDeallocateCcb(IC, C)
Definition: strucsup.c:96

◆ CdDeleteFileLock()

VOID CdDeleteFileLock ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFILE_LOCK  FileLock 
)

◆ CdDeleteInternalStream()

VOID CdDeleteInternalStream ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFCB  Fcb 
)

Definition at line 333 of file cachesup.c.

357{
359
360 PAGED_CODE();
361
362 UNREFERENCED_PARAMETER( IrpContext );
363
364 ASSERT_IRP_CONTEXT( IrpContext );
365 ASSERT_FCB( Fcb );
366
367 //
368 // Lock the Fcb.
369 //
370
371 CdLockFcb( IrpContext, Fcb );
372
373 //
374 // Capture the file object.
375 //
376
379
380 //
381 // It is now safe to unlock the Fcb.
382 //
383
384 CdUnlockFcb( IrpContext, Fcb );
385
386 //
387 // Dereference the file object if present.
388 //
389
390 if (FileObject != NULL) {
391
392 if (FileObject->PrivateCacheMap != NULL) {
393
395 }
396
397 //
398 // Null the name pointer, since the stream file object never actually
399 // 'owns' the names, we just point it to existing ones.
400 //
401
402 FileObject->FileName.Buffer = NULL;
403 FileObject->FileName.MaximumLength = FileObject->FileName.Length = 0;
404
406 }
407}
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:286

Referenced by _Requires_lock_held_().

◆ CdDeleteVcb()

VOID CdDeleteVcb ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PVCB  Vcb 
)

Definition at line 876 of file strucsup.c.

899{
900 PAGED_CODE();
901
904
905 UNREFERENCED_PARAMETER( IrpContext );
906
907 //
908 // Chuck the backpocket Vpb we kept just in case.
909 //
910
911 CdFreePool( &Vcb->SwapVpb );
912
913 //
914 // If there is a Vpb then we must delete it ourselves.
915 //
916
917 CdFreePool( &Vcb->Vpb );
918
919 //
920 // Dereference our target if we haven't already done so.
921 //
922
923 if (Vcb->TargetDeviceObject != NULL) {
924
925 ObDereferenceObject( Vcb->TargetDeviceObject );
926 }
927
928 //
929 // Delete the XA Sector and sector cache buffer if allocated.
930 //
931
932 CdFreePool( &Vcb->XASector );
933 CdFreePool( &Vcb->SectorCacheBuffer);
934
935 if (Vcb->SectorCacheIrp != NULL) {
936
937 IoFreeIrp( Vcb->SectorCacheIrp);
938 Vcb->SectorCacheIrp = NULL;
939
940 ExDeleteResourceLite( &Vcb->SectorCacheResource);
941 }
942
943 //
944 // Remove this entry from the global queue.
945 //
946
947 RemoveEntryList( &Vcb->VcbLinks );
948
949 //
950 // Delete the Vcb and File resources.
951 //
952
953 ExDeleteResourceLite( &Vcb->VcbResource );
954 ExDeleteResourceLite( &Vcb->FileResource );
955
956 //
957 // Delete the TOC if present.
958 //
959
960 CdFreePool( &Vcb->CdromToc );
961
962 //
963 // Uninitialize the notify structures.
964 //
965
966 if (Vcb->NotifySync != NULL) {
967
968 FsRtlNotifyUninitializeSync( &Vcb->NotifySync );
969 }
970
971 //
972 // Now delete the volume device object.
973 //
974#ifdef _MSC_VER
975#pragma prefast( suppress: __WARNING_BUFFER_UNDERFLOW, "This is ok, the Vcb is embedded in our volume device object, and that is what we are really deleting." )
976#endif
979 Vcb ));
980
981 return;
982}
#define ASSERT_EXCLUSIVE_CDDATA
Definition: cddata.h:257
#define ASSERT_EXCLUSIVE_VCB(V)
Definition: cddata.h:258
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define ExDeleteResourceLite(res)
Definition: env_spec_w32.h:647
VOID NTAPI FsRtlNotifyUninitializeSync(IN PNOTIFY_SYNC *NotifySync)
Definition: notify.c:1668
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666

◆ CdDissectName()

VOID CdDissectName ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PUNICODE_STRING  RemainingName,
_Out_ PUNICODE_STRING  FinalName 
)

Definition at line 301 of file namesup.c.

327{
328 ULONG NameLength;
329 PWCHAR NextWchar;
330
331 PAGED_CODE();
332
333 UNREFERENCED_PARAMETER( IrpContext );
334
335 //
336 // Find the offset of the next component separators.
337 //
338
339 for (NameLength = 0, NextWchar = RemainingName->Buffer;
340 (NameLength < RemainingName->Length) && (*NextWchar != L'\\');
341 NameLength += sizeof( WCHAR) , NextWchar += 1);
342
343 //
344 // Adjust all the strings by this amount.
345 //
346
347 FinalName->Buffer = RemainingName->Buffer;
348
349 FinalName->MaximumLength = FinalName->Length = (USHORT) NameLength;
350
351 //
352 // If this is the last component then set the RemainingName lengths to zero.
353 //
354
355 if (NameLength == RemainingName->Length) {
356
357 RemainingName->Length = 0;
358
359 //
360 // Otherwise we adjust the string by this amount plus the separating character.
361 //
362
363 } else {
364
365 RemainingName->MaximumLength -= (USHORT) (NameLength + sizeof( WCHAR ));
366 RemainingName->Length -= (USHORT) (NameLength + sizeof( WCHAR ));
367 RemainingName->Buffer = Add2Ptr( RemainingName->Buffer,
368 NameLength + sizeof( WCHAR ),
369 PWCHAR );
370 }
371
372 return;
373}
_Inout_ PFCB _Inout_ PUNICODE_STRING RemainingName
Definition: cdprocs.h:802
#define Add2Ptr(PTR, INC)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
unsigned short USHORT
Definition: pedump.c:61
uint16_t * PWCHAR
Definition: typedefs.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by _Requires_lock_held_().

◆ CdExceptionFilter()

LONG CdExceptionFilter ( _Inout_ PIRP_CONTEXT  IrpContext,
_In_ PEXCEPTION_POINTERS  ExceptionPointer 
)

Definition at line 525 of file cddata.c.

549{
552
553 ASSERT_OPTIONAL_IRP_CONTEXT( IrpContext );
554
555 ExceptionCode = ExceptionPointer->ExceptionRecord->ExceptionCode;
556
557 //
558 // If the exception is STATUS_IN_PAGE_ERROR, get the I/O error code
559 // from the exception record.
560 //
561
563 (ExceptionPointer->ExceptionRecord->NumberParameters >= 3)) {
564
566 (NTSTATUS)ExceptionPointer->ExceptionRecord->ExceptionInformation[2];
567 }
568
569 //
570 // If there is an Irp context then check which status code to use.
571 //
572
573 if (ARGUMENT_PRESENT( IrpContext )) {
574
575 if (IrpContext->ExceptionStatus == STATUS_SUCCESS) {
576
577 //
578 // Store the real status into the IrpContext.
579 //
580
581 IrpContext->ExceptionStatus = ExceptionCode;
582
583 } else {
584
585 //
586 // No need to test the status code if we raised it ourselves.
587 //
588
590 }
591 }
592
593 AssertVerifyDevice( IrpContext, IrpContext->ExceptionStatus );
594
595 //
596 // Bug check if this status is not supported.
597 //
598
600
601#ifdef _MSC_VER
602#pragma prefast( suppress: __WARNING_USE_OTHER_FUNCTION, "We're corrupted." )
603#endif
604 CdBugCheck( (ULONG_PTR) ExceptionPointer->ExceptionRecord,
605 (ULONG_PTR) ExceptionPointer->ContextRecord,
606 (ULONG_PTR) ExceptionPointer->ExceptionRecord->ExceptionAddress );
607
608 }
609
611}
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1774
#define AssertVerifyDevice(C, S)
Definition: cdprocs.h:1810
#define NTSTATUS
Definition: precomp.h:21
TestStatus
Definition: global_mem.c:33
#define STATUS_IN_PAGE_ERROR
Definition: ntstatus.h:243

Referenced by _IRQL_requires_max_(), _Requires_lock_held_(), and CdFspDispatch().

◆ CdFastDecodeFileObject()

TYPE_OF_OPEN CdFastDecodeFileObject ( _In_ PFILE_OBJECT  FileObject,
_Out_ PFCB Fcb 
)

Definition at line 206 of file filobsup.c.

232{
233 PAGED_CODE();
234
236
237 //
238 // The Fcb is in the FsContext field. The type of open is in the low
239 // bits of the Ccb.
240 //
241
242 *Fcb = FileObject->FsContext;
243
244 return (TYPE_OF_OPEN)
246}
#define ASSERT_FILE_OBJECT(FO)
Definition: cddata.h:252
#define TYPE_OF_OPEN_MASK
Definition: filobsup.c:28

Referenced by _Function_class_(), CdFastLock(), CdFastUnlockAll(), CdFastUnlockAllByKey(), and CdFastUnlockSingle().

◆ 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}
#define CD_ATTRIBUTE_DIRECTORY
Definition: cd.h:354
_In_ PFCB Fcb
Definition: dirsup.c:398
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN IgnoreCase
Definition: dirsup.c:1112
VOID CdUpdateDirentName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
Definition: dirsup.c:534
_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
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
#define DIRENT_FLAG_CONSTANT_ENTRY
Definition: cdstruc.h:1671
ULONG Flags
Definition: ntfs.h:536

◆ CdFspClose()

VOID CdFspClose ( _In_opt_ PVCB  Vcb)

◆ CdFullCompareNames()

FSRTL_COMPARISON_RESULT CdFullCompareNames ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PUNICODE_STRING  NameA,
_In_ PUNICODE_STRING  NameB 
)

Definition at line 1064 of file namesup.c.

1091{
1092 SIZE_T i;
1093 ULONG MinLength = NameA->Length;
1095
1096 PAGED_CODE();
1097
1098 UNREFERENCED_PARAMETER( IrpContext );
1099
1100 //
1101 // Figure out the minimum of the two lengths
1102 //
1103
1104 if (NameA->Length > NameB->Length) {
1105
1106 MinLength = NameB->Length;
1108
1109 } else if (NameA->Length == NameB->Length) {
1110
1111 Result = EqualTo;
1112 }
1113
1114 //
1115 // Loop through looking at all of the characters in both strings
1116 // testing for equalilty, less than, and greater than
1117 //
1118
1119 i = RtlCompareMemory( NameA->Buffer, NameB->Buffer, MinLength );
1120
1121 if (i < MinLength) {
1122
1123 //
1124 // We know the offset of the first character which is different.
1125 //
1126
1127 return ((NameA->Buffer[ i / 2 ] < NameB->Buffer[ i / 2 ]) ?
1128 LessThan :
1129 GreaterThan);
1130 }
1131
1132 //
1133 // The names match up to the length of the shorter string.
1134 // The shorter string lexically appears first.
1135 //
1136
1137 return Result;
1138}
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
@ LessThan
Definition: fsrtltypes.h:77
@ GreaterThan
Definition: fsrtltypes.h:79
@ EqualTo
Definition: fsrtltypes.h:78
enum _FSRTL_COMPARISON_RESULT FSRTL_COMPARISON_RESULT
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG_PTR SIZE_T
Definition: typedefs.h:80
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by CdFindNameLink(), and CdInsertNameLink().

◆ CdGenerate8dot3Name()

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 at line 550 of file namesup.c.

594{
596
598 UNICODE_STRING BiasedShortName;
599 WCHAR ShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof( WCHAR ) ] = {0};
600 WCHAR BiasedShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof( WCHAR ) ];
601
602 GENERATE_NAME_CONTEXT NameContext;
603
604 ULONG BiasedDirentOffset;
605
606 ULONG MaximumBaseBytes;
607 ULONG BaseNameOffset;
608
609 PWCHAR NextWchar;
610 WCHAR ThisWchar;
612
613 BOOLEAN FoundTilde = FALSE;
614
615 OEM_STRING OemName = {0};
616 USHORT OemNameOffset = 0;
617 BOOLEAN OverflowBuffer = FALSE;
618
619 PAGED_CODE();
620
621 //
622 // Initialize the short string to use the input buffer.
623 //
624
625 ShortName.Buffer = ShortNameBuffer;
626 ShortName.MaximumLength = BYTE_COUNT_8_DOT_3;
627
628 //
629 // Initialize the name context.
630 //
631
632 RtlZeroMemory( &NameContext, sizeof( GENERATE_NAME_CONTEXT ));
633
634 //
635 // We now have the unicode name for the input string. Go ahead and generate
636 // the short name.
637 //
638
639 RtlGenerate8dot3Name( FileName, TRUE, &NameContext, &ShortName );
640
641 //
642 // We now have the generic short name. We want incorporate the dirent offset
643 // into the name in order to reduce the chance of name conflicts. We will use
644 // a tilde character followed by a character representation of the dirent offset.
645 // This will be the hexadecimal representation of the dirent offset in the directory.
646 // It is actuall this offset divided by 32 since we don't need the full
647 // granularity.
648 //
649
650 BiasedDirentOffset = DirentOffset >> SHORT_NAME_SHIFT;
651
652 //
653 // Point to a local buffer to store the offset string. We start
654 // at the end of the buffer and work backwards.
655 //
656
657 NextWchar = Add2Ptr( BiasedShortNameBuffer,
659 PWCHAR );
660
661 BiasedShortName.MaximumLength = BYTE_COUNT_8_DOT_3;
662
663 //
664 // Generate an OEM version of the string so that we can check for double
665 // byte characters.
666 //
667
669
670 //
671 // If this failed, bail out. Don't expect any problems other than no mem.
672 //
673
674 if (!NT_SUCCESS( Status)) {
675
677 CdRaiseStatus( IrpContext, Status);
678 }
679
680 Length = 0;
681
682 //
683 // Now add the characters for the dirent offset. We need to start
684 // from the least significant digit and work backwards.
685 //
686
687 do {
688
689 NextWchar -= 1;
690
691 ThisWchar = (WCHAR) (BiasedDirentOffset & 0x0000000f);
692
693 //
694 // Store in the next character. Bias against either '0' or 'A'
695 //
696
697 if (ThisWchar <= 9) {
698
699 *NextWchar = ThisWchar + L'0';
700
701 } else {
702
703 *NextWchar = ThisWchar + L'A' - 0xA;
704 }
705
706 Length += sizeof( WCHAR );
707
708 //
709 // Shift out the low 4 bits of the offset.
710 //
711
712 BiasedDirentOffset >>= 4;
713
714 } while (BiasedDirentOffset != 0);
715
716 //
717 // Now store in the tilde character.
718 //
719
720 NextWchar -= 1;
721 *NextWchar = L'~';
722 Length += sizeof( WCHAR );
723
724 //
725 // Set the length of this string.
726 //
727
728 BiasedShortName.Length = Length;
729 BiasedShortName.Buffer = NextWchar;
730
731 //
732 // Figure out the maximum number of characters we can copy of the base
733 // name. We subract the number of characters in the dirent string from 8.
734 // We will copy this many characters or stop when we reach a '.' character
735 // or a '~' character in the name.
736 //
737
738 MaximumBaseBytes = 16 - Length;
739
740 BaseNameOffset = 0;
741
742 //
743 // Keep copying from the base name until we hit a '.', '~' or the end of
744 // the short name.
745 //
746
747 NextWchar = ShortFileName;
748 Length = 0;
749
750 while ((BaseNameOffset < ShortName.Length) &&
751 (ShortName.Buffer[BaseNameOffset / 2] != L'.')) {
752
753 //
754 // Remember if we found a tilde character in the short name,
755 // so we don't copy it or anything following it.
756 //
757
758 if (ShortName.Buffer[BaseNameOffset / 2] == L'~') {
759
760 FoundTilde = TRUE;
761 }
762
763 //
764 // We need to consider the DBCS code page, because Unicode characters
765 // may use 2 bytes as DBCS characters.
766 //
767
768#ifdef _MSC_VER
769#pragma prefast(push)
770#pragma prefast(suppress:26014, "OemNameOffset <= BaseNameOffset throughout this loop; OemName buffer previously allocated based on ShortName's length.")
771#endif
772 if (FsRtlIsLeadDbcsCharacter(OemName.Buffer[OemNameOffset])) {
773#ifdef _MSC_VER
774#pragma prefast(pop)
775#endif
776
777 OemNameOffset += 2;
778
779 if ((OemNameOffset + (BiasedShortName.Length / sizeof(WCHAR))) > 8) {
780
781 OverflowBuffer = TRUE;
782 }
783 }
784 else {
785
786 OemNameOffset++;
787 }
788
789 //
790 // Only copy the bytes if we still have space for the dirent string.
791 //
792
793 if (!FoundTilde && !OverflowBuffer && (BaseNameOffset < MaximumBaseBytes)) {
794
795 *NextWchar = ShortName.Buffer[BaseNameOffset / 2];
796 Length += sizeof( WCHAR );
797 NextWchar += 1;
798 }
799
800 BaseNameOffset += 2;
801 }
802
804
805 //
806 // Now copy the dirent string into the biased name buffer.
807 //
808
809#ifdef _MSC_VER
810#pragma prefast(push)
811#endif
812 RtlCopyMemory( NextWchar,
813 BiasedShortName.Buffer,
814 BiasedShortName.Length );
815#ifdef _MSC_VER
816#pragma prefast(pop)
817#endif
818
819 Length += BiasedShortName.Length;
820 NextWchar += (BiasedShortName.Length / sizeof( WCHAR ));
821
822 //
823 // Now copy any remaining bytes over to the biased short name.
824 //
825
826 if (BaseNameOffset != ShortName.Length) {
827
828 RtlCopyMemory( NextWchar,
829 &ShortName.Buffer[BaseNameOffset / 2],
830 ShortName.Length - BaseNameOffset );
831
832 Length += (ShortName.Length - (USHORT) BaseNameOffset);
833 }
834
835 //
836 // The final short name is stored in the user's buffer.
837 //
838
839 *ShortByteCount = Length;
840}
NTSYSAPI VOID NTAPI RtlGenerate8dot3Name(_In_ PCUNICODE_STRING Name, _In_ BOOLEAN AllowExtendedCharacters, _Inout_ PGENERATE_NAME_CONTEXT Context, _Inout_ PUNICODE_STRING Name8dot3)
#define SHORT_NAME_SHIFT
Definition: cd.h:364
Dirent DirentOffset
Definition: dirsup.c:444
CdName VersionString Length
Definition: namesup.c:89
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FsRtlIsLeadDbcsCharacter(DBCS_CHAR)
Definition: init.c:428
IN PDCB IN POEM_STRING OemName
Definition: fatprocs.h:1304
VOID NTAPI RtlFreeOemString(POEM_STRING OemString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
USHORT MaximumLength
Definition: env_spec_w32.h:370
STRING OEM_STRING
Definition: umtypes.h:203

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

◆ CdGetNextFcb()

PFCB CdGetNextFcb ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PVCB  Vcb,
_In_ PVOID RestartKey 
)

Definition at line 2155 of file strucsup.c.

2182{
2183 PFCB Fcb;
2184
2185 PAGED_CODE();
2186
2187 UNREFERENCED_PARAMETER( IrpContext );
2188
2189 Fcb = (PFCB) RtlEnumerateGenericTableWithoutSplaying( &Vcb->FcbTable, RestartKey );
2190
2191 if (Fcb != NULL) {
2192
2193 Fcb = ((PFCB_TABLE_ELEMENT)(Fcb))->Fcb;
2194 }
2195
2196 return Fcb;
2197}
struct _FCB_TABLE_ELEMENT * PFCB_TABLE_ELEMENT
FCB * PFCB
Definition: cdstruc.h:1040
_Must_inspect_result_ NTSYSAPI PVOID NTAPI RtlEnumerateGenericTableWithoutSplaying(_In_ PRTL_GENERIC_TABLE Table, _Inout_ PVOID *RestartKey)

Referenced by _Requires_lock_held_().

◆ CdHijackIrpAndFlushDevice()

NTSTATUS CdHijackIrpAndFlushDevice ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PIRP  Irp,
_In_ PDEVICE_OBJECT  TargetDeviceObject 
)

Definition at line 4105 of file deviosup.c.

4134{
4135 KEVENT Event;
4137 PIO_STACK_LOCATION NextIrpSp;
4138
4139 PAGED_CODE();
4140
4141 UNREFERENCED_PARAMETER( IrpContext );
4142
4143 //
4144 // Get the next stack location, and copy over the stack location
4145 //
4146
4147 NextIrpSp = IoGetNextIrpStackLocation( Irp );
4148
4149 *NextIrpSp = *IoGetCurrentIrpStackLocation( Irp );
4150
4152 NextIrpSp->MinorFunction = 0;
4153
4154 //
4155 // Set up the completion routine
4156 //
4157
4159
4162 &Event,
4163 TRUE,
4164 TRUE,
4165 TRUE );
4166
4167 //
4168 // Send the request.
4169 //
4170
4172
4173 if (Status == STATUS_PENDING) {
4174
4176
4177 Status = Irp->IoStatus.Status;
4178 }
4179
4180 //
4181 // If the driver doesn't support flushes, return SUCCESS.
4182 //
4183
4185
4187 }
4188
4189 Irp->IoStatus.Status = 0;
4190 Irp->IoStatus.Information = 0;
4191
4192 return Status;
4193}
IO_COMPLETION_ROUTINE CdSyncCompletionRoutine
Definition: deviosup.c:2388
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
Definition: fatprocs.h:1674
#define KernelMode
Definition: asm.h:34
@ NotificationEvent
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IRP_MJ_FLUSH_BUFFERS
@ Executive
Definition: ketypes.h:415

Referenced by _Requires_lock_held_().

◆ CdInitializeFcbFromFileContext()

VOID CdInitializeFcbFromFileContext ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFCB  Fcb,
_In_ PFCB  ParentFcb,
_In_ PFILE_ENUM_CONTEXT  FileContext 
)

Definition at line 1225 of file strucsup.c.

1257{
1258 PDIRENT ThisDirent = &FileContext->InitialDirent->Dirent;
1259 PCOMPOUND_DIRENT CurrentCompoundDirent;
1260
1261 LONGLONG CurrentFileOffset;
1262 ULONG CurrentMcbEntryOffset;
1263
1264 PAGED_CODE();
1265
1266 //
1267 // Use a try-finally to facilitate cleanup.
1268 //
1269
1270 CdLockFcb( IrpContext, Fcb );
1271
1272 _SEH2_TRY {
1273
1274 //
1275 // Initialize the common header in the Fcb. The node type is already
1276 // present.
1277 //
1278
1279 Fcb->Resource = &IrpContext->Vcb->FileResource;
1280
1281 //
1282 // Allocation occurs in block-sized units.
1283 //
1284
1285 Fcb->FileSize.QuadPart =
1286 Fcb->ValidDataLength.QuadPart = FileContext->FileSize;
1287
1288 Fcb->AllocationSize.QuadPart = LlBlockAlign( Fcb->Vcb, FileContext->FileSize );
1289
1290 //
1291 // Set the flags from the dirent. We always start with the read-only bit.
1292 //
1293
1295 if (FlagOn( ThisDirent->DirentFlags, CD_ATTRIBUTE_HIDDEN )) {
1296
1298 }
1299
1300 //
1301 // Convert the time to NT time.
1302 //
1303
1304 CdConvertCdTimeToNtTime( IrpContext,
1305 ThisDirent->CdTime,
1307
1308 //
1309 // Set the flag indicating the type of extent.
1310 //
1311
1312 if (ThisDirent->ExtentType != Form1Data) {
1313
1314 if (ThisDirent->ExtentType == Mode2Form2Data) {
1315
1317
1318 } else {
1319
1321 }
1322
1323 Fcb->XAAttributes = ThisDirent->XAAttributes;
1324 Fcb->XAFileNumber = ThisDirent->XAFileNumber;
1325 }
1326
1327 //
1328 // Read through all of the dirents for the file until we find the last
1329 // and add the allocation into the Mcb.
1330 //
1331
1332 CurrentCompoundDirent = FileContext->InitialDirent;
1333 CurrentFileOffset = 0;
1334 CurrentMcbEntryOffset = 0;
1335
1336 while (TRUE) {
1337
1338 CdAddAllocationFromDirent( IrpContext,
1339 Fcb,
1340 CurrentMcbEntryOffset,
1341 CurrentFileOffset,
1342 &CurrentCompoundDirent->Dirent );
1343
1344 //
1345 // Break out if we are at the last dirent.
1346 //
1347
1348 if (!FlagOn( CurrentCompoundDirent->Dirent.DirentFlags, CD_ATTRIBUTE_MULTI )) {
1349
1350 break;
1351 }
1352
1353 CurrentFileOffset += CurrentCompoundDirent->Dirent.DataLength;
1354 CurrentMcbEntryOffset += 1;
1355
1356 //
1357 // We better be able to find the next dirent.
1358 //
1359
1360 if (!CdLookupNextDirent( IrpContext,
1361 ParentFcb,
1362 &CurrentCompoundDirent->DirContext,
1363 &FileContext->CurrentDirent->DirContext )) {
1364
1366 }
1367
1368 CurrentCompoundDirent = FileContext->CurrentDirent;
1369
1370 CdUpdateDirentFromRawDirent( IrpContext,
1371 ParentFcb,
1372 &CurrentCompoundDirent->DirContext,
1373 &CurrentCompoundDirent->Dirent );
1374 }
1375
1376 //
1377 // Show that the Fcb is initialized.
1378 //
1379
1381
1382 //
1383 // Link into the other in-memory structures and into the Fcb table.
1384 //
1385
1387
1388 InsertTailList( &ParentFcb->FcbQueue, &Fcb->FcbLinks );
1389
1390 CdIncrementReferenceCounts( IrpContext, ParentFcb, 1, 1 );
1391
1392 CdInsertFcbTable( IrpContext, Fcb );
1394
1395 } _SEH2_FINALLY {
1396
1397 CdUnlockFcb( IrpContext, Fcb );
1398 } _SEH2_END;
1399
1400 return;
1401}
@ Form1Data
Definition: cd.h:524
@ Mode2Form2Data
Definition: cd.h:525
VOID CdAddAllocationFromDirent(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ ULONG McbEntryOffset, _In_ LONGLONG StartingFileOffset, _In_ PDIRENT Dirent)
Definition: allocsup.c:335
#define CdInsertFcbTable(IC, F)
Definition: strucsup.c:129
_In_ PFCB ParentFcb
Definition: cdprocs.h:736
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT FileContext
Definition: cdprocs.h:442
BOOLEAN CdLookupNextDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PDIRENT_ENUM_CONTEXT CurrentDirContext, _Inout_ PDIRENT_ENUM_CONTEXT NextDirContext)
Definition: dirsup.c:208
#define LlBlockAlign(V, L)
Definition: cdprocs.h:1646
#define FCB_STATE_MODE2FORM2_FILE
Definition: cdstruc.h:1044
#define FCB_STATE_IN_FCB_TABLE
Definition: cdstruc.h:1043
#define FCB_STATE_DA_FILE
Definition: cdstruc.h:1046
#define InsertTailList(ListHead, Entry)
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
UCHAR DirentFlags
Definition: cdstruc.h:1613
XA_EXTENT_TYPE ExtentType
Definition: cdstruc.h:1663
PCHAR CdTime
Definition: cdstruc.h:1607
ULONG DataLength
Definition: cdstruc.h:1600
USHORT XAAttributes
Definition: cdstruc.h:1639
UCHAR XAFileNumber
Definition: cdstruc.h:1640
UCHAR XAFileNumber
Definition: cdstruc.h:989
struct _FCB * ParentFcb
Definition: cdstruc.h:940
LIST_ENTRY FcbLinks
Definition: cdstruc.h:946
USHORT XAAttributes
Definition: cdstruc.h:983
ERESOURCE FileResource
Definition: cdstruc.h:590

Referenced by _Requires_lock_held_().

◆ CdInitializeFcbFromPathEntry()

VOID CdInitializeFcbFromPathEntry ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFCB  Fcb,
_In_opt_ PFCB  ParentFcb,
_In_ PPATH_ENTRY  PathEntry 
)

Definition at line 1136 of file strucsup.c.

1167{
1168 PAGED_CODE();
1169
1170 //
1171 // Fill in the Index specific fields of the Fcb.
1172 //
1173
1174 Fcb->StreamOffset = BytesFromBlocks( Fcb->Vcb,
1175 SectorBlockOffset( Fcb->Vcb, PathEntry->DiskOffset ));
1176
1177 Fcb->Ordinal = PathEntry->Ordinal;
1178
1179 //
1180 // Initialize the common header in the Fcb. The node type is already
1181 // present.
1182 //
1183
1184 Fcb->Resource = &Fcb->Vcb->FileResource;
1185
1186 //
1187 // Always set the sizes to one sector until we read the self-entry.
1188 //
1189
1190 Fcb->AllocationSize.QuadPart =
1191 Fcb->FileSize.QuadPart =
1192 Fcb->ValidDataLength.QuadPart = SECTOR_SIZE;
1193
1194 CdAddInitialAllocation( IrpContext,
1195 Fcb,
1196 PathEntry->DiskOffset,
1197 SECTOR_SIZE );
1198 //
1199 // State flags for this Fcb.
1200 //
1201
1203
1204 //
1205 // Link into the other in-memory structures and into the Fcb table.
1206 //
1207
1208 if (ParentFcb != NULL) {
1209
1211
1212 InsertTailList( &ParentFcb->FcbQueue, &Fcb->FcbLinks );
1213
1214 CdIncrementReferenceCounts( IrpContext, ParentFcb, 1, 1 );
1215 }
1216
1217 CdInsertFcbTable( IrpContext, Fcb );
1219
1220 return;
1221}
#define SectorBlockOffset(V, LB)
Definition: cdprocs.h:1626
#define BytesFromBlocks(V, B)
Definition: cdprocs.h:1630
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705

Referenced by _Requires_lock_held_(), and CdUpdateVcbFromVolDescriptor().

◆ CdInitializeStackIrpContext()

VOID CdInitializeStackIrpContext ( _Out_ PIRP_CONTEXT  IrpContext,
_In_ PIRP_CONTEXT_LITE  IrpContextLite 
)

Definition at line 1839 of file strucsup.c.

1864{
1865 PAGED_CODE();
1866
1867 //
1868 // Zero and then initialize the structure.
1869 //
1870
1871 RtlZeroMemory( IrpContext, sizeof( IRP_CONTEXT ));
1872
1873 //
1874 // Set the proper node type code and node byte size
1875 //
1876
1877 IrpContext->NodeTypeCode = CDFS_NTC_IRP_CONTEXT;
1878 IrpContext->NodeByteSize = sizeof( IRP_CONTEXT );
1879
1880 //
1881 // Note that this is from the stack.
1882 //
1883
1884 SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_ON_STACK );
1885
1886 //
1887 // Copy RealDevice for workque algorithms.
1888 //
1889
1890 IrpContext->RealDevice = IrpContextLite->RealDevice;
1891
1892 //
1893 // The Vcb is found in the Fcb.
1894 //
1895
1896 IrpContext->Vcb = IrpContextLite->Fcb->Vcb;
1897
1898 //
1899 // Major/Minor Function codes
1900 //
1901
1902 IrpContext->MajorFunction = IRP_MJ_CLOSE;
1903
1904 //
1905 // Set the wait parameter
1906 //
1907
1908 SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
1909
1910 return;
1911}

◆ CdInitializeVcb()

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 
)

Definition at line 241 of file strucsup.c.

292{
293 PAGED_CODE();
294
295 UNREFERENCED_PARAMETER( IrpContext );
296
297 //
298 // We start by first zeroing out all of the VCB, this will guarantee
299 // that any stale data is wiped clean.
300 //
301
302 RtlZeroMemory( Vcb, sizeof( VCB ));
303
304 //
305 // Set the proper node type code and node byte size.
306 //
307
308 Vcb->NodeTypeCode = CDFS_NTC_VCB;
309 Vcb->NodeByteSize = sizeof( VCB );
310
311 //
312 // Initialize the DirNotify structs. FsRtlNotifyInitializeSync can raise.
313 //
314
315 InitializeListHead( &Vcb->DirNotifyList );
316 FsRtlNotifyInitializeSync( &Vcb->NotifySync );
317
318 //
319 // Pick up a VPB right now so we know we can pull this filesystem stack
320 // off of the storage stack on demand. This can raise - if it does,
321 // uninitialize the notify structures before returning.
322 //
323
324 _SEH2_TRY {
325
327 sizeof( VPB ),
328 TAG_VPB );
329 }
331
333
334 FsRtlNotifyUninitializeSync( &Vcb->NotifySync );
335 }
336 } _SEH2_END;
337
338 //
339 // Nothing beyond this point should raise.
340 //
341
342 RtlZeroMemory( Vcb->SwapVpb, sizeof( VPB ) );
343
344 //
345 // Initialize the resource variable for the Vcb and files.
346 //
347
348 ExInitializeResourceLite( &Vcb->VcbResource );
349 ExInitializeResourceLite( &Vcb->FileResource );
350 ExInitializeFastMutex( &Vcb->VcbMutex );
351
352 //
353 // Insert this Vcb record on the CdData.VcbQueue.
354 //
355
356 InsertHeadList( &CdData.VcbQueue, &Vcb->VcbLinks );
357
358 //
359 // Set the Target Device Object and Vpb fields, referencing the
360 // Target device for the mount.
361 //
362
364 Vcb->TargetDeviceObject = TargetDeviceObject;
365 Vcb->Vpb = Vpb;
366
367 //
368 // Set the removable media flag based on the real device's
369 // characteristics
370 //
371
372 if (FlagOn( Vpb->RealDevice->Characteristics, FILE_REMOVABLE_MEDIA )) {
373
375 }
376
377 //
378 // Initialize the generic Fcb Table.
379 //
380
381 RtlInitializeGenericTable( &Vcb->FcbTable,
385 NULL );
386
387 //
388 // Show that we have a mount in progress.
389 //
390
392
393 //
394 // Refererence the Vcb for two reasons. The first is a reference
395 // that prevents the Vcb from going away on the last close unless
396 // dismount has already occurred. The second is to make sure
397 // we don't go into the dismount path on any error during mount
398 // until we get to the Mount cleanup.
399 //
400
401 Vcb->VcbReference = 1 + CDFS_RESIDUAL_REFERENCE;
402
403 //
404 // Update the TOC information in the Vcb.
405 //
406
407 Vcb->CdromToc = CdromToc;
408 Vcb->TocLength = TocLength;
409 Vcb->TrackCount = TocTrackCount;
410 Vcb->DiskFlags = TocDiskFlags;
411
412 //
413 // If this disk contains audio tracks only then set the audio flag.
414 //
415
416 if (TocDiskFlags == CDROM_DISK_AUDIO_TRACK) {
417
419 }
420
421 //
422 // Set the block factor.
423 //
424
425 Vcb->BlockFactor = BlockFactor;
426
427 //
428 // Set the media change count on the device
429 //
430
431 CdUpdateMediaChangeCount( Vcb, MediaChangeCount);
432}
#define CDFS_RESIDUAL_REFERENCE
Definition: cddata.h:43
RTL_GENERIC_COMPARE_ROUTINE CdFcbTableCompare
Definition: strucsup.c:167
RTL_GENERIC_FREE_ROUTINE CdDeallocateFcbTable
Definition: strucsup.c:188
RTL_GENERIC_ALLOCATE_ROUTINE CdAllocateFcbTable
Definition: strucsup.c:178
#define CdUpdateMediaChangeCount(V, C)
Definition: cdprocs.h:1448
#define CdUpdateVcbCondition(V, C)
Definition: cdprocs.h:1449
#define TAG_VPB
Definition: cdprocs.h:106
#define VCB_STATE_REMOVABLE_MEDIA
Definition: cdstruc.h:710
#define VCB_STATE_CDXA
Definition: cdstruc.h:711
struct _VCB VCB
@ VcbMountInProgress
Definition: cdstruc.h:491
#define CDFS_NTC_VCB
Definition: nodetype.h:28
#define InsertHeadList(ListHead, Entry)
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
VOID NTAPI RtlInitializeGenericTable(IN PRTL_GENERIC_TABLE Table, IN PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine, IN PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine, IN PRTL_GENERIC_FREE_ROUTINE FreeRoutine, IN PVOID TableContext)
Definition: generictable.c:100
#define FILE_REMOVABLE_MEDIA
Definition: nt_native.h:807
#define CDROM_DISK_AUDIO_TRACK
Definition: ntddcdrm.h:145
VOID NTAPI FsRtlNotifyInitializeSync(IN PNOTIFY_SYNC *NotifySync)
Definition: notify.c:1590
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:160
#define ObReferenceObject
Definition: obfuncs.h:204
RTL_GENERIC_FREE_ROUTINE * PRTL_GENERIC_FREE_ROUTINE
Definition: rtltypes.h:475
RTL_GENERIC_COMPARE_ROUTINE * PRTL_GENERIC_COMPARE_ROUTINE
Definition: rtltypes.h:458
RTL_GENERIC_ALLOCATE_ROUTINE * PRTL_GENERIC_ALLOCATE_ROUTINE
Definition: rtltypes.h:467

◆ CdInsertPrefix()

VOID CdInsertPrefix ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFCB  Fcb,
_In_ PCD_NAME  Name,
_In_ BOOLEAN  IgnoreCase,
_In_ BOOLEAN  ShortNameMatch,
_Inout_ PFCB  ParentFcb 
)

Definition at line 52 of file prefxsup.c.

87{
88 ULONG PrefixFlags;
89 PNAME_LINK NameLink;
90 PPREFIX_ENTRY PrefixEntry;
91 PRTL_SPLAY_LINKS *TreeRoot;
92
93 PWCHAR NameBuffer;
94
95 PAGED_CODE();
96
97 //
98 // Check if we need to allocate a prefix entry for the short name.
99 // If we can't allocate one then fail quietly. We don't have to
100 // insert the name.
101 //
102
103 PrefixEntry = &Fcb->FileNamePrefix;
104
105 if (ShortNameMatch) {
106
107 if (Fcb->ShortNamePrefix == NULL) {
108
110 sizeof( PREFIX_ENTRY ),
112
113 if (Fcb->ShortNamePrefix == NULL) { return; }
114
116 }
117
118 PrefixEntry = Fcb->ShortNamePrefix;
119 }
120
121 //
122 // Capture the local variables for the separate cases.
123 //
124
125 if (IgnoreCase) {
126
128 NameLink = &PrefixEntry->IgnoreCaseName;
129 TreeRoot = &ParentFcb->IgnoreCaseRoot;
130
131 } else {
132
133 PrefixFlags = PREFIX_FLAG_EXACT_CASE_IN_TREE;
134 NameLink = &PrefixEntry->ExactCaseName;
135 TreeRoot = &ParentFcb->ExactCaseRoot;
136 }
137
138 //
139 // If neither name is in the tree then check whether we have a buffer for this
140 // name
141 //
142
143 if (!FlagOn( PrefixEntry->PrefixFlags,
145
146 //
147 // Allocate a new buffer if the embedded buffer is too small.
148 //
149
150 NameBuffer = PrefixEntry->FileNameBuffer;
151
152 if (Name->FileName.Length > BYTE_COUNT_EMBEDDED_NAME) {
153
155 Name->FileName.Length * 2,
157
158 //
159 // Exit if no name buffer.
160 //
161
162 if (NameBuffer == NULL) { return; }
163 }
164
165 //
166 // Split the buffer and fill in the separate components.
167 //
168
169 PrefixEntry->ExactCaseName.FileName.Buffer = NameBuffer;
170 PrefixEntry->IgnoreCaseName.FileName.Buffer = Add2Ptr( NameBuffer,
171 Name->FileName.Length,
172 PWCHAR );
173
175 PrefixEntry->IgnoreCaseName.FileName.Length =
177 PrefixEntry->ExactCaseName.FileName.Length = Name->FileName.Length;
178 }
179
180 //
181 // Only insert the name if not already present.
182 //
183
184 if (!FlagOn( PrefixEntry->PrefixFlags, PrefixFlags )) {
185
186 //
187 // Initialize the name in the prefix entry.
188 //
189
190 RtlCopyMemory( NameLink->FileName.Buffer,
191 Name->FileName.Buffer,
192 Name->FileName.Length );
193
194 CdInsertNameLink( IrpContext,
195 TreeRoot,
196 NameLink );
197
198 PrefixEntry->Fcb = Fcb;
199 SetFlag( PrefixEntry->PrefixFlags, PrefixFlags );
200 }
201
202 return;
203}
BOOLEAN CdInsertNameLink(_In_ PIRP_CONTEXT IrpContext, _Inout_ PRTL_SPLAY_LINKS *RootNode, _In_ PNAME_LINK NameLink)
Definition: prefxsup.c:568
#define TAG_PREFIX_NAME
Definition: cdprocs.h:102
#define TAG_PREFIX_ENTRY
Definition: cdprocs.h:101
#define PREFIX_FLAG_IGNORE_CASE_IN_TREE
Definition: cdstruc.h:307
#define PREFIX_FLAG_EXACT_CASE_IN_TREE
Definition: cdstruc.h:306
#define BYTE_COUNT_EMBEDDED_NAME
Definition: cdstruc.h:171
#define IgnoreCase
Definition: cdprocs.h:461
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
PREFIX_ENTRY FileNamePrefix
Definition: cdstruc.h:1024
PPREFIX_ENTRY ShortNamePrefix
Definition: cdstruc.h:1023
Definition: cdstruc.h:275
struct _FCB * Fcb
Definition: cdstruc.h:281
ULONG PrefixFlags
Definition: cdstruc.h:287
NAME_LINK IgnoreCaseName
Definition: cdstruc.h:299
NAME_LINK ExactCaseName
Definition: cdstruc.h:293
WCHAR FileNameBuffer[BYTE_COUNT_EMBEDDED_NAME]
Definition: cdstruc.h:301

◆ CdIs8dot3Name()

BOOLEAN CdIs8dot3Name ( _In_ PIRP_CONTEXT  IrpContext,
_In_ UNICODE_STRING  FileName 
)

Definition at line 429 of file namesup.c.

451{
452 CHAR DbcsNameBuffer[ BYTE_COUNT_8_DOT_3 ];
453 STRING DbcsName = {0};
454
455 PWCHAR NextWchar;
456 ULONG Count;
457
458 ULONG DotCount = 0;
459 BOOLEAN LastCharDot = FALSE;
460
461 PAGED_CODE();
462
463 UNREFERENCED_PARAMETER( IrpContext );
464
465 //
466 // The length must be less than 24 bytes.
467 //
468
469 NT_ASSERT( FileName.Length != 0 );
470 if (FileName.Length > BYTE_COUNT_8_DOT_3) {
471
472 return FALSE;
473 }
474
475 //
476 // Walk though and check for a space character.
477 //
478
479 NextWchar = FileName.Buffer;
480 Count = 0;
481
482 do {
483
484 //
485 // No spaces allowed.
486 //
487
488 if (*NextWchar == L' ') { return FALSE; }
489
490 if (*NextWchar == L'.') {
491
492 //
493 // Not an 8.3 name if more than 1 dot or more than 8 characters
494 // remaining. (It is legal for the dot to be in the ninth
495 // position)
496 //
497
498 if ((DotCount > 0) ||
499 (Count > 8 * sizeof( WCHAR ))) {
500
501 return FALSE;
502 }
503
504 DotCount += 1;
505 LastCharDot = TRUE;
506
507 } else {
508
509 LastCharDot = FALSE;
510 }
511
512 Count += 2;
513 NextWchar += 1;
514
515 } while (Count < FileName.Length);
516
517 //
518 // Go ahead and truncate the dot if at the end.
519 //
520
521 if (LastCharDot) {
522
523 FileName.Length -= sizeof( WCHAR );
524 }
525
526 //
527 // Create an Oem name to use to check for a valid short name.
528 //
529
530 DbcsName.MaximumLength = BYTE_COUNT_8_DOT_3;
531 DbcsName.Buffer = DbcsNameBuffer;
532
533 if (!NT_SUCCESS( RtlUnicodeStringToCountedOemString( &DbcsName,
534 &FileName,
535 FALSE ))) {
536
537 return FALSE;
538 }
539
540 //
541 // We have now initialized the Oem string. Call the FsRtl package to check for a
542 // valid FAT name.
543 //
544
545 return FsRtlIsFatDbcsLegal( DbcsName, FALSE, FALSE, FALSE );
546}
BOOLEAN NTAPI FsRtlIsFatDbcsLegal(IN ANSI_STRING DbcsName, IN BOOLEAN WildCardsPermissible, IN BOOLEAN PathNamePermissible, IN BOOLEAN LeadingBackslashPermissible)
Definition: dbcsname.c:466
std::wstring STRING
Definition: fontsub.cpp:33
char CHAR
Definition: xmlstorage.h:175

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

◆ CdIsLegalName()

BOOLEAN CdIsLegalName ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PUNICODE_STRING  FileName 
)

Definition at line 377 of file namesup.c.

398{
399 PWCHAR Wchar;
400
401 PAGED_CODE();
402
403 UNREFERENCED_PARAMETER( IrpContext );
404
405 //
406 // Check if name corresponds to a legal file name.
407 //
408
409 for (Wchar = FileName->Buffer;
410 Wchar < Add2Ptr( FileName->Buffer, FileName->Length, PWCHAR );
411 Wchar++) {
412
413 if ((*Wchar < 0xff) &&
415 (*Wchar != L'"') &&
416 (*Wchar != L'<') &&
417 (*Wchar != L'>') &&
418 (*Wchar != L'|')) {
419
420 return FALSE;
421 }
422 }
423
424 return TRUE;
425}
#define FsRtlIsAnsiCharacterLegalHpfs(C, WILD)
Definition: fsrtlfuncs.h:1614

Referenced by CdUpdateDirentName().

◆ CdIsNameInExpression()

BOOLEAN CdIsNameInExpression ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PCD_NAME  CurrentName,
_In_ PCD_NAME  SearchExpression,
_In_ ULONG  WildcardFlags,
_In_ BOOLEAN  CheckVersion 
)

Definition at line 844 of file namesup.c.

881{
882 BOOLEAN Match = TRUE;
883 PAGED_CODE();
884
885 UNREFERENCED_PARAMETER( IrpContext );
886
887 //
888 // If there are wildcards in the expression then we call the
889 // appropriate FsRtlRoutine.
890 //
891
892 if (FlagOn( WildcardFlags, CCB_FLAG_ENUM_NAME_EXP_HAS_WILD )) {
893
894 Match = FsRtlIsNameInExpression( &SearchExpression->FileName,
895 &CurrentName->FileName,
896 FALSE,
897 NULL );
898
899 //
900 // Otherwise do a direct memory comparison for the name string.
901 //
902
903 } else {
904
905 if ((CurrentName->FileName.Length != SearchExpression->FileName.Length) ||
906 (!RtlEqualMemory( CurrentName->FileName.Buffer,
907 SearchExpression->FileName.Buffer,
908 CurrentName->FileName.Length ))) {
909
910 Match = FALSE;
911 }
912 }
913
914 //
915 // Check the version numbers if requested by the user and we have a
916 // match on the name and the version number is present.
917 //
918
919 if (Match && CheckVersion && SearchExpression->VersionString.Length &&
920 !FlagOn( WildcardFlags, CCB_FLAG_ENUM_VERSION_MATCH_ALL )) {
921
922 //
923 // If there are wildcards in the expression then call the
924 // appropriate search expression.
925 //
926
927 if (FlagOn( WildcardFlags, CCB_FLAG_ENUM_VERSION_EXP_HAS_WILD )) {
928
929 Match = FsRtlIsNameInExpression( &SearchExpression->VersionString,
930 &CurrentName->VersionString,
931 FALSE,
932 NULL );
933
934 //
935 // Otherwise do a direct memory comparison for the name string.
936 //
937
938 } else {
939
940 if ((CurrentName->VersionString.Length != SearchExpression->VersionString.Length) ||
941 (!RtlEqualMemory( CurrentName->VersionString.Buffer,
942 SearchExpression->VersionString.Buffer,
943 CurrentName->VersionString.Length ))) {
944
945 Match = FALSE;
946 }
947 }
948 }
949
950 return Match;
951}
#define CCB_FLAG_ENUM_NAME_EXP_HAS_WILD
Definition: cdstruc.h:1114
#define CCB_FLAG_ENUM_VERSION_EXP_HAS_WILD
Definition: cdstruc.h:1115
#define CCB_FLAG_ENUM_VERSION_MATCH_ALL
Definition: cdstruc.h:1117
BOOLEAN NTAPI FsRtlIsNameInExpression(IN PUNICODE_STRING Expression, IN PUNICODE_STRING Name, IN BOOLEAN IgnoreCase, IN PWCHAR UpcaseTable OPTIONAL)
Definition: name.c:514

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

◆ CdLbnToMmSsFf()

VOID CdLbnToMmSsFf ( _In_ ULONG  Blocks,
_Out_writes_(3) PUCHAR  Msf 
)

Referenced by CdTocSerial().

◆ 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}
ULONG CdCheckRawDirentBounds(_In_ PIRP_CONTEXT IrpContext, _In_ PDIRENT_ENUM_CONTEXT DirContext)
Definition: dirsup.c:1688
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
Definition: dirsup.c:399
#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

Referenced by _Requires_lock_held_(), and CdCreateInternalStream().

◆ CdLookupFcbTable()

PFCB CdLookupFcbTable ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PVCB  Vcb,
_In_ FILE_ID  FileId 
)

Definition at line 2107 of file strucsup.c.

2132{
2135 PFCB ReturnFcb = NULL;
2136
2137 PAGED_CODE();
2138
2139 Key.FileId = FileId;
2140
2142
2143 if (Hit != NULL) {
2144
2145 ReturnFcb = Hit->Fcb;
2146 }
2147
2148 return ReturnFcb;
2149
2150 UNREFERENCED_PARAMETER( IrpContext );
2151}
_Must_inspect_result_ NTSYSAPI PVOID NTAPI RtlLookupElementGenericTable(_In_ PRTL_GENERIC_TABLE Table, _In_ PVOID Buffer)

Referenced by _Requires_lock_held_(), and CdCreateFcb().

◆ 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}
enum _XA_EXTENT_TYPE XA_EXTENT_TYPE
#define XA_SECTOR_SIZE
Definition: cd.h:35
#define CdRawDirent(IC, DC)
Definition: dirsup.c:88
BOOLEAN CdLookupNextDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PDIRENT_ENUM_CONTEXT CurrentDirContext, _Inout_ PDIRENT_ENUM_CONTEXT NextDirContext)
Definition: dirsup.c:208
Dirent ExtentType
Definition: dirsup.c:520
XA_EXTENT_TYPE CdCheckForXAExtent(_In_ PIRP_CONTEXT IrpContext, _In_ PRAW_DIRENT RawDirent, _Inout_ PDIRENT Dirent)
Definition: dirsup.c:1790
struct _RIFF_HEADER RIFF_HEADER
#define FILE_CONTEXT_MULTIPLE_DIRENTS
Definition: cdstruc.h:1739
#define Int32x32To64(a, b)
ULONG StartingOffset
Definition: cdstruc.h:1593
ULONG InterleaveGapSize
Definition: cdstruc.h:1627
ULONG FileUnitSize
Definition: cdstruc.h:1626
ULONG SystemUseOffset
Definition: cdstruc.h:1633
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

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
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1115

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

◆ CdLookupNextPathEntry()

BOOLEAN CdLookupNextPathEntry ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PPATH_ENUM_CONTEXT  PathContext,
_Inout_ PPATH_ENTRY  PathEntry 
)

Definition at line 207 of file pathsup.c.

242{
243 LONGLONG CurrentBaseOffset;
244
245 PAGED_CODE();
246
247 //
248 // Get the offset of the next path entry within the current
249 // data block.
250 //
251
252 PathContext->DataOffset += PathEntry->PathEntryLength;
253
254 //
255 // If we are in the last data block then check if we are beyond the
256 // end of the file.
257 //
258
259 if (PathContext->LastDataBlock) {
260
261 if (PathContext->DataOffset >= PathContext->DataLength) {
262
263 return FALSE;
264 }
265
266 //
267 // If we are not in the last data block of the path table and
268 // this offset is in the second sector then move to the next
269 // data block.
270 //
271
272 } else if (PathContext->DataOffset >= SECTOR_SIZE) {
273
274 CurrentBaseOffset = PathContext->BaseOffset + SECTOR_SIZE;
275
276 CdMapPathTableBlock( IrpContext,
277 IrpContext->Vcb->PathTableFcb,
278 CurrentBaseOffset,
279 PathContext );
280
281 //
282 // Set up our current offset into the Path Context.
283 //
284
285 PathContext->DataOffset -= SECTOR_SIZE;
286 }
287
288 //
289 // Now update the path entry with the values from the on-disk
290 // structure.
291 //
292
293 return CdUpdatePathEntryFromRawPathEntry( IrpContext,
294 PathEntry->Ordinal + 1,
295 TRUE,
296 PathContext,
297 PathEntry );
298}
VOID CdMapPathTableBlock(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ LONGLONG BaseOffset, _Inout_ PPATH_ENUM_CONTEXT PathContext)
Definition: pathsup.c:484

Referenced by _Requires_lock_held_().

◆ CdLookupPathEntry()

VOID CdLookupPathEntry ( _In_ PIRP_CONTEXT  IrpContext,
_In_ ULONG  PathEntryOffset,
_In_ ULONG  Ordinal,
_In_ BOOLEAN  VerifyBounds,
_Inout_ PCOMPOUND_PATH_ENTRY  CompoundPathEntry 
)

Referenced by _Requires_lock_held_().

◆ CdMarkDevForVerifyIfVcbMounted()

BOOLEAN CdMarkDevForVerifyIfVcbMounted ( _Inout_ PVCB  Vcb)

Definition at line 359 of file verfysup.c.

381{
383 KIRQL SavedIrql;
384
385 IoAcquireVpbSpinLock( &SavedIrql );
386
387#ifdef _MSC_VER
388#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
389#endif
390 if (Vcb->Vpb->RealDevice->Vpb == Vcb->Vpb) {
391
392 CdMarkRealDevForVerify( Vcb->Vpb->RealDevice);
393 Marked = TRUE;
394 }
395 else {
396
397 //
398 // Flag this to avoid the VPB spinlock in future passes.
399 //
400
402 }
403
404 IoReleaseVpbSpinLock( SavedIrql );
405
406 return Marked;
407}
#define CdMarkRealDevForVerify(DO)
Definition: cdprocs.h:1451
#define VCB_STATE_VPB_NOT_ON_DEVICE
Definition: cdstruc.h:714
#define Marked(f)
Definition: render.c:146
VOID NTAPI IoReleaseVpbSpinLock(IN KIRQL Irql)
Definition: volume.c:1215
VOID NTAPI IoAcquireVpbSpinLock(OUT PKIRQL Irql)
Definition: volume.c:1204

Referenced by _Requires_lock_held_(), and CdVerifyVcb().

◆ CdNoopAcquire()

BOOLEAN NTAPI CdNoopAcquire ( _In_ PVOID  Fcb,
_In_ BOOLEAN  Wait 
)

Definition at line 218 of file resrcsup.c.

242{
243 PAGED_CODE();
244
247
248 return TRUE;
249}

Referenced by CdInitializeGlobalData().

◆ CdNoopRelease()

VOID NTAPI CdNoopRelease ( _In_ PVOID  Fcb)

Definition at line 254 of file resrcsup.c.

275{
276 PAGED_CODE();
277
279}

Referenced by CdInitializeGlobalData().

◆ CdOperationIsDasdOpen()

static INLINE BOOLEAN CdOperationIsDasdOpen ( _In_ PIRP_CONTEXT  IrpContext)
static

Definition at line 1392 of file cdprocs.h.

1395{
1397
1398 return ((IrpContext->MajorFunction == IRP_MJ_CREATE) &&
1399 (IrpSp->FileObject->FileName.Length == 0) &&
1400 (IrpSp->FileObject->RelatedFileObject == NULL));
1401}

Referenced by _Requires_lock_held_().

◆ CdPerformDevIoCtrl()

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 
)

Definition at line 1446 of file deviosup.c.

1456{
1457 PAGED_CODE();
1458
1459 return CdPerformDevIoCtrlEx( IrpContext,
1461 Device,
1462 NULL,
1463 0,
1467 OverrideVerify,
1468 Iosb);
1469}
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)
Definition: deviosup.c:1329
return Iosb
Definition: create.c:4402
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID _In_ ULONG _In_ BOOLEAN InternalDeviceIoControl
Definition: iofuncs.h:720

Referenced by _Success_(), and CdVerifyVcb().

◆ CdPerformDevIoCtrlEx()

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 
)

Definition at line 1329 of file deviosup.c.

1374{
1376 PIRP Irp;
1377 KEVENT Event;
1378 IO_STATUS_BLOCK LocalIosb;
1379 PIO_STATUS_BLOCK IosbToUse = &LocalIosb;
1380
1381 PAGED_CODE();
1382
1383 UNREFERENCED_PARAMETER( IrpContext );
1384
1385 //
1386 // Check if the user gave us an Iosb.
1387 //
1388
1389 if (ARGUMENT_PRESENT( Iosb )) {
1390
1391 IosbToUse = Iosb;
1392 }
1393
1394 IosbToUse->Status = 0;
1395 IosbToUse->Information = 0;
1396
1398
1400 Device,
1406 &Event,
1407 IosbToUse );
1408
1409 if (Irp == NULL) {
1410
1412 }
1413
1414 if (OverrideVerify) {
1415
1417 }
1418
1420
1421 //
1422 // We check for device not ready by first checking Status
1423 // and then if status pending was returned, the Iosb status
1424 // value.
1425 //
1426
1427 if (Status == STATUS_PENDING) {
1428
1430 Executive,
1431 KernelMode,
1432 FALSE,
1434
1435 Status = IosbToUse->Status;
1436 }
1437
1438 NT_ASSERT( !(OverrideVerify && (STATUS_VERIFY_REQUIRED == Status)));
1439
1440 return Status;
1441}
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define STATUS_VERIFY_REQUIRED
Definition: udferr_usr.h:130
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
#define SL_OVERRIDE_VERIFY_VOLUME
Definition: iotypes.h:1823

Referenced by CdPerformDevIoCtrl(), and CdProcessToc().

◆ CdProcessToc()

NTSTATUS CdProcessToc ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PDEVICE_OBJECT  TargetDeviceObject,
_In_ PCDROM_TOC_LARGE  CdromToc,
_Inout_ PULONG  Length,
_Out_ PULONG  TrackCount,
_Inout_ PULONG  DiskFlags 
)

Definition at line 2201 of file strucsup.c.

2237{
2241
2242 ULONG CurrentTrack;
2243 ULONG LocalTrackCount;
2244 ULONG LocalTocLength;
2245 ULONG Address = 0;
2246 BOOLEAN UseReadToc = FALSE;
2247
2248 union {
2249
2250 UCHAR BigEndian[2];
2251 USHORT Length;
2252
2253 } BiasedTocLength;
2254
2256
2257 PAGED_CODE();
2258
2259 //
2260 // Zero the command block. This conveniently corresponds to an
2261 // LBA mode READ_TOC request.
2262 //
2263
2264 RtlZeroMemory( &Command, sizeof( Command));
2265
2266RetryReadToc:
2267
2268 //
2269 // Go ahead and read the table of contents
2270 //
2271
2272 Status = CdPerformDevIoCtrlEx( IrpContext,
2275 &Command,
2276 sizeof( Command ),
2277 CdromToc,
2278 sizeof( CDROM_TOC_LARGE ),
2279 FALSE,
2280 TRUE,
2281 &Iosb );
2282
2283 //
2284 // Nothing to process if this request fails.
2285 //
2286
2287 if (!NT_SUCCESS( Status )) {
2288
2289 //
2290 // If the underlying device does not support READ_TOC_EX, try the old method.
2291 //
2292
2293 if (!UseReadToc &&
2295 (Status == STATUS_NOT_IMPLEMENTED) || /* ReactOS Change: we return STATUS_NOT_IMPLEMENTED for IOCTL_CDROM_READ_TOC_EX */
2297
2298 UseReadToc = TRUE;
2299 goto RetryReadToc;
2300 }
2301
2302 return Status;
2303 }
2304
2305 //
2306 // Get the number of tracks and stated size of this structure.
2307 //
2308
2309 CurrentTrack = 0;
2310 LocalTrackCount = CdromToc->LastTrack - CdromToc->FirstTrack + 1;
2311 LocalTocLength = PtrOffset( CdromToc, &CdromToc->TrackData[LocalTrackCount + 1] );
2312
2313 //
2314 // Get out if there is an immediate problem with the TOC.
2315 //
2316
2317 if ((LocalTocLength > Iosb.Information) ||
2318 (CdromToc->FirstTrack > CdromToc->LastTrack)) {
2319
2321 return Status;
2322 }
2323
2324 //
2325 // Walk through the individual tracks. Stop at the first data track after
2326 // any lead-in audio tracks.
2327 //
2328
2329 do {
2330
2331 //
2332 // Get the next track.
2333 //
2334
2335 Track = &CdromToc->TrackData[CurrentTrack];
2336
2337 //
2338 // If this is a data track then check if we have only seen audio tracks
2339 // to this point.
2340 //
2341
2342 if (FlagOn( Track->Control, TOC_DATA_TRACK )) {
2343
2344 //
2345 // If we have only seen audio tracks then assume this is a
2346 // CD+ disk. Hide the current data track and only return
2347 // the previous audio tracks. Set the disk type to be mixed
2348 // data/audio.
2349 //
2350
2351 if (FlagOn( *DiskFlags, CDROM_DISK_AUDIO_TRACK ) &&
2352 !FlagOn( *DiskFlags, CDROM_DISK_DATA_TRACK )) {
2353
2354 //
2355 // Remove one track from the TOC.
2356 //
2357
2358 CdromToc->LastTrack -= 1;
2359
2360 //
2361 // Knock 2.5 minutes off the current track to hide the final leadin.
2362 // 2.5 min = 150 sec = (x 75) 11250 frames (sectors).
2363 //
2364
2365 SwapCopyUchar4( &Address, &Track->Address);
2366 Address -= 11250;
2367 SwapCopyUchar4( &Track->Address, &Address);
2368
2369 Track->TrackNumber = TOC_LAST_TRACK;
2370
2371 //
2372 // Set the disk type to mixed data/audio.
2373 //
2374
2375 SetFlag( *DiskFlags, CDROM_DISK_DATA_TRACK );
2376
2377 break;
2378 }
2379
2380 //
2381 // Set the flag to indicate data tracks present.
2382 //
2383
2384 SetFlag( *DiskFlags, CDROM_DISK_DATA_TRACK );
2385
2386 //
2387 // If this is a audio track then set the flag indicating audio
2388 // tracks.
2389 //
2390
2391 } else {
2392
2393 SetFlag( *DiskFlags, CDROM_DISK_AUDIO_TRACK );
2394 }
2395
2396 //
2397 // Set our index for the next track.
2398 //
2399
2400 CurrentTrack += 1;
2401
2402 } while (CurrentTrack < LocalTrackCount);
2403
2404 //
2405 // Set the length to point just past the last track we looked at.
2406 //
2407
2408 *TrackCount = CurrentTrack;
2409 *Length = PtrOffset( CdromToc, &CdromToc->TrackData[CurrentTrack + 1] );
2410 BiasedTocLength.Length = (USHORT) *Length - 2;
2411
2412 CdromToc->Length[0] = BiasedTocLength.BigEndian[1];
2413 CdromToc->Length[1] = BiasedTocLength.BigEndian[0];
2414
2415 return Status;
2416}
#define TOC_LAST_TRACK
Definition: cd.h:100
#define TOC_DATA_TRACK
Definition: cd.h:99
#define SwapCopyUchar4(Dst, Src)
Definition: cdprocs.h:1719
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)
Definition: deviosup.c:1329
#define PtrOffset(BASE, OFFSET)
Definition: cdprocs.h:1547
#define Track(x, y)
Definition: memtrack.h:11
#define IOCTL_CDROM_READ_TOC_EX
Definition: ntddcdrm.h:79
#define CDROM_DISK_DATA_TRACK
Definition: ntddcdrm.h:146
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
static WCHAR Address[46]
Definition: ping.c:68
Definition: shell.h:41
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ CdRaiseStatusEx()

INLINE DECLSPEC_NORETURN VOID CdRaiseStatusEx ( _In_ PIRP_CONTEXT  IrpContext,
_In_ NTSTATUS  Status,
_In_ BOOLEAN  NormalizeStatus,
_In_ ULONG  Fileid,
_In_ ULONG  Line 
)

Definition at line 1835 of file cdprocs.h.

1842{
1843 if (NormalizeStatus) {
1844
1845 IrpContext->ExceptionStatus = FsRtlNormalizeNtstatus( Status, STATUS_UNEXPECTED_IO_ERROR);
1846 }
1847 else {
1848
1849 IrpContext->ExceptionStatus = Status;
1850 }
1851
1852 IrpContext->RaisedAtLineFile = (Fileid << 16) | Line;
1853
1854 ExRaiseStatus( IrpContext->ExceptionStatus );
1855}
NTSTATUS NTAPI FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize, IN NTSTATUS NormalizedNtStatus)
Definition: filter.c:90
#define STATUS_UNEXPECTED_IO_ERROR
Definition: ntstatus.h:469
Definition: ncftp.h:79

◆ CdReadSectors()

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 
)

Definition at line 1080 of file deviosup.c.

1126{
1128 KEVENT Event;
1129 PIRP Irp;
1130
1131 PAGED_CODE();
1132
1133 //
1134 // Initialize the event.
1135 //
1136
1138
1139 //
1140 // Attempt to allocate the IRP. If unsuccessful, raise
1141 // STATUS_INSUFFICIENT_RESOURCES.
1142 //
1143
1146 Buffer,
1147 ByteCount,
1149 &Event,
1150 &IrpContext->Irp->IoStatus );
1151
1152 if (Irp == NULL) {
1153
1155 }
1156
1157 //
1158 // Ignore the change line (verify) for mount and verify requests
1159 //
1160
1162
1163 //
1164 // Send the request down to the driver. If an error occurs return
1165 // it to the caller.
1166 //
1167
1169
1170 //
1171 // If the status was STATUS_PENDING then wait on the event.
1172 //
1173
1174 if (Status == STATUS_PENDING) {
1175
1177 Executive,
1178 KernelMode,
1179 FALSE,
1180 NULL );
1181
1182 //
1183 // On a successful wait pull the status out of the IoStatus block.
1184 //
1185
1186 if (NT_SUCCESS( Status )) {
1187
1188 Status = IrpContext->Irp->IoStatus.Status;
1189 }
1190 }
1191
1192 //
1193 // Check whether we should raise in the error case.
1194 //
1195
1196 if (!NT_SUCCESS( Status )) {
1197
1198 if (!ReturnError) {
1199
1200 CdNormalizeAndRaiseStatus( IrpContext, Status );
1201 }
1202
1203 //
1204 // We don't raise, but return FALSE to indicate an error.
1205 //
1206
1207 return FALSE;
1208
1209 //
1210 // The operation completed successfully.
1211 //
1212
1213 } else {
1214
1215 return TRUE;
1216 }
1217}
_In_ PFCB _In_ LONGLONG StartingOffset
Definition: cdprocs.h:291
#define CdNormalizeAndRaiseStatus(IC, S)
Definition: cdprocs.h:1860
Definition: bufpool.h:45
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1069

Referenced by _Success_(), and CdFindActiveVolDescriptor().

◆ CdRemovePrefix()

VOID CdRemovePrefix ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFCB  Fcb 
)

Definition at line 207 of file prefxsup.c.

229{
230 PAGED_CODE();
231
232 UNREFERENCED_PARAMETER( IrpContext );
233
234 //
235 // Start with the short name prefix entry.
236 //
237
238 if (Fcb->ShortNamePrefix != NULL) {
239
241
243 }
244
246
248 }
249
252 }
253
254 //
255 // Now do the long name prefix entries.
256 //
257
259
261 }
262
264
266 }
267
270
271 //
272 // Deallocate any buffer we may have allocated.
273 //
274
277
280 }
281
282 return;
283}
NTSYSAPI PRTL_SPLAY_LINKS NTAPI RtlDelete(_In_ PRTL_SPLAY_LINKS Links)

Referenced by _Requires_lock_held_().

◆ CdSerial32()

ULONG CdSerial32 ( _In_reads_bytes_(ByteCount) PCHAR  Buffer,
_In_ ULONG  ByteCount 
)

Definition at line 1185 of file cddata.c.

1209{
1210 union {
1211 UCHAR Bytes[4];
1212 ULONG SerialId;
1213 } Checksum;
1214
1215 PAGED_CODE();
1216
1217 //
1218 // Initialize the serial number.
1219 //
1220
1221 Checksum.SerialId = 0;
1222
1223 //
1224 // Continue while there are more bytes to use.
1225 //
1226
1227 while (ByteCount--) {
1228
1229 //
1230 // Increment this sub-checksum.
1231 //
1232
1233 Checksum.Bytes[ByteCount & 0x3] += *(Buffer++);
1234 }
1235
1236 //
1237 // Return the checksums as a ULONG.
1238 //
1239
1240 return Checksum.SerialId;
1241}
_In_ UINT Bytes
Definition: mmcopy.h:9

Referenced by CdFindActiveVolDescriptor().

◆ CdSetThreadContext()

VOID CdSetThreadContext ( _Inout_ PIRP_CONTEXT  IrpContext,
_In_ PTHREAD_CONTEXT  ThreadContext 
)

Definition at line 981 of file cddata.c.

1012{
1013 PTHREAD_CONTEXT CurrentThreadContext;
1014#ifdef __REACTOS__
1015 ULONG_PTR StackTop;
1016 ULONG_PTR StackBottom;
1017#endif
1018
1019 PAGED_CODE();
1020
1021 ASSERT_IRP_CONTEXT( IrpContext );
1022
1023 //
1024 // Get the current top-level irp out of the thread storage.
1025 // If NULL then this is the top-level request.
1026 //
1027
1028 CurrentThreadContext = (PTHREAD_CONTEXT) IoGetTopLevelIrp();
1029
1030 if (CurrentThreadContext == NULL) {
1031
1032 SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL );
1033 }
1034
1035 //
1036 // Initialize the input context unless we are using the current
1037 // thread context block. We use the new block if our caller
1038 // specified this or the existing block is invalid.
1039 //
1040 // The following must be true for the current to be a valid Cdfs context.
1041 //
1042 // Structure must lie within current stack.
1043 // Address must be ULONG aligned.
1044 // Cdfs signature must be present.
1045 //
1046 // If this is not a valid Cdfs context then use the input thread
1047 // context and store it in the top level context.
1048 //
1049
1050#ifdef __REACTOS__
1051 IoGetStackLimits( &StackTop, &StackBottom);
1052#endif
1053
1054#ifdef _MSC_VER
1055#pragma warning(suppress: 6011) // Bug in PREFast around bitflag operations
1056#endif
1057 if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL ) ||
1058#ifndef __REACTOS__
1059 (!IoWithinStackLimits( (ULONG_PTR)CurrentThreadContext, sizeof( THREAD_CONTEXT ) ) ||
1060#else
1061 (((ULONG_PTR) CurrentThreadContext > StackBottom - sizeof( THREAD_CONTEXT )) ||
1062 ((ULONG_PTR) CurrentThreadContext <= StackTop) ||
1063#endif
1064 FlagOn( (ULONG_PTR) CurrentThreadContext, 0x3 ) ||
1065 (CurrentThreadContext->Cdfs != 0x53464443))) {
1066
1067 ThreadContext->Cdfs = 0x53464443;
1068 ThreadContext->SavedTopLevelIrp = (PIRP) CurrentThreadContext;
1069 ThreadContext->TopLevelIrpContext = IrpContext;
1070 IoSetTopLevelIrp( (PIRP) ThreadContext );
1071
1072 IrpContext->TopLevel = IrpContext;
1073 IrpContext->ThreadContext = ThreadContext;
1074
1075 SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL_CDFS );
1076
1077 //
1078 // Otherwise use the IrpContext in the thread context.
1079 //
1080
1081 } else {
1082
1083 IrpContext->TopLevel = CurrentThreadContext->TopLevelIrpContext;
1084 }
1085
1086 return;
1087}
THREAD_CONTEXT * PTHREAD_CONTEXT
Definition: cdstruc.h:1386
#define IRP_CONTEXT_FLAG_TOP_LEVEL
Definition: cdstruc.h:1217
VOID NTAPI IoGetStackLimits(OUT PULONG_PTR LowLimit, OUT PULONG_PTR HighLimit)
Definition: util.c:78
LOGICAL NTAPI IoWithinStackLimits(_In_ ULONG_PTR RegionStart, _In_ SIZE_T RegionSize)

Referenced by _IRQL_requires_max_(), and CdFspDispatch().

◆ CdShortNameDirentOffset()

ULONG CdShortNameDirentOffset ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PUNICODE_STRING  Name 
)

Definition at line 955 of file namesup.c.

980{
981 ULONG ResultOffset = MAXULONG;
982 ULONG RemainingByteCount = Name->Length;
983
984 BOOLEAN FoundTilde = FALSE;
985
986 PWCHAR NextWchar;
987
988 PAGED_CODE();
989
990 UNREFERENCED_PARAMETER( IrpContext );
991
992 //
993 // Walk through the name until we either reach the end of the name
994 // or find a tilde character.
995 //
996
997 for (NextWchar = Name->Buffer;
998 RemainingByteCount != 0;
999 NextWchar += 1, RemainingByteCount -= sizeof( WCHAR )) {
1000
1001 //
1002 // Check if this is a dot. Stop constructing any string if
1003 // we found a dot.
1004 //
1005
1006 if (*NextWchar == L'.') {
1007
1008 break;
1009 }
1010
1011 //
1012 // If we already found a tilde then check this character as a
1013 // valid character. It must be a digit or A to F.
1014 //
1015
1016 if (FoundTilde) {
1017
1018 if ((*NextWchar < L'0') ||
1019 (*NextWchar > L'F') ||
1020 ((*NextWchar > L'9') && (*NextWchar < 'A'))) {
1021
1022 ResultOffset = MAXULONG;
1023 break;
1024 }
1025
1026 //
1027 // Shift the result by 4 bits and add in this new character.
1028 //
1029
1030 ResultOffset <<= 4;
1031
1032 if (*NextWchar < L'A') {
1033
1034 ResultOffset += *NextWchar - L'0';
1035
1036 } else {
1037
1038 ResultOffset += (*NextWchar - L'A') + 10;
1039 }
1040
1041 continue;
1042 }
1043
1044 //
1045 // If this is a tilde then start building the dirent string.
1046 //
1047
1048 if (*NextWchar == L'~') {
1049
1050 FoundTilde = TRUE;
1051 ResultOffset = 0;
1052 }
1053 }
1054
1055 return ResultOffset;
1056}
#define MAXULONG
Definition: typedefs.h:251

Referenced by _Success_().

◆ CdTruncateAllocation()

VOID CdTruncateAllocation ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PFCB  Fcb,
_In_ LONGLONG  StartingFileOffset 
)

Definition at line 575 of file allocsup.c.

602{
603 ULONG McbEntryOffset;
604
605 PAGED_CODE();
606
607 ASSERT_IRP_CONTEXT( IrpContext );
608 ASSERT_FCB( Fcb );
610
611 //
612 // Find the entry containg this starting offset.
613 //
614
615 McbEntryOffset = CdFindMcbEntry( IrpContext, Fcb, StartingFileOffset );
616
617 //
618 // Now set the current size of the mcb to this point.
619 //
620
621 Fcb->Mcb.CurrentEntryCount = McbEntryOffset;
622
623 return;
624}
ULONG CdFindMcbEntry(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ LONGLONG FileOffset)
Definition: allocsup.c:732

Referenced by CdCreateInternalStream().

◆ CdUnlockVolumeInternal()

NTSTATUS CdUnlockVolumeInternal ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PVCB  Vcb,
_In_opt_ PFILE_OBJECT  FileObject 
)

Definition at line 288 of file fsctrl.c.

317{
319 KIRQL SavedIrql;
320
321 UNREFERENCED_PARAMETER( IrpContext );
322
323 //
324 // Note that we check the VPB_LOCKED flag here rather than the Vcb
325 // lock flag. The Vpb flag is only set for an explicit lock request, not
326 // for the implicit lock obtained on a volume open with zero share mode.
327 //
328
329 IoAcquireVpbSpinLock( &SavedIrql );
330
331 if (FlagOn(Vcb->Vpb->Flags, VPB_LOCKED) &&
332 (FileObject == Vcb->VolumeLockFileObject)) {
333
334 ClearFlag( Vcb->VcbState, VCB_STATE_LOCKED );
335 ClearFlag( Vcb->Vpb->Flags, VPB_LOCKED);
336 Vcb->VolumeLockFileObject = NULL;
338 }
339
340 IoReleaseVpbSpinLock( SavedIrql );
341
342 return Status;
343}
#define VCB_STATE_LOCKED
Definition: cdstruc.h:709
#define STATUS_NOT_LOCKED
Definition: ntstatus.h:279
#define VPB_LOCKED
Definition: iotypes.h:1808

◆ CdUpcaseName()

VOID CdUpcaseName ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PCD_NAME  Name,
_Inout_ PCD_NAME  UpcaseName 
)

Definition at line 194 of file namesup.c.

219{
221
222 PAGED_CODE();
223
224 UNREFERENCED_PARAMETER( IrpContext );
225
226 //
227 // If the name structures are different then initialize the different components.
228 //
229
230 if (Name != UpcaseName) {
231
232 //
233 // Initialize the version string portion of the name.
234 //
235
236 UpcaseName->VersionString.Length = 0;
237
238 if (Name->VersionString.Length != 0) {
239
240 UpcaseName->VersionString.MaximumLength =
241 UpcaseName->VersionString.Length = Name->VersionString.Length;
242
243 //
244 // Initially set the buffer to point to where we need to insert
245 // the separator.
246 //
247
248 UpcaseName->VersionString.Buffer = Add2Ptr( UpcaseName->FileName.Buffer,
249 Name->FileName.Length,
250 PWCHAR );
251
252 //
253 // We are currently pointing to the location to store the separator.
254 // Store the ';' and then move to the next character to
255 // copy the data.
256 //
257
258#ifdef _MSC_VER
259#pragma prefast( suppress:26015, "CD_NAME structures have two UNICODE_STRING structures pointing to the same allocation. there is no way to tell prefast this is the case and that the allocation is always big enough.");
260#endif
261 *(UpcaseName->VersionString.Buffer) = L';';
262
263 UpcaseName->VersionString.Buffer += 1;
264 }
265 }
266
267 //
268 // Upcase the string using the correct upcase routine.
269 //
270
271 Status = RtlUpcaseUnicodeString( &UpcaseName->FileName,
272 &Name->FileName,
273 FALSE );
274
275 //
276 // This should never fail.
277 //
278
281
282 if (Name->VersionString.Length != 0) {
283
284 Status = RtlUpcaseUnicodeString( &UpcaseName->VersionString,
285 &Name->VersionString,
286 FALSE );
287
288 //
289 // This should never fail.
290 //
291
294 }
295
296 return;
297}
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
Definition: string_lib.cpp:46
#define __analysis_assert(e)
Definition: specstrings.h:259

Referenced by CdUpdateDirentName(), and CdUpdatePathEntryName().

◆ 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}
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 TAG_DIRENT_NAME
Definition: cdprocs.h:87
#define VCB_STATE_JOLIET
Definition: cdstruc.h:708
#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
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264

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

◆ CdUpdatePathEntryName()

VOID CdUpdatePathEntryName ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PPATH_ENTRY  PathEntry,
_In_ BOOLEAN  IgnoreCase 
)

Definition at line 781 of file pathsup.c.

815{
818
819 PAGED_CODE();
820
821 //
822 // Check if this is a self entry. We use a fixed string for this.
823 //
824 // Self-Entry - Length is 1, value is 0.
825 //
826
827 if ((*PathEntry->DirName == 0) &&
828 (PathEntry->DirNameLen == 1)) {
829
830 //
831 // There should be no allocated buffers.
832 //
833
834 NT_ASSERT( !FlagOn( PathEntry->Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER ));
835
836 //
837 // Now use one of the hard coded directory names.
838 //
839
840 PathEntry->CdDirName.FileName = CdUnicodeDirectoryNames[0];
841
842 //
843 // Show that there is no version number.
844 //
845
846 PathEntry->CdDirName.VersionString.Length = 0;
847
848 //
849 // The case name is identical.
850 //
851
852 PathEntry->CdCaseDirName = PathEntry->CdDirName;
853
854 //
855 // Return now.
856 //
857
858 return;
859 }
860
861 //
862 // Compute how large a buffer we will need. If this is an ignore
863 // case operation then we will want a double size buffer. If the disk is not
864 // a Joliet disk then we might need two bytes for each byte in the name.
865 //
866
867 Length = PathEntry->DirNameLen;
868
869 if (IgnoreCase) {
870
871 Length *= 2;
872 }
873
874 if (!FlagOn( IrpContext->Vcb->VcbState, VCB_STATE_JOLIET )) {
875
876 Length *= sizeof( WCHAR );
877 }
878
879 //
880 // Now decide if we need to allocate a new buffer. We will if
881 // this name won't fit in the embedded name buffer and it is
882 // larger than the current allocated buffer. We always use the
883 // allocated buffer if present.
884 //
885 // If we haven't allocated a buffer then use the embedded buffer if the data
886 // will fit. This is the typical case.
887 //
888
889 if (!FlagOn( PathEntry->Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER ) &&
890 (Length <= sizeof( PathEntry->NameBuffer ))) {
891
892 PathEntry->CdDirName.FileName.MaximumLength = sizeof( PathEntry->NameBuffer );
893 PathEntry->CdDirName.FileName.Buffer = PathEntry->NameBuffer;
894
895 } else {
896
897 //
898 // We need to use an allocated buffer. Check if the current buffer
899 // is large enough.
900 //
901
902 if (Length > PathEntry->CdDirName.FileName.MaximumLength) {
903
904 //
905 // Free any allocated buffer.
906 //
907
908 if (FlagOn( PathEntry->Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER )) {
909
910 CdFreePool( &PathEntry->CdDirName.FileName.Buffer );
911 ClearFlag( PathEntry->Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER );
912 }
913
914 PathEntry->CdDirName.FileName.Buffer = FsRtlAllocatePoolWithTag( CdPagedPool,
915 Length,
917
918 SetFlag( PathEntry->Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER );
919
920 PathEntry->CdDirName.FileName.MaximumLength = (USHORT) Length;
921 }
922 }
923
924 //
925 // We now have a buffer for the name. We need to either convert the on-disk bigendian
926 // to little endian or covert the name to Unicode.
927 //
928
929 if (!FlagOn( IrpContext->Vcb->VcbState, VCB_STATE_JOLIET )) {
930
931 Status = RtlOemToUnicodeN( PathEntry->CdDirName.FileName.Buffer,
932 PathEntry->CdDirName.FileName.MaximumLength,
933 &Length,
934 PathEntry->DirName,
935 PathEntry->DirNameLen );
936
939 PathEntry->CdDirName.FileName.Length = (USHORT) Length;
940
941 } else {
942
943 //
944 // Convert this string to little endian.
945 //
946
947 CdConvertBigToLittleEndian( IrpContext,
948 PathEntry->DirName,
949 PathEntry->DirNameLen,
950 (PCHAR) PathEntry->CdDirName.FileName.Buffer );
951
952 PathEntry->CdDirName.FileName.Length = (USHORT) PathEntry->DirNameLen;
953 }
954
955 //
956 // There is no version string.
957 //
958
959 PathEntry->CdDirName.VersionString.Length =
960 PathEntry->CdCaseDirName.VersionString.Length = 0;
961
962 //
963 // If the name string ends with a period then knock off the last
964 // character.
965 //
966
967 if (PathEntry->CdDirName.FileName.Buffer[(PathEntry->CdDirName.FileName.Length - sizeof( WCHAR )) / 2] == L'.') {
968
969 //
970 // Shrink the filename length.
971 //
972
973 PathEntry->CdDirName.FileName.Length -= sizeof( WCHAR );
974 }
975
976 //
977 // Update the case name buffer if necessary. If this is an exact case
978 // operation then just copy the exact case string.
979 //
980
981 if (IgnoreCase) {
982
983 PathEntry->CdCaseDirName.FileName.Buffer = Add2Ptr( PathEntry->CdDirName.FileName.Buffer,
984 PathEntry->CdDirName.FileName.MaximumLength / 2,
985 PWCHAR);
986
987 PathEntry->CdCaseDirName.FileName.MaximumLength = PathEntry->CdDirName.FileName.MaximumLength / 2;
988
989 CdUpcaseName( IrpContext,
990 &PathEntry->CdDirName,
991 &PathEntry->CdCaseDirName );
992
993 } else {
994
995 PathEntry->CdCaseDirName = PathEntry->CdDirName;
996 }
997
998 return;
999}
#define TAG_PATH_ENTRY_NAME
Definition: cdprocs.h:100

◆ CdUpdateVcbFromVolDescriptor()

VOID CdUpdateVcbFromVolDescriptor ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PVCB  Vcb,
_In_reads_bytes_opt_(SECTOR_SIZE) PCHAR  RawIsoVd 
)

Definition at line 436 of file strucsup.c.

463{
464 ULONG StartingBlock;
466
467 LONGLONG FileId = 0;
468
469 PRAW_DIRENT RawDirent;
470 PATH_ENTRY PathEntry;
471 PCD_MCB_ENTRY McbEntry;
472
473 BOOLEAN UnlockVcb = FALSE;
474
475 PAGED_CODE();
476
477 //
478 // Use a try-finally to facilitate cleanup.
479 //
480
481 _SEH2_TRY {
482
483 //
484 // Copy the block size and compute the various block masks.
485 // Block size must not be larger than the sector size. We will
486 // use a default of the CD physical sector size if we are not
487 // on a data-full disc.
488 //
489 // This must always be set.
490 //
491
492 Vcb->BlockSize = ( ARGUMENT_PRESENT( RawIsoVd ) ?
493 CdRvdBlkSz( RawIsoVd, Vcb->VcbState ) :
494 SECTOR_SIZE );
495
496 //
497 // We no longer accept media where blocksize != sector size.
498 //
499
500 if (Vcb->BlockSize != SECTOR_SIZE) {
501
503 }
504
505 Vcb->BlocksPerSector = SECTOR_SIZE / Vcb->BlockSize;
506 Vcb->BlockMask = Vcb->BlockSize - 1;
507 Vcb->BlockInverseMask = ~Vcb->BlockMask;
508
509 Vcb->BlockToSectorShift = 0;
510 Vcb->BlockToByteShift = SECTOR_SHIFT;
511
512 //
513 // If there is a volume descriptor then do the internal Fcb's and
514 // other Vcb fields.
515 //
516
517 if (ARGUMENT_PRESENT( RawIsoVd )) {
518
519 //
520 // Create the path table Fcb and refererence it and the Vcb.
521 //
522
523 CdLockVcb( IrpContext, Vcb );
524 UnlockVcb = TRUE;
525
526 Vcb->PathTableFcb = CdCreateFcb( IrpContext,
527 *((PFILE_ID) &FileId),
529 NULL );
530
531 CdIncrementReferenceCounts( IrpContext, Vcb->PathTableFcb, 1, 1 );
532 CdUnlockVcb( IrpContext, Vcb );
533 UnlockVcb = FALSE;
534
535 //
536 // Compute the stream offset and size of this path table.
537 //
538
539 StartingBlock = CdRvdPtLoc( RawIsoVd, Vcb->VcbState );
540
541 ByteCount = CdRvdPtSz( RawIsoVd, Vcb->VcbState );
542
543 Vcb->PathTableFcb->StreamOffset = BytesFromBlocks( Vcb,
544 SectorBlockOffset( Vcb, StartingBlock ));
545
546 Vcb->PathTableFcb->FileSize.QuadPart = (LONGLONG) (Vcb->PathTableFcb->StreamOffset +
547 ByteCount);
548
549 Vcb->PathTableFcb->ValidDataLength.QuadPart = Vcb->PathTableFcb->FileSize.QuadPart;
550
551 Vcb->PathTableFcb->AllocationSize.QuadPart = LlSectorAlign( Vcb->PathTableFcb->FileSize.QuadPart );
552
553 //
554 // Now add the mapping information.
555 //
556
557 CdLockFcb( IrpContext, Vcb->PathTableFcb );
558
559 CdAddInitialAllocation( IrpContext,
560 Vcb->PathTableFcb,
561 StartingBlock,
562 Vcb->PathTableFcb->AllocationSize.QuadPart );
563
564 CdUnlockFcb( IrpContext, Vcb->PathTableFcb );
565
566 //
567 // Point to the file resource.
568 //
569
570 Vcb->PathTableFcb->Resource = &Vcb->FileResource;
571
572 //
573 // Mark the Fcb as initialized and create the stream file for this.
574 //
575
576 SetFlag( Vcb->PathTableFcb->FcbState, FCB_STATE_INITIALIZED );
577
578 CdCreateInternalStream( IrpContext, Vcb, Vcb->PathTableFcb, &CdInternalStreamNames[0]);
579
580 //
581 // Create the root index and reference it in the Vcb.
582 //
583
584 CdLockVcb( IrpContext, Vcb );
585 UnlockVcb = TRUE;
586 Vcb->RootIndexFcb = CdCreateFcb( IrpContext,
587 *((PFILE_ID) &FileId),
589 NULL );
590
591 CdIncrementReferenceCounts( IrpContext, Vcb->RootIndexFcb, 1, 1 );
592 CdUnlockVcb( IrpContext, Vcb );
593 UnlockVcb = FALSE;
594
595 //
596 // Create the File id by hand for this Fcb.
597 //
598
599 CdSetFidPathTableOffset( Vcb->RootIndexFcb->FileId, Vcb->PathTableFcb->StreamOffset );
600 CdFidSetDirectory( Vcb->RootIndexFcb->FileId );
601
602 //
603 // Create a pseudo path table entry so we can call the initialization
604 // routine for the directory.
605 //
606
607 RawDirent = (PRAW_DIRENT) CdRvdDirent( RawIsoVd, Vcb->VcbState );
608
609 CopyUchar4( &PathEntry.DiskOffset, RawDirent->FileLoc );
610
611 PathEntry.DiskOffset += RawDirent->XarLen;
612 PathEntry.Ordinal = 1;
613 PathEntry.PathTableOffset = Vcb->PathTableFcb->StreamOffset;
614
616 Vcb->RootIndexFcb,
617 NULL,
618 &PathEntry );
619
620 //
621 // Create the stream file for the root directory.
622 //
623
624 CdCreateInternalStream( IrpContext, Vcb, Vcb->RootIndexFcb, &CdInternalStreamNames[1] );
625
626 //
627 // Now do the volume dasd Fcb. Create this and reference it in the
628 // Vcb.
629 //
630
631 CdLockVcb( IrpContext, Vcb );
632 UnlockVcb = TRUE;
633
634 Vcb->VolumeDasdFcb = CdCreateFcb( IrpContext,
635 *((PFILE_ID) &FileId),
637 NULL );
638
639 CdIncrementReferenceCounts( IrpContext, Vcb->VolumeDasdFcb, 1, 1 );
640 CdUnlockVcb( IrpContext, Vcb );
641 UnlockVcb = FALSE;
642
643 //
644 // The file size is the full disk.
645 //
646
647 StartingBlock = CdRvdVolSz( RawIsoVd, Vcb->VcbState );
648
649 Vcb->VolumeDasdFcb->FileSize.QuadPart = LlBytesFromBlocks( Vcb, StartingBlock );
650
651 Vcb->VolumeDasdFcb->AllocationSize.QuadPart =
652 Vcb->VolumeDasdFcb->ValidDataLength.QuadPart = Vcb->VolumeDasdFcb->FileSize.QuadPart;
653
654 //
655 // Now add the extent representing the volume 'by hand'.
656 //
657
658 CdLockFcb( IrpContext, Vcb->VolumeDasdFcb );
659
660 McbEntry = Vcb->VolumeDasdFcb->Mcb.McbArray;
661
662 McbEntry->FileOffset =
663 McbEntry->DiskOffset = 0;
664
665 McbEntry->ByteCount = Vcb->VolumeDasdFcb->AllocationSize.QuadPart;
666
667 McbEntry->DataBlockByteCount =
668 McbEntry->TotalBlockByteCount = McbEntry->ByteCount;
669
670 Vcb->VolumeDasdFcb->Mcb.CurrentEntryCount = 1;
671
672 CdUnlockFcb( IrpContext, Vcb->VolumeDasdFcb );
673
674 //
675 // Point to the file resource.
676 //
677
678 Vcb->VolumeDasdFcb->Resource = &Vcb->FileResource;
679
680 Vcb->VolumeDasdFcb->FileAttributes = FILE_ATTRIBUTE_READONLY;
681
682 //
683 // Mark the Fcb as initialized.
684 //
685
686 SetFlag( Vcb->VolumeDasdFcb->FcbState, FCB_STATE_INITIALIZED );
687
688 //
689 // Check and see if this is an XA disk.
690 //
691
692 if (FlagOn( Vcb->VcbState, VCB_STATE_ISO | VCB_STATE_JOLIET)
694 Add2Ptr( RawIsoVd, 0x400, PCHAR ),
695 8 )) {
696
697 SetFlag( Vcb->VcbState, VCB_STATE_CDXA );
698 }
699
700 //
701 // If this is a music disk then we want to mock this disk to make it
702 // look like ISO disk. We will create a pseudo root directory in
703 // that case.
704 //
705
706 } else if (FlagOn( Vcb->VcbState, VCB_STATE_AUDIO_DISK )) {
707
708 ULONG RootDirectorySize;
709
710 //
711 // Create the path table Fcb and refererence it and the Vcb.
712 //
713
714 CdLockVcb( IrpContext, Vcb );
715 UnlockVcb = TRUE;
716
717 Vcb->PathTableFcb = CdCreateFcb( IrpContext,
718 *((PFILE_ID) &FileId),
720 NULL );
721
722 CdIncrementReferenceCounts( IrpContext, Vcb->PathTableFcb, 1, 1 );
723 CdUnlockVcb( IrpContext, Vcb );
724 UnlockVcb = FALSE;
725
726 //
727 // We only create a pseudo entry for the root.
728 //
729
730 Vcb->PathTableFcb->FileSize.QuadPart = (LONGLONG) (FIELD_OFFSET( RAW_PATH_ISO, DirId ) + 2);
731
732 Vcb->PathTableFcb->ValidDataLength.QuadPart = Vcb->PathTableFcb->FileSize.QuadPart;
733
734 Vcb->PathTableFcb->AllocationSize.QuadPart = LlSectorAlign( Vcb->PathTableFcb->FileSize.QuadPart );
735
736 //
737 // Point to the file resource.
738 //
739
740 Vcb->PathTableFcb->Resource = &Vcb->FileResource;
741
742 //
743 // Mark the Fcb as initialized and create the stream file for this.
744 //
745
746 SetFlag( Vcb->PathTableFcb->FcbState, FCB_STATE_INITIALIZED );
747
748 CdCreateInternalStream( IrpContext, Vcb, Vcb->PathTableFcb, &CdInternalStreamNames[0]);
749
750 //
751 // Create the root index and reference it in the Vcb.
752 //
753
754 CdLockVcb( IrpContext, Vcb );
755 UnlockVcb = TRUE;
756 Vcb->RootIndexFcb = CdCreateFcb( IrpContext,
757 *((PFILE_ID) &FileId),
759 NULL );
760
761 CdIncrementReferenceCounts( IrpContext, Vcb->RootIndexFcb, 1, 1 );
762 CdUnlockVcb( IrpContext, Vcb );
763 UnlockVcb = FALSE;
764
765 //
766 // Create the File id by hand for this Fcb.
767 //
768
769 CdSetFidPathTableOffset( Vcb->RootIndexFcb->FileId, Vcb->PathTableFcb->StreamOffset );
770 CdFidSetDirectory( Vcb->RootIndexFcb->FileId );
771
772 //
773 // Create a pseudo path table entry so we can call the initialization
774 // routine for the directory.
775 //
776
777 RtlZeroMemory( &PathEntry, sizeof( PATH_ENTRY ));
778
779
780 PathEntry.Ordinal = 1;
781 PathEntry.PathTableOffset = Vcb->PathTableFcb->StreamOffset;
782
784 Vcb->RootIndexFcb,
785 NULL,
786 &PathEntry );
787
788 //
789 // Set the sizes by hand for this Fcb. It should have an entry for each track plus an
790 // entry for the root and parent.
791 //
792
793 RootDirectorySize = (Vcb->TrackCount + 2) * CdAudioDirentSize;
794 RootDirectorySize = SectorAlign( RootDirectorySize );
795
796 Vcb->RootIndexFcb->AllocationSize.QuadPart =
797 Vcb->RootIndexFcb->ValidDataLength.QuadPart =
798 Vcb->RootIndexFcb->FileSize.QuadPart = RootDirectorySize;
799
800 SetFlag( Vcb->RootIndexFcb->FcbState, FCB_STATE_INITIALIZED );
801
802 //
803 // Create the stream file for the root directory.
804 //
805
806 CdCreateInternalStream( IrpContext, Vcb, Vcb->RootIndexFcb, &CdInternalStreamNames[1] );
807
808 //
809 // Now do the volume dasd Fcb. Create this and reference it in the
810 // Vcb.
811 //
812
813 CdLockVcb( IrpContext, Vcb );
814 UnlockVcb = TRUE;
815
816 Vcb->VolumeDasdFcb = CdCreateFcb( IrpContext,
817 *((PFILE_ID) &FileId),
819 NULL );
820
821 CdIncrementReferenceCounts( IrpContext, Vcb->VolumeDasdFcb, 1, 1 );
822 CdUnlockVcb( IrpContext, Vcb );
823 UnlockVcb = FALSE;
824
825 //
826 // We won't allow raw reads on this Fcb so leave the size at
827 // zero.
828 //
829
830 //
831 // Point to the file resource.
832 //
833
834 Vcb->VolumeDasdFcb->Resource = &Vcb->FileResource;
835
836 Vcb->VolumeDasdFcb->FileAttributes = FILE_ATTRIBUTE_READONLY;
837
838 //
839 // Mark the Fcb as initialized.
840 //
841
842 SetFlag( Vcb->VolumeDasdFcb->FcbState, FCB_STATE_INITIALIZED );
843
844 //
845 // We will store a hard-coded name in the Vpb and use the toc as
846 // the serial number.
847 //
848
849 Vcb->Vpb->VolumeLabelLength = CdAudioLabelLength;
850
851 RtlCopyMemory( Vcb->Vpb->VolumeLabel,
854
855 //
856 // Find the serial number for the audio disk.
857 //
858
859 Vcb->Vpb->SerialNumber = CdTocSerial( IrpContext, Vcb->CdromToc );
860
861 //
862 // Set the ISO bit so we know how to treat the names.
863 //
864
865 SetFlag( Vcb->VcbState, VCB_STATE_ISO );
866 }
867
868 } _SEH2_FINALLY {
869
870 if (UnlockVcb) { CdUnlockVcb( IrpContext, Vcb ); }
871 } _SEH2_END;
872}
#define CdRvdPtLoc(R, F)
Definition: cd.h:295
RAW_DIRENT * PRAW_DIRENT
Definition: cd.h:351
#define CdRvdBlkSz(R, F)
Definition: cd.h:289
#define CdRvdVolSz(R, F)
Definition: cd.h:313
#define CdRvdDirent(R, F)
Definition: cd.h:307
#define CdRvdPtSz(R, F)
Definition: cd.h:301
USHORT CdAudioLabelLength
Definition: cddata.c:70
WCHAR CdAudioLabel[]
Definition: cddata.c:69
ULONG CdAudioDirentSize
Definition: cddata.c:78
CHAR CdXaId[]
Definition: cddata.c:63
VOID CdCreateInternalStream(_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _Inout_ PFCB Fcb, _In_ PUNICODE_STRING Name)
Definition: cachesup.c:38
ULONG CdTocSerial(_In_ PIRP_CONTEXT IrpContext, _In_ PCDROM_TOC_LARGE CdromToc)
Definition: strucsup.c:2779
VOID CdInitializeFcbFromPathEntry(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_opt_ PFCB ParentFcb, _In_ PPATH_ENTRY PathEntry)
Definition: strucsup.c:1136
UNICODE_STRING CdInternalStreamNames[]
Definition: strucsup.c:234
PFCB CdCreateFcb(_In_ PIRP_CONTEXT IrpContext, _In_ FILE_ID FileId, _In_ NODE_TYPE_CODE NodeTypeCode, _Out_opt_ PBOOLEAN FcbExisted)
Definition: strucsup.c:986
#define LlSectorAlign(L)
Definition: cdprocs.h:1584
#define CopyUchar4(Dst, Src)
Definition: cdprocs.h:1701
#define SectorAlign(L)
Definition: cdprocs.h:1580
#define VCB_STATE_ISO
Definition: cdstruc.h:707
#define CdFidSetDirectory(I)
Definition: cdstruc.h:1836
#define CdSetFidPathTableOffset(I, P)
Definition: cdstruc.h:1834
Definition: cdstruc.h:1460
ULONG DiskOffset
Definition: cdstruc.h:1476
ULONG PathTableOffset
Definition: cdstruc.h:1469
ULONG Ordinal
Definition: cdstruc.h:1468
UCHAR FileLoc[4]
Definition: cd.h:334
UCHAR XarLen
Definition: cd.h:333
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

◆ CdVerifyFcbOperation()

BOOLEAN CdVerifyFcbOperation ( _In_opt_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb 
)

Definition at line 615 of file verfysup.c.

641{
642 PVCB Vcb = Fcb->Vcb;
643 PDEVICE_OBJECT RealDevice = Vcb->Vpb->RealDevice;
644 PIRP Irp;
645
646 PAGED_CODE();
647
648 //
649 // Check that the fileobject has not been cleaned up.
650 //
651
652 if ( ARGUMENT_PRESENT( IrpContext )) {
653
655
656 Irp = IrpContext->Irp;
658
660
662
663 //
664 // Following FAT, we allow certain operations even on cleaned up
665 // file objects. Everything else, we fail.
666 //
667
668 if ( (FlagOn(Irp->Flags, IRP_PAGING_IO)) ||
673
674 NOTHING;
675
676 } else {
677
678 CdRaiseStatus( IrpContext, STATUS_FILE_CLOSED );
679 }
680 }
681 }
682
683 //
684 // Fail immediately if the volume is in the progress of being dismounted
685 // or has been marked invalid.
686 //
687
688 if ((Vcb->VcbCondition == VcbInvalid) ||
689 (Vcb->VcbCondition == VcbDismountInProgress)) {
690
691 if (ARGUMENT_PRESENT( IrpContext )) {
692
693 if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
694
696
697 } else {
698
699 CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
700 }
701 }
702
703 return FALSE;
704 }
705
706 //
707 // Always fail if the volume needs to be verified.
708 //
709
710 if (CdRealDevNeedsVerify( RealDevice)) {
711
712 if (ARGUMENT_PRESENT( IrpContext )) {
713
714 IoSetHardErrorOrVerifyDevice( IrpContext->Irp,
715 RealDevice );
716
718 }
719
720 return FALSE;
721
722 //
723 //
724 // All operations are allowed on mounted.
725 //
726
727 } else if ((Vcb->VcbCondition == VcbMounted) ||
728 (Vcb->VcbCondition == VcbMountInProgress)) {
729
730 return TRUE;
731
732 //
733 // Fail all requests for fast Io on other Vcb conditions.
734 //
735
736 } else if (!ARGUMENT_PRESENT( IrpContext )) {
737
738 return FALSE;
739
740 //
741 // The remaining case is VcbNotMounted.
742 // Mark the device to be verified and raise WRONG_VOLUME.
743 //
744
745 } else if (Vcb->VcbCondition == VcbNotMounted) {
746
747 IoSetHardErrorOrVerifyDevice( IrpContext->Irp, RealDevice );
748 CdRaiseStatus( IrpContext, STATUS_WRONG_VOLUME );
749
750// return FALSE; // unreachable code
751 }
752
753 return TRUE;
754}
#define CdRealDevNeedsVerify(DO)
Definition: cdprocs.h:1456
#define VCB_STATE_DISMOUNTED
Definition: cdstruc.h:716
@ VcbDismountInProgress
Definition: cdstruc.h:494
@ VcbInvalid
Definition: cdstruc.h:493
#define NOTHING
Definition: input_list.c:10
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
Definition: util.c:316
#define STATUS_FILE_CLOSED
Definition: ntstatus.h:532
#define STATUS_VOLUME_DISMOUNTED
Definition: ntstatus.h:747
#define STATUS_FILE_INVALID
Definition: ntstatus.h:388
#define STATUS_WRONG_VOLUME
Definition: udferr_usr.h:140
#define IRP_PAGING_IO
#define FO_CLEANUP_COMPLETE
Definition: iotypes.h:1790

Referenced by _Function_class_(), _Requires_lock_held_(), CdCommonLockControl(), CdFastLock(), CdFastUnlockAll(), CdFastUnlockAllByKey(), and CdFastUnlockSingle().

◆ CdVerifyOrCreateDirStreamFile()

static INLINE VOID CdVerifyOrCreateDirStreamFile ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PFCB  Fcb 
)
static

Definition at line 242 of file cdprocs.h.

246{
247 //
248 // Unsafe test to see if call / lock neccessary.
249 //
250
251 if (NULL == Fcb->FileObject) {
252
253 CdCreateInternalStream( IrpContext,
254 Fcb->Vcb,
255 Fcb,
257 }
258}
VOID CdCreateInternalStream(_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _Inout_ PFCB Fcb, _In_ PUNICODE_STRING Name)
Definition: cachesup.c:38

Referenced by _Requires_lock_held_(), and CdInitializeEnumeration().

◆ CdVerifyVcb()

VOID CdVerifyVcb ( _In_ PIRP_CONTEXT  IrpContext,
_Inout_ PVCB  Vcb 
)

Definition at line 411 of file verfysup.c.

436{
439 ULONG MediaChangeCount = 0;
440 BOOLEAN ForceVerify = FALSE;
441 BOOLEAN DevMarkedForVerify;
442
443 PAGED_CODE();
444
445 //
446 // Fail immediately if the volume is in the progress of being dismounted
447 // or has been marked invalid.
448 //
449
450 if ((Vcb->VcbCondition == VcbInvalid) ||
451 ((Vcb->VcbCondition == VcbDismountInProgress) &&
452 (IrpContext->MajorFunction != IRP_MJ_CREATE))) {
453
454 if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
455
457
458 } else {
459
460 CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
461 }
462 }
463
464 //
465 // Capture the real device verify state.
466 //
467
468 DevMarkedForVerify = CdRealDevNeedsVerify( Vcb->Vpb->RealDevice);
469
470 if (FlagOn( Vcb->VcbState, VCB_STATE_REMOVABLE_MEDIA ) && !DevMarkedForVerify) {
471
472 //
473 // If the media is removable and the verify volume flag in the
474 // device object is not set then we want to ping the device
475 // to see if it needs to be verified.
476 //
477
478 if (Vcb->VcbCondition != VcbMountInProgress) {
479
480 Status = CdPerformDevIoCtrl( IrpContext,
482 Vcb->TargetDeviceObject,
483 &MediaChangeCount,
484 sizeof(ULONG),
485 FALSE,
486 FALSE,
487 &Iosb );
488
489 if (Iosb.Information != sizeof(ULONG)) {
490
491 //
492 // Be safe about the count in case the driver didn't fill it in
493 //
494
495 MediaChangeCount = 0;
496 }
497
498 //
499 // There are four cases when we want to do a verify. These are the
500 // first three.
501 //
502 // 1. We are mounted, and the device has become empty
503 // 2. The device has returned verify required (=> DO_VERIFY_VOL flag is
504 // set, but could be due to hardware condition)
505 // 3. Media change count doesn't match the one in the Vcb
506 //
507
508 if (((Vcb->VcbCondition == VcbMounted) &&
509 CdIsRawDevice( IrpContext, Status ))
510 ||
512 ||
513 (NT_SUCCESS(Status) &&
514 (Vcb->MediaChangeCount != MediaChangeCount))) {
515
516 //
517 // If we are currently the volume on the device then it is our
518 // responsibility to set the verify flag. If we're not on the device,
519 // then we shouldn't touch the flag.
520 //
521
522 if (!FlagOn( Vcb->VcbState, VCB_STATE_VPB_NOT_ON_DEVICE) &&
523 !DevMarkedForVerify) {
524
525 DevMarkedForVerify = CdMarkDevForVerifyIfVcbMounted( Vcb);
526 }
527
528 ForceVerify = TRUE;
529
530 //
531 // NOTE that we no longer update the media change count here. We
532 // do so only when we've actually completed a verify at a particular
533 // change count value.
534 //
535 }
536 }
537
538 //
539 // This is the 4th verify case.
540 //
541 // We ALWAYS force CREATE requests on unmounted volumes through the
542 // verify path. These requests could have been in limbo between
543 // IoCheckMountedVpb and us when a verify/mount took place and caused
544 // a completely different fs/volume to be mounted. In this case the
545 // checks above may not have caught the condition, since we may already
546 // have verified (wrong volume) and decided that we have nothing to do.
547 // We want the requests to be re routed to the currently mounted volume,
548 // since they were directed at the 'drive', not our volume.
549 //
550
551 if (NT_SUCCESS( Status) && !ForceVerify && !DevMarkedForVerify &&
552 (IrpContext->MajorFunction == IRP_MJ_CREATE)) {
553
555
556 ForceVerify = (IrpSp->FileObject->RelatedFileObject == NULL) &&
557 ((Vcb->VcbCondition == VcbDismountInProgress) ||
558 (Vcb->VcbCondition == VcbNotMounted));
559
560 //
561 // Note that we don't touch the device verify flag here. It required
562 // it would have been caught and set by the first set of checks.
563 //
564 }
565 }
566
567 //
568 // Raise the verify / error if neccessary.
569 //
570
571 if (ForceVerify || DevMarkedForVerify || !NT_SUCCESS( Status)) {
572
573 IoSetHardErrorOrVerifyDevice( IrpContext->Irp,
574 Vcb->Vpb->RealDevice );
575
576 CdRaiseStatus( IrpContext, (ForceVerify || DevMarkedForVerify)
578 : Status);
579 }
580
581 //
582 // Based on the condition of the Vcb we'll either return to our
583 // caller or raise an error condition
584 //
585
586 switch (Vcb->VcbCondition) {
587
588 case VcbNotMounted:
589
590 IoSetHardErrorOrVerifyDevice( IrpContext->Irp, Vcb->Vpb->RealDevice );
591
592 CdRaiseStatus( IrpContext, STATUS_WRONG_VOLUME );
593 break;
594
595 case VcbInvalid:
597
598 if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
599
601
602 } else {
603
604 CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
605 }
606 break;
607
608 /* ReactOS Change: GCC "enumeration value not handled in switch" */
609 default: break;
610 }
611}
BOOLEAN CdMarkDevForVerifyIfVcbMounted(_Inout_ PVCB Vcb)
Definition: verfysup.c:359
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)
Definition: deviosup.c:1446
#define CdIsRawDevice(IC, S)
Definition: cdprocs.h:1466
#define IOCTL_CDROM_CHECK_VERIFY
Definition: ntddcdrm.h:103

Referenced by CdCommonDevControl(), and CdIsVolumeMounted().

◆ SectorsFromLlBytes()

static INLINE ULONG SectorsFromLlBytes ( ULONGLONG  Bytes)
static

Definition at line 1607 of file cdprocs.h.

1609 {
1610
1611 return (ULONG)(Bytes >> SECTOR_SHIFT);
1612}

Variable Documentation

◆ ByteCount

Definition at line 162 of file cdprocs.h.

◆ Ccb

IN PFCB IN PCCB Ccb

Definition at line 591 of file cdprocs.h.

Referenced by _At_(), _Function_class_(), _Requires_lock_held_(), _When_(), BroadcastOpen(), BuildAndSubmitIrp(), CdAllowExtendedDasdIo(), CdCommonDevControl(), CdCommonLockControl(), CdDeleteCcb(), CdEnumerateIndex(), CdInitializeEnumeration(), CdIsVolumeDirty(), CdIsVolumeMounted(), CloseClientPort(), Ext2AllocateCcb(), Ext2AllowExtendedDasdIo(), Ext2Cleanup(), Ext2Close(), Ext2CreateFile(), Ext2CreateVolume(), Ext2DeleteReparsePoint(), Ext2FastIoCheckIfPossible(), Ext2FastIoQueryBasicInfo(), Ext2FastIoQueryNetworkOpenInfo(), Ext2FillEntry(), Ext2Flush(), Ext2FlushFile(), Ext2FreeCcb(), Ext2GetReparsePoint(), Ext2GetRetrievalPointerBase(), Ext2GetRetrievalPointers(), Ext2IsFileRemovable(), Ext2NotifyChangeDirectory(), Ext2OplockRequest(), Ext2QueryDirectory(), Ext2QueryEa(), Ext2QueryFileInformation(), Ext2QueryRetrievalPointers(), Ext2ReadFile(), Ext2ReadVolume(), Ext2SetDispositionInfo(), Ext2SetEa(), Ext2SetFileInformation(), Ext2SetLinkInfo(), Ext2SetRenameInfo(), Ext2SetReparsePoint(), Ext2WriteFile(), Ext2WriteVolume(), FatAllowExtendedDasdIo(), FatCommonQueryEa(), FatCommonSetEa(), FatCreateCcb(), FatDeallocateCcbStrings(), FatDecodeFileObject(), FatDeferredFlush(), FatDeleteCcb(), FatFreeCcb(), FatFspDispatch(), FatIsVolumeDirty(), FatIsVolumeMounted(), FatSetFileObject(), FatSetRenameInfo(), FatSetZeroOnDeallocate(), FatTunnelFcbOrDcb(), FatUnlockVolume(), if(), MsfsClose(), MsfsCreate(), MsfsCreateMailslot(), MsfsQueryInformation(), MsfsRead(), MsfsSetInformation(), MsfsWrite(), MupCleanup(), MupCleanupFcb(), MupClose(), MupCreateCcb(), MupDereferenceCcb(), MupForwardIoRequest(), MupSetFileObject(), NpAddDataQueueEntry(), NpCommonCleanup(), NpCommonClose(), NpCommonFlushBuffers(), NpCommonQueryInformation(), NpCommonQuerySecurityInfo(), NpCommonRead(), NpCommonSetInformation(), NpCommonSetSecurityInfo(), NpCommonWrite(), NpCopyClientContext(), NpCreateCcb(), NpCreateClientEnd(), NpCreateExistingNamedPipe(), NpCreateNewNamedPipe(), NpDecodeFileObject(), NpDeleteCcb(), NpDisconnect(), NpFsdCreate(), NpGetClientSecurityContext(), NpImpersonate(), NpImpersonateClientContext(), NpInitializeSecurity(), NpListen(), NpOpenNamedPipeRootDirectory(), NpPeek(), NpQueryClientProcess(), NpQueryNameInfo(), NpQueryPipeInfo(), NpQueryPipeLocalInfo(), NpQueryPositionInfo(), NpQueryStandardInfo(), NpReadDataQueue(), NpSetClientProcess(), NpSetClosingPipeState(), NpSetConnectedPipeState(), NpSetDisconnectedPipeState(), NpSetFileObject(), NpSetListeningPipeState(), NpSetPipeInfo(), NpTransceive(), NpUninitializeSecurity(), NpWaitForNamedPipe(), NpWriteDataQueue(), NtfsCloseFile(), NtfsMountVolume(), NtfsQueryDirectory(), RegisterUncProvider(), UDFCheckAccessRights(), UDFCleanUpCCB(), UDFCommonCleanup(), UDFCommonClose(), UDFCommonDeviceControl(), UDFCommonDirControl(), UDFCommonFileInfo(), UDFCommonFlush(), UDFCommonLockControl(), UDFCommonQueryVolInfo(), UDFCommonRead(), UDFCommonSetVolInfo(), UDFCommonWrite(), UDFDismountVolume(), UDFFastIoCheckIfPossible(), UDFFastIoCopyWrite(), UDFFastIoQueryBasicInfo(), UDFFastIoQueryStdInfo(), UDFFastLock(), UDFFastUnlockAll(), UDFFastUnlockAllByKey(), UDFFastUnlockSingle(), UDFFlushAFile(), UDFGetFileAllocModeFromICB(), UDFGetInternalInformation(), UDFGetRetrievalPointers(), UDFGetVolumeBitmap(), UDFIsVolumeDirty(), UDFIsVolumeMounted(), UDFLockVolume(), UDFNotifyChangeDirectory(), UDFOpenFile(), UDFQueryDirectory(), UDFReleaseCCB(), UDFSetAccessRights(), UDFSetBasicInformation(), UDFSetDispositionInformation(), UDFSetEOF(), UDFSetFileAllocModeFromICB(), UDFStoreFileId(), UDFUnlockVolume(), and VfatMount().

◆ CdFastIoCheckIfPossible

FAST_IO_CHECK_IF_POSSIBLE CdFastIoCheckIfPossible

Definition at line 1951 of file cdprocs.h.

Referenced by CdInitializeGlobalData().

◆ CdFastLock

FAST_IO_LOCK CdFastLock

Definition at line 1903 of file cdprocs.h.

Referenced by CdInitializeGlobalData().

◆ CdFastQueryBasicInfo

FAST_IO_QUERY_BASIC_INFO CdFastQueryBasicInfo

Definition at line 1876 of file cdprocs.h.

Referenced by CdInitializeGlobalData().

◆ CdFastQueryNetworkInfo

FAST_IO_QUERY_NETWORK_OPEN_INFO CdFastQueryNetworkInfo

Definition at line 1963 of file cdprocs.h.

Referenced by CdInitializeGlobalData().

◆ CdFastQueryStdInfo

FAST_IO_QUERY_STANDARD_INFO CdFastQueryStdInfo

Definition at line 1888 of file cdprocs.h.

Referenced by CdInitializeGlobalData().

◆ CdFastUnlockAll

FAST_IO_UNLOCK_ALL CdFastUnlockAll

Definition at line 1926 of file cdprocs.h.

Referenced by CdInitializeGlobalData().

◆ CdFastUnlockAllByKey

FAST_IO_UNLOCK_ALL_BY_KEY CdFastUnlockAllByKey

Definition at line 1937 of file cdprocs.h.

Referenced by CdInitializeGlobalData().

◆ CdFastUnlockSingle

FAST_IO_UNLOCK_SINGLE CdFastUnlockSingle

Definition at line 1916 of file cdprocs.h.

Referenced by CdInitializeGlobalData().

◆ CdFspDispatch

WORKER_THREAD_ROUTINE CdFspDispatch

Definition at line 2040 of file cdprocs.h.

Referenced by CdAddToWorkque().

◆ CdName

_Inout_ PCD_NAME CdName

Definition at line 622 of file cdprocs.h.

◆ CompletionContext

◆ CompoundPathEntry

Definition at line 739 of file cdprocs.h.

Referenced by _Requires_lock_held_().

◆ CurrentFcb

_Inout_ PFCB* CurrentFcb

Definition at line 801 of file cdprocs.h.

Referenced by _Requires_lock_held_().

◆ DeviceToVerify

◆ DirContext

◆ Dirent

◆ DirName

◆ DiskOffset

Definition at line 161 of file cdprocs.h.

Referenced by _Requires_lock_held_(), CdDiskOffsetFromMcbEntry(), and main().

◆ DismountUnderway

_In_ PVCB _In_ BOOLEAN DismountUnderway

Definition at line 236 of file cdprocs.h.

Referenced by _Requires_lock_held_().

◆ ExceptionCode

◆ Fcb

IN PFCB Fcb

Definition at line 159 of file cdprocs.h.

Referenced by __RxAcquireFcb(), _At_(), _Function_class_(), _Inout_updates_bytes_(), _Requires_lock_held_(), _When_(), BroadcastOpen(), CcCanIWrite(), CcDeferWrite(), CcSetDirtyPageThreshold(), CdAddAllocationFromDirent(), CdAddInitialAllocation(), CdAllowExtendedDasdIo(), CdCommonDevControl(), CdCommonLockControl(), CdCreateCcb(), CdCreateInternalStream(), CdDeleteFcb(), CdDeleteInternalStream(), CdFastDecodeFileObject(), CdFastLock(), CdFastUnlockAll(), CdFastUnlockAllByKey(), CdFastUnlockSingle(), CdFileTrackMode(), CdFindMcbEntry(), CdGetNextFcb(), CdInitializeEnumeration(), CdInitializeFcbFromFileContext(), CdInitializeFcbFromPathEntry(), CdInsertPrefix(), CdIsVolumeDirty(), CdIsVolumeMounted(), CdMapPathTableBlock(), CdNoopAcquire(), CdNoopRelease(), CdQueryBasicInfo(), CdQueryEaInfo(), CdQueryInternalInfo(), CdQueryNetworkInfo(), CdQueryStandardInfo(), CdQueueClose(), CdRemovePrefix(), CdTruncateAllocation(), CdVerifyFcbOperation(), CdVerifyOrCreateDirStreamFile(), check_nfs41_create_args(), DosInt21h(), Ext2AcquireFileForCcFlush(), Ext2AcquireFileForModWrite(), Ext2AcquireForCreateSection(), Ext2AcquireForLazyWrite(), Ext2AcquireForReadAhead(), Ext2AllocateFcb(), Ext2Cleanup(), Ext2Close(), Ext2CreateFile(), Ext2DeleteFile(), Ext2DeleteReparsePoint(), Ext2FastIoCheckIfPossible(), Ext2FastIoLock(), Ext2FastIoQueryBasicInfo(), Ext2FastIoQueryNetworkOpenInfo(), Ext2FastIoQueryStandardInfo(), Ext2FastIoRead(), Ext2FastIoUnlockAll(), Ext2FastIoUnlockAllByKey(), Ext2FastIoUnlockSingle(), Ext2FastIoWrite(), Ext2FcbReaperThread(), Ext2FillEntry(), Ext2FloppyFlush(), Ext2Flush(), Ext2FlushFile(), Ext2FlushFiles(), Ext2FreeFcb(), Ext2GetRetrievalPointerBase(), Ext2GetRetrievalPointers(), Ext2InsertFcb(), Ext2IsFastIoPossible(), Ext2IsFileRemovable(), Ext2IsHandleCountZero(), Ext2LockControl(), Ext2NotifyChangeDirectory(), Ext2OplockRequest(), Ext2OverwriteEa(), Ext2PreAcquireForCreateSection(), Ext2PurgeFile(), Ext2PurgeVolume(), Ext2QueryDirectory(), Ext2QueryEa(), Ext2QueryExtentMappings(), Ext2QueryFileInformation(), Ext2QueryRetrievalPointers(), Ext2QueryUnusedFcb(), Ext2ReadFile(), Ext2ReleaseFcb(), Ext2ReleaseFileForCcFlush(), Ext2ReleaseFileForModWrite(), Ext2ReleaseForCreateSection(), Ext2ReleaseFromLazyWrite(), Ext2ReleaseFromReadAhead(), Ext2SetDispositionInfo(), Ext2SetEa(), Ext2SetFileInformation(), Ext2SetLinkInfo(), Ext2SetRenameInfo(), Ext2SetReparsePoint(), Ext2StartFloppyFlushDpc(), Ext2SupersedeOrOverWriteFile(), Ext2UnlinkFcb(), Ext2WriteFile(), Ext2ZeroData(), FATAddEntry(), FatAllowExtendedDasdIo(), FatCommonQueryEa(), FatCommonSetEa(), FatConstructNamesInFcb(), FatCreateFcb(), FatDeleteFcb(), FatDeleteVcb(), FatFlushDirentForFile(), FatFreeFcb(), FatFspDispatch(), FatGetNextFcbBottomUp(), FatGetNextFcbTopDown(), FATIsDirectoryEmpty(), FatIsHandleCountZero(), FatIsVolumeDirty(), FatIsVolumeMounted(), FatMatchFileSize(), FatNoOpAcquire(), FatNoOpRelease(), FatPagingFileIo(), FatQueryBasicInfo(), FatQueryEaInfo(), FatQueryInternalInfo(), FatQueryShortNameInfo(), FatRemoveNames(), FatResetFcb(), FatSetFullNameInFcb(), FatSetRenameInfo(), FatUnlockVolume(), FATXAddEntry(), FATXIsDirectoryEmpty(), FsRtlCopyRead2(), FsRtlCopyWrite2(), GET_ALREADY_PREFIXED_NAME(), LockOrUnlockVolume(), main(), MsfsAcquireLock(), MsfsClose(), MsfsCreate(), MsfsCreateMailslot(), MsfsFileSystemControl(), MsfsInsertIrp(), MsfsPeekNextIrp(), MsfsQueryInformation(), MsfsQueryMailslotInformation(), MsfsRead(), MsfsReleaseLock(), MsfsSetInformation(), MsfsSetMailslotInformation(), MsfsWrite(), MupCleanup(), MupCleanupFcb(), MupClose(), MupCloseFcb(), MupCreateFcb(), MupDecodeFileObject(), MupDereferenceFcb(), MupForwardIoRequest(), MupSetFileObject(), nfs41_Create(), NpCommonCleanup(), NpCommonClose(), NpCommonQueryInformation(), NpCommonQuerySecurityInfo(), NpCommonSetInformation(), NpCommonSetSecurityInfo(), NpCreateCcb(), NpCreateClientEnd(), NpCreateExistingNamedPipe(), NpCreateFcb(), NpCreateNewNamedPipe(), NpDeleteFcb(), NpFindPrefix(), NpFindRelativePrefix(), NpFsdCreate(), NpFsdCreateNamedPipe(), NpQueryPipeLocalInfo(), NpSetClosingPipeState(), NpSetPipeInfo(), NpWaitForNamedPipe(), NtfsAddFCBToTable(), NtfsAttachFCBToFileObject(), NtfsCleanupFile(), NtfsCloseFile(), NtfsCreateFCB(), NtfsCreateFile(), NtfsDestroyFCB(), NtfsFCBInitializeCache(), NtfsFCBIsCompressed(), NtfsFCBIsDirectory(), NtfsFCBIsEncrypted(), NtfsFCBIsReparsePoint(), NtfsFCBIsRoot(), NtfsGetBasicInformation(), NtfsGetInternalInformation(), NtfsGetNameInformation(), NtfsGetNetworkOpenInformation(), NtfsGetStandardInformation(), NtfsGetStreamInformation(), NtfsGrabFCB(), NtfsGrabFCBFromTable(), NtfsMakeAbsoluteFilename(), NtfsMakeRootFCB(), NtfsMountVolume(), NtfsOpenFile(), NtfsOpenRootFCB(), NtfsQueryDirectory(), NtfsQueryInformation(), NtfsReadFile(), NtfsReleaseFCB(), NtfsSetEndOfFile(), NtfsSetInformation(), NtfsWrite(), NtfsWriteFile(), PerformTest(), RegisterUncProvider(), RxAcquireExclusiveFcbResourceInMRx(), RxAcquireFcbForLazyWrite(), RxAcquireFcbForReadAhead(), RxAllocateFcbObject(), RxCanonicalizeNameAndObtainNetRoot(), RxChangeBufferingState(), RxCheckShareAccessPerSrvOpens(), RxCloseAssociatedSrvOpen(), RxCommonCleanup(), RxCommonClose(), RxCommonDevFCBCleanup(), RxCommonDevFCBClose(), RxCommonDirectoryControl(), RxCommonQueryInformation(), RxCommonQueryVolumeInformation(), RxCommonRead(), RxCommonSetInformation(), RxCommonWrite(), RxConjureOriginalName(), RxCreateFromNetRoot(), RxCreateNetFcb(), RxCreateNetFobx(), RxCreateSrvOpen(), RxFastIoCheckIfPossible(), RxFcbTableInsertFcb(), RxFcbTableLookupFcb(), RxFcbTableRemoveFcb(), RxFinalizeConnection(), RxFinalizeNetFobx(), RxFinalizeNetRoot(), RxFinalizeSrvOpen(), RxFindOrCreateFcb(), RxFinishFcbInitialization(), RxFlushFcbInSystemCache(), RxFreeFcbObject(), RxFsdCommonDispatch(), RxFsdDispatch(), RxGetFileSizeWithLock(), RxInitializeContext(), RxIsOkToPurgeFcb(), RxLowIoReadShell(), RxLowIoReadShellCompletion(), RxLowIoSubmit(), RxLowIoWriteShell(), RxLowIoWriteShellCompletion(), RxMarkFobxOnCleanup(), RxMarkFobxOnClose(), RxOrphanSrvOpens(), RxpDereferenceNetFcb(), RxpQueryInfoMiniRdr(), RxpReferenceNetFcb(), RxProcessChangeBufferingStateRequestsForSrvOpen(), RxpScavengeFobxs(), RxpSetInfoMiniRdr(), RxPurgeFcb(), RxPurgeFcbInSystemCache(), RxPurgeNetFcb(), RxPurgeRelatedFobxs(), RxQueryDirectory(), RxQueryNameInfo(), RxQueryStandardInfo(), RxReleaseFcbFromLazyWrite(), RxReleaseFcbFromReadAhead(), RxScavengeFobxsForNetRoot(), RxScavengeRelatedFobxs(), RxSearchForCollapsibleOpen(), RxSetBasicInfo(), RxSetDispositionInfo(), RxSetFileSizeWithLock(), RxSetRenameInfo(), RxSetupNetFileObject(), RxUninitializeCacheMap(), RxVerifyOperationIsLegal(), SetAttributeDataLength(), TestFastIoRead(), TestFastIoWrite(), TestIrpHandler(), UDFAssignAcl(), UDFCheckAccessRights(), UDFCleanUpFCB(), UDFCleanUpFcbChain(), UDFCloseAllXXXDelayedInDir(), UDFCloseFileInfoChain(), UDFCommonCleanup(), UDFCommonClose(), UDFCommonDeviceControl(), UDFCommonDirControl(), UDFCommonFileInfo(), UDFCommonFlush(), UDFCommonLockControl(), UDFCommonRead(), UDFCommonWrite(), UDFDismountVolume(), UDFFastIoCheckIfPossible(), UDFFastIoCopyWrite(), UDFFastIoQueryBasicInfo(), UDFFastIoQueryStdInfo(), UDFFastLock(), UDFFastUnlockAll(), UDFFastUnlockAllByKey(), UDFFastUnlockSingle(), UDFFlushAFile(), UDFGetAltNameInformation(), UDFGetBasicInformation(), UDFGetFileAllocModeFromICB(), UDFGetFileStreamInformation(), UDFGetInternalInformation(), UDFGetNetworkInformation(), UDFGetRetrievalPointers(), UDFGetStandardInformation(), UDFGetVolumeBitmap(), UDFHardLink(), UDFInitializeIrpContextLite(), UDFIsFastIoPossible(), UDFIsLastClose(), UDFIsVolumeDirty(), UDFIsVolumeMounted(), UDFLockVolume(), UDFLookUpAcl(), UDFMarkStreamsForDeletion(), UDFNotifyChangeDirectory(), UDFNotifyFullReportChange(), UDFPostStackOverflowRead(), UDFQueryDirectory(), UDFQueueDelayedClose(), UDFReadSecurity(), UDFReleaseFCB(), UDFRename(), UDFSetAccessRights(), UDFSetAllocationInformation(), UDFSetBasicInformation(), UDFSetDispositionInformation(), UDFSetEOF(), UDFSetFileAllocModeFromICB(), UDFUnlockVolume(), UDFWriteSecurity(), UpdateFileSize(), VfatAcquireForCcFlush(), VfatAcquireForLazyWrite(), VfatAddEntry(), VfatCheckForDismount(), VfatCommonRead(), VfatDelEntry(), VfatDismountVolume(), VfatFlush(), VfatFlushFile(), VfatFlushVolume(), VfatGetAllInformation(), VfatGetEaInformation(), VfatGetInternalInformation(), VfatGetNetworkOpenInformation(), VfatGetRetrievalPointers(), vfatInitFcb(), vfatInitFCBFromDirEntry(), VfatIsDirectoryEmpty(), VfatLockControl(), VfatLockOrUnlockVolume(), VfatMount(), VfatOpenFile(), VfatRead(), VfatReadFileData(), VfatReleaseForCcFlush(), VfatReleaseFromLazyWrite(), vfatReportChange(), VfatSetAllocationSizeInformation(), vfatSetFCBNewDirName(), vfatUpdateFCB(), VfatWrite(), and VfatWriteFileData().

◆ FileContext

◆ FileObject

Definition at line 588 of file cdprocs.h.

◆ FileOffset

_In_ PLARGE_INTEGER FileOffset

Definition at line 160 of file cdprocs.h.

Referenced by _CcpFlushCache(), _Function_class_(), _MmGetPageEntrySectionSegment(), _Requires_lock_held_(), AddDiskToList(), BlFileReadAtOffsetEx(), CcCopyRead(), CcCopyWrite(), CcFastCopyRead(), CcFastCopyWrite(), CcFlushCache(), CcMapData(), CcMdlRead(), CcMdlWriteComplete(), CcpBuildCacheMdl(), CcpFindBcb(), CcpFindMatchingMap(), CcpGetAppropriateBcb(), CcPinMappedData(), CcPinRead(), CcpMapData(), CcpPinData(), CcpPinMappedData(), CcPrepareMdlWrite(), CcPreparePinWrite(), CcPurgeCacheSection(), CcRosCreateVacb(), CcRosGetVacb(), CcRosLookupVacb(), CcRosRequestVacb(), CcScheduleReadAhead(), CdDiskOffsetFromMcbEntry(), CdFastLock(), CdFastUnlockSingle(), CdFindMcbEntry(), CmpFileRead(), CmpFileWrite(), Dispatch_fnFastRead(), Dispatch_fnFastWrite(), DumpDisk(), DumpPartition(), ElfBackupFile(), ElfFlushFile(), ElfpInitExistingFile(), ElfpInitNewFile(), ElfReadRecord(), ElfWriteRecord(), EtfsOpen(), EtfspGetDirectoryInfo(), EtfspGetDirent(), ExeFmtpReadFile(), Ext2FastIoCheckIfPossible(), Ext2FastIoLock(), Ext2FastIoRead(), Ext2FastIoUnlockSingle(), Ext2FastIoWrite(), Fat12WriteBootSector(), Fat12WriteFAT(), Fat12WriteRootDirectory(), Fat16WriteBootSector(), Fat16WriteFAT(), Fat16WriteRootDirectory(), Fat32WriteBootSector(), Fat32WriteFAT(), Fat32WriteFsInfo(), Fat32WriteRootDirectory(), FATAddEntry(), FatComputeMoveFileSplicePoints(), FatFlushDirentForFile(), FatFlushFatEntries(), FATGetNextDirEntry(), FATIsDirectoryEmpty(), FatWipeSectors(), Fatx16WriteFAT(), Fatx32WriteFAT(), FATXAddEntry(), FATXGetNextDirEntry(), FATXIsDirectoryEmpty(), FatxWriteBootSector(), FatxWriteRootDirectory(), FltpFastIoCheckIfPossible(), FltpFastIoLock(), FltpFastIoMdlRead(), FltpFastIoMdlWriteComplete(), FltpFastIoMdlWriteCompleteCompressed(), FltpFastIoPrepareMdlWrite(), FltpFastIoRead(), FltpFastIoReadCompressed(), FltpFastIoUnlockSingle(), FltpFastIoWrite(), FltpFastIoWriteCompressed(), FsdSetFsLabelInformation(), FsRtlCopyRead(), FsRtlCopyRead2(), FsRtlCopyWrite(), FsRtlCopyWrite2(), FsRtlFastCheckLockForRead(), FsRtlFastCheckLockForWrite(), FsRtlFastUnlockSingle(), FsRtlMdlRead(), FsRtlMdlReadDev(), FsRtlMdlWriteComplete(), FsRtlMdlWriteCompleteDev(), FsRtlPrepareMdlWrite(), FsRtlPrepareMdlWriteDev(), FsRtlPrivateLock(), HvpGetHiveHeader(), HvpRecoverDataFromLog(), HvpRecoverHeaderFromLog(), HvpWriteHive(), HvpWriteLog(), InfOpenFile(), IniCacheLoadByHandle(), InstallBtrfsBootCode(), InstallFat32BootCode(), InstallFatBootCode(), InstallMbrBootCode(), InstallNtfsBootCode(), KmtInitTestFiles(), LogfpFlushFile(), LogfpReadFile(), LogfpWriteFile(), main(), MergeStabsAndCoffs(), MiFreeSegmentPage(), MiReadFilePage(), MiSectionPageTableGet(), MiSectionPageTableGetOrAllocate(), MiSimpleRead(), MiWritePage(), MmFinalizeSectionPageOut(), MmMakeSegmentResident(), MmMapViewOfSegment(), MmpPageOutPhysicalAddress(), MmWithdrawSectionPage(), NtfsFastIoCheckIfPossible(), NtfsFastIoRead(), NtfsFastIoWrite(), OffsetToCluster(), ReadBootCodeByHandle(), ReadLogBuffer(), ReadVolumeLabel(), RxFastIoCheckIfPossible(), RxFastIoRead(), RxFastIoWrite(), RxPurgeFcbInSystemCache(), START_TEST(), TestCommonRead(), TestFastIoRead(), TestFastIoWrite(), TestSharedCacheMap(), UDFFastIoCheckIfPossible(), UDFFastIoCopyWrite(), UDFFastLock(), UDFFastUnlockSingle(), VfatFastIoCheckIfPossible(), VfatFastIoLock(), VfatFastIoRead(), VfatFastIoReadCompressed(), VfatFastIoUnlockSingle(), VfatFastIoWrite(), VfatFastIoWriteCompressed(), vfatFindDirSpace(), VfatMdlRead(), VfatMdlWriteComplete(), VfatMdlWriteCompleteCompressed(), VfatPrepareMdlWrite(), and WriteLogBuffer().

◆ Force

◆ IgnoreCase

Definition at line 441 of file cdprocs.h.

◆ IgnoreWait

◆ Irp

Definition at line 1407 of file cdprocs.h.

◆ MatchingName

Definition at line 443 of file cdprocs.h.

Referenced by _Success_().

◆ Name

Definition at line 440 of file cdprocs.h.

◆ ParentFcb

◆ RaiseOnError

_Inout_ PFCB _In_ BOOLEAN RaiseOnError

Definition at line 1210 of file cdprocs.h.

Referenced by _At_(), and CdCreateUserMdl().

◆ RemainingName

◆ RemovedStartingFcb

_Inout_ PFCB _Out_ PBOOLEAN RemovedStartingFcb

Definition at line 1260 of file cdprocs.h.

Referenced by _Requires_lock_held_().

◆ Resource

_Acquires_lock_ _Curr_ PERESOURCE Resource

Definition at line 843 of file cdprocs.h.

Referenced by _Requires_lock_held_(), AcpiBufferToResource(), AcpiResourceToAddress64(), AcpiRsConvertAmlToResource(), AcpiRsConvertAmlToResources(), AcpiRsConvertResourcesToAml(), AcpiRsConvertResourceToAml(), AcpiRsCreateResourceList(), AcpiRsDumpAddressCommon(), AcpiRsDumpDescriptor(), AcpiRsGetAddressCommon(), AcpiRsGetAmlLength(), AcpiRsMatchVendorResource(), AcpiRsSetAddressCommon(), AcpiWalkResourceBuffer(), DLDAcquireExclusive(), DLDAcquireShared(), DLDpAcquireResourceExclusiveLite(), DLDpFindCurrentThread(), DLDProcessResource(), DLDProcessThread(), DLDpWaitForResource(), DxEngLockHdev(), DxEngUnlockHdev(), ExAcquireResourceExclusiveLite(), ExAcquireResourceLock(), ExAcquireResourceSharedLite(), ExAcquireSharedStarveExclusive(), ExAcquireSharedWaitForExclusive(), ExConvertExclusiveToSharedLite(), ExDeleteResourceLite(), ExDisableResourceBoostLite(), ExEnterCriticalRegionAndAcquireResourceExclusive(), ExEnterCriticalRegionAndAcquireResourceShared(), ExEnterCriticalRegionAndAcquireSharedWaitForExclusive(), ExGetExclusiveWaiterCount(), ExGetSharedWaiterCount(), ExInitializeResourceLite(), ExIsResourceAcquiredExclusiveLite(), ExIsResourceAcquiredSharedLite(), ExpAllocateExclusiveWaiterEvent(), ExpAllocateSharedWaiterSemaphore(), ExpExpandResourceOwnerTable(), ExpFindEntryForThread(), ExpFindFreeEntry(), ExpWaitForResource(), ExReinitializeResourceLite(), ExReleaseResourceAndLeaveCriticalRegion(), ExReleaseResourceForThreadLite(), ExReleaseResourceLite(), ExReleaseResourceLock(), ExSetResourceOwnerPointer(), Ext2EresourceAlignmentChecking(), ExTryToAcquireResourceExclusiveLite(), FatAllocateResource(), FatFreeResource(), FsRtlCopyRead2(), FxResourceCm::FxResourceCm(), FxResourceIo::FxResourceIo(), InitializeIdEntry(), InitializeNamedEntry(), InitializeTestResource(), KsLoadResource(), LdrAccessResource(), LoadMenuA(), LoadMenuW(), main(), NdisCloseConfiguration(), NtfsWrite(), NtGetVersionResource(), PciQueryResources(), RtlAcquireResourceExclusive(), RtlAcquireResourceShared(), RtlConvertExclusiveToShared(), RtlConvertSharedToExclusive(), RtlDeleteResource(), RtlDumpResource(), RtlInitializeResource(), RtlReleaseResource(), START_TEST(), UDFAcquireResourceExclusiveWithCheck(), UDFAcquireResourceSharedWithCheck(), UDFIsResourceAcquired(), UDFPostStackOverflowRead(), VfatRead(), and VfatWrite().

◆ ShortNameDirentOffset

_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG ShortNameDirentOffset

Definition at line 462 of file cdprocs.h.

◆ StartingFcb

_Inout_ PFCB StartingFcb

Definition at line 1259 of file cdprocs.h.

Referenced by _Requires_lock_held_().

◆ StartingOffset

◆ Type

◆ TypeOfOpen

◆ Vcb

Definition at line 235 of file cdprocs.h.