ReactOS  0.4.13-dev-257-gfabbd7c
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 1555 of file cdprocs.h.

◆ AssertVerifyDevice

#define AssertVerifyDevice (   C,
  S 
)

Definition at line 1820 of file cdprocs.h.

◆ AssertVerifyDeviceIrp

#define AssertVerifyDeviceIrp (   I)

Definition at line 1821 of file cdprocs.h.

◆ BlockAlign

#define BlockAlign (   V,
  L 
)
Value:
( \
((ULONG)(L) + (V)->BlockMask) & (V)->BlockInverseMask \
)
static const WCHAR L[]
Definition: oid.c:1250
#define V(i, a, b, c, d)
Definition: jaricom.c:29
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1648 of file cdprocs.h.

◆ BlockOffset

#define BlockOffset (   V,
  L 
)
Value:
( \
((ULONG) (L)) & (V)->BlockMask \
)
static const WCHAR L[]
Definition: oid.c:1250
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1660 of file cdprocs.h.

◆ BytesFromBlocks

#define BytesFromBlocks (   V,
  B 
)
Value:
( \
(ULONG) (B) << (V)->BlockToByteShift \
)
#define V(i, a, b, c, d)
Definition: jaricom.c:29
#define B(row, col)
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1640 of file cdprocs.h.

◆ BytesFromSectors

#define BytesFromSectors (   L)
Value:
( \
((ULONG) (L)) << SECTOR_SHIFT \
)
#define SECTOR_SHIFT
Definition: cd.h:32
static const WCHAR L[]
Definition: oid.c:1250
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1606 of file cdprocs.h.

◆ CanFsdWait

#define CanFsdWait (   I)    IoIsOperationSynchronous(I)

Definition at line 2011 of file cdprocs.h.

◆ CdAcquireAllFiles

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

Definition at line 993 of file cdprocs.h.

◆ CdAcquireCacheForRead

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

Definition at line 966 of file cdprocs.h.

◆ CdAcquireCacheForUpdate

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

Definition at line 969 of file cdprocs.h.

◆ CdAcquireCdData

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

Definition at line 978 of file cdprocs.h.

◆ CdAcquireFcbExclusive

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

Definition at line 1011 of file cdprocs.h.

◆ CdAcquireFcbShared

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

Definition at line 1014 of file cdprocs.h.

◆ CdAcquireFileExclusive

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

Definition at line 999 of file cdprocs.h.

◆ CdAcquireFileShared

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

Definition at line 1002 of file cdprocs.h.

◆ CdAcquireFileSharedStarveExclusive

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

Definition at line 1005 of file cdprocs.h.

◆ CdAcquireVcbExclusive

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

Definition at line 984 of file cdprocs.h.

◆ CdAcquireVcbShared

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

Definition at line 987 of file cdprocs.h.

◆ CdAllocateIoContext

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

Definition at line 1349 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:1523
#define CP
Definition: debug.h:64
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179

Definition at line 771 of file cdprocs.h.

◆ CdCleanupDirContext

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

Definition at line 553 of file cdprocs.h.

◆ CdCleanupDirent

#define CdCleanupDirent (   IC,
  D 
)
Value:
{ \
CdFreePool( &(D)->CdFileName.FileName.Buffer ); \
} \
}
#define DIRENT_FLAG_ALLOC_BUFFER
Definition: cdstruc.h:1676
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define D(name, bit)

Definition at line 547 of file cdprocs.h.

◆ CdConvertCacheToShared

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

Definition at line 975 of file cdprocs.h.

◆ CdCreateIrpContextLite

Definition at line 1254 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:227
#define F(x, y, z)
Definition: md5.c:51
ULONG VcbCleanup
Definition: cdstruc.h:557

Definition at line 1316 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); \
}
__volatile LONG VcbUserReference
Definition: cdstruc.h:559
__volatile LONG VcbReference
Definition: cdstruc.h:558
Definition: ttei6.cpp:27
#define UC(b)
_In_ PVCB Vcb
Definition: cdprocs.h:227
#define F(x, y, z)
Definition: md5.c:51

Definition at line 1330 of file cdprocs.h.

◆ CdFreeIoContext

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

Definition at line 1354 of file cdprocs.h.

◆ CdFreeIrpContextLite

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

Definition at line 1257 of file cdprocs.h.

◆ CdFreePool

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

Definition at line 2200 of file cdprocs.h.

◆ CdGetFcbOplock

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

Definition at line 1086 of file cdprocs.h.

◆ CdIllegalFcbAccess

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

Definition at line 127 of file cdprocs.h.

◆ CdIncrementCleanupCounts

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

Definition at line 1310 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); \
}
__volatile LONG VcbUserReference
Definition: cdstruc.h:559
__volatile LONG VcbReference
Definition: cdstruc.h:558
Definition: ttei6.cpp:27
#define UC(b)
_In_ PVCB Vcb
Definition: cdprocs.h:227
#define F(x, y, z)
Definition: md5.c:51

Definition at line 1322 of file cdprocs.h.

◆ CdInitializeCompoundPathEntry

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

Definition at line 768 of file cdprocs.h.

◆ CdInitializeDirContext

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

Definition at line 544 of file cdprocs.h.

◆ CdInitializeDirent

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

Definition at line 541 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; \
}
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING ShortName
Definition: fatprocs.h:1294
#define BYTE_COUNT_8_DOT_3
Definition: cd.h:362

Definition at line 532 of file cdprocs.h.

◆ CdIsFastIoPossible

#define CdIsFastIoPossible (   F)
Value:
((BOOLEAN) \
((((F)->Vcb->VcbCondition != VcbMounted ) || \
\
FastIoIsNotPossible : \
\
((((F)->FileLock != NULL) && FsRtlAreThereCurrentFileLocks( (F)->FileLock )) ? \
\
\
)
#define CdGetFcbOplock(F)
Definition: cdprocs.h:1086
smooth NULL
Definition: ftsmooth.c:416
#define FsRtlAreThereCurrentFileLocks(FL)
Definition: fsrtlfuncs.h:1584
VCB_CONDITION VcbCondition
Definition: cdstruc.h:547
_In_ PVCB Vcb
Definition: cdprocs.h:227
#define BOOLEAN
Definition: pedump.c:73
BOOLEAN NTAPI FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
Definition: oplock.c:1566
#define F(x, y, z)
Definition: md5.c:51

Definition at line 2025 of file cdprocs.h.

◆ CdIsRawDevice

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

Definition at line 1476 of file cdprocs.h.

◆ CdLockCdData

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

Definition at line 1020 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 PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define F(x, y, z)
Definition: md5.c:51

Definition at line 1049 of file cdprocs.h.

◆ CdLockUserBuffer

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

Definition at line 398 of file cdprocs.h.

◆ CdLockVcb

#define CdLockVcb (   IC,
  V 
)
Value:
ExAcquireFastMutex( &(V)->VcbMutex ); \
NT_ASSERT( NULL == (V)->VcbLockThread); \
(V)->VcbLockThread = PsGetCurrentThread()
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
smooth NULL
Definition: ftsmooth.c:416
#define V(i, a, b, c, d)
Definition: jaricom.c:29
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23

Definition at line 1028 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 )
#define DO
Definition: ftp_var.h:15
#define F(x, y, z)
Definition: md5.c:51
VOID CdLookupDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG DirentOffset, _Out_ PDIRENT_ENUM_CONTEXT DirContext)
Definition: dirsup.c:125

Definition at line 556 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); \
} \
}
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
smooth NULL
Definition: ftsmooth.c:416

Definition at line 376 of file cdprocs.h.

◆ CdMarkRealDevForVerify

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

Definition at line 1461 of file cdprocs.h.

◆ CdMarkRealDevVerifyOk

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

Definition at line 1463 of file cdprocs.h.

◆ CdNonPagedPool

#define CdNonPagedPool   NonPagedPoolNx

Definition at line 1387 of file cdprocs.h.

◆ CdNonPagedPoolCacheAligned

#define CdNonPagedPoolCacheAligned   NonPagedPoolNxCacheAligned

Definition at line 1388 of file cdprocs.h.

◆ CdNormalizeAndRaiseStatus

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

Definition at line 1870 of file cdprocs.h.

◆ CdPagedPool

#define CdPagedPool   PagedPool

Definition at line 1385 of file cdprocs.h.

◆ CdRaiseStatus

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

Definition at line 1869 of file cdprocs.h.

◆ CdRealDevNeedsVerify

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

Definition at line 1466 of file cdprocs.h.

◆ CdReleaseAllFiles

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

Definition at line 996 of file cdprocs.h.

◆ CdReleaseCache

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

Definition at line 972 of file cdprocs.h.

◆ CdReleaseCdData

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

Definition at line 981 of file cdprocs.h.

◆ CdReleaseFcb

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

Definition at line 1017 of file cdprocs.h.

◆ CdReleaseFile

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

Definition at line 1008 of file cdprocs.h.

◆ CdReleaseVcb

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

Definition at line 990 of file cdprocs.h.

◆ CdRestoreThreadContext

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

Definition at line 1993 of file cdprocs.h.

◆ CdTelemetryMountSafe

#define CdTelemetryMountSafe (   ...)    NOTHING

Definition at line 2322 of file cdprocs.h.

◆ CdUnlockCdData

#define CdUnlockCdData ( )
Value:
ExReleaseFastMutex( &CdData.CdDataMutex )
FAST_MUTEX CdDataMutex
Definition: cdstruc.h:402
PVOID CdDataLockThread
Definition: cdstruc.h:401
smooth NULL
Definition: ftsmooth.c:416
CD_DATA CdData
Definition: cddata.c:42

Definition at line 1024 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)); \
} \
}
smooth NULL
Definition: ftsmooth.c:416
#define F(x, y, z)
Definition: md5.c:51

Definition at line 1065 of file cdprocs.h.

◆ CdUnlockVcb

#define CdUnlockVcb (   IC,
  V 
)
Value:
NT_ASSERT( NULL != (V)->VcbLockThread); \
(V)->VcbLockThread = NULL; \
ExReleaseFastMutex( &(V)->VcbMutex )
smooth NULL
Definition: ftsmooth.c:416
#define V(i, a, b, c, d)
Definition: jaricom.c:29
#define NT_ASSERT
Definition: rtlfuncs.h:3312

Definition at line 1033 of file cdprocs.h.

◆ CdUnpinData

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

Definition at line 261 of file cdprocs.h.

◆ CdUpdateMediaChangeCount

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

Definition at line 1458 of file cdprocs.h.

◆ CdUpdateVcbCondition

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

Definition at line 1459 of file cdprocs.h.

◆ CopyUchar1

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

Definition at line 1695 of file cdprocs.h.

◆ CopyUchar2

#define CopyUchar2 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
}
#define UNALIGNED
Definition: crtdefs.h:132
#define Dst
Definition: mesh.h:153

Definition at line 1703 of file cdprocs.h.

◆ CopyUchar4

#define CopyUchar4 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
}
#define UNALIGNED
Definition: crtdefs.h:132
#define Dst
Definition: mesh.h:153

Definition at line 1711 of file cdprocs.h.

◆ CopyUshort2

#define CopyUshort2 (   Dst,
  Src 
)
Value:
{ \
*((USHORT2 *)(Dst)) = *((UNALIGNED USHORT2 *)(Src));\
}
#define UNALIGNED
Definition: crtdefs.h:132
#define Dst
Definition: mesh.h:153

Definition at line 1720 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:66
static const WCHAR L[]
Definition: oid.c:1250
#define V(i, a, b, c, d)
Definition: jaricom.c:29

Definition at line 1656 of file cdprocs.h.

◆ LlBytesFromBlocks

#define LlBytesFromBlocks (   V,
  B 
)
Value:
( \
Int64ShllMod32( (LONGLONG) (B), (V)->BlockToByteShift ) \
)
int64_t LONGLONG
Definition: typedefs.h:66
#define B(row, col)

