ntdll: Implemented NtOpenProcessTokenEx and NtOpenThreadTokenEx.

This commit is contained in:
Alexandre Julliard 2008-09-04 21:57:13 +02:00
parent 1abf809099
commit 0327f84a2f
3 changed files with 41 additions and 21 deletions

View File

@ -95,22 +95,31 @@ NTSTATUS WINAPI NtOpenProcessToken(
HANDLE ProcessHandle, HANDLE ProcessHandle,
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;
} }
@ -123,21 +132,30 @@ NTSTATUS WINAPI NtOpenThreadToken(
DWORD DesiredAccess, DWORD DesiredAccess,
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;

View File

@ -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 @@
@ 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

View File

@ -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);