mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:25:39 +00:00
[0.4.7][CDFS_NEW/NTOSKRNL/NDK] Switch from our old CDFS to MS-PL CDFS_NEW
The main motivation to switch to that newer driver is, that our old one simply can not read all isos. Especially complex ones made trouble and were only shown as empty in explorer. It is still possible to build and use the old driver when needed, only thing that needs to be done for that is to revert 0.4.8-dev-164-gec6b3ecbe4
Porting back the state up to 0.4.8-release-100-g8f947b5 implies: Fixing the following JIRA-IDs (or avoid introducing them): CORE-18029 "Mute noisy DPRINT 'SectionObject has ImageSection'" CORE-17405 "Fix a macro-copy-paste and shrink the binary size" CORE-15659 "Unable to build the gcc Release version in Windows using RosBE 2.1.6 (module cdfs fails)" CORE-14315 "CDFS_NEW assertion during first stage setup due to new CcPerformReadAhead" CORE-14128 "Avast! Free Antivirus 7.0 hangs the system when trying to detect a newly created virus" CORE-14067 "CDFS_NEW assertions and exceptions" CORE-14003 "Shutting down LiveCD asserts since introduction of MS PL CDFS_NEW" CORE-13184 "Restore ability to install from disk-image" by picking the following commits: 0.4.8-release-100-g8f947b5322
[NTOSKRNL] Mute noisy DPRINT 'SectionObject has ImageSection' CORE-18029 0.4.8-release-80-geb1ea19588
[CDFS_NEW] == 0.4.15-dev-1456-g889eab7
CORE-17405 0.4.8-release-62-g8c07aad4a8
[CDFS_NEW/XDK] == 0.4.11-dev-39-ga2f9762
+ 0.4.11-dev-40-g6d7ec8c
CORE-14067 0.4.8-release-3-g5d976d04e8
[CDFS_NEW] == 0.4.12-dev-431-gbccad87f3c
+ 0.4.12-dev-432-g3463b2db9f
CORE-15659 0.4.8-RC-3-g51f9494d48
[CDFS_NEW] superseded later by the proper fix 0.4.8-release-62-g8c07aad4a8
CORE-14067 0.4.8-dev-1069-ga5e89014dc
[CDFS_NEW] CORE-14315 0.4.8-dev-475-ga59d4674de
[NTOSKRNL] io/iomgr/device.c (forgotten assert) CORE-14128 0.4.8-dev-221-g9d67a24799
[CDFS_NEW] 0.4.8-dev-220-g67a7e45e35
[CDFS_NEW/DOC] 0.4.8-dev-219-g6a3bbf24e0
[CDFS_NEW] 0.4.8-dev-218-gec26cde4a1
[CDFS_NEW] 0.4.8-dev-217-gbc2378a356
[CDFS_NEW] 0.4.8-dev-216-g5429771b99
[CDFS_NEW] 0.4.8-dev-215-gfd34548263
[CDFS_NEW] Sync with MS-PL driver 0.4.8-dev-164-gec6b3ecbe4
[FILESYSTEMS] switch from CDFS to CDFS_NEW in CMakeLists.txt 0.4.8-dev-160-g2b217e4ecf
[NTOSKRNL] Mute spam CcSetReadAheadGranularity() 0.4.8-dev-159-g64cb138a67
[NTOSKRNL] Mute spam CcPurgeCacheSection() 0.4.8-dev-150-gf723d230a0
[CDFS_NEW] 0.4.8-dev-133-gfaee3753ea
[CDFS_NEW] CORE-14003 0.4.8-dev-132-g1d777ffab5
[NTOSKRNL] iofunc.c CORE-14003 0.4.8-dev-131-gc3d5a3f2bd
[NTOSKRNL] iofunc.c CORE-14003 0.4.8-dev-130-g3b64f7f8fb
[NTOSKRNL] ob/obref.c & co CORE-14003 0.4.8-dev-129-g7eefe70294
[NTOSKRNL] io/iomgr.c & co CORE-14003 0.4.8-dev-127-g5f255827d3
[CDFS_NEW] 0.4.8-dev-126-g1bef48796e
[NTOSKRNL] just a comment, superseded later 0.4.8-dev-125-gcbf0430b56
[CDFS_NEW] 0.4.8-dev-123-gf88fe43abd
[NTOSKRNL] io/iomgr/device.c (forbidden DPRINT) 0.4.8-dev-122-g6c73385625
[CDFS_NEW] CORE-13184 0.4.8-dev-97-g94298313c0
[CDFS_NEW] 0.4.8-dev-95-ge88eeb21af
[CDFS_NEW/NTOSKRNL] CcWaitForCurrentLazyWriterActivity() stub return Success 0.4.8-dev-94-g03d5be6437
[CDFS_NEW] 0.4.8-dev-93-gfa1c60db50
[CDFS_NEW] 0.4.8-dev-92-g8b2fd60829
[CDFS_NEW] 0.4.8-dev-91-ge4da7ecc50
[CDFS_NEW] 0.4.8-dev-90-g7b19676e2b
[CDFS_NEW] 0.4.8-dev-89-g3d4b8783fd
[CDFS_NEW] 0.4.8-dev-88-g818025ecc8
[CDFS_NEW] 0.4.8-dev-87-g2639dd6736
[CDFS_NEW] 0.4.8-dev-86-g755bdb5d0b
[CDFS_NEW] 0.4.8-dev-85-g3cbcb1bade
[CDFS_NEW] and mute spam in opcode INSTEAD of picking: 0.4.8-dev-165-g2284a457a3
[NTOSKRNL] oplock.c Fixup 0.4.8-dev-163-gd3d5853956
[NTOSKRNL] oplock.c Implement oplock-support 0.4.12-dev-232-gf488102c86
[CDFS] was also left out for now I am aware, that the backport introduces white-space-glitches within CDFS_NEW. I decided to live with them in favor of better sync to master and newer releases.
This commit is contained in:
parent
579198c07b
commit
688875e411
54 changed files with 5845 additions and 3769 deletions
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
add_subdirectory(btrfs)
|
add_subdirectory(btrfs)
|
||||||
add_subdirectory(cdfs)
|
add_subdirectory(cdfs_new)
|
||||||
add_subdirectory(ext2)
|
add_subdirectory(ext2)
|
||||||
add_subdirectory(fastfat)
|
add_subdirectory(fastfat)
|
||||||
add_subdirectory(ffs)
|
add_subdirectory(ffs)
|
||||||
|
|
40
drivers/filesystems/cdfs_new/CMakeLists.txt
Normal file
40
drivers/filesystems/cdfs_new/CMakeLists.txt
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/drivers)
|
||||||
|
|
||||||
|
list(APPEND SOURCE
|
||||||
|
allocsup.c
|
||||||
|
cachesup.c
|
||||||
|
cddata.c
|
||||||
|
cdinit.c
|
||||||
|
cdprocssrc.c
|
||||||
|
cleanup.c
|
||||||
|
close.c
|
||||||
|
create.c
|
||||||
|
devctrl.c
|
||||||
|
deviosup.c
|
||||||
|
dirctrl.c
|
||||||
|
dirsup.c
|
||||||
|
fileinfo.c
|
||||||
|
filobsup.c
|
||||||
|
fsctrl.c
|
||||||
|
fspdisp.c
|
||||||
|
lockctrl.c
|
||||||
|
namesup.c
|
||||||
|
pathsup.c
|
||||||
|
pnp.c
|
||||||
|
prefxsup.c
|
||||||
|
read.c
|
||||||
|
resrcsup.c
|
||||||
|
shutdown.c
|
||||||
|
strucsup.c
|
||||||
|
verfysup.c
|
||||||
|
volinfo.c
|
||||||
|
workque.c
|
||||||
|
write.c)
|
||||||
|
|
||||||
|
add_library(cdfs SHARED ${SOURCE} cdfs.rc)
|
||||||
|
set_module_type(cdfs kernelmodedriver)
|
||||||
|
target_link_libraries(cdfs ${PSEH_LIB} memcmp)
|
||||||
|
add_importlibs(cdfs ntoskrnl hal)
|
||||||
|
add_cd_file(TARGET cdfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
|
||||||
|
add_registry_inf(cdfs_reg.inf)
|
20
drivers/filesystems/cdfs_new/README.md
Normal file
20
drivers/filesystems/cdfs_new/README.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<!---
|
||||||
|
name: CDFS File System Driver
|
||||||
|
platform: WDM
|
||||||
|
language: cpp
|
||||||
|
category: FileSystem
|
||||||
|
description: The CD-ROM file system driver (cdfs) sample is a file system driver for removable media.
|
||||||
|
samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=617642
|
||||||
|
--->
|
||||||
|
|
||||||
|
|
||||||
|
CDFS File System Driver
|
||||||
|
=======================
|
||||||
|
|
||||||
|
The CD-ROM file system driver (cdfs) sample is a sample file system driver that you can use to write new file systems.
|
||||||
|
|
||||||
|
Cdfs is a read-only file system that addresses various issues such as accessing data on disk, interacting with the cache manager, and handling various I/O operations such as opening files, performing reads on a file, retrieving information on a file, and performing various control operations on the file system. The Cdfs file system is included with the Microsoft Windows operating system.
|
||||||
|
|
||||||
|
## Universal Windows Driver Compliant
|
||||||
|
This sample builds a Universal Windows Driver. It uses only APIs and DDIs that are included in OneCoreUAP.
|
||||||
|
|
|
@ -44,7 +44,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -58,18 +58,18 @@ Abstract:
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
CdFindMcbEntry (
|
CdFindMcbEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN LONGLONG FileOffset
|
_In_ LONGLONG FileOffset
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdDiskOffsetFromMcbEntry (
|
CdDiskOffsetFromMcbEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PCD_MCB_ENTRY McbEntry,
|
_In_ PCD_MCB_ENTRY McbEntry,
|
||||||
IN LONGLONG FileOffset,
|
_In_ LONGLONG FileOffset,
|
||||||
IN PLONGLONG DiskOffset,
|
_Out_ PLONGLONG DiskOffset,
|
||||||
IN PULONG ByteCount
|
_Out_ PULONG ByteCount
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -84,13 +84,18 @@ CdDiskOffsetFromMcbEntry (
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// PREFast currently has no way to express the Fcb==Fcb->Vcb->VolumeDasdFcb early return
|
||||||
|
#pragma warning(suppress: 6001 6101)
|
||||||
|
#endif
|
||||||
CdLookupAllocation (
|
CdLookupAllocation (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN LONGLONG FileOffset,
|
_In_ LONGLONG FileOffset,
|
||||||
OUT PLONGLONG DiskOffset,
|
_Out_ PLONGLONG DiskOffset,
|
||||||
OUT PULONG ByteCount
|
_Out_ PULONG ByteCount
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -128,7 +133,7 @@ Return Value:
|
||||||
{
|
{
|
||||||
BOOLEAN FirstPass = TRUE;
|
BOOLEAN FirstPass = TRUE;
|
||||||
ULONG McbEntryOffset;
|
ULONG McbEntryOffset;
|
||||||
PFCB ParentFcb = NULL; /* ReactOS Change: GCC uninitialized variable bug */
|
PFCB ParentFcb = NULL;
|
||||||
BOOLEAN CleanupParent = FALSE;
|
BOOLEAN CleanupParent = FALSE;
|
||||||
|
|
||||||
BOOLEAN UnlockFcb = FALSE;
|
BOOLEAN UnlockFcb = FALSE;
|
||||||
|
@ -137,19 +142,31 @@ Return Value:
|
||||||
ULONG CurrentMcbOffset;
|
ULONG CurrentMcbOffset;
|
||||||
PCD_MCB_ENTRY CurrentMcbEntry;
|
PCD_MCB_ENTRY CurrentMcbEntry;
|
||||||
|
|
||||||
DIRENT_ENUM_CONTEXT DirContext;
|
DIRENT_ENUM_CONTEXT DirContext = {0};
|
||||||
DIRENT Dirent;
|
DIRENT Dirent = {0};
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
|
|
||||||
|
//
|
||||||
|
// For DASD IO we already have clamped the read to the volume limits.
|
||||||
|
// We'll allow reading beyond those limits for extended DASD IO, so
|
||||||
|
// no MCB lookup here.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (Fcb == Fcb->Vcb->VolumeDasdFcb) {
|
||||||
|
|
||||||
|
*DiskOffset = FileOffset;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Use a try finally to facilitate cleanup.
|
// Use a try finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We use a loop to perform the lookup. If we don't find the mapping in the
|
// We use a loop to perform the lookup. If we don't find the mapping in the
|
||||||
|
@ -215,10 +232,7 @@ Return Value:
|
||||||
// Do an unsafe test to see if we need to create a file object.
|
// Do an unsafe test to see if we need to create a file object.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ParentFcb->FileObject == NULL) {
|
CdVerifyOrCreateDirStreamFile( IrpContext, ParentFcb);
|
||||||
|
|
||||||
CdCreateInternalStream( IrpContext, ParentFcb->Vcb, ParentFcb );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the local variables to indicate the first dirent
|
// Initialize the local variables to indicate the first dirent
|
||||||
|
@ -296,7 +310,7 @@ Return Value:
|
||||||
FirstPass = FALSE;
|
FirstPass = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (CleanupParent) {
|
if (CleanupParent) {
|
||||||
|
|
||||||
|
@ -311,7 +325,7 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UnlockFcb) { CdUnlockFcb( IrpContext, Fcb ); }
|
if (UnlockFcb) { CdUnlockFcb( IrpContext, Fcb ); }
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -319,11 +333,11 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdAddAllocationFromDirent (
|
CdAddAllocationFromDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_Inout_ PFCB Fcb,
|
||||||
IN ULONG McbEntryOffset,
|
_In_ ULONG McbEntryOffset,
|
||||||
IN LONGLONG StartingFileOffset,
|
_In_ LONGLONG StartingFileOffset,
|
||||||
IN PDIRENT Dirent
|
_In_ PDIRENT Dirent
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -358,6 +372,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
ASSERT_LOCKED_FCB( Fcb );
|
ASSERT_LOCKED_FCB( Fcb );
|
||||||
|
@ -466,10 +482,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdAddInitialAllocation (
|
CdAddInitialAllocation (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_Inout_ PFCB Fcb,
|
||||||
IN ULONG StartingBlock,
|
_In_ ULONG StartingBlock,
|
||||||
IN LONGLONG DataLength
|
_In_ LONGLONG DataLength
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -505,11 +521,13 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
ASSERT_LOCKED_FCB( Fcb );
|
ASSERT_LOCKED_FCB( Fcb );
|
||||||
ASSERT( 0 == Fcb->Mcb.CurrentEntryCount);
|
NT_ASSERT( 0 == Fcb->Mcb.CurrentEntryCount);
|
||||||
ASSERT( CDFS_NTC_FCB_DATA != Fcb->NodeTypeCode);
|
NT_ASSERT( CDFS_NTC_FCB_DATA != Fcb->NodeTypeCode);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the new entry with the input data.
|
// Update the new entry with the input data.
|
||||||
|
@ -555,9 +573,9 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdTruncateAllocation (
|
CdTruncateAllocation (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_Inout_ PFCB Fcb,
|
||||||
IN LONGLONG StartingFileOffset
|
_In_ LONGLONG StartingFileOffset
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -591,7 +609,7 @@ Return Value:
|
||||||
ASSERT_LOCKED_FCB( Fcb );
|
ASSERT_LOCKED_FCB( Fcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the entry containing this starting offset.
|
// Find the entry containg this starting offset.
|
||||||
//
|
//
|
||||||
|
|
||||||
McbEntryOffset = CdFindMcbEntry( IrpContext, Fcb, StartingFileOffset );
|
McbEntryOffset = CdFindMcbEntry( IrpContext, Fcb, StartingFileOffset );
|
||||||
|
@ -606,10 +624,11 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_At_(Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET( FCB, FcbType )))
|
||||||
VOID
|
VOID
|
||||||
CdInitializeMcb (
|
CdInitializeMcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb
|
_Inout_updates_bytes_(Fcb->NodeByteSize) PFCB Fcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -635,6 +654,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
|
|
||||||
|
@ -652,10 +673,14 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_At_(Fcb->NodeByteSize, _In_range_(>=, FIELD_OFFSET( FCB, FcbType )))
|
||||||
|
_When_(Fcb->NodeTypeCode == CDFS_NTC_FCB_PATH_TABLE, _At_(Fcb->NodeByteSize, _In_range_(==, SIZEOF_FCB_INDEX)))
|
||||||
|
_When_(Fcb->NodeTypeCode == CDFS_NTC_FCB_INDEX, _At_(Fcb->NodeByteSize, _In_range_(==, SIZEOF_FCB_INDEX)))
|
||||||
|
_When_(Fcb->NodeTypeCode == CDFS_NTC_FCB_DATA, _At_(Fcb->NodeByteSize, _In_range_(==, SIZEOF_FCB_DATA)))
|
||||||
VOID
|
VOID
|
||||||
CdUninitializeMcb (
|
CdUninitializeMcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb
|
_Inout_updates_bytes_(Fcb->NodeByteSize) PFCB Fcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -681,6 +706,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
|
|
||||||
|
@ -698,14 +725,14 @@ Return Value:
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local suupport routine
|
||||||
//
|
//
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
CdFindMcbEntry (
|
CdFindMcbEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN LONGLONG FileOffset
|
_In_ LONGLONG FileOffset
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -736,6 +763,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
ASSERT_LOCKED_FCB( Fcb );
|
ASSERT_LOCKED_FCB( Fcb );
|
||||||
|
@ -781,11 +810,11 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdDiskOffsetFromMcbEntry (
|
CdDiskOffsetFromMcbEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PCD_MCB_ENTRY McbEntry,
|
_In_ PCD_MCB_ENTRY McbEntry,
|
||||||
IN LONGLONG FileOffset,
|
_In_ LONGLONG FileOffset,
|
||||||
IN PLONGLONG DiskOffset,
|
_Out_ PLONGLONG DiskOffset,
|
||||||
IN PULONG ByteCount
|
_Out_ PULONG ByteCount
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -827,6 +856,9 @@ Return Value:
|
||||||
LONGLONG LocalByteCount;
|
LONGLONG LocalByteCount;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -36,9 +36,10 @@ Abstract:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdCreateInternalStream (
|
CdCreateInternalStream (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFCB Fcb
|
_Inout_ PFCB Fcb,
|
||||||
|
_In_ PUNICODE_STRING Name
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -69,8 +70,8 @@ Return Value:
|
||||||
BOOLEAN CleanupDirContext = FALSE;
|
BOOLEAN CleanupDirContext = FALSE;
|
||||||
BOOLEAN UpdateFcbSizes = FALSE;
|
BOOLEAN UpdateFcbSizes = FALSE;
|
||||||
|
|
||||||
DIRENT Dirent;
|
DIRENT Dirent = {0};
|
||||||
DIRENT_ENUM_CONTEXT DirContext;
|
DIRENT_ENUM_CONTEXT DirContext = {0};
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -94,14 +95,14 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create the internal stream. The Vpb should be pointing at our volume
|
// Create the internal stream. The Vpb should be pointing at our volume
|
||||||
// device object at this point.
|
// device object at this point.
|
||||||
//
|
//
|
||||||
|
|
||||||
StreamFile = IoCreateStreamFileObject( NULL, Vcb->Vpb->RealDevice );
|
StreamFile = IoCreateStreamFileObjectLite( NULL, Vcb->Vpb->RealDevice );
|
||||||
|
|
||||||
if (StreamFile == NULL) {
|
if (StreamFile == NULL) {
|
||||||
|
|
||||||
|
@ -128,6 +129,14 @@ Return Value:
|
||||||
Fcb,
|
Fcb,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
|
//
|
||||||
|
// We'll give stream file objects a name to aid IO profiling etc. We
|
||||||
|
// NULL this in CdDeleteInternalStream before OB deletes the file object,
|
||||||
|
// and before CdRemovePrefix is called (which frees Fcb names).
|
||||||
|
//
|
||||||
|
|
||||||
|
StreamFile->FileName = *Name;
|
||||||
|
|
||||||
//
|
//
|
||||||
// We will reference the current Fcb twice to keep it from going
|
// We will reference the current Fcb twice to keep it from going
|
||||||
// away in the error path. Otherwise if we dereference it
|
// away in the error path. Otherwise if we dereference it
|
||||||
|
@ -272,7 +281,7 @@ Return Value:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup any dirent structures we may have used.
|
// Cleanup any dirent structures we may have used.
|
||||||
|
@ -290,6 +299,14 @@ Return Value:
|
||||||
|
|
||||||
if (StreamFile != NULL) {
|
if (StreamFile != NULL) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Null the name pointer, since the stream file object never actually
|
||||||
|
// 'owns' the names, we just point it to existing ones.
|
||||||
|
//
|
||||||
|
|
||||||
|
StreamFile->FileName.Buffer = NULL;
|
||||||
|
StreamFile->FileName.MaximumLength = StreamFile->FileName.Length = 0;
|
||||||
|
|
||||||
ObDereferenceObject( StreamFile );
|
ObDereferenceObject( StreamFile );
|
||||||
Fcb->FileObject = NULL;
|
Fcb->FileObject = NULL;
|
||||||
}
|
}
|
||||||
|
@ -306,7 +323,7 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
CdUnlockFcb( IrpContext, Fcb );
|
CdUnlockFcb( IrpContext, Fcb );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -314,8 +331,8 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdDeleteInternalStream (
|
CdDeleteInternalStream (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb
|
_Inout_ PFCB Fcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -342,6 +359,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
ASSERT_IRP_CONTEXT( IrpContext );
|
ASSERT_IRP_CONTEXT( IrpContext );
|
||||||
ASSERT_FCB( Fcb );
|
ASSERT_FCB( Fcb );
|
||||||
|
|
||||||
|
@ -375,17 +394,23 @@ Return Value:
|
||||||
CcUninitializeCacheMap( FileObject, NULL, NULL );
|
CcUninitializeCacheMap( FileObject, NULL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Null the name pointer, since the stream file object never actually
|
||||||
|
// 'owns' the names, we just point it to existing ones.
|
||||||
|
//
|
||||||
|
|
||||||
|
FileObject->FileName.Buffer = NULL;
|
||||||
|
FileObject->FileName.MaximumLength = FileObject->FileName.Length = 0;
|
||||||
|
|
||||||
ObDereferenceObject( FileObject );
|
ObDereferenceObject( FileObject );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCompleteMdl (
|
CdCompleteMdl (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -434,11 +459,13 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPurgeVolume (
|
CdPurgeVolume (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN BOOLEAN DismountUnderway
|
_In_ BOOLEAN DismountUnderway
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -592,7 +619,7 @@ Return Value:
|
||||||
if (Vcb->PathTableFcb != NULL) {
|
if (Vcb->PathTableFcb != NULL) {
|
||||||
|
|
||||||
ThisFcb = Vcb->PathTableFcb;
|
ThisFcb = Vcb->PathTableFcb;
|
||||||
InterlockedIncrement( &Vcb->PathTableFcb->FcbReference );
|
InterlockedIncrement( (LONG*)&Vcb->PathTableFcb->FcbReference );
|
||||||
|
|
||||||
if ((ThisFcb->FcbNonpaged->SegmentObject.DataSectionObject != NULL) &&
|
if ((ThisFcb->FcbNonpaged->SegmentObject.DataSectionObject != NULL) &&
|
||||||
!CcPurgeCacheSection( &ThisFcb->FcbNonpaged->SegmentObject,
|
!CcPurgeCacheSection( &ThisFcb->FcbNonpaged->SegmentObject,
|
||||||
|
@ -606,7 +633,7 @@ Return Value:
|
||||||
|
|
||||||
CdDeleteInternalStream( IrpContext, ThisFcb );
|
CdDeleteInternalStream( IrpContext, ThisFcb );
|
||||||
|
|
||||||
InterlockedDecrement( &ThisFcb->FcbReference );
|
InterlockedDecrement( (LONG*)&ThisFcb->FcbReference );
|
||||||
|
|
||||||
CdTeardownStructures( IrpContext, ThisFcb, &RemovedFcb );
|
CdTeardownStructures( IrpContext, ThisFcb, &RemovedFcb );
|
||||||
}
|
}
|
||||||
|
@ -614,7 +641,7 @@ Return Value:
|
||||||
if (Vcb->VolumeDasdFcb != NULL) {
|
if (Vcb->VolumeDasdFcb != NULL) {
|
||||||
|
|
||||||
ThisFcb = Vcb->VolumeDasdFcb;
|
ThisFcb = Vcb->VolumeDasdFcb;
|
||||||
InterlockedIncrement( &ThisFcb->FcbReference );
|
InterlockedIncrement( (LONG*)&ThisFcb->FcbReference );
|
||||||
|
|
||||||
if ((ThisFcb->FcbNonpaged->SegmentObject.DataSectionObject != NULL) &&
|
if ((ThisFcb->FcbNonpaged->SegmentObject.DataSectionObject != NULL) &&
|
||||||
!CcPurgeCacheSection( &ThisFcb->FcbNonpaged->SegmentObject,
|
!CcPurgeCacheSection( &ThisFcb->FcbNonpaged->SegmentObject,
|
||||||
|
@ -626,7 +653,7 @@ Return Value:
|
||||||
Status = STATUS_UNABLE_TO_DELETE_SECTION;
|
Status = STATUS_UNABLE_TO_DELETE_SECTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
InterlockedDecrement( &ThisFcb->FcbReference );
|
InterlockedDecrement( (LONG*)&ThisFcb->FcbReference );
|
||||||
|
|
||||||
CdTeardownStructures( IrpContext, ThisFcb, &RemovedFcb );
|
CdTeardownStructures( IrpContext, ThisFcb, &RemovedFcb );
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ typedef struct _RAW_JOLIET_VD {
|
||||||
UCHAR Reserved[8]; // reserved 8 = 0
|
UCHAR Reserved[8]; // reserved 8 = 0
|
||||||
ULONG VolSpaceI; // size of the volume in LBN's Intel
|
ULONG VolSpaceI; // size of the volume in LBN's Intel
|
||||||
ULONG VolSpaceM; // size of the volume in LBN's Motorola
|
ULONG VolSpaceM; // size of the volume in LBN's Motorola
|
||||||
UCHAR CharSet[32]; // character set bytes 0 = ASCII, Joliet Seq here
|
UCHAR CharSet[32]; // character set bytes 0 = ASCII, Joliett Seq here
|
||||||
USHORT VolSetSizeI; // volume set size Intel
|
USHORT VolSetSizeI; // volume set size Intel
|
||||||
USHORT VolSetSizeM; // volume set size Motorola
|
USHORT VolSetSizeM; // volume set size Motorola
|
||||||
USHORT VolSeqNumI; // volume set sequence number Intel
|
USHORT VolSeqNumI; // volume set sequence number Intel
|
||||||
|
@ -383,9 +383,9 @@ typedef RAW_DIRENT *PRAW_DIRENT;
|
||||||
//
|
//
|
||||||
// VOID
|
// VOID
|
||||||
// CdConvertCdTimeToNtTime (
|
// CdConvertCdTimeToNtTime (
|
||||||
// IN PIRP_CONTEXT IrpContext,
|
// _In_ PIRP_CONTEXT IrpContext,
|
||||||
// IN PCHAR CdTime,
|
// _In_ PCHAR CdTime,
|
||||||
// OUT PLARGE_INTEGER NtTime
|
// _Out_ PLARGE_INTEGER NtTime
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
#ifdef CD_SANITY
|
#ifdef CD_SANITY
|
||||||
BOOLEAN CdTestTopLevel = TRUE;
|
BOOLEAN CdTestTopLevel = TRUE;
|
||||||
|
@ -178,16 +178,43 @@ LONG CdXAFileHeader[] = {
|
||||||
-44 // <CD-XA Raw Sectors> ADJUST
|
-44 // <CD-XA Raw Sectors> ADJUST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef CDFS_TELEMETRY_DATA
|
||||||
|
|
||||||
|
//
|
||||||
|
// Telemetry Data for reporting
|
||||||
|
//
|
||||||
|
|
||||||
|
CDFS_TELEMETRY_DATA_CONTEXT CdTelemetryData;
|
||||||
|
|
||||||
|
#endif // CDFS_TELEMETRY_DATA
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
#pragma alloc_text(PAGE, CdFastIoCheckIfPossible)
|
#pragma alloc_text(PAGE, CdFastIoCheckIfPossible)
|
||||||
#pragma alloc_text(PAGE, CdSerial32)
|
#pragma alloc_text(PAGE, CdSerial32)
|
||||||
|
#pragma alloc_text(PAGE, CdSetThreadContext)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_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
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
CdFsdDispatch (
|
CdFsdDispatch (
|
||||||
IN PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -214,7 +241,7 @@ Routine Description:
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
VolumeDeviceObject - Supplies the volume device object for this request
|
DeviceObject - Supplies the volume device object for this request
|
||||||
|
|
||||||
Irp - Supplies the Irp being processed
|
Irp - Supplies the Irp being processed
|
||||||
|
|
||||||
|
@ -225,7 +252,7 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
THREAD_CONTEXT ThreadContext;
|
THREAD_CONTEXT ThreadContext = {0};
|
||||||
PIRP_CONTEXT IrpContext = NULL;
|
PIRP_CONTEXT IrpContext = NULL;
|
||||||
BOOLEAN Wait;
|
BOOLEAN Wait;
|
||||||
|
|
||||||
|
@ -243,6 +270,8 @@ Return Value:
|
||||||
|
|
||||||
ASSERT_OPTIONAL_IRP( Irp );
|
ASSERT_OPTIONAL_IRP( Irp );
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
|
|
||||||
#ifdef CD_SANITY
|
#ifdef CD_SANITY
|
||||||
|
@ -259,7 +288,7 @@ Return Value:
|
||||||
// Use a try-except to handle the exception cases.
|
// Use a try-except to handle the exception cases.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the IrpContext is NULL then this is the first pass through
|
// If the IrpContext is NULL then this is the first pass through
|
||||||
|
@ -293,7 +322,7 @@ Return Value:
|
||||||
CdSetThreadContext( IrpContext, &ThreadContext );
|
CdSetThreadContext( IrpContext, &ThreadContext );
|
||||||
|
|
||||||
#ifdef CD_SANITY
|
#ifdef CD_SANITY
|
||||||
ASSERT( !CdTestTopLevel ||
|
NT_ASSERT( !CdTestTopLevel ||
|
||||||
SafeNodeType( IrpContext->TopLevel ) == CDFS_NTC_IRP_CONTEXT );
|
SafeNodeType( IrpContext->TopLevel ) == CDFS_NTC_IRP_CONTEXT );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -347,6 +376,11 @@ Return Value:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IRP_MJ_WRITE :
|
||||||
|
|
||||||
|
Status = CdCommonWrite( IrpContext, Irp );
|
||||||
|
break;
|
||||||
|
|
||||||
case IRP_MJ_QUERY_INFORMATION :
|
case IRP_MJ_QUERY_INFORMATION :
|
||||||
|
|
||||||
Status = CdCommonQueryInfo( IrpContext, Irp );
|
Status = CdCommonQueryInfo( IrpContext, Irp );
|
||||||
|
@ -392,40 +426,46 @@ Return Value:
|
||||||
Status = CdCommonPnp( IrpContext, Irp );
|
Status = CdCommonPnp( IrpContext, Irp );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IRP_MJ_SHUTDOWN :
|
||||||
|
|
||||||
|
Status = CdCommonShutdown( IrpContext, Irp );
|
||||||
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
|
||||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
CdCompleteRequest( IrpContext, Irp, Status );
|
CdCompleteRequest( IrpContext, Irp, Status );
|
||||||
}
|
}
|
||||||
|
|
||||||
} except( CdExceptionFilter( IrpContext, GetExceptionInformation() )) {
|
} _SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
||||||
|
|
||||||
Status = CdProcessException( IrpContext, Irp, GetExceptionCode() );
|
Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
} while (Status == STATUS_CANT_WAIT);
|
} while (Status == STATUS_CANT_WAIT);
|
||||||
|
|
||||||
#ifdef CD_SANITY
|
#ifdef CD_SANITY
|
||||||
ASSERT( !CdTestTopLevel ||
|
NT_ASSERT( !CdTestTopLevel ||
|
||||||
(PreviousTopLevel == IoGetTopLevelIrp()) );
|
(PreviousTopLevel == IoGetTopLevelIrp()) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
|
|
||||||
ASSERT( SaveIrql == KeGetCurrentIrql( ));
|
NT_ASSERT( SaveIrql == KeGetCurrentIrql( ));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef CD_SANITY
|
#ifdef CD_SANITY
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdRaiseStatusEx(
|
CdRaiseStatusEx (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN NTSTATUS Status,
|
_In_ NTSTATUS Status,
|
||||||
IN BOOLEAN NormalizeStatus,
|
_In_ BOOLEAN NormalizeStatus,
|
||||||
IN OPTIONAL ULONG FileId,
|
_In_opt_ ULONG FileId,
|
||||||
IN OPTIONAL ULONG Line
|
_In_opt_ ULONG Line
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
BOOLEAN BreakIn = FALSE;
|
BOOLEAN BreakIn = FALSE;
|
||||||
|
@ -461,7 +501,7 @@ CdRaiseStatusEx(
|
||||||
DbgPrint( "CDFS: Contact CDFS.SYS component owner for triage.\n");
|
DbgPrint( "CDFS: Contact CDFS.SYS component owner for triage.\n");
|
||||||
DbgPrint( "CDFS: 'eb %p 0;eb %p 0' to disable this alert.\n", &CdTestRaisedStatus, &CdBreakOnAnyRaise);
|
DbgPrint( "CDFS: 'eb %p 0;eb %p 0' to disable this alert.\n", &CdTestRaisedStatus, &CdBreakOnAnyRaise);
|
||||||
|
|
||||||
DbgBreakPoint();
|
NT_ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NormalizeStatus) {
|
if (NormalizeStatus) {
|
||||||
|
@ -480,10 +520,11 @@ CdRaiseStatusEx(
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
LONG
|
LONG
|
||||||
CdExceptionFilter (
|
CdExceptionFilter (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PEXCEPTION_POINTERS ExceptionPointer
|
_In_ PEXCEPTION_POINTERS ExceptionPointer
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -557,6 +598,9 @@ Return Value:
|
||||||
|
|
||||||
if (TestStatus && !FsRtlIsNtstatusExpected( ExceptionCode )) {
|
if (TestStatus && !FsRtlIsNtstatusExpected( ExceptionCode )) {
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast( suppress: __WARNING_USE_OTHER_FUNCTION, "We're corrupted." )
|
||||||
|
#endif
|
||||||
CdBugCheck( (ULONG_PTR) ExceptionPointer->ExceptionRecord,
|
CdBugCheck( (ULONG_PTR) ExceptionPointer->ExceptionRecord,
|
||||||
(ULONG_PTR) ExceptionPointer->ContextRecord,
|
(ULONG_PTR) ExceptionPointer->ContextRecord,
|
||||||
(ULONG_PTR) ExceptionPointer->ExceptionRecord->ExceptionAddress );
|
(ULONG_PTR) ExceptionPointer->ExceptionRecord->ExceptionAddress );
|
||||||
|
@ -567,11 +611,13 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdProcessException (
|
CdProcessException (
|
||||||
IN PIRP_CONTEXT IrpContext OPTIONAL,
|
_In_opt_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
IN NTSTATUS ExceptionCode
|
_In_ NTSTATUS ExceptionCode
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -601,7 +647,7 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT Device;
|
PDEVICE_OBJECT Device = NULL;
|
||||||
PVPB Vpb;
|
PVPB Vpb;
|
||||||
PETHREAD Thread;
|
PETHREAD Thread;
|
||||||
|
|
||||||
|
@ -625,17 +671,6 @@ Return Value:
|
||||||
|
|
||||||
ExceptionCode = IrpContext->ExceptionStatus;
|
ExceptionCode = IrpContext->ExceptionStatus;
|
||||||
|
|
||||||
//
|
|
||||||
// If we are not a top level request then we just complete the request
|
|
||||||
// with the current status code.
|
|
||||||
//
|
|
||||||
|
|
||||||
if (!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL )) {
|
|
||||||
|
|
||||||
CdCompleteRequest( IrpContext, Irp, ExceptionCode );
|
|
||||||
return ExceptionCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if we are posting this request. One of the following must be true
|
// Check if we are posting this request. One of the following must be true
|
||||||
// if we are to post a request.
|
// if we are to post a request.
|
||||||
|
@ -644,7 +679,8 @@ Return Value:
|
||||||
// or we are forcing this to be posted.
|
// or we are forcing this to be posted.
|
||||||
//
|
//
|
||||||
// - Status code is STATUS_VERIFY_REQUIRED and we are at APC level
|
// - Status code is STATUS_VERIFY_REQUIRED and we are at APC level
|
||||||
// or higher. Can't wait for IO in the verify path in this case.
|
// or higher, or within a guarded region. Can't wait for IO in
|
||||||
|
// the verify path in this case.
|
||||||
//
|
//
|
||||||
// Set the MORE_PROCESSING flag in the IrpContext to keep if from being
|
// Set the MORE_PROCESSING flag in the IrpContext to keep if from being
|
||||||
// deleted if this is a retryable condition.
|
// deleted if this is a retryable condition.
|
||||||
|
@ -653,7 +689,7 @@ Return Value:
|
||||||
// Note that (children of) CdFsdPostRequest can raise (Mdl allocation).
|
// Note that (children of) CdFsdPostRequest can raise (Mdl allocation).
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
if (ExceptionCode == STATUS_CANT_WAIT) {
|
if (ExceptionCode == STATUS_CANT_WAIT) {
|
||||||
|
|
||||||
|
@ -661,20 +697,18 @@ Return Value:
|
||||||
|
|
||||||
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (ExceptionCode == STATUS_VERIFY_REQUIRED) {
|
else if ((ExceptionCode == STATUS_VERIFY_REQUIRED) &&
|
||||||
|
FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL ) &&
|
||||||
if (KeGetCurrentIrql() >= APC_LEVEL) {
|
KeAreAllApcsDisabled()) {
|
||||||
|
|
||||||
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
ExceptionCode = CdFsdPostRequest( IrpContext, Irp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
_SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
||||||
except( CdExceptionFilter( IrpContext, GetExceptionInformation() )) {
|
|
||||||
|
|
||||||
ExceptionCode = GetExceptionCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ExceptionCode = _SEH2_GetExceptionCode();
|
||||||
|
} _SEH2_END;
|
||||||
//
|
//
|
||||||
// If we posted the request or our caller will retry then just return here.
|
// If we posted the request or our caller will retry then just return here.
|
||||||
//
|
//
|
||||||
|
@ -687,6 +721,17 @@ Return Value:
|
||||||
|
|
||||||
ClearFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_MORE_PROCESSING );
|
ClearFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_MORE_PROCESSING );
|
||||||
|
|
||||||
|
//
|
||||||
|
// If we are not a top level request then we just complete the request
|
||||||
|
// with the current status code.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL )) {
|
||||||
|
|
||||||
|
CdCompleteRequest( IrpContext, Irp, ExceptionCode );
|
||||||
|
return ExceptionCode;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Store this error into the Irp for posting back to the Io system.
|
// Store this error into the Irp for posting back to the Io system.
|
||||||
//
|
//
|
||||||
|
@ -722,10 +767,25 @@ Return Value:
|
||||||
Device = IoGetDeviceToVerify( PsGetCurrentThread() );
|
Device = IoGetDeviceToVerify( PsGetCurrentThread() );
|
||||||
IoSetDeviceToVerify( PsGetCurrentThread(), NULL );
|
IoSetDeviceToVerify( PsGetCurrentThread(), NULL );
|
||||||
|
|
||||||
ASSERT( Device != NULL );
|
NT_ASSERT( Device != NULL );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Let's not BugCheck just because the driver messes up.
|
// It turns out some storage drivers really do set invalid non-NULL device
|
||||||
|
// objects to verify.
|
||||||
|
//
|
||||||
|
// To work around this, completely ignore the device to verify in the thread,
|
||||||
|
// and just use our real device object instead.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (IrpContext->Vcb) {
|
||||||
|
|
||||||
|
Device = IrpContext->Vcb->Vpb->RealDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Let's not BugCheck just because the device to verify is somehow still NULL.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Device == NULL) {
|
if (Device == NULL) {
|
||||||
|
@ -736,7 +796,6 @@ Return Value:
|
||||||
|
|
||||||
return ExceptionCode;
|
return ExceptionCode;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// CdPerformVerify() will do the right thing with the Irp.
|
// CdPerformVerify() will do the right thing with the Irp.
|
||||||
|
@ -773,6 +832,7 @@ Return Value:
|
||||||
Vpb = NULL;
|
Vpb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The device to verify is either in my thread local storage
|
// The device to verify is either in my thread local storage
|
||||||
// or that of the thread that owns the Irp.
|
// or that of the thread that owns the Irp.
|
||||||
|
@ -786,10 +846,24 @@ Return Value:
|
||||||
Thread = PsGetCurrentThread();
|
Thread = PsGetCurrentThread();
|
||||||
Device = IoGetDeviceToVerify( Thread );
|
Device = IoGetDeviceToVerify( Thread );
|
||||||
|
|
||||||
ASSERT( Device != NULL );
|
NT_ASSERT( Device != NULL );
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Let's not BugCheck just because the driver messes up.
|
// It turns out some storage drivers really do set invalid non-NULL device
|
||||||
|
// objects to verify.
|
||||||
|
//
|
||||||
|
// To work around this, completely ignore the device to verify in the thread,
|
||||||
|
// and just use our real device object instead.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (IrpContext->Vcb) {
|
||||||
|
|
||||||
|
Device = IrpContext->Vcb->Vpb->RealDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Let's not BugCheck just because the device to verify is somehow still NULL.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Device == NULL) {
|
if (Device == NULL) {
|
||||||
|
@ -798,7 +872,6 @@ Return Value:
|
||||||
|
|
||||||
return ExceptionCode;
|
return ExceptionCode;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// This routine actually causes the pop-up. It usually
|
// This routine actually causes the pop-up. It usually
|
||||||
|
@ -839,9 +912,9 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdCompleteRequest (
|
CdCompleteRequest (
|
||||||
IN PIRP_CONTEXT IrpContext OPTIONAL,
|
_Inout_opt_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp OPTIONAL,
|
_Inout_opt_ PIRP Irp,
|
||||||
IN NTSTATUS Status
|
_In_ NTSTATUS Status
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -906,8 +979,8 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdSetThreadContext (
|
CdSetThreadContext (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PTHREAD_CONTEXT ThreadContext
|
_In_ PTHREAD_CONTEXT ThreadContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -938,8 +1011,10 @@ Return Value:
|
||||||
|
|
||||||
{
|
{
|
||||||
PTHREAD_CONTEXT CurrentThreadContext;
|
PTHREAD_CONTEXT CurrentThreadContext;
|
||||||
|
#ifdef __REACTOS__
|
||||||
ULONG_PTR StackTop;
|
ULONG_PTR StackTop;
|
||||||
ULONG_PTR StackBottom;
|
ULONG_PTR StackBottom;
|
||||||
|
#endif
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -972,11 +1047,20 @@ Return Value:
|
||||||
// context and store it in the top level context.
|
// context and store it in the top level context.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
IoGetStackLimits( &StackTop, &StackBottom);
|
IoGetStackLimits( &StackTop, &StackBottom);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(suppress: 6011) // Bug in PREFast around bitflag operations
|
||||||
|
#endif
|
||||||
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL ) ||
|
if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL ) ||
|
||||||
|
#ifndef __REACTOS__
|
||||||
|
(!IoWithinStackLimits( (ULONG_PTR)CurrentThreadContext, sizeof( THREAD_CONTEXT ) ) ||
|
||||||
|
#else
|
||||||
(((ULONG_PTR) CurrentThreadContext > StackBottom - sizeof( THREAD_CONTEXT )) ||
|
(((ULONG_PTR) CurrentThreadContext > StackBottom - sizeof( THREAD_CONTEXT )) ||
|
||||||
((ULONG_PTR) CurrentThreadContext <= StackTop) ||
|
((ULONG_PTR) CurrentThreadContext <= StackTop) ||
|
||||||
|
#endif
|
||||||
FlagOn( (ULONG_PTR) CurrentThreadContext, 0x3 ) ||
|
FlagOn( (ULONG_PTR) CurrentThreadContext, 0x3 ) ||
|
||||||
(CurrentThreadContext->Cdfs != 0x53464443))) {
|
(CurrentThreadContext->Cdfs != 0x53464443))) {
|
||||||
|
|
||||||
|
@ -1002,18 +1086,24 @@ Return Value:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_Function_class_(FAST_IO_CHECK_IF_POSSIBLE)
|
||||||
|
_IRQL_requires_same_
|
||||||
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastIoCheckIfPossible (
|
CdFastIoCheckIfPossible (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN PLARGE_INTEGER FileOffset,
|
_In_ PLARGE_INTEGER FileOffset,
|
||||||
IN ULONG Length,
|
_In_ ULONG Length,
|
||||||
IN BOOLEAN Wait,
|
_In_ BOOLEAN Wait,
|
||||||
IN ULONG LockKey,
|
_In_ ULONG LockKey,
|
||||||
IN BOOLEAN CheckForReadOperation,
|
_In_ BOOLEAN CheckForReadOperation,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus,
|
_Pre_notnull_
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
_When_(return != FALSE, _Post_equal_to_(_Old_(IoStatus)))
|
||||||
|
_When_(return == FALSE, _Post_valid_)
|
||||||
|
PIO_STATUS_BLOCK IoStatus,
|
||||||
|
_In_ PDEVICE_OBJECT DeviceObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1054,6 +1144,9 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( Wait );
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Decode the type of file object we're being asked to process and
|
// Decode the type of file object we're being asked to process and
|
||||||
// make sure that is is only a user file open.
|
// make sure that is is only a user file open.
|
||||||
|
@ -1090,8 +1183,8 @@ Return Value:
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
CdSerial32 (
|
CdSerial32 (
|
||||||
IN PCHAR Buffer,
|
_In_reads_bytes_(ByteCount) PCHAR Buffer,
|
||||||
IN ULONG ByteCount
|
_In_ ULONG ByteCount
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
|
|
|
@ -94,82 +94,77 @@ extern LONG CdXAFileHeader[];
|
||||||
extern LONG CdAudioPlayHeader[];
|
extern LONG CdAudioPlayHeader[];
|
||||||
extern LONG CdXAAudioPhileHeader[];
|
extern LONG CdXAAudioPhileHeader[];
|
||||||
|
|
||||||
|
#ifdef CDFS_TELEMETRY_DATA
|
||||||
|
|
||||||
//
|
//
|
||||||
// Turn on pseudo-asserts if CD_FREE_ASSERTS is defined.
|
// Globals for Telemetry data.
|
||||||
//
|
//
|
||||||
|
|
||||||
#if !DBG
|
extern CDFS_TELEMETRY_DATA_CONTEXT CdTelemetryData;
|
||||||
#ifdef CD_FREE_ASSERTS
|
|
||||||
#undef ASSERT
|
#endif // CDFS_TELEMETRY_DATA
|
||||||
#undef ASSERTMSG
|
|
||||||
#define ASSERT(exp) if (!(exp)) { extern BOOLEAN KdDebuggerEnabled; DbgPrint("%s:%d %s\n",__FILE__,__LINE__,#exp); if (KdDebuggerEnabled) { DbgBreakPoint(); } }
|
|
||||||
#define ASSERTMSG(msg,exp) if (!(exp)) { extern BOOLEAN KdDebuggerEnabled; DbgPrint("%s:%d %s %s\n",__FILE__,__LINE__,msg,#exp); if (KdDebuggerEnabled) { DbgBreakPoint(); } }
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following assertion macros ensure that the indicated structure
|
// The following assertion macros ensure that the indicated structure
|
||||||
// is valid
|
// is valid
|
||||||
//
|
//
|
||||||
// ASSERT_STRUCT( IN PVOID Struct, IN CSHORT NodeType );
|
// ASSERT_STRUCT( _In_ PVOID Struct, _In_ CSHORT NodeType );
|
||||||
// ASSERT_OPTIONAL_STRUCT( IN PVOID Struct OPTIONAL, IN CSHORT NodeType );
|
// ASSERT_OPTIONAL_STRUCT( _In_opt_ PVOID Struct, _In_ CSHORT NodeType );
|
||||||
//
|
//
|
||||||
// ASSERT_VCB( IN PVCB Vcb );
|
// ASSERT_VCB( _In_ PVCB Vcb );
|
||||||
// ASSERT_OPTIONAL_VCB( IN PVCB Vcb OPTIONAL );
|
// ASSERT_OPTIONAL_VCB( _In_opt_ PVCB Vcb );
|
||||||
//
|
//
|
||||||
// ASSERT_FCB( IN PFCB Fcb );
|
// ASSERT_FCB( _In_ PFCB Fcb );
|
||||||
// ASSERT_OPTIONAL_FCB( IN PFCB Fcb OPTIONAL );
|
// ASSERT_OPTIONAL_FCB( _In_opt_ PFCB Fcb );
|
||||||
//
|
//
|
||||||
// ASSERT_FCB_NONPAGED( IN PFCB_NONPAGED FcbNonpaged );
|
// ASSERT_FCB_NONPAGED( _In_ PFCB_NONPAGED FcbNonpaged );
|
||||||
// ASSERT_OPTIONAL_FCB( IN PFCB_NONPAGED FcbNonpaged OPTIONAL );
|
// ASSERT_OPTIONAL_FCB( _In_opt_ PFCB_NONPAGED FcbNonpaged );
|
||||||
//
|
//
|
||||||
// ASSERT_CCB( IN PSCB Ccb );
|
// ASSERT_CCB( _In_ PSCB Ccb );
|
||||||
// ASSERT_OPTIONAL_CCB( IN PSCB Ccb OPTIONAL );
|
// ASSERT_OPTIONAL_CCB( _In_opt_ PSCB Ccb );
|
||||||
//
|
//
|
||||||
// ASSERT_IRP_CONTEXT( IN PIRP_CONTEXT IrpContext );
|
// ASSERT_IRP_CONTEXT( _In_ PIRP_CONTEXT IrpContext );
|
||||||
// ASSERT_OPTIONAL_IRP_CONTEXT( IN PIRP_CONTEXT IrpContext OPTIONAL );
|
// ASSERT_OPTIONAL_IRP_CONTEXT( _In_opt_ PIRP_CONTEXT IrpContext );
|
||||||
//
|
//
|
||||||
// ASSERT_IRP( IN PIRP Irp );
|
// ASSERT_IRP( _In_ PIRP Irp );
|
||||||
// ASSERT_OPTIONAL_IRP( IN PIRP Irp OPTIONAL );
|
// ASSERT_OPTIONAL_IRP( _In_opt_ PIRP Irp );
|
||||||
//
|
//
|
||||||
// ASSERT_FILE_OBJECT( IN PFILE_OBJECT FileObject );
|
// ASSERT_FILE_OBJECT( _In_ PFILE_OBJECT FileObject );
|
||||||
// ASSERT_OPTIONAL_FILE_OBJECT( IN PFILE_OBJECT FileObject OPTIONAL );
|
// ASSERT_OPTIONAL_FILE_OBJECT( _In_opt_ PFILE_OBJECT FileObject );
|
||||||
//
|
//
|
||||||
// The following macros are used to check the current thread owns
|
// The following macros are used to check the current thread owns
|
||||||
// the indicated resource
|
// the indicated resource
|
||||||
//
|
//
|
||||||
// ASSERT_EXCLUSIVE_RESOURCE( IN PERESOURCE Resource );
|
// ASSERT_EXCLUSIVE_RESOURCE( _In_ PERESOURCE Resource );
|
||||||
//
|
//
|
||||||
// ASSERT_SHARED_RESOURCE( IN PERESOURCE Resource );
|
// ASSERT_SHARED_RESOURCE( _In_ PERESOURCE Resource );
|
||||||
//
|
//
|
||||||
// ASSERT_RESOURCE_NOT_MINE( IN PERESOURCE Resource );
|
// ASSERT_RESOURCE_NOT_MINE( _In_ PERESOURCE Resource );
|
||||||
//
|
//
|
||||||
// The following macros are used to check whether the current thread
|
// The following macros are used to check whether the current thread
|
||||||
// owns the resource in the given structures.
|
// owns the resoures in the given structures.
|
||||||
//
|
//
|
||||||
// ASSERT_EXCLUSIVE_CDDATA
|
// ASSERT_EXCLUSIVE_CDDATA
|
||||||
//
|
//
|
||||||
// ASSERT_EXCLUSIVE_VCB( IN PVCB Vcb );
|
// ASSERT_EXCLUSIVE_VCB( _In_ PVCB Vcb );
|
||||||
//
|
//
|
||||||
// ASSERT_SHARED_VCB( IN PVCB Vcb );
|
// ASSERT_SHARED_VCB( _In_ PVCB Vcb );
|
||||||
//
|
//
|
||||||
// ASSERT_EXCLUSIVE_FCB( IN PFCB Fcb );
|
// ASSERT_EXCLUSIVE_FCB( _In_ PFCB Fcb );
|
||||||
//
|
//
|
||||||
// ASSERT_SHARED_FCB( IN PFCB Fcb );
|
// ASSERT_SHARED_FCB( _In_ PFCB Fcb );
|
||||||
//
|
//
|
||||||
// ASSERT_EXCLUSIVE_FILE( IN PFCB Fcb );
|
// ASSERT_EXCLUSIVE_FILE( _In_ PFCB Fcb );
|
||||||
//
|
//
|
||||||
// ASSERT_SHARED_FILE( IN PFCB Fcb );
|
// ASSERT_SHARED_FILE( _In_ PFCB Fcb );
|
||||||
//
|
//
|
||||||
// ASSERT_LOCKED_VCB( IN PVCB Vcb );
|
// ASSERT_LOCKED_VCB( _In_ PVCB Vcb );
|
||||||
//
|
//
|
||||||
// ASSERT_NOT_LOCKED_VCB( IN PVCB Vcb );
|
// ASSERT_NOT_LOCKED_VCB( _In_ PVCB Vcb );
|
||||||
//
|
//
|
||||||
// ASSERT_LOCKED_FCB( IN PFCB Fcb );
|
// ASSERT_LOCKED_FCB( _In_ PFCB Fcb );
|
||||||
//
|
//
|
||||||
// ASSERT_NOT_LOCKED_FCB( IN PFCB Fcb );
|
// ASSERT_NOT_LOCKED_FCB( _In_ PFCB Fcb );
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -178,24 +173,24 @@ extern LONG CdXAAudioPhileHeader[];
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
#undef CD_SANITY
|
#undef CD_SANITY
|
||||||
#define CD_SANITY
|
//#define CD_SANITY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CD_SANITY
|
#ifdef CD_SANITY
|
||||||
|
|
||||||
#define ASSERT_STRUCT(S,T) ASSERT( SafeNodeType( S ) == (T) )
|
#define ASSERT_STRUCT(S,T) NT_ASSERT( SafeNodeType( S ) == (T) )
|
||||||
#define ASSERT_OPTIONAL_STRUCT(S,T) ASSERT( ((S) == NULL) || (SafeNodeType( S ) == (T)) )
|
#define ASSERT_OPTIONAL_STRUCT(S,T) NT_ASSERT( ((S) == NULL) || (SafeNodeType( S ) == (T)) )
|
||||||
|
|
||||||
#define ASSERT_VCB(V) ASSERT_STRUCT( (V), CDFS_NTC_VCB )
|
#define ASSERT_VCB(V) ASSERT_STRUCT( (V), CDFS_NTC_VCB )
|
||||||
#define ASSERT_OPTIONAL_VCB(V) ASSERT_OPTIONAL_STRUCT( (V), CDFS_NTC_VCB )
|
#define ASSERT_OPTIONAL_VCB(V) ASSERT_OPTIONAL_STRUCT( (V), CDFS_NTC_VCB )
|
||||||
|
|
||||||
#define ASSERT_FCB(F) \
|
#define ASSERT_FCB(F) \
|
||||||
ASSERT( (SafeNodeType( F ) == CDFS_NTC_FCB_DATA ) || \
|
NT_ASSERT( (SafeNodeType( F ) == CDFS_NTC_FCB_DATA ) || \
|
||||||
(SafeNodeType( F ) == CDFS_NTC_FCB_INDEX ) || \
|
(SafeNodeType( F ) == CDFS_NTC_FCB_INDEX ) || \
|
||||||
(SafeNodeType( F ) == CDFS_NTC_FCB_PATH_TABLE ) )
|
(SafeNodeType( F ) == CDFS_NTC_FCB_PATH_TABLE ) )
|
||||||
|
|
||||||
#define ASSERT_OPTIONAL_FCB(F) \
|
#define ASSERT_OPTIONAL_FCB(F) \
|
||||||
ASSERT( ((F) == NULL) || \
|
NT_ASSERT( ((F) == NULL) || \
|
||||||
(SafeNodeType( F ) == CDFS_NTC_FCB_DATA ) || \
|
(SafeNodeType( F ) == CDFS_NTC_FCB_DATA ) || \
|
||||||
(SafeNodeType( F ) == CDFS_NTC_FCB_INDEX ) || \
|
(SafeNodeType( F ) == CDFS_NTC_FCB_INDEX ) || \
|
||||||
(SafeNodeType( F ) == CDFS_NTC_FCB_PATH_TABLE ) )
|
(SafeNodeType( F ) == CDFS_NTC_FCB_PATH_TABLE ) )
|
||||||
|
@ -215,27 +210,27 @@ extern LONG CdXAAudioPhileHeader[];
|
||||||
#define ASSERT_FILE_OBJECT(FO) ASSERT_STRUCT( (FO), IO_TYPE_FILE )
|
#define ASSERT_FILE_OBJECT(FO) ASSERT_STRUCT( (FO), IO_TYPE_FILE )
|
||||||
#define ASSERT_OPTIONAL_FILE_OBJECT(FO) ASSERT_OPTIONAL_STRUCT( (FO), IO_TYPE_FILE )
|
#define ASSERT_OPTIONAL_FILE_OBJECT(FO) ASSERT_OPTIONAL_STRUCT( (FO), IO_TYPE_FILE )
|
||||||
|
|
||||||
#define ASSERT_EXCLUSIVE_RESOURCE(R) ASSERT( ExIsResourceAcquiredExclusiveLite( R ))
|
#define ASSERT_EXCLUSIVE_RESOURCE(R) NT_ASSERT( ExIsResourceAcquiredExclusiveLite( R ))
|
||||||
|
|
||||||
#define ASSERT_SHARED_RESOURCE(R) ASSERT( ExIsResourceAcquiredSharedLite( R ))
|
#define ASSERT_SHARED_RESOURCE(R) NT_ASSERT( ExIsResourceAcquiredSharedLite( R ))
|
||||||
|
|
||||||
#define ASSERT_RESOURCE_NOT_MINE(R) ASSERT( !ExIsResourceAcquiredSharedLite( R ))
|
#define ASSERT_RESOURCE_NOT_MINE(R) NT_ASSERT( !ExIsResourceAcquiredSharedLite( R ))
|
||||||
|
|
||||||
#define ASSERT_EXCLUSIVE_CDDATA ASSERT( ExIsResourceAcquiredExclusiveLite( &CdData.DataResource ))
|
#define ASSERT_EXCLUSIVE_CDDATA NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &CdData.DataResource ))
|
||||||
#define ASSERT_EXCLUSIVE_VCB(V) ASSERT( ExIsResourceAcquiredExclusiveLite( &(V)->VcbResource ))
|
#define ASSERT_EXCLUSIVE_VCB(V) NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &(V)->VcbResource ))
|
||||||
#define ASSERT_SHARED_VCB(V) ASSERT( ExIsResourceAcquiredSharedLite( &(V)->VcbResource ))
|
#define ASSERT_SHARED_VCB(V) NT_ASSERT( ExIsResourceAcquiredSharedLite( &(V)->VcbResource ))
|
||||||
|
|
||||||
#define ASSERT_EXCLUSIVE_FCB(F) ASSERT( ExIsResourceAcquiredExclusiveLite( &(F)->FcbNonpaged->FcbResource ))
|
#define ASSERT_EXCLUSIVE_FCB(F) NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &(F)->FcbNonpaged->FcbResource ))
|
||||||
#define ASSERT_SHARED_FCB(F) ASSERT( ExIsResourceAcquiredSharedLite( &(F)->FcbNonpaged->FcbResource ))
|
#define ASSERT_SHARED_FCB(F) NT_ASSERT( ExIsResourceAcquiredSharedLite( &(F)->FcbNonpaged->FcbResource ))
|
||||||
|
|
||||||
#define ASSERT_EXCLUSIVE_FILE(F) ASSERT( ExIsResourceAcquiredExclusiveLite( (F)->Resource ))
|
#define ASSERT_EXCLUSIVE_FILE(F) NT_ASSERT( ExIsResourceAcquiredExclusiveLite( (F)->Resource ))
|
||||||
#define ASSERT_SHARED_FILE(F) ASSERT( ExIsResourceAcquiredSharedLite( (F)->Resource ))
|
#define ASSERT_SHARED_FILE(F) NT_ASSERT( ExIsResourceAcquiredSharedLite( (F)->Resource ))
|
||||||
|
|
||||||
#define ASSERT_LOCKED_VCB(V) ASSERT( (V)->VcbLockThread == PsGetCurrentThread() )
|
#define ASSERT_LOCKED_VCB(V) NT_ASSERT( (V)->VcbLockThread == PsGetCurrentThread() )
|
||||||
#define ASSERT_NOT_LOCKED_VCB(V) ASSERT( (V)->VcbLockThread != PsGetCurrentThread() )
|
#define ASSERT_NOT_LOCKED_VCB(V) NT_ASSERT( (V)->VcbLockThread != PsGetCurrentThread() )
|
||||||
|
|
||||||
#define ASSERT_LOCKED_FCB(F) ASSERT( !FlagOn( (F)->FcbState, FCB_STATE_IN_FCB_TABLE) || ((F)->FcbLockThread == PsGetCurrentThread()))
|
#define ASSERT_LOCKED_FCB(F) NT_ASSERT( !FlagOn( (F)->FcbState, FCB_STATE_IN_FCB_TABLE) || ((F)->FcbLockThread == PsGetCurrentThread()))
|
||||||
#define ASSERT_NOT_LOCKED_FCB(F) ASSERT( (F)->FcbLockThread != PsGetCurrentThread() )
|
#define ASSERT_NOT_LOCKED_FCB(F) NT_ASSERT( (F)->FcbLockThread != PsGetCurrentThread() )
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -246,7 +241,6 @@ extern LONG CdXAAudioPhileHeader[];
|
||||||
#define ASSERT_VCB(V) { NOTHING; }
|
#define ASSERT_VCB(V) { NOTHING; }
|
||||||
#define ASSERT_OPTIONAL_VCB(V) { NOTHING; }
|
#define ASSERT_OPTIONAL_VCB(V) { NOTHING; }
|
||||||
#define ASSERT_FCB(F) { NOTHING; }
|
#define ASSERT_FCB(F) { NOTHING; }
|
||||||
#define ASSERT_OPTIONAL_FCB(F) { NOTHING; }
|
|
||||||
#define ASSERT_FCB_NONPAGED(FN) { NOTHING; }
|
#define ASSERT_FCB_NONPAGED(FN) { NOTHING; }
|
||||||
#define ASSERT_OPTIONAL_FCB(FN) { NOTHING; }
|
#define ASSERT_OPTIONAL_FCB(FN) { NOTHING; }
|
||||||
#define ASSERT_CCB(C) { NOTHING; }
|
#define ASSERT_CCB(C) { NOTHING; }
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
/* $Id: cdfs.rc 21710 2006-04-22 16:36:21Z tretiakov $ */
|
//
|
||||||
|
// Copyright (C) Microsoft. All rights reserved.
|
||||||
|
//
|
||||||
|
#include <verrsrc.h>
|
||||||
|
|
||||||
|
#include <ntverp.h>
|
||||||
|
|
||||||
|
#define VER_FILETYPE VFT_DRV
|
||||||
|
#define VER_FILESUBTYPE VFT2_DRV_SYSTEM
|
||||||
|
#define VER_FILEDESCRIPTION_STR "CD-ROM File System Driver"
|
||||||
|
#define VER_INTERNALNAME_STR "cdfs.sys"
|
||||||
|
|
||||||
|
#include "common.ver"
|
||||||
|
|
||||||
#define REACTOS_VERSION_DLL
|
|
||||||
#define REACTOS_STR_FILE_DESCRIPTION "ISO9660 Driver\0"
|
|
||||||
#define REACTOS_STR_INTERNAL_NAME "cdfs\0"
|
|
||||||
#define REACTOS_STR_ORIGINAL_FILENAME "cdfs.sys\0"
|
|
||||||
#include <reactos/version.rc>
|
|
||||||
|
|
7
drivers/filesystems/cdfs_new/cdfs_reg.inf
Normal file
7
drivers/filesystems/cdfs_new/cdfs_reg.inf
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
; Cdfs (ISO96660) filesystem driver
|
||||||
|
[AddReg]
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","ErrorControl",0x00010001,0x00000000
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","Group",0x00000000,"File System"
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","ImagePath",0x00020000,"system32\drivers\cdfs.sys"
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","Start",0x00010001,0x00000003
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Services\Cdfs","Type",0x00010001,0x00000002
|
|
@ -13,7 +13,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -21,36 +21,39 @@ Abstract:
|
||||||
|
|
||||||
#define BugCheckFileId (CDFS_BUG_CHECK_CDINIT)
|
#define BugCheckFileId (CDFS_BUG_CHECK_CDINIT)
|
||||||
|
|
||||||
|
// Tell prefast the function type.
|
||||||
|
DRIVER_INITIALIZE DriverEntry;
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
DriverEntry(
|
DriverEntry(
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
_In_ PDRIVER_OBJECT DriverObject,
|
||||||
IN PUNICODE_STRING RegistryPath
|
_In_ PUNICODE_STRING RegistryPath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// tell prefast this is a driver unload function
|
||||||
|
DRIVER_UNLOAD CdUnload;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdUnload(
|
CdUnload(
|
||||||
IN PDRIVER_OBJECT DriverObject
|
_In_ PDRIVER_OBJECT DriverObject
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdInitializeGlobalData (
|
CdInitializeGlobalData (
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
_In_ PDRIVER_OBJECT DriverObject,
|
||||||
IN PDEVICE_OBJECT FileSystemDeviceObject
|
_In_ PDEVICE_OBJECT FileSystemDeviceObject
|
||||||
);
|
#ifdef __REACTOS__
|
||||||
|
,
|
||||||
NTSTATUS
|
IN PDEVICE_OBJECT HddFileSystemDeviceObject
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
#endif
|
||||||
CdShutdown (
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PIRP Irp
|
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
#pragma alloc_text(INIT, DriverEntry)
|
#pragma alloc_text(INIT, DriverEntry)
|
||||||
#pragma alloc_text(PAGE, CdUnload)
|
#pragma alloc_text(PAGE, CdUnload)
|
||||||
#pragma alloc_text(PAGE, CdShutdown)
|
|
||||||
#pragma alloc_text(INIT, CdInitializeGlobalData)
|
#pragma alloc_text(INIT, CdInitializeGlobalData)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -62,8 +65,8 @@ CdShutdown (
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
DriverEntry(
|
DriverEntry(
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
_In_ PDRIVER_OBJECT DriverObject,
|
||||||
IN PUNICODE_STRING RegistryPath
|
_In_ PUNICODE_STRING RegistryPath
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -89,6 +92,12 @@ Return Value:
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING UnicodeString;
|
UNICODE_STRING UnicodeString;
|
||||||
PDEVICE_OBJECT CdfsFileSystemDeviceObject;
|
PDEVICE_OBJECT CdfsFileSystemDeviceObject;
|
||||||
|
FS_FILTER_CALLBACKS FilterCallbacks;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
PDEVICE_OBJECT HddFileSystemDeviceObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( RegistryPath );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create the device object.
|
// Create the device object.
|
||||||
|
@ -107,7 +116,38 @@ Return Value:
|
||||||
if (!NT_SUCCESS( Status )) {
|
if (!NT_SUCCESS( Status )) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
//
|
||||||
|
// Create the HDD device object.
|
||||||
|
//
|
||||||
|
|
||||||
|
RtlInitUnicodeString( &UnicodeString, L"\\CdfsHdd" );
|
||||||
|
|
||||||
|
Status = IoCreateDevice( DriverObject,
|
||||||
|
0,
|
||||||
|
&UnicodeString,
|
||||||
|
FILE_DEVICE_DISK_FILE_SYSTEM,
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
|
&HddFileSystemDeviceObject );
|
||||||
|
|
||||||
|
if (!NT_SUCCESS( Status )) {
|
||||||
|
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(push)
|
||||||
|
#pragma prefast(disable: 28155, "the dispatch routine has the correct type, prefast is just being paranoid.")
|
||||||
|
#pragma prefast(disable: 28168, "the dispatch routine has the correct type, prefast is just being paranoid.")
|
||||||
|
#pragma prefast(disable: 28169, "the dispatch routine has the correct type, prefast is just being paranoid.")
|
||||||
|
#pragma prefast(disable: 28175, "we're allowed to change these.")
|
||||||
|
#endif
|
||||||
|
|
||||||
DriverObject->DriverUnload = CdUnload;
|
DriverObject->DriverUnload = CdUnload;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Note that because of the way data caching is done, we set neither
|
// Note that because of the way data caching is done, we set neither
|
||||||
// the Direct I/O or Buffered I/O bit in DeviceObject->Flags. If
|
// the Direct I/O or Buffered I/O bit in DeviceObject->Flags. If
|
||||||
|
@ -125,6 +165,7 @@ Return Value:
|
||||||
DriverObject->MajorFunction[IRP_MJ_CREATE] =
|
DriverObject->MajorFunction[IRP_MJ_CREATE] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
|
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_READ] =
|
DriverObject->MajorFunction[IRP_MJ_READ] =
|
||||||
|
DriverObject->MajorFunction[IRP_MJ_WRITE] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
|
DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
|
DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION]=
|
DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION]=
|
||||||
|
@ -133,14 +174,34 @@ Return Value:
|
||||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] =
|
DriverObject->MajorFunction[IRP_MJ_LOCK_CONTROL] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
|
DriverObject->MajorFunction[IRP_MJ_CLEANUP] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_PNP] = (PDRIVER_DISPATCH) CdFsdDispatch;
|
DriverObject->MajorFunction[IRP_MJ_PNP] =
|
||||||
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = CdShutdown;
|
DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = (PDRIVER_DISPATCH) CdFsdDispatch;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(pop)
|
||||||
|
|
||||||
|
#pragma prefast(suppress: 28175, "this is a file system driver, we're allowed to touch FastIoDispatch.")
|
||||||
|
#endif
|
||||||
DriverObject->FastIoDispatch = &CdFastIoDispatch;
|
DriverObject->FastIoDispatch = &CdFastIoDispatch;
|
||||||
|
|
||||||
Status = IoRegisterShutdownNotification (CdfsFileSystemDeviceObject);
|
//
|
||||||
if (!NT_SUCCESS (Status)) {
|
// Initialize the filter callbacks we use.
|
||||||
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
//
|
||||||
|
|
||||||
|
RtlZeroMemory( &FilterCallbacks,
|
||||||
|
sizeof(FS_FILTER_CALLBACKS) );
|
||||||
|
|
||||||
|
FilterCallbacks.SizeOfFsFilterCallbacks = sizeof(FS_FILTER_CALLBACKS);
|
||||||
|
FilterCallbacks.PreAcquireForSectionSynchronization = CdFilterCallbackAcquireForCreateSection;
|
||||||
|
|
||||||
|
Status = FsRtlRegisterFileSystemFilterCallbacks( DriverObject,
|
||||||
|
&FilterCallbacks );
|
||||||
|
|
||||||
|
if (!NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
|
IoDeleteDevice( CdfsFileSystemDeviceObject );
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
IoDeleteDevice (HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,9 +209,16 @@ Return Value:
|
||||||
// Initialize the global data structures
|
// Initialize the global data structures
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject );
|
Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject );
|
||||||
|
#else
|
||||||
|
Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject, HddFileSystemDeviceObject );
|
||||||
|
#endif
|
||||||
if (!NT_SUCCESS (Status)) {
|
if (!NT_SUCCESS (Status)) {
|
||||||
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
IoDeleteDevice (HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,9 +229,25 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
CdfsFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
|
CdfsFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
HddFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
|
||||||
|
#endif
|
||||||
|
|
||||||
IoRegisterFileSystem( CdfsFileSystemDeviceObject );
|
IoRegisterFileSystem( CdfsFileSystemDeviceObject );
|
||||||
ObReferenceObject (CdfsFileSystemDeviceObject);
|
ObReferenceObject (CdfsFileSystemDeviceObject);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
IoRegisterFileSystem( HddFileSystemDeviceObject );
|
||||||
|
ObReferenceObject (HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CDFS_TELEMETRY_DATA
|
||||||
|
//
|
||||||
|
// Initialize Telemetry
|
||||||
|
//
|
||||||
|
|
||||||
|
CdInitializeTelemetry();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// And return to our caller
|
// And return to our caller
|
||||||
|
@ -172,42 +256,11 @@ Return Value:
|
||||||
return( STATUS_SUCCESS );
|
return( STATUS_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
|
||||||
CdShutdown (
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PIRP Irp
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
This routine is the shutdown handler for CDFS.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
DeviceObject - Supplies the registered device object for CDFS.
|
|
||||||
Irp - Shutdown IRP
|
|
||||||
|
|
||||||
|
|
||||||
Return Value:
|
|
||||||
|
|
||||||
None.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
|
||||||
IoUnregisterFileSystem (DeviceObject);
|
|
||||||
IoDeleteDevice (CdData.FileSystemDeviceObject);
|
|
||||||
|
|
||||||
CdCompleteRequest( NULL, Irp, STATUS_SUCCESS );
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdUnload(
|
CdUnload(
|
||||||
IN PDRIVER_OBJECT DriverObject
|
_In_ PDRIVER_OBJECT DriverObject
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
|
@ -227,6 +280,10 @@ Return Value:
|
||||||
{
|
{
|
||||||
PIRP_CONTEXT IrpContext;
|
PIRP_CONTEXT IrpContext;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DriverObject );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Free any IRP contexts
|
// Free any IRP contexts
|
||||||
//
|
//
|
||||||
|
@ -241,6 +298,9 @@ Return Value:
|
||||||
IoFreeWorkItem (CdData.CloseItem);
|
IoFreeWorkItem (CdData.CloseItem);
|
||||||
ExDeleteResourceLite( &CdData.DataResource );
|
ExDeleteResourceLite( &CdData.DataResource );
|
||||||
ObDereferenceObject (CdData.FileSystemDeviceObject);
|
ObDereferenceObject (CdData.FileSystemDeviceObject);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
ObDereferenceObject (CdData.HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -249,8 +309,12 @@ Return Value:
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdInitializeGlobalData (
|
CdInitializeGlobalData (
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
_In_ PDRIVER_OBJECT DriverObject,
|
||||||
IN PDEVICE_OBJECT FileSystemDeviceObject
|
_In_ PDEVICE_OBJECT FileSystemDeviceObject
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
,
|
||||||
|
IN PDEVICE_OBJECT HddFileSystemDeviceObject
|
||||||
|
#endif
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -279,6 +343,12 @@ Return Value:
|
||||||
RtlZeroMemory( &CdFastIoDispatch, sizeof( FAST_IO_DISPATCH ));
|
RtlZeroMemory( &CdFastIoDispatch, sizeof( FAST_IO_DISPATCH ));
|
||||||
|
|
||||||
CdFastIoDispatch.SizeOfFastIoDispatch = sizeof(FAST_IO_DISPATCH);
|
CdFastIoDispatch.SizeOfFastIoDispatch = sizeof(FAST_IO_DISPATCH);
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(push)
|
||||||
|
#pragma prefast(disable:28155, "these are all correct")
|
||||||
|
#endif
|
||||||
|
|
||||||
CdFastIoDispatch.FastIoCheckIfPossible = CdFastIoCheckIfPossible; // CheckForFastIo
|
CdFastIoDispatch.FastIoCheckIfPossible = CdFastIoCheckIfPossible; // CheckForFastIo
|
||||||
CdFastIoDispatch.FastIoRead = FsRtlCopyRead; // Read
|
CdFastIoDispatch.FastIoRead = FsRtlCopyRead; // Read
|
||||||
CdFastIoDispatch.FastIoQueryBasicInfo = CdFastQueryBasicInfo; // QueryBasicInfo
|
CdFastIoDispatch.FastIoQueryBasicInfo = CdFastQueryBasicInfo; // QueryBasicInfo
|
||||||
|
@ -287,7 +357,11 @@ Return Value:
|
||||||
CdFastIoDispatch.FastIoUnlockSingle = CdFastUnlockSingle; // UnlockSingle
|
CdFastIoDispatch.FastIoUnlockSingle = CdFastUnlockSingle; // UnlockSingle
|
||||||
CdFastIoDispatch.FastIoUnlockAll = CdFastUnlockAll; // UnlockAll
|
CdFastIoDispatch.FastIoUnlockAll = CdFastUnlockAll; // UnlockAll
|
||||||
CdFastIoDispatch.FastIoUnlockAllByKey = CdFastUnlockAllByKey; // UnlockAllByKey
|
CdFastIoDispatch.FastIoUnlockAllByKey = CdFastUnlockAllByKey; // UnlockAllByKey
|
||||||
CdFastIoDispatch.AcquireFileForNtCreateSection = CdAcquireForCreateSection;
|
//
|
||||||
|
// This callback has been replaced by CdFilterCallbackAcquireForCreateSection.
|
||||||
|
//
|
||||||
|
|
||||||
|
CdFastIoDispatch.AcquireFileForNtCreateSection = NULL;
|
||||||
CdFastIoDispatch.ReleaseFileForNtCreateSection = CdReleaseForCreateSection;
|
CdFastIoDispatch.ReleaseFileForNtCreateSection = CdReleaseForCreateSection;
|
||||||
CdFastIoDispatch.FastIoQueryNetworkOpenInfo = CdFastQueryNetworkInfo; // QueryNetworkInfo
|
CdFastIoDispatch.FastIoQueryNetworkOpenInfo = CdFastQueryNetworkInfo; // QueryNetworkInfo
|
||||||
|
|
||||||
|
@ -296,6 +370,10 @@ Return Value:
|
||||||
CdFastIoDispatch.PrepareMdlWrite = FsRtlPrepareMdlWriteDev;
|
CdFastIoDispatch.PrepareMdlWrite = FsRtlPrepareMdlWriteDev;
|
||||||
CdFastIoDispatch.MdlWriteComplete = FsRtlMdlWriteCompleteDev;
|
CdFastIoDispatch.MdlWriteComplete = FsRtlMdlWriteCompleteDev;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize the CdData structure.
|
// Initialize the CdData structure.
|
||||||
//
|
//
|
||||||
|
@ -307,6 +385,9 @@ Return Value:
|
||||||
|
|
||||||
CdData.DriverObject = DriverObject;
|
CdData.DriverObject = DriverObject;
|
||||||
CdData.FileSystemDeviceObject = FileSystemDeviceObject;
|
CdData.FileSystemDeviceObject = FileSystemDeviceObject;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
CdData.HddFileSystemDeviceObject = HddFileSystemDeviceObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
InitializeListHead( &CdData.VcbQueue );
|
InitializeListHead( &CdData.VcbQueue );
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
1
drivers/filesystems/cdfs_new/cdprocssrc.c
Normal file
1
drivers/filesystems/cdfs_new/cdprocssrc.c
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include "cdprocs.h"
|
|
@ -133,7 +133,7 @@ Abstract:
|
||||||
5. A fast mutex in the Vcb will protect access to the Fcb table and
|
5. A fast mutex in the Vcb will protect access to the Fcb table and
|
||||||
the open counts in the Vcb. It is also used to modify the reference
|
the open counts in the Vcb. It is also used to modify the reference
|
||||||
counts in all Fcbs. This mutex cannot be acquired
|
counts in all Fcbs. This mutex cannot be acquired
|
||||||
exclusively and is an end resource.
|
exclusely and is an end resource.
|
||||||
|
|
||||||
6. A fast mutex in the Fcb will synchronize access to all Fcb fields
|
6. A fast mutex in the Fcb will synchronize access to all Fcb fields
|
||||||
which aren't synchronized in some other way. A thread may acquire
|
which aren't synchronized in some other way. A thread may acquire
|
||||||
|
@ -170,6 +170,12 @@ typedef PVOID PBCB; //**** Bcb's are now part of the cache module
|
||||||
|
|
||||||
#define BYTE_COUNT_EMBEDDED_NAME (32)
|
#define BYTE_COUNT_EMBEDDED_NAME (32)
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
#define __volatile volatile
|
||||||
|
#define _Unreferenced_parameter_
|
||||||
|
#define __field_range(a,b)
|
||||||
|
#define __analysis_assert(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// The CD_MCB is used to store the mapping of logical file offset to
|
// The CD_MCB is used to store the mapping of logical file offset to
|
||||||
|
@ -244,7 +250,7 @@ typedef struct _CD_NAME {
|
||||||
UNICODE_STRING FileName;
|
UNICODE_STRING FileName;
|
||||||
|
|
||||||
//
|
//
|
||||||
// String containing the version number.
|
// String containging the version number.
|
||||||
//
|
//
|
||||||
|
|
||||||
UNICODE_STRING VersionString;
|
UNICODE_STRING VersionString;
|
||||||
|
@ -318,7 +324,7 @@ typedef struct _CD_DATA {
|
||||||
// The type and size of this record (must be CDFS_NTC_DATA_HEADER)
|
// The type and size of this record (must be CDFS_NTC_DATA_HEADER)
|
||||||
//
|
//
|
||||||
|
|
||||||
NODE_TYPE_CODE NodeTypeCode;
|
_Field_range_(==, CDFS_NTC_DATA_HEADER) NODE_TYPE_CODE NodeTypeCode;
|
||||||
NODE_BYTE_SIZE NodeByteSize;
|
NODE_BYTE_SIZE NodeByteSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -349,6 +355,10 @@ typedef struct _CD_DATA {
|
||||||
|
|
||||||
PDEVICE_OBJECT FileSystemDeviceObject;
|
PDEVICE_OBJECT FileSystemDeviceObject;
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
PDEVICE_OBJECT HddFileSystemDeviceObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Following are used to manage the async and delayed close queue.
|
// Following are used to manage the async and delayed close queue.
|
||||||
//
|
//
|
||||||
|
@ -356,7 +366,7 @@ typedef struct _CD_DATA {
|
||||||
// two close queues.
|
// two close queues.
|
||||||
// ReduceDelayedClose - Indicates that we have hit the upper threshold
|
// ReduceDelayedClose - Indicates that we have hit the upper threshold
|
||||||
// for the delayed close queue and need to reduce it to lower threshold.
|
// for the delayed close queue and need to reduce it to lower threshold.
|
||||||
//
|
// Flags - CD flags.
|
||||||
// AsyncCloseQueue - Queue of IrpContext waiting for async close operation.
|
// AsyncCloseQueue - Queue of IrpContext waiting for async close operation.
|
||||||
// AsyncCloseCount - Number of entries on the async close queue.
|
// AsyncCloseCount - Number of entries on the async close queue.
|
||||||
//
|
//
|
||||||
|
@ -364,7 +374,7 @@ typedef struct _CD_DATA {
|
||||||
// operation.
|
// operation.
|
||||||
// MaxDelayedCloseCount - Trigger delay close work at this threshold.
|
// MaxDelayedCloseCount - Trigger delay close work at this threshold.
|
||||||
// MinDelayedCloseCount - Turn off delay close work at this threshold.
|
// MinDelayedCloseCount - Turn off delay close work at this threshold.
|
||||||
// DelayedCloseCount - Number of entries on the delayed close queue.
|
// DelayedCloseCount - Number of entries on the delayted close queue.
|
||||||
//
|
//
|
||||||
// CloseItem - Workqueue item used to start FspClose thread.
|
// CloseItem - Workqueue item used to start FspClose thread.
|
||||||
//
|
//
|
||||||
|
@ -373,7 +383,7 @@ typedef struct _CD_DATA {
|
||||||
ULONG AsyncCloseCount;
|
ULONG AsyncCloseCount;
|
||||||
BOOLEAN FspCloseActive;
|
BOOLEAN FspCloseActive;
|
||||||
BOOLEAN ReduceDelayedClose;
|
BOOLEAN ReduceDelayedClose;
|
||||||
USHORT PadUshort;
|
USHORT Flags;
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following fields describe the deferred close file objects.
|
// The following fields describe the deferred close file objects.
|
||||||
|
@ -414,7 +424,48 @@ typedef struct _CD_DATA {
|
||||||
} CD_DATA;
|
} CD_DATA;
|
||||||
typedef CD_DATA *PCD_DATA;
|
typedef CD_DATA *PCD_DATA;
|
||||||
|
|
||||||
|
|
||||||
|
#define CD_FLAGS_SHUTDOWN (0x0001)
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Since DVD drives allow > 100 "sessions", we need to use a larger TOC
|
||||||
|
// than the legacy CD definition. The maximum is theoretically 0xaa-16 (max
|
||||||
|
// number of open tracks in a session), but it's quite possible that some
|
||||||
|
// drive does not enforce this, so we'll go with 169 (track 0xaa is always the
|
||||||
|
// leadout).
|
||||||
|
//
|
||||||
|
|
||||||
|
#define MAXIMUM_NUMBER_TRACKS_LARGE 0xAA
|
||||||
|
|
||||||
|
typedef struct _CDROM_TOC_LARGE {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Header
|
||||||
|
//
|
||||||
|
|
||||||
|
UCHAR Length[2]; // add two bytes for this field
|
||||||
|
UCHAR FirstTrack;
|
||||||
|
UCHAR LastTrack;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Track data
|
||||||
|
//
|
||||||
|
|
||||||
|
TRACK_DATA TrackData[ MAXIMUM_NUMBER_TRACKS_LARGE];
|
||||||
|
|
||||||
|
} CDROM_TOC_LARGE, *PCDROM_TOC_LARGE;
|
||||||
|
|
||||||
|
typedef struct _CD_SECTOR_CACHE_CHUNK {
|
||||||
|
|
||||||
|
ULONG BaseLbn;
|
||||||
|
PUCHAR Buffer;
|
||||||
|
|
||||||
|
} CD_SECTOR_CACHE_CHUNK, *PCD_SECTOR_CACHE_CHUNK;
|
||||||
|
|
||||||
|
#define CD_SEC_CACHE_CHUNKS 4
|
||||||
|
#define CD_SEC_CHUNK_BLOCKS 0x18
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Vcb (Volume control block) record corresponds to every
|
// The Vcb (Volume control block) record corresponds to every
|
||||||
// volume mounted by the file system. They are ordered in a queue off
|
// volume mounted by the file system. They are ordered in a queue off
|
||||||
|
@ -456,7 +507,7 @@ typedef struct _VCB {
|
||||||
// The type and size of this record (must be CDFS_NTC_VCB)
|
// The type and size of this record (must be CDFS_NTC_VCB)
|
||||||
//
|
//
|
||||||
|
|
||||||
NODE_TYPE_CODE NodeTypeCode;
|
_Field_range_(==, CDFS_NTC_VCB) NODE_TYPE_CODE NodeTypeCode;
|
||||||
NODE_BYTE_SIZE NodeByteSize;
|
NODE_BYTE_SIZE NodeByteSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -504,8 +555,8 @@ typedef struct _VCB {
|
||||||
//
|
//
|
||||||
|
|
||||||
ULONG VcbCleanup;
|
ULONG VcbCleanup;
|
||||||
LONG VcbReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */
|
__volatile LONG VcbReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */
|
||||||
LONG VcbUserReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */
|
__volatile LONG VcbUserReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fcb for the Volume Dasd file, root directory and the Path Table.
|
// Fcb for the Volume Dasd file, root directory and the Path Table.
|
||||||
|
@ -589,7 +640,7 @@ typedef struct _VCB {
|
||||||
// Volume TOC. Cache this information for quick lookup.
|
// Volume TOC. Cache this information for quick lookup.
|
||||||
//
|
//
|
||||||
|
|
||||||
PCDROM_TOC CdromToc;
|
PCDROM_TOC_LARGE CdromToc;
|
||||||
ULONG TocLength;
|
ULONG TocLength;
|
||||||
ULONG TrackCount;
|
ULONG TrackCount;
|
||||||
ULONG DiskFlags;
|
ULONG DiskFlags;
|
||||||
|
@ -621,8 +672,42 @@ typedef struct _VCB {
|
||||||
|
|
||||||
PVPB SwapVpb;
|
PVPB SwapVpb;
|
||||||
|
|
||||||
} VCB;
|
//
|
||||||
typedef VCB *PVCB;
|
// Directory block cache. Read large numbers of blocks on directory
|
||||||
|
// reads, hoping to benefit from the fact that most mastered/pressed
|
||||||
|
// discs clump metadata in one place thus allowing us to crudely
|
||||||
|
// pre-cache and reduce seeks back to directory data during app install,
|
||||||
|
// file copy etc.
|
||||||
|
//
|
||||||
|
// Note that the purpose of this is to PRE cache unread data,
|
||||||
|
// not cache already read data (since Cc already provides that), thus
|
||||||
|
// speeding initial access to the volume.
|
||||||
|
//
|
||||||
|
|
||||||
|
PUCHAR SectorCacheBuffer;
|
||||||
|
CD_SECTOR_CACHE_CHUNK SecCacheChunks[ CD_SEC_CACHE_CHUNKS];
|
||||||
|
ULONG SecCacheLRUChunkIndex;
|
||||||
|
|
||||||
|
PIRP SectorCacheIrp;
|
||||||
|
KEVENT SectorCacheEvent;
|
||||||
|
ERESOURCE SectorCacheResource;
|
||||||
|
|
||||||
|
#ifdef CDFS_TELEMETRY_DATA
|
||||||
|
|
||||||
|
//
|
||||||
|
// An ID that is common across the volume stack used to correlate volume events and for telemetry purposes.
|
||||||
|
// It may have a different value than the VolumeGuid.
|
||||||
|
//
|
||||||
|
|
||||||
|
GUID VolumeCorrelationId;
|
||||||
|
|
||||||
|
#endif // CDFS_TELEMETRY_DATA
|
||||||
|
|
||||||
|
#if DBG
|
||||||
|
ULONG SecCacheHits;
|
||||||
|
ULONG SecCacheMisses;
|
||||||
|
#endif
|
||||||
|
} VCB, *PVCB;
|
||||||
|
|
||||||
#define VCB_STATE_HSG (0x00000001)
|
#define VCB_STATE_HSG (0x00000001)
|
||||||
#define VCB_STATE_ISO (0x00000002)
|
#define VCB_STATE_ISO (0x00000002)
|
||||||
|
@ -633,6 +718,8 @@ typedef VCB *PVCB;
|
||||||
#define VCB_STATE_AUDIO_DISK (0x00000080)
|
#define VCB_STATE_AUDIO_DISK (0x00000080)
|
||||||
#define VCB_STATE_NOTIFY_REMOUNT (0x00000100)
|
#define VCB_STATE_NOTIFY_REMOUNT (0x00000100)
|
||||||
#define VCB_STATE_VPB_NOT_ON_DEVICE (0x00000200)
|
#define VCB_STATE_VPB_NOT_ON_DEVICE (0x00000200)
|
||||||
|
#define VCB_STATE_SHUTDOWN (0x00000400)
|
||||||
|
#define VCB_STATE_DISMOUNTED (0x00000800)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -655,7 +742,7 @@ typedef struct _VOLUME_DEVICE_OBJECT {
|
||||||
// executed later.
|
// executed later.
|
||||||
//
|
//
|
||||||
|
|
||||||
LONG PostedRequestCount; /* ReactOS Change: GCC "pointer targets in passing argument 1 of 'InterlockedDecrement' differ in signedness" */
|
__volatile LONG PostedRequestCount; /* ReactOS Change: GCC "pointer targets in passing argument 1 of 'InterlockedDecrement' differ in signedness" */
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following field indicates the number of IRP's waiting
|
// The following field indicates the number of IRP's waiting
|
||||||
|
@ -702,12 +789,14 @@ typedef enum _FCB_CONDITION {
|
||||||
|
|
||||||
typedef struct _FCB_DATA {
|
typedef struct _FCB_DATA {
|
||||||
|
|
||||||
|
#if (NTDDI_VERSION < NTDDI_WIN8)
|
||||||
//
|
//
|
||||||
// The following field is used by the oplock module
|
// The following field is used by the oplock module
|
||||||
// to maintain current oplock information.
|
// to maintain current oplock information.
|
||||||
//
|
//
|
||||||
|
|
||||||
OPLOCK Oplock;
|
OPLOCK Oplock;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following field is used by the filelock module
|
// The following field is used by the filelock module
|
||||||
|
@ -776,12 +865,12 @@ typedef struct _FCB_NONPAGED {
|
||||||
// Type and size of this record must be CDFS_NTC_FCB_NONPAGED
|
// Type and size of this record must be CDFS_NTC_FCB_NONPAGED
|
||||||
//
|
//
|
||||||
|
|
||||||
NODE_TYPE_CODE NodeTypeCode;
|
_Field_range_(==, CDFS_NTC_FCB_NONPAGED) NODE_TYPE_CODE NodeTypeCode;
|
||||||
NODE_BYTE_SIZE NodeByteSize;
|
NODE_BYTE_SIZE NodeByteSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
// The following field contains a record of special pointers used by
|
// The following field contains a record of special pointers used by
|
||||||
// MM and Cache to manipulate section objects. Note that the values
|
// MM and Cache to manipluate section objects. Note that the values
|
||||||
// are set outside of the file system. However the file system on an
|
// are set outside of the file system. However the file system on an
|
||||||
// open/create will set the file object's SectionObject field to
|
// open/create will set the file object's SectionObject field to
|
||||||
// point to this field
|
// point to this field
|
||||||
|
@ -878,7 +967,7 @@ typedef struct _FCB {
|
||||||
//
|
//
|
||||||
|
|
||||||
ULONG FcbCleanup;
|
ULONG FcbCleanup;
|
||||||
LONG FcbReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */
|
__volatile LONG FcbReference; /* ReactOS Change: GCC 'pointer targets in passing argument 1 of 'InterlockedXxx' differ in signedness */
|
||||||
ULONG FcbUserReference;
|
ULONG FcbUserReference;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -987,7 +1076,7 @@ typedef struct _CCB {
|
||||||
// Type and size of this record (must be CDFS_NTC_CCB)
|
// Type and size of this record (must be CDFS_NTC_CCB)
|
||||||
//
|
//
|
||||||
|
|
||||||
NODE_TYPE_CODE NodeTypeCode;
|
_Field_range_(==, CDFS_NTC_CCB) NODE_TYPE_CODE NodeTypeCode;
|
||||||
NODE_BYTE_SIZE NodeByteSize;
|
NODE_BYTE_SIZE NodeByteSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1022,6 +1111,7 @@ typedef CCB *PCCB;
|
||||||
#define CCB_FLAG_IGNORE_CASE (0x00000004)
|
#define CCB_FLAG_IGNORE_CASE (0x00000004)
|
||||||
#define CCB_FLAG_OPEN_WITH_VERSION (0x00000008)
|
#define CCB_FLAG_OPEN_WITH_VERSION (0x00000008)
|
||||||
#define CCB_FLAG_DISMOUNT_ON_CLOSE (0x00000010)
|
#define CCB_FLAG_DISMOUNT_ON_CLOSE (0x00000010)
|
||||||
|
#define CCB_FLAG_ALLOW_EXTENDED_DASD_IO (0x00000020)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Following flags refer to index enumeration.
|
// Following flags refer to index enumeration.
|
||||||
|
@ -1037,7 +1127,7 @@ typedef CCB *PCCB;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Irp Context record is allocated for every originating Irp. It is
|
// The Irp Context record is allocated for every orginating Irp. It is
|
||||||
// created by the Fsd dispatch routines, and deallocated by the CdComplete
|
// created by the Fsd dispatch routines, and deallocated by the CdComplete
|
||||||
// request routine
|
// request routine
|
||||||
//
|
//
|
||||||
|
@ -1048,7 +1138,7 @@ typedef struct _IRP_CONTEXT {
|
||||||
// Type and size of this record (must be CDFS_NTC_IRP_CONTEXT)
|
// Type and size of this record (must be CDFS_NTC_IRP_CONTEXT)
|
||||||
//
|
//
|
||||||
|
|
||||||
NODE_TYPE_CODE NodeTypeCode;
|
_Field_range_(==, CDFS_NTC_IRP_CONTEXT) NODE_TYPE_CODE NodeTypeCode;
|
||||||
NODE_BYTE_SIZE NodeByteSize;
|
NODE_BYTE_SIZE NodeByteSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1193,7 +1283,7 @@ typedef struct _IRP_CONTEXT_LITE {
|
||||||
// Type and size of this record (must be CDFS_NTC_IRP_CONTEXT_LITE)
|
// Type and size of this record (must be CDFS_NTC_IRP_CONTEXT_LITE)
|
||||||
//
|
//
|
||||||
|
|
||||||
NODE_TYPE_CODE NodeTypeCode;
|
_Field_range_(==, CDFS_NTC_IRP_CONTEXT_LITE) NODE_TYPE_CODE NodeTypeCode;
|
||||||
NODE_BYTE_SIZE NodeByteSize;
|
NODE_BYTE_SIZE NodeByteSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1238,9 +1328,9 @@ typedef struct _CD_IO_CONTEXT {
|
||||||
// These two fields are used for multiple run Io
|
// These two fields are used for multiple run Io
|
||||||
//
|
//
|
||||||
|
|
||||||
LONG IrpCount;
|
__volatile LONG IrpCount;
|
||||||
PIRP MasterIrp;
|
PIRP MasterIrp;
|
||||||
NTSTATUS Status;
|
__volatile NTSTATUS Status;
|
||||||
BOOLEAN AllocatedContext;
|
BOOLEAN AllocatedContext;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
@ -1487,7 +1577,7 @@ typedef DIRENT_ENUM_CONTEXT *PDIRENT_ENUM_CONTEXT;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Following structure is used to smooth out the differences in the HSG, ISO
|
// Following structure is used to smooth out the differences in the HSG, ISO
|
||||||
// and Joliet directory entries.
|
// and Joliett directory entries.
|
||||||
//
|
//
|
||||||
|
|
||||||
typedef struct _DIRENT {
|
typedef struct _DIRENT {
|
||||||
|
@ -1759,5 +1849,71 @@ typedef AUDIO_PLAY_HEADER *PAUDIO_PLAY_HEADER;
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CDFS_TELEMETRY_DATA
|
||||||
|
// ============================================================================
|
||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Telemetry
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
typedef struct _CDFS_TELEMETRY_DATA_CONTEXT {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Number of times there was not enough stack space to generate telemetry
|
||||||
|
//
|
||||||
|
|
||||||
|
volatile LONG MissedTelemetryPoints;
|
||||||
|
|
||||||
|
//
|
||||||
|
// System Time of the last periodic telemtry event. System Time
|
||||||
|
// is according to KeQuerySystemTime()
|
||||||
|
//
|
||||||
|
|
||||||
|
LARGE_INTEGER LastPeriodicTelemetrySystemTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TickCount of the last periodic telemtry event. TickCount is
|
||||||
|
// according to KeQueryTickCount()
|
||||||
|
//
|
||||||
|
|
||||||
|
LARGE_INTEGER LastPeriodicTelemetryTickCount;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hint for Worker thread whether to generate
|
||||||
|
// periodic telemetry or not
|
||||||
|
//
|
||||||
|
|
||||||
|
BOOLEAN GeneratePeriodicTelemetry;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Guid for ID parity with other file systems telemetry.
|
||||||
|
//
|
||||||
|
|
||||||
|
GUID VolumeGuid;
|
||||||
|
|
||||||
|
|
||||||
|
#if DBG
|
||||||
|
|
||||||
|
//
|
||||||
|
// For DBG builds we want a machanism to change the frequency of
|
||||||
|
// periodic events
|
||||||
|
//
|
||||||
|
|
||||||
|
LONGLONG PeriodicInterval;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// File system statistics at time of last period telemetry event
|
||||||
|
//
|
||||||
|
|
||||||
|
FILESYSTEM_STATISTICS CommonStats;
|
||||||
|
|
||||||
|
} CDFS_TELEMETRY_DATA_CONTEXT, *PCDFS_TELEMETRY_DATA_CONTEXT;
|
||||||
|
|
||||||
|
#endif // CDFS_TELEMETRY_DATA
|
||||||
|
|
||||||
#endif // _CDSTRUC_
|
#endif // _CDSTRUC_
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -22,11 +22,11 @@ Abstract:
|
||||||
|
|
||||||
#define BugCheckFileId (CDFS_BUG_CHECK_CLEANUP)
|
#define BugCheckFileId (CDFS_BUG_CHECK_CLEANUP)
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonCleanup (
|
CdCommonCleanup (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -82,7 +82,7 @@ Return Value:
|
||||||
TYPE_OF_OPEN TypeOfOpen;
|
TYPE_OF_OPEN TypeOfOpen;
|
||||||
|
|
||||||
BOOLEAN SendUnlockNotification = FALSE;
|
BOOLEAN SendUnlockNotification = FALSE;
|
||||||
BOOLEAN AttemptTeardown;
|
BOOLEAN AttemptTeardown = FALSE;
|
||||||
BOOLEAN VcbAcquired = FALSE;
|
BOOLEAN VcbAcquired = FALSE;
|
||||||
|
|
||||||
PVCB Vcb;
|
PVCB Vcb;
|
||||||
|
@ -149,6 +149,37 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseFile( IrpContext, Fcb);
|
CdReleaseFile( IrpContext, Fcb);
|
||||||
|
|
||||||
|
if (TypeOfOpen == UserVolumeOpen) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// For a force dismount, physically disconnect this Vcb from the device so
|
||||||
|
// a new mount can occur. Vcb deletion cannot happen at this time since
|
||||||
|
// there is a reference on it associated with this very request, but we'll
|
||||||
|
// call check for dismount again later after we process this close.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (FlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE )) {
|
||||||
|
|
||||||
|
CdAcquireCdData( IrpContext );
|
||||||
|
|
||||||
|
CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||||
|
|
||||||
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
|
//
|
||||||
|
// If this handle actually wrote something, flush the device buffers,
|
||||||
|
// and then set the verify bit now just to be safe (in case there is no
|
||||||
|
// dismount).
|
||||||
|
//
|
||||||
|
|
||||||
|
} else if (FlagOn( FileObject->Flags, FO_FILE_MODIFIED )) {
|
||||||
|
|
||||||
|
CdHijackIrpAndFlushDevice( IrpContext, Irp, Vcb->TargetDeviceObject );
|
||||||
|
|
||||||
|
CdMarkDevForVerifyIfVcbMounted( Vcb );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Acquire the current file.
|
// Acquire the current file.
|
||||||
//
|
//
|
||||||
|
@ -159,7 +190,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
//try { /* ReactOS Change: Manual removal of SEH since macros to hack around it don't allow multiple SEH usage within one function */
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Case on the type of open that we are trying to cleanup.
|
// Case on the type of open that we are trying to cleanup.
|
||||||
|
@ -187,7 +218,7 @@ Return Value:
|
||||||
// need to check for STATUS_PENDING.
|
// need to check for STATUS_PENDING.
|
||||||
//
|
//
|
||||||
|
|
||||||
FsRtlCheckOplock( &Fcb->Oplock,
|
FsRtlCheckOplock( CdGetFcbOplock(Fcb),
|
||||||
Irp,
|
Irp,
|
||||||
IrpContext,
|
IrpContext,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -221,12 +252,15 @@ Return Value:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UserVolumeOpen :
|
case UserVolumeOpen:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast( suppress:__WARNING_USE_OTHER_FUNCTION, "argument bogus" )
|
||||||
|
#endif
|
||||||
CdBugCheck( TypeOfOpen, 0, 0 );
|
CdBugCheck( TypeOfOpen, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +291,7 @@ Return Value:
|
||||||
|
|
||||||
if (FileObject == Vcb->VolumeLockFileObject) {
|
if (FileObject == Vcb->VolumeLockFileObject) {
|
||||||
|
|
||||||
ASSERT( FlagOn( Vcb->VcbState, VCB_STATE_LOCKED));
|
NT_ASSERT( FlagOn( Vcb->VcbState, VCB_STATE_LOCKED));
|
||||||
|
|
||||||
IoAcquireVpbSpinLock( &SavedIrql );
|
IoAcquireVpbSpinLock( &SavedIrql );
|
||||||
|
|
||||||
|
@ -279,7 +313,7 @@ Return Value:
|
||||||
|
|
||||||
IoRemoveShareAccess( FileObject, &Fcb->ShareAccess );
|
IoRemoveShareAccess( FileObject, &Fcb->ShareAccess );
|
||||||
|
|
||||||
//} finally { /* ReactOS Change: Manual removal of SEH since macros to hack around it don't allow multiple SEH usage within one function */
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
CdReleaseFcb( IrpContext, Fcb );
|
CdReleaseFcb( IrpContext, Fcb );
|
||||||
|
|
||||||
|
@ -287,7 +321,7 @@ Return Value:
|
||||||
|
|
||||||
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
|
FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
|
||||||
}
|
}
|
||||||
//} /* ReactOS Change: Manual removal of SEH since macros to hack around it don't allow multiple SEH usage within one function */
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If appropriate, try to spark teardown by purging the volume. Should
|
// If appropriate, try to spark teardown by purging the volume. Should
|
||||||
|
@ -305,19 +339,19 @@ Return Value:
|
||||||
|
|
||||||
CdAcquireCdData( IrpContext);
|
CdAcquireCdData( IrpContext);
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||||
VcbAcquired = TRUE;
|
VcbAcquired = TRUE;
|
||||||
|
|
||||||
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (VcbAcquired) { CdReleaseVcb( IrpContext, Vcb ); }
|
if (VcbAcquired) { CdReleaseVcb( IrpContext, Vcb ); }
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext);
|
CdReleaseCdData( IrpContext);
|
||||||
}
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -42,7 +42,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -54,36 +54,41 @@ Abstract:
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdCommonClosePrivate (
|
CdCommonClosePrivate (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN ULONG UserReference,
|
_In_ ULONG UserReference,
|
||||||
IN BOOLEAN FromFsd
|
_In_ BOOLEAN FromFsd
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueueClose (
|
CdQueueClose (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN ULONG UserReference,
|
_In_ ULONG UserReference,
|
||||||
IN BOOLEAN DelayedClose
|
_In_ BOOLEAN DelayedClose
|
||||||
);
|
);
|
||||||
|
|
||||||
PIRP_CONTEXT
|
PIRP_CONTEXT
|
||||||
CdRemoveClose (
|
CdRemoveClose (
|
||||||
IN PVCB Vcb OPTIONAL
|
_In_opt_ PVCB Vcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Tell prefast this is a workitem routine
|
||||||
|
IO_WORKITEM_ROUTINE CdCloseWorker;
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdCloseWorker (
|
CdCloseWorker (
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
IN PVOID Context
|
_In_opt_ PVOID Context
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
#pragma alloc_text(PAGE, CdFspClose)
|
||||||
#pragma alloc_text(PAGE, CdCommonClose)
|
#pragma alloc_text(PAGE, CdCommonClose)
|
||||||
#pragma alloc_text(PAGE, CdCommonClosePrivate)
|
#pragma alloc_text(PAGE, CdCommonClosePrivate)
|
||||||
#pragma alloc_text(PAGE, CdQueueClose)
|
#pragma alloc_text(PAGE, CdQueueClose)
|
||||||
|
@ -94,7 +99,7 @@ CdCloseWorker (
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdFspClose (
|
CdFspClose (
|
||||||
IN PVCB Vcb OPTIONAL
|
_In_opt_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -120,7 +125,7 @@ Return Value:
|
||||||
PIRP_CONTEXT IrpContext;
|
PIRP_CONTEXT IrpContext;
|
||||||
IRP_CONTEXT StackIrpContext;
|
IRP_CONTEXT StackIrpContext;
|
||||||
|
|
||||||
THREAD_CONTEXT ThreadContext;
|
THREAD_CONTEXT ThreadContext = {0};
|
||||||
|
|
||||||
PFCB Fcb;
|
PFCB Fcb;
|
||||||
ULONG UserReference;
|
ULONG UserReference;
|
||||||
|
@ -137,8 +142,8 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Continue processing until there are no more closes to process.
|
// Continue processing until there are no more closes to process.
|
||||||
//
|
//
|
||||||
/* ReactOS Change: "GCC suggest parentheses around assignment used as truth value" */
|
|
||||||
while ((IrpContext = CdRemoveClose( Vcb ))) {
|
while ((IrpContext = CdRemoveClose( Vcb )) != NULL) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we don't have an IrpContext then use the one on the stack.
|
// If we don't have an IrpContext then use the one on the stack.
|
||||||
|
@ -166,7 +171,7 @@ Return Value:
|
||||||
// Free the IrpContextLite.
|
// Free the IrpContextLite.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdFreeIrpContextLite( IrpContext ); /* ReactOS Change: GCC "error: invalid lvalue in unary '&'" */
|
CdFreeIrpContextLite( *(PVOID*)&IrpContext ); /* ReactOS Change: GCC "error: invalid lvalue in unary '&'" */
|
||||||
|
|
||||||
//
|
//
|
||||||
// Remember we have the IrpContext from the stack.
|
// Remember we have the IrpContext from the stack.
|
||||||
|
@ -191,6 +196,8 @@ Return Value:
|
||||||
IrpContext->ExceptionStatus = STATUS_SUCCESS;
|
IrpContext->ExceptionStatus = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Analysis_assume_(Fcb != NULL && Fcb->Vcb != NULL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// We have an IrpContext. Now we need to set the top level thread
|
// We have an IrpContext. Now we need to set the top level thread
|
||||||
// context.
|
// context.
|
||||||
|
@ -261,6 +268,9 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentVcb = Fcb->Vcb;
|
CurrentVcb = Fcb->Vcb;
|
||||||
|
|
||||||
|
_Analysis_assume_( CurrentVcb != NULL );
|
||||||
|
|
||||||
CdAcquireVcbShared( IrpContext, CurrentVcb, FALSE );
|
CdAcquireVcbShared( IrpContext, CurrentVcb, FALSE );
|
||||||
|
|
||||||
VcbHoldCount = 0;
|
VcbHoldCount = 0;
|
||||||
|
@ -309,14 +319,17 @@ Return Value:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(suppress:26165, "Esp:1153")
|
||||||
|
#endif
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonClose (
|
CdCommonClose (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -349,7 +362,6 @@ Return Value:
|
||||||
ULONG UserReference = 0;
|
ULONG UserReference = 0;
|
||||||
|
|
||||||
BOOLEAN PotentialVcbTeardown = FALSE;
|
BOOLEAN PotentialVcbTeardown = FALSE;
|
||||||
BOOLEAN ForceDismount = FALSE;
|
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -397,13 +409,6 @@ Return Value:
|
||||||
|
|
||||||
UserReference = 1;
|
UserReference = 1;
|
||||||
|
|
||||||
//
|
|
||||||
// Was a FSCTL_DISMOUNT issued on this handle? If so, we need to
|
|
||||||
// force a dismount of the volume now.
|
|
||||||
//
|
|
||||||
|
|
||||||
ForceDismount = BooleanFlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// We can always deallocate the Ccb if present.
|
// We can always deallocate the Ccb if present.
|
||||||
//
|
//
|
||||||
|
@ -431,7 +436,8 @@ Return Value:
|
||||||
// if we can't acquire all of the resources.
|
// if we can't acquire all of the resources.
|
||||||
//
|
//
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we may be dismounting this volume then acquire the CdData
|
// If we may be dismounting this volume then acquire the CdData
|
||||||
|
@ -439,7 +445,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Since we now must make volumes go away as soon as reasonable after
|
// Since we now must make volumes go away as soon as reasonable after
|
||||||
// the last user handles closes, key off of the cleanup count. It is
|
// the last user handles closes, key off of the cleanup count. It is
|
||||||
// OK to do this more than necessary. Since this Fcb could be holding
|
// OK to do this more than neccesary. Since this Fcb could be holding
|
||||||
// a number of other Fcbs (and thus their references), a simple check
|
// a number of other Fcbs (and thus their references), a simple check
|
||||||
// on reference count is not appropriate.
|
// on reference count is not appropriate.
|
||||||
//
|
//
|
||||||
|
@ -447,33 +453,17 @@ Return Value:
|
||||||
// common case.
|
// common case.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (((Vcb->VcbCleanup == 0) || ForceDismount) &&
|
if ((Vcb->VcbCleanup == 0) &&
|
||||||
(Vcb->VcbCondition != VcbMounted)) {
|
(Vcb->VcbCondition != VcbMounted)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Possible. Acquire CdData to synchronise with the remount path, and
|
// Possible dismount. Acquire CdData to synchronise with the remount path
|
||||||
// then repeat the tests.
|
// before looking at the vcb condition again.
|
||||||
//
|
//
|
||||||
// Note that we must send the notification outside of any locks, since
|
|
||||||
// the worker that processes the notify could also be calling into our
|
|
||||||
// pnp path which wants both CdData and VcbResource. For a force dismount
|
|
||||||
// the volume will be marked invalid (no going back), so we will definitely
|
|
||||||
// go ahead and dismount below.
|
|
||||||
//
|
|
||||||
|
|
||||||
if (ForceDismount) {
|
|
||||||
|
|
||||||
//
|
|
||||||
// Send notification.
|
|
||||||
//
|
|
||||||
|
|
||||||
FsRtlNotifyVolumeEvent( IoGetCurrentIrpStackLocation( Irp )->FileObject,
|
|
||||||
FSRTL_VOLUME_DISMOUNT );
|
|
||||||
}
|
|
||||||
|
|
||||||
CdAcquireCdData( IrpContext );
|
CdAcquireCdData( IrpContext );
|
||||||
|
|
||||||
if (((Vcb->VcbCleanup == 0) || ForceDismount) &&
|
if ((Vcb->VcbCleanup == 0) &&
|
||||||
(Vcb->VcbCondition != VcbMounted) &&
|
(Vcb->VcbCondition != VcbMounted) &&
|
||||||
(Vcb->VcbCondition != VcbMountInProgress) &&
|
(Vcb->VcbCondition != VcbMountInProgress) &&
|
||||||
FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL_CDFS )) {
|
FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_TOP_LEVEL_CDFS )) {
|
||||||
|
@ -486,21 +476,16 @@ Return Value:
|
||||||
// We can't dismount this volume now, there are other references or
|
// We can't dismount this volume now, there are other references or
|
||||||
// it's just been remounted.
|
// it's just been remounted.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ForceDismount) {
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Physically disconnect this Vcb from the device so a new mount can
|
// Drop the global lock if we don't need it anymore.
|
||||||
// occur. Vcb deletion cannot happen at this time since there is
|
|
||||||
// a handle on it associated with this very request, but we'll call
|
|
||||||
// check for dismount again later anyway.
|
|
||||||
//
|
//
|
||||||
|
|
||||||
CdCheckForDismount( IrpContext, Vcb, TRUE );
|
if (!PotentialVcbTeardown) {
|
||||||
|
|
||||||
|
CdReleaseCdData( IrpContext );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -522,7 +507,8 @@ Return Value:
|
||||||
// the request.
|
// the request.
|
||||||
//
|
//
|
||||||
|
|
||||||
} else if (PotentialVcbTeardown) {
|
}
|
||||||
|
else if (PotentialVcbTeardown) {
|
||||||
|
|
||||||
CdCheckForDismount( IrpContext, Vcb, FALSE );
|
CdCheckForDismount( IrpContext, Vcb, FALSE );
|
||||||
}
|
}
|
||||||
|
@ -551,13 +537,14 @@ Return Value:
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdCommonClosePrivate (
|
CdCommonClosePrivate (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN ULONG UserReference,
|
_In_ ULONG UserReference,
|
||||||
IN BOOLEAN FromFsd
|
_In_ BOOLEAN FromFsd
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -651,6 +638,9 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseFcb( IrpContext, Fcb );
|
CdReleaseFcb( IrpContext, Fcb );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_Analysis_assume_lock_not_held_(Fcb->FcbNonpaged->FcbResource);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the Vcb and return to our caller. Let him know we completed
|
// Release the Vcb and return to our caller. Let him know we completed
|
||||||
|
@ -665,8 +655,8 @@ Return Value:
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdCloseWorker (
|
CdCloseWorker (
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
IN PVOID Context
|
_In_opt_ PVOID Context
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
|
@ -687,16 +677,21 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
UNREFERENCED_PARAMETER( Context );
|
||||||
|
|
||||||
CdFspClose (NULL);
|
CdFspClose (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueueClose (
|
CdQueueClose (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN ULONG UserReference,
|
_In_ ULONG UserReference,
|
||||||
IN BOOLEAN DelayedClose
|
_In_ BOOLEAN DelayedClose
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -880,7 +875,7 @@ Return Value:
|
||||||
|
|
||||||
PIRP_CONTEXT
|
PIRP_CONTEXT
|
||||||
CdRemoveClose (
|
CdRemoveClose (
|
||||||
IN PVCB Vcb OPTIONAL
|
_In_opt_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -26,73 +26,84 @@ Abstract:
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_When_(RelatedTypeOfOpen != UnopenedFileObject, _At_(RelatedCcb, _In_))
|
||||||
|
_When_(RelatedTypeOfOpen == UnopenedFileObject, _At_(RelatedCcb, _In_opt_))
|
||||||
|
_When_(RelatedTypeOfOpen != UnopenedFileObject, _At_(RelatedFileName, _In_))
|
||||||
|
_When_(RelatedTypeOfOpen == UnopenedFileObject, _At_(RelatedFileName, _In_opt_))
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdNormalizeFileNames (
|
CdNormalizeFileNames (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN BOOLEAN OpenByFileId,
|
_In_ BOOLEAN OpenByFileId,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN TYPE_OF_OPEN RelatedTypeOfOpen,
|
_In_ TYPE_OF_OPEN RelatedTypeOfOpen,
|
||||||
IN PCCB RelatedCcb OPTIONAL,
|
PCCB RelatedCcb,
|
||||||
IN PUNICODE_STRING RelatedFileName OPTIONAL,
|
PUNICODE_STRING RelatedFileName,
|
||||||
IN OUT PUNICODE_STRING FileName,
|
_Inout_ PUNICODE_STRING FileName,
|
||||||
IN OUT PCD_NAME RemainingName
|
_Inout_ PCD_NAME RemainingName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Acquires_exclusive_lock_((*CurrentFcb)->FcbNonpaged->FcbResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdOpenByFileId (
|
CdOpenByFileId (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN OUT PFCB *CurrentFcb
|
_Inout_ PFCB *CurrentFcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdOpenExistingFcb (
|
CdOpenExistingFcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN TYPE_OF_OPEN TypeOfOpen,
|
_In_ TYPE_OF_OPEN TypeOfOpen,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN PCCB RelatedCcb OPTIONAL
|
_In_opt_ PCCB RelatedCcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Acquires_lock_((*CurrentFcb)->FcbNonpaged->FcbResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdOpenDirectoryFromPathEntry (
|
CdOpenDirectoryFromPathEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN PCD_NAME DirName,
|
_In_ PCD_NAME DirName,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN BOOLEAN ShortNameMatch,
|
_In_ BOOLEAN ShortNameMatch,
|
||||||
IN PPATH_ENTRY PathEntry,
|
_In_ PPATH_ENTRY PathEntry,
|
||||||
IN BOOLEAN PerformUserOpen,
|
_In_ BOOLEAN PerformUserOpen,
|
||||||
IN PCCB RelatedCcb OPTIONAL
|
_In_opt_ PCCB RelatedCcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdOpenFileFromFileContext (
|
CdOpenFileFromFileContext (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN PCD_NAME FileName,
|
_In_ PCD_NAME FileName,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN BOOLEAN ShortNameMatch,
|
_In_ BOOLEAN ShortNameMatch,
|
||||||
IN PFILE_ENUM_CONTEXT FileContext,
|
_In_ PFILE_ENUM_CONTEXT FileContext,
|
||||||
IN PCCB RelatedCcb OPTIONAL
|
_In_opt_ PCCB RelatedCcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCompleteFcbOpen (
|
CdCompleteFcbOpen (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN TYPE_OF_OPEN TypeOfOpen,
|
_In_ TYPE_OF_OPEN TypeOfOpen,
|
||||||
IN ULONG UserCcbFlags,
|
_In_ ULONG UserCcbFlags,
|
||||||
IN ACCESS_MASK DesiredAccess
|
_In_ ACCESS_MASK DesiredAccess
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -106,10 +117,14 @@ CdCompleteFcbOpen (
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(suppress:26165, "Esp:1153")
|
||||||
|
#endif
|
||||||
CdCommonCreate (
|
CdCommonCreate (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -155,10 +170,10 @@ Return Value:
|
||||||
|
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
|
|
||||||
COMPOUND_PATH_ENTRY CompoundPathEntry;
|
COMPOUND_PATH_ENTRY CompoundPathEntry = {{0}};/* ReactOS Change: GCC "missing braces around initializer" */
|
||||||
BOOLEAN CleanupCompoundPathEntry = FALSE;
|
BOOLEAN CleanupCompoundPathEntry = FALSE;
|
||||||
|
|
||||||
FILE_ENUM_CONTEXT FileContext;
|
FILE_ENUM_CONTEXT FileContext = {0};
|
||||||
BOOLEAN CleanupFileContext = FALSE;
|
BOOLEAN CleanupFileContext = FALSE;
|
||||||
BOOLEAN FoundEntry;
|
BOOLEAN FoundEntry;
|
||||||
|
|
||||||
|
@ -216,9 +231,9 @@ Return Value:
|
||||||
PUNICODE_STRING FileName;
|
PUNICODE_STRING FileName;
|
||||||
PUNICODE_STRING RelatedFileName = NULL;
|
PUNICODE_STRING RelatedFileName = NULL;
|
||||||
|
|
||||||
CD_NAME RemainingName;
|
CD_NAME RemainingName = {{0}};/* ReactOS Change: GCC "missing braces around initializer" */
|
||||||
CD_NAME FinalName;
|
CD_NAME FinalName;
|
||||||
PCD_NAME MatchingName;
|
PCD_NAME MatchingName = NULL;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -259,6 +274,18 @@ Return Value:
|
||||||
return STATUS_ACCESS_DENIED;
|
return STATUS_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (NTDDI_VERSION >= NTDDI_WIN7)
|
||||||
|
//
|
||||||
|
// CDFS does not support FILE_OPEN_REQUIRING_OPLOCK
|
||||||
|
//
|
||||||
|
|
||||||
|
if (FlagOn( IrpSp->Parameters.Create.Options, FILE_OPEN_REQUIRING_OPLOCK )) {
|
||||||
|
|
||||||
|
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copy the Vcb to a local. Assume the starting directory is the root.
|
// Copy the Vcb to a local. Assume the starting directory is the root.
|
||||||
//
|
//
|
||||||
|
@ -357,7 +384,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Verify that the Vcb is not in an unusable condition. This routine
|
// Verify that the Vcb is not in an unusable condition. This routine
|
||||||
|
@ -901,7 +928,7 @@ Return Value:
|
||||||
RelatedCcb ));
|
RelatedCcb ));
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup the PathEntry if initialized.
|
// Cleanup the PathEntry if initialized.
|
||||||
|
@ -926,15 +953,16 @@ Return Value:
|
||||||
// condition.
|
// condition.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (AbnormalTermination()) {
|
if (_SEH2_AbnormalTermination()) {
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// In the error path we start by calling our teardown routine if we
|
// In the error path we start by calling our teardown routine if we
|
||||||
// have a CurrentFcb.
|
// have a CurrentFcb and its not the volume Dasd Fcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (CurrentFcb != NULL) {
|
if ((CurrentFcb != NULL) &&
|
||||||
|
(CurrentFcb != Vcb->VolumeDasdFcb)) {
|
||||||
|
|
||||||
BOOLEAN RemovedFcb;
|
BOOLEAN RemovedFcb;
|
||||||
|
|
||||||
|
@ -969,7 +997,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
if (CurrentFcb != NULL) {
|
if (CurrentFcb != NULL) {
|
||||||
|
_Analysis_assume_lock_held_(CurrentFcb->FcbNonpaged->FcbResource);
|
||||||
CdReleaseFcb( IrpContext, CurrentFcb );
|
CdReleaseFcb( IrpContext, CurrentFcb );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,7 +1013,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
CdCompleteRequest( IrpContext, Irp, Status );
|
CdCompleteRequest( IrpContext, Irp, Status );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -994,18 +1022,21 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
_When_(RelatedTypeOfOpen != UnopenedFileObject, _At_(RelatedCcb, _In_))
|
||||||
|
_When_(RelatedTypeOfOpen == UnopenedFileObject, _At_(RelatedCcb, _In_opt_))
|
||||||
|
_When_(RelatedTypeOfOpen != UnopenedFileObject, _At_(RelatedFileName, _In_))
|
||||||
|
_When_(RelatedTypeOfOpen == UnopenedFileObject, _At_(RelatedFileName, _In_opt_))
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdNormalizeFileNames (
|
CdNormalizeFileNames (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN BOOLEAN OpenByFileId,
|
_In_ BOOLEAN OpenByFileId,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN TYPE_OF_OPEN RelatedTypeOfOpen,
|
_In_ TYPE_OF_OPEN RelatedTypeOfOpen,
|
||||||
IN PCCB RelatedCcb OPTIONAL,
|
PCCB RelatedCcb,
|
||||||
IN PUNICODE_STRING RelatedFileName OPTIONAL,
|
PUNICODE_STRING RelatedFileName,
|
||||||
IN OUT PUNICODE_STRING FileName,
|
_Inout_ PUNICODE_STRING FileName,
|
||||||
IN OUT PCD_NAME RemainingName
|
_Inout_ PCD_NAME RemainingName
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1048,7 +1079,7 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
ULONG RemainingNameLength;
|
ULONG RemainingNameLength = 0;
|
||||||
ULONG RelatedNameLength = 0;
|
ULONG RelatedNameLength = 0;
|
||||||
ULONG SeparatorLength = 0;
|
ULONG SeparatorLength = 0;
|
||||||
|
|
||||||
|
@ -1319,8 +1350,14 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Do a quick check to make sure there are no wildcards.
|
// Do a quick check to make sure there are no wildcards.
|
||||||
//
|
//
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(push)
|
||||||
|
#pragma prefast(suppress:26000, "RemainingName->FileName.Buffer = FileName.Buffer + (RelatedNameLength + SeparatorLength); FileName.MaximumLength < (RelatedNameLength + SeparatorLength + RemainingNameLength).")
|
||||||
|
#endif
|
||||||
if (FsRtlDoesNameContainWildCards( &RemainingName->FileName )) {
|
if (FsRtlDoesNameContainWildCards( &RemainingName->FileName )) {
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
return STATUS_OBJECT_NAME_INVALID;
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
}
|
}
|
||||||
|
@ -1422,7 +1459,14 @@ Return Value:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(push)
|
||||||
|
#pragma prefast(suppress:26030, "RemainingName->FileName.Buffer = FileName.Buffer + (RelatedNameLength + SeparatorLength); FileName.MaximumLength < (RelatedNameLength + SeparatorLength + RemainingNameLength).")
|
||||||
|
#endif
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(pop)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1430,12 +1474,14 @@ Return Value:
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Acquires_exclusive_lock_((*CurrentFcb)->FcbNonpaged->FcbResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdOpenByFileId (
|
CdOpenByFileId (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN OUT PFCB *CurrentFcb
|
_Inout_ PFCB *CurrentFcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1492,7 +1538,7 @@ Return Value:
|
||||||
FILE_ENUM_CONTEXT FileContext;
|
FILE_ENUM_CONTEXT FileContext;
|
||||||
BOOLEAN CleanupFileContext = FALSE;
|
BOOLEAN CleanupFileContext = FALSE;
|
||||||
|
|
||||||
COMPOUND_PATH_ENTRY CompoundPathEntry;
|
COMPOUND_PATH_ENTRY CompoundPathEntry = {{0}};/* ReactOS Change: GCC "missing braces around initializer" */
|
||||||
BOOLEAN CleanupCompoundPathEntry = FALSE;
|
BOOLEAN CleanupCompoundPathEntry = FALSE;
|
||||||
|
|
||||||
FILE_ID FileId;
|
FILE_ID FileId;
|
||||||
|
@ -1512,7 +1558,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Go ahead and figure out the TypeOfOpen and NodeType. We can
|
// Go ahead and figure out the TypeOfOpen and NodeType. We can
|
||||||
|
@ -1722,10 +1768,7 @@ Return Value:
|
||||||
// the Fcb with the size from the self entry.
|
// the Fcb with the size from the self entry.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (NextFcb->FileObject == NULL) {
|
CdVerifyOrCreateDirStreamFile( IrpContext, NextFcb);
|
||||||
|
|
||||||
CdCreateInternalStream( IrpContext, Vcb, NextFcb );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// If our offset is beyond the end of the directory then the
|
// If our offset is beyond the end of the directory then the
|
||||||
|
@ -1883,6 +1926,9 @@ Return Value:
|
||||||
|
|
||||||
*CurrentFcb = NextFcb;
|
*CurrentFcb = NextFcb;
|
||||||
|
|
||||||
|
// Lock object is acquired using internal state
|
||||||
|
_Analysis_suppress_lock_checking_(NextFcb->FcbNonpaged->FcbResource);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the requested access on this Fcb.
|
// Check the requested access on this Fcb.
|
||||||
//
|
//
|
||||||
|
@ -1902,10 +1948,11 @@ Return Value:
|
||||||
TypeOfOpen,
|
TypeOfOpen,
|
||||||
CCB_FLAG_OPEN_BY_ID,
|
CCB_FLAG_OPEN_BY_ID,
|
||||||
IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
|
IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (UnlockVcb) {
|
if (UnlockVcb) {
|
||||||
|
|
||||||
|
@ -1921,7 +1968,7 @@ Return Value:
|
||||||
|
|
||||||
CdCleanupCompoundPathEntry( IrpContext, &CompoundPathEntry );
|
CdCleanupCompoundPathEntry( IrpContext, &CompoundPathEntry );
|
||||||
}
|
}
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -1931,14 +1978,15 @@ Return Value:
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdOpenExistingFcb (
|
CdOpenExistingFcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN TYPE_OF_OPEN TypeOfOpen,
|
_In_ TYPE_OF_OPEN TypeOfOpen,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN PCCB RelatedCcb OPTIONAL
|
_In_opt_ PCCB RelatedCcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -2032,18 +2080,20 @@ Return Value:
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Acquires_lock_((*CurrentFcb)->FcbNonpaged->FcbResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdOpenDirectoryFromPathEntry (
|
CdOpenDirectoryFromPathEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN PCD_NAME DirName,
|
_In_ PCD_NAME DirName,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN BOOLEAN ShortNameMatch,
|
_In_ BOOLEAN ShortNameMatch,
|
||||||
IN PPATH_ENTRY PathEntry,
|
_In_ PPATH_ENTRY PathEntry,
|
||||||
IN BOOLEAN PerformUserOpen,
|
_In_ BOOLEAN PerformUserOpen,
|
||||||
IN PCCB RelatedCcb OPTIONAL
|
_In_opt_ PCCB RelatedCcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -2106,7 +2156,7 @@ Return Value:
|
||||||
PFCB NextFcb;
|
PFCB NextFcb;
|
||||||
PFCB ParentFcb = NULL;
|
PFCB ParentFcb = NULL;
|
||||||
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS; /* ReactOS Change: GCC uninitialized variable */
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -2126,7 +2176,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the related Ccb to see if this was an OpenByFileId.
|
// Check the related Ccb to see if this was an OpenByFileId.
|
||||||
|
@ -2208,6 +2258,9 @@ Return Value:
|
||||||
ParentFcb = *CurrentFcb;
|
ParentFcb = *CurrentFcb;
|
||||||
*CurrentFcb = NextFcb;
|
*CurrentFcb = NextFcb;
|
||||||
|
|
||||||
|
// Lock object is acquired using internal state
|
||||||
|
_Analysis_suppress_lock_checking_(NextFcb->FcbNonpaged->FcbResource);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Store this name into the prefix table for the parent.
|
// Store this name into the prefix table for the parent.
|
||||||
//
|
//
|
||||||
|
@ -2281,7 +2334,7 @@ Return Value:
|
||||||
IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
|
IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unlock the Vcb if held.
|
// Unlock the Vcb if held.
|
||||||
|
@ -2300,7 +2353,7 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseFcb( IrpContext, ParentFcb );
|
CdReleaseFcb( IrpContext, ParentFcb );
|
||||||
}
|
}
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -2310,17 +2363,18 @@ Return Value:
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdOpenFileFromFileContext (
|
CdOpenFileFromFileContext (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN PCD_NAME FileName,
|
_In_ PCD_NAME FileName,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN BOOLEAN ShortNameMatch,
|
_In_ BOOLEAN ShortNameMatch,
|
||||||
IN PFILE_ENUM_CONTEXT FileContext,
|
_In_ PFILE_ENUM_CONTEXT FileContext,
|
||||||
IN PCCB RelatedCcb OPTIONAL
|
_In_opt_ PCCB RelatedCcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -2380,7 +2434,7 @@ Return Value:
|
||||||
PFCB NextFcb;
|
PFCB NextFcb;
|
||||||
PFCB ParentFcb = NULL;
|
PFCB ParentFcb = NULL;
|
||||||
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -2399,7 +2453,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if a version number was used to open this file.
|
// Check if a version number was used to open this file.
|
||||||
|
@ -2554,6 +2608,7 @@ Return Value:
|
||||||
// Release the parent Fcb at this point.
|
// Release the parent Fcb at this point.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Analysis_assume_same_lock_(ParentFcb->FcbNonpaged->FcbResource, NextFcb->FcbNonpaged->FcbResource);
|
||||||
CdReleaseFcb( IrpContext, ParentFcb );
|
CdReleaseFcb( IrpContext, ParentFcb );
|
||||||
ParentFcb = NULL;
|
ParentFcb = NULL;
|
||||||
|
|
||||||
|
@ -2569,7 +2624,7 @@ Return Value:
|
||||||
CcbFlags,
|
CcbFlags,
|
||||||
IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
|
IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unlock the Vcb if held.
|
// Unlock the Vcb if held.
|
||||||
|
@ -2588,7 +2643,7 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseFcb( IrpContext, ParentFcb );
|
CdReleaseFcb( IrpContext, ParentFcb );
|
||||||
}
|
}
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -2598,15 +2653,16 @@ Return Value:
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCompleteFcbOpen (
|
CdCompleteFcbOpen (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN TYPE_OF_OPEN TypeOfOpen,
|
_In_ TYPE_OF_OPEN TypeOfOpen,
|
||||||
IN ULONG UserCcbFlags,
|
_In_ ULONG UserCcbFlags,
|
||||||
IN ACCESS_MASK DesiredAccess
|
_In_ ACCESS_MASK DesiredAccess
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -2745,7 +2801,7 @@ Return Value:
|
||||||
|
|
||||||
IrpContext->TeardownFcb = CurrentFcb;
|
IrpContext->TeardownFcb = CurrentFcb;
|
||||||
|
|
||||||
if (FsRtlCurrentBatchOplock( &Fcb->Oplock )) {
|
if (FsRtlCurrentBatchOplock( CdGetFcbOplock(Fcb) )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We remember if a batch oplock break is underway for the
|
// We remember if a batch oplock break is underway for the
|
||||||
|
@ -2754,7 +2810,7 @@ Return Value:
|
||||||
|
|
||||||
Information = FILE_OPBATCH_BREAK_UNDERWAY;
|
Information = FILE_OPBATCH_BREAK_UNDERWAY;
|
||||||
|
|
||||||
OplockStatus = FsRtlCheckOplock( &Fcb->Oplock,
|
OplockStatus = FsRtlCheckOplock( CdGetFcbOplock(Fcb),
|
||||||
IrpContext->Irp,
|
IrpContext->Irp,
|
||||||
IrpContext,
|
IrpContext,
|
||||||
(PVOID)CdOplockComplete, /* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
(PVOID)CdOplockComplete, /* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
||||||
|
@ -2786,7 +2842,7 @@ Return Value:
|
||||||
// file.
|
// file.
|
||||||
//
|
//
|
||||||
|
|
||||||
OplockStatus = FsRtlCheckOplock( &Fcb->Oplock,
|
OplockStatus = FsRtlCheckOplock( CdGetFcbOplock(Fcb),
|
||||||
IrpContext->Irp,
|
IrpContext->Irp,
|
||||||
IrpContext,
|
IrpContext,
|
||||||
(PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
(PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -26,11 +26,15 @@ Abstract:
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// Tell prefast this is a completion routine
|
||||||
|
IO_COMPLETION_ROUTINE CdDevCtrlCompletionRoutine;
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdDevCtrlCompletionRoutine (
|
CdDevCtrlCompletionRoutine (
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp,
|
_In_ PIRP Irp,
|
||||||
IN PVOID Contxt
|
_In_reads_opt_(_Inexpressible_("varies")) PVOID Contxt
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -40,8 +44,8 @@ CdDevCtrlCompletionRoutine (
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonDevControl (
|
CdCommonDevControl (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -64,8 +68,6 @@ Return Value:
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
PIO_STACK_LOCATION NextIrpSp;
|
PIO_STACK_LOCATION NextIrpSp;
|
||||||
|
|
||||||
// PVOID TargetBuffer = NULL; /* ReactOS Change: GCC unused variable */
|
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -171,10 +173,11 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdDevCtrlCompletionRoutine (
|
CdDevCtrlCompletionRoutine (
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp,
|
_In_ PIRP Irp,
|
||||||
IN PVOID Contxt
|
_In_reads_opt_(_Inexpressible_("varies")) PVOID Contxt
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -26,41 +26,43 @@ Abstract:
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryDirectory (
|
CdQueryDirectory (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PCCB Ccb
|
_In_ PCCB Ccb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdNotifyChangeDirectory (
|
CdNotifyChangeDirectory (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PCCB Ccb
|
_In_ PCCB Ccb
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdInitializeEnumeration (
|
CdInitializeEnumeration (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PCCB Ccb,
|
_Inout_ PCCB Ccb,
|
||||||
IN OUT PFILE_ENUM_CONTEXT FileContext,
|
_Inout_ PFILE_ENUM_CONTEXT FileContext,
|
||||||
OUT PBOOLEAN ReturnNextEntry,
|
_Out_ PBOOLEAN ReturnNextEntry,
|
||||||
OUT PBOOLEAN ReturnSingleEntry,
|
_Out_ PBOOLEAN ReturnSingleEntry,
|
||||||
OUT PBOOLEAN InitialQuery
|
_Out_ PBOOLEAN InitialQuery
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdEnumerateIndex (
|
CdEnumerateIndex (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PCCB Ccb,
|
_In_ PCCB Ccb,
|
||||||
IN OUT PFILE_ENUM_CONTEXT FileContext,
|
_Inout_ PFILE_ENUM_CONTEXT FileContext,
|
||||||
IN BOOLEAN ReturnNextEntry
|
_In_ BOOLEAN ReturnNextEntry
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -72,10 +74,12 @@ CdEnumerateIndex (
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonDirControl (
|
CdCommonDirControl (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -152,13 +156,14 @@ Return Value:
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryDirectory (
|
CdQueryDirectory (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PCCB Ccb
|
_In_ PCCB Ccb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -197,9 +202,9 @@ Return Value:
|
||||||
ULONG VersionStringBytes;
|
ULONG VersionStringBytes;
|
||||||
|
|
||||||
FILE_ENUM_CONTEXT FileContext;
|
FILE_ENUM_CONTEXT FileContext;
|
||||||
PDIRENT ThisDirent;
|
PDIRENT ThisDirent = NULL;
|
||||||
BOOLEAN InitialQuery;
|
BOOLEAN InitialQuery;
|
||||||
BOOLEAN ReturnNextEntry;
|
BOOLEAN ReturnNextEntry = FALSE;
|
||||||
BOOLEAN ReturnSingleEntry;
|
BOOLEAN ReturnSingleEntry;
|
||||||
BOOLEAN Found;
|
BOOLEAN Found;
|
||||||
BOOLEAN DoCcbUpdate = FALSE;
|
BOOLEAN DoCcbUpdate = FALSE;
|
||||||
|
@ -209,7 +214,7 @@ Return Value:
|
||||||
|
|
||||||
ULONG BaseLength;
|
ULONG BaseLength;
|
||||||
|
|
||||||
PFILE_BOTH_DIR_INFORMATION DirInfo = NULL; /* ReactOS Change: GCC Uninit var */
|
PFILE_BOTH_DIR_INFORMATION DirInfo = NULL;
|
||||||
PFILE_NAMES_INFORMATION NamesInfo;
|
PFILE_NAMES_INFORMATION NamesInfo;
|
||||||
PFILE_ID_FULL_DIR_INFORMATION IdFullDirInfo;
|
PFILE_ID_FULL_DIR_INFORMATION IdFullDirInfo;
|
||||||
PFILE_ID_BOTH_DIR_INFORMATION IdBothDirInfo;
|
PFILE_ID_BOTH_DIR_INFORMATION IdBothDirInfo;
|
||||||
|
@ -287,7 +292,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Verify the Fcb is still good.
|
// Verify the Fcb is still good.
|
||||||
|
@ -387,7 +392,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Here are the rules concerning filling up the buffer:
|
// Here are the rules concerning filling up the buffer:
|
||||||
//
|
//
|
||||||
// 1. The Io system guarantees that there will always be
|
// 1. The Io system garentees that there will always be
|
||||||
// enough room for at least one base record.
|
// enough room for at least one base record.
|
||||||
//
|
//
|
||||||
// 2. If the full first record (including file name) cannot
|
// 2. If the full first record (including file name) cannot
|
||||||
|
@ -499,7 +504,7 @@ Return Value:
|
||||||
// such trickery.
|
// such trickery.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Zero and initialize the base part of the current entry.
|
// Zero and initialize the base part of the current entry.
|
||||||
|
@ -543,21 +548,16 @@ Return Value:
|
||||||
|
|
||||||
DirInfo->EndOfFile.QuadPart = DirInfo->AllocationSize.QuadPart = 0;
|
DirInfo->EndOfFile.QuadPart = DirInfo->AllocationSize.QuadPart = 0;
|
||||||
|
|
||||||
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY );
|
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DirInfo->EndOfFile.QuadPart = FileContext.FileSize;
|
DirInfo->EndOfFile.QuadPart = FileContext.FileSize;
|
||||||
DirInfo->AllocationSize.QuadPart = LlSectorAlign( FileContext.FileSize );
|
DirInfo->AllocationSize.QuadPart = LlSectorAlign( FileContext.FileSize );
|
||||||
|
|
||||||
|
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_READONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// All Cdrom files are readonly. We also copy the existence
|
|
||||||
// bit to the hidden attribute.
|
|
||||||
//
|
|
||||||
|
|
||||||
SetFlag( DirInfo->FileAttributes, FILE_ATTRIBUTE_READONLY );
|
|
||||||
|
|
||||||
if (FlagOn( ThisDirent->DirentFlags,
|
if (FlagOn( ThisDirent->DirentFlags,
|
||||||
CD_ATTRIBUTE_HIDDEN )) {
|
CD_ATTRIBUTE_HIDDEN )) {
|
||||||
|
|
||||||
|
@ -715,7 +715,10 @@ Return Value:
|
||||||
LastEntry = NextEntry;
|
LastEntry = NextEntry;
|
||||||
NextEntry = QuadAlign( Information );
|
NextEntry = QuadAlign( Information );
|
||||||
|
|
||||||
} except (EXCEPTION_EXECUTE_HANDLER) {
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(suppress: 6320)
|
||||||
|
#endif
|
||||||
|
} _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We had a problem filling in the user's buffer, so stop and
|
// We had a problem filling in the user's buffer, so stop and
|
||||||
|
@ -724,16 +727,16 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
Information = 0;
|
Information = 0;
|
||||||
try_leave( Status = GetExceptionCode());
|
try_leave( Status = _SEH2_GetExceptionCode());
|
||||||
}
|
} _SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoCcbUpdate = TRUE;
|
DoCcbUpdate = TRUE;
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup our search context - *before* acquiring the FCB mutex exclusive,
|
// Cleanup our search context - *before* aquiring the FCB mutex exclusive,
|
||||||
// else can block on threads in cdcreateinternalstream/purge which
|
// else can block on threads in cdcreateinternalstream/purge which
|
||||||
// hold the FCB but are waiting for all maps in this stream to be released.
|
// hold the FCB but are waiting for all maps in this stream to be released.
|
||||||
//
|
//
|
||||||
|
@ -741,7 +744,7 @@ Return Value:
|
||||||
CdCleanupFileContext( IrpContext, &FileContext );
|
CdCleanupFileContext( IrpContext, &FileContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now we can safely acquire the FCB mutex if we need to.
|
// Now we can safely aqure the FCB mutex if we need to.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (DoCcbUpdate && !NT_ERROR( Status )) {
|
if (DoCcbUpdate && !NT_ERROR( Status )) {
|
||||||
|
@ -769,7 +772,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
CdReleaseFile( IrpContext, Fcb );
|
CdReleaseFile( IrpContext, Fcb );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Complete the request here.
|
// Complete the request here.
|
||||||
|
@ -786,12 +789,13 @@ Return Value:
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdNotifyChangeDirectory (
|
CdNotifyChangeDirectory (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PCCB Ccb
|
_In_ PCCB Ccb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -837,7 +841,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Verify the Vcb.
|
// Verify the Vcb.
|
||||||
|
@ -862,14 +866,14 @@ Return Value:
|
||||||
NULL,
|
NULL,
|
||||||
NULL );
|
NULL );
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the Vcb.
|
// Release the Vcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, IrpContext->Vcb );
|
CdReleaseVcb( IrpContext, IrpContext->Vcb );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup the IrpContext.
|
// Cleanup the IrpContext.
|
||||||
|
@ -887,14 +891,14 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdInitializeEnumeration (
|
CdInitializeEnumeration (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIO_STACK_LOCATION IrpSp,
|
_In_ PIO_STACK_LOCATION IrpSp,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PCCB Ccb,
|
_Inout_ PCCB Ccb,
|
||||||
IN OUT PFILE_ENUM_CONTEXT FileContext,
|
_Inout_ PFILE_ENUM_CONTEXT FileContext,
|
||||||
OUT PBOOLEAN ReturnNextEntry,
|
_Out_ PBOOLEAN ReturnNextEntry,
|
||||||
OUT PBOOLEAN ReturnSingleEntry,
|
_Out_ PBOOLEAN ReturnSingleEntry,
|
||||||
OUT PBOOLEAN InitialQuery
|
_Out_ PBOOLEAN InitialQuery
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -949,6 +953,31 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
//
|
||||||
|
// If the user has specified that the scan be restarted, and has specicified
|
||||||
|
// a new query pattern, reinitialize the CCB.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (FlagOn( IrpSp->Flags, SL_RESTART_SCAN )) {
|
||||||
|
|
||||||
|
CdLockFcb( IrpContext, Fcb );
|
||||||
|
|
||||||
|
FileName = (PUNICODE_STRING) IrpSp->Parameters.QueryDirectory.FileName;
|
||||||
|
if (FileName && FileName->Length > 0) {
|
||||||
|
|
||||||
|
if (!FlagOn( Ccb->Flags, CCB_FLAG_ENUM_MATCH_ALL )) {
|
||||||
|
|
||||||
|
CdFreePool( &Ccb->SearchExpression.FileName.Buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
ClearFlag(Ccb->Flags, CCB_FLAG_ENUM_MATCH_ALL);
|
||||||
|
ClearFlag(Ccb->Flags, CCB_FLAG_ENUM_INITIALIZED);
|
||||||
|
ClearFlag(Ccb->Flags, CCB_FLAG_ENUM_NAME_EXP_HAS_WILD);
|
||||||
|
}
|
||||||
|
|
||||||
|
CdUnlockFcb( IrpContext, Fcb );
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this is the initial query then build a search expression from the input
|
// If this is the initial query then build a search expression from the input
|
||||||
// file name.
|
// file name.
|
||||||
|
@ -1049,8 +1078,8 @@ Return Value:
|
||||||
//
|
//
|
||||||
// This should never fail.
|
// This should never fail.
|
||||||
//
|
//
|
||||||
|
__analysis_assert( Status == STATUS_SUCCESS );
|
||||||
ASSERT( Status == STATUS_SUCCESS );
|
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1189,10 +1218,7 @@ Return Value:
|
||||||
// If there is no file object then create it now.
|
// If there is no file object then create it now.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Fcb->FileObject == NULL) {
|
CdVerifyOrCreateDirStreamFile( IrpContext, Fcb);
|
||||||
|
|
||||||
CdCreateInternalStream( IrpContext, Fcb->Vcb, Fcb );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Determine the offset in the stream to position the FileContext and
|
// Determine the offset in the stream to position the FileContext and
|
||||||
|
@ -1330,10 +1356,10 @@ Return Value:
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdEnumerateIndex (
|
CdEnumerateIndex (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PCCB Ccb,
|
_In_ PCCB Ccb,
|
||||||
IN OUT PFILE_ENUM_CONTEXT FileContext,
|
_Inout_ PFILE_ENUM_CONTEXT FileContext,
|
||||||
IN BOOLEAN ReturnNextEntry
|
_In_ BOOLEAN ReturnNextEntry
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1371,7 +1397,7 @@ Return Value:
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Loop until we find a match or exhaust the directory.
|
// Loop until we find a match or exaust the directory.
|
||||||
//
|
//
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -80,8 +80,8 @@ Abstract:
|
||||||
//
|
//
|
||||||
// PRAW_DIRENT
|
// PRAW_DIRENT
|
||||||
// CdRawDirent (
|
// CdRawDirent (
|
||||||
// IN PIRP_CONTEXT IrpContext,
|
// _In_ PIRP_CONTEXT IrpContext,
|
||||||
// IN PDIR_ENUM_CONTEXT DirContext
|
// _In_ PDIR_ENUM_CONTEXT DirContext
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -94,15 +94,15 @@ Abstract:
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
CdCheckRawDirentBounds (
|
CdCheckRawDirentBounds (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PDIRENT_ENUM_CONTEXT DirContext
|
_In_ PDIRENT_ENUM_CONTEXT DirContext
|
||||||
);
|
);
|
||||||
|
|
||||||
XA_EXTENT_TYPE
|
XA_EXTENT_TYPE
|
||||||
CdCheckForXAExtent (
|
CdCheckForXAExtent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PRAW_DIRENT RawDirent,
|
_In_ PRAW_DIRENT RawDirent,
|
||||||
IN OUT PDIRENT Dirent
|
_Inout_ PDIRENT Dirent
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -123,10 +123,10 @@ CdCheckForXAExtent (
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdLookupDirent (
|
CdLookupDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN ULONG DirentOffset,
|
_In_ ULONG DirentOffset,
|
||||||
OUT PDIRENT_ENUM_CONTEXT DirContext
|
_Out_ PDIRENT_ENUM_CONTEXT DirContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -206,10 +206,10 @@ Return Value:
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdLookupNextDirent (
|
CdLookupNextDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PDIRENT_ENUM_CONTEXT CurrentDirContext,
|
_In_ PDIRENT_ENUM_CONTEXT CurrentDirContext,
|
||||||
OUT PDIRENT_ENUM_CONTEXT NextDirContext
|
_Inout_ PDIRENT_ENUM_CONTEXT NextDirContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -241,7 +241,7 @@ Arguments:
|
||||||
find. This may already point to a dirent so we need to check if
|
find. This may already point to a dirent so we need to check if
|
||||||
we are in the same sector and unmap any buffer as necessary.
|
we are in the same sector and unmap any buffer as necessary.
|
||||||
|
|
||||||
This dirent is left in an indeterminate state if we don't find a dirent.
|
This dirent is left in an indeterminant state if we don't find a dirent.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
|
@ -390,13 +390,14 @@ Return Value:
|
||||||
return FoundDirent;
|
return FoundDirent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_At_(Dirent->CdTime, _Post_notnull_)
|
||||||
VOID
|
VOID
|
||||||
CdUpdateDirentFromRawDirent (
|
CdUpdateDirentFromRawDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PDIRENT_ENUM_CONTEXT DirContext,
|
_In_ PDIRENT_ENUM_CONTEXT DirContext,
|
||||||
IN OUT PDIRENT Dirent
|
_Inout_ PDIRENT Dirent
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -426,6 +427,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( Fcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clear all of the current state flags except the flag indicating that
|
// Clear all of the current state flags except the flag indicating that
|
||||||
// we allocated a name string.
|
// we allocated a name string.
|
||||||
|
@ -465,7 +468,7 @@ Return Value:
|
||||||
// Save a pointer to the time stamps.
|
// Save a pointer to the time stamps.
|
||||||
//
|
//
|
||||||
|
|
||||||
Dirent->CdTime = (PCHAR)RawDirent->RecordTime; /* ReactOS change: GCC "pointer targets in assignment differ in signedness" */
|
Dirent->CdTime = (PCHAR)RawDirent->RecordTime;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copy the dirent flags.
|
// Copy the dirent flags.
|
||||||
|
@ -501,7 +504,7 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
Dirent->FileNameLen = RawDirent->FileIdLen;
|
Dirent->FileNameLen = RawDirent->FileIdLen;
|
||||||
Dirent->FileName = (PCHAR)RawDirent->FileId; /* ReactOS change: GCC "pointer targets in assignment differ in signedness" */
|
Dirent->FileName = (PCHAR)RawDirent->FileId;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there are any remaining bytes at the end of the dirent then
|
// If there are any remaining bytes at the end of the dirent then
|
||||||
|
@ -529,9 +532,9 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdUpdateDirentName (
|
CdUpdateDirentName (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN OUT PDIRENT Dirent,
|
_Inout_ PDIRENT Dirent,
|
||||||
IN ULONG IgnoreCase
|
_In_ ULONG IgnoreCase
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -704,7 +707,8 @@ Return Value:
|
||||||
Dirent->FileName,
|
Dirent->FileName,
|
||||||
Dirent->FileNameLen );
|
Dirent->FileNameLen );
|
||||||
|
|
||||||
ASSERT( Status == STATUS_SUCCESS );
|
__analysis_assert( Status == STATUS_SUCCESS );
|
||||||
|
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||||
Dirent->CdFileName.FileName.Length = (USHORT) Length;
|
Dirent->CdFileName.FileName.Length = (USHORT) Length;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -781,6 +785,11 @@ Return Value:
|
||||||
Dirent->CdFileName.FileName.Length -= sizeof( WCHAR );
|
Dirent->CdFileName.FileName.Length -= sizeof( WCHAR );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CdIsLegalName( IrpContext, &Dirent->CdFileName.FileName )) {
|
||||||
|
|
||||||
|
CdRaiseStatus( IrpContext, STATUS_FILE_CORRUPT_ERROR );
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this an exact case operation then use the filename exactly.
|
// If this an exact case operation then use the filename exactly.
|
||||||
//
|
//
|
||||||
|
@ -811,21 +820,21 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
_Success_(return != FALSE) BOOLEAN
|
||||||
CdFindFile (
|
CdFindFile (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PCD_NAME Name,
|
_In_ PCD_NAME Name,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN OUT PFILE_ENUM_CONTEXT FileContext,
|
_Inout_ PFILE_ENUM_CONTEXT FileContext,
|
||||||
OUT PCD_NAME *MatchingName
|
_Out_ PCD_NAME *MatchingName
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This routine is called to search a directory for a file matching the input
|
This routine is called to search a dirctory for a file matching the input
|
||||||
name. This name has been upcased at this point if this a case-insensitive
|
name. This name has been upcased at this point if this a case-insensitive
|
||||||
search. The name has been separated into separate name and version strings.
|
search. The name has been separated into separate name and version strings.
|
||||||
We look for an exact match in the name and only consider the version if
|
We look for an exact match in the name and only consider the version if
|
||||||
|
@ -864,10 +873,7 @@ Return Value:
|
||||||
// Make sure there is a stream file for this Fcb.
|
// Make sure there is a stream file for this Fcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Fcb->FileObject == NULL) {
|
CdVerifyOrCreateDirStreamFile( IrpContext, Fcb);
|
||||||
|
|
||||||
CdCreateInternalStream( IrpContext, Fcb->Vcb, Fcb );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check to see whether we need to check for a possible short name.
|
// Check to see whether we need to check for a possible short name.
|
||||||
|
@ -989,18 +995,18 @@ Return Value:
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdFindDirectory (
|
CdFindDirectory (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PCD_NAME Name,
|
_In_ PCD_NAME Name,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN OUT PFILE_ENUM_CONTEXT FileContext
|
_Inout_ PFILE_ENUM_CONTEXT FileContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This routine is called to search a directory for a directory matching the input
|
This routine is called to search a dirctory for a directory matching the input
|
||||||
name. This name has been upcased at this point if this a case-insensitive
|
name. This name has been upcased at this point if this a case-insensitive
|
||||||
search. We look for an exact match in the name and do not look for shortname
|
search. We look for an exact match in the name and do not look for shortname
|
||||||
equivalents.
|
equivalents.
|
||||||
|
@ -1033,10 +1039,7 @@ Return Value:
|
||||||
// Make sure there is a stream file for this Fcb.
|
// Make sure there is a stream file for this Fcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Fcb->FileObject == NULL) {
|
CdVerifyOrCreateDirStreamFile( IrpContext, Fcb);
|
||||||
|
|
||||||
CdCreateInternalStream( IrpContext, Fcb->Vcb, Fcb );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Position ourselves at the first entry.
|
// Position ourselves at the first entry.
|
||||||
|
@ -1100,14 +1103,15 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_At_(FileContext->ShortName.FileName.MaximumLength, _In_range_(>=, BYTE_COUNT_8_DOT_3))
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdFindFileByShortName (
|
CdFindFileByShortName (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PCD_NAME Name,
|
_In_ PCD_NAME Name,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN ULONG ShortNameDirentOffset,
|
_In_ ULONG ShortNameDirentOffset,
|
||||||
IN OUT PFILE_ENUM_CONTEXT FileContext
|
_Inout_ PFILE_ENUM_CONTEXT FileContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1153,10 +1157,7 @@ Return Value:
|
||||||
// Make sure there is a stream file for this Fcb.
|
// Make sure there is a stream file for this Fcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Fcb->FileObject == NULL) {
|
CdVerifyOrCreateDirStreamFile( IrpContext, Fcb);
|
||||||
|
|
||||||
CdCreateInternalStream( IrpContext, Fcb->Vcb, Fcb );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Position ourselves at the start of the directory and update
|
// Position ourselves at the start of the directory and update
|
||||||
|
@ -1272,9 +1273,9 @@ Return Value:
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdLookupNextInitialFileDirent (
|
CdLookupNextInitialFileDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_ENUM_CONTEXT FileContext
|
_Inout_ PFILE_ENUM_CONTEXT FileContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1283,7 +1284,7 @@ Routine Description:
|
||||||
|
|
||||||
This routine is called to walk through the directory until we find the
|
This routine is called to walk through the directory until we find the
|
||||||
first possible dirent for file. We are positioned at some point described
|
first possible dirent for file. We are positioned at some point described
|
||||||
by the FileContext. We will walk through any remaining dirents for the
|
by the FileContext. We will walk through any remaing dirents for the
|
||||||
current file until we find the first dirent for some subsequent file.
|
current file until we find the first dirent for some subsequent file.
|
||||||
|
|
||||||
We can be called when we have found just one dirent for a file or all
|
We can be called when we have found just one dirent for a file or all
|
||||||
|
@ -1423,9 +1424,9 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdLookupLastFileDirent (
|
CdLookupLastFileDirent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PFILE_ENUM_CONTEXT FileContext
|
_In_ PFILE_ENUM_CONTEXT FileContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1457,9 +1458,9 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
XA_EXTENT_TYPE ExtentType = 0; /* ReactOS Change: GCC Uninit var */
|
XA_EXTENT_TYPE ExtentType = Form1Data;
|
||||||
PCOMPOUND_DIRENT CurrentCompoundDirent;
|
PCOMPOUND_DIRENT CurrentCompoundDirent;
|
||||||
PDIRENT CurrentDirent;
|
PDIRENT CurrentDirent = NULL;
|
||||||
|
|
||||||
BOOLEAN FirstPass = TRUE;
|
BOOLEAN FirstPass = TRUE;
|
||||||
BOOLEAN FoundDirent;
|
BOOLEAN FoundDirent;
|
||||||
|
@ -1633,8 +1634,8 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdCleanupFileContext (
|
CdCleanupFileContext (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFILE_ENUM_CONTEXT FileContext
|
_In_ PFILE_ENUM_CONTEXT FileContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1661,6 +1662,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup the individual compound dirents.
|
// Cleanup the individual compound dirents.
|
||||||
//
|
//
|
||||||
|
@ -1683,8 +1686,8 @@ Return Value:
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
CdCheckRawDirentBounds (
|
CdCheckRawDirentBounds (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PDIRENT_ENUM_CONTEXT DirContext
|
_In_ PDIRENT_ENUM_CONTEXT DirContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1718,12 +1721,14 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// We should always have at least a byte still available in the
|
// We should always have at least a byte still available in the
|
||||||
// current buffer.
|
// current buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
ASSERT( (DirContext->DataLength - DirContext->SectorOffset) >= 1 );
|
NT_ASSERT( (DirContext->DataLength - DirContext->SectorOffset) >= 1 );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get a pointer to the current dirent.
|
// Get a pointer to the current dirent.
|
||||||
|
@ -1783,9 +1788,9 @@ Return Value:
|
||||||
|
|
||||||
XA_EXTENT_TYPE
|
XA_EXTENT_TYPE
|
||||||
CdCheckForXAExtent (
|
CdCheckForXAExtent (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PRAW_DIRENT RawDirent,
|
_In_ PRAW_DIRENT RawDirent,
|
||||||
IN OUT PDIRENT Dirent
|
_Inout_ PDIRENT Dirent
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1815,6 +1820,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check if there is enough space for the XA system use area.
|
// Check if there is enough space for the XA system use area.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define doit(a,b) { printf("%s %04lx %4lx %s\n", #a, FIELD_OFFSET(a,b), sizeof(d.b), #b); }
|
#define doit(a,b) { printf("%s %04lx %4lx %s\n", #a, FIELD_OFFSET(a,b), sizeof(d.b), #b); }
|
||||||
|
@ -127,7 +127,6 @@ main (argc, argv)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
{
|
{
|
||||||
FCB_DATA d;
|
FCB_DATA d;
|
||||||
doit( FCB_DATA, Oplock );
|
|
||||||
doit( FCB_DATA, FileLock );
|
doit( FCB_DATA, FileLock );
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -475,4 +474,3 @@ main (argc, argv)
|
||||||
doit( SYSTEM_USE_XA, Reserved );
|
doit( SYSTEM_USE_XA, Reserved );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -28,67 +28,68 @@ Abstract:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryBasicInfo (
|
CdQueryBasicInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_BASIC_INFORMATION Buffer,
|
_Out_ PFILE_BASIC_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryStandardInfo (
|
CdQueryStandardInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_STANDARD_INFORMATION Buffer,
|
_Out_ PFILE_STANDARD_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryInternalInfo (
|
CdQueryInternalInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_INTERNAL_INFORMATION Buffer,
|
_Out_ PFILE_INTERNAL_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryEaInfo (
|
CdQueryEaInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_EA_INFORMATION Buffer,
|
_Out_ PFILE_EA_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryPositionInfo (
|
CdQueryPositionInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN OUT PFILE_POSITION_INFORMATION Buffer,
|
_Out_ PFILE_POSITION_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryNameInfo (
|
CdQueryNameInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN OUT PFILE_NAME_INFORMATION Buffer,
|
_Out_ PFILE_NAME_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryAlternateNameInfo (
|
CdQueryAlternateNameInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PCCB Ccb,
|
_In_ PCCB Ccb,
|
||||||
IN OUT PFILE_NAME_INFORMATION Buffer,
|
_Out_ PFILE_NAME_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryNetworkInfo (
|
CdQueryNetworkInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
|
_Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -108,10 +109,11 @@ CdQueryNetworkInfo (
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonQueryInfo (
|
CdCommonQueryInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -165,7 +167,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We only support query on file and directory handles.
|
// We only support query on file and directory handles.
|
||||||
|
@ -191,8 +193,8 @@ Return Value:
|
||||||
|
|
||||||
if (!FlagOn( Fcb->FcbState, FCB_STATE_INITIALIZED )) {
|
if (!FlagOn( Fcb->FcbState, FCB_STATE_INITIALIZED )) {
|
||||||
|
|
||||||
ASSERT( TypeOfOpen == UserDirectoryOpen );
|
NT_ASSERT( TypeOfOpen == UserDirectoryOpen );
|
||||||
CdCreateInternalStream( IrpContext, Fcb->Vcb, Fcb );
|
CdVerifyOrCreateDirStreamFile( IrpContext, Fcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -325,7 +327,7 @@ Return Value:
|
||||||
|
|
||||||
Irp->IoStatus.Information = IrpSp->Parameters.QueryFile.Length - Length;
|
Irp->IoStatus.Information = IrpSp->Parameters.QueryFile.Length - Length;
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the file.
|
// Release the file.
|
||||||
|
@ -335,7 +337,7 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseFile( IrpContext, Fcb );
|
CdReleaseFile( IrpContext, Fcb );
|
||||||
}
|
}
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Complete the request if we didn't raise.
|
// Complete the request if we didn't raise.
|
||||||
|
@ -347,10 +349,11 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonSetInfo (
|
CdCommonSetInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -406,7 +409,7 @@ Return Value:
|
||||||
|
|
||||||
CdAcquireFileShared( IrpContext, Fcb );
|
CdAcquireFileShared( IrpContext, Fcb );
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure the Fcb is in a usable condition. This
|
// Make sure the Fcb is in a usable condition. This
|
||||||
|
@ -445,10 +448,10 @@ Return Value:
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
CdReleaseFile( IrpContext, Fcb );
|
CdReleaseFile( IrpContext, Fcb );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Complete the request if there was no raise.
|
// Complete the request if there was no raise.
|
||||||
|
@ -458,15 +461,18 @@ Return Value:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_Function_class_(FAST_IO_QUERY_BASIC_INFO)
|
||||||
|
_IRQL_requires_same_
|
||||||
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastQueryBasicInfo (
|
CdFastQueryBasicInfo (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN BOOLEAN Wait,
|
_In_ BOOLEAN Wait,
|
||||||
IN OUT PFILE_BASIC_INFORMATION Buffer,
|
_Out_ PFILE_BASIC_INFORMATION Buffer,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus,
|
_Out_ PIO_STATUS_BLOCK IoStatus,
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
_In_ PDEVICE_OBJECT DeviceObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -500,6 +506,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
ASSERT_FILE_OBJECT( FileObject );
|
ASSERT_FILE_OBJECT( FileObject );
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
|
@ -536,7 +544,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only deal with 'good' Fcb's.
|
// Only deal with 'good' Fcb's.
|
||||||
|
@ -566,25 +574,28 @@ Return Value:
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
ExReleaseResourceLite( Fcb->Resource );
|
ExReleaseResourceLite( Fcb->Resource );
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_Function_class_(FAST_IO_QUERY_STANDARD_INFO)
|
||||||
|
_IRQL_requires_same_
|
||||||
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastQueryStdInfo (
|
CdFastQueryStdInfo (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN BOOLEAN Wait,
|
_In_ BOOLEAN Wait,
|
||||||
IN OUT PFILE_STANDARD_INFORMATION Buffer,
|
_Out_ PFILE_STANDARD_INFORMATION Buffer,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus,
|
_Out_ PIO_STATUS_BLOCK IoStatus,
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
_In_ PDEVICE_OBJECT DeviceObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -618,6 +629,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
ASSERT_FILE_OBJECT( FileObject );
|
ASSERT_FILE_OBJECT( FileObject );
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
|
@ -654,7 +667,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only deal with 'good' Fcb's.
|
// Only deal with 'good' Fcb's.
|
||||||
|
@ -694,25 +707,28 @@ Return Value:
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
ExReleaseResourceLite( Fcb->Resource );
|
ExReleaseResourceLite( Fcb->Resource );
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_Function_class_(FAST_IO_QUERY_NETWORK_OPEN_INFO)
|
||||||
|
_IRQL_requires_same_
|
||||||
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastQueryNetworkInfo (
|
CdFastQueryNetworkInfo (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN BOOLEAN Wait,
|
_In_ BOOLEAN Wait,
|
||||||
OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
|
_Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus,
|
_Out_ PIO_STATUS_BLOCK IoStatus,
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
_In_ PDEVICE_OBJECT DeviceObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -746,6 +762,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
ASSERT_FILE_OBJECT( FileObject );
|
ASSERT_FILE_OBJECT( FileObject );
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
|
@ -782,7 +800,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only deal with 'good' Fcb's.
|
// Only deal with 'good' Fcb's.
|
||||||
|
@ -827,12 +845,12 @@ Return Value:
|
||||||
Result = TRUE;
|
Result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
ExReleaseResourceLite( Fcb->Resource );
|
ExReleaseResourceLite( Fcb->Resource );
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
@ -844,10 +862,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryBasicInfo (
|
CdQueryBasicInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_BASIC_INFORMATION Buffer,
|
_Out_ PFILE_BASIC_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -875,6 +893,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// We only support creation, last modify and last write times on Cdfs.
|
// We only support creation, last modify and last write times on Cdfs.
|
||||||
//
|
//
|
||||||
|
@ -903,10 +923,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryStandardInfo (
|
CdQueryStandardInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_STANDARD_INFORMATION Buffer,
|
_Out_ PFILE_STANDARD_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
|
@ -933,6 +953,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// There is only one link and delete is never pending on a Cdrom file.
|
// There is only one link and delete is never pending on a Cdrom file.
|
||||||
//
|
//
|
||||||
|
@ -976,10 +998,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryInternalInfo (
|
CdQueryInternalInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_INTERNAL_INFORMATION Buffer,
|
_Out_ PFILE_INTERNAL_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1007,6 +1029,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Index number is the file Id number in the Fcb.
|
// Index number is the file Id number in the Fcb.
|
||||||
//
|
//
|
||||||
|
@ -1024,10 +1048,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryEaInfo (
|
CdQueryEaInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_EA_INFORMATION Buffer,
|
_Out_ PFILE_EA_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1055,6 +1079,9 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
UNREFERENCED_PARAMETER( Fcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// No Ea's on Cdfs volumes.
|
// No Ea's on Cdfs volumes.
|
||||||
//
|
//
|
||||||
|
@ -1072,10 +1099,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryPositionInfo (
|
CdQueryPositionInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN OUT PFILE_POSITION_INFORMATION Buffer,
|
_Out_ PFILE_POSITION_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1103,6 +1130,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the current position found in the file object.
|
// Get the current position found in the file object.
|
||||||
//
|
//
|
||||||
|
@ -1125,10 +1154,10 @@ Return Value:
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryNameInfo (
|
CdQueryNameInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN OUT PFILE_NAME_INFORMATION Buffer,
|
_Out_ PFILE_NAME_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1159,7 +1188,9 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT(*Length >= sizeof(ULONG));
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
|
NT_ASSERT(*Length >= sizeof(ULONG));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Simply copy the name in the file object to the user's buffer.
|
// Simply copy the name in the file object to the user's buffer.
|
||||||
|
@ -1197,13 +1228,14 @@ Return Value:
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryAlternateNameInfo (
|
CdQueryAlternateNameInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN PCCB Ccb,
|
_In_ PCCB Ccb,
|
||||||
IN OUT PFILE_NAME_INFORMATION Buffer,
|
_Out_ PFILE_NAME_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1237,16 +1269,16 @@ Return Value:
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
DIRENT_ENUM_CONTEXT DirContext;
|
DIRENT_ENUM_CONTEXT DirContext = {0};
|
||||||
DIRENT Dirent;
|
DIRENT Dirent = {0};
|
||||||
|
|
||||||
PUNICODE_STRING NameToUse;
|
PUNICODE_STRING NameToUse;
|
||||||
ULONG DirentOffset;
|
ULONG DirentOffset;
|
||||||
|
|
||||||
COMPOUND_PATH_ENTRY CompoundPathEntry;
|
COMPOUND_PATH_ENTRY CompoundPathEntry = {{0}};/* ReactOS Change: GCC "missing braces around initializer" */
|
||||||
FILE_ENUM_CONTEXT FileContext;
|
FILE_ENUM_CONTEXT FileContext;
|
||||||
|
|
||||||
PFCB ParentFcb;
|
PFCB ParentFcb = NULL;
|
||||||
BOOLEAN ReleaseParentFcb = FALSE;
|
BOOLEAN ReleaseParentFcb = FALSE;
|
||||||
|
|
||||||
BOOLEAN CleanupFileLookup = FALSE;
|
BOOLEAN CleanupFileLookup = FALSE;
|
||||||
|
@ -1278,20 +1310,13 @@ Return Value:
|
||||||
// Use a try-finally to cleanup the structures.
|
// Use a try-finally to cleanup the structures.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
ParentFcb = Fcb->ParentFcb;
|
ParentFcb = Fcb->ParentFcb;
|
||||||
CdAcquireFileShared( IrpContext, ParentFcb );
|
CdAcquireFileShared( IrpContext, ParentFcb );
|
||||||
ReleaseParentFcb = TRUE;
|
ReleaseParentFcb = TRUE;
|
||||||
|
|
||||||
//
|
CdVerifyOrCreateDirStreamFile( IrpContext, ParentFcb);
|
||||||
// Do an unsafe test to see if we need to create a file object.
|
|
||||||
//
|
|
||||||
|
|
||||||
if (ParentFcb->FileObject == NULL) {
|
|
||||||
|
|
||||||
CdCreateInternalStream( IrpContext, ParentFcb->Vcb, ParentFcb );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CdFidIsDirectory( Fcb->FileId)) {
|
if (CdFidIsDirectory( Fcb->FileId)) {
|
||||||
|
|
||||||
|
@ -1396,12 +1421,12 @@ Return Value:
|
||||||
RtlCopyMemory( Buffer->FileName, ShortNameBuffer, Buffer->FileNameLength );
|
RtlCopyMemory( Buffer->FileName, ShortNameBuffer, Buffer->FileNameLength );
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
if (CleanupFileLookup) {
|
if (CleanupFileLookup) {
|
||||||
|
|
||||||
CdCleanupDirContext( IrpContext, &DirContext );
|
CdCleanupDirContext( IrpContext, &DirContext );
|
||||||
CdCleanupDirent( IrpContext, &Dirent );
|
CdCleanupDirent( IrpContext, &Dirent );/* ReactOS Change: GCC "passing argument 1 from incompatible pointer type" */
|
||||||
|
|
||||||
} else if (CleanupDirectoryLookup) {
|
} else if (CleanupDirectoryLookup) {
|
||||||
|
|
||||||
|
@ -1413,7 +1438,7 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseFile( IrpContext, ParentFcb );
|
CdReleaseFile( IrpContext, ParentFcb );
|
||||||
}
|
}
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reduce the available bytes by the amount stored into this buffer.
|
// Reduce the available bytes by the amount stored into this buffer.
|
||||||
|
@ -1434,10 +1459,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdQueryNetworkInfo (
|
CdQueryNetworkInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
|
_Out_ PFILE_NETWORK_OPEN_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -1465,6 +1490,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// We only support creation, last modify and last write times on Cdfs.
|
// We only support creation, last modify and last write times on Cdfs.
|
||||||
//
|
//
|
||||||
|
|
|
@ -13,7 +13,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -33,14 +33,16 @@ Abstract:
|
||||||
#pragma alloc_text(PAGE, CdSetFileObject)
|
#pragma alloc_text(PAGE, CdSetFileObject)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
_When_(TypeOfOpen == UnopenedFileObject, _At_(Fcb, _In_opt_))
|
||||||
|
_When_(TypeOfOpen != UnopenedFileObject, _At_(Fcb, _In_))
|
||||||
VOID
|
VOID
|
||||||
CdSetFileObject (
|
CdSetFileObject (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFILE_OBJECT FileObject,
|
_Inout_ PFILE_OBJECT FileObject,
|
||||||
IN TYPE_OF_OPEN TypeOfOpen,
|
_In_ TYPE_OF_OPEN TypeOfOpen,
|
||||||
IN PFCB Fcb OPTIONAL,
|
PFCB Fcb,
|
||||||
IN PCCB Ccb OPTIONAL
|
_In_opt_ PCCB Ccb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -70,12 +72,14 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// We only have values 0 to 7 available so make sure we didn't
|
// We only have values 0 to 7 available so make sure we didn't
|
||||||
// inadvertantly add a new type.
|
// inadvertantly add a new type.
|
||||||
//
|
//
|
||||||
|
|
||||||
ASSERTMSG( "FileObject types exceed available bits\n", BeyondValidType <= 8 );
|
NT_ASSERTMSG( "FileObject types exceed available bits\n", BeyondValidType <= 8 );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setting a file object to type UnopenedFileObject means just
|
// Setting a file object to type UnopenedFileObject means just
|
||||||
|
@ -94,7 +98,7 @@ Return Value:
|
||||||
// Check that the 3 low-order bits of the Ccb are clear.
|
// Check that the 3 low-order bits of the Ccb are clear.
|
||||||
//
|
//
|
||||||
|
|
||||||
ASSERTMSG( "Ccb is not quad-aligned\n", !FlagOn( ((ULONG_PTR) Ccb), TYPE_OF_OPEN_MASK ));
|
NT_ASSERTMSG( "Ccb is not quad-aligned\n", !FlagOn( ((ULONG_PTR) Ccb), TYPE_OF_OPEN_MASK ));
|
||||||
|
|
||||||
//
|
//
|
||||||
// We will or the type of open into the low order bits of FsContext2
|
// We will or the type of open into the low order bits of FsContext2
|
||||||
|
@ -105,6 +109,9 @@ Return Value:
|
||||||
FileObject->FsContext = Fcb;
|
FileObject->FsContext = Fcb;
|
||||||
FileObject->FsContext2 = Ccb;
|
FileObject->FsContext2 = Ccb;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning( suppress: 4213 )
|
||||||
|
#endif
|
||||||
SetFlag( (*(PULONG_PTR)&FileObject->FsContext2), TypeOfOpen ); /* ReactOS Change: GCC "invalid lvalue in assignment" */
|
SetFlag( (*(PULONG_PTR)&FileObject->FsContext2), TypeOfOpen ); /* ReactOS Change: GCC "invalid lvalue in assignment" */
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -117,13 +124,16 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_When_(return == UnopenedFileObject, _At_(*Fcb, _Post_null_))
|
||||||
|
_When_(return != UnopenedFileObject, _At_(Fcb, _Outptr_))
|
||||||
|
_When_(return == UnopenedFileObject, _At_(*Ccb, _Post_null_))
|
||||||
|
_When_(return != UnopenedFileObject, _At_(Ccb, _Outptr_))
|
||||||
TYPE_OF_OPEN
|
TYPE_OF_OPEN
|
||||||
CdDecodeFileObject (
|
CdDecodeFileObject (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
OUT PFCB *Fcb,
|
PFCB *Fcb,
|
||||||
OUT PCCB *Ccb
|
PCCB *Ccb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -152,6 +162,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If this is an unopened file object then return NULL for the
|
// If this is an unopened file object then return NULL for the
|
||||||
// Fcb/Ccb. Don't trust any other values in the file object.
|
// Fcb/Ccb. Don't trust any other values in the file object.
|
||||||
|
@ -176,6 +188,9 @@ Return Value:
|
||||||
*Fcb = FileObject->FsContext;
|
*Fcb = FileObject->FsContext;
|
||||||
*Ccb = FileObject->FsContext2;
|
*Ccb = FileObject->FsContext2;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning( suppress: 4213 )
|
||||||
|
#endif
|
||||||
ClearFlag( (*(PULONG_PTR)Ccb), TYPE_OF_OPEN_MASK ); /* ReactOS Change: GCC "invalid lvalue in assignment" */
|
ClearFlag( (*(PULONG_PTR)Ccb), TYPE_OF_OPEN_MASK ); /* ReactOS Change: GCC "invalid lvalue in assignment" */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,8 +204,8 @@ Return Value:
|
||||||
|
|
||||||
TYPE_OF_OPEN
|
TYPE_OF_OPEN
|
||||||
CdFastDecodeFileObject (
|
CdFastDecodeFileObject (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
OUT PFCB *Fcb
|
_Out_ PFCB *Fcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -24,8 +24,9 @@ Abstract:
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFspDispatch (
|
CdFspDispatch (
|
||||||
IN PIRP_CONTEXT IrpContext
|
_In_ PVOID Context
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -48,7 +49,8 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
THREAD_CONTEXT ThreadContext;
|
THREAD_CONTEXT ThreadContext = {0};
|
||||||
|
PIRP_CONTEXT IrpContext = Context;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
PIRP Irp = IrpContext->Irp;
|
PIRP Irp = IrpContext->Irp;
|
||||||
|
@ -94,7 +96,7 @@ Return Value:
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reinitialize for the next try at completing this
|
// Reinitialize for the next try at completing this
|
||||||
|
@ -124,7 +126,7 @@ Return Value:
|
||||||
|
|
||||||
case IRP_MJ_CLOSE :
|
case IRP_MJ_CLOSE :
|
||||||
|
|
||||||
ASSERT( FALSE );
|
NT_ASSERT( FALSE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MJ_READ :
|
case IRP_MJ_READ :
|
||||||
|
@ -174,7 +176,7 @@ Return Value:
|
||||||
|
|
||||||
case IRP_MJ_PNP :
|
case IRP_MJ_PNP :
|
||||||
|
|
||||||
ASSERT( FALSE );
|
NT_ASSERT( FALSE );
|
||||||
CdCommonPnp( IrpContext, Irp );
|
CdCommonPnp( IrpContext, Irp );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -184,10 +186,10 @@ Return Value:
|
||||||
CdCompleteRequest( IrpContext, Irp, Status );
|
CdCompleteRequest( IrpContext, Irp, Status );
|
||||||
}
|
}
|
||||||
|
|
||||||
} except( CdExceptionFilter( IrpContext, GetExceptionInformation() )) {
|
} _SEH2_EXCEPT( CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
||||||
|
|
||||||
Status = CdProcessException( IrpContext, Irp, GetExceptionCode() );
|
Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Break out of the loop if we didn't get CANT_WAIT.
|
// Break out of the loop if we didn't get CANT_WAIT.
|
||||||
|
@ -233,6 +235,12 @@ Return Value:
|
||||||
VolDo->OverflowQueueCount -= 1;
|
VolDo->OverflowQueueCount -= 1;
|
||||||
|
|
||||||
Entry = RemoveHeadList( &VolDo->OverflowQueue );
|
Entry = RemoveHeadList( &VolDo->OverflowQueue );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
VolDo->PostedRequestCount -= 1;
|
||||||
|
|
||||||
|
Entry = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeReleaseSpinLock( &VolDo->OverflowQueueSpinLock, SavedIrql );
|
KeReleaseSpinLock( &VolDo->OverflowQueueSpinLock, SavedIrql );
|
||||||
|
@ -242,7 +250,10 @@ Return Value:
|
||||||
// the Ex Worker thread.
|
// the Ex Worker thread.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (Entry == NULL) { break; }
|
if (Entry == NULL) {
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract the IrpContext , Irp, set wait to TRUE, and loop.
|
// Extract the IrpContext , Irp, set wait to TRUE, and loop.
|
||||||
|
@ -254,6 +265,7 @@ Return Value:
|
||||||
|
|
||||||
Irp = IrpContext->Irp;
|
Irp = IrpContext->Irp;
|
||||||
IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
||||||
|
__analysis_assert( IrpSp != 0 );
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -261,15 +273,6 @@ Return Value:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Decrement the PostedRequestCount if there was a volume device object.
|
|
||||||
//
|
|
||||||
|
|
||||||
if (VolDo) {
|
|
||||||
|
|
||||||
InterlockedDecrement( &VolDo->PostedRequestCount );
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -33,8 +33,8 @@ Abstract:
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonLockControl (
|
CdCommonLockControl (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -86,7 +86,7 @@ Return Value:
|
||||||
// This call might post the irp for us.
|
// This call might post the irp for us.
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = FsRtlCheckOplock( &Fcb->Oplock,
|
Status = FsRtlCheckOplock( CdGetFcbOplock(Fcb),
|
||||||
Irp,
|
Irp,
|
||||||
IrpContext,
|
IrpContext,
|
||||||
(PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
(PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
||||||
|
@ -140,15 +140,15 @@ Return Value:
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastLock (
|
CdFastLock (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN PLARGE_INTEGER FileOffset,
|
_In_ PLARGE_INTEGER FileOffset,
|
||||||
IN PLARGE_INTEGER Length,
|
_In_ PLARGE_INTEGER Length,
|
||||||
PEPROCESS ProcessId,
|
_In_ PEPROCESS ProcessId,
|
||||||
ULONG Key,
|
_In_ ULONG Key,
|
||||||
BOOLEAN FailImmediately,
|
_In_ BOOLEAN FailImmediately,
|
||||||
BOOLEAN ExclusiveLock,
|
_In_ BOOLEAN ExclusiveLock,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus,
|
_Out_ PIO_STATUS_BLOCK IoStatus,
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
_In_ PDEVICE_OBJECT DeviceObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -192,6 +192,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
ASSERT_FILE_OBJECT( FileObject );
|
ASSERT_FILE_OBJECT( FileObject );
|
||||||
|
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
|
@ -224,13 +226,13 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We check whether we can proceed based on the state of the file oplocks.
|
// We check whether we can proceed based on the state of the file oplocks.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Fcb->Oplock != NULL) && !FsRtlOplockIsFastIoPossible( &Fcb->Oplock )) {
|
if (!FsRtlOplockIsFastIoPossible( CdGetFcbOplock(Fcb) )) {
|
||||||
|
|
||||||
try_return( NOTHING );
|
try_return( NOTHING );
|
||||||
}
|
}
|
||||||
|
@ -247,7 +249,10 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Now call the FsRtl routine to perform the lock request.
|
// Now call the FsRtl routine to perform the lock request.
|
||||||
//
|
//
|
||||||
/* ReactOS Change: GCC "suggest parentheses around assignment used as truth value" */
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(suppress: 28159, "prefast thinks this is an obsolete routine, but it is ok for CDFS to use it")
|
||||||
|
#endif
|
||||||
if ((Results = FsRtlFastLock( Fcb->FileLock,
|
if ((Results = FsRtlFastLock( Fcb->FileLock,
|
||||||
FileObject,
|
FileObject,
|
||||||
FileOffset,
|
FileOffset,
|
||||||
|
@ -258,7 +263,7 @@ Return Value:
|
||||||
ExclusiveLock,
|
ExclusiveLock,
|
||||||
IoStatus,
|
IoStatus,
|
||||||
NULL,
|
NULL,
|
||||||
FALSE ))) {
|
FALSE )) != FALSE) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set the flag indicating if Fast I/O is questionable. We
|
// Set the flag indicating if Fast I/O is questionable. We
|
||||||
|
@ -275,10 +280,10 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
@ -287,13 +292,13 @@ Return Value:
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastUnlockSingle (
|
CdFastUnlockSingle (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
IN PLARGE_INTEGER FileOffset,
|
_In_ PLARGE_INTEGER FileOffset,
|
||||||
IN PLARGE_INTEGER Length,
|
_In_ PLARGE_INTEGER Length,
|
||||||
PEPROCESS ProcessId,
|
_In_ PEPROCESS ProcessId,
|
||||||
ULONG Key,
|
_In_ ULONG Key,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus,
|
_Out_ PIO_STATUS_BLOCK IoStatus,
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
_In_ PDEVICE_OBJECT DeviceObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -330,6 +335,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -366,13 +373,13 @@ Return Value:
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We check whether we can proceed based on the state of the file oplocks.
|
// We check whether we can proceed based on the state of the file oplocks.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Fcb->Oplock != NULL) && !FsRtlOplockIsFastIoPossible( &Fcb->Oplock )) {
|
if (!FsRtlOplockIsFastIoPossible( CdGetFcbOplock(Fcb) )) {
|
||||||
|
|
||||||
try_return( NOTHING );
|
try_return( NOTHING );
|
||||||
}
|
}
|
||||||
|
@ -416,10 +423,10 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
@ -428,10 +435,10 @@ Return Value:
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastUnlockAll (
|
CdFastUnlockAll (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
PEPROCESS ProcessId,
|
_In_ PEPROCESS ProcessId,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus,
|
_Out_ PIO_STATUS_BLOCK IoStatus,
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
_In_ PDEVICE_OBJECT DeviceObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -462,6 +469,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -498,13 +507,13 @@ Return Value:
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We check whether we can proceed based on the state of the file oplocks.
|
// We check whether we can proceed based on the state of the file oplocks.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Fcb->Oplock != NULL) && !FsRtlOplockIsFastIoPossible( &Fcb->Oplock )) {
|
if (!FsRtlOplockIsFastIoPossible( CdGetFcbOplock(Fcb) )) {
|
||||||
|
|
||||||
try_return( NOTHING );
|
try_return( NOTHING );
|
||||||
}
|
}
|
||||||
|
@ -539,10 +548,10 @@ Return Value:
|
||||||
CdUnlockFcb( IrpContext, Fcb );
|
CdUnlockFcb( IrpContext, Fcb );
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
@ -551,11 +560,11 @@ Return Value:
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdFastUnlockAllByKey (
|
CdFastUnlockAllByKey (
|
||||||
IN PFILE_OBJECT FileObject,
|
_In_ PFILE_OBJECT FileObject,
|
||||||
PVOID ProcessId,
|
_In_ PVOID ProcessId,
|
||||||
ULONG Key,
|
_In_ ULONG Key,
|
||||||
OUT PIO_STATUS_BLOCK IoStatus,
|
_Out_ PIO_STATUS_BLOCK IoStatus,
|
||||||
IN PDEVICE_OBJECT DeviceObject
|
_In_ PDEVICE_OBJECT DeviceObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -588,6 +597,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
|
||||||
IoStatus->Information = 0;
|
IoStatus->Information = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -624,13 +635,13 @@ Return Value:
|
||||||
|
|
||||||
FsRtlEnterFileSystem();
|
FsRtlEnterFileSystem();
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We check whether we can proceed based on the state of the file oplocks.
|
// We check whether we can proceed based on the state of the file oplocks.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((Fcb->Oplock != NULL) && !FsRtlOplockIsFastIoPossible( &Fcb->Oplock )) {
|
if (!FsRtlOplockIsFastIoPossible( CdGetFcbOplock(Fcb) )) {
|
||||||
|
|
||||||
try_return( NOTHING );
|
try_return( NOTHING );
|
||||||
}
|
}
|
||||||
|
@ -666,10 +677,10 @@ Return Value:
|
||||||
CdUnlockFcb( IrpContext, Fcb );
|
CdUnlockFcb( IrpContext, Fcb );
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
FsRtlExitFileSystem();
|
FsRtlExitFileSystem();
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Results;
|
return Results;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -27,6 +27,7 @@ Abstract:
|
||||||
#pragma alloc_text(PAGE, CdDissectName)
|
#pragma alloc_text(PAGE, CdDissectName)
|
||||||
#pragma alloc_text(PAGE, CdGenerate8dot3Name)
|
#pragma alloc_text(PAGE, CdGenerate8dot3Name)
|
||||||
#pragma alloc_text(PAGE, CdFullCompareNames)
|
#pragma alloc_text(PAGE, CdFullCompareNames)
|
||||||
|
#pragma alloc_text(PAGE, CdIsLegalName)
|
||||||
#pragma alloc_text(PAGE, CdIs8dot3Name)
|
#pragma alloc_text(PAGE, CdIs8dot3Name)
|
||||||
#pragma alloc_text(PAGE, CdIsNameInExpression)
|
#pragma alloc_text(PAGE, CdIsNameInExpression)
|
||||||
#pragma alloc_text(PAGE, CdShortNameDirentOffset)
|
#pragma alloc_text(PAGE, CdShortNameDirentOffset)
|
||||||
|
@ -34,10 +35,12 @@ Abstract:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
_Post_satisfies_(_Old_(CdName->FileName.Length) >=
|
||||||
|
CdName->FileName.Length + CdName->VersionString.Length)
|
||||||
VOID
|
VOID
|
||||||
CdConvertNameToCdName (
|
CdConvertNameToCdName (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN OUT PCD_NAME CdName
|
_Inout_ PCD_NAME CdName
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -65,6 +68,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Look for a separator character.
|
// Look for a separator character.
|
||||||
//
|
//
|
||||||
|
@ -103,10 +108,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdConvertBigToLittleEndian (
|
CdConvertBigToLittleEndian (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PCHAR BigEndian,
|
_In_reads_bytes_(ByteCount) PCHAR BigEndian,
|
||||||
IN ULONG ByteCount,
|
_In_ ULONG ByteCount,
|
||||||
OUT PCHAR LittleEndian
|
_Out_writes_bytes_(ByteCount) PCHAR LittleEndian
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -166,7 +171,14 @@ Return Value:
|
||||||
|
|
||||||
while (RemainingByteCount != 0) {
|
while (RemainingByteCount != 0) {
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(push)
|
||||||
|
#pragma prefast(suppress:26014, "RemainingByteCount is even")
|
||||||
|
#endif
|
||||||
*Destination = *Source;
|
*Destination = *Source;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
Source += 2;
|
Source += 2;
|
||||||
Destination += 2;
|
Destination += 2;
|
||||||
|
@ -180,9 +192,9 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdUpcaseName (
|
CdUpcaseName (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PCD_NAME Name,
|
_In_ PCD_NAME Name,
|
||||||
IN OUT PCD_NAME UpcaseName
|
_Inout_ PCD_NAME UpcaseName
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -206,10 +218,11 @@ Return Value:
|
||||||
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
//PVOID NewBuffer; /* ReactOS Change: GCC Uninitialized variable */
|
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the name structures are different then initialize the different components.
|
// If the name structures are different then initialize the different components.
|
||||||
//
|
//
|
||||||
|
@ -242,6 +255,9 @@ Return Value:
|
||||||
// copy the data.
|
// copy the data.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast( suppress:26015, "CD_NAME structures have two UNICODE_STRING structures pointing to the same allocation. there is no way to tell prefast this is the case and that the allocation is always big enough.");
|
||||||
|
#endif
|
||||||
*(UpcaseName->VersionString.Buffer) = L';';
|
*(UpcaseName->VersionString.Buffer) = L';';
|
||||||
|
|
||||||
UpcaseName->VersionString.Buffer += 1;
|
UpcaseName->VersionString.Buffer += 1;
|
||||||
|
@ -260,7 +276,8 @@ Return Value:
|
||||||
// This should never fail.
|
// This should never fail.
|
||||||
//
|
//
|
||||||
|
|
||||||
ASSERT( Status == STATUS_SUCCESS );
|
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||||
|
__analysis_assert( Status == STATUS_SUCCESS );
|
||||||
|
|
||||||
if (Name->VersionString.Length != 0) {
|
if (Name->VersionString.Length != 0) {
|
||||||
|
|
||||||
|
@ -272,7 +289,8 @@ Return Value:
|
||||||
// This should never fail.
|
// This should never fail.
|
||||||
//
|
//
|
||||||
|
|
||||||
ASSERT( Status == STATUS_SUCCESS );
|
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||||
|
__analysis_assert( Status == STATUS_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -281,9 +299,9 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdDissectName (
|
CdDissectName (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN OUT PUNICODE_STRING RemainingName,
|
_Inout_ PUNICODE_STRING RemainingName,
|
||||||
OUT PUNICODE_STRING FinalName
|
_Out_ PUNICODE_STRING FinalName
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -312,6 +330,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the offset of the next component separators.
|
// Find the offset of the next component separators.
|
||||||
//
|
//
|
||||||
|
@ -352,11 +372,63 @@ Return Value:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
CdIsLegalName (
|
||||||
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
|
_In_ PUNICODE_STRING FileName
|
||||||
|
)
|
||||||
|
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
This routine checks if the name is a legal ISO 9660 name.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
FileName - String of bytes containing the name.
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
BOOLEAN - TRUE if this name is a legal, FALSE otherwise.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
{
|
||||||
|
PWCHAR Wchar;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if name corresponds to a legal file name.
|
||||||
|
//
|
||||||
|
|
||||||
|
for (Wchar = FileName->Buffer;
|
||||||
|
Wchar < Add2Ptr( FileName->Buffer, FileName->Length, PWCHAR );
|
||||||
|
Wchar++) {
|
||||||
|
|
||||||
|
if ((*Wchar < 0xff) &&
|
||||||
|
!FsRtlIsAnsiCharacterLegalHpfs( *Wchar, FALSE ) &&
|
||||||
|
(*Wchar != L'"') &&
|
||||||
|
(*Wchar != L'<') &&
|
||||||
|
(*Wchar != L'>') &&
|
||||||
|
(*Wchar != L'|')) {
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdIs8dot3Name (
|
CdIs8dot3Name (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN UNICODE_STRING FileName
|
_In_ UNICODE_STRING FileName
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -378,7 +450,7 @@ Return Value:
|
||||||
|
|
||||||
{
|
{
|
||||||
CHAR DbcsNameBuffer[ BYTE_COUNT_8_DOT_3 ];
|
CHAR DbcsNameBuffer[ BYTE_COUNT_8_DOT_3 ];
|
||||||
STRING DbcsName;
|
STRING DbcsName = {0};
|
||||||
|
|
||||||
PWCHAR NextWchar;
|
PWCHAR NextWchar;
|
||||||
ULONG Count;
|
ULONG Count;
|
||||||
|
@ -388,11 +460,13 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// The length must be less than 24 bytes.
|
// The length must be less than 24 bytes.
|
||||||
//
|
//
|
||||||
|
|
||||||
ASSERT( FileName.Length != 0 );
|
NT_ASSERT( FileName.Length != 0 );
|
||||||
if (FileName.Length > BYTE_COUNT_8_DOT_3) {
|
if (FileName.Length > BYTE_COUNT_8_DOT_3) {
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -474,11 +548,11 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdGenerate8dot3Name (
|
CdGenerate8dot3Name (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PUNICODE_STRING FileName,
|
_In_ PUNICODE_STRING FileName,
|
||||||
IN ULONG DirentOffset,
|
_In_ ULONG DirentOffset,
|
||||||
OUT PWCHAR ShortFileName,
|
_Out_writes_bytes_to_(BYTE_COUNT_8_DOT_3, *ShortByteCount) PWCHAR ShortFileName,
|
||||||
OUT PUSHORT ShortByteCount
|
_Out_ PUSHORT ShortByteCount
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -519,9 +593,10 @@ Return Value:
|
||||||
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
UNICODE_STRING ShortName;
|
UNICODE_STRING ShortName;
|
||||||
UNICODE_STRING BiasedShortName;
|
UNICODE_STRING BiasedShortName;
|
||||||
WCHAR ShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof( WCHAR ) ];
|
WCHAR ShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof( WCHAR ) ] = {0};
|
||||||
WCHAR BiasedShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof( WCHAR ) ];
|
WCHAR BiasedShortNameBuffer[ BYTE_COUNT_8_DOT_3 / sizeof( WCHAR ) ];
|
||||||
|
|
||||||
GENERATE_NAME_CONTEXT NameContext;
|
GENERATE_NAME_CONTEXT NameContext;
|
||||||
|
@ -537,7 +612,7 @@ Return Value:
|
||||||
|
|
||||||
BOOLEAN FoundTilde = FALSE;
|
BOOLEAN FoundTilde = FALSE;
|
||||||
|
|
||||||
OEM_STRING OemName;
|
OEM_STRING OemName = {0};
|
||||||
USHORT OemNameOffset = 0;
|
USHORT OemNameOffset = 0;
|
||||||
BOOLEAN OverflowBuffer = FALSE;
|
BOOLEAN OverflowBuffer = FALSE;
|
||||||
|
|
||||||
|
@ -568,7 +643,7 @@ Return Value:
|
||||||
// into the name in order to reduce the chance of name conflicts. We will use
|
// into the name in order to reduce the chance of name conflicts. We will use
|
||||||
// a tilde character followed by a character representation of the dirent offset.
|
// a tilde character followed by a character representation of the dirent offset.
|
||||||
// This will be the hexadecimal representation of the dirent offset in the directory.
|
// This will be the hexadecimal representation of the dirent offset in the directory.
|
||||||
// It is actually this offset divided by 32 since we don't need the full
|
// It is actuall this offset divided by 32 since we don't need the full
|
||||||
// granularity.
|
// granularity.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -592,9 +667,14 @@ Return Value:
|
||||||
|
|
||||||
Status = RtlUnicodeStringToOemString(&OemName, &ShortName, TRUE);
|
Status = RtlUnicodeStringToOemString(&OemName, &ShortName, TRUE);
|
||||||
|
|
||||||
if (!NT_SUCCESS( Status )) {
|
//
|
||||||
|
// If this failed, bail out. Don't expect any problems other than no mem.
|
||||||
|
//
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, Status );
|
if (!NT_SUCCESS( Status)) {
|
||||||
|
|
||||||
|
NT_ASSERT( STATUS_INSUFFICIENT_RESOURCES == Status);
|
||||||
|
CdRaiseStatus( IrpContext, Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = 0;
|
Length = 0;
|
||||||
|
@ -650,7 +730,7 @@ Return Value:
|
||||||
|
|
||||||
//
|
//
|
||||||
// Figure out the maximum number of characters we can copy of the base
|
// Figure out the maximum number of characters we can copy of the base
|
||||||
// name. We subtract the number of characters in the dirent string from 8.
|
// name. We subract the number of characters in the dirent string from 8.
|
||||||
// We will copy this many characters or stop when we reach a '.' character
|
// We will copy this many characters or stop when we reach a '.' character
|
||||||
// or a '~' character in the name.
|
// or a '~' character in the name.
|
||||||
//
|
//
|
||||||
|
@ -685,19 +765,26 @@ Return Value:
|
||||||
// may use 2 bytes as DBCS characters.
|
// may use 2 bytes as DBCS characters.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(push)
|
||||||
|
#pragma prefast(suppress:26014, "OemNameOffset <= BaseNameOffset throughout this loop; OemName buffer previously allocated based on ShortName's length.")
|
||||||
|
#endif
|
||||||
if (FsRtlIsLeadDbcsCharacter(OemName.Buffer[OemNameOffset])) {
|
if (FsRtlIsLeadDbcsCharacter(OemName.Buffer[OemNameOffset])) {
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
OemNameOffset += 2;
|
OemNameOffset += 2;
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
OemNameOffset++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((OemNameOffset + (BiasedShortName.Length / sizeof(WCHAR))) > 8) {
|
if ((OemNameOffset + (BiasedShortName.Length / sizeof(WCHAR))) > 8) {
|
||||||
|
|
||||||
OverflowBuffer = TRUE;
|
OverflowBuffer = TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
OemNameOffset++;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only copy the bytes if we still have space for the dirent string.
|
// Only copy the bytes if we still have space for the dirent string.
|
||||||
|
@ -719,9 +806,15 @@ Return Value:
|
||||||
// Now copy the dirent string into the biased name buffer.
|
// Now copy the dirent string into the biased name buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(push)
|
||||||
|
#endif
|
||||||
RtlCopyMemory( NextWchar,
|
RtlCopyMemory( NextWchar,
|
||||||
BiasedShortName.Buffer,
|
BiasedShortName.Buffer,
|
||||||
BiasedShortName.Length );
|
BiasedShortName.Length );
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
Length += BiasedShortName.Length;
|
Length += BiasedShortName.Length;
|
||||||
NextWchar += (BiasedShortName.Length / sizeof( WCHAR ));
|
NextWchar += (BiasedShortName.Length / sizeof( WCHAR ));
|
||||||
|
@ -744,18 +837,16 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
*ShortByteCount = Length;
|
*ShortByteCount = Length;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdIsNameInExpression (
|
CdIsNameInExpression (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PCD_NAME CurrentName,
|
_In_ PCD_NAME CurrentName,
|
||||||
IN PCD_NAME SearchExpression,
|
_In_ PCD_NAME SearchExpression,
|
||||||
IN ULONG WildcardFlags,
|
_In_ ULONG WildcardFlags,
|
||||||
IN BOOLEAN CheckVersion
|
_In_ BOOLEAN CheckVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -791,6 +882,8 @@ Return Value:
|
||||||
BOOLEAN Match = TRUE;
|
BOOLEAN Match = TRUE;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// If there are wildcards in the expression then we call the
|
// If there are wildcards in the expression then we call the
|
||||||
// appropriate FsRtlRoutine.
|
// appropriate FsRtlRoutine.
|
||||||
|
@ -860,8 +953,8 @@ Return Value:
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
CdShortNameDirentOffset (
|
CdShortNameDirentOffset (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PUNICODE_STRING Name
|
_In_ PUNICODE_STRING Name
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -894,6 +987,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Walk through the name until we either reach the end of the name
|
// Walk through the name until we either reach the end of the name
|
||||||
// or find a tilde character.
|
// or find a tilde character.
|
||||||
|
@ -967,9 +1062,9 @@ Return Value:
|
||||||
|
|
||||||
FSRTL_COMPARISON_RESULT
|
FSRTL_COMPARISON_RESULT
|
||||||
CdFullCompareNames (
|
CdFullCompareNames (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PUNICODE_STRING NameA,
|
_In_ PUNICODE_STRING NameA,
|
||||||
IN PUNICODE_STRING NameB
|
_In_ PUNICODE_STRING NameB
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -987,8 +1082,8 @@ Return Value:
|
||||||
|
|
||||||
COMPARISON - returns
|
COMPARISON - returns
|
||||||
|
|
||||||
LessThan if NameA < NameB lexicographically,
|
LessThan if NameA < NameB lexicalgraphically,
|
||||||
GreaterThan if NameA > NameB lexicographically,
|
GreaterThan if NameA > NameB lexicalgraphically,
|
||||||
EqualTo if NameA is equal to NameB
|
EqualTo if NameA is equal to NameB
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
@ -1000,6 +1095,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Figure out the minimum of the two lengths
|
// Figure out the minimum of the two lengths
|
||||||
//
|
//
|
||||||
|
@ -1016,7 +1113,7 @@ Return Value:
|
||||||
|
|
||||||
//
|
//
|
||||||
// Loop through looking at all of the characters in both strings
|
// Loop through looking at all of the characters in both strings
|
||||||
// testing for equality, less than, and greater than
|
// testing for equalilty, less than, and greater than
|
||||||
//
|
//
|
||||||
|
|
||||||
i = RtlCompareMemory( NameA->Buffer, NameB->Buffer, MinLength );
|
i = RtlCompareMemory( NameA->Buffer, NameB->Buffer, MinLength );
|
||||||
|
|
|
@ -19,7 +19,7 @@ Abstract:
|
||||||
#ifndef _CDNODETYPE_
|
#ifndef _CDNODETYPE_
|
||||||
#define _CDNODETYPE_
|
#define _CDNODETYPE_
|
||||||
|
|
||||||
typedef CSHORT NODE_TYPE_CODE;
|
typedef USHORT NODE_TYPE_CODE;
|
||||||
typedef NODE_TYPE_CODE *PNODE_TYPE_CODE;
|
typedef NODE_TYPE_CODE *PNODE_TYPE_CODE;
|
||||||
|
|
||||||
#define NTC_UNDEFINED ((NODE_TYPE_CODE)0x0000)
|
#define NTC_UNDEFINED ((NODE_TYPE_CODE)0x0000)
|
||||||
|
@ -90,15 +90,16 @@ typedef CSHORT NODE_BYTE_SIZE;
|
||||||
#define CDFS_BUG_CHECK_PNP (0x00140000)
|
#define CDFS_BUG_CHECK_PNP (0x00140000)
|
||||||
#define CDFS_BUG_CHECK_PREFXSUP (0x00150000)
|
#define CDFS_BUG_CHECK_PREFXSUP (0x00150000)
|
||||||
#define CDFS_BUG_CHECK_READ (0x00160000)
|
#define CDFS_BUG_CHECK_READ (0x00160000)
|
||||||
#define CDFS_BUG_CHECK_RESRCSUP (0x00170000)
|
#define CDFS_BUG_CHECK_WRITE (0x00170000)
|
||||||
#define CDFS_BUG_CHECK_STRUCSUP (0x00180000)
|
#define CDFS_BUG_CHECK_RESRCSUP (0x00180000)
|
||||||
#define CDFS_BUG_CHECK_TIMESUP (0x00190000)
|
#define CDFS_BUG_CHECK_STRUCSUP (0x00190000)
|
||||||
#define CDFS_BUG_CHECK_VERFYSUP (0x001a0000)
|
#define CDFS_BUG_CHECK_TIMESUP (0x001a0000)
|
||||||
#define CDFS_BUG_CHECK_VOLINFO (0x001b0000)
|
#define CDFS_BUG_CHECK_VERFYSUP (0x001b0000)
|
||||||
#define CDFS_BUG_CHECK_WORKQUE (0x001c0000)
|
#define CDFS_BUG_CHECK_VOLINFO (0x001c0000)
|
||||||
|
#define CDFS_BUG_CHECK_WORKQUE (0x001d0000)
|
||||||
|
#define CDFS_BUG_CHECK_SHUTDOWN (0x001e0000)
|
||||||
|
|
||||||
|
|
||||||
/* ReactOS Change: Need to add to reactos.mc */
|
|
||||||
#define CDFS_FILE_SYSTEM ((ULONG)0x00000026L)
|
|
||||||
#define CdBugCheck(A,B,C) { KeBugCheckEx(CDFS_FILE_SYSTEM, BugCheckFileId | __LINE__, A, B, C ); }
|
#define CdBugCheck(A,B,C) { KeBugCheckEx(CDFS_FILE_SYSTEM, BugCheckFileId | __LINE__, A, B, C ); }
|
||||||
|
|
||||||
#endif // _NODETYPE_
|
#endif // _NODETYPE_
|
||||||
|
|
|
@ -22,7 +22,7 @@ Abstract:
|
||||||
of the tree. The children of a given directory will be grouped together.
|
of the tree. The children of a given directory will be grouped together.
|
||||||
|
|
||||||
The directories are assigned ordinal numbers based on their position in
|
The directories are assigned ordinal numbers based on their position in
|
||||||
the path table. The root directory is assigned ordinal value 1.
|
the path table. The root dirctory is assigned ordinal value 1.
|
||||||
|
|
||||||
Path table sectors:
|
Path table sectors:
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -88,8 +88,8 @@ Abstract:
|
||||||
//
|
//
|
||||||
// PRAW_PATH_ENTRY
|
// PRAW_PATH_ENTRY
|
||||||
// CdRawPathEntry (
|
// CdRawPathEntry (
|
||||||
// IN PIRP_CONTEXT IrpContext,
|
// _In_ PIRP_CONTEXT IrpContext,
|
||||||
// IN PPATH_ENUM_CONTEXT PathContext
|
// _In_ PPATH_ENUM_CONTEXT PathContext
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -102,19 +102,20 @@ Abstract:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdMapPathTableBlock (
|
CdMapPathTableBlock (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN LONGLONG BaseOffset,
|
_In_ LONGLONG BaseOffset,
|
||||||
IN OUT PPATH_ENUM_CONTEXT PathContext
|
_Inout_ PPATH_ENUM_CONTEXT PathContext
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdUpdatePathEntryFromRawPathEntry (
|
CdUpdatePathEntryFromRawPathEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN ULONG Ordinal,
|
_In_ ULONG Ordinal,
|
||||||
IN BOOLEAN VerifyBounds,
|
_In_ BOOLEAN VerifyBounds,
|
||||||
IN PPATH_ENUM_CONTEXT PathContext,
|
_In_ PPATH_ENUM_CONTEXT PathContext,
|
||||||
OUT PPATH_ENTRY PathEntry
|
_Out_ PPATH_ENTRY PathEntry
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -129,11 +130,11 @@ CdUpdatePathEntryFromRawPathEntry (
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdLookupPathEntry (
|
CdLookupPathEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN ULONG PathEntryOffset,
|
_In_ ULONG PathEntryOffset,
|
||||||
IN ULONG Ordinal,
|
_In_ ULONG Ordinal,
|
||||||
IN BOOLEAN VerifyBounds,
|
_In_ BOOLEAN VerifyBounds,
|
||||||
IN OUT PCOMPOUND_PATH_ENTRY CompoundPathEntry
|
_Inout_ PCOMPOUND_PATH_ENTRY CompoundPathEntry
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -204,9 +205,9 @@ Return Value:
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdLookupNextPathEntry (
|
CdLookupNextPathEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN OUT PPATH_ENUM_CONTEXT PathContext,
|
_Inout_ PPATH_ENUM_CONTEXT PathContext,
|
||||||
IN OUT PPATH_ENTRY PathEntry
|
_Inout_ PPATH_ENTRY PathEntry
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -296,14 +297,14 @@ Return Value:
|
||||||
PathEntry );
|
PathEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdFindPathEntry (
|
CdFindPathEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB ParentFcb,
|
_In_ PFCB ParentFcb,
|
||||||
IN PCD_NAME DirName,
|
_In_ PCD_NAME DirName,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN OUT PCOMPOUND_PATH_ENTRY CompoundPathEntry
|
_Inout_ PCOMPOUND_PATH_ENTRY CompoundPathEntry
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -481,10 +482,10 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdMapPathTableBlock (
|
CdMapPathTableBlock (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_In_ PFCB Fcb,
|
||||||
IN LONGLONG BaseOffset,
|
_In_ LONGLONG BaseOffset,
|
||||||
IN OUT PPATH_ENUM_CONTEXT PathContext
|
_Inout_ PPATH_ENUM_CONTEXT PathContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -493,7 +494,7 @@ Routine Description:
|
||||||
|
|
||||||
This routine is called to map (or allocate and copy) the next
|
This routine is called to map (or allocate and copy) the next
|
||||||
data block in the path table. We check if the next block will
|
data block in the path table. We check if the next block will
|
||||||
span a view boundary and allocate an auxiliary buffer in that case.
|
span a view boundary and allocate an auxilary buffer in that case.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
|
@ -519,9 +520,11 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Map the new block and set the enumeration context to this
|
// Map the new block and set the enumeration context to this
|
||||||
// point. Allocate an auxiliary buffer if necessary.
|
// point. Allocate an auxilary buffer if necessary.
|
||||||
//
|
//
|
||||||
|
|
||||||
CurrentLength = 2 * SECTOR_SIZE;
|
CurrentLength = 2 * SECTOR_SIZE;
|
||||||
|
@ -564,7 +567,7 @@ Return Value:
|
||||||
(FlagOn( ((ULONG) BaseOffset), VACB_MAPPING_MASK ) == LAST_VACB_SECTOR_OFFSET )) {
|
(FlagOn( ((ULONG) BaseOffset), VACB_MAPPING_MASK ) == LAST_VACB_SECTOR_OFFSET )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Map each sector individually and store into an auxiliary
|
// Map each sector individually and store into an auxilary
|
||||||
// buffer.
|
// buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -605,7 +608,7 @@ Return Value:
|
||||||
|
|
||||||
//
|
//
|
||||||
// There is a slight chance that we have allocated an
|
// There is a slight chance that we have allocated an
|
||||||
// auxiliary buffer on the previous sector.
|
// auxilary buffer on the previous sector.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (PathContext->AllocatedData) {
|
if (PathContext->AllocatedData) {
|
||||||
|
@ -629,14 +632,14 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
_Success_(return != FALSE)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdUpdatePathEntryFromRawPathEntry (
|
CdUpdatePathEntryFromRawPathEntry (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN ULONG Ordinal,
|
_In_ ULONG Ordinal,
|
||||||
IN BOOLEAN VerifyBounds,
|
_In_ BOOLEAN VerifyBounds,
|
||||||
IN PPATH_ENUM_CONTEXT PathContext,
|
_In_ PPATH_ENUM_CONTEXT PathContext,
|
||||||
OUT PPATH_ENTRY PathEntry
|
_Out_ PPATH_ENTRY PathEntry
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -764,7 +767,7 @@ Return Value:
|
||||||
|
|
||||||
PathEntry->PathEntryLength = WordAlign( PathEntry->PathEntryLength );
|
PathEntry->PathEntryLength = WordAlign( PathEntry->PathEntryLength );
|
||||||
|
|
||||||
PathEntry->DirName = (PCHAR)RawPathEntry->DirId; /* ReactOS Change: GCC "assignment makes pointer from integer without a cast" */
|
PathEntry->DirName = (PCHAR)RawPathEntry->DirId;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -776,9 +779,9 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdUpdatePathEntryName (
|
CdUpdatePathEntryName (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN OUT PPATH_ENTRY PathEntry,
|
_Inout_ PPATH_ENTRY PathEntry,
|
||||||
IN BOOLEAN IgnoreCase
|
_In_ BOOLEAN IgnoreCase
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -789,7 +792,7 @@ Routine Description:
|
||||||
path entry. If this is a Joliet name then we will make sure we have
|
path entry. If this is a Joliet name then we will make sure we have
|
||||||
an allocated buffer and need to convert from big endian to little
|
an allocated buffer and need to convert from big endian to little
|
||||||
endian. We also correctly update the case name. If this operation is ignore
|
endian. We also correctly update the case name. If this operation is ignore
|
||||||
case then we need an auxiliary buffer for the name.
|
case then we need an auxilary buffer for the name.
|
||||||
|
|
||||||
For an Ansi disk we can use the name from the disk for the exact case. We only
|
For an Ansi disk we can use the name from the disk for the exact case. We only
|
||||||
need to allocate a buffer for the ignore case name. The on-disk representation of
|
need to allocate a buffer for the ignore case name. The on-disk representation of
|
||||||
|
@ -828,7 +831,7 @@ Return Value:
|
||||||
// There should be no allocated buffers.
|
// There should be no allocated buffers.
|
||||||
//
|
//
|
||||||
|
|
||||||
ASSERT( !FlagOn( PathEntry->Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER ));
|
NT_ASSERT( !FlagOn( PathEntry->Flags, PATH_ENTRY_FLAG_ALLOC_BUFFER ));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now use one of the hard coded directory names.
|
// Now use one of the hard coded directory names.
|
||||||
|
@ -931,7 +934,8 @@ Return Value:
|
||||||
PathEntry->DirName,
|
PathEntry->DirName,
|
||||||
PathEntry->DirNameLen );
|
PathEntry->DirNameLen );
|
||||||
|
|
||||||
ASSERT( Status == STATUS_SUCCESS );
|
NT_ASSERT( Status == STATUS_SUCCESS );
|
||||||
|
__analysis_assert( Status == STATUS_SUCCESS );
|
||||||
PathEntry->CdDirName.FileName.Length = (USHORT) Length;
|
PathEntry->CdDirName.FileName.Length = (USHORT) Length;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -22,39 +22,51 @@ Abstract:
|
||||||
|
|
||||||
#define BugCheckFileId (CDFS_BUG_CHECK_PNP)
|
#define BugCheckFileId (CDFS_BUG_CHECK_PNP)
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_nonreentrant_lock_(CdData.DataResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPnpQueryRemove (
|
CdPnpQueryRemove (
|
||||||
PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_nonreentrant_lock_(CdData.DataResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPnpRemove (
|
CdPnpRemove (
|
||||||
PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_nonreentrant_lock_(CdData.DataResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPnpSurpriseRemove (
|
CdPnpSurpriseRemove (
|
||||||
PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_nonreentrant_lock_(CdData.DataResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPnpCancelRemove (
|
CdPnpCancelRemove (
|
||||||
PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Tell prefast this is a completion routine.
|
||||||
|
IO_COMPLETION_ROUTINE CdPnpCompletionRoutine;
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdPnpCompletionRoutine (
|
CdPnpCompletionRoutine (
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp,
|
_In_ PIRP Irp,
|
||||||
IN PVOID Contxt
|
_In_reads_opt_(_Inexpressible_("varies")) PVOID Contxt
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -65,11 +77,11 @@ CdPnpCompletionRoutine (
|
||||||
#pragma alloc_text(PAGE, CdPnpSurpriseRemove)
|
#pragma alloc_text(PAGE, CdPnpSurpriseRemove)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonPnp (
|
CdCommonPnp (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -90,7 +102,7 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
BOOLEAN PassThrough = FALSE;
|
BOOLEAN PassThrough = FALSE;
|
||||||
|
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
|
@ -98,6 +110,11 @@ Return Value:
|
||||||
PVOLUME_DEVICE_OBJECT OurDeviceObject;
|
PVOLUME_DEVICE_OBJECT OurDeviceObject;
|
||||||
PVCB Vcb;
|
PVCB Vcb;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
// Global lock object is acquired based on internal book-keeping
|
||||||
|
_Analysis_suppress_lock_checking_(CdData.DataResource);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the current Irp stack location.
|
// Get the current Irp stack location.
|
||||||
//
|
//
|
||||||
|
@ -126,6 +143,9 @@ Return Value:
|
||||||
// field that takes us past the end of an ordinary device object.
|
// field that takes us past the end of an ordinary device object.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the size member is allowed")
|
||||||
|
#endif
|
||||||
if (OurDeviceObject->DeviceObject.Size != sizeof(VOLUME_DEVICE_OBJECT) ||
|
if (OurDeviceObject->DeviceObject.Size != sizeof(VOLUME_DEVICE_OBJECT) ||
|
||||||
NodeType( &OurDeviceObject->Vcb ) != CDFS_NTC_VCB) {
|
NodeType( &OurDeviceObject->Vcb ) != CDFS_NTC_VCB) {
|
||||||
|
|
||||||
|
@ -214,12 +234,13 @@ Return Value:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_nonreentrant_lock_(CdData.DataResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPnpQueryRemove (
|
CdPnpQueryRemove (
|
||||||
PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -250,6 +271,8 @@ Return Value:
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
BOOLEAN VcbPresent = TRUE;
|
BOOLEAN VcbPresent = TRUE;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT_EXCLUSIVE_CDDATA;
|
ASSERT_EXCLUSIVE_CDDATA;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -325,7 +348,7 @@ Return Value:
|
||||||
|
|
||||||
if (Status == STATUS_PENDING) {
|
if (Status == STATUS_PENDING) {
|
||||||
|
|
||||||
KeWaitForSingleObject( &Event,
|
(VOID)KeWaitForSingleObject( &Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -342,7 +365,7 @@ Return Value:
|
||||||
// Since we were able to lock the volume, we are guaranteed to
|
// Since we were able to lock the volume, we are guaranteed to
|
||||||
// move this volume into dismount state and disconnect it from
|
// move this volume into dismount state and disconnect it from
|
||||||
// the underlying storage stack. The force on our part is actually
|
// the underlying storage stack. The force on our part is actually
|
||||||
// unnecessary, though complete.
|
// unnecesary, though complete.
|
||||||
//
|
//
|
||||||
// What is not strictly guaranteed, though, is that the closes
|
// What is not strictly guaranteed, though, is that the closes
|
||||||
// for the metadata streams take effect synchronously underneath
|
// for the metadata streams take effect synchronously underneath
|
||||||
|
@ -354,7 +377,7 @@ Return Value:
|
||||||
|
|
||||||
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
VcbPresent = CdCheckForDismount( IrpContext, Vcb, TRUE );
|
||||||
|
|
||||||
ASSERT( !VcbPresent || Vcb->VcbCondition == VcbDismountInProgress );
|
NT_ASSERT( !VcbPresent || Vcb->VcbCondition == VcbDismountInProgress );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -371,7 +394,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
// The reason this is the case is that handles/fileobjects place a reference
|
// The reason this is the case is that handles/fileobjects place a reference
|
||||||
// on the device objects they overly. In the filesystem case, these references
|
// on the device objects they overly. In the filesystem case, these references
|
||||||
// are on our target devices. PnP correctly thinks that if references remain
|
// are on our target devices. PnP correcly thinks that if references remain
|
||||||
// on the device objects in the stack that someone has a handle, and that this
|
// on the device objects in the stack that someone has a handle, and that this
|
||||||
// counts as a reason to not succeed the query - even though every interrogated
|
// counts as a reason to not succeed the query - even though every interrogated
|
||||||
// driver thinks that it is OK.
|
// driver thinks that it is OK.
|
||||||
|
@ -391,11 +414,14 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_Analysis_assume_lock_not_held_(Vcb->VcbResource);
|
||||||
|
}
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext );
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup our IrpContext and complete the IRP if necessary.
|
// Cleanup our IrpContext and complete the IRP if neccesary.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdCompleteRequest( IrpContext, Irp, Status );
|
CdCompleteRequest( IrpContext, Irp, Status );
|
||||||
|
@ -403,12 +429,13 @@ Return Value:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_nonreentrant_lock_(CdData.DataResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPnpRemove (
|
CdPnpRemove (
|
||||||
PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -437,6 +464,8 @@ Return Value:
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
BOOLEAN VcbPresent = TRUE;
|
BOOLEAN VcbPresent = TRUE;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT_EXCLUSIVE_CDDATA;
|
ASSERT_EXCLUSIVE_CDDATA;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -446,7 +475,7 @@ Return Value:
|
||||||
// (the only case in which this will be the first warning).
|
// (the only case in which this will be the first warning).
|
||||||
//
|
//
|
||||||
// Note that it is entirely unlikely that we will be around
|
// Note that it is entirely unlikely that we will be around
|
||||||
// for a REMOVE in the first two cases, as we try to initiate
|
// for a REMOVE in the first two cases, as we try to intiate
|
||||||
// dismount.
|
// dismount.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -515,7 +544,7 @@ Return Value:
|
||||||
|
|
||||||
if (Status == STATUS_PENDING) {
|
if (Status == STATUS_PENDING) {
|
||||||
|
|
||||||
KeWaitForSingleObject( &Event,
|
(VOID)KeWaitForSingleObject( &Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -527,7 +556,7 @@ Return Value:
|
||||||
//
|
//
|
||||||
// Now make our dismount happen. This may not vaporize the
|
// Now make our dismount happen. This may not vaporize the
|
||||||
// Vcb, of course, since there could be any number of handles
|
// Vcb, of course, since there could be any number of handles
|
||||||
// outstanding if we were not preceded by a QUERY.
|
// outstanding if we were not preceeded by a QUERY.
|
||||||
//
|
//
|
||||||
// PnP will take care of disconnecting this stack if we
|
// PnP will take care of disconnecting this stack if we
|
||||||
// couldn't get off of it immediately.
|
// couldn't get off of it immediately.
|
||||||
|
@ -544,6 +573,9 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_Analysis_assume_lock_not_held_(Vcb->VcbResource);
|
||||||
|
}
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext );
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
|
@ -556,12 +588,13 @@ Return Value:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_nonreentrant_lock_(CdData.DataResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPnpSurpriseRemove (
|
CdPnpSurpriseRemove (
|
||||||
PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -596,6 +629,8 @@ Return Value:
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
BOOLEAN VcbPresent = TRUE;
|
BOOLEAN VcbPresent = TRUE;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT_EXCLUSIVE_CDDATA;
|
ASSERT_EXCLUSIVE_CDDATA;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -653,7 +688,7 @@ Return Value:
|
||||||
|
|
||||||
if (Status == STATUS_PENDING) {
|
if (Status == STATUS_PENDING) {
|
||||||
|
|
||||||
KeWaitForSingleObject( &Event,
|
(VOID)KeWaitForSingleObject( &Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -679,6 +714,9 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_Analysis_assume_lock_not_held_(Vcb->VcbResource);
|
||||||
|
}
|
||||||
|
|
||||||
CdReleaseCdData( IrpContext );
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
|
@ -691,12 +729,13 @@ Return Value:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_nonreentrant_lock_(CdData.DataResource)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPnpCancelRemove (
|
CdPnpCancelRemove (
|
||||||
PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -723,6 +762,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT_EXCLUSIVE_CDDATA;
|
ASSERT_EXCLUSIVE_CDDATA;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -774,19 +815,22 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdPnpCompletionRoutine (
|
CdPnpCompletionRoutine (
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
_In_ PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp,
|
_In_ PIRP Irp,
|
||||||
IN PVOID Contxt
|
_In_reads_opt_(_Inexpressible_("varies")) PVOID Contxt
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PKEVENT Event = (PKEVENT) Contxt;
|
PKEVENT Event = (PKEVENT) Contxt;
|
||||||
|
_Analysis_assume_(Contxt != NULL);
|
||||||
|
|
||||||
KeSetEvent( Event, 0, FALSE );
|
KeSetEvent( Event, 0, FALSE );
|
||||||
|
|
||||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER( DeviceObject );
|
UNREFERENCED_PARAMETER( DeviceObject );
|
||||||
|
UNREFERENCED_PARAMETER( Irp );
|
||||||
UNREFERENCED_PARAMETER( Contxt );
|
UNREFERENCED_PARAMETER( Contxt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -27,16 +27,16 @@ Abstract:
|
||||||
|
|
||||||
PNAME_LINK
|
PNAME_LINK
|
||||||
CdFindNameLink (
|
CdFindNameLink (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PRTL_SPLAY_LINKS *RootNode,
|
_In_ PRTL_SPLAY_LINKS *RootNode,
|
||||||
IN PUNICODE_STRING Name
|
_In_ PUNICODE_STRING Name
|
||||||
);
|
);
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdInsertNameLink (
|
CdInsertNameLink (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PRTL_SPLAY_LINKS *RootNode,
|
_Inout_ PRTL_SPLAY_LINKS *RootNode,
|
||||||
IN PNAME_LINK NameLink
|
_In_ PNAME_LINK NameLink
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -50,12 +50,12 @@ CdInsertNameLink (
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdInsertPrefix (
|
CdInsertPrefix (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb,
|
_Inout_ PFCB Fcb,
|
||||||
IN PCD_NAME Name,
|
_In_ PCD_NAME Name,
|
||||||
IN BOOLEAN IgnoreCase,
|
_In_ BOOLEAN IgnoreCase,
|
||||||
IN BOOLEAN ShortNameMatch,
|
_In_ BOOLEAN ShortNameMatch,
|
||||||
IN PFCB ParentFcb
|
_Inout_ PFCB ParentFcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -205,8 +205,8 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdRemovePrefix (
|
CdRemovePrefix (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb
|
_Inout_ PFCB Fcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -229,6 +229,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Start with the short name prefix entry.
|
// Start with the short name prefix entry.
|
||||||
//
|
//
|
||||||
|
@ -281,12 +283,14 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
CdFindPrefix (
|
CdFindPrefix (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN OUT PFCB *CurrentFcb,
|
_Inout_ PFCB *CurrentFcb,
|
||||||
IN OUT PUNICODE_STRING RemainingName,
|
_Inout_ PUNICODE_STRING RemainingName,
|
||||||
IN BOOLEAN IgnoreCase
|
_In_ BOOLEAN IgnoreCase
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -459,9 +463,9 @@ Return Value:
|
||||||
|
|
||||||
PNAME_LINK
|
PNAME_LINK
|
||||||
CdFindNameLink (
|
CdFindNameLink (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PRTL_SPLAY_LINKS *RootNode,
|
_In_ PRTL_SPLAY_LINKS *RootNode,
|
||||||
IN PUNICODE_STRING Name
|
_In_ PUNICODE_STRING Name
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -562,9 +566,9 @@ Return Value:
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdInsertNameLink (
|
CdInsertNameLink (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PRTL_SPLAY_LINKS *RootNode,
|
_Inout_ PRTL_SPLAY_LINKS *RootNode,
|
||||||
IN PNAME_LINK NameLink
|
_In_ PNAME_LINK NameLink
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -25,8 +25,8 @@ Abstract:
|
||||||
//
|
//
|
||||||
// VOID
|
// VOID
|
||||||
// SafeZeroMemory (
|
// SafeZeroMemory (
|
||||||
// IN PUCHAR At,
|
// _Out_ PUCHAR At,
|
||||||
// IN ULONG ByteCount
|
// _In_ ULONG ByteCount
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -34,13 +34,24 @@ Abstract:
|
||||||
// This macro just puts a nice little try-except around RtlZeroMemory
|
// This macro just puts a nice little try-except around RtlZeroMemory
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
#define SafeZeroMemory(IC,AT,BYTE_COUNT) { \
|
#define SafeZeroMemory(IC,AT,BYTE_COUNT) { \
|
||||||
try { \
|
_SEH2_TRY { \
|
||||||
RtlZeroMemory( (AT), (BYTE_COUNT) ); \
|
RtlZeroMemory( (AT), (BYTE_COUNT) ); \
|
||||||
} except( EXCEPTION_EXECUTE_HANDLER ) { \
|
__pragma(warning(suppress: 6320)) \
|
||||||
|
} _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) { \
|
||||||
CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \
|
CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \
|
||||||
} \
|
} _SEH2_END; \
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define SafeZeroMemory(IC,AT,BYTE_COUNT) { \
|
||||||
|
_SEH2_TRY { \
|
||||||
|
RtlZeroMemory( (AT), (BYTE_COUNT) ); \
|
||||||
|
} _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) { \
|
||||||
|
CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \
|
||||||
|
} _SEH2_END; \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read ahead amount used for normal data files
|
// Read ahead amount used for normal data files
|
||||||
|
@ -53,10 +64,12 @@ Abstract:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonRead (
|
CdCommonRead (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -79,7 +92,7 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS; /* ReactOS Change: GCC Uninit var */
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
||||||
|
|
||||||
TYPE_OF_OPEN TypeOfOpen;
|
TYPE_OF_OPEN TypeOfOpen;
|
||||||
|
@ -123,6 +136,9 @@ Return Value:
|
||||||
|
|
||||||
TypeOfOpen = CdDecodeFileObject( IrpContext, IrpSp->FileObject, &Fcb, &Ccb );
|
TypeOfOpen = CdDecodeFileObject( IrpContext, IrpSp->FileObject, &Fcb, &Ccb );
|
||||||
|
|
||||||
|
// Internal lock object is acquired if return status is STATUS_PENDING
|
||||||
|
_Analysis_suppress_lock_checking_(Fcb->Resource);
|
||||||
|
|
||||||
if ((TypeOfOpen == UnopenedFileObject) ||
|
if ((TypeOfOpen == UnopenedFileObject) ||
|
||||||
(TypeOfOpen == UserDirectoryOpen)) {
|
(TypeOfOpen == UserDirectoryOpen)) {
|
||||||
|
|
||||||
|
@ -180,7 +196,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Verify the Fcb. Allow reads if this is a DASD handle that is
|
// Verify the Fcb. Allow reads if this is a DASD handle that is
|
||||||
|
@ -222,7 +238,7 @@ Return Value:
|
||||||
// based on the state of the file oplocks.
|
// based on the state of the file oplocks.
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = FsRtlCheckOplock( &Fcb->Oplock,
|
Status = FsRtlCheckOplock( CdGetFcbOplock(Fcb),
|
||||||
Irp,
|
Irp,
|
||||||
IrpContext,
|
IrpContext,
|
||||||
(PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
(PVOID)CdOplockComplete,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
||||||
|
@ -249,6 +265,14 @@ Return Value:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check request beyond end of file if this is not a read on a volume
|
||||||
|
// handle marked for extended DASD IO.
|
||||||
|
//
|
||||||
|
|
||||||
|
if ((TypeOfOpen != UserVolumeOpen) ||
|
||||||
|
(!FlagOn( Ccb->Flags, CCB_FLAG_ALLOW_EXTENDED_DASD_IO ))) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Complete the request if it begins beyond the end of file.
|
// Complete the request if it begins beyond the end of file.
|
||||||
//
|
//
|
||||||
|
@ -267,6 +291,7 @@ Return Value:
|
||||||
ByteCount = (ULONG) (Fcb->FileSize.QuadPart - StartingOffset);
|
ByteCount = (ULONG) (Fcb->FileSize.QuadPart - StartingOffset);
|
||||||
ByteRange = Fcb->FileSize.QuadPart;
|
ByteRange = Fcb->FileSize.QuadPart;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle the non-cached read first.
|
// Handle the non-cached read first.
|
||||||
|
@ -515,7 +540,7 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
try_exit: NOTHING;
|
try_exit: NOTHING;
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the Fcb.
|
// Release the Fcb.
|
||||||
|
@ -525,7 +550,7 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseFile( IrpContext, Fcb );
|
CdReleaseFile( IrpContext, Fcb );
|
||||||
}
|
}
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Post the request if we got CANT_WAIT.
|
// Post the request if we got CANT_WAIT.
|
||||||
|
@ -548,3 +573,4 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -23,7 +23,7 @@ Abstract:
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
#pragma alloc_text(PAGE, CdAcquireForCache)
|
#pragma alloc_text(PAGE, CdAcquireForCache)
|
||||||
#pragma alloc_text(PAGE, CdAcquireForCreateSection)
|
#pragma alloc_text(PAGE, CdFilterCallbackAcquireForCreateSection)
|
||||||
#pragma alloc_text(PAGE, CdAcquireResource)
|
#pragma alloc_text(PAGE, CdAcquireResource)
|
||||||
#pragma alloc_text(PAGE, CdNoopAcquire)
|
#pragma alloc_text(PAGE, CdNoopAcquire)
|
||||||
#pragma alloc_text(PAGE, CdNoopRelease)
|
#pragma alloc_text(PAGE, CdNoopRelease)
|
||||||
|
@ -32,12 +32,18 @@ Abstract:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_When_(Type == AcquireExclusive && return != FALSE, _Acquires_exclusive_lock_(*Resource))
|
||||||
|
_When_(Type == AcquireShared && return != FALSE, _Acquires_shared_lock_(*Resource))
|
||||||
|
_When_(Type == AcquireSharedStarveExclusive && return != FALSE, _Acquires_shared_lock_(*Resource))
|
||||||
|
_When_(IgnoreWait == FALSE, _Post_satisfies_(return == TRUE))
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdAcquireResource (
|
CdAcquireResource (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PERESOURCE Resource,
|
_Inout_ PERESOURCE Resource,
|
||||||
IN BOOLEAN IgnoreWait,
|
_In_ BOOLEAN IgnoreWait,
|
||||||
IN TYPE_OF_ACQUIRE Type
|
_In_ TYPE_OF_ACQUIRE Type
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -90,6 +96,9 @@ Return Value:
|
||||||
switch (Type) {
|
switch (Type) {
|
||||||
case AcquireExclusive:
|
case AcquireExclusive:
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast( suppress:28137, "prefast believes Wait should be a constant, but this is ok for CDFS" )
|
||||||
|
#endif
|
||||||
Acquired = ExAcquireResourceExclusiveLite( Resource, Wait );
|
Acquired = ExAcquireResourceExclusiveLite( Resource, Wait );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -105,11 +114,11 @@ Return Value:
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Acquired = FALSE;
|
Acquired = FALSE;
|
||||||
ASSERT( FALSE );
|
NT_ASSERT( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// If not acquired and the user didn't specify IgnoreWait then
|
// If not acquired and the user didn't specifiy IgnoreWait then
|
||||||
// raise CANT_WAIT.
|
// raise CANT_WAIT.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -122,11 +131,14 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_When_(return!=0, _Acquires_shared_lock_(*Fcb->Resource))
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdAcquireForCache (
|
CdAcquireForCache (
|
||||||
IN PFCB Fcb,
|
_Inout_ PFCB Fcb,
|
||||||
IN BOOLEAN Wait
|
_In_ BOOLEAN Wait
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -152,17 +164,24 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT(IoGetTopLevelIrp() == NULL);
|
if (!ExAcquireResourceSharedLite( Fcb->Resource, Wait )) {
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
NT_ASSERT(IoGetTopLevelIrp() == NULL);
|
||||||
IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
||||||
|
|
||||||
return ExAcquireResourceSharedLite( Fcb->Resource, Wait );
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
_Releases_lock_(*Fcb->Resource)
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdReleaseFromCache (
|
CdReleaseFromCache (
|
||||||
IN PFCB Fcb
|
_Inout_ PFCB Fcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -187,7 +206,7 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
ASSERT(IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
NT_ASSERT(IoGetTopLevelIrp() == (PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);
|
||||||
IoSetTopLevelIrp( NULL );
|
IoSetTopLevelIrp( NULL );
|
||||||
|
|
||||||
ExReleaseResourceLite( Fcb->Resource );
|
ExReleaseResourceLite( Fcb->Resource );
|
||||||
|
@ -197,8 +216,8 @@ Return Value:
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdNoopAcquire (
|
CdNoopAcquire (
|
||||||
IN PVOID Fcb,
|
_In_ PVOID Fcb,
|
||||||
IN BOOLEAN Wait
|
_In_ BOOLEAN Wait
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -222,6 +241,10 @@ Return Value:
|
||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( Fcb );
|
||||||
|
UNREFERENCED_PARAMETER( Wait );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +252,7 @@ Return Value:
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdNoopRelease (
|
CdNoopRelease (
|
||||||
IN PVOID Fcb
|
_In_ PVOID Fcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -251,13 +274,17 @@ Return Value:
|
||||||
|
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( Fcb );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
NTSTATUS
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdAcquireForCreateSection (
|
CdFilterCallbackAcquireForCreateSection (
|
||||||
IN PFILE_OBJECT FileObject
|
_In_ PFS_FILTER_CALLBACK_DATA CallbackData,
|
||||||
|
_Unreferenced_parameter_ PVOID *CompletionContext
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -268,17 +295,34 @@ Routine Description:
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
FileObject - File object for a Cdfs stream.
|
FS_FILTER_CALLBACK_DATA - Filter based callback data that provides the file object we
|
||||||
|
want to acquire.
|
||||||
|
|
||||||
|
CompletionContext - Ignored.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
None
|
On success we return STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY.
|
||||||
|
|
||||||
|
If SyncType is SyncTypeCreateSection, we return a status that indicates there are no
|
||||||
|
writers to this file.
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
|
PFILE_OBJECT FileObject;
|
||||||
|
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
NT_ASSERT( CallbackData->Operation == FS_FILTER_ACQUIRE_FOR_SECTION_SYNCHRONIZATION );
|
||||||
|
NT_ASSERT( CallbackData->SizeOfFsFilterCallbackData == sizeof(FS_FILTER_CALLBACK_DATA) );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get the file object from the callback data.
|
||||||
|
//
|
||||||
|
|
||||||
|
FileObject = CallbackData->FileObject;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the Fcb resource exclusively.
|
// Get the Fcb resource exclusively.
|
||||||
|
@ -299,13 +343,32 @@ Return Value:
|
||||||
|
|
||||||
ExAcquireSharedStarveExclusive( ((PFCB) FileObject->FsContext)->Resource,
|
ExAcquireSharedStarveExclusive( ((PFCB) FileObject->FsContext)->Resource,
|
||||||
TRUE );
|
TRUE );
|
||||||
|
|
||||||
|
//
|
||||||
|
// CDFS is a read-only file system, so we can always indicate no writers.
|
||||||
|
// We only do this for create section synchronization. For others we
|
||||||
|
// return the generic success STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (CallbackData->Parameters.AcquireForSectionSynchronization.SyncType == SyncTypeCreateSection) {
|
||||||
|
|
||||||
|
return STATUS_FILE_LOCKED_WITH_ONLY_READERS;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( CompletionContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_Function_class_(FAST_IO_RELEASE_FILE)
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdReleaseForCreateSection (
|
CdReleaseForCreateSection (
|
||||||
IN PFILE_OBJECT FileObject
|
_In_ PFILE_OBJECT FileObject
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
179
drivers/filesystems/cdfs_new/shutdown.c
Normal file
179
drivers/filesystems/cdfs_new/shutdown.c
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Copyright (c) 1997-2006 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Shutdown.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
This module implements the shutdown routine for CDFS called by
|
||||||
|
the dispatch driver.
|
||||||
|
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "cdprocs.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// The Bug check file id for this module
|
||||||
|
//
|
||||||
|
|
||||||
|
#define BugCheckFileId (CDFS_BUG_CHECK_SHUTDOWN)
|
||||||
|
|
||||||
|
#ifdef ALLOC_PRAGMA
|
||||||
|
#pragma alloc_text(PAGE, CdCommonShutdown)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
NTSTATUS
|
||||||
|
CdCommonShutdown (
|
||||||
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
|
_Inout_ PIRP Irp
|
||||||
|
)
|
||||||
|
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
This is the common routine for handling shutdown operation called
|
||||||
|
by both the fsd and fsp threads
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Irp - Supplies the Irp to process
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
NTSTATUS - The return status for the operation
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
{
|
||||||
|
KEVENT Event;
|
||||||
|
PLIST_ENTRY Links;
|
||||||
|
PVCB Vcb;
|
||||||
|
PIRP NewIrp;
|
||||||
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
BOOLEAN VcbPresent;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make sure we don't get any pop-ups.
|
||||||
|
//
|
||||||
|
|
||||||
|
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_DISABLE_POPUPS );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize an event for doing calls down to
|
||||||
|
// our target device objects.
|
||||||
|
//
|
||||||
|
|
||||||
|
KeInitializeEvent( &Event, NotificationEvent, FALSE );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Indicate that shutdown has started.
|
||||||
|
//
|
||||||
|
|
||||||
|
SetFlag( CdData.Flags, CD_FLAGS_SHUTDOWN );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get everyone else out of the way
|
||||||
|
//
|
||||||
|
|
||||||
|
CdAcquireCdData( IrpContext );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Now walk through all the mounted Vcb's and shutdown the target
|
||||||
|
// device objects.
|
||||||
|
//
|
||||||
|
|
||||||
|
Links = CdData.VcbQueue.Flink;
|
||||||
|
|
||||||
|
while (Links != &CdData.VcbQueue) {
|
||||||
|
|
||||||
|
Vcb = CONTAINING_RECORD( Links, VCB, VcbLinks );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Move to the next link now since the current Vcb may be deleted.
|
||||||
|
//
|
||||||
|
|
||||||
|
Links = Links->Flink;
|
||||||
|
|
||||||
|
//
|
||||||
|
// If we have already been called before for this volume
|
||||||
|
// (and yes this does happen), skip this volume as no writes
|
||||||
|
// have been allowed since the first shutdown.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (FlagOn( Vcb->VcbState, VCB_STATE_SHUTDOWN ) ||
|
||||||
|
(Vcb->VcbCondition != VcbMounted)) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
|
CdPurgeVolume( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Build an irp for this volume stack - our own irp is probably too small and
|
||||||
|
// each stack may have a different stack size.
|
||||||
|
//
|
||||||
|
|
||||||
|
NewIrp = IoBuildSynchronousFsdRequest( IRP_MJ_SHUTDOWN,
|
||||||
|
Vcb->TargetDeviceObject,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
&Event,
|
||||||
|
&Iosb );
|
||||||
|
|
||||||
|
if (NewIrp != NULL) {
|
||||||
|
|
||||||
|
Status = IoCallDriver( Vcb->TargetDeviceObject, NewIrp );
|
||||||
|
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
|
||||||
|
(VOID)KeWaitForSingleObject( &Event,
|
||||||
|
Executive,
|
||||||
|
KernelMode,
|
||||||
|
FALSE,
|
||||||
|
NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
KeClearEvent( &Event );
|
||||||
|
}
|
||||||
|
|
||||||
|
SetFlag( Vcb->VcbState, VCB_STATE_SHUTDOWN );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attempt to punch the volume down.
|
||||||
|
//
|
||||||
|
|
||||||
|
VcbPresent = CdCheckForDismount( IrpContext, Vcb, FALSE );
|
||||||
|
|
||||||
|
if (VcbPresent) {
|
||||||
|
|
||||||
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CdReleaseCdData( IrpContext );
|
||||||
|
|
||||||
|
IoUnregisterFileSystem( CdData.FileSystemDeviceObject );
|
||||||
|
IoDeleteDevice( CdData.FileSystemDeviceObject );
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
IoUnregisterFileSystem( CdData.HddFileSystemDeviceObject );
|
||||||
|
IoDeleteDevice( CdData.HddFileSystemDeviceObject );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CdCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -13,7 +13,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -26,12 +26,12 @@ Abstract:
|
||||||
#pragma alloc_text(PAGE, CdVerifyVcb)
|
#pragma alloc_text(PAGE, CdVerifyVcb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdPerformVerify (
|
CdPerformVerify (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp,
|
_Inout_ PIRP Irp,
|
||||||
IN PDEVICE_OBJECT DeviceToVerify
|
_In_ PDEVICE_OBJECT DeviceToVerify
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -92,7 +92,7 @@ Return Value:
|
||||||
Vcb = &CONTAINING_RECORD( IrpSp->DeviceObject,
|
Vcb = &CONTAINING_RECORD( IrpSp->DeviceObject,
|
||||||
VOLUME_DEVICE_OBJECT,
|
VOLUME_DEVICE_OBJECT,
|
||||||
DeviceObject )->Vcb;
|
DeviceObject )->Vcb;
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Send down the verify FSCTL. Note that this is sent to the
|
// Send down the verify FSCTL. Note that this is sent to the
|
||||||
|
@ -206,26 +206,28 @@ Return Value:
|
||||||
Status = CdFsdPostRequest( IrpContext, Irp );
|
Status = CdFsdPostRequest( IrpContext, Irp );
|
||||||
}
|
}
|
||||||
|
|
||||||
} except(CdExceptionFilter( IrpContext, GetExceptionInformation() )) {
|
} _SEH2_EXCEPT(CdExceptionFilter( IrpContext, _SEH2_GetExceptionInformation() )) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// We had some trouble trying to perform the verify or raised
|
// We had some trouble trying to perform the verify or raised
|
||||||
// an error ourselves. So we'll abort the I/O request with
|
// an error ourselves. So we'll abort the I/O request with
|
||||||
// the error status that we get back from the exception code.
|
// the error status that we get back from the execption code.
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = CdProcessException( IrpContext, Irp, GetExceptionCode() );
|
Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdCheckForDismount (
|
CdCheckForDismount (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_Inout_ PVCB Vcb,
|
||||||
IN BOOLEAN Force
|
_In_ BOOLEAN Force
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -345,14 +347,17 @@ Return Value:
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Vcb );
|
CdReleaseVcb( IrpContext, Vcb );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_Analysis_assume_lock_not_held_(Vcb->VcbResource);
|
||||||
|
}
|
||||||
|
|
||||||
return VcbPresent;
|
return VcbPresent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdMarkDevForVerifyIfVcbMounted(
|
CdMarkDevForVerifyIfVcbMounted (
|
||||||
IN PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -379,6 +384,9 @@ Return Value:
|
||||||
|
|
||||||
IoAcquireVpbSpinLock( &SavedIrql );
|
IoAcquireVpbSpinLock( &SavedIrql );
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
||||||
|
#endif
|
||||||
if (Vcb->Vpb->RealDevice->Vpb == Vcb->Vpb) {
|
if (Vcb->Vpb->RealDevice->Vpb == Vcb->Vpb) {
|
||||||
|
|
||||||
CdMarkRealDevForVerify( Vcb->Vpb->RealDevice);
|
CdMarkRealDevForVerify( Vcb->Vpb->RealDevice);
|
||||||
|
@ -401,8 +409,8 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdVerifyVcb (
|
CdVerifyVcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -431,7 +439,6 @@ Return Value:
|
||||||
ULONG MediaChangeCount = 0;
|
ULONG MediaChangeCount = 0;
|
||||||
BOOLEAN ForceVerify = FALSE;
|
BOOLEAN ForceVerify = FALSE;
|
||||||
BOOLEAN DevMarkedForVerify;
|
BOOLEAN DevMarkedForVerify;
|
||||||
//KIRQL SavedIrql; /* ReactOS Change: GCC Unused variable */
|
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -444,10 +451,15 @@ Return Value:
|
||||||
((Vcb->VcbCondition == VcbDismountInProgress) &&
|
((Vcb->VcbCondition == VcbDismountInProgress) &&
|
||||||
(IrpContext->MajorFunction != IRP_MJ_CREATE))) {
|
(IrpContext->MajorFunction != IRP_MJ_CREATE))) {
|
||||||
|
|
||||||
|
if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
|
||||||
|
|
||||||
|
CdRaiseStatus( IrpContext, STATUS_VOLUME_DISMOUNTED );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (FlagOn( Vcb->VcbState, VCB_STATE_REMOVABLE_MEDIA )) {
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Capture the real device verify state.
|
// Capture the real device verify state.
|
||||||
|
@ -455,6 +467,8 @@ Return Value:
|
||||||
|
|
||||||
DevMarkedForVerify = CdRealDevNeedsVerify( Vcb->Vpb->RealDevice);
|
DevMarkedForVerify = CdRealDevNeedsVerify( Vcb->Vpb->RealDevice);
|
||||||
|
|
||||||
|
if (FlagOn( Vcb->VcbState, VCB_STATE_REMOVABLE_MEDIA ) && !DevMarkedForVerify) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// If the media is removable and the verify volume flag in the
|
// If the media is removable and the verify volume flag in the
|
||||||
// device object is not set then we want to ping the device
|
// device object is not set then we want to ping the device
|
||||||
|
@ -534,7 +548,7 @@ Return Value:
|
||||||
// since they were directed at the 'drive', not our volume.
|
// since they were directed at the 'drive', not our volume.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (NT_SUCCESS( Status) && !ForceVerify &&
|
if (NT_SUCCESS( Status) && !ForceVerify && !DevMarkedForVerify &&
|
||||||
(IrpContext->MajorFunction == IRP_MJ_CREATE)) {
|
(IrpContext->MajorFunction == IRP_MJ_CREATE)) {
|
||||||
|
|
||||||
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( IrpContext->Irp);
|
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( IrpContext->Irp);
|
||||||
|
@ -548,18 +562,20 @@ Return Value:
|
||||||
// it would have been caught and set by the first set of checks.
|
// it would have been caught and set by the first set of checks.
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Raise the verify / error if necessary.
|
// Raise the verify / error if neccessary.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (ForceVerify || !NT_SUCCESS( Status)) {
|
if (ForceVerify || DevMarkedForVerify || !NT_SUCCESS( Status)) {
|
||||||
|
|
||||||
IoSetHardErrorOrVerifyDevice( IrpContext->Irp,
|
IoSetHardErrorOrVerifyDevice( IrpContext->Irp,
|
||||||
Vcb->Vpb->RealDevice );
|
Vcb->Vpb->RealDevice );
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, ForceVerify ? STATUS_VERIFY_REQUIRED : Status);
|
CdRaiseStatus( IrpContext, (ForceVerify || DevMarkedForVerify)
|
||||||
}
|
? STATUS_VERIFY_REQUIRED
|
||||||
|
: Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -577,9 +593,16 @@ Return Value:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VcbInvalid:
|
case VcbInvalid:
|
||||||
case VcbDismountInProgress :
|
case VcbDismountInProgress:
|
||||||
|
|
||||||
|
if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
|
||||||
|
|
||||||
|
CdRaiseStatus( IrpContext, STATUS_VOLUME_DISMOUNTED );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
||||||
|
@ -590,8 +613,8 @@ Return Value:
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdVerifyFcbOperation (
|
CdVerifyFcbOperation (
|
||||||
IN PIRP_CONTEXT IrpContext OPTIONAL,
|
_In_opt_ PIRP_CONTEXT IrpContext,
|
||||||
IN PFCB Fcb
|
_In_ PFCB Fcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -616,7 +639,6 @@ Return Value:
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
{
|
{
|
||||||
//NTSTATUS Status = STATUS_SUCCESS; /* ReactOS Change: GCC Unused variable */
|
|
||||||
PVCB Vcb = Fcb->Vcb;
|
PVCB Vcb = Fcb->Vcb;
|
||||||
PDEVICE_OBJECT RealDevice = Vcb->Vpb->RealDevice;
|
PDEVICE_OBJECT RealDevice = Vcb->Vpb->RealDevice;
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
|
@ -668,8 +690,15 @@ Return Value:
|
||||||
|
|
||||||
if (ARGUMENT_PRESENT( IrpContext )) {
|
if (ARGUMENT_PRESENT( IrpContext )) {
|
||||||
|
|
||||||
|
if (FlagOn( Vcb->VcbState, VCB_STATE_DISMOUNTED )) {
|
||||||
|
|
||||||
|
CdRaiseStatus( IrpContext, STATUS_VOLUME_DISMOUNTED );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
CdRaiseStatus( IrpContext, STATUS_FILE_INVALID );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -715,23 +744,22 @@ Return Value:
|
||||||
|
|
||||||
} else if (Vcb->VcbCondition == VcbNotMounted) {
|
} else if (Vcb->VcbCondition == VcbNotMounted) {
|
||||||
|
|
||||||
if (ARGUMENT_PRESENT( IrpContext )) {
|
|
||||||
|
|
||||||
IoSetHardErrorOrVerifyDevice( IrpContext->Irp, RealDevice );
|
IoSetHardErrorOrVerifyDevice( IrpContext->Irp, RealDevice );
|
||||||
CdRaiseStatus( IrpContext, STATUS_WRONG_VOLUME );
|
CdRaiseStatus( IrpContext, STATUS_WRONG_VOLUME );
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
// return FALSE; // unreachable code
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CdDismountVcb (
|
CdDismountVcb (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb
|
_Inout_ PVCB Vcb
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -772,7 +800,7 @@ Return Value:
|
||||||
// We should only take this path once.
|
// We should only take this path once.
|
||||||
//
|
//
|
||||||
|
|
||||||
ASSERT( Vcb->VcbCondition != VcbDismountInProgress );
|
NT_ASSERT( Vcb->VcbCondition != VcbDismountInProgress );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Mark the Vcb as DismountInProgress.
|
// Mark the Vcb as DismountInProgress.
|
||||||
|
@ -858,6 +886,9 @@ Return Value:
|
||||||
// mount request.
|
// mount request.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
||||||
|
#endif
|
||||||
if (OldVpb->RealDevice->Vpb == OldVpb) {
|
if (OldVpb->RealDevice->Vpb == OldVpb) {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -868,13 +899,20 @@ Return Value:
|
||||||
|
|
||||||
if (!FinalReference) {
|
if (!FinalReference) {
|
||||||
|
|
||||||
ASSERT( Vcb->SwapVpb != NULL );
|
NT_ASSERT( Vcb->SwapVpb != NULL );
|
||||||
|
|
||||||
Vcb->SwapVpb->Type = IO_TYPE_VPB;
|
Vcb->SwapVpb->Type = IO_TYPE_VPB;
|
||||||
Vcb->SwapVpb->Size = sizeof( VPB );
|
Vcb->SwapVpb->Size = sizeof( VPB );
|
||||||
Vcb->SwapVpb->RealDevice = OldVpb->RealDevice;
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(push)
|
||||||
|
#pragma prefast(disable: 28175, "this is a filesystem driver, touching the vpb is allowed")
|
||||||
|
#endif
|
||||||
|
Vcb->SwapVpb->RealDevice = OldVpb->RealDevice;
|
||||||
Vcb->SwapVpb->RealDevice->Vpb = Vcb->SwapVpb;
|
Vcb->SwapVpb->RealDevice->Vpb = Vcb->SwapVpb;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
Vcb->SwapVpb->Flags = FlagOn( OldVpb->Flags, VPB_REMOVE_PENDING );
|
Vcb->SwapVpb->Flags = FlagOn( OldVpb->Flags, VPB_REMOVE_PENDING );
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -26,36 +26,49 @@ Abstract:
|
||||||
// Local support routines
|
// Local support routines
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryFsVolumeInfo (
|
CdQueryFsVolumeInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFILE_FS_VOLUME_INFORMATION Buffer,
|
_Out_ PFILE_FS_VOLUME_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryFsSizeInfo (
|
CdQueryFsSizeInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFILE_FS_SIZE_INFORMATION Buffer,
|
_Out_ PFILE_FS_SIZE_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryFsDeviceInfo (
|
CdQueryFsDeviceInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFILE_FS_DEVICE_INFORMATION Buffer,
|
_Out_ PFILE_FS_DEVICE_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryFsAttributeInfo (
|
CdQueryFsAttributeInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer,
|
_Out_ PFILE_FS_ATTRIBUTE_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
|
);
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
#define PFILE_FS_SECTOR_SIZE_INFORMATION PVOID
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
CdQueryFsSectorSizeInfo (
|
||||||
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
|
_In_ PVCB Vcb,
|
||||||
|
_Out_writes_bytes_(*Length) PFILE_FS_SECTOR_SIZE_INFORMATION Buffer,
|
||||||
|
_Inout_ PULONG Length
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -64,13 +77,15 @@ CdQueryFsAttributeInfo (
|
||||||
#pragma alloc_text(PAGE, CdQueryFsDeviceInfo)
|
#pragma alloc_text(PAGE, CdQueryFsDeviceInfo)
|
||||||
#pragma alloc_text(PAGE, CdQueryFsSizeInfo)
|
#pragma alloc_text(PAGE, CdQueryFsSizeInfo)
|
||||||
#pragma alloc_text(PAGE, CdQueryFsVolumeInfo)
|
#pragma alloc_text(PAGE, CdQueryFsVolumeInfo)
|
||||||
|
#pragma alloc_text(PAGE, CdQueryFsSectorSizeInfo)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdCommonQueryVolInfo (
|
CdCommonQueryVolInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -130,7 +145,7 @@ Return Value:
|
||||||
// Use a try-finally to facilitate cleanup.
|
// Use a try-finally to facilitate cleanup.
|
||||||
//
|
//
|
||||||
|
|
||||||
try {
|
_SEH2_TRY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Verify the Vcb.
|
// Verify the Vcb.
|
||||||
|
@ -167,6 +182,13 @@ Return Value:
|
||||||
Status = CdQueryFsAttributeInfo( IrpContext, Fcb->Vcb, Irp->AssociatedIrp.SystemBuffer, &Length );
|
Status = CdQueryFsAttributeInfo( IrpContext, Fcb->Vcb, Irp->AssociatedIrp.SystemBuffer, &Length );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||||
|
case FileFsSectorSizeInformation:
|
||||||
|
|
||||||
|
Status = CdQueryFsSectorSizeInfo( IrpContext, Fcb->Vcb, Irp->AssociatedIrp.SystemBuffer, &Length );
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
/* ReactOS Change: GCC "enumeration value not handled in switch" */
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
@ -177,14 +199,14 @@ Return Value:
|
||||||
|
|
||||||
Irp->IoStatus.Information = IrpSp->Parameters.QueryVolume.Length - Length;
|
Irp->IoStatus.Information = IrpSp->Parameters.QueryVolume.Length - Length;
|
||||||
|
|
||||||
} finally {
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Release the Vcb.
|
// Release the Vcb.
|
||||||
//
|
//
|
||||||
|
|
||||||
CdReleaseVcb( IrpContext, Fcb->Vcb );
|
CdReleaseVcb( IrpContext, Fcb->Vcb );
|
||||||
}
|
} _SEH2_END;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Complete the request if we didn't raise.
|
// Complete the request if we didn't raise.
|
||||||
|
@ -200,12 +222,13 @@ Return Value:
|
||||||
// Local support routine
|
// Local support routine
|
||||||
//
|
//
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryFsVolumeInfo (
|
CdQueryFsVolumeInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFILE_FS_VOLUME_INFORMATION Buffer,
|
_Out_ PFILE_FS_VOLUME_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -222,7 +245,7 @@ Arguments:
|
||||||
is to be returned
|
is to be returned
|
||||||
|
|
||||||
Length - Supplies the length of the buffer in byte. This variable
|
Length - Supplies the length of the buffer in byte. This variable
|
||||||
upon return receives the remaining bytes free in the buffer
|
upon return recieves the remaining bytes free in the buffer
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
|
@ -237,6 +260,8 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill in the data from the Vcb.
|
// Fill in the data from the Vcb.
|
||||||
//
|
//
|
||||||
|
@ -292,10 +317,10 @@ Return Value:
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryFsSizeInfo (
|
CdQueryFsSizeInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFILE_FS_SIZE_INFORMATION Buffer,
|
_Out_ PFILE_FS_SIZE_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -312,7 +337,7 @@ Arguments:
|
||||||
is to be returned
|
is to be returned
|
||||||
|
|
||||||
Length - Supplies the length of the buffer in byte. This variable
|
Length - Supplies the length of the buffer in byte. This variable
|
||||||
upon return receives the remaining bytes free in the buffer
|
upon return recieves the remaining bytes free in the buffer
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
|
@ -323,6 +348,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill in the output buffer.
|
// Fill in the output buffer.
|
||||||
//
|
//
|
||||||
|
@ -353,10 +380,10 @@ Return Value:
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryFsDeviceInfo (
|
CdQueryFsDeviceInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFILE_FS_DEVICE_INFORMATION Buffer,
|
_Out_ PFILE_FS_DEVICE_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -373,7 +400,7 @@ Arguments:
|
||||||
is to be returned
|
is to be returned
|
||||||
|
|
||||||
Length - Supplies the length of the buffer in byte. This variable
|
Length - Supplies the length of the buffer in byte. This variable
|
||||||
upon return receives the remaining bytes free in the buffer
|
upon return recieves the remaining bytes free in the buffer
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
|
@ -384,6 +411,8 @@ Return Value:
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update the output buffer.
|
// Update the output buffer.
|
||||||
//
|
//
|
||||||
|
@ -411,10 +440,10 @@ Return Value:
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdQueryFsAttributeInfo (
|
CdQueryFsAttributeInfo (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
IN PVCB Vcb,
|
_In_ PVCB Vcb,
|
||||||
IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer,
|
_Out_ PFILE_FS_ATTRIBUTE_INFORMATION Buffer,
|
||||||
IN OUT PULONG Length
|
_Inout_ PULONG Length
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -431,7 +460,7 @@ Arguments:
|
||||||
is to be returned
|
is to be returned
|
||||||
|
|
||||||
Length - Supplies the length of the buffer in byte. This variable
|
Length - Supplies the length of the buffer in byte. This variable
|
||||||
upon return receives the remaining bytes free in the buffer
|
upon return recieves the remaining bytes free in the buffer
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
|
||||||
|
@ -446,12 +475,15 @@ Return Value:
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER( Vcb );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill out the fixed portion of the buffer.
|
// Fill out the fixed portion of the buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
Buffer->FileSystemAttributes = FILE_CASE_SENSITIVE_SEARCH |
|
Buffer->FileSystemAttributes = FILE_CASE_SENSITIVE_SEARCH |
|
||||||
FILE_READ_ONLY_VOLUME;
|
FILE_READ_ONLY_VOLUME |
|
||||||
|
FILE_SUPPORTS_OPEN_BY_FILE_ID;
|
||||||
|
|
||||||
if (FlagOn( IrpContext->Vcb->VcbState, VCB_STATE_JOLIET )) {
|
if (FlagOn( IrpContext->Vcb->VcbState, VCB_STATE_JOLIET )) {
|
||||||
|
|
||||||
|
@ -503,3 +535,71 @@ Return Value:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (NTDDI_VERSION >= NTDDI_WIN8)
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
CdQueryFsSectorSizeInfo (
|
||||||
|
_In_ PIRP_CONTEXT IrpContext,
|
||||||
|
_In_ PVCB Vcb,
|
||||||
|
_Out_writes_bytes_(*Length) PFILE_FS_SECTOR_SIZE_INFORMATION Buffer,
|
||||||
|
_Inout_ PULONG Length
|
||||||
|
)
|
||||||
|
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
This routine implements the query sector size information call
|
||||||
|
This operation will work on any handle and requires no privilege.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Vcb - Supplies the Vcb being queried
|
||||||
|
|
||||||
|
Buffer - Supplies a pointer to the output buffer where the information
|
||||||
|
is to be returned
|
||||||
|
|
||||||
|
Length - Supplies the length of the buffer in byte. This variable
|
||||||
|
upon return receives the remaining bytes free in the buffer
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
NTSTATUS - Returns the status for the query
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
UNREFERENCED_PARAMETER( IrpContext );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sufficient buffer size is guaranteed by the I/O manager or the
|
||||||
|
// originating kernel mode driver.
|
||||||
|
//
|
||||||
|
|
||||||
|
ASSERT( *Length >= sizeof( FILE_FS_SECTOR_SIZE_INFORMATION ));
|
||||||
|
_Analysis_assume_( *Length >= sizeof( FILE_FS_SECTOR_SIZE_INFORMATION ));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve the sector size information
|
||||||
|
//
|
||||||
|
|
||||||
|
Status = FsRtlGetSectorSizeInformation( Vcb->Vpb->RealDevice,
|
||||||
|
Buffer );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Adjust the length variable
|
||||||
|
//
|
||||||
|
|
||||||
|
if (NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
|
*Length -= sizeof( FILE_FS_SECTOR_SIZE_INFORMATION );
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,7 @@ Abstract:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include "CdProcs.h"
|
#include "cdprocs.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The Bug check file id for this module
|
// The Bug check file id for this module
|
||||||
|
@ -35,8 +35,8 @@ Abstract:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdAddToWorkque (
|
CdAddToWorkque (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALLOC_PRAGMA
|
#ifdef ALLOC_PRAGMA
|
||||||
|
@ -46,10 +46,11 @@ CdAddToWorkque (
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
CdFsdPostRequest (
|
CdFsdPostRequest (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -96,18 +97,20 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdPrePostIrp (
|
CdPrePostIrp (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This routine performs any necessary work before STATUS_PENDING is
|
This routine performs any neccessary work before STATUS_PENDING is
|
||||||
returned with the Fsd thread. This routine is called within the
|
returned with the Fsd thread. This routine is called within the
|
||||||
filesystem and by the oplock package.
|
filesystem and by the oplock package.
|
||||||
|
|
||||||
|
@ -155,6 +158,7 @@ Return Value:
|
||||||
|
|
||||||
if (!RemovedFcb) {
|
if (!RemovedFcb) {
|
||||||
|
|
||||||
|
_Analysis_assume_lock_held_((*IrpContext->TeardownFcb)->FcbNonpaged->FcbResource);
|
||||||
CdReleaseFcb( IrpContext, *(IrpContext->TeardownFcb) );
|
CdReleaseFcb( IrpContext, *(IrpContext->TeardownFcb) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +169,7 @@ Return Value:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
// We need to lock the user's buffer, unless this is an MDL-read,
|
// We need to lock the user's buffer, unless this is an MDL read/write,
|
||||||
// in which case there is no user buffer.
|
// in which case there is no user buffer.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -173,7 +177,16 @@ Return Value:
|
||||||
|
|
||||||
if (!FlagOn( IrpContext->MinorFunction, IRP_MN_MDL )) {
|
if (!FlagOn( IrpContext->MinorFunction, IRP_MN_MDL )) {
|
||||||
|
|
||||||
CdLockUserBuffer( IrpContext, IrpSp->Parameters.Read.Length );
|
CdLockUserBuffer( IrpContext, IrpSp->Parameters.Read.Length, IoWriteAccess );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IRP_MJ_WRITE :
|
||||||
|
|
||||||
|
if (!FlagOn( IrpContext->MinorFunction, IRP_MN_MDL )) {
|
||||||
|
|
||||||
|
CdLockUserBuffer( IrpContext, IrpSp->Parameters.Read.Length, IoReadAccess );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -186,7 +199,7 @@ Return Value:
|
||||||
|
|
||||||
if (IrpContext->MinorFunction == IRP_MN_QUERY_DIRECTORY) {
|
if (IrpContext->MinorFunction == IRP_MN_QUERY_DIRECTORY) {
|
||||||
|
|
||||||
CdLockUserBuffer( IrpContext, IrpSp->Parameters.QueryDirectory.Length );
|
CdLockUserBuffer( IrpContext, IrpSp->Parameters.QueryDirectory.Length, IoWriteAccess );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -209,11 +222,13 @@ Return Value:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
VOID
|
VOID
|
||||||
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
NTAPI /* ReactOS Change: GCC Does not support STDCALL by default */
|
||||||
CdOplockComplete (
|
CdOplockComplete (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -272,6 +287,7 @@ Return Value:
|
||||||
|
|
||||||
if (!RemovedFcb) {
|
if (!RemovedFcb) {
|
||||||
|
|
||||||
|
_Analysis_assume_lock_held_((*IrpContext->TeardownFcb)->FcbNonpaged->FcbResource);
|
||||||
CdReleaseFcb( IrpContext, *(IrpContext->TeardownFcb) );
|
CdReleaseFcb( IrpContext, *(IrpContext->TeardownFcb) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,15 +323,15 @@ Return Value:
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
CdAddToWorkque (
|
CdAddToWorkque (
|
||||||
IN PIRP_CONTEXT IrpContext,
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
IN PIRP Irp
|
_Inout_ PIRP Irp
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
|
||||||
Routine Description:
|
Routine Description:
|
||||||
|
|
||||||
This routine is called to actually store the posted Irp to the Fsp
|
This routine is called to acually store the posted Irp to the Fsp
|
||||||
workque.
|
workque.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
@ -387,10 +403,16 @@ Return Value:
|
||||||
// Send it off.....
|
// Send it off.....
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(suppress:28155, "the function prototype is correct")
|
||||||
|
#endif
|
||||||
ExInitializeWorkItem( &IrpContext->WorkQueueItem,
|
ExInitializeWorkItem( &IrpContext->WorkQueueItem,
|
||||||
(PVOID)CdFspDispatch,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
(PVOID)CdFspDispatch,/* ReactOS Change: GCC "assignment from incompatible pointer type" */
|
||||||
IrpContext );
|
IrpContext );
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma prefast(suppress: 28159, "prefast believes this routine is obsolete, but it is ok for CDFS to continue using it")
|
||||||
|
#endif
|
||||||
ExQueueWorkItem( &IrpContext->WorkQueueItem, CriticalWorkQueue );
|
ExQueueWorkItem( &IrpContext->WorkQueueItem, CriticalWorkQueue );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
390
drivers/filesystems/cdfs_new/write.c
Normal file
390
drivers/filesystems/cdfs_new/write.c
Normal file
|
@ -0,0 +1,390 @@
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Copyright (c) 1989-2000 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Write.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
This module implements the File Write routine for Write called by the
|
||||||
|
Fsd/Fsp dispatch drivers.
|
||||||
|
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "cdprocs.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// The Bug check file id for this module
|
||||||
|
//
|
||||||
|
|
||||||
|
#define BugCheckFileId (CDFS_BUG_CHECK_WRITE)
|
||||||
|
|
||||||
|
//
|
||||||
|
// VOID
|
||||||
|
// SafeZeroMemory (
|
||||||
|
// _Out_ PUCHAR At,
|
||||||
|
// _In_ ULONG ByteCount
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// This macro just puts a nice little try-except around RtlZeroMemory
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
|
#define SafeZeroMemory(IC,AT,BYTE_COUNT) { \
|
||||||
|
_SEH2_TRY { \
|
||||||
|
RtlZeroMemory( (AT), (BYTE_COUNT) ); \
|
||||||
|
__pragma(warning(suppress: 6320)) \
|
||||||
|
} _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) { \
|
||||||
|
CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \
|
||||||
|
} _SEH2_END; \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define SafeZeroMemory(IC,AT,BYTE_COUNT) { \
|
||||||
|
_SEH2_TRY { \
|
||||||
|
RtlZeroMemory( (AT), (BYTE_COUNT) ); \
|
||||||
|
} _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) { \
|
||||||
|
CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER ); \
|
||||||
|
} _SEH2_END; \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ALLOC_PRAGMA
|
||||||
|
#pragma alloc_text(PAGE, CdCommonWrite)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
_Requires_lock_held_(_Global_critical_region_)
|
||||||
|
NTSTATUS
|
||||||
|
CdCommonWrite (
|
||||||
|
_Inout_ PIRP_CONTEXT IrpContext,
|
||||||
|
_Inout_ PIRP Irp
|
||||||
|
)
|
||||||
|
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
This is the common entry point for NtWriteFile calls. For synchronous requests,
|
||||||
|
CommonWrite will complete the request in the current thread. If not
|
||||||
|
synchronous the request will be passed to the Fsp if there is a need to
|
||||||
|
block.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
Irp - Supplies the Irp to process
|
||||||
|
|
||||||
|
Return Value:
|
||||||
|
|
||||||
|
NTSTATUS - The result of this operation.
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
{
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp );
|
||||||
|
|
||||||
|
TYPE_OF_OPEN TypeOfOpen;
|
||||||
|
PFCB Fcb;
|
||||||
|
PCCB Ccb;
|
||||||
|
|
||||||
|
BOOLEAN Wait;
|
||||||
|
ULONG SynchronousIo;
|
||||||
|
PVOID UserBuffer;
|
||||||
|
|
||||||
|
LONGLONG StartingOffset;
|
||||||
|
LONGLONG ByteRange;
|
||||||
|
ULONG ByteCount;
|
||||||
|
ULONG WriteByteCount;
|
||||||
|
ULONG OriginalByteCount;
|
||||||
|
|
||||||
|
BOOLEAN ReleaseFile = TRUE;
|
||||||
|
|
||||||
|
CD_IO_CONTEXT LocalIoContext;
|
||||||
|
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
|
//
|
||||||
|
// If this is a zero length write then return SUCCESS immediately.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (IrpSp->Parameters.Write.Length == 0) {
|
||||||
|
|
||||||
|
CdCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Decode the file object and verify we support write on this. It
|
||||||
|
// must be a volume file.
|
||||||
|
//
|
||||||
|
|
||||||
|
TypeOfOpen = CdDecodeFileObject( IrpContext, IrpSp->FileObject, &Fcb, &Ccb );
|
||||||
|
|
||||||
|
// Internal lock object is acquired if return status is STATUS_PENDING
|
||||||
|
_Analysis_suppress_lock_checking_(Fcb->Resource);
|
||||||
|
|
||||||
|
if (TypeOfOpen != UserVolumeOpen) {
|
||||||
|
|
||||||
|
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST );
|
||||||
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Examine our input parameters to determine if this is noncached and/or
|
||||||
|
// a paging io operation.
|
||||||
|
//
|
||||||
|
|
||||||
|
Wait = BooleanFlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
|
||||||
|
SynchronousIo = FlagOn( IrpSp->FileObject->Flags, FO_SYNCHRONOUS_IO );
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract the range of the Io.
|
||||||
|
//
|
||||||
|
|
||||||
|
StartingOffset = IrpSp->Parameters.Write.ByteOffset.QuadPart;
|
||||||
|
OriginalByteCount = ByteCount = IrpSp->Parameters.Write.Length;
|
||||||
|
|
||||||
|
ByteRange = StartingOffset + ByteCount;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Acquire the file shared to perform the write.
|
||||||
|
//
|
||||||
|
|
||||||
|
CdAcquireFileShared( IrpContext, Fcb );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Use a try-finally to facilitate cleanup.
|
||||||
|
//
|
||||||
|
|
||||||
|
_SEH2_TRY {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Verify the Fcb. Allow writes if this is a DASD handle that is
|
||||||
|
// dismounting the volume.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (!FlagOn( Ccb->Flags, CCB_FLAG_DISMOUNT_ON_CLOSE )) {
|
||||||
|
|
||||||
|
CdVerifyFcbOperation( IrpContext, Fcb );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!FlagOn( Ccb->Flags, CCB_FLAG_ALLOW_EXTENDED_DASD_IO )) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Complete the request if it begins beyond the end of file.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (StartingOffset >= Fcb->FileSize.QuadPart) {
|
||||||
|
|
||||||
|
try_return( Status = STATUS_END_OF_FILE );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Truncate the write if it extends beyond the end of the file.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (ByteRange > Fcb->FileSize.QuadPart) {
|
||||||
|
|
||||||
|
ByteCount = (ULONG) (Fcb->FileSize.QuadPart - StartingOffset);
|
||||||
|
ByteRange = Fcb->FileSize.QuadPart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If we have an unaligned transfer then post this request if
|
||||||
|
// we can't wait. Unaligned means that the starting offset
|
||||||
|
// is not on a sector boundary or the write is not integral
|
||||||
|
// sectors.
|
||||||
|
//
|
||||||
|
|
||||||
|
WriteByteCount = BlockAlign( Fcb->Vcb, ByteCount );
|
||||||
|
|
||||||
|
if (SectorOffset( StartingOffset ) ||
|
||||||
|
SectorOffset( WriteByteCount ) ||
|
||||||
|
(WriteByteCount > OriginalByteCount)) {
|
||||||
|
|
||||||
|
if (!Wait) {
|
||||||
|
|
||||||
|
CdRaiseStatus( IrpContext, STATUS_CANT_WAIT );
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make sure we don't overwrite the buffer.
|
||||||
|
//
|
||||||
|
|
||||||
|
WriteByteCount = ByteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the IoContext for the write.
|
||||||
|
// If there is a context pointer, we need to make sure it was
|
||||||
|
// allocated and not a stale stack pointer.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (IrpContext->IoContext == NULL ||
|
||||||
|
!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_ALLOC_IO )) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// If we can wait, use the context on the stack. Otherwise
|
||||||
|
// we need to allocate one.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (Wait) {
|
||||||
|
|
||||||
|
IrpContext->IoContext = &LocalIoContext;
|
||||||
|
ClearFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_ALLOC_IO );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
IrpContext->IoContext = CdAllocateIoContext();
|
||||||
|
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_ALLOC_IO );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlZeroMemory( IrpContext->IoContext, sizeof( CD_IO_CONTEXT ) );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Store whether we allocated this context structure in the structure
|
||||||
|
// itself.
|
||||||
|
//
|
||||||
|
|
||||||
|
IrpContext->IoContext->AllocatedContext =
|
||||||
|
BooleanFlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_ALLOC_IO );
|
||||||
|
|
||||||
|
if (Wait) {
|
||||||
|
|
||||||
|
KeInitializeEvent( &IrpContext->IoContext->SyncEvent,
|
||||||
|
NotificationEvent,
|
||||||
|
FALSE );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
IrpContext->IoContext->ResourceThreadId = ExGetCurrentResourceThread();
|
||||||
|
IrpContext->IoContext->Resource = Fcb->Resource;
|
||||||
|
IrpContext->IoContext->RequestedByteCount = ByteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
Irp->IoStatus.Information = WriteByteCount;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set the FO_MODIFIED flag here to trigger a verify when this
|
||||||
|
// handle is closed. Note that we can err on the conservative
|
||||||
|
// side with no problem, i.e. if we accidently do an extra
|
||||||
|
// verify there is no problem.
|
||||||
|
//
|
||||||
|
|
||||||
|
SetFlag( IrpSp->FileObject->Flags, FO_FILE_MODIFIED );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Dasd access is always non-cached. Call the Dasd write routine to
|
||||||
|
// perform the actual write.
|
||||||
|
//
|
||||||
|
|
||||||
|
Status = CdVolumeDasdWrite( IrpContext, Fcb, StartingOffset, WriteByteCount );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Don't complete this request now if STATUS_PENDING was returned.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (Status == STATUS_PENDING) {
|
||||||
|
|
||||||
|
Irp = NULL;
|
||||||
|
ReleaseFile = FALSE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Test is we should zero part of the buffer or update the
|
||||||
|
// synchronous file position.
|
||||||
|
//
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert any unknown error code to IO_ERROR.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (!NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set the information field to zero.
|
||||||
|
//
|
||||||
|
|
||||||
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Raise if this is a user induced error.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (IoIsErrorUserInduced( Status )) {
|
||||||
|
|
||||||
|
CdRaiseStatus( IrpContext, Status );
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = FsRtlNormalizeNtstatus( Status, STATUS_UNEXPECTED_IO_ERROR );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if there is any portion of the user's buffer to zero.
|
||||||
|
//
|
||||||
|
|
||||||
|
} else if (WriteByteCount != ByteCount) {
|
||||||
|
|
||||||
|
CdMapUserBuffer( IrpContext, &UserBuffer );
|
||||||
|
|
||||||
|
SafeZeroMemory( IrpContext,
|
||||||
|
Add2Ptr( UserBuffer,
|
||||||
|
ByteCount,
|
||||||
|
PVOID ),
|
||||||
|
WriteByteCount - ByteCount );
|
||||||
|
|
||||||
|
Irp->IoStatus.Information = ByteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update the file position if this is a synchronous request.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (SynchronousIo && NT_SUCCESS( Status )) {
|
||||||
|
|
||||||
|
IrpSp->FileObject->CurrentByteOffset.QuadPart = ByteRange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try_exit: NOTHING;
|
||||||
|
} _SEH2_FINALLY {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Release the Fcb.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (ReleaseFile) {
|
||||||
|
|
||||||
|
CdReleaseFile( IrpContext, Fcb );
|
||||||
|
}
|
||||||
|
} _SEH2_END;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Post the request if we got CANT_WAIT.
|
||||||
|
//
|
||||||
|
|
||||||
|
if (Status == STATUS_CANT_WAIT) {
|
||||||
|
|
||||||
|
Status = CdFsdPostRequest( IrpContext, Irp );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Otherwise complete the request.
|
||||||
|
//
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
CdCompleteRequest( IrpContext, Irp, Status );
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,3 +15,7 @@ The following FSD are shared with: http://www.acc.umu.se/~bosse/
|
||||||
|
|
||||||
reactos/drivers/filesystems/ffs # Synced to 0.5.2
|
reactos/drivers/filesystems/ffs # Synced to 0.5.2
|
||||||
reactos/drivers/filesystems/reiserfs # Synced to 0.26
|
reactos/drivers/filesystems/reiserfs # Synced to 0.26
|
||||||
|
|
||||||
|
The following FSD are shared with: https://github.com/Microsoft/Windows-driver-samples
|
||||||
|
|
||||||
|
reactos/drivers/filesystems/cdfs_new # Synced to 2817004
|
|
@ -160,6 +160,4 @@ CcSetReadAheadGranularity (
|
||||||
{
|
{
|
||||||
CCTRACE(CC_API_DEBUG, "FileObject=%p Granularity=%lu\n",
|
CCTRACE(CC_API_DEBUG, "FileObject=%p Granularity=%lu\n",
|
||||||
FileObject, Granularity);
|
FileObject, Granularity);
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,8 +523,7 @@ NTAPI
|
||||||
CcWaitForCurrentLazyWriterActivity (
|
CcWaitForCurrentLazyWriterActivity (
|
||||||
VOID)
|
VOID)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
return STATUS_SUCCESS;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -143,6 +143,7 @@ CcPurgeCacheSection (
|
||||||
PLIST_ENTRY ListEntry;
|
PLIST_ENTRY ListEntry;
|
||||||
PROS_VACB Vacb;
|
PROS_VACB Vacb;
|
||||||
LONGLONG ViewEnd;
|
LONGLONG ViewEnd;
|
||||||
|
BOOLEAN Success;
|
||||||
|
|
||||||
CCTRACE(CC_API_DEBUG, "SectionObjectPointer=%p\n FileOffset=%p Length=%lu UninitializeCacheMaps=%d",
|
CCTRACE(CC_API_DEBUG, "SectionObjectPointer=%p\n FileOffset=%p Length=%lu UninitializeCacheMaps=%d",
|
||||||
SectionObjectPointer, FileOffset, Length, UninitializeCacheMaps);
|
SectionObjectPointer, FileOffset, Length, UninitializeCacheMaps);
|
||||||
|
@ -169,6 +170,9 @@ CcPurgeCacheSection (
|
||||||
|
|
||||||
InitializeListHead(&FreeList);
|
InitializeListHead(&FreeList);
|
||||||
|
|
||||||
|
/* Assume success */
|
||||||
|
Success = TRUE;
|
||||||
|
|
||||||
KeAcquireGuardedMutex(&ViewLock);
|
KeAcquireGuardedMutex(&ViewLock);
|
||||||
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &OldIrql);
|
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &OldIrql);
|
||||||
ListEntry = SharedCacheMap->CacheMapVacbListHead.Flink;
|
ListEntry = SharedCacheMap->CacheMapVacbListHead.Flink;
|
||||||
|
@ -189,8 +193,12 @@ CcPurgeCacheSection (
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT((Vacb->ReferenceCount == 0) ||
|
/* Still in use, it cannot be purged, fail */
|
||||||
(Vacb->ReferenceCount == 1 && Vacb->Dirty));
|
if (Vacb->ReferenceCount != 0 && !Vacb->Dirty)
|
||||||
|
{
|
||||||
|
Success = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* This VACB is in range, so unlink it and mark for free */
|
/* This VACB is in range, so unlink it and mark for free */
|
||||||
RemoveEntryList(&Vacb->VacbLruListEntry);
|
RemoveEntryList(&Vacb->VacbLruListEntry);
|
||||||
|
@ -213,7 +221,7 @@ CcPurgeCacheSection (
|
||||||
CcRosInternalFreeVacb(Vacb);
|
CcRosInternalFreeVacb(Vacb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ FsRtlCheckOplock(IN POPLOCK Oplock,
|
||||||
IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL)
|
IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL)
|
||||||
{
|
{
|
||||||
/* Unimplemented */
|
/* Unimplemented */
|
||||||
UNIMPLEMENTED;
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +71,6 @@ NTAPI
|
||||||
FsRtlCurrentBatchOplock(IN POPLOCK Oplock)
|
FsRtlCurrentBatchOplock(IN POPLOCK Oplock)
|
||||||
{
|
{
|
||||||
/* Unimplemented */
|
/* Unimplemented */
|
||||||
UNIMPLEMENTED;
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +122,6 @@ FsRtlOplockFsctrl(IN POPLOCK Oplock,
|
||||||
IN ULONG OpenCount)
|
IN ULONG OpenCount)
|
||||||
{
|
{
|
||||||
/* Unimplemented */
|
/* Unimplemented */
|
||||||
UNIMPLEMENTED;
|
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +143,6 @@ BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
|
FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +164,5 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
FsRtlUninitializeOplock(IN POPLOCK Oplock)
|
FsRtlUninitializeOplock(IN POPLOCK Oplock)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1230,6 +1230,13 @@ IopDoNameTransmogrify(
|
||||||
IN PREPARSE_DATA_BUFFER DataBuffer
|
IN PREPARSE_DATA_BUFFER DataBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
IoComputeDesiredAccessFileObject(
|
||||||
|
IN PFILE_OBJECT FileObject,
|
||||||
|
IN PACCESS_MASK DesiredAccess
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// I/O Timer Routines
|
// I/O Timer Routines
|
||||||
//
|
//
|
||||||
|
|
|
@ -384,6 +384,15 @@ ObpDeleteObjectType(
|
||||||
IN PVOID Object
|
IN PVOID Object
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
ObReferenceFileObjectForWrite(
|
||||||
|
IN HANDLE Handle,
|
||||||
|
IN KPROCESSOR_MODE AccessMode,
|
||||||
|
OUT PFILE_OBJECT *FileObject,
|
||||||
|
OUT POBJECT_HANDLE_INFORMATION HandleInformation
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// DOS Devices Functions
|
// DOS Devices Functions
|
||||||
//
|
//
|
||||||
|
|
|
@ -357,9 +357,8 @@ IopEditDeviceList(IN PDRIVER_OBJECT DriverObject,
|
||||||
/* Not this one, keep moving */
|
/* Not this one, keep moving */
|
||||||
if (!Previous->NextDevice)
|
if (!Previous->NextDevice)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to remove PDO %p on driver %wZ (not found)\n",
|
DPRINT1("Failed to remove PDO %p (not found)\n",
|
||||||
DeviceObject,
|
DeviceObject);
|
||||||
&DeviceObject->DriverObject->DriverName);
|
|
||||||
|
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
KeReleaseQueuedSpinLock(LockQueueIoDatabaseLock, OldIrql);
|
KeReleaseQueuedSpinLock(LockQueueIoDatabaseLock, OldIrql);
|
||||||
|
@ -1350,7 +1349,6 @@ IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
|
||||||
if (FileObject->FileObjectExtension)
|
if (FileObject->FileObjectExtension)
|
||||||
{
|
{
|
||||||
PFILE_OBJECT_EXTENSION FileObjectExtension;
|
PFILE_OBJECT_EXTENSION FileObjectExtension;
|
||||||
ASSERT(FALSE);
|
|
||||||
|
|
||||||
/* Cast the buffer to something we understand */
|
/* Cast the buffer to something we understand */
|
||||||
FileObjectExtension = FileObject->FileObjectExtension;
|
FileObjectExtension = FileObject->FileObjectExtension;
|
||||||
|
|
|
@ -3499,12 +3499,10 @@ NtWriteFile(IN HANDLE FileHandle,
|
||||||
CapturedByteOffset.QuadPart = 0;
|
CapturedByteOffset.QuadPart = 0;
|
||||||
IOTRACE(IO_API_DEBUG, "FileHandle: %p\n", FileHandle);
|
IOTRACE(IO_API_DEBUG, "FileHandle: %p\n", FileHandle);
|
||||||
|
|
||||||
/* Get File Object */
|
/* Get File Object for write */
|
||||||
Status = ObReferenceObjectByHandle(FileHandle,
|
Status = ObReferenceFileObjectForWrite(FileHandle,
|
||||||
0,
|
|
||||||
IoFileObjectType,
|
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
(PVOID*)&FileObject,
|
&FileObject,
|
||||||
&ObjectHandleInfo);
|
&ObjectHandleInfo);
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
|
@ -3513,21 +3511,6 @@ NtWriteFile(IN HANDLE FileHandle,
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Check if the handle has either FILE_WRITE_DATA or
|
|
||||||
* FILE_APPEND_DATA granted. However, if this is a named pipe,
|
|
||||||
* make sure we don't ask for FILE_APPEND_DATA as it interferes
|
|
||||||
* with the FILE_CREATE_PIPE_INSTANCE access right!
|
|
||||||
*/
|
|
||||||
if (!(ObjectHandleInfo.GrantedAccess &
|
|
||||||
((!(FileObject->Flags & FO_NAMED_PIPE) ?
|
|
||||||
FILE_APPEND_DATA : 0) | FILE_WRITE_DATA)))
|
|
||||||
{
|
|
||||||
/* We failed */
|
|
||||||
ObDereferenceObject(FileObject);
|
|
||||||
_SEH2_YIELD(return STATUS_ACCESS_DENIED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Probe the status block */
|
/* Probe the status block */
|
||||||
ProbeForWriteIoStatusBlock(IoStatusBlock);
|
ProbeForWriteIoStatusBlock(IoStatusBlock);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,33 @@ NTAPI
|
||||||
RtlpGetStackLimits(PULONG_PTR StackBase,
|
RtlpGetStackLimits(PULONG_PTR StackBase,
|
||||||
PULONG_PTR StackLimit);
|
PULONG_PTR StackLimit);
|
||||||
|
|
||||||
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
IoComputeDesiredAccessFileObject(IN PFILE_OBJECT FileObject,
|
||||||
|
IN PACCESS_MASK DesiredAccess)
|
||||||
|
{
|
||||||
|
/* Assume failure */
|
||||||
|
*DesiredAccess = 0;
|
||||||
|
|
||||||
|
/* First check we really have a FileObject */
|
||||||
|
if (OBJECT_TO_OBJECT_HEADER(FileObject)->Type != IoFileObjectType)
|
||||||
|
{
|
||||||
|
return STATUS_OBJECT_TYPE_MISMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Then compute desired access:
|
||||||
|
* Check if the handle has either FILE_WRITE_DATA or FILE_APPEND_DATA was
|
||||||
|
* granted. However, if this is a named pipe, make sure we don't ask for
|
||||||
|
* FILE_APPEND_DATA as it interferes with the FILE_CREATE_PIPE_INSTANCE
|
||||||
|
* access right!
|
||||||
|
*/
|
||||||
|
*DesiredAccess = ((!(FileObject->Flags & FO_NAMED_PIPE) ? FILE_APPEND_DATA : 0) | FILE_WRITE_DATA);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4835,10 +4835,7 @@ MmFlushImageSection (IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SectionObjectPointer->ImageSectionObject)
|
if (SectionObjectPointer->ImageSectionObject)
|
||||||
{
|
|
||||||
DPRINT1("SectionObject has ImageSection\n");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NEWCC
|
#ifdef NEWCC
|
||||||
CcpLock();
|
CcpLock();
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
extern ULONG ObpAccessProtectCloseBit;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS *********************************************************/
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
@ -195,6 +197,112 @@ ObFastReplaceObject(IN PEX_FAST_REF FastRef,
|
||||||
return OldObject;
|
return OldObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
ObReferenceFileObjectForWrite(IN HANDLE Handle,
|
||||||
|
IN KPROCESSOR_MODE AccessMode,
|
||||||
|
OUT PFILE_OBJECT *FileObject,
|
||||||
|
OUT POBJECT_HANDLE_INFORMATION HandleInformation)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
PHANDLE_TABLE HandleTable;
|
||||||
|
POBJECT_HEADER ObjectHeader;
|
||||||
|
PHANDLE_TABLE_ENTRY HandleEntry;
|
||||||
|
ACCESS_MASK GrantedAccess, DesiredAccess;
|
||||||
|
|
||||||
|
/* Assume failure */
|
||||||
|
*FileObject = NULL;
|
||||||
|
|
||||||
|
/* Check if this is a special handle */
|
||||||
|
if (HandleToLong(Handle) < 0)
|
||||||
|
{
|
||||||
|
/* Make sure we have a valid kernel handle */
|
||||||
|
if (AccessMode != KernelMode || Handle == NtCurrentProcess() || Handle == NtCurrentThread())
|
||||||
|
{
|
||||||
|
return STATUS_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Use the kernel handle table and get the actual handle value */
|
||||||
|
Handle = ObKernelHandleToHandle(Handle);
|
||||||
|
HandleTable = ObpKernelHandleTable;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Otherwise use this process's handle table */
|
||||||
|
HandleTable = PsGetCurrentProcess()->ObjectTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(HandleTable != NULL);
|
||||||
|
KeEnterCriticalRegion();
|
||||||
|
|
||||||
|
/* Get the handle entry */
|
||||||
|
HandleEntry = ExMapHandleToPointer(HandleTable, Handle);
|
||||||
|
if (HandleEntry)
|
||||||
|
{
|
||||||
|
/* Get the object header and validate the type*/
|
||||||
|
ObjectHeader = ObpGetHandleObject(HandleEntry);
|
||||||
|
|
||||||
|
/* Get the desired access from the file object */
|
||||||
|
if (!NT_SUCCESS(IoComputeDesiredAccessFileObject((PFILE_OBJECT)&ObjectHeader->Body,
|
||||||
|
&DesiredAccess)))
|
||||||
|
{
|
||||||
|
Status = STATUS_OBJECT_TYPE_MISMATCH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Extract the granted access from the handle entry */
|
||||||
|
if (BooleanFlagOn(NtGlobalFlag, FLG_KERNEL_STACK_TRACE_DB))
|
||||||
|
{
|
||||||
|
/* FIXME: Translate granted access */
|
||||||
|
GrantedAccess = HandleEntry->GrantedAccess;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GrantedAccess = HandleEntry->GrantedAccess & ~ObpAccessProtectCloseBit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: Get handle information for audit */
|
||||||
|
|
||||||
|
HandleInformation->GrantedAccess = GrantedAccess;
|
||||||
|
|
||||||
|
/* FIXME: Get handle attributes */
|
||||||
|
HandleInformation->HandleAttributes = 0;
|
||||||
|
|
||||||
|
/* Do granted and desired access match? */
|
||||||
|
if (GrantedAccess & DesiredAccess)
|
||||||
|
{
|
||||||
|
/* FIXME: Audit access if required */
|
||||||
|
|
||||||
|
/* Reference the object directly since we have its header */
|
||||||
|
InterlockedIncrement(&ObjectHeader->PointerCount);
|
||||||
|
|
||||||
|
/* Unlock the handle */
|
||||||
|
ExUnlockHandleTableEntry(HandleTable, HandleEntry);
|
||||||
|
KeLeaveCriticalRegion();
|
||||||
|
|
||||||
|
*FileObject = (PFILE_OBJECT)&ObjectHeader->Body;
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
ASSERT(*FileObject != NULL);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No match, deny write access */
|
||||||
|
Status = STATUS_ACCESS_DENIED;
|
||||||
|
|
||||||
|
ExUnlockHandleTableEntry(HandleTable, HandleEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Status = STATUS_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return failure status */
|
||||||
|
KeLeaveCriticalRegion();
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS *********************************************************/
|
/* PUBLIC FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
LONG_PTR
|
LONG_PTR
|
||||||
|
|
|
@ -1606,19 +1606,16 @@ extern const UCHAR * const *FsRtlLegalAnsiCharacterArray;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FsRtlIsAnsiCharacterWild(C) \
|
#define FsRtlIsAnsiCharacterWild(C) \
|
||||||
FlagOn(LEGAL_ANSI_CHARACTER_ARRAY[(UCHAR)(C)], FSRTL_WILD_CHARACTER)
|
FsRtlTestAnsiCharacter((C), FALSE, FALSE, FSRTL_WILD_CHARACTER)
|
||||||
|
|
||||||
#define FsRtlIsAnsiCharacterLegalFat(C, WILD) \
|
#define FsRtlIsAnsiCharacterLegalFat(C, WILD) \
|
||||||
FlagOn(LEGAL_ANSI_CHARACTER_ARRAY[(UCHAR)(C)], (FSRTL_FAT_LEGAL) | \
|
FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_FAT_LEGAL)
|
||||||
((WILD) ? FSRTL_WILD_CHARACTER : 0 ))
|
|
||||||
|
|
||||||
#define FsRtlIsAnsiCharacterLegalHpfs(C, WILD) \
|
#define FsRtlIsAnsiCharacterLegalHpfs(C, WILD) \
|
||||||
FlagOn(LEGAL_ANSI_CHARACTER_ARRAY[(UCHAR)(C)], (FSRTL_HPFS_LEGAL) | \
|
FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_HPFS_LEGAL)
|
||||||
((WILD) ? FSRTL_WILD_CHARACTER : 0 ))
|
|
||||||
|
|
||||||
#define FsRtlIsAnsiCharacterLegalNtfs(C, WILD) \
|
#define FsRtlIsAnsiCharacterLegalNtfs(C, WILD) \
|
||||||
FlagOn(LEGAL_ANSI_CHARACTER_ARRAY[(UCHAR)(C)], (FSRTL_NTFS_LEGAL) | \
|
FsRtlTestAnsiCharacter((C), TRUE, (WILD), FSRTL_NTFS_LEGAL)
|
||||||
((WILD) ? FSRTL_WILD_CHARACTER : 0 ))
|
|
||||||
|
|
||||||
#define FsRtlIsAnsiCharacterLegalNtfsStream(C,WILD_OK) \
|
#define FsRtlIsAnsiCharacterLegalNtfsStream(C,WILD_OK) \
|
||||||
FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_STREAM_LEGAL)
|
FsRtlTestAnsiCharacter((C), TRUE, (WILD_OK), FSRTL_NTFS_STREAM_LEGAL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue