ReactOS 0.4.15-dev-8434-g155a7c7
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);
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}
#define TEST_STR
Definition: RegOpenKeyExW.c:10
#define ok_hex(expression, result)
Definition: atltest.h:94
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define KEY_READ
Definition: nt_native.h:1023
long LONG
Definition: pedump.c:60
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10