Definition at line 1644 of file cdprocs.h.

◆ LlBytesFromSectors

#define LlBytesFromSectors (   L)
Value:
( \
Int64ShllMod32( (LONGLONG)(L), SECTOR_SHIFT ) \
)
#define SECTOR_SHIFT
Definition: cd.h:32
int64_t LONGLONG
Definition: typedefs.h:66
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 1624 of file cdprocs.h.

◆ LlSectorAlign

#define LlSectorAlign (   L)
Value:
( \
((((LONGLONG)(L)) + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1)) \
)
#define SECTOR_SIZE
Definition: winldr.h:34
int64_t LONGLONG
Definition: typedefs.h:66
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 1594 of file cdprocs.h.

◆ LlSectorsFromBytes

#define LlSectorsFromBytes (   L)
Value:
( \
Int64ShraMod32( (LONGLONG)(L), SECTOR_SHIFT ) \
)
#define SECTOR_SHIFT
Definition: cd.h:32
int64_t LONGLONG
Definition: typedefs.h:66
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 1628 of file cdprocs.h.

◆ LlSectorTruncate

#define LlSectorTruncate (   L)
Value:
( \
((LONGLONG)(L)) & ~(SECTOR_SIZE - 1) \
)
#define SECTOR_SIZE
Definition: winldr.h:34
int64_t LONGLONG
Definition: typedefs.h:66
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 1602 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
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1573 of file cdprocs.h.

◆ Max

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

Definition at line 70 of file cdprocs.h.

◆ Min

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

Definition at line 66 of file cdprocs.h.

◆ PtrOffset

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

Definition at line 1557 of file cdprocs.h.

◆ QuadAlign

#define QuadAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 7) & 0xfffffff8) \
)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1582 of file cdprocs.h.

◆ RawSectorAlign

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

Definition at line 1664 of file cdprocs.h.

◆ SectorAlign

#define SectorAlign (   L)
Value:
( \
((((ULONG)(L)) + (SECTOR_SIZE - 1)) & ~(SECTOR_SIZE - 1)) \
)
#define SECTOR_SIZE
Definition: winldr.h:34
static const WCHAR L[]
Definition: oid.c:1250
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1590 of file cdprocs.h.

◆ SectorBlockOffset

#define SectorBlockOffset (   V,
  LB 
)
Value:
( \
((ULONG) (LB)) & ((V)->BlocksPerSector - 1) \
)
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1636 of file cdprocs.h.

◆ SectorOffset

#define SectorOffset (   L)
Value:
( \
)
#define SECTOR_MASK
Definition: cd.h:28
uint32_t ULONG_PTR
Definition: typedefs.h:63
static const WCHAR L[]
Definition: oid.c:1250
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1632 of file cdprocs.h.

◆ SectorsFromBytes

#define SectorsFromBytes (   L)
Value:
( \
((ULONG) (L)) >> SECTOR_SHIFT \
)
#define SECTOR_SHIFT
Definition: cd.h:32
static const WCHAR L[]
Definition: oid.c:1250
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1610 of file cdprocs.h.

◆ SectorTruncate

#define SectorTruncate (   L)
Value:
( \
((ULONG)(L)) & ~(SECTOR_SIZE - 1) \
)
#define SECTOR_SIZE
Definition: winldr.h:34
static const WCHAR L[]
Definition: oid.c:1250
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1598 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)); \
}
#define UNALIGNED
Definition: crtdefs.h:132
#define Dst
Definition: mesh.h:153

Definition at line 1729 of file cdprocs.h.

◆ TAG_CCB

#define TAG_CCB   'ccdC'

Definition at line 77 of file cdprocs.h.

◆ TAG_CDROM_TOC

#define TAG_CDROM_TOC   'ctdC'

Definition at line 78 of file cdprocs.h.

◆ TAG_DIRENT_NAME

#define TAG_DIRENT_NAME   'nddC'

Definition at line 79 of file cdprocs.h.

◆ TAG_ENUM_EXPRESSION

#define TAG_ENUM_EXPRESSION   'eedC'

Definition at line 80 of file cdprocs.h.

◆ TAG_FCB_DATA

#define TAG_FCB_DATA   'dfdC'

Definition at line 81 of file cdprocs.h.

◆ TAG_FCB_INDEX

#define TAG_FCB_INDEX   'ifdC'

Definition at line 82 of file cdprocs.h.

◆ TAG_FCB_NONPAGED

#define TAG_FCB_NONPAGED   'nfdC'

Definition at line 83 of file cdprocs.h.

◆ TAG_FCB_TABLE

#define TAG_FCB_TABLE   'tfdC'

Definition at line 84 of file cdprocs.h.

◆ TAG_FILE_NAME

#define TAG_FILE_NAME   'nFdC'

Definition at line 85 of file cdprocs.h.

◆ TAG_GEN_SHORT_NAME

#define TAG_GEN_SHORT_NAME   'sgdC'

Definition at line 86 of file cdprocs.h.

◆ TAG_IO_BUFFER

#define TAG_IO_BUFFER   'fbdC'

Definition at line 87 of file cdprocs.h.

◆ TAG_IO_CONTEXT

#define TAG_IO_CONTEXT   'oidC'

Definition at line 88 of file cdprocs.h.

◆ TAG_IRP_CONTEXT

#define TAG_IRP_CONTEXT   'cidC'

Definition at line 89 of file cdprocs.h.

◆ TAG_IRP_CONTEXT_LITE

#define TAG_IRP_CONTEXT_LITE   'lidC'

Definition at line 90 of file cdprocs.h.

◆ TAG_MCB_ARRAY

#define TAG_MCB_ARRAY   'amdC'

Definition at line 91 of file cdprocs.h.

◆ TAG_PATH_ENTRY_NAME

#define TAG_PATH_ENTRY_NAME   'nPdC'

Definition at line 92 of file cdprocs.h.

