1 /* 2 * PROJECT: ReactOS api tests 3 * LICENSE: GPLv2+ - See COPYING in the top level directory 4 * PURPOSE: Test for the RegOpenKeyExW alignment 5 * PROGRAMMER: Mark Jansen (mark.jansen@reactos.org) 6 */ 7 #include <apitest.h> 8 9 #define WIN32_NO_STATUS 10 #include <winreg.h> 11 12 13 #define TEST_STR L".exe" 14 15 16 START_TEST(RegOpenKeyExW) 17 { 18 char GccShouldNotAlignThis[20 * 2]; 19 char GccShouldNotAlignThis2[20]; 20 PVOID Alias = GccShouldNotAlignThis + 1; 21 PVOID UnalignedKey = GccShouldNotAlignThis2 + 1; 22 HKEY hk; 23 LONG lRes; 24 25 memcpy(Alias, TEST_STR, sizeof(TEST_STR)); 26 27 lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, &hk); 28 ok_int(lRes, ERROR_SUCCESS); 29 if (lRes) 30 return; 31 RegCloseKey(hk); 32 33 ok_hex(((ULONG_PTR)Alias) % 2, 1); 34 lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, Alias, 0, KEY_READ, &hk); 35 ok_int(lRes, ERROR_SUCCESS); 36 if (!lRes) 37 RegCloseKey(hk); 38 39 ok_hex(((ULONG_PTR)UnalignedKey) % 2, 1); 40 lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, UnalignedKey); 41 ok_int(lRes, ERROR_SUCCESS); 42 if (!lRes) 43 { 44 RegCloseKey(*(HKEY*)(UnalignedKey)); 45 } 46 } 47