Implemented OpenProcess on top of NtOpenProcess.

This commit is contained in:
Eric Pouech 2005-06-27 11:12:11 +00:00 committed by Alexandre Julliard
parent 06ce892008
commit 6d68a03d4f
4 changed files with 44 additions and 10 deletions

View File

@ -2468,16 +2468,28 @@ void WINAPI ExitProcess16( WORD status )
*/ */
HANDLE WINAPI OpenProcess( DWORD access, BOOL inherit, DWORD id ) HANDLE WINAPI OpenProcess( DWORD access, BOOL inherit, DWORD id )
{ {
HANDLE ret = 0; NTSTATUS status;
SERVER_START_REQ( open_process ) HANDLE handle;
OBJECT_ATTRIBUTES attr;
CLIENT_ID cid;
cid.UniqueProcess = (HANDLE)id;
cid.UniqueThread = 0; /* FIXME ? */
attr.Length = sizeof(OBJECT_ATTRIBUTES);
attr.RootDirectory = NULL;
attr.Attributes = inherit ? OBJ_INHERIT : 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
attr.ObjectName = NULL;
status = NtOpenProcess(&handle, access, &attr, &cid);
if (status != STATUS_SUCCESS)
{ {
req->pid = id; SetLastError( RtlNtStatusToDosError(status) );
req->access = access; return NULL;
req->inherit = inherit;
if (!wine_server_call_err( req )) ret = reply->handle;
} }
SERVER_END_REQ; return handle;
return ret;
} }

View File

@ -149,7 +149,7 @@
@ stdcall NtOpenKey(ptr long ptr) @ stdcall NtOpenKey(ptr long ptr)
@ stdcall NtOpenMutant(ptr long ptr) @ stdcall NtOpenMutant(ptr long ptr)
@ stub NtOpenObjectAuditAlarm @ stub NtOpenObjectAuditAlarm
@ stub NtOpenProcess @ stdcall NtOpenProcess(ptr long ptr ptr)
@ stdcall NtOpenProcessToken(long long long) @ stdcall NtOpenProcessToken(long long long)
@ stdcall NtOpenSection(ptr long ptr) @ stdcall NtOpenSection(ptr long ptr)
@ stdcall NtOpenSemaphore(long long ptr) @ stdcall NtOpenSemaphore(long long ptr)
@ -769,7 +769,7 @@
@ stdcall ZwOpenKey(ptr long ptr) NtOpenKey @ stdcall ZwOpenKey(ptr long ptr) NtOpenKey
@ stdcall ZwOpenMutant(ptr long ptr) NtOpenMutant @ stdcall ZwOpenMutant(ptr long ptr) NtOpenMutant
@ stub ZwOpenObjectAuditAlarm @ stub ZwOpenObjectAuditAlarm
@ stub ZwOpenProcess @ stdcall ZwOpenProcess(ptr long ptr ptr) NtOpenProcess
@ stdcall ZwOpenProcessToken(long long long) NtOpenProcessToken @ stdcall ZwOpenProcessToken(long long long) NtOpenProcessToken
@ stdcall ZwOpenSection(ptr long ptr) NtOpenSection @ stdcall ZwOpenSection(ptr long ptr) NtOpenSection
@ stdcall ZwOpenSemaphore(long long ptr) NtOpenSemaphore @ stdcall ZwOpenSemaphore(long long ptr) NtOpenSemaphore

View File

@ -281,3 +281,24 @@ NTSTATUS WINAPI NtFlushInstructionCache(
#endif #endif
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
/******************************************************************
* NtOpenProcess [NTDLL.@]
* ZwOpenProcess [NTDLL.@]
*/
NTSTATUS WINAPI NtOpenProcess(PHANDLE handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES* attr, const CLIENT_ID* cid)
{
NTSTATUS status;
SERVER_START_REQ( open_process )
{
req->pid = (DWORD)cid->UniqueProcess;
req->access = access;
req->inherit = attr && (attr->Attributes & OBJ_INHERIT);
status = wine_server_call( req );
if (!status) *handle = reply->handle;
}
SERVER_END_REQ;
return status;
}

View File

@ -1695,6 +1695,7 @@ NTSTATUS WINAPI NtOpenFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BL
NTSTATUS WINAPI NtOpenIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES); NTSTATUS WINAPI NtOpenIoCompletion(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
NTSTATUS WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *); NTSTATUS WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *);
NTSTATUS WINAPI NtOpenMutant(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSTATUS WINAPI NtOpenMutant(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSTATUS WINAPI NtOpenProcess(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const CLIENT_ID*);
NTSTATUS WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *); NTSTATUS WINAPI NtOpenProcessToken(HANDLE,DWORD,HANDLE *);
NTSTATUS WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSTATUS WINAPI NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSTATUS WINAPI NtOpenSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*); NTSTATUS WINAPI NtOpenSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);