ReactOS 0.4.15-dev-7842-g558ab78
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{
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 UNICODE_STRING BehaviourTestFile = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\BehaviourTestFile");
24
25 Error = KmtLoadAndOpenDriver(L"CcCopyRead", FALSE);
27 if (Error)
28 return;
29
33
34 ByteOffset.QuadPart = 3;
37 ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
38
39 ByteOffset.QuadPart = 514;
42 ok_eq_hex(((USHORT *)Buffer)[242], 0xBABA);
43 ok_eq_hex(((USHORT *)Buffer)[243], 0xFFFF);
44
45 ByteOffset.QuadPart = 1000;
48 ok_eq_hex(((USHORT *)Buffer)[0], 0xFFFF);
49 ok_eq_hex(((USHORT *)Buffer)[1], 0xBABA);
50
52
56
57 ByteOffset.QuadPart = 3;
60 ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
61
62 ByteOffset.QuadPart = 514;
65 ok_eq_hex(((USHORT *)Buffer)[242], 0xBABA);
66 ok_eq_hex(((USHORT *)Buffer)[243], 0xFFFF);
67
68 ByteOffset.QuadPart = 300000;
71 ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
72
73 ByteOffset.QuadPart = 999990;
76 ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
77
78 ByteOffset.QuadPart = 1000;
81 ok_eq_hex(((USHORT *)Buffer)[0], 0xFFFF);
82 ok_eq_hex(((USHORT *)Buffer)[1], 0xBABA);
83
85
89
90 ByteOffset.QuadPart = 1;
93 ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
94
96
100
101 ByteOffset.QuadPart = 0;
104 ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
105
107
111
112 ByteOffset.QuadPart = 0;
114
116
117 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
120}
#define ok_eq_hex(value, expected)
Definition: apitest.h:76
#define ok_eq_int(value, expected)
Definition: apitest.h:59
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
BOOL Error
Definition: chkdsk.c:66
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
Definition: bufpool.h:45
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
Definition: fatprocs.h:731
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:25
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
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:3952
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define FILE_ALL_ACCESS
Definition: nt_native.h:651
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
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)
DWORD KmtLoadAndOpenDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning)
Definition: support.c:213
VOID KmtCloseDriver(VOID)
Definition: support.c:236
VOID KmtUnloadDriver(VOID)
Definition: support.c:167
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14