79 *
Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE |
80 TESTENTRY_BUFFERED_IO_DEVICE |
81 TESTENTRY_NO_READONLY_DEVICE;
186#define ok_read_called(_Offset, _Length) do { \
187 ok(ReadCalled, "CcCopyWrite should have triggerred a read.\n"); \
188 ok_eq_longlong(ReadOffset.QuadPart, _Offset); \
189 ok_eq_ulong(ReadLength, _Length); \
192#define ok_read_not_called() ok(!ReadCalled, "CcCopyWrite shouldn't have triggered a read.\n")
226 ok_bool_true(Ret,
"CcCopyWrite(0, NULL) should succeed\n");
287 DPRINT(
"IRP %x/%x\n", IoStack->MajorFunction, IoStack->MinorFunction);
295 Irp->IoStatus.Information = 0;
301 if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR))
309 FsRtlSetupAdvancedHeader(&
Fcb->
Header, &
Fcb->HeaderMutex);
310 if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR) &&
311 IoStack->FileObject->FileName.Buffer[1] ==
'B')
313 Fcb->
Header.AllocationSize.QuadPart = 1000000;
315 Fcb->
Header.ValidDataLength.QuadPart = 1000000;
317 else if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR) &&
318 IoStack->FileObject->FileName.Buffer[1] ==
'S')
320 Fcb->
Header.AllocationSize.QuadPart = 512;
322 Fcb->
Header.ValidDataLength.QuadPart = 512;
324 else if (IoStack->FileObject->FileName.Length >= 2 *
sizeof(
WCHAR) &&
325 IoStack->FileObject->FileName.Buffer[1] ==
'V')
327 Fcb->
Header.AllocationSize.QuadPart = 62;
329 Fcb->
Header.ValidDataLength.QuadPart = 62;
333 Fcb->
Header.AllocationSize.QuadPart = 1004;
335 Fcb->
Header.ValidDataLength.QuadPart = 1004;
338 IoStack->FileObject->FsContext =
Fcb;
355 Offset = IoStack->Parameters.Read.ByteOffset;
356 Length = IoStack->Parameters.Read.Length;
364 ok((
Offset.QuadPart == 0 ||
Offset.QuadPart == 4096 ||
Offset.QuadPart == 8192),
"Unexpected offset: %I64i\n",
Offset.QuadPart);
371 ok(
Irp->AssociatedIrp.SystemBuffer ==
NULL,
"A SystemBuffer was allocated!\n");
379 ok(
Mdl !=
NULL,
"Null pointer for MDL!\n");
386 IoStack->FileObject->CurrentByteOffset.QuadPart =
Offset.QuadPart +
Length;
396 Offset = IoStack->Parameters.Read.ByteOffset;
397 Length = IoStack->Parameters.Read.Length;
417 Buffer =
Irp->AssociatedIrp.SystemBuffer;
443 ok((
Offset.QuadPart == 0) || (
Offset.QuadPart ==
PAGE_SIZE * 2),
"Expected a non-cached write on 1st or 3rd page\n");
449 ok((
Offset.QuadPart == 0 ||
Offset.QuadPart == 4096),
"Unexpected offset: %I64i\n",
Offset.QuadPart);
453 ok(
Irp->AssociatedIrp.SystemBuffer ==
NULL,
"A SystemBuffer was allocated!\n");
460 ok(
Mdl !=
NULL,
"Null pointer for MDL!\n");
486 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 BOOLEAN NTAPI FastIoWrite(_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)
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)
#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_ulong(value, expected)
#define ok_bool_false(value, desc)
#define ok_bool_true(value, desc)
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
_In_ PFCB _In_ LONGLONG FileOffset
#define STATUS_NOT_SUPPORTED
#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)
#define BooleanFlagOn(F, SF)
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 RtlFillMemory(Dest, Length, Fill)
#define EXCEPTION_EXECUTE_HANDLER
#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 CcCopyWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN PVOID Buffer)
#define IoCompleteRequest
#define STATUS_ACCESS_VIOLATION
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
KMT_TESTFUNC Test_CcCopyWrite
PFAST_IO_WRITE FastIoWrite
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 IRP_MJ_FLUSH_BUFFERS
#define ROUND_TO_PAGES(Size)
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define MDL_SOURCE_IS_NONPAGED_POOL