mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 14:15:49 +00:00
[ADVAPI32_APITEST] Addendum to 75585, use void pointers to work around gcc ignoring pshpack1.
svn path=/trunk/; revision=75587
This commit is contained in:
parent
956092d462
commit
441f8dc306
1 changed files with 11 additions and 24 deletions
|
@ -2,39 +2,27 @@
|
||||||
* PROJECT: ReactOS api tests
|
* PROJECT: ReactOS api tests
|
||||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||||
* PURPOSE: Test for the RegOpenKeyExW alignment
|
* PURPOSE: Test for the RegOpenKeyExW alignment
|
||||||
* PROGRAMMER: Mark Jansen <mark.jansen@reactos.org>
|
* PROGRAMMER: Mark Jansen (mark.jansen@reactos.org)
|
||||||
*/
|
*/
|
||||||
#include <apitest.h>
|
#include <apitest.h>
|
||||||
|
|
||||||
#define WIN32_NO_STATUS
|
#define WIN32_NO_STATUS
|
||||||
#include <winreg.h>
|
#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"
|
#define TEST_STR L".exe"
|
||||||
|
|
||||||
|
|
||||||
START_TEST(RegOpenKeyExW)
|
START_TEST(RegOpenKeyExW)
|
||||||
{
|
{
|
||||||
struct Unalignment1 un;
|
char GccShouldNotAlignThis[20 * 2];
|
||||||
struct Unalignment2 un2;
|
char GccShouldNotAlignThis2[20];
|
||||||
|
PVOID Alias = GccShouldNotAlignThis + 1;
|
||||||
|
PVOID UnalignedKey = GccShouldNotAlignThis2 + 1;
|
||||||
HKEY hk;
|
HKEY hk;
|
||||||
LONG lRes;
|
LONG lRes;
|
||||||
|
|
||||||
memcpy(un.buffer, TEST_STR, sizeof(TEST_STR));
|
memcpy(Alias, TEST_STR, sizeof(TEST_STR));
|
||||||
un2.hk = 0;
|
|
||||||
|
|
||||||
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, &hk);
|
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, &hk);
|
||||||
ok_int(lRes, ERROR_SUCCESS);
|
ok_int(lRes, ERROR_SUCCESS);
|
||||||
|
@ -42,18 +30,17 @@ START_TEST(RegOpenKeyExW)
|
||||||
return;
|
return;
|
||||||
RegCloseKey(hk);
|
RegCloseKey(hk);
|
||||||
|
|
||||||
ok_hex(((ULONG_PTR)un.buffer) % 2, 1);
|
ok_hex(((ULONG_PTR)Alias) % 2, 1);
|
||||||
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, un.buffer, 0, KEY_READ, &hk);
|
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, Alias, 0, KEY_READ, &hk);
|
||||||
ok_int(lRes, ERROR_SUCCESS);
|
ok_int(lRes, ERROR_SUCCESS);
|
||||||
if (!lRes)
|
if (!lRes)
|
||||||
RegCloseKey(hk);
|
RegCloseKey(hk);
|
||||||
|
|
||||||
ok_hex(((ULONG_PTR)&un2.hk) % 2, 1);
|
ok_hex(((ULONG_PTR)UnalignedKey) % 2, 1);
|
||||||
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, &un2.hk);
|
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, UnalignedKey);
|
||||||
ok_int(lRes, ERROR_SUCCESS);
|
ok_int(lRes, ERROR_SUCCESS);
|
||||||
if (!lRes)
|
if (!lRes)
|
||||||
{
|
{
|
||||||
hk = un2.hk;
|
RegCloseKey(*(HKEY*)(UnalignedKey));
|
||||||
RegCloseKey(hk);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue