Commit 4269423e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Added NtOpenKeyEx implementation.

parent 56c045c6
......@@ -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
......
......@@ -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;
......@@ -141,6 +139,19 @@ NTSTATUS WINAPI NtOpenKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTR
}
/******************************************************************************
* 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.@]
*
* See NtOpenKey.
......
......@@ -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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment