ReactOS  0.4.15-dev-3165-gdf6fff7
CcCopyWrite_drv.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS kernel-mode tests
3  * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4  * PURPOSE: Test driver for CcCopyWrite function
5  * PROGRAMMER: Pierre Schweitzer <pierre@reactos.org>
6  */
7 
8 #include <kmt_test.h>
9 
10 #define NDEBUG
11 #include <debug.h>
12 
13 typedef struct _TEST_FCB
14 {
20 
23 static KMT_IRP_HANDLER TestIrpHandler;
26 
30 
31 static
32 BOOLEAN
33 NTAPI
43 {
45  return FALSE;
46 }
47 
48 static
49 BOOLEAN
50 NTAPI
60 {
62  return FALSE;
63 }
64 
70  _Inout_ INT *Flags)
71 {
73 
74  PAGED_CODE();
75 
77 
78  *DeviceName = L"CcCopyWrite";
79  *Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE |
80  TESTENTRY_BUFFERED_IO_DEVICE |
81  TESTENTRY_NO_READONLY_DEVICE;
82 
88 
91  DriverObject->FastIoDispatch = &TestFastIoDispatch;
92 
93 
94  return Status;
95 }
96 
97 VOID
100 {
101  PAGED_CODE();
102 }
103 
104 BOOLEAN
105 NTAPI
108  _In_ BOOLEAN Wait)
109 {
110  return TRUE;
111 }
112 
113 VOID
114 NTAPI
117 {
118  return;
119 }
120 
121 BOOLEAN
122 NTAPI
125  _In_ BOOLEAN Wait)
126 {
127  return TRUE;
128 }
129 
130 VOID
131 NTAPI
134 {
135  return;
136 }
137 
143 };
144 
145 static
146 PVOID
148  _In_ _Out_ PIRP Irp,
150 {
151  PMDL Mdl;
152 
153  if (Irp->MdlAddress == NULL)
154  {
155  Mdl = IoAllocateMdl(Irp->UserBuffer, BufferLength, FALSE, FALSE, Irp);
156  if (Mdl == NULL)
157  {
158  return NULL;
159  }
160 
161  _SEH2_TRY
162  {
163  MmProbeAndLockPages(Mdl, Irp->RequestorMode, IoWriteAccess);
164  }
166  {
167  IoFreeMdl(Mdl);
168  Irp->MdlAddress = NULL;
169  _SEH2_YIELD(return NULL);
170  }
171  _SEH2_END;
172  }
173 
175 }
176 
177 static
178 void
180 {
181  ReadCalled = FALSE;
182  ReadOffset.QuadPart = MAXLONGLONG;
184 }
185 
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); \
190 }while(0)
191 
192 #define ok_read_not_called() ok(!ReadCalled, "CcCopyWrite shouldn't have triggered a read.\n")
193 
194 static
195 VOID
197 {
198 
199  BOOLEAN Ret;
201  CHAR Buffer[10];
202 
203  memset(Buffer, 0xAC, 10);
204 
205  /* Test bogus file object & file offset */
206  Ret = 'x';
207  KmtStartSeh()
208  Ret = CcCopyWrite(FileObject, NULL, 0, FALSE, NULL);
210  ok_eq_char(Ret, 'x');
211 
212  Ret = 'x';
213  Offset.QuadPart = 0;
214  KmtStartSeh()
215  Ret = CcCopyWrite(NULL, &Offset, 10, FALSE, Buffer);
217  ok_eq_char(Ret, 'x');
218 
219  /* What happens on invalid buffer */
220  Ret = 'x';
221  Offset.QuadPart = 0;
222  reset_read();
223  KmtStartSeh()
224  Ret = CcCopyWrite(FileObject, &Offset, 0, TRUE, NULL);
226  ok_bool_true(Ret, "CcCopyWrite(0, NULL) should succeed\n");
227  /* When there is nothing to write, there is no reason to read */
229 
230  Ret = 'x';
231  Offset.QuadPart = 0;
232  reset_read();
233  KmtStartSeh()
234  Ret = CcCopyWrite(FileObject, &Offset, 10, TRUE, NULL);
236  ok_eq_char(Ret, 'x');
237  /* This raises an exception, but it actually triggered a read */
239 
240  /* So this one succeeds, as the page is now resident */
241  Ret = 'x';
242  Offset.QuadPart = 0;
243  reset_read();
244  KmtStartSeh()
245  Ret = CcCopyWrite(FileObject, &Offset, 10, FALSE, Buffer);
247  ok_bool_true(Ret, "CcCopyWrite should succeed\n");
248  /* But there was no read triggered, as the page is already resident. */
250 
251  /* But this one doesn't */
252  Ret = 'x';
253  Offset.QuadPart = PAGE_SIZE;
254  reset_read();
255  KmtStartSeh()
256  Ret = CcCopyWrite(FileObject, &Offset, 10, FALSE, Buffer);
258  ok_bool_false(Ret, "CcCopyWrite should fail\n");
259  /* But it triggered a read anyway. */
261 
262  /* Of course, waiting for it succeeds and triggers the read */
263  Ret = 'x';
264  Offset.QuadPart = PAGE_SIZE * 2;
265  reset_read();
266  KmtStartSeh()
267  Ret = CcCopyWrite(FileObject, &Offset, 10, TRUE, Buffer);
269  ok_bool_true(Ret, "CcCopyWrite should succeed\n");
271 }
272 
273 static
274 NTSTATUS
277  _In_ PIRP Irp,
278  _In_ PIO_STACK_LOCATION IoStack)
279 {
282  PTEST_FCB Fcb;
283  CACHE_UNINITIALIZE_EVENT CacheUninitEvent;
284 
285  PAGED_CODE();
286 
287  DPRINT("IRP %x/%x\n", IoStack->MajorFunction, IoStack->MinorFunction);
288  ASSERT(IoStack->MajorFunction == IRP_MJ_CLEANUP ||
289  IoStack->MajorFunction == IRP_MJ_CREATE ||
290  IoStack->MajorFunction == IRP_MJ_READ ||
291  IoStack->MajorFunction == IRP_MJ_WRITE ||
292  IoStack->MajorFunction == IRP_MJ_FLUSH_BUFFERS);
293 
295  Irp->IoStatus.Information = 0;
296 
297  if (IoStack->MajorFunction == IRP_MJ_CREATE)
298  {
299  ok_irql(PASSIVE_LEVEL);
300 
301  if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR))
302  {
304  TestFileObject = IoStack->FileObject;
305  }
306  Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(*Fcb), 'FwrI');
307  RtlZeroMemory(Fcb, sizeof(*Fcb));
308  ExInitializeFastMutex(&Fcb->HeaderMutex);
309  FsRtlSetupAdvancedHeader(&Fcb->Header, &Fcb->HeaderMutex);
310  if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) &&
311  IoStack->FileObject->FileName.Buffer[1] == 'B')
312  {
313  Fcb->Header.AllocationSize.QuadPart = 1000000;
314  Fcb->Header.FileSize.QuadPart = 1000000;
315  Fcb->Header.ValidDataLength.QuadPart = 1000000;
316  }
317  else if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) &&
318  IoStack->FileObject->FileName.Buffer[1] == 'S')
319  {
320  Fcb->Header.AllocationSize.QuadPart = 512;
321  Fcb->Header.FileSize.QuadPart = 512;
322  Fcb->Header.ValidDataLength.QuadPart = 512;
323  }
324  else if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) &&
325  IoStack->FileObject->FileName.Buffer[1] == 'V')
326  {
327  Fcb->Header.AllocationSize.QuadPart = 62;
328  Fcb->Header.FileSize.QuadPart = 62;
329  Fcb->Header.ValidDataLength.QuadPart = 62;
330  }
331  else
332  {
333  Fcb->Header.AllocationSize.QuadPart = 1004;
334  Fcb->Header.FileSize.QuadPart = 1004;
335  Fcb->Header.ValidDataLength.QuadPart = 1004;
336  }
337  Fcb->Header.IsFastIoPossible = FastIoIsNotPossible;
338  IoStack->FileObject->FsContext = Fcb;
339  IoStack->FileObject->SectionObjectPointer = &Fcb->SectionObjectPointers;
340 
341  CcInitializeCacheMap(IoStack->FileObject,
342  (PCC_FILE_SIZES)&Fcb->Header.AllocationSize,
343  FALSE, &Callbacks, NULL);
344 
345  Irp->IoStatus.Information = FILE_OPENED;
347  }
348  else if (IoStack->MajorFunction == IRP_MJ_READ)
349  {
350  PMDL Mdl;
351  ULONG Length;
352  PVOID Buffer;
354 
355  Offset = IoStack->Parameters.Read.ByteOffset;
356  Length = IoStack->Parameters.Read.Length;
357  Fcb = IoStack->FileObject->FsContext;
358 
360  ok_eq_pointer(IoStack->FileObject, TestFileObject);
361 
362  ok(BooleanFlagOn(Irp->Flags, IRP_NOCACHE), "IRP not coming from Cc!\n");
363  ok_irql(APC_LEVEL);
364  ok((Offset.QuadPart == 0 || Offset.QuadPart == 4096 || Offset.QuadPart == 8192), "Unexpected offset: %I64i\n", Offset.QuadPart);
365  ok(Length % PAGE_SIZE == 0, "Length is not aligned: %I64i\n", Length);
366 
367  ReadCalled = TRUE;
368  ReadOffset = Offset;
369  ReadLength = Length;
370 
371  ok(Irp->AssociatedIrp.SystemBuffer == NULL, "A SystemBuffer was allocated!\n");
373  ok(Buffer != NULL, "Null pointer!\n");
374  RtlFillMemory(Buffer, Length, 0xBA);
375 
377 
378  Mdl = Irp->MdlAddress;
379  ok(Mdl != NULL, "Null pointer for MDL!\n");
380  ok((Mdl->MdlFlags & MDL_PAGES_LOCKED) != 0, "MDL not locked\n");
381  ok((Mdl->MdlFlags & MDL_SOURCE_IS_NONPAGED_POOL) == 0, "MDL from non paged\n");
382  ok((Mdl->MdlFlags & MDL_IO_PAGE_READ) != 0, "Non paging IO\n");
383  ok((Irp->Flags & IRP_PAGING_IO) != 0, "Non paging IO\n");
384 
385  Irp->IoStatus.Information = Length;
386  IoStack->FileObject->CurrentByteOffset.QuadPart = Offset.QuadPart + Length;
387  }
388  else if (IoStack->MajorFunction == IRP_MJ_WRITE)
389  {
390  PMDL Mdl;
391  ULONG Length;
392  PVOID Buffer;
394  static const UNICODE_STRING BehaviourTestFileName = RTL_CONSTANT_STRING(L"\\BehaviourTestFile");
395 
396  Offset = IoStack->Parameters.Read.ByteOffset;
397  Length = IoStack->Parameters.Read.Length;
398  Fcb = IoStack->FileObject->FsContext;
399 
400  ok_bool_false(InBehaviourTest, "Shouldn't trigger write from CcCopyWrite\n");
401  /* Check special file name */
402  InBehaviourTest = RtlCompareUnicodeString(&IoStack->FileObject->FileName, &BehaviourTestFileName, TRUE) == 0;
403 
404  if (!FlagOn(Irp->Flags, IRP_NOCACHE))
405  {
406  BOOLEAN Ret;
407 
408  ok_irql(PASSIVE_LEVEL);
409 
410  if (InBehaviourTest)
411  {
412  Test_CcCopyWrite(IoStack->FileObject);
413  Status = Irp->IoStatus.Status = STATUS_SUCCESS;
414  }
415  else
416  {
417  Buffer = Irp->AssociatedIrp.SystemBuffer;
418  ok(Buffer != NULL, "Null pointer!\n");
419 
420  Fcb->WriteLength = Length;
421 
422  _SEH2_TRY
423  {
424  Ret = CcCopyWrite(IoStack->FileObject, &Offset, Length, TRUE, Buffer);
425  ok_bool_true(Ret, "CcCopyWrite");
426  }
428  {
429  Irp->IoStatus.Status = _SEH2_GetExceptionCode();
430  }
431  _SEH2_END;
432 
433  Status = Irp->IoStatus.Status;
434  }
435  }
436  else
437  {
438  ok_irql(PASSIVE_LEVEL);
439 
440  if (InBehaviourTest)
441  {
442  /* We wrote only to the 1st and 3rd page */
443  ok((Offset.QuadPart == 0) || (Offset.QuadPart == PAGE_SIZE * 2), "Expected a non-cached write on 1st or 3rd page\n");
444  /* We wrote that much with CcCopyWrite */
446  }
447  else
448  {
449  ok((Offset.QuadPart == 0 || Offset.QuadPart == 4096), "Unexpected offset: %I64i\n", Offset.QuadPart);
450  ok_eq_ulong(Length, ROUND_TO_PAGES(Fcb->WriteLength));
451  }
452 
453  ok(Irp->AssociatedIrp.SystemBuffer == NULL, "A SystemBuffer was allocated!\n");
455  ok(Buffer != NULL, "Null pointer!\n");
456 
458 
459  Mdl = Irp->MdlAddress;
460  ok(Mdl != NULL, "Null pointer for MDL!\n");
461  ok((Mdl->MdlFlags & MDL_PAGES_LOCKED) != 0, "MDL not locked\n");
462  ok((Mdl->MdlFlags & MDL_SOURCE_IS_NONPAGED_POOL) == 0, "MDL from non paged\n");
463  ok((Mdl->MdlFlags & MDL_IO_PAGE_READ) == 0, "MDL for read paging IO\n");
464  ok((Irp->Flags & IRP_PAGING_IO) != 0, "Non paging IO\n");
465  }
466 
468  }
469  else if (IoStack->MajorFunction == IRP_MJ_FLUSH_BUFFERS)
470  {
472 
473  Fcb = IoStack->FileObject->FsContext;
475 
477  }
478  else if (IoStack->MajorFunction == IRP_MJ_CLEANUP)
479  {
480  ok_irql(PASSIVE_LEVEL);
481  KeInitializeEvent(&CacheUninitEvent.Event, NotificationEvent, FALSE);
482  CcUninitializeCacheMap(IoStack->FileObject, &Zero, &CacheUninitEvent);
483  KeWaitForSingleObject(&CacheUninitEvent.Event, Executive, KernelMode, FALSE, NULL);
484  Fcb = IoStack->FileObject->FsContext;
485  ExFreePoolWithTag(Fcb, 'FwrI');
486  IoStack->FileObject->FsContext = NULL;
488  }
489 
490  if (Status == STATUS_PENDING)
491  {
495  }
496  else
497  {
498  Irp->IoStatus.Status = Status;
500  }
501 
502  return Status;
503 }
#define MDL_IO_PAGE_READ
Definition: mmtypes.h:24
#define ok_eq_ulong(value, expected)
const uint16_t * PCWSTR
Definition: typedefs.h:57
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
return STATUS_NOT_SUPPORTED
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define LL
Definition: tui.h:84
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define _Inout_
Definition: ms_sal.h:378
#define IRP_MJ_FLUSH_BUFFERS
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
Definition: cachesub.c:222
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:925
PFILE_OBJECT FileObject
Definition: ntfs.h:520
#define _Out_
Definition: ms_sal.h:345
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:167
#define ok_eq_pointer(value, expected)
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
#define KmtEndSeh(ExpectedStatus)
Definition: kmt_test.h:283
#define FILE_OPENED
Definition: nt_native.h:769
#define IRP_NOCACHE
#define ok_eq_char(value, expected)
Definition: kmt_test.h:244
static PDEVICE_OBJECT TestDeviceObject
ULONG ReadLength
#define MAXLONGLONG
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
int32_t INT
Definition: typedefs.h:58
_SEH2_TRY
Definition: create.c:4226
VOID TestUnload(_In_ PDRIVER_OBJECT DriverObject)
#define ok_bool_false(value, desc)
Definition: kmt_test.h:257
#define ok_bool_true(value, desc)
Definition: kmt_test.h:256
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
static BOOLEAN InBehaviourTest
#define RTL_CONSTANT_LARGE_INTEGER(quad_part)
Definition: rtltypes.h:416
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
static PVOID MapAndLockUserBuffer(_In_ _Out_ PIRP Irp, _In_ ULONG BufferLength)
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
_Must_inspect_result_ _In_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY _In_opt_ PWDFMEMORY_OFFSET ReadOffset
Definition: wdfusb.h:1996
ULONG WriteLength
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
unsigned char BOOLEAN
#define _In_
Definition: ms_sal.h:308
#define MDL_SOURCE_IS_NONPAGED_POOL
Definition: mmtypes.h:20
#define IoCompleteRequest
Definition: irp.c:1240
VOID NTAPI ReleaseFromLazyWrite(_In_ PVOID Context)
Definition: bufpool.h:45
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:547
NTSTATUS KmtRegisterIrpHandler(IN UCHAR MajorFunction, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_IRP_HANDLER IrpHandler)
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
Status
Definition: gdiplustypes.h:24
FAST_MUTEX
Definition: extypes.h:17
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2662
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
static FAST_IO_DISPATCH TestFastIoDispatch
BOOLEAN NTAPI AcquireForReadAhead(_In_ PVOID Context, _In_ BOOLEAN Wait)
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19
#define STATUS_PENDING
Definition: ntstatus.h:82
VOID NTAPI CcInitializeCacheMap(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes, IN BOOLEAN PinAccess, IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext)
Definition: fssup.c:195
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
SECTION_OBJECT_POINTERS SectionObjectPointers
* PFILE_OBJECT
Definition: iotypes.h:1998
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS TestEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PCUNICODE_STRING RegistryPath, _Out_ PCWSTR *DeviceName, _Inout_ INT *Flags)
static const WCHAR L[]
Definition: oid.c:1250
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
FSRTL_ADVANCED_FCB_HEADER Header
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define KmtStartSeh()
Definition: kmt_test.h:277
static VOID Test_CcCopyWrite(PFILE_OBJECT FileObject)
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
#define MAXULONG
Definition: typedefs.h:251
BOOLEAN NTAPI CcCopyWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN PVOID Buffer)
Definition: copysup.c:129
BOOLEAN ReadCalled
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
VOID NTAPI ReleaseFromReadAhead(_In_ PVOID Context)
PFAST_IO_READ FastIoRead
Definition: iotypes.h:1735
_SEH2_END
Definition: create.c:4400
static CACHE_MANAGER_CALLBACKS Callbacks
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
PFAST_IO_WRITE FastIoWrite
Definition: iotypes.h:1736
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:922
static KMT_IRP_HANDLER TestIrpHandler
#define ROUND_TO_PAGES(Size)
BOOLEAN NTAPI AcquireForLazyWrite(_In_ PVOID Context, _In_ BOOLEAN Wait)
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:286
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:159
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define ok_read_not_called()
#define ok_read_called(_Offset, _Length)
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define IRP_PAGING_IO
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
Definition: fatprocs.h:411
#define IRP_MJ_READ
Definition: rdpdr.c:46
FAST_MUTEX HeaderMutex
#define IRP_MJ_CLEANUP
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:155
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
static void reset_read(void)
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define DPRINT
Definition: sndvol32.h:71
_In_ PFCB Fcb
Definition: cdprocs.h:159
struct _TEST_FCB TEST_FCB
IoMarkIrpPending(Irp)
#define memset(x, y, z)
Definition: compat.h:39
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define APC_LEVEL
Definition: env_spec_w32.h:695
SECTION_OBJECT_POINTERS SectionObjectPointers
Definition: ntfs.h:518
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 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)
#define PAGED_CODE()
struct _TEST_FCB * PTEST_FCB
LARGE_INTEGER ReadOffset
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
static PFILE_OBJECT TestFileObject