Author: mjansen
Date: Thu Aug 17 10:30:10 2017
New Revision: 75585
URL:
http://svn.reactos.org/svn/reactos?rev=75585&view=rev
Log:
[ADVAPI32_APITEST] Test unaligned pointers for RegOpenKeyExW.
Added:
trunk/rostests/apitests/advapi32/RegOpenKeyExW.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] Thu Aug 17 10:30:10 2017
@@ -9,6 +9,7 @@
QueryServiceConfig2.c
RegEnumKey.c
RegEnumValueW.c
+ RegOpenKeyExW.c
RegQueryInfoKey.c
RegQueryValueExW.c
RtlEncryptMemory.c
Added: trunk/rostests/apitests/advapi32/RegOpenKeyExW.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/RegOpen…
==============================================================================
--- trunk/rostests/apitests/advapi32/RegOpenKeyExW.c (added)
+++ trunk/rostests/apitests/advapi32/RegOpenKeyExW.c [iso-8859-1] Thu Aug 17 10:30:10
2017
@@ -0,0 +1,59 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Test for the RegOpenKeyExW alignment
+ * PROGRAMMER: Mark Jansen <mark.jansen(a)reactos.org>
+ */
+#include <apitest.h>
+
+#define WIN32_NO_STATUS
+#include <winreg.h>
+
+#include <pshpack1.h>
+struct Unalignment1
+{
+ char dum;
+ WCHAR buffer[20];
+} Unalignment1;
+struct Unalignment2
+{
+ char dum;
+ HKEY hk;
+} Unalignment2;
+#include <poppack.h>
+
+
+#define TEST_STR L".exe"
+
+
+START_TEST(RegOpenKeyExW)
+{
+ struct Unalignment1 un;
+ struct Unalignment2 un2;
+ HKEY hk;
+ LONG lRes;
+
+ memcpy(un.buffer, TEST_STR, sizeof(TEST_STR));
+ un2.hk = 0;
+
+ lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, &hk);
+ ok_int(lRes, ERROR_SUCCESS);
+ if (lRes)
+ return;
+ RegCloseKey(hk);
+
+ ok_hex(((ULONG_PTR)un.buffer) % 2, 1);
+ lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, un.buffer, 0, KEY_READ, &hk);
+ ok_int(lRes, ERROR_SUCCESS);
+ if (!lRes)
+ RegCloseKey(hk);
+
+ ok_hex(((ULONG_PTR)&un2.hk) % 2, 1);
+ lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, &un2.hk);
+ ok_int(lRes, ERROR_SUCCESS);
+ if (!lRes)
+ {
+ hk = un2.hk;
+ RegCloseKey(hk);
+ }
+}
Propchange: trunk/rostests/apitests/advapi32/RegOpenKeyExW.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] Thu Aug 17 10:30:10 2017
@@ -12,6 +12,7 @@
extern void func_QueryServiceConfig2(void);
extern void func_RegEnumKey(void);
extern void func_RegEnumValueW(void);
+extern void func_RegOpenKeyExW(void);
extern void func_RegQueryInfoKey(void);
extern void func_RegQueryValueExW(void);
extern void func_RtlEncryptMemory(void);
@@ -31,6 +32,7 @@
{ "RegEnumKey", func_RegEnumKey },
{ "RegEnumValueW", func_RegEnumValueW },
{ "RegQueryInfoKey", func_RegQueryInfoKey },
+ { "RegOpenKeyExW", func_RegOpenKeyExW },
{ "RegQueryValueExW", func_RegQueryValueExW },
{ "RtlEncryptMemory", func_RtlEncryptMemory },
{ "SaferIdentifyLevel", func_SaferIdentifyLevel },