Author: tkreuzer
Date: Mon Sep 15 21:04:03 2014
New Revision: 64162
URL:
http://svn.reactos.org/svn/reactos?rev=64162&view=rev
Log:
[ADVAPI32_APITEST]
- Add tests for RtlEncrypt/DecryptMemory
Added:
trunk/rostests/apitests/advapi32/RtlEncryptMemory.c (with props)
Modified:
trunk/rostests/apitests/advapi32/CMakeLists.txt
trunk/rostests/apitests/advapi32/testlist.c
Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CMakeLi…
==============================================================================
--- trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] Mon Sep 15 21:04:03 2014
@@ -3,6 +3,7 @@
CreateService.c
LockDatabase.c
QueryServiceConfig2.c
+ RtlEncryptMemory.c
SaferIdentifyLevel.c
testlist.c)
Added: trunk/rostests/apitests/advapi32/RtlEncryptMemory.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/RtlEncr…
==============================================================================
--- trunk/rostests/apitests/advapi32/RtlEncryptMemory.c (added)
+++ trunk/rostests/apitests/advapi32/RtlEncryptMemory.c [iso-8859-1] Mon Sep 15 21:04:03
2014
@@ -0,0 +1,38 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test for RtlEncrypt/DecryptMemory
+ * PROGRAMMER: Timo Kreuzer <timo.kreuzer(a)reactos.org>
+ */
+
+#include <apitest.h>
+
+#define WIN32_NO_STATUS
+#include <windows.h>
+#include <ndk/ntndk.h>
+#include <winsafer.h>
+#include <Ntsecapi.h>
+
+START_TEST(RtlEncryptMemory)
+{
+ static const CHAR const TestData[32] = "This is some test Message!!!";
+ CHAR Buffer[32];
+ NTSTATUS Status;
+
+ /* Size must be aligned to 8 bytes */
+ Status = RtlEncryptMemory(Buffer, 7, RTL_ENCRYPT_OPTION_SAME_PROCESS);
+ ok_ntstatus(Status, STATUS_INVALID_PARAMETER);
+
+ /* Buffer must not be aligned to 8 bytes */
+ Status = RtlEncryptMemory(&Buffer[1], 8, RTL_ENCRYPT_OPTION_SAME_PROCESS);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+
+ RtlCopyMemory(Buffer, TestData, sizeof(Buffer));
+ Status = RtlEncryptMemory(Buffer, sizeof(Buffer), RTL_ENCRYPT_OPTION_SAME_PROCESS);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+ ok_int(RtlEqualMemory(Buffer, TestData, sizeof(Buffer)), 0);
+ Status = RtlDecryptMemory(Buffer, sizeof(Buffer), RTL_ENCRYPT_OPTION_SAME_PROCESS);
+ ok_ntstatus(Status, STATUS_SUCCESS);
+ ok_int(RtlEqualMemory(Buffer, TestData, sizeof(Buffer)), 1);
+
+}
Propchange: trunk/rostests/apitests/advapi32/RtlEncryptMemory.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/advapi32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/testlis…
==============================================================================
--- trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] Mon Sep 15 21:04:03 2014
@@ -6,6 +6,7 @@
extern void func_CreateService(void);
extern void func_LockDatabase(void);
extern void func_QueryServiceConfig2(void);
+extern void func_RtlEncryptMemory(void);
extern void func_SaferIdentifyLevel(void);
const struct test winetest_testlist[] =
@@ -13,6 +14,7 @@
{ "CreateService", func_CreateService },
{ "LockDatabase" , func_LockDatabase },
{ "QueryServiceConfig2", func_QueryServiceConfig2 },
+ { "RtlEncryptMemory", func_RtlEncryptMemory },
{ "SaferIdentifyLevel", func_SaferIdentifyLevel },
{ 0, 0 }