13#define IOCTL_START_TEST 1
14#define IOCTL_FINISH_TEST 2
50 *
Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE |
51 TESTENTRY_BUFFERED_IO_DEVICE |
52 TESTENTRY_NO_READONLY_DEVICE;
162 ok(TestContext !=
NULL,
"Called in invalid context!\n");
163 ok(TestContext->
Bcb !=
NULL,
"Called in invalid context!\n");
164 ok(TestContext->
Buffer !=
NULL,
"Called in invalid context!\n");
165 ok(TestContext->
Length != 0,
"Called in invalid context!\n");
174 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
176 ok(
Bcb != TestContext->
Bcb,
"Returned same BCB!\n");
186 if (!
skip(Ret ==
TRUE,
"CcPinMappedData failed\n"))
188 ok(
Bcb != PinBcb,
"Returned same BCB!\n");
213 ok(TestContext !=
NULL,
"Called in invalid context!\n");
214 ok(TestContext->
Bcb !=
NULL,
"Called in invalid context!\n");
215 ok(TestContext->
Buffer !=
NULL,
"Called in invalid context!\n");
216 ok(TestContext->
Length != 0,
"Called in invalid context!\n");
225 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
227 ok(
Bcb != TestContext->
Bcb,
"Returned same BCB!\n");
237 if (!
skip(Ret ==
FALSE,
"CcPinMappedData succeed\n"))
248 if (!
skip(Ret ==
FALSE,
"CcPinMappedData succeed\n"))
292 FsRtlSetupAdvancedHeader(&
Fcb->
Header, &
Fcb->HeaderMutex);
311 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
321 if (!
skip(Ret ==
TRUE,
"CcPinMappedData failed\n"))
323 ok(
Bcb != PinBcb,
"Returned same BCB!\n");
333 else if (TestId == 1)
341 if (!
skip(Ret ==
TRUE,
"CcPinRead failed\n"))
351 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
353 ok(
Bcb != PinBcb,
"Returned same BCB!\n");
361 if (!
skip(Ret ==
TRUE,
"CcPinMappedData failed\n"))
363 ok(
Bcb != NewBcb,
"Returned same BCB!\n");
377 else if (TestId == 2)
382 if (!
skip(TestContext !=
NULL,
"ExAllocatePool failed\n"))
390 if (!
skip(Ret ==
TRUE,
"CcPinRead failed\n"))
407 else if (TestId == 3)
415 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
425 if (!
skip(Ret ==
FALSE,
"CcPinMappedData succeed\n"))
437 else if (TestId == 4)
442 if (!
skip(TestContext !=
NULL,
"ExAllocatePool failed\n"))
450 if (!
skip(Ret ==
TRUE,
"CcPinRead failed\n"))
556 DPRINT(
"IRP %x/%x\n", IoStack->MajorFunction, IoStack->MinorFunction);
562 Irp->IoStatus.Information = 0;
571 Offset = IoStack->Parameters.Read.ByteOffset;
572 Length = IoStack->Parameters.Read.Length;
583 ok(
Irp->AssociatedIrp.SystemBuffer ==
NULL,
"A SystemBuffer was allocated!\n");
595 ok(
Mdl !=
NULL,
"Null pointer for MDL!\n");
struct _TEST_CONTEXT TEST_CONTEXT
VOID NTAPI ReleaseFromReadAhead(_In_ PVOID Context)
static PDEVICE_OBJECT TestDeviceObject
static PFILE_OBJECT TestFileObject
#define IOCTL_FINISH_TEST
static CC_FILE_SIZES FileSizes
static VOID PerformTest(ULONG TestId, PDEVICE_OBJECT DeviceObject)
struct _TEST_FCB TEST_FCB
BOOLEAN NTAPI AcquireForReadAhead(_In_ PVOID Context, _In_ BOOLEAN Wait)
static VOID CleanupTest(ULONG TestId, PDEVICE_OBJECT DeviceObject)
struct _TEST_FCB * PTEST_FCB
VOID TestUnload(_In_ PDRIVER_OBJECT DriverObject)
struct _TEST_CONTEXT * PTEST_CONTEXT
static PVOID MapAndLockUserBuffer(_In_ _Out_ PIRP Irp, _In_ ULONG BufferLength)
static CACHE_MANAGER_CALLBACKS Callbacks
static KMT_MESSAGE_HANDLER TestMessageHandler
VOID NTAPI ReleaseFromLazyWrite(_In_ PVOID Context)
NTSTATUS TestEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PCUNICODE_STRING RegistryPath, _Out_ PCWSTR *DeviceName, _Inout_ INT *Flags)
static VOID NTAPI PinInAnotherThread(IN PVOID Context)
BOOLEAN NTAPI AcquireForLazyWrite(_In_ PVOID Context, _In_ BOOLEAN Wait)
static KMT_IRP_HANDLER TestIrpHandler
static VOID NTAPI PinInAnotherThreadExclusive(IN PVOID Context)
#define ok_eq_pointer(value, expected)
#define ok_eq_ulong(value, expected)
#define CcIsFileCached(FO)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
#define ExAllocatePool(type, size)
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
VOID NTAPI CcInitializeCacheMap(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes, IN BOOLEAN PinAccess, IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext)
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
#define EXCEPTION_EXECUTE_HANDLER
#define RtlFillMemory(Dest, Length, Fill)
#define KmtEndSeh(ExpectedStatus)
PKTHREAD KmtStartThread(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext OPTIONAL)
VOID KmtFinishThread(IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL)
NTSTATUS KmtRegisterMessageHandler(IN ULONG ControlCode OPTIONAL, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_MESSAGE_HANDLER MessageHandler)
NTSTATUS KmtRegisterIrpHandler(IN UCHAR MajorFunction, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_IRP_HANDLER IrpHandler)
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
#define RTL_CONSTANT_LARGE_INTEGER(quad_part)
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
PFILE_OBJECT NTAPI IoCreateStreamFileObject(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject)
#define IoCompleteRequest
#define STATUS_NOT_SUPPORTED
#define STATUS_NOT_IMPLEMENTED
VOID NTAPI CcUnpinData(IN PVOID Bcb)
BOOLEAN NTAPI CcPinMappedData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, IN OUT PVOID *Bcb)
BOOLEAN NTAPI CcPinRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
BOOLEAN NTAPI CcMapData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *BcbResult, OUT PVOID *Buffer)
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
SECTION_OBJECT_POINTERS SectionObjectPointers
FSRTL_ADVANCED_FCB_HEADER Header
SECTION_OBJECT_POINTERS SectionObjectPointers
FSRTL_ADVANCED_FCB_HEADER Header
#define RtlZeroMemory(Destination, Length)
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_In_ WDFDPC _In_ BOOLEAN Wait
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
_Must_inspect_result_ _In_ ULONG Flags
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define MDL_SOURCE_IS_NONPAGED_POOL
#define ObDereferenceObject