ReactOS 0.4.15-dev-5666-gc548b97
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
unsigned int ULONG
Definition: retypes.h:1
#define L(x)
Definition: ntvdm.h:50

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:420

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:1817
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
signed char * PSTR
Definition: retypes.h:7
#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
_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:498
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
signed char * PCHAR
Definition: retypes.h:7
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2992
#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:108
PIRP Irp
Definition: usbstor.h:98
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:852

◆ 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:20
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:426

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:417
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:403

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 di