◆ TAG_PREFIX_ENTRY

#define TAG_PREFIX_ENTRY   'epdC'

Definition at line 93 of file cdprocs.h.

◆ TAG_PREFIX_NAME

#define TAG_PREFIX_NAME   'npdC'

Definition at line 94 of file cdprocs.h.

◆ TAG_SPANNING_PATH_TABLE

#define TAG_SPANNING_PATH_TABLE   'psdC'

Definition at line 95 of file cdprocs.h.

◆ TAG_UPCASE_NAME

#define TAG_UPCASE_NAME   'nudC'

Definition at line 96 of file cdprocs.h.

◆ TAG_VOL_DESC

#define TAG_VOL_DESC   'dvdC'

Definition at line 97 of file cdprocs.h.

◆ TAG_VPB

#define TAG_VPB   'pvdC'

Definition at line 98 of file cdprocs.h.

◆ try_leave

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

Definition at line 2190 of file cdprocs.h.

◆ try_return

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

Definition at line 2189 of file cdprocs.h.

◆ WordAlign

#define WordAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 1) & 0xfffffffe) \
)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1564 of file cdprocs.h.

Typedef Documentation

◆ PTYPE_OF_ACQUIRE

◆ PTYPE_OF_OPEN

Definition at line 586 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 832 of file cdprocs.h.

832  {
833 
837 
enum _TYPE_OF_ACQUIRE * PTYPE_OF_ACQUIRE
enum _TYPE_OF_ACQUIRE TYPE_OF_ACQUIRE

◆ _TYPE_OF_OPEN

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

Definition at line 576 of file cdprocs.h.

576  {
577 
578  UnopenedFileObject = 0,
582  UserFileOpen,
584 
585 } TYPE_OF_OPEN;
enum _TYPE_OF_OPEN TYPE_OF_OPEN

Function Documentation

◆ _At_() [1/6]

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

◆ _At_() [2/6]

_At_ ( Dirent->  CdTime,
_Post_notnull_   
)

◆ _At_() [3/6]

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

◆ _At_() [4/6]

_At_ ( Fcb  ,
_In_   
)

◆ _At_() [5/6]

_At_ ( Fcb  ,
_Outptr_   
)

◆ _At_() [6/6]

_At_ ( IrpContext  ,
_Pre_notnull_   
)

◆ _CdFreePool()

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

Definition at line 2205 of file cdprocs.h.

2208 {
2209  if (*Pool != NULL) {
2210 
2211  ExFreePool(*Pool);
2212  *Pool = NULL;
2213  }
2214 }
smooth NULL
Definition: ftsmooth.c:416
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 }
Definition: cdstruc.h:908
#define PAGED_CODE()
Definition: video.h:57
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817

◆ _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 
670  Fcb->Mcb.McbArray = &Fcb->McbEntry;
671 
672  return;
673 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
CD_MCB_ENTRY McbEntry
Definition: cdstruc.h:1021
ULONG MaximumEntryCount
Definition: cdstruc.h:194
#define ASSERT_FCB(F)
Definition: cddata.h:243
#define PAGED_CODE()
Definition: video.h:57
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:249
CD_MCB Mcb
Definition: cdstruc.h:1022
ULONG CurrentEntryCount
Definition: cdstruc.h:195
_In_ PFCB Fcb
Definition: cdprocs.h:151
struct _CD_MCB_ENTRY * McbArray
Definition: cdstruc.h:201

◆ _IRQL_requires_max_()

_IRQL_requires_max_ ( APC_LEVEL  )

