ReactOS  0.4.14-dev-552-g2fad488
RegOpenKeyExW.c
Go to the documentation of this file.
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 
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 
24  ok_int(lRes, ERROR_SUCCESS);
25  if (lRes)
26  return;
27  RegCloseKey(hk);
28 
29  ok_hex(((ULONG_PTR)Alias) % 2, 1);
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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define ok_hex(expression, result)
Definition: atltest.h:94
uint32_t ULONG_PTR
Definition: typedefs.h:63
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define ok_int(expression, result)
Definition: atltest.h:134
#define TEST_STR
Definition: RegOpenKeyExW.c:10
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
START_TEST(RegOpenKeyExW)
Definition: RegOpenKeyExW.c:12
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10