ReactOS 0.4.16-dev-292-gbbdcc14
NtOpenKey.c File Reference
#include "precomp.h"
Include dependency graph for NtOpenKey.c:

Go to the source code of this file.

Macros

#define TEST_STR   L"\\Registry\\Machine\\SOFTWARE"
 

Functions

 START_TEST (NtOpenKey)
 

Macro Definition Documentation

◆ TEST_STR

#define TEST_STR   L"\\Registry\\Machine\\SOFTWARE"

Definition at line 10 of file NtOpenKey.c.

Function Documentation

◆ START_TEST()

START_TEST ( NtOpenKey  )

Definition at line 12 of file NtOpenKey.c.

13{
16 char GccShouldNotAlignThis[40 * 2];
17 char GccShouldNotAlignThis2[20];
18 PVOID Alias = GccShouldNotAlignThis + 1;
19 PVOID UnalignedKey = GccShouldNotAlignThis2 + 1;
20
23
24 memcpy(Alias, TEST_STR, sizeof(TEST_STR));
25
26
29
32
33 if (!NT_SUCCESS(Status))
34 return;
35
37
38 String.Buffer = Alias;
39 ok_hex(((ULONG_PTR)String.Buffer) % 2, 1);
41 ok_ntstatus(Status, STATUS_DATATYPE_MISALIGNMENT); // FIXME: Later windows versions succeed here.
42 if (NT_SUCCESS(Status))
44
46 ok_hex(((ULONG_PTR)UnalignedKey) % 2, 1);
47 Status = NtOpenKey(UnalignedKey, KEY_QUERY_VALUE, &Object);
49 if (NT_SUCCESS(Status))
50 {
51 NtClose(*(HANDLE*)(UnalignedKey));
52 }
53}
#define TEST_STR
Definition: NtOpenKey.c:10
#define ok_hex(expression, result)
Definition: atltest.h:94
#define ok_ntstatus(status, expected)
Definition: atltest.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:25
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433