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

Go to the source code of this file.

Macros

#define VerifyAccess(h, e)   VerifyAccess_(h, e, __FILE__, __LINE__)
 
#define TestCreateOpen(d, ea, es)   TestCreateOpen_(d, ea, es, __FILE__, __LINE__)
 

Functions

static VOID VerifyAccess_ (_In_ HANDLE Handle, _In_ ACCESS_MASK ExpectedAccess, _In_ PCSTR File, _In_ INT Line)
 
static VOID TestCreateOpen_ (_In_ ACCESS_MASK DesiredAccess, _In_ ACCESS_MASK ExpectedAccess, _In_ NTSTATUS ExpectedStatus, _In_ PCSTR File, _In_ INT Line)
 
 START_TEST (NtCreateKey)
 

Macro Definition Documentation

◆ TestCreateOpen

#define TestCreateOpen (   d,
  ea,
  es 
)    TestCreateOpen_(d, ea, es, __FILE__, __LINE__)

Definition at line 95 of file NtCreateKey.c.

◆ VerifyAccess

#define VerifyAccess (   h,
  e 
)    VerifyAccess_(h, e, __FILE__, __LINE__)

Definition at line 32 of file NtCreateKey.c.

Function Documentation

◆ START_TEST()

START_TEST ( NtCreateKey  )

Definition at line 97 of file NtCreateKey.c.

◆ TestCreateOpen_()

static VOID TestCreateOpen_ ( _In_ ACCESS_MASK  DesiredAccess,
_In_ ACCESS_MASK  ExpectedAccess,
_In_ NTSTATUS  ExpectedStatus,
_In_ PCSTR  File,
_In_ INT  Line 
)
static

Definition at line 36 of file NtCreateKey.c.

42{
45 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software");
47
49 &KeyName,
51 NULL,
52 NULL);
56 0,
57 NULL,
59 NULL);
60 ok_(File, Line)(Status == ExpectedStatus,
61 "NtCreateKey returned 0x%lx, expected 0x%lx\n",
62 Status, ExpectedStatus);
63 if (NT_SUCCESS(Status))
64 {
65 VerifyAccess_(KeyHandle, ExpectedAccess, File, Line);
68 "NtClose from NtCreateKey returned 0x%lx\n",
69 Status);
70 }
71 else if (NT_SUCCESS(ExpectedStatus))
72 {
73 skip_(File, Line)("NtCreateKey failed, skipping\n");
74 }
75
79 ok_(File, Line)(Status == ExpectedStatus,
80 "NtOpenKey returned 0x%lx, expected 0x%lx\n",
81 Status, ExpectedStatus);
82 if (NT_SUCCESS(Status))
83 {
84 VerifyAccess_(KeyHandle, ExpectedAccess, File, Line);
87 "NtClose from NtOpenKey returned 0x%lx\n",
88 Status);
89 }
90 else if (NT_SUCCESS(ExpectedStatus))
91 {
92 skip_(File, Line)("NtOpenKey failed, skipping\n");
93 }
94}
static VOID VerifyAccess_(_In_ HANDLE Handle, _In_ ACCESS_MASK ExpectedAccess, _In_ PCSTR File, _In_ INT Line)
Definition: NtCreateKey.c:12
#define ok_(x1, x2)
Definition: atltest.h:61
LONG NTSTATUS
Definition: precomp.h:26
Definition: File.h:16
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#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 skip_(test, file, line,...)
Definition: kmt_test.h:224
#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
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
#define L(x)
Definition: ntvdm.h:50
Definition: ncftp.h:79
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699

◆ VerifyAccess_()

static VOID VerifyAccess_ ( _In_ HANDLE  Handle,
_In_ ACCESS_MASK  ExpectedAccess,
_In_ PCSTR  File,
_In_ INT  Line 
)
static

Definition at line 12 of file NtCreateKey.c.

17{
21
24 &BasicInfo,
25 sizeof(BasicInfo),
26 &Length);
27 ok_(File, Line)(Status == STATUS_SUCCESS, "NtQueryObject returned 0x%lx\n", Status);
28 ok_(File, Line)(BasicInfo.GrantedAccess == ExpectedAccess,
29 "GrantedAccess is 0x%lx, expected 0x%lx\n",
30 BasicInfo.GrantedAccess, ExpectedAccess);
31}
@ ObjectBasicInformation
Definition: DriverTester.h:54
NTSTATUS NtQueryObject(IN HANDLE Handle, IN OBJECT_INFO_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG ObjectInformationLength, OUT PULONG ReturnLength)
ULONG Handle
Definition: gdb_input.c:15
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
ACCESS_MASK GrantedAccess
Definition: winternl.h:1251
uint32_t ULONG
Definition: typedefs.h:59

Referenced by TestCreateOpen_().