ReactOS 0.4.15-dev-8100-g1887773
RtlCopyMappedMemory.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for RtlCopyMappedMemory
5 * PROGRAMMERS: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8#include "precomp.h"
9
10static NTSTATUS (NTAPI *pRtlCopyMappedMemory)(PVOID, const VOID *, SIZE_T);
11
13{
15 UCHAR Buffer1[32];
16 UCHAR Buffer2[32];
17
18 pRtlCopyMappedMemory = (PVOID)GetProcAddress(GetModuleHandleW(L"ntdll.dll"),
19 "RtlCopyMappedMemory");
20 if (!pRtlCopyMappedMemory)
21 {
22 win_skip("RtlCopyMappedMemory (NT >= 5.2 API) not available\n");
23 return;
24 }
25
26 StartSeh() pRtlCopyMappedMemory(NULL, NULL, 1); EndSeh(STATUS_ACCESS_VIOLATION);
27 StartSeh() pRtlCopyMappedMemory(Buffer1, NULL, 1); EndSeh(STATUS_ACCESS_VIOLATION);
28 StartSeh() pRtlCopyMappedMemory(NULL, Buffer1, 1); EndSeh(STATUS_ACCESS_VIOLATION);
29
30 StartSeh()
31 Status = pRtlCopyMappedMemory(NULL, NULL, 0);
33 ok(Status == STATUS_SUCCESS, "RtlCopyMappedMemory returned %lx\n", Status);
34
35 RtlFillMemory(Buffer1, sizeof(Buffer1), 0x11);
36 RtlFillMemory(Buffer2, sizeof(Buffer2), 0x22);
37 StartSeh()
38 Status = pRtlCopyMappedMemory(Buffer1, Buffer2, sizeof(Buffer1));
40 ok(Status == STATUS_SUCCESS, "RtlCopyMappedMemory returned %lx\n", Status);
41 ok(RtlCompareMemory(Buffer1, Buffer2, sizeof(Buffer1)) == sizeof(Buffer1), "Data not copied\n");
42}
static const VOID SIZE_T
#define StartSeh()
Definition: _sntprintf.h:16
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NTSTATUS
Definition: precomp.h:21
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
Status
Definition: gdiplustypes.h:25
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
NTSTATUS NTAPI RtlCopyMappedMemory(_Out_writes_bytes_all_(Size) PVOID Destination, _In_reads_bytes_(Size) const VOID *Source, _In_ SIZE_T Size)
Definition: memstream.c:479
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define L(x)
Definition: ntvdm.h:50
#define win_skip
Definition: test.h:163
#define STATUS_SUCCESS
Definition: shellext.h:65
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
unsigned char UCHAR
Definition: xmlstorage.h:181