ntdll: Added NtOpenKeyEx implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2015-11-04 15:28:49 +01:00 committed by Alexandre Julliard
parent 56c045c68e
commit 4269423ee4
4 changed files with 35 additions and 7 deletions

View File

@ -213,6 +213,7 @@
@ stdcall NtOpenIoCompletion(ptr long ptr) @ stdcall NtOpenIoCompletion(ptr long ptr)
@ stdcall NtOpenJobObject(ptr long ptr) @ stdcall NtOpenJobObject(ptr long ptr)
@ stdcall NtOpenKey(ptr long ptr) @ stdcall NtOpenKey(ptr long ptr)
@ stdcall NtOpenKeyEx(ptr long ptr long)
@ stdcall NtOpenKeyedEvent(ptr long ptr) @ stdcall NtOpenKeyedEvent(ptr long ptr)
@ stdcall NtOpenMutant(ptr long ptr) @ stdcall NtOpenMutant(ptr long ptr)
@ stub NtOpenObjectAuditAlarm @ stub NtOpenObjectAuditAlarm
@ -1128,6 +1129,7 @@
@ stdcall ZwOpenIoCompletion(ptr long ptr) NtOpenIoCompletion @ stdcall ZwOpenIoCompletion(ptr long ptr) NtOpenIoCompletion
@ stdcall ZwOpenJobObject(ptr long ptr) NtOpenJobObject @ stdcall ZwOpenJobObject(ptr long ptr) NtOpenJobObject
@ stdcall ZwOpenKey(ptr long ptr) NtOpenKey @ stdcall ZwOpenKey(ptr long ptr) NtOpenKey
@ stdcall ZwOpenKeyEx(ptr long ptr long) NtOpenKeyEx
@ stdcall ZwOpenKeyedEvent(ptr long ptr) NtOpenKeyedEvent @ stdcall ZwOpenKeyedEvent(ptr long ptr) NtOpenKeyedEvent
@ stdcall ZwOpenMutant(ptr long ptr) NtOpenMutant @ stdcall ZwOpenMutant(ptr long ptr) NtOpenMutant
@ stub ZwOpenObjectAuditAlarm @ stub ZwOpenObjectAuditAlarm

View File

@ -106,14 +106,10 @@ NTSTATUS WINAPI RtlpNtCreateKey( PHANDLE retkey, ACCESS_MASK access, const OBJEC
} }
/****************************************************************************** /******************************************************************************
* NtOpenKey [NTDLL.@] * NtOpenKeyEx [NTDLL.@]
* ZwOpenKey [NTDLL.@] * ZwOpenKeyEx [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 ) NTSTATUS WINAPI NtOpenKeyEx( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, ULONG options )
{ {
NTSTATUS ret; NTSTATUS ret;
DWORD len; DWORD len;
@ -123,6 +119,8 @@ NTSTATUS WINAPI NtOpenKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTR
len = attr->ObjectName->Length; len = attr->ObjectName->Length;
TRACE( "(%p,%s,%x,%p)\n", attr->RootDirectory, TRACE( "(%p,%s,%x,%p)\n", attr->RootDirectory,
debugstr_us(attr->ObjectName), access, retkey ); debugstr_us(attr->ObjectName), access, retkey );
if (options)
FIXME("options %x not implemented\n", options);
if (len > MAX_NAME_LENGTH) return STATUS_BUFFER_OVERFLOW; 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; 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.@] * RtlpNtOpenKey [NTDLL.@]
* *

View File

@ -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 * pRtlCheckRegistryKey)(IN ULONG,IN PWSTR);
static NTSTATUS (WINAPI * pRtlOpenCurrentUser)(IN ACCESS_MASK, PHANDLE); static NTSTATUS (WINAPI * pRtlOpenCurrentUser)(IN ACCESS_MASK, PHANDLE);
static NTSTATUS (WINAPI * pNtOpenKey)(PHANDLE, IN ACCESS_MASK, IN POBJECT_ATTRIBUTES); 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 * pNtClose)(IN HANDLE);
static NTSTATUS (WINAPI * pNtFlushKey)(HANDLE); static NTSTATUS (WINAPI * pNtFlushKey)(HANDLE);
static NTSTATUS (WINAPI * pNtDeleteKey)(HANDLE); static NTSTATUS (WINAPI * pNtDeleteKey)(HANDLE);
@ -195,6 +196,7 @@ static BOOL InitFunctionPtrs(void)
/* optional functions */ /* optional functions */
pNtQueryLicenseValue = (void *)GetProcAddress(hntdll, "NtQueryLicenseValue"); pNtQueryLicenseValue = (void *)GetProcAddress(hntdll, "NtQueryLicenseValue");
pNtOpenKeyEx = (void *)GetProcAddress(hntdll, "NtOpenKeyEx");
return TRUE; return TRUE;
} }
@ -351,6 +353,18 @@ static void test_NtOpenKey(void)
attr.Length *= 2; attr.Length *= 2;
status = pNtOpenKey(&key, am, &attr); status = pNtOpenKey(&key, am, &attr);
ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got: 0x%08x\n", status); 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) static void test_NtCreateKey(void)

View File

@ -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 NtOpenIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
NTSYSAPI NTSTATUS WINAPI NtOpenJobObject(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSYSAPI NTSTATUS WINAPI NtOpenJobObject(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSYSAPI NTSTATUS WINAPI NtOpenKey(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 NtOpenKeyedEvent(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSYSAPI NTSTATUS WINAPI NtOpenMutant(PHANDLE,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); NTSYSAPI NTSTATUS WINAPI NtOpenObjectAuditAlarm(PUNICODE_STRING,PHANDLE,PUNICODE_STRING,PUNICODE_STRING,PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,ACCESS_MASK,PPRIVILEGE_SET,BOOLEAN,BOOLEAN,PBOOLEAN);