ReactOS  0.4.14-dev-98-gb0d4763
CcCopyRead_user.c File Reference
#include <kmt_test.h>
Include dependency graph for CcCopyRead_user.c:

Go to the source code of this file.

Functions

 START_TEST (CcCopyRead)
 

Function Documentation

◆ START_TEST()

START_TEST ( CcCopyRead  )

Definition at line 10 of file CcCopyRead_user.c.

11 {
12  HANDLE Handle;
17  PVOID Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, 1024);
18  UNICODE_STRING BigAlignmentTest = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\BigAlignmentTest");
19  UNICODE_STRING SmallAlignmentTest = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\SmallAlignmentTest");
20  UNICODE_STRING ReallySmallAlignmentTest = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\ReallySmallAlignmentTest");
21  UNICODE_STRING FileBig = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\FileBig");
22 
23  KmtLoadDriver(L"CcCopyRead", FALSE);
24  KmtOpenDriver();
25 
29 
30  ByteOffset.QuadPart = 3;
33  ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
34 
35  ByteOffset.QuadPart = 514;
38  ok_eq_hex(((USHORT *)Buffer)[242], 0xBABA);
39  ok_eq_hex(((USHORT *)Buffer)[243], 0xFFFF);
40 
41  ByteOffset.QuadPart = 1000;
44  ok_eq_hex(((USHORT *)Buffer)[0], 0xFFFF);
45  ok_eq_hex(((USHORT *)Buffer)[1], 0xBABA);
46 
47  NtClose(Handle);
48 
52 
53  ByteOffset.QuadPart = 3;
56  ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
57 
58  ByteOffset.QuadPart = 514;
61  ok_eq_hex(((USHORT *)Buffer)[242], 0xBABA);
62  ok_eq_hex(((USHORT *)Buffer)[243], 0xFFFF);
63 
64  ByteOffset.QuadPart = 300000;
67  ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
68 
69  ByteOffset.QuadPart = 999990;
72  ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
73 
74  ByteOffset.QuadPart = 1000;
77  ok_eq_hex(((USHORT *)Buffer)[0], 0xFFFF);
78  ok_eq_hex(((USHORT *)Buffer)[1], 0xBABA);
79 
80  NtClose(Handle);
81 
85 
86  ByteOffset.QuadPart = 1;
89  ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
90 
91  NtClose(Handle);
92 
96 
97  ByteOffset.QuadPart = 0;
100  ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
101 
102  NtClose(Handle);
103 
104  RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
105  KmtCloseDriver();
106  KmtUnloadDriver();
107 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define FILE_ALL_ACCESS
Definition: nt_native.h:651
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
_In_ HANDLE Handle
Definition: extypes.h:390
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
VOID KmtCloseDriver(VOID)
Definition: support.c:200
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
Status
Definition: gdiplustypes.h:24
VOID KmtUnloadDriver(VOID)
Definition: support.c:155
unsigned short USHORT
Definition: pedump.c:61
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ok_eq_hex(value, expected)
VOID KmtLoadDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning)
Definition: support.c:127
VOID KmtOpenDriver(VOID)
Definition: support.c:174
return STATUS_SUCCESS
Definition: btrfs.c:2966
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:716
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14