Commit 6d68a03d authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Implemented OpenProcess on top of NtOpenProcess.

parent 06ce8920
......@@ -2468,16 +2468,28 @@ void WINAPI ExitProcess16( WORD status )
*/
HANDLE WINAPI OpenProcess( DWORD access, BOOL inherit, DWORD id )
{
HANDLE ret = 0;
SERVER_START_REQ( open_process )
NTSTATUS status;
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;
req->access = access;
req->inherit = inherit;
if (!wine_server_call_err( req )) ret = reply->handle;
SetLastError( RtlNtStatusToDosError(status) );
return NULL;
}
SERVER_END_REQ;
return ret;
return handle;
}
......
......@@ -149,7 +149,7 @@
@ stdcall NtOpenKey(ptr long ptr)
@ stdcall NtOpenMutant(ptr long ptr)
@ stub NtOpenObjectAuditAlarm
@ stub NtOpenProcess
@ stdcall NtOpenProcess(ptr long ptr ptr)
@ stdcall NtOpenProcessToken(long long long)
@ stdcall NtOpenSection(ptr long ptr)
@ stdcall NtOpenSemaphore(long long ptr)
......@@ -769,7 +769,7 @@
@ stdcall ZwOpenKey(ptr long ptr) NtOpenKey
@ stdcall ZwOpenMutant(ptr long ptr) NtOpenMutant
@ stub ZwOpenObjectAuditAlarm
@ stub ZwOpenProcess
@ stdcall ZwOpenProcess(ptr long ptr ptr) NtOpenProcess
@ stdcall ZwOpenProcessToken(long long long) NtOpenProcessToken
@ stdcall ZwOpenSection(ptr long ptr) NtOpenSection
@ stdcall ZwOpenSemaphore(long long ptr) NtOpenSemaphore
......
......@@ -281,3 +281,24 @@ NTSTATUS WINAPI NtFlushInstructionCache(
#endif
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;
}
......@@ -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 NtOpenKey(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 NtOpenSection(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
NTSTATUS WINAPI NtOpenSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
......
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