23#define BugCheckFileId (CDFS_BUG_CHECK_CREATE)
70CdOpenDirectoryFromPathEntry (
85CdOpenFileFromFileContext (
110#pragma alloc_text(PAGE, CdCommonCreate)
111#pragma alloc_text(PAGE, CdCompleteFcbOpen)
112#pragma alloc_text(PAGE, CdNormalizeFileNames)
113#pragma alloc_text(PAGE, CdOpenByFileId)
114#pragma alloc_text(PAGE, CdOpenDirectoryFromPathEntry)
115#pragma alloc_text(PAGE, CdOpenExistingFcb)
116#pragma alloc_text(PAGE, CdOpenFileFromFileContext)
123#pragma prefast(suppress:26165, "Esp:1153")
245 if (IrpContext->Vcb ==
NULL) {
277#if (NTDDI_VERSION >= NTDDI_WIN7)
293 Vcb = IrpContext->Vcb;
294 NextFcb =
Vcb->RootIndexFcb;
301 RelatedFileObject =
NULL;
312 RelatedFileObject =
FileObject->RelatedFileObject;
315 RelatedTypeOfOpen = CdDecodeFileObject( IrpContext, RelatedFileObject, &NextFcb, &RelatedCcb );
331 RelatedFileName = &RelatedFileObject->FileName;
346 Status = CdNormalizeFileNames( IrpContext,
507 CdFindPrefix( IrpContext,
616 ShortNameMatch =
FALSE;
631 CleanupCompoundPathEntry =
TRUE;
633 FoundEntry = CdFindPathEntry( IrpContext,
655 if (CleanupFileContext) {
661 CleanupFileContext =
TRUE;
663 FoundEntry = CdFindFileByShortName( IrpContext,
677 ShortNameMatch =
TRUE;
685 FoundEntry = CdFindPathEntry( IrpContext,
808 CdOpenDirectoryFromPathEntry( IrpContext,
820 CleanupCompoundPathEntry =
FALSE;
830 if (CleanupFileContext) {
836 CleanupFileContext =
TRUE;
842 CdConvertNameToCdName( IrpContext, &FinalName );
844 FoundEntry = CdFindFile( IrpContext,
937 if (CleanupCompoundPathEntry) {
946 if (CleanupFileContext) {
969 CdTeardownStructures( IrpContext,
CurrentFcb, &RemovedFcb );
1030CdNormalizeFileNames (
1082 ULONG RemainingNameLength = 0;
1083 ULONG RelatedNameLength = 0;
1084 ULONG SeparatorLength = 0;
1152 RemainingNameLength =
FileName->Length;
1181 }
else if (
FileName->Buffer[0] ==
L'\\' ) {
1211 (RelatedCcb->
Fcb !=
Vcb->RootIndexFcb)) {
1213 SeparatorLength =
sizeof(
WCHAR );
1216 RelatedNameLength = RelatedFileName->
Length;
1224 }
else if (
FileName->Length != 0) {
1236 RemainingNameLength -=
sizeof(
WCHAR );
1237 SeparatorLength =
sizeof(
WCHAR );
1244 BufferLength = RelatedNameLength + SeparatorLength + RemainingNameLength;
1279 if (RelatedNameLength != 0) {
1285 if (RemainingNameLength != 0) {
1289 RemainingNameLength );
1294 RelatedNameLength );
1300 if (SeparatorLength != 0) {
1324 FileName->Length = (
USHORT) (RelatedNameLength + SeparatorLength + RemainingNameLength);
1336 RelatedNameLength + SeparatorLength,
1343 if (
IgnoreCase && (RemainingNameLength != 0)) {
1354#pragma prefast(push)
1355#pragma prefast(suppress:26000, "RemainingName->FileName.Buffer = FileName.Buffer + (RelatedNameLength + SeparatorLength); FileName.MaximumLength < (RelatedNameLength + SeparatorLength + RemainingNameLength).")
1463#pragma prefast(push)
1464#pragma prefast(suppress:26030, "RemainingName->FileName.Buffer = FileName.Buffer + (RelatedNameLength + SeparatorLength); FileName.MaximumLength < (RelatedNameLength + SeparatorLength + RemainingNameLength).")
1600 if (NextFcb ==
NULL) {
1623 if (NextFcb ==
NULL) {
1633 if (StreamOffset >
Vcb->PathTableFcb->FileSize.LowPart) {
1639 CleanupCompoundPathEntry =
TRUE;
1646 Vcb->PathTableFcb->StreamOffset,
1726 if (NextFcb !=
NULL) {
1778 if (StreamOffset > NextFcb->FileSize.LowPart) {
1792 NextFcb->StreamOffset );
1794 CleanupFileContext =
TRUE;
1812 (
FileContext.InitialDirent->Dirent.DirentOffset > StreamOffset)) {
1944 Status = CdCompleteFcbOpen( IrpContext,
1962 if (CleanupFileContext) {
1967 if (CleanupCompoundPathEntry) {
2066 Status = CdCompleteFcbOpen( IrpContext,
2086CdOpenDirectoryFromPathEntry (
2167 if (PerformUserOpen &&
2268 if (ShortNameMatch) {
2299 &PathEntry->CdDirName,
2308 &PathEntry->CdCaseDirName,
2326 if (PerformUserOpen) {
2328 Status = CdCompleteFcbOpen( IrpContext,
2368CdOpenFileFromFileContext (
2462 if (
FileName->VersionString.Length != 0) {
2555 if (ShortNameMatch) {
2583 }
else if (
FileName->VersionString.Length == 0) {
2600 &
FileContext->InitialDirent->Dirent.CdCaseFileName,
2619 Status = CdCompleteFcbOpen( IrpContext,
2742 if (
Vcb->VcbCleanup != 0) {
2816 (
PVOID)CdOplockComplete,
2817 (
PVOID)CdPrePostIrp );
2848 (
PVOID)CdOplockComplete,
2849 (
PVOID)CdPrePostIrp );
2856 IrpContext->TeardownFcb =
NULL;
2959 IrpContext->Irp->IoStatus.Information =
Information;
2966 return OplockStatus;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define FILE_DIRECTORY_FILE
#define FILE_NON_DIRECTORY_FILE
#define CD_ATTRIBUTE_DIRECTORY
VOID CdCompleteRequest(_Inout_opt_ PIRP_CONTEXT IrpContext, _Inout_opt_ PIRP Irp, _In_ NTSTATUS Status)
#define CDFS_RESIDUAL_USER_REFERENCE
#define CdIllegalFcbAccess(IC, T, DA)
static INLINE VOID CdVerifyOrCreateDirStreamFile(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb)
VOID CdInitializeFcbFromFileContext(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ PFCB ParentFcb, _In_ PFILE_ENUM_CONTEXT FileContext)
BOOLEAN CdLookupNextPathEntry(_In_ PIRP_CONTEXT IrpContext, _Inout_ PPATH_ENUM_CONTEXT PathContext, _Inout_ PPATH_ENTRY PathEntry)
PCCB CdCreateCcb(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ ULONG Flags)
#define CdInitializeCompoundPathEntry(IC, CP)
VOID CdFspClose(_In_opt_ PVCB Vcb)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN TypeOfOpen
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PCOMPOUND_PATH_ENTRY CompoundPathEntry
VOID CdDissectName(_In_ PIRP_CONTEXT IrpContext, _Inout_ PUNICODE_STRING RemainingName, _Out_ PUNICODE_STRING FinalName)
#define CdReleaseVcb(IC, V)
#define CdReleaseFcb(IC, F)
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT _Out_ PCD_NAME * MatchingName
VOID CdVerifyVcb(_In_ PIRP_CONTEXT IrpContext, _Inout_ PVCB Vcb)
VOID CdLookupLastFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _In_ PFILE_ENUM_CONTEXT FileContext)
_In_ PFCB _In_ PCD_NAME DirName
_Inout_ PFCB _Inout_ PUNICODE_STRING RemainingName
VOID CdUpcaseName(_In_ PIRP_CONTEXT IrpContext, _In_ PCD_NAME Name, _Inout_ PCD_NAME UpcaseName)
PFCB CdLookupFcbTable(_In_ PIRP_CONTEXT IrpContext, _In_ PVCB Vcb, _In_ FILE_ID FileId)
#define CdGetFcbOplock(F)
#define CdInitializeFileContext(IC, FC)
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _Inout_ PFILE_ENUM_CONTEXT FileContext
#define CdAcquireVcbShared(IC, V, I)
VOID CdInitializeFcbFromPathEntry(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_opt_ PFCB ParentFcb, _In_ PPATH_ENTRY PathEntry)
#define CdUnlockVcb(IC, V)
#define CdLookupInitialFileDirent(IC, F, FC, DO)
BOOLEAN CdLookupNextInitialFileDirent(_In_ PIRP_CONTEXT IrpContext, _In_ PFCB Fcb, _Inout_ PFILE_ENUM_CONTEXT FileContext)
#define CdCleanupCompoundPathEntry(IC, CP)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
#define CdAcquireVcbExclusive(IC, V, I)
#define CdAcquireFcbExclusive(IC, F, I)
PFCB CdCreateFcb(_In_ PIRP_CONTEXT IrpContext, _In_ FILE_ID FileId, _In_ NODE_TYPE_CODE NodeTypeCode, _Out_opt_ PBOOLEAN FcbExisted)
enum _TYPE_OF_OPEN TYPE_OF_OPEN
_Inout_ PFCB * CurrentFcb
ULONG CdShortNameDirentOffset(_In_ PIRP_CONTEXT IrpContext, _In_ PUNICODE_STRING Name)
_In_ PFCB _In_ PCD_NAME _In_ BOOLEAN _In_ ULONG ShortNameDirentOffset
#define CdIncrementCleanupCounts(IC, F)
VOID CdInsertPrefix(_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ PCD_NAME Name, _In_ BOOLEAN IgnoreCase, _In_ BOOLEAN ShortNameMatch, _Inout_ PFCB ParentFcb)
VOID CdLookupPathEntry(_In_ PIRP_CONTEXT IrpContext, _In_ ULONG PathEntryOffset, _In_ ULONG Ordinal, _In_ BOOLEAN VerifyBounds, _Inout_ PCOMPOUND_PATH_ENTRY CompoundPathEntry)
#define CdIsFastIoPossible(F)
VOID CdCleanupFileContext(_In_ PIRP_CONTEXT IrpContext, _In_ PFILE_ENUM_CONTEXT FileContext)
#define CdUnlockFcb(IC, F)
#define CdIncrementReferenceCounts(IC, F, C, UC)
#define CdRaiseStatus(IC, S)
#define CCB_FLAG_IGNORE_CASE
#define IRP_CONTEXT_FLAG_FULL_NAME
#define CdFidIsDirectory(I)
#define CCB_FLAG_OPEN_RELATIVE_BY_ID
#define CCB_FLAG_OPEN_WITH_VERSION
#define CdQueryFidDirentOffset(I)
#define CCB_FLAG_OPEN_BY_ID
#define CdSetFidDirentOffset(I, D)
#define IRP_CONTEXT_FLAG_WAIT
#define VCB_STATE_AUDIO_DISK
#define CdFidSetDirectory(I)
#define IRP_CONTEXT_FLAG_TRAIL_BACKSLASH
#define CdQueryFidPathTableOffset(I)
#define CdSetFidPathTableOffset(I, P)
#define _Acquires_lock_(lock)
#define _Requires_lock_held_(lock)
#define _Acquires_exclusive_lock_(lock)
#define _Analysis_assume_lock_held_(lock)
#define _Analysis_assume_same_lock_(lock1, lock2)
#define _Analysis_suppress_lock_checking_(lock)
#define NT_SUCCESS(StatCode)
#define SafeNodeType(Ptr)
#define CDFS_NTC_FCB_INDEX
#define CDFS_NTC_FCB_DATA
_In_ PIO_STACK_LOCATION IrpSp
#define BooleanFlagOn(F, SF)
struct _FileName FileName
#define FILE_OPEN_BY_FILE_ID
#define FILE_NO_INTERMEDIATE_BUFFERING
#define FILE_OPEN_REQUIRING_OPLOCK
#define Add2Ptr(PTR, INC)
#define FILE_DELETE_CHILD
#define FILE_WRITE_ATTRIBUTES
#define FILE_ATTRIBUTE_DIRECTORY
#define FILE_ADD_SUBDIRECTORY
#define ARGUMENT_PRESENT(ArgumentPointer)
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
BOOLEAN NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
VOID NTAPI IoSetShareAccess(IN ACCESS_MASK DesiredAccess, IN ULONG DesiredShareAccess, IN PFILE_OBJECT FileObject, OUT PSHARE_ACCESS ShareAccess)
NTSTATUS NTAPI IoCheckShareAccess(IN ACCESS_MASK DesiredAccess, IN ULONG DesiredShareAccess, IN PFILE_OBJECT FileObject, IN PSHARE_ACCESS ShareAccess, IN BOOLEAN Update)
VOID NTAPI IoUpdateShareAccess(IN PFILE_OBJECT FileObject, OUT PSHARE_ACCESS ShareAccess)
BOOLEAN NTAPI FsRtlCurrentBatchOplock(IN POPLOCK Oplock)
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)
#define _SEH2_AbnormalTermination()
UNICODE_STRING VersionString
SECTION_OBJECT_POINTERS SegmentObject
__volatile LONG FcbReference
PFCB_NONPAGED FcbNonpaged
union _IO_STACK_LOCATION::@1579 Parameters
struct _IO_STACK_LOCATION::@3978::@3979 Create
#define RtlCopyMemory(Destination, Source, Length)
#define RtlMoveMemory(Destination, Source, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_FILE_IS_A_DIRECTORY
#define STATUS_NOT_A_DIRECTORY
#define STATUS_ACCESS_DENIED
#define STATUS_OBJECT_PATH_NOT_FOUND
#define STATUS_INVALID_PARAMETER
#define STATUS_DISK_CORRUPT_ERROR
#define STATUS_SHARING_VIOLATION
#define STATUS_FILE_CORRUPT_ERROR
#define STATUS_OBJECT_NAME_INVALID
#define STATUS_OBJECT_NAME_NOT_FOUND
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_Must_inspect_result_ _In_opt_ WDFKEY _In_ PCUNICODE_STRING _In_ ACCESS_MASK _In_ ULONG _Out_opt_ PULONG CreateDisposition
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
#define FILE_OPBATCH_BREAK_UNDERWAY
#define SL_OPEN_PAGING_FILE
#define FO_NO_INTERMEDIATE_BUFFERING
#define FO_CACHE_SUPPORTED
#define SL_OPEN_TARGET_DIRECTORY
#define SL_CASE_SENSITIVE