[ADVAPI32_APITEST] Test unaligned pointers for RegOpenKeyExW.

svn path=/trunk/; revision=75585
This commit is contained in:
Mark Jansen 2017-08-17 10:30:10 +00:00
parent 2e7b5c5b11
commit ddcdef0768
3 changed files with 62 additions and 0 deletions

View File

@ -9,6 +9,7 @@ list(APPEND SOURCE
QueryServiceConfig2.c
RegEnumKey.c
RegEnumValueW.c
RegOpenKeyExW.c
RegQueryInfoKey.c
RegQueryValueExW.c
RtlEncryptMemory.c

View File

@ -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@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);
}
}

View File

@ -12,6 +12,7 @@ extern void func_LockServiceDatabase(void);
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 @@ const struct test winetest_testlist[] =
{ "RegEnumKey", func_RegEnumKey },
{ "RegEnumValueW", func_RegEnumValueW },
{ "RegQueryInfoKey", func_RegQueryInfoKey },
{ "RegOpenKeyExW", func_RegOpenKeyExW },
{ "RegQueryValueExW", func_RegQueryValueExW },
{ "RtlEncryptMemory", func_RtlEncryptMemory },
{ "SaferIdentifyLevel", func_SaferIdentifyLevel },