13#define IOCTL_START_TEST 1
14#define IOCTL_FINISH_TEST 2
55 *
Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE |
56 TESTENTRY_BUFFERED_IO_DEVICE |
57 TESTENTRY_NO_READONLY_DEVICE;
87 trace(
"System with %I64dMb RAM and terminal services %S\n",
Memory, (
TS ?
L"enabled" :
L"disabled"));
193 ok(TestContext !=
NULL,
"Called in invalid context!\n");
194 ok(TestContext->
Bcb !=
NULL,
"Called in invalid context!\n");
195 ok(TestContext->
Buffer !=
NULL,
"Called in invalid context!\n");
196 ok(TestContext->
Length != 0,
"Called in invalid context!\n");
204 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
216 if (!
skip(Ret ==
TRUE,
"CcPinRead failed\n"))
218 ok(
Bcb != TestContext->
Bcb,
"Returned same BCB!\n");
227 ok(Ret ==
FALSE,
"CcPinRead succeed\n");
238 if (!
skip(Ret ==
TRUE,
"CcPinRead failed\n"))
240 ok(
Bcb != TestContext->
Bcb,
"Returned same BCB!\n");
247 TestContext->
Length -= 0x500;
253 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
290 FsRtlSetupAdvancedHeader(&
Fcb->
Header, &
Fcb->HeaderMutex);
304 Offset.QuadPart = TestId * 0x1000;
309 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
316 else if (TestId == 3)
321 if (!
skip(TestContext !=
NULL,
"ExAllocatePool failed\n"))
329 if (!
skip(Ret ==
TRUE,
"CcMapData failed\n"))
339 "Buffer %p not mapped in system space\n", TestContext->
Buffer);
344 "Buffer %p not mapped in system space\n", TestContext->
Buffer);
349 "Buffer %p not mapped in system space\n", TestContext->
Buffer);
351#elif defined(_M_AMD64)
353 "Buffer %p not mapped in system space\n", TestContext->
Buffer);
355 skip(
FALSE,
"System space mapping not defined\n");
372 else if (TestId == 4)
384 ok(Ret ==
TRUE,
"CcMapData failed\n");
398 ok(Ret ==
TRUE,
"CcMapData failed\n");
412 ok(Ret ==
TRUE,
"CcMapData failed\n");
425 ok(Ret ==
TRUE,
"CcMapData failed\n");
439 ok(Ret ==
TRUE,
"CcMapData failed\n");
535 DPRINT(
"IRP %x/%x\n", IoStack->MajorFunction, IoStack->MinorFunction);
541 Irp->IoStatus.Information = 0;
550 Offset = IoStack->Parameters.Read.ByteOffset;
551 Length = IoStack->Parameters.Read.Length;
562 ok(
Irp->AssociatedIrp.SystemBuffer ==
NULL,
"A SystemBuffer was allocated!\n");
574 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 VOID NTAPI MapInAnotherThread(IN PVOID Context)
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)
BOOLEAN NTAPI AcquireForLazyWrite(_In_ PVOID Context, _In_ BOOLEAN Wait)
static KMT_IRP_HANDLER TestIrpHandler
#define ok_eq_pointer(value, expected)
#define ok_eq_ulong(value, expected)
OSVERSIONINFOW VersionInfo
#define CcIsFileCached(FO)
#define NT_SUCCESS(StatCode)
NTSTATUS NTAPI RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define BooleanFlagOn(F, SF)
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)
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
VOID NTAPI CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
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 VER_SUITE_TERMINAL
#define UNREFERENCED_PARAMETER(P)
#define VER_SUITE_SINGLEUSERTS
_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 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)
LARGE_INTEGER AllocationSize
SECTION_OBJECT_POINTERS SectionObjectPointers
FSRTL_ADVANCED_FCB_HEADER Header
ULONG dwOSVersionInfoSize
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
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
_Must_inspect_result_ _In_ ULONG Flags
#define VACB_MAPPING_GRANULARITY
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define MDL_SOURCE_IS_NONPAGED_POOL
#define ObDereferenceObject