62 *
Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE |
63 TESTENTRY_BUFFERED_IO_DEVICE |
64 TESTENTRY_NO_READONLY_DEVICE;
166#define ok_read_called(_Offset, _Length) do { \
167 ok(ReadCalledNonCached, "CcCopyRead should have triggerred a non-cached read.\n"); \
168 ok_eq_longlong(ReadOffset.QuadPart, _Offset); \
169 ok_eq_ulong(ReadLength, _Length); \
172#define ok_read_not_called() ok(!ReadCalledNonCached, "CcCopyRead shouldn't have triggered a read.\n")
208 ok_bool_true(Ret,
"CcCopyRead(0, NULL) should succeed\n");
292 DPRINT(
"IRP %x/%x\n", IoStack->MajorFunction, IoStack->MinorFunction);
298 Irp->IoStatus.Information = 0;
304 if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR))
312 FsRtlSetupAdvancedHeader(&
Fcb->
Header, &
Fcb->HeaderMutex);
314 if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR) &&
315 IoStack->FileObject->FileName.Buffer[1] ==
'B')
317 Fcb->
Header.AllocationSize.QuadPart = 1000000;
319 Fcb->
Header.ValidDataLength.QuadPart = 1000000;
321 else if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR) &&
322 IoStack->FileObject->FileName.Buffer[1] ==
'S')
324 Fcb->
Header.AllocationSize.QuadPart = 1004;
326 Fcb->
Header.ValidDataLength.QuadPart = 1004;
328 else if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR) &&
329 IoStack->FileObject->FileName.Buffer[1] ==
'R')
331 Fcb->
Header.AllocationSize.QuadPart = 62;
333 Fcb->
Header.ValidDataLength.QuadPart = 62;
335 else if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR) &&
336 IoStack->FileObject->FileName.Buffer[1] ==
'F')
338 Fcb->
Header.AllocationSize.QuadPart = 4294967296;
339 Fcb->
Header.FileSize.QuadPart = 4294967296;
340 Fcb->
Header.ValidDataLength.QuadPart = 4294967296;
345 Fcb->
Header.AllocationSize.QuadPart = 512;
347 Fcb->
Header.ValidDataLength.QuadPart = 512;
350 IoStack->FileObject->FsContext =
Fcb;
368 Offset = IoStack->Parameters.Read.ByteOffset;
369 Length = IoStack->Parameters.Read.Length;
396 Buffer =
Irp->AssociatedIrp.SystemBuffer;
438 ok(
Irp->AssociatedIrp.SystemBuffer ==
NULL,
"A SystemBuffer was allocated!\n");
450 ok(
Mdl !=
NULL,
"Null pointer for MDL!\n");
460 IoStack->FileObject->CurrentByteOffset.QuadPart =
Offset.QuadPart +
Length;
473 IoStack->FileObject->FsContext =
NULL;
VOID NTAPI ReleaseFromReadAhead(_In_ PVOID Context)
static PDEVICE_OBJECT TestDeviceObject
static PFILE_OBJECT TestFileObject
static FAST_IO_DISPATCH TestFastIoDispatch
struct _TEST_FCB TEST_FCB
BOOLEAN NTAPI AcquireForReadAhead(_In_ PVOID Context, _In_ BOOLEAN Wait)
static BOOLEAN InBehaviourTest
struct _TEST_FCB * PTEST_FCB
VOID TestUnload(_In_ PDRIVER_OBJECT DriverObject)
#define ok_read_not_called()
static void reset_read(void)
static PVOID MapAndLockUserBuffer(_In_ _Out_ PIRP Irp, _In_ ULONG BufferLength)
static CACHE_MANAGER_CALLBACKS Callbacks
static BOOLEAN NTAPI FastIoRead(_In_ PFILE_OBJECT FileObject, _In_ PLARGE_INTEGER FileOffset, _In_ ULONG Length, _In_ BOOLEAN Wait, _In_ ULONG LockKey, _Out_ PVOID Buffer, _Out_ PIO_STATUS_BLOCK IoStatus, _In_ PDEVICE_OBJECT DeviceObject)
VOID NTAPI ReleaseFromLazyWrite(_In_ PVOID Context)
BOOLEAN ReadCalledNonCached
#define ok_read_called(_Offset, _Length)
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_char(value, expected)
#define ok_eq_hex(value, expected)
#define ok_bool_false(value, desc)
#define ok_bool_true(value, desc)
#define ok_eq_ulongptr(value, expected)
_In_ PFCB _In_ LONGLONG FileOffset
#define NT_SUCCESS(StatCode)
#define ExAllocatePoolWithTag(hernya, size, tag)
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
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)
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 ExFreePoolWithTag(_P, _T)
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
#define RTL_CONSTANT_LARGE_INTEGER(quad_part)
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
BOOLEAN NTAPI CcCopyRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus)
#define IoCompleteRequest
#define STATUS_NOT_SUPPORTED
#define STATUS_ACCESS_VIOLATION
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
KMT_TESTFUNC Test_CcCopyRead
SECTION_OBJECT_POINTERS SectionObjectPointers
FSRTL_ADVANCED_FCB_HEADER Header
SECTION_OBJECT_POINTERS SectionObjectPointers
FSRTL_ADVANCED_FCB_HEADER Header
#define RTL_CONSTANT_STRING(s)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_USER_BUFFER
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_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_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY _In_opt_ PWDFMEMORY_OFFSET ReadOffset
_Must_inspect_result_ _In_ ULONG Flags
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define MDL_SOURCE_IS_NONPAGED_POOL