mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +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:
@@ -2,39 +2,27 @@
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||
* PURPOSE: Test for the RegOpenKeyExW alignment
|
||||
* PROGRAMMER: Mark Jansen <[email protected]>
|
||||
* PROGRAMMER: Mark Jansen ([email protected])
|
||||
*/
|
||||
#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;
|
||||
char GccShouldNotAlignThis[20 * 2];
|
||||
char GccShouldNotAlignThis2[20];
|
||||
PVOID Alias = GccShouldNotAlignThis + 1;
|
||||
PVOID UnalignedKey = GccShouldNotAlignThis2 + 1;
|
||||
HKEY hk;
|
||||
LONG lRes;
|
||||
|
||||
memcpy(un.buffer, TEST_STR, sizeof(TEST_STR));
|
||||
un2.hk = 0;
|
||||
memcpy(Alias, TEST_STR, sizeof(TEST_STR));
|
||||
|
||||
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, &hk);
|
||||
ok_int(lRes, ERROR_SUCCESS);
|
||||
@@ -42,18 +30,17 @@ START_TEST(RegOpenKeyExW)
|
||||
return;
|
||||
RegCloseKey(hk);
|
||||
|
||||
ok_hex(((ULONG_PTR)un.buffer) % 2, 1);
|
||||
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, un.buffer, 0, KEY_READ, &hk);
|
||||
ok_hex(((ULONG_PTR)Alias) % 2, 1);
|
||||
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, Alias, 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_hex(((ULONG_PTR)UnalignedKey) % 2, 1);
|
||||
lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, UnalignedKey);
|
||||
ok_int(lRes, ERROR_SUCCESS);
|
||||
if (!lRes)
|
||||
{
|
||||
hk = un2.hk;
|
||||
RegCloseKey(hk);
|
||||
RegCloseKey(*(HKEY*)(UnalignedKey));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user