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 8 #include "precomp.h" 9 10 #define TEST_STR L".exe" 11 12 START_TEST(RegOpenKeyExW) 13 { 14 char GccShouldNotAlignThis[20 * 2]; 15 char GccShouldNotAlignThis2[20]; 16 PVOID Alias = GccShouldNotAlignThis + 1; 17 PVOID UnalignedKey = GccShouldNotAlignThis2 + 1; 18 HKEY hk; 19 LONG lRes; 20 21 memcpy(Alias, TEST_STR, sizeof(TEST_STR)); 22 23 lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, &hk); 24 ok_int(lRes, ERROR_SUCCESS); 25 if (lRes) 26 return; 27 RegCloseKey(hk); 28 29 ok_hex(((ULONG_PTR)Alias) % 2, 1); 30 lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, Alias, 0, KEY_READ, &hk); 31 ok_int(lRes, ERROR_SUCCESS); 32 if (!lRes) 33 RegCloseKey(hk); 34 35 ok_hex(((ULONG_PTR)UnalignedKey) % 2, 1); 36 lRes = RegOpenKeyExW(HKEY_CLASSES_ROOT, TEST_STR, 0, KEY_READ, UnalignedKey); 37 ok_int(lRes, ERROR_SUCCESS); 38 if (!lRes) 39 { 40 RegCloseKey(*(HKEY*)(UnalignedKey)); 41 } 42 } 43