◆ _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:
== REG_SZ), _At_((PSTR) PropertyBuffer, _Post_valid_))
_At_(Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET(FCB, FcbType))) VOID CdInitializeMcb(_In_ PIRP_CONTEXT IrpContext
#define _Out_writes_bytes_to_opt_(size, count)
Definition: no_sal2.h:375
_When_(TypeOfOpen==UnopenedFileObject, _At_(Fcb, _In_opt_)) _When_(TypeOfOpen !
_In_ DWORD _Out_opt_ PDWORD _In_ DWORD PropertyBufferSize
Definition: setupapi.h:1548
unsigned int BOOL
Definition: ntddk_ex.h:94
#define REG_MULTI_SZ
Definition: nt_native.h:1501
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
#define _Out_opt_
Definition: no_sal2.h:339
#define WINAPI
Definition: msvc.h:8
_In_opt_ PSP_DEVINFO_DATA DeviceInfoData
Definition: setupapi.h:1523
unsigned long DWORD
Definition: ntddk_ex.h:95
#define _Post_valid_
Definition: no_sal2.h:466
BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)
Definition: devinst.c:3144
#define _In_
Definition: no_sal2.h:204
signed char * PSTR
Definition: retypes.h:7
_NullNull_terminated_ CHAR * PZZSTR
Definition: ntbasedef.h:406
DWORD * PDWORD
Definition: pedump.c:68
_In_ DWORD _Out_opt_ PDWORD PropertyRegDataType
Definition: setupapi.h:1545
#define WINSETUPAPI
Definition: setupapi.h:15
BYTE * PBYTE
Definition: pedump.c:66
#define REG_SZ
Definition: layer.c:22

Definition at line 3139 of file fsctrl.c.

3189 {
3190  PLIST_ENTRY Link;
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:718
#define TRUE
Definition: types.h:120
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH/sizeof(WCHAR)]
Definition: iotypes.h:175
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: cdstruc.h:504
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define PAGED_CODE()
Definition: video.h:57
unsigned char BOOLEAN
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
CD_DATA CdData
Definition: cddata.c:42
NTSYSAPI ULONG NTAPI RtlEqualMemory(CONST VOID *Source1, CONST VOID *Source2, ULONG Length)
struct _DEVICE_OBJECT * RealDevice
Definition: iotypes.h:172
#define Vcb
Definition: cdprocs.h:1425
Definition: typedefs.h:117
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
LIST_ENTRY VcbQueue
Definition: cdstruc.h:340
Definition: iotypes.h:166
USHORT VolumeLabelLength
Definition: iotypes.h:170
ULONG SerialNumber
Definition: iotypes.h:173
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1664

◆ _When_() [1/6]

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

◆ _When_() [2/6]

_When_ ( return  = UnopenedFileObject,
_At_ *,  _Post_null_ 
)

◆ _When_() [3/6]

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

◆ _When_() [4/6]

◆ _When_() [5/6]

◆ _When_() [6/6]

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

◆ 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 
393  NewMcbArray = FsRtlAllocatePoolWithTag( CdPagedPool,
394  NewArraySize,
395  TAG_MCB_ARRAY );
396 
397  RtlZeroMemory( NewMcbArray, NewArraySize );
398  RtlCopyMemory( NewMcbArray,
399  Fcb->Mcb.McbArray,
400  Fcb->Mcb.MaximumEntryCount * sizeof( CD_MCB_ENTRY ));
401 
402  //
403  // Deallocate the current array unless it is embedded in the Fcb.
404  //
405 
406  if (Fcb->Mcb.MaximumEntryCount != 1) {
407 
408  CdFreePool( &Fcb->Mcb.McbArray );
409  }
410 
411  //
412  // Now update the Mcb with the new array.
413  //
414 
415  Fcb->Mcb.MaximumEntryCount *= 2;
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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:229
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
ULONG MaximumEntryCount
Definition: cdstruc.h:194
#define ASSERT_FCB(F)
Definition: cddata.h:243
#define PAGED_CODE()
Definition: video.h:57
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:249
#define LlBytesFromBlocks(V, B)
Definition: cdprocs.h:1644
LONGLONG TotalBlockByteCount
Definition: cdstruc.h:230
LONGLONG DataBlockByteCount
Definition: cdstruc.h:229
#define BlockAlign(V, L)
Definition: cdprocs.h:1648
struct _CD_MCB_ENTRY CD_MCB_ENTRY
#define CD_ATTRIBUTE_MULTI
Definition: cd.h:356
#define CdPagedPool
Definition: cdprocs.h:1385
#define ASSERT_LOCKED_FCB(F)
Definition: cddata.h:267
CD_MCB Mcb
Definition: cdstruc.h:1022
LONGLONG ByteCount
Definition: cdstruc.h:215
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define CdFreePool(x)
Definition: cdprocs.h:2200
ULONG CurrentEntryCount
Definition: cdstruc.h:195
Definition: cdstruc.h:206
unsigned int ULONG
Definition: retypes.h:1
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: cdprocs.h:429
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define TAG_MCB_ARRAY
Definition: cdprocs.h:91
PVCB Vcb
Definition: cdstruc.h:939
LONGLONG DiskOffset
Definition: cdstruc.h:214
_In_ PFCB Fcb
Definition: cdprocs.h:151
struct _CD_MCB_ENTRY * McbArray
Definition: cdstruc.h:201
LONGLONG FileOffset
Definition: cdstruc.h:221

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 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define ASSERT_FCB(F)
Definition: cddata.h:243
#define PAGED_CODE()
Definition: video.h:57
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:249
#define CDFS_NTC_FCB_DATA
Definition: nodetype.h:31
#define LlBytesFromBlocks(V, B)
Definition: cdprocs.h:1644
LONGLONG TotalBlockByteCount
Definition: cdstruc.h:230
LONGLONG DataBlockByteCount
Definition: cdstruc.h:229
#define ASSERT_LOCKED_FCB(F)
Definition: cddata.h:267
CD_MCB Mcb
Definition: cdstruc.h:1022
LONGLONG ByteCount
Definition: cdstruc.h:215
ULONG CurrentEntryCount
Definition: cdstruc.h:195
Definition: cdstruc.h:206
PVCB Vcb
Definition: cdstruc.h:939
LONGLONG DiskOffset
Definition: cdstruc.h:214
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
_In_ PFCB Fcb
Definition: cdprocs.h:151
struct _CD_MCB_ENTRY * McbArray
Definition: cdstruc.h:201
#define NT_ASSERT
Definition: rtlfuncs.h:3312
LONGLONG FileOffset
Definition: cdstruc.h:221

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 }
DIRENT_ENUM_CONTEXT DirContext
Definition: cdstruc.h:1689
#define CdCleanupDirContext(IC, DC)
Definition: cdprocs.h:553
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
PAGED_CODE()
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG _Inout_ PFILE_ENUM_CONTEXT FileContext
Definition: dirsup.c:1148
unsigned int ULONG
Definition: retypes.h:1
UNREFERENCED_PARAMETER(Fcb)
#define CdCleanupDirent(IC, D)
Definition: cdprocs.h:547

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 
1798  CdUnlockCdData();
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 IRP_CONTEXT_FLAG_ALLOC_IO
Definition: cdstruc.h:1227
Definition: ntbasedef.h:635
#define IRP_CONTEXT_FLAG_MORE_PROCESSING
Definition: cdstruc.h:1220
#define PAGED_CODE()
Definition: video.h:57
#define CdRestoreThreadContext(IC)
Definition: cdprocs.h:1993
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)
Definition: rtlfuncs.h:253
smooth NULL
Definition: ftsmooth.c:416
SINGLE_LIST_ENTRY IrpContextList
Definition: cdstruc.h:350
#define IRP_CONTEXT_FLAGS_CLEAR_ON_RETRY
Definition: cdstruc.h:1257
CD_DATA CdData
Definition: cddata.c:42
#define IRP_CONTEXT_FLAG_ON_STACK
Definition: cdstruc.h:1219
#define CdLockCdData()
Definition: cdprocs.h:1020
#define CdFreeIoContext(IO)
Definition: cdprocs.h:1354
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
ULONG IrpContextDepth
Definition: cdstruc.h:348
#define CdFreePool(x)
Definition: cdprocs.h:2200
ULONG IrpContextMaxDepth
Definition: cdstruc.h:349
#define IRP_CONTEXT_FLAGS_CLEAR_ON_POST
Definition: cdstruc.h:1242
#define CdUnlockCdData()
Definition: cdprocs.h:1024

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 
88  if (TypeOfOpen != UserVolumeOpen) {
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 }
#define TRUE
Definition: types.h:120
_In_ PIRP Irp
Definition: csq.h:116
Definition: cdstruc.h:908
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: cdstruc.h:1073
LONG NTSTATUS
Definition: precomp.h:26
ULONG DiskFlags
Definition: cdstruc.h:646
#define PAGED_CODE()
Definition: video.h:57
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
#define IOCTL_CDROM_DISK_TYPE
Definition: ntddcdrm.h:67
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:593
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
Definition: cddata.c:914
smooth NULL
Definition: ftsmooth.c:416
struct _CDROM_DISK_DATA * PCDROM_DISK_DATA
enum _TYPE_OF_OPEN TYPE_OF_OPEN
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
Status
Definition: gdiplustypes.h:24
VOID CdVerifyVcb(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb)
Definition: verfysup.c:411
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
struct _CDROM_DISK_DATA CDROM_DISK_DATA
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
PVCB Vcb
Definition: cdstruc.h:939
#define IOCTL_CDROM_READ_TOC
Definition: ntddcdrm.h:73
IO_COMPLETION_ROUTINE CdDevCtrlCompletionRoutine
Definition: devctrl.c:30
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2745

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 }
FILE_LOCK FileLock
Definition: fatstruc.h:1067
#define TRUE
Definition: types.h:120
_In_ PIRP Irp
Definition: csq.h:116
Definition: cdstruc.h:908
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: cdstruc.h:1073
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
#define CdUnlockFcb(IC, F)
Definition: cdprocs.h:1065
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
Definition: cdprocs.h:593
#define CdGetFcbOplock(F)
Definition: cdprocs.h:1086
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
Definition: cddata.c:914
smooth NULL
Definition: ftsmooth.c:416
#define CdIsFastIoPossible(F)
Definition: cdprocs.h:2025
enum _TYPE_OF_OPEN TYPE_OF_OPEN
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
NTSTATUS NTAPI FsRtlProcessFileLock(IN PFILE_LOCK FileLock, IN PIRP Irp, IN PVOID Context OPTIONAL)
Definition: filelock.c:1153
Status
Definition: gdiplustypes.h:24
#define CdLockFcb(IC, F)
Definition: cdprocs.h:1049
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
BOOLEAN CdVerifyFcbOperation(_In_opt_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
Definition: verfysup.c:615
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:1172
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2745

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 }
_In_ PIRP Irp
Definition: csq.h:116
#define PAGED_CODE()
Definition: video.h:57
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
Definition: cddata.c:914
VOID NTAPI CcMdlReadComplete(IN PFILE_OBJECT FileObject, IN PMDL MdlChain)
Definition: mdlsup.c:75
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
* PFILE_OBJECT
Definition: iotypes.h:1954
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
return STATUS_SUCCESS
Definition: btrfs.c:2745

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 AssertVerifyDeviceIrp(I)
Definition: cdprocs.h:1821
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
#define ASSERT_OPTIONAL_IRP_CONTEXT(IC)
Definition: cddata.h:250
#define ARGUMENT_PRESENT(ArgumentPointer)
#define NT_ERROR(Status)
Definition: umtypes.h:106
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
Status
Definition: gdiplustypes.h:24
#define IO_CD_ROM_INCREMENT
Definition: iotypes.h:566
#define IRP_INPUT_OPERATION
#define ASSERT_OPTIONAL_IRP(I)
Definition: cddata.h:252
VOID CdCleanupIrpContext(_In_ PIRP_CONTEXT IrpContext, _In_ BOOLEAN Post)
Definition: strucsup.c:1733

Referenced by _IRQL_requires_max_(), _Requires_lock_held_(), 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
178  *Destination = *Source;
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 }
signed char * PCHAR
Definition: retypes.h:7
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PAGED_CODE()
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2875
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1060
#define CdRaiseStatus(IC, S)
Definition: cdprocs.h:1869
#define STATUS_DISK_CORRUPT_ERROR
Definition: udferr_usr.h:147
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167

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 CDFS_NTC_CCB
Definition: nodetype.h:33
#define CdAllocateCcb(IC)
Definition: strucsup.c:93
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: cdstruc.h:1073
#define PAGED_CODE()
Definition: video.h:57
NODE_TYPE_CODE NodeTypeCode
Definition: fatstruc.h:1362
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
ULONG Flags
Definition: cdstruc.h:1086
struct _CCB CCB
NODE_BYTE_SIZE NodeByteSize
Definition: cdstruc.h:1080
PFCB Fcb
Definition: cdstruc.h:1092
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ PFCB Fcb
Definition: cdprocs.h:151

◆ 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 
1057  RtlZeroMemory( NewFcb, SIZEOF_FCB_INDEX );
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,
1119  &NewFcb->FcbNonpaged->AdvancedFcbHeaderMutex );
1120 
1121  if (NodeTypeCode == CDFS_NTC_FCB_DATA) {
1122 
1124  }
1125 
1126  } else {
1127 
1128  *FcbExisted = TRUE;
1129  }
1130 
1131  return NewFcb;
1132 }
#define SIZEOF_FCB_INDEX
Definition: cdstruc.h:1065
#define SIZEOF_FCB_DATA
Definition: cdstruc.h:1062
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
Definition: cdstruc.h:908
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 CDFS_NTC_FCB_PATH_TABLE
Definition: nodetype.h:29
#define CDFS_NTC_FCB_INDEX
Definition: nodetype.h:30
#define PAGED_CODE()
Definition: video.h:57
#define CdBugCheck(A, B, C)
Definition: nodetype.h:103
FAST_MUTEX AdvancedFcbHeaderMutex
Definition: cdstruc.h:898
#define CdGetFcbOplock(F)
Definition: cdprocs.h:1086
#define CDFS_NTC_FCB_DATA
Definition: nodetype.h:31
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define ARGUMENT_PRESENT(ArgumentPointer)
VOID NTAPI FsRtlInitializeOplock(IN OUT POPLOCK Oplock)
Definition: oplock.c:1402
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define CdFreePool(x)
Definition: cdprocs.h:2200
PFCB_NONPAGED CdCreateFcbNonpaged(_In_ PIRP_CONTEXT IrpContext)
Definition: strucsup.c:2555
#define CdRaiseStatus(IC, S)
Definition: cdprocs.h:1869
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
FILE_ID FileId
Definition: cdstruc.h:958
#define CdAllocateFcbIndex(IC)
Definition: strucsup.c:81
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
PVCB Vcb
Definition: cdstruc.h:939
PFCB_NONPAGED FcbNonpaged
Definition: cdstruc.h:1009

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 );
311  Fcb->FileObject = NULL;
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 }
LONGLONG CreationTime
Definition: cdstruc.h:1036
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:384
#define FCB_STATE_INITIALIZED
Definition: cdstruc.h:1048
#define TRUE
Definition: types.h:120
#define CD_ATTRIBUTE_HIDDEN
Definition: cd.h:353
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PFILE_OBJECT FileObject
Definition: ntfs.h:504
CACHE_MANAGER_CALLBACKS CacheManagerCallbacks
Definition: cdstruc.h:415
ULONG FileAttributes
Definition: cdstruc.h:983
VOID CdUpdateDirentName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
Definition: dirsup.c:534
#define CdCleanupDirContext(IC, DC)
Definition: cdprocs.h:553
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
PFILE_OBJECT NTAPI IoCreateStreamFileObjectLite(IN PFILE_OBJECT FileObject OPTIONAL, IN PDEVICE_OBJECT DeviceObject OPTIONAL)
Definition: file.c:3198
#define ASSERT_FCB(F)
Definition: cddata.h:243
#define PAGED_CODE()
Definition: video.h:57
#define CdUnlockFcb(IC, F)
Definition: cdprocs.h:1065
_SEH2_TRY
Definition: create.c:4250
#define STATUS_FILE_CORRUPT_ERROR
Definition: udferr_usr.h:168
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:249
struct NameRec_ * Name
Definition: cdprocs.h:464
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define BlockAlign(V, L)
Definition: cdprocs.h:1648
#define CdDecrementReferenceCounts(IC, F, C, UC)
Definition: cdprocs.h:1330
VOID CdTruncateAllocation(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ LONGLONG StartingFileOffset)
Definition: allocsup.c:575
WCHAR CdUnicodeSelfArray[]
Definition: cddata.c:49
CD_DATA CdData
Definition: cddata.c:42
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:193
#define CdInitializeDirContext(IC, DC)
Definition: cdprocs.h:544
#define CdUnlockVcb(IC, V)
Definition: cdprocs.h:1033
#define Vcb
Definition: cdprocs.h:1425
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT DirContext
Definition: cdprocs.h:429
#define CdInitializeDirent(IC, D)
Definition: cdprocs.h:541
* PFILE_OBJECT
Definition: iotypes.h:1954
#define CdLockVcb(IC, V)
Definition: cdprocs.h:1028
#define CdConvertCdTimeToNtTime(IC, CD, NT)
Definition: cd.h:394
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define CdLockFcb(IC, F)
Definition: cdprocs.h:1049
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
_SEH2_END
Definition: create.c:4424
#define CdRaiseStatus(IC, S)
Definition: cdprocs.h:1869
VOID NTAPI CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
Definition: fssup.c:354
_SEH2_FINALLY
Definition: create.c:4395
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
VOID CdAddInitialAllocation(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ ULONG StartingBlock, _In_ LONGLONG DataLength)
Definition: allocsup.c:484
SECTION_OBJECT_POINTERS SegmentObject
Definition: cdstruc.h:879
unsigned int ULONG
Definition: retypes.h:1
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: cdprocs.h:429
#define CdIncrementReferenceCounts(IC, F, C, UC)
Definition: cdprocs.h:1322
_In_ PFCB Fcb
Definition: cdprocs.h:151
PFCB_NONPAGED FcbNonpaged
Definition: cdstruc.h:1009
ULONG FcbState
Definition: cdstruc.h:977
#define CdCleanupDirent(IC, D)
Definition: cdprocs.h:547
VOID CdLookupDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG DirentOffset, _Out_ PDIRENT_ENUM_CONTEXT DirContext)
Definition: dirsup.c:125

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 
1625  NT_ASSERT( IrpSp->FileObject != NULL ||
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 
1650  CdUnlockCdData();
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 
1659  NewIrpContext = FsRtlAllocatePoolWithTag( CdNonPagedPool, sizeof( IRP_CONTEXT ), TAG_IRP_CONTEXT );
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 IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1221
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
PDEVICE_OBJECT FileSystemDeviceObject
Definition: cdstruc.h:356
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:229
PIRP Irp
Definition: usbstor.h:323
IRP_CONTEXT * PIRP_CONTEXT
Definition: cdstruc.h:1217
#define IRP_CONTEXT_FLAG_FORCE_POST
Definition: cdstruc.h:1222
#define IRP_MJ_SHUTDOWN
_In_ PIRP Irp
Definition: csq.h:116
#define ExRaiseStatus
Definition: ntoskrnl.h:95
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
VOLUME_DEVICE_OBJECT * PVOLUME_DEVICE_OBJECT
Definition: cdstruc.h:775
#define PAGED_CODE()
Definition: video.h:57
#define FSCTL_INVALIDATE_VOLUMES
Definition: nt_native.h:847
smooth NULL
Definition: ftsmooth.c:416
SINGLE_LIST_ENTRY IrpContextList
Definition: cdstruc.h:350
FORCEINLINE PSINGLE_LIST_ENTRY PopEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead)
Definition: rtlfuncs.h:240
#define IRP_MN_MOUNT_VOLUME
Definition: iotypes.h:4047
#define IRP_MN_USER_FS_REQUEST
Definition: iotypes.h:4046
CD_DATA CdData
Definition: cddata.c:42
#define CdNonPagedPool
Definition: cdprocs.h:1387
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define CdLockCdData()
Definition: cdprocs.h:1020
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2866
struct _IRP_CONTEXT IRP_CONTEXT
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define TAG_IRP_CONTEXT
Definition: cdprocs.h:89
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
ULONG IrpContextDepth
Definition: cdstruc.h:348
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define CDFS_NTC_IRP_CONTEXT
Definition: nodetype.h:34
#define IRP_MJ_CLEANUP
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
#define CdUnlockCdData()
Definition: cdprocs.h:1024
IN BOOLEAN Wait
Definition: fatprocs.h:1529
#define NT_ASSERT
Definition: rtlfuncs.h:3312

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,
1273  BufferLength,
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 
1301  if (!FsRtlIsNtstatusExpected( Status )) {
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 }
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
Definition: filter.c:61
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:249
_In_ ULONG BufferLength
Definition: usbdlib.h:225
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
Status
Definition: gdiplustypes.h:24
#define ASSERT_IRP(I)
Definition: cddata.h:251
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
_SEH2_END
Definition: create.c:4424
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:935
#define CdRaiseStatus(IC, S)
Definition: cdprocs.h:1869
_Inout_ PFCB _In_ BOOLEAN RaiseOnError
Definition: cdprocs.h:1214
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2745
#define NT_ASSERT
Definition: rtlfuncs.h:3312

◆ 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 UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define CdFreePool(x)
Definition: cdprocs.h:2200
#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 
378  Fcb->FileObject = NULL;
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 }
PFILE_OBJECT FileObject
Definition: ntfs.h:504
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define ASSERT_FCB(F)
Definition: cddata.h:243
#define PAGED_CODE()
Definition: video.h:57
#define CdUnlockFcb(IC, F)
Definition: cdprocs.h:1065
#define ASSERT_IRP_CONTEXT(IC)
Definition: cddata.h:249
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
* PFILE_OBJECT
Definition: iotypes.h:1954
#define CdLockFcb(IC, F)
Definition: cdprocs.h:1049
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:284
_In_ PFCB Fcb
Definition: cdprocs.h:151

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:258
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
NTSTATUS NTAPI ExDeleteResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1456
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define PAGED_CODE()
Definition: video.h:57
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define Vcb
Definition: cdprocs.h:1425
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1250
#define CdFreePool(x)
Definition: cdprocs.h:2200
#define ASSERT_EXCLUSIVE_VCB(V)
Definition: cddata.h:259
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
VOID NTAPI FsRtlNotifyUninitializeSync(IN PNOTIFY_SYNC *NotifySync)
Definition: notify.c:1639

◆ 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 }
#define Add2Ptr(PTR, INC)
uint16_t * PWCHAR
Definition: typedefs.h:54
__wchar_t WCHAR
Definition: xmlstorage.h:180
PAGED_CODE()
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static const WCHAR L[]
Definition: oid.c:1250
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
UNREFERENCED_PARAMETER(IrpContext)
_Inout_ PFCB _Inout_ PUNICODE_STRING RemainingName
Definition: cdprocs.h:806

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 
565  ExceptionCode =
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 
589  TestStatus = FALSE;
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:1782
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
Definition: filter.c:61
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define CdBugCheck(A, B, C)
Definition: nodetype.h:103
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
TestStatus
Definition: global_mem.c:32
#define ASSERT_OPTIONAL_IRP_CONTEXT(IC)
Definition: cddata.h:250
#define ARGUMENT_PRESENT(ArgumentPointer)
#define AssertVerifyDevice(C, S)
Definition: cdprocs.h:1820
#define NTSTATUS
Definition: precomp.h:20
#define STATUS_IN_PAGE_ERROR
Definition: ntstatus.h:229
return STATUS_SUCCESS
Definition: btrfs.c:2745

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)
245  FlagOn( (ULONG_PTR) FileObject->FsContext2, TYPE_OF_OPEN_MASK );
246 }
#define ASSERT_FILE_OBJECT(FO)
Definition: cddata.h:253
#define PAGED_CODE()
Definition: video.h:57
uint32_t ULONG_PTR
Definition: typedefs.h:63
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define TYPE_OF_OPEN_MASK
Definition: filobsup.c:28
enum _TYPE_OF_OPEN TYPE_OF_OPEN
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
_In_ PFCB Fcb
Definition: cdprocs.h:151

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 {
1032  PDIRENT Dirent;
1033 
1034  BOOLEAN Found = FALSE;
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 }
VOID CdUpdateDirentName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PDIRENT Dirent, _In_ ULONG IgnoreCase)
Definition: dirsup.c:534
#define TRUE
Definition: types.h:120
BOOLEAN CdIsNameInExpression(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME CurrentName, _In_ PCD_NAME SearchExpression, _In_ ULONG WildcardFlags, _In_ BOOLEAN CheckVersion)
Definition: namesup.c:844
CdLookupInitialFileDirent(IrpContext, Fcb, FileContext, Fcb->StreamOffset)
#define CD_ATTRIBUTE_DIRECTORY
Definition: cd.h:354
unsigned char BOOLEAN
PAGED_CODE()
return Found
Definition: dirsup.c:1270
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN IgnoreCase
Definition: dirsup.c:1110
#define DIRENT_FLAG_CONSTANT_ENTRY
Definition: cdstruc.h:1677
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG _Inout_ PFILE_ENUM_CONTEXT FileContext
Definition: dirsup.c:1148
CdVerifyOrCreateDirStreamFile(IrpContext, Fcb)
ULONG Flags
Definition: ntfs.h:520
_In_ PFCB Fcb
Definition: dirsup.c:398
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
BOOLEAN CdLookupNextInitialFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Inout_ PFILE_ENUM_CONTEXT FileContext)
Definition: dirsup.c:1275
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: dirsup.c:425

◆ 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;
1107  Result = GreaterThan;
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  //
11