diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 38422ae39a8..464b23323dd 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -213,6 +213,7 @@ @ stdcall NtOpenIoCompletion(ptr long ptr) @ stdcall NtOpenJobObject(ptr long ptr) @ stdcall NtOpenKey(ptr long ptr) +@ stdcall NtOpenKeyEx(ptr long ptr long) @ stdcall NtOpenKeyedEvent(ptr long ptr) @ stdcall NtOpenMutant(ptr long ptr) @ stub NtOpenObjectAuditAlarm @@ -1128,6 +1129,7 @@ @ stdcall ZwOpenIoCompletion(ptr long ptr) NtOpenIoCompletion @ stdcall ZwOpenJobObject(ptr long ptr) NtOpenJobObject @ stdcall ZwOpenKey(ptr long ptr) NtOpenKey +@ stdcall ZwOpenKeyEx(ptr long ptr long) NtOpenKeyEx @ stdcall ZwOpenKeyedEvent(ptr long ptr) NtOpenKeyedEvent @ stdcall ZwOpenMutant(ptr long ptr) NtOpenMutant @ stub ZwOpenObjectAuditAlarm diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index a104c2e9cb9..c0fc64120a5 100644 --- a/dlls/ntdll/reg.c +++ b/dlls/ntdll/reg.c @@ -106,14 +106,10 @@ NTSTATUS WINAPI RtlpNtCreateKey( PHANDLE retkey, ACCESS_MASK access, const OBJEC } /****************************************************************************** - * NtOpenKey [NTDLL.@] - * ZwOpenKey [NTDLL.@] - * - * OUT HANDLE retkey (returns 0 when failure) - * IN ACCESS_MASK access - * IN POBJECT_ATTRIBUTES attr + * NtOpenKeyEx [NTDLL.@] + * ZwOpenKeyEx [NTDLL.@] */ -NTSTATUS WINAPI NtOpenKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ) +NTSTATUS WINAPI NtOpenKeyEx( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, ULONG options ) { NTSTATUS ret; DWORD len; @@ -123,6 +119,8 @@ NTSTATUS WINAPI NtOpenKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTR len = attr->ObjectName->Length; TRACE( "(%p,%s,%x,%p)\n", attr->RootDirectory, debugstr_us(attr->ObjectName), access, retkey ); + if (options) + FIXME("options %x not implemented\n", options); if (len > MAX_NAME_LENGTH) return STATUS_BUFFER_OVERFLOW; @@ -140,6 +138,19 @@ NTSTATUS WINAPI NtOpenKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTR return ret; } +/****************************************************************************** + * NtOpenKey [NTDLL.@] + * ZwOpenKey [NTDLL.@] + * + * OUT HANDLE retkey (returns 0 when failure) + * IN ACCESS_MASK access + * IN POBJECT_ATTRIBUTES attr + */ +NTSTATUS WINAPI NtOpenKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ) +{ + return NtOpenKeyEx( retkey, access, attr, 0 ); +} + /****************************************************************************** * RtlpNtOpenKey [NTDLL.@] * diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c index 6d04668539c..ecfe1b24f78 100644 --- a/dlls/ntdll/tests/reg.c +++ b/dlls/ntdll/tests/reg.c @@ -123,6 +123,7 @@ static NTSTATUS (WINAPI * pRtlQueryRegistryValues)(IN ULONG, IN PCWSTR,IN PRTL_Q static NTSTATUS (WINAPI * pRtlCheckRegistryKey)(IN ULONG,IN PWSTR); static NTSTATUS (WINAPI * pRtlOpenCurrentUser)(IN ACCESS_MASK, PHANDLE); static NTSTATUS (WINAPI * pNtOpenKey)(PHANDLE, IN ACCESS_MASK, IN POBJECT_ATTRIBUTES); +static NTSTATUS (WINAPI * pNtOpenKeyEx)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, ULONG); static NTSTATUS (WINAPI * pNtClose)(IN HANDLE); static NTSTATUS (WINAPI * pNtFlushKey)(HANDLE); static NTSTATUS (WINAPI * pNtDeleteKey)(HANDLE); @@ -195,6 +196,7 @@ static BOOL InitFunctionPtrs(void) /* optional functions */ pNtQueryLicenseValue = (void *)GetProcAddress(hntdll, "NtQueryLicenseValue"); + pNtOpenKeyEx = (void *)GetProcAddress(hntdll, "NtOpenKeyEx"); return TRUE; } @@ -351,6 +353,18 @@ static void test_NtOpenKey(void) attr.Length *= 2; status = pNtOpenKey(&key, am, &attr); ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got: 0x%08x\n", status); + + if (!pNtOpenKeyEx) + { + win_skip("NtOpenKeyEx not available\n"); + return; + } + + InitializeObjectAttributes(&attr, &winetestpath, 0, 0, 0); + status = pNtOpenKeyEx(&key, KEY_WRITE|KEY_READ, &attr, 0); + ok(status == STATUS_SUCCESS, "NtOpenKeyEx Failed: 0x%08x\n", status); + + pNtClose(key); } static void test_NtCreateKey(void) diff --git a/include/winternl.h b/include/winternl.h index 54203913674..f3de6363ef6 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2169,6 +2169,7 @@ NTSYSAPI NTSTATUS WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_ NTSYSAPI NTSTATUS WINAPI NtOpenIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES); NTSYSAPI NTSTATUS WINAPI NtOpenJobObject(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSYSAPI NTSTATUS WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *); +NTSYSAPI NTSTATUS WINAPI NtOpenKeyEx(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG); NTSYSAPI NTSTATUS WINAPI NtOpenKeyedEvent(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSYSAPI NTSTATUS WINAPI NtOpenMutant(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSYSAPI NTSTATUS WINAPI NtOpenObjectAuditAlarm(PUNICODE_STRING,PHANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,ACCESS_MASK,PPRIVILEGE_SET,BOOLEAN,BOOLEAN,PBOOLEAN);