Commit 0327f84a authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Implemented NtOpenProcessTokenEx and NtOpenThreadTokenEx.

parent 1abf8090
...@@ -96,21 +96,30 @@ NTSTATUS WINAPI NtOpenProcessToken( ...@@ -96,21 +96,30 @@ NTSTATUS WINAPI NtOpenProcessToken(
DWORD DesiredAccess, DWORD DesiredAccess,
HANDLE *TokenHandle) HANDLE *TokenHandle)
{ {
return NtOpenProcessTokenEx( ProcessHandle, DesiredAccess, 0, TokenHandle );
}
/******************************************************************************
* NtOpenProcessTokenEx [NTDLL.@]
* ZwOpenProcessTokenEx [NTDLL.@]
*/
NTSTATUS WINAPI NtOpenProcessTokenEx( HANDLE process, DWORD access, DWORD attributes,
HANDLE *handle )
{
NTSTATUS ret; NTSTATUS ret;
TRACE("(%p,0x%08x,%p)\n", ProcessHandle,DesiredAccess, TokenHandle); TRACE("(%p,0x%08x,0x%08x,%p)\n", process, access, attributes, handle);
SERVER_START_REQ( open_token ) SERVER_START_REQ( open_token )
{ {
req->handle = ProcessHandle; req->handle = process;
req->access = DesiredAccess; req->access = access;
req->attributes = 0; req->attributes = attributes;
req->flags = 0; req->flags = 0;
ret = wine_server_call( req ); ret = wine_server_call( req );
if (!ret) *TokenHandle = reply->token; if (!ret) *handle = reply->token;
} }
SERVER_END_REQ; SERVER_END_REQ;
return ret; return ret;
} }
...@@ -124,20 +133,29 @@ NTSTATUS WINAPI NtOpenThreadToken( ...@@ -124,20 +133,29 @@ NTSTATUS WINAPI NtOpenThreadToken(
BOOLEAN OpenAsSelf, BOOLEAN OpenAsSelf,
HANDLE *TokenHandle) HANDLE *TokenHandle)
{ {
return NtOpenThreadTokenEx( ThreadHandle, DesiredAccess, OpenAsSelf, 0, TokenHandle );
}
/******************************************************************************
* NtOpenThreadTokenEx [NTDLL.@]
* ZwOpenThreadTokenEx [NTDLL.@]
*/
NTSTATUS WINAPI NtOpenThreadTokenEx( HANDLE thread, DWORD access, BOOLEAN as_self, DWORD attributes,
HANDLE *handle )
{
NTSTATUS ret; NTSTATUS ret;
TRACE("(%p,0x%08x,0x%08x,%p)\n", TRACE("(%p,0x%08x,%u,0x%08x,%p)\n", thread, access, as_self, attributes, handle );
ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
SERVER_START_REQ( open_token ) SERVER_START_REQ( open_token )
{ {
req->handle = ThreadHandle; req->handle = thread;
req->access = DesiredAccess; req->access = access;
req->attributes = 0; req->attributes = attributes;
req->flags = OPEN_TOKEN_THREAD; req->flags = OPEN_TOKEN_THREAD;
if (OpenAsSelf) req->flags |= OPEN_TOKEN_AS_SELF; if (as_self) req->flags |= OPEN_TOKEN_AS_SELF;
ret = wine_server_call( req ); ret = wine_server_call( req );
if (!ret) *TokenHandle = reply->token; if (!ret) *handle = reply->token;
} }
SERVER_END_REQ; SERVER_END_REQ;
......
...@@ -214,14 +214,14 @@ ...@@ -214,14 +214,14 @@
@ stdcall NtOpenMutant(ptr long ptr) @ stdcall NtOpenMutant(ptr long ptr)
@ stub NtOpenObjectAuditAlarm @ stub NtOpenObjectAuditAlarm
@ stdcall NtOpenProcess(ptr long ptr ptr) @ stdcall NtOpenProcess(ptr long ptr ptr)
@ stdcall NtOpenProcessToken(long long long) @ stdcall NtOpenProcessToken(long long ptr)
# @ stub NtOpenProcessTokenEx @ stdcall NtOpenProcessTokenEx(long long long ptr)
@ stdcall NtOpenSection(ptr long ptr) @ stdcall NtOpenSection(ptr long ptr)
@ stdcall NtOpenSemaphore(long long ptr) @ stdcall NtOpenSemaphore(long long ptr)
@ stdcall NtOpenSymbolicLinkObject (ptr long ptr) @ stdcall NtOpenSymbolicLinkObject (ptr long ptr)
@ stdcall NtOpenThread(ptr long ptr ptr) @ stdcall NtOpenThread(ptr long ptr ptr)
@ stdcall NtOpenThreadToken(long long long long) @ stdcall NtOpenThreadToken(long long long ptr)
# @ stub NtOpenThreadTokenEx @ stdcall NtOpenThreadTokenEx(long long long long ptr)
@ stdcall NtOpenTimer(ptr long ptr) @ stdcall NtOpenTimer(ptr long ptr)
@ stub NtPlugPlayControl @ stub NtPlugPlayControl
@ stdcall NtPowerInformation(long ptr long ptr long) @ stdcall NtPowerInformation(long ptr long ptr long)
...@@ -1058,14 +1058,14 @@ ...@@ -1058,14 +1058,14 @@
@ stdcall ZwOpenMutant(ptr long ptr) NtOpenMutant @ stdcall ZwOpenMutant(ptr long ptr) NtOpenMutant
@ stub ZwOpenObjectAuditAlarm @ stub ZwOpenObjectAuditAlarm
@ stdcall ZwOpenProcess(ptr long ptr ptr) NtOpenProcess @ stdcall ZwOpenProcess(ptr long ptr ptr) NtOpenProcess
@ stdcall ZwOpenProcessToken(long long long) NtOpenProcessToken @ stdcall ZwOpenProcessToken(long long ptr) NtOpenProcessToken
# @ stub ZwOpenProcessTokenEx @ stdcall ZwOpenProcessTokenEx(long long long ptr) NtOpenProcessTokenEx
@ stdcall ZwOpenSection(ptr long ptr) NtOpenSection @ stdcall ZwOpenSection(ptr long ptr) NtOpenSection
@ stdcall ZwOpenSemaphore(long long ptr) NtOpenSemaphore @ stdcall ZwOpenSemaphore(long long ptr) NtOpenSemaphore
@ stdcall ZwOpenSymbolicLinkObject (ptr long ptr) NtOpenSymbolicLinkObject @ stdcall ZwOpenSymbolicLinkObject (ptr long ptr) NtOpenSymbolicLinkObject
@ stdcall ZwOpenThread(ptr long ptr ptr) NtOpenThread @ stdcall ZwOpenThread(ptr long ptr ptr) NtOpenThread
@ stdcall ZwOpenThreadToken(long long long long) NtOpenThreadToken @ stdcall ZwOpenThreadToken(long long long ptr) NtOpenThreadToken
# @ stub ZwOpenThreadTokenEx @ stdcall ZwOpenThreadTokenEx(long long long long ptr) NtOpenThreadTokenEx
@ stdcall ZwOpenTimer(ptr long ptr) NtOpenTimer @ stdcall ZwOpenTimer(ptr long ptr) NtOpenTimer
@ stub ZwPlugPlayControl @ stub ZwPlugPlayControl
@ stdcall ZwPowerInformation(long ptr long ptr long) NtPowerInformation @ stdcall ZwPowerInformation(long ptr long ptr long) NtPowerInformation
......
...@@ -1942,11 +1942,13 @@ NTSYSAPI NTSTATUS WINAPI NtOpenMutant(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUT ...@@ -1942,11 +1942,13 @@ NTSYSAPI NTSTATUS WINAPI NtOpenMutant(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUT
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);
NTSYSAPI NTSTATUS WINAPI NtOpenProcess(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*); NTSYSAPI NTSTATUS WINAPI NtOpenProcess(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
NTSYSAPI NTSTATUS WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *); NTSYSAPI NTSTATUS WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
NTSYSAPI NTSTATUS WINAPI NtOpenProcessTokenEx(HANDLE,DWORD,DWORD,HANDLE *);
NTSYSAPI NTSTATUS WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSYSAPI NTSTATUS WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSYSAPI NTSTATUS WINAPI NtOpenSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSYSAPI NTSTATUS WINAPI NtOpenSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSYSAPI NTSTATUS WINAPI NtOpenSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES); NTSYSAPI NTSTATUS WINAPI NtOpenSymbolicLinkObject(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
NTSYSAPI NTSTATUS WINAPI NtOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*); NTSYSAPI NTSTATUS WINAPI NtOpenThread(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
NTSYSAPI NTSTATUS WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *); NTSYSAPI NTSTATUS WINAPI NtOpenThreadToken(HANDLE,DWORD,BOOLEAN,HANDLE *);
NTSYSAPI NTSTATUS WINAPI NtOpenThreadTokenEx(HANDLE,DWORD,BOOLEAN,DWORD,HANDLE *);
NTSYSAPI NTSTATUS WINAPI NtOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*); NTSYSAPI NTSTATUS WINAPI NtOpenTimer(HANDLE*, ACCESS_MASK, const OBJECT_ATTRIBUTES*);
NTSYSAPI NTSTATUS WINAPI NtPowerInformation(POWER_INFORMATION_LEVEL,PVOID,ULONG,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtPowerInformation(POWER_INFORMATION_LEVEL,PVOID,ULONG,PVOID,ULONG);
NTSYSAPI NTSTATUS WINAPI NtPrivilegeCheck(HANDLE,PPRIVILEGE_SET,PBOOLEAN); NTSYSAPI NTSTATUS WINAPI NtPrivilegeCheck(HANDLE,PPRIVILEGE_SET,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