ReactOS 0.4.16-dev-334-g4d9f67c
CcCopyRead_drv.c File Reference
#include <kmt_test.h>
#include <debug.h>
Include dependency graph for CcCopyRead_drv.c:

Go to the source code of this file.

Classes

struct  _TEST_FCB
 

Macros

#define NDEBUG
 
#define ok_read_called(_Offset, _Length)
 
#define ok_read_not_called()   ok(!ReadCalledNonCached, "CcCopyRead shouldn't have triggered a read.\n")
 

Typedefs

typedef struct _TEST_FCB TEST_FCB
 
typedef struct _TEST_FCBPTEST_FCB
 

Functions

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)
 
NTSTATUS TestEntry (_In_ PDRIVER_OBJECT DriverObject, _In_ PCUNICODE_STRING RegistryPath, _Out_ PCWSTR *DeviceName, _Inout_ INT *Flags)
 
VOID TestUnload (_In_ PDRIVER_OBJECT DriverObject)
 
BOOLEAN NTAPI AcquireForLazyWrite (_In_ PVOID Context, _In_ BOOLEAN Wait)
 
VOID NTAPI ReleaseFromLazyWrite (_In_ PVOID Context)
 
BOOLEAN NTAPI AcquireForReadAhead (_In_ PVOID Context, _In_ BOOLEAN Wait)
 
VOID NTAPI ReleaseFromReadAhead (_In_ PVOID Context)
 
static PVOID MapAndLockUserBuffer (_In_ _Out_ PIRP Irp, _In_ ULONG BufferLength)
 
static void reset_read (void)
 
static VOID Test_CcCopyRead (PFILE_OBJECT FileObject)
 
static NTSTATUS TestIrpHandler (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PIO_STACK_LOCATION IoStack)
 

Variables

static PFILE_OBJECT TestFileObject
 
static PDEVICE_OBJECT TestDeviceObject
 
static KMT_IRP_HANDLER TestIrpHandler
 
static FAST_IO_DISPATCH TestFastIoDispatch
 
static BOOLEAN InBehaviourTest
 
BOOLEAN ReadCalledNonCached
 
LARGE_INTEGER ReadOffset
 
ULONG ReadLength
 
static CACHE_MANAGER_CALLBACKS Callbacks
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file CcCopyRead_drv.c.

◆ ok_read_called

#define ok_read_called (   _Offset,
  _Length 
)
Value:
do { \
ok(ReadCalledNonCached, "CcCopyRead should have triggerred a non-cached read.\n"); \
ok_eq_longlong(ReadOffset.QuadPart, _Offset); \
ok_eq_ulong(ReadLength, _Length); \
}while(0)
ULONG ReadLength
BOOLEAN ReadCalledNonCached
_Check_return_ _Ret_maybenull_ _In_ size_t _In_ size_t _Offset
Definition: malloc.h:140
_Must_inspect_result_ _In_ WDFUSBPIPE _In_ WDFREQUEST _In_opt_ WDFMEMORY _In_opt_ PWDFMEMORY_OFFSET ReadOffset
Definition: wdfusb.h:2003

Definition at line 166 of file CcCopyRead_drv.c.

◆ ok_read_not_called

#define ok_read_not_called ( )    ok(!ReadCalledNonCached, "CcCopyRead shouldn't have triggered a read.\n")

Definition at line 172 of file CcCopyRead_drv.c.

Typedef Documentation

◆ PTEST_FCB

◆ TEST_FCB

Function Documentation

◆ AcquireForLazyWrite()

BOOLEAN NTAPI AcquireForLazyWrite ( _In_ PVOID  Context,
_In_ BOOLEAN  Wait 
)

Definition at line 86 of file CcCopyRead_drv.c.

89{
90 return TRUE;
91}
#define TRUE
Definition: types.h:120

◆ AcquireForReadAhead()

BOOLEAN NTAPI AcquireForReadAhead ( _In_ PVOID  Context,
_In_ BOOLEAN  Wait 
)

Definition at line 103 of file CcCopyRead_drv.c.

106{
107 return TRUE;
108}

◆ FastIoRead()

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 
)
static

Definition at line 34 of file CcCopyRead_drv.c.

43{
45 return FALSE;
46}
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define FALSE
Definition: types.h:117
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159

Referenced by TestEntry().

◆ MapAndLockUserBuffer()

static PVOID MapAndLockUserBuffer ( _In_ _Out_ PIRP  Irp,
_In_ ULONG  BufferLength 
)
static

Definition at line 127 of file CcCopyRead_drv.c.

130{
131 PMDL Mdl;
132
133 if (Irp->MdlAddress == NULL)
134 {
135 Mdl = IoAllocateMdl(Irp->UserBuffer, BufferLength, FALSE, FALSE, Irp);
136 if (Mdl == NULL)
137 {
138 return NULL;
139 }
140
142 {
143 MmProbeAndLockPages(Mdl, Irp->RequestorMode, IoWriteAccess);
144 }
146 {
147 IoFreeMdl(Mdl);
148 Irp->MdlAddress = NULL;
149 _SEH2_YIELD(return NULL);
150 }
151 _SEH2_END;
152 }
153
155}
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define IoFreeMdl
Definition: fxmdl.h:89
#define IoAllocateMdl
Definition: fxmdl.h:88
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
@ NormalPagePriority
Definition: imports.h:54
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
@ IoWriteAccess
Definition: ketypes.h:864
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)

Referenced by TestIrpHandler().

◆ ReleaseFromLazyWrite()

VOID NTAPI ReleaseFromLazyWrite ( _In_ PVOID  Context)

Definition at line 95 of file CcCopyRead_drv.c.

97{
98 return;
99}

◆ ReleaseFromReadAhead()

VOID NTAPI ReleaseFromReadAhead ( _In_ PVOID  Context)

Definition at line 112 of file CcCopyRead_drv.c.

114{
115 return;
116}

◆ reset_read()

static void reset_read ( void  )
static

Definition at line 159 of file CcCopyRead_drv.c.

160{
162 ReadOffset.QuadPart = MAXLONGLONG;
164}
#define MAXLONGLONG
#define MAXULONG
Definition: typedefs.h:251

Referenced by Test_CcCopyRead().

◆ Test_CcCopyRead()

static VOID Test_CcCopyRead ( PFILE_OBJECT  FileObject)
static

Definition at line 176 of file CcCopyRead_drv.c.

177{
178
179 BOOLEAN Ret;
181 CHAR Buffer[10];
183
184 memset(Buffer, 0xAC, 10);
185
186 /* Test bogus file object & file offset */
187 Ret = 'x';
191 ok_eq_char(Ret, 'x');
192
193 Ret = 'x';
194 Offset.QuadPart = 0;
196 Ret = CcCopyRead(NULL, &Offset, 10, FALSE, Buffer, &IoStatus);
198 ok_eq_char(Ret, 'x');
199
200 /* What happens on invalid buffer */
201 Ret = 'x';
202 Offset.QuadPart = 0;
203 memset(&IoStatus, 0xAB, sizeof(IoStatus));
204 reset_read();
208 ok_bool_true(Ret, "CcCopyRead(0, NULL) should succeed\n");
209 /* When there is nothing to write, there is no reason to read */
213
214 Ret = 'x';
215 Offset.QuadPart = 0;
216 memset(&IoStatus, 0xAB, sizeof(IoStatus));
217 reset_read();
219 Ret = CcCopyRead(FileObject, &Offset, 10, TRUE, NULL, &IoStatus);
221 ok_eq_char(Ret, 'x');
222 /* This raises an exception, but it actually triggered a read */
224 ok_eq_hex(IoStatus.Status, 0xABABABAB);
225 ok_eq_ulongptr(IoStatus.Information, (ULONG_PTR)0xABABABABABABABAB);
226
227 /* So this one succeeds, as the page is now resident */
228 Ret = 'x';
229 Offset.QuadPart = 0;
230 memset(&IoStatus, 0xAB, sizeof(IoStatus));
231 reset_read();
235 ok_bool_true(Ret, "CcCopyRead should succeed\n");
236 /* But there was no read triggered, as the page is already resident. */
240
241 /* But this one doesn't */
242 Ret = 'x';
244 memset(&IoStatus, 0xAB, sizeof(IoStatus));
245 reset_read();
249 ok_bool_false(Ret, "CcCopyRead should fail\n");
250 /* But it triggered a read anyway. */
252 ok_eq_hex(IoStatus.Status, 0xABABABAB);
253 ok_eq_ulongptr(IoStatus.Information, (ULONG_PTR)0xABABABABABABABAB);
254
255 /* Of course, waiting for it succeeds and triggers the read */
256 Ret = 'x';
258 memset(&IoStatus, 0xAB, sizeof(IoStatus));
259 reset_read();
263 ok_bool_true(Ret, "CcCopyRead should succeed\n");
267
268 /* Try the same without a status block */
269 Ret = 'x';
272 Ret = CcCopyRead(FileObject, &Offset, 10, TRUE, Buffer, NULL);
274 ok_eq_char(Ret, 'x');
275}
#define ok_read_not_called()
static void reset_read(void)
#define ok_read_called(_Offset, _Length)
unsigned char BOOLEAN
#define ok_eq_char(value, expected)
Definition: apitest.h:66
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok_bool_false(value, desc)
Definition: apitest.h:79
#define ok_bool_true(value, desc)
Definition: apitest.h:78
#define ok_eq_ulongptr(value, expected)
Definition: apitest.h:71
Definition: bufpool.h:45
#define PAGE_SIZE
Definition: env_spec_w32.h:49
Status
Definition: gdiplustypes.h:25
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble n
Definition: glext.h:7729
#define KmtStartSeh()
Definition: kmt_test.h:282
#define KmtEndSeh(ExpectedStatus)
Definition: kmt_test.h:288
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
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)
Definition: copysup.c:43
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
return succeed
Definition: scsi.h:3736
#define memset(x, y, z)
Definition: compat.h:39
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
ret QuadPart
Definition: rtlfuncs.h:3106
char CHAR
Definition: xmlstorage.h:175

◆ TestEntry()

NTSTATUS TestEntry ( _In_ PDRIVER_OBJECT  DriverObject,
_In_ PCUNICODE_STRING  RegistryPath,
_Out_ PCWSTR DeviceName,
_Inout_ INT Flags 
)

Definition at line 49 of file CcCopyRead_drv.c.

54{
56
57 PAGED_CODE();
58
60
61 *DeviceName = L"CcCopyRead";
62 *Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE |
63 TESTENTRY_BUFFERED_IO_DEVICE |
64 TESTENTRY_NO_READONLY_DEVICE;
65
69
71 DriverObject->FastIoDispatch = &TestFastIoDispatch;
72
73
74 return Status;
75}
#define PAGED_CODE()
static FAST_IO_DISPATCH TestFastIoDispatch
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)
static KMT_IRP_HANDLER TestIrpHandler
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS KmtRegisterIrpHandler(IN UCHAR MajorFunction, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_IRP_HANDLER IrpHandler)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
#define L(x)
Definition: ntvdm.h:50
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
PFAST_IO_READ FastIoRead
Definition: iotypes.h:1735
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define IRP_MJ_CLEANUP

◆ TestIrpHandler()

static NTSTATUS TestIrpHandler ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_ PIO_STACK_LOCATION  IoStack 
)
static

Definition at line 280 of file CcCopyRead_drv.c.

284{
288 CACHE_UNINITIALIZE_EVENT CacheUninitEvent;
289
290 PAGED_CODE();
291
292 DPRINT("IRP %x/%x\n", IoStack->MajorFunction, IoStack->MinorFunction);
293 ASSERT(IoStack->MajorFunction == IRP_MJ_CLEANUP ||
294 IoStack->MajorFunction == IRP_MJ_CREATE ||
295 IoStack->MajorFunction == IRP_MJ_READ);
296
298 Irp->IoStatus.Information = 0;
299
300 if (IoStack->MajorFunction == IRP_MJ_CREATE)
301 {
302 ok_irql(PASSIVE_LEVEL);
303
304 if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR))
305 {
307 TestFileObject = IoStack->FileObject;
308 }
309 Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(*Fcb), 'FwrI');
310 RtlZeroMemory(Fcb, sizeof(*Fcb));
311 ExInitializeFastMutex(&Fcb->HeaderMutex);
312 FsRtlSetupAdvancedHeader(&Fcb->Header, &Fcb->HeaderMutex);
313 Fcb->BigFile = FALSE;
314 if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) &&
315 IoStack->FileObject->FileName.Buffer[1] == 'B')
316 {
317 Fcb->Header.AllocationSize.QuadPart = 1000000;
318 Fcb->Header.FileSize.QuadPart = 1000000;
319 Fcb->Header.ValidDataLength.QuadPart = 1000000;
320 }
321 else if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) &&
322 IoStack->FileObject->FileName.Buffer[1] == 'S')
323 {
324 Fcb->Header.AllocationSize.QuadPart = 1004;
325 Fcb->Header.FileSize.QuadPart = 1004;
326 Fcb->Header.ValidDataLength.QuadPart = 1004;
327 }
328 else if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) &&
329 IoStack->FileObject->FileName.Buffer[1] == 'R')
330 {
331 Fcb->Header.AllocationSize.QuadPart = 62;
332 Fcb->Header.FileSize.QuadPart = 62;
333 Fcb->Header.ValidDataLength.QuadPart = 62;
334 }
335 else if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) &&
336 IoStack->FileObject->FileName.Buffer[1] == 'F')
337 {
338 Fcb->Header.AllocationSize.QuadPart = 4294967296;
339 Fcb->Header.FileSize.QuadPart = 4294967296;
340 Fcb->Header.ValidDataLength.QuadPart = 4294967296;
341 Fcb->BigFile = TRUE;
342 }
343 else
344 {
345 Fcb->Header.AllocationSize.QuadPart = 512;
346 Fcb->Header.FileSize.QuadPart = 512;
347 Fcb->Header.ValidDataLength.QuadPart = 512;
348 }
349 Fcb->Header.IsFastIoPossible = FastIoIsNotPossible;
350 IoStack->FileObject->FsContext = Fcb;
351 IoStack->FileObject->SectionObjectPointer = &Fcb->SectionObjectPointers;
352
353 CcInitializeCacheMap(IoStack->FileObject,
354 (PCC_FILE_SIZES)&Fcb->Header.AllocationSize,
355 FALSE, &Callbacks, NULL);
356
357 Irp->IoStatus.Information = FILE_OPENED;
359 }
360 else if (IoStack->MajorFunction == IRP_MJ_READ)
361 {
362 BOOLEAN Ret;
366 static const UNICODE_STRING BehaviourTestFileName = RTL_CONSTANT_STRING(L"\\BehaviourTestFile");
367
368 Offset = IoStack->Parameters.Read.ByteOffset;
369 Length = IoStack->Parameters.Read.Length;
370 Fcb = IoStack->FileObject->FsContext;
371
373 ok_eq_pointer(IoStack->FileObject, TestFileObject);
374
375 /* Check special file name */
376 InBehaviourTest = RtlCompareUnicodeString(&IoStack->FileObject->FileName, &BehaviourTestFileName, TRUE) == 0;
377
378 if (!FlagOn(Irp->Flags, IRP_NOCACHE))
379 {
380 ok_irql(PASSIVE_LEVEL);
381
382 if (InBehaviourTest)
383 {
384 Test_CcCopyRead(IoStack->FileObject);
385 Status = Irp->IoStatus.Status = STATUS_SUCCESS;
386 }
387 else
388 {
389 /* We don't want to test alignement for big files (not the purpose of the test) */
390 if (!Fcb->BigFile)
391 {
392 ok(Offset.QuadPart % PAGE_SIZE != 0, "Offset is aligned: %I64i\n", Offset.QuadPart);
393 ok(Length % PAGE_SIZE != 0, "Length is aligned: %I64i\n", Length);
394 }
395
396 Buffer = Irp->AssociatedIrp.SystemBuffer;
397 ok(Buffer != NULL, "Null pointer!\n");
398
400 {
401 Ret = CcCopyRead(IoStack->FileObject, &Offset, Length, TRUE, Buffer,
402 &Irp->IoStatus);
403 ok_bool_true(Ret, "CcCopyRead");
404 }
406 {
407 Irp->IoStatus.Status = _SEH2_GetExceptionCode();
408 }
409 _SEH2_END;
410
411 Status = Irp->IoStatus.Status;
412
413 if (NT_SUCCESS(Status))
414 {
415 if (Offset.QuadPart <= 1000LL && Offset.QuadPart + Length > 1000LL)
416 {
417 ok_eq_hex(*(PUSHORT)((ULONG_PTR)Buffer + (ULONG_PTR)(1000LL - Offset.QuadPart)), 0xFFFF);
418 }
419 else
420 {
421 ok_eq_hex(*(PUSHORT)Buffer, 0xBABA);
422 }
423 }
424 }
425 }
426 else
427 {
428 PMDL Mdl;
429
433
434 ok_irql(APC_LEVEL);
435 ok((Offset.QuadPart % PAGE_SIZE == 0 || Offset.QuadPart == 0), "Offset is not aligned: %I64i\n", Offset.QuadPart);
436 ok(Length % PAGE_SIZE == 0, "Length is not aligned: %I64i\n", Length);
437
438 ok(Irp->AssociatedIrp.SystemBuffer == NULL, "A SystemBuffer was allocated!\n");
440 ok(Buffer != NULL, "Null pointer!\n");
442
444 if (Offset.QuadPart <= 1000LL && Offset.QuadPart + Length > 1000LL)
445 {
446 *(PUSHORT)((ULONG_PTR)Buffer + (ULONG_PTR)(1000LL - Offset.QuadPart)) = 0xFFFF;
447 }
448
449 Mdl = Irp->MdlAddress;
450 ok(Mdl != NULL, "Null pointer for MDL!\n");
451 ok((Mdl->MdlFlags & MDL_PAGES_LOCKED) != 0, "MDL not locked\n");
452 ok((Mdl->MdlFlags & MDL_SOURCE_IS_NONPAGED_POOL) == 0, "MDL from non paged\n");
453 ok((Mdl->MdlFlags & MDL_IO_PAGE_READ) != 0, "Non paging IO\n");
454 ok((Irp->Flags & IRP_PAGING_IO) != 0, "Non paging IO\n");
455 }
456
457 if (NT_SUCCESS(Status))
458 {
459 Irp->IoStatus.Information = Length;
460 IoStack->FileObject->CurrentByteOffset.QuadPart = Offset.QuadPart + Length;
461 }
462
464 }
465 else if (IoStack->MajorFunction == IRP_MJ_CLEANUP)
466 {
467 ok_irql(PASSIVE_LEVEL);
468 KeInitializeEvent(&CacheUninitEvent.Event, NotificationEvent, FALSE);
469 CcUninitializeCacheMap(IoStack->FileObject, &Zero, &CacheUninitEvent);
471 Fcb = IoStack->FileObject->FsContext;
472 ExFreePoolWithTag(Fcb, 'FwrI');
473 IoStack->FileObject->FsContext = NULL;
475 }
476
477 if (Status == STATUS_PENDING)
478 {
482 }
483 else
484 {
485 Irp->IoStatus.Status = Status;
487 }
488
489 return Status;
490}
static PDEVICE_OBJECT TestDeviceObject
static PFILE_OBJECT TestFileObject
static BOOLEAN InBehaviourTest
static PVOID MapAndLockUserBuffer(_In_ _Out_ PIRP Irp, _In_ ULONG BufferLength)
static CACHE_MANAGER_CALLBACKS Callbacks
#define ok_eq_pointer(value, expected)
Definition: apitest.h:59
#define ok(value,...)
Definition: atltest.h:57
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ULONG_PTR
Definition: config.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define NonPagedPool
Definition: env_spec_w32.h:307
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
Definition: fatprocs.h:419
@ FastIoIsNotPossible
Definition: fsrtltypes.h:240
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
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:286
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
IoMarkIrpPending(Irp)
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define KernelMode
Definition: asm.h:34
#define RTL_CONSTANT_LARGE_INTEGER(quad_part)
Definition: rtltypes.h:418
#define FILE_OPENED
Definition: nt_native.h:769
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ NotificationEvent
#define IoCompleteRequest
Definition: irp.c:1240
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
KMT_TESTFUNC Test_CcCopyRead
Definition: testlist.c:9
#define DPRINT
Definition: sndvol32.h:73
SECTION_OBJECT_POINTERS SectionObjectPointers
Definition: ntfs.h:518
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:925
PFILE_OBJECT FileObject
Definition: ntfs.h:520
#define LL
Definition: tui.h:167
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_PAGING_IO
#define IRP_NOCACHE
@ Executive
Definition: ketypes.h:415
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19
#define MDL_IO_PAGE_READ
Definition: mmtypes.h:24
#define MDL_SOURCE_IS_NONPAGED_POOL
Definition: mmtypes.h:20
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ TestUnload()

VOID TestUnload ( _In_ PDRIVER_OBJECT  DriverObject)

Definition at line 78 of file CcCopyRead_drv.c.

80{
81 PAGED_CODE();
82}

Variable Documentation

◆ Callbacks

CACHE_MANAGER_CALLBACKS Callbacks
static
Initial value:
= {
}
VOID NTAPI ReleaseFromReadAhead(_In_ PVOID Context)
BOOLEAN NTAPI AcquireForReadAhead(_In_ PVOID Context, _In_ BOOLEAN Wait)
VOID NTAPI ReleaseFromLazyWrite(_In_ PVOID Context)
BOOLEAN NTAPI AcquireForLazyWrite(_In_ PVOID Context, _In_ BOOLEAN Wait)

Definition at line 118 of file CcCopyRead_drv.c.

Referenced by TestIrpHandler().

◆ InBehaviourTest

BOOLEAN InBehaviourTest
static

Definition at line 25 of file CcCopyRead_drv.c.

Referenced by TestIrpHandler().

◆ ReadCalledNonCached

BOOLEAN ReadCalledNonCached

Definition at line 27 of file CcCopyRead_drv.c.

Referenced by reset_read(), and TestIrpHandler().

◆ ReadLength

◆ ReadOffset

Definition at line 28 of file CcCopyRead_drv.c.

◆ TestDeviceObject

PDEVICE_OBJECT TestDeviceObject
static

Definition at line 22 of file CcCopyRead_drv.c.

Referenced by TestIrpHandler().

◆ TestFastIoDispatch

FAST_IO_DISPATCH TestFastIoDispatch
static

Definition at line 24 of file CcCopyRead_drv.c.

Referenced by TestEntry().

◆ TestFileObject

PFILE_OBJECT TestFileObject
static

Definition at line 21 of file CcCopyRead_drv.c.

Referenced by TestIrpHandler().

◆ TestIrpHandler

KMT_IRP_HANDLER TestIrpHandler
static

Definition at line 23 of file CcCopyRead_drv.c.

Referenced by TestEntry().