Implemented NtDuplicateObject.

This commit is contained in:
Alexandre Julliard 2002-09-16 19:32:50 +00:00
parent a9c057f73b
commit ac7b9d3797
4 changed files with 32 additions and 36 deletions

View File

@ -99,7 +99,7 @@
@ stdcall NtDeleteValueKey(long ptr) NtDeleteValueKey @ stdcall NtDeleteValueKey(long ptr) NtDeleteValueKey
@ stdcall NtDeviceIoControlFile(long long long long long long long long long long) NtDeviceIoControlFile @ stdcall NtDeviceIoControlFile(long long long long long long long long long long) NtDeviceIoControlFile
@ stdcall NtDisplayString(ptr)NtDisplayString @ stdcall NtDisplayString(ptr)NtDisplayString
@ stdcall NtDuplicateObject(long long long long long long long) NtDuplicateObject @ stdcall NtDuplicateObject(long long long ptr long long long) NtDuplicateObject
@ stdcall NtDuplicateToken(long long long long long long) NtDuplicateToken @ stdcall NtDuplicateToken(long long long long long long) NtDuplicateToken
@ stub NtEnumerateBus @ stub NtEnumerateBus
@ stdcall NtEnumerateKey (long long long long long long) NtEnumerateKey @ stdcall NtEnumerateKey (long long long long long long) NtEnumerateKey
@ -616,7 +616,7 @@
@ stdcall ZwDeleteValueKey(long ptr) NtDeleteValueKey @ stdcall ZwDeleteValueKey(long ptr) NtDeleteValueKey
@ stdcall ZwDeviceIoControlFile(long long long long long long long long long long) NtDeviceIoControlFile @ stdcall ZwDeviceIoControlFile(long long long long long long long long long long) NtDeviceIoControlFile
@ stub ZwDisplayString @ stub ZwDisplayString
@ stdcall ZwDuplicateObject(long long long long long long long) NtDuplicateObject @ stdcall ZwDuplicateObject(long long long ptr long long long) NtDuplicateObject
@ stdcall ZwDuplicateToken(long long long long long long) NtDuplicateToken @ stdcall ZwDuplicateToken(long long long long long long) NtDuplicateToken
@ stub ZwEnumerateBus @ stub ZwEnumerateBus
@ stdcall ZwEnumerateKey(long long long ptr long ptr) NtEnumerateKey @ stdcall ZwEnumerateKey(long long long ptr long ptr) NtEnumerateKey

View File

@ -213,24 +213,34 @@ NtQuerySecurityObject(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
/****************************************************************************** /******************************************************************************
* NtDuplicateObject [NTDLL.@] * NtDuplicateObject [NTDLL.@]
* ZwDuplicateObject [NTDLL.@] * ZwDuplicateObject [NTDLL.@]
*/ */
NTSTATUS WINAPI NtDuplicateObject( NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
IN HANDLE SourceProcessHandle, HANDLE dest_process, PHANDLE dest,
IN PHANDLE SourceHandle, ACCESS_MASK access, ULONG attributes, ULONG options )
IN HANDLE TargetProcessHandle,
OUT PHANDLE TargetHandle,
IN ACCESS_MASK DesiredAccess,
IN BOOLEAN InheritHandle,
ULONG Options)
{ {
FIXME("(0x%08x,%p,0x%08x,%p,0x%08lx,0x%08x,0x%08lx) stub!\n", NTSTATUS ret;
SourceProcessHandle,SourceHandle,TargetProcessHandle,TargetHandle, SERVER_START_REQ( dup_handle )
DesiredAccess,InheritHandle,Options); {
*TargetHandle = 0; req->src_process = source_process;
return 0; req->src_handle = source;
req->dst_process = dest_process;
req->access = access;
req->inherit = (attributes & OBJ_INHERIT) != 0;
req->options = options;
if (!(ret = wine_server_call( req )))
{
if (dest) *dest = reply->handle;
if (reply->fd != -1) close( reply->fd );
}
}
SERVER_END_REQ;
return ret;
} }
/************************************************************************** /**************************************************************************

View File

@ -762,6 +762,7 @@ NTSTATUS WINAPI NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,
NTSTATUS WINAPI NtDeleteKey(HANDLE); NTSTATUS WINAPI NtDeleteKey(HANDLE);
NTSTATUS WINAPI NtDeleteValueKey(HANDLE,const UNICODE_STRING *); NTSTATUS WINAPI NtDeleteValueKey(HANDLE,const UNICODE_STRING *);
NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG); NTSTATUS WINAPI NtDeviceIoControlFile(HANDLE,HANDLE,PIO_APC_ROUTINE,PVOID,PIO_STATUS_BLOCK,ULONG,PVOID,ULONG,PVOID,ULONG);
NTSTATUS WINAPI NtDuplicateObject(HANDLE,HANDLE,HANDLE,PHANDLE,ACCESS_MASK,ULONG,ULONG);
NTSTATUS WINAPI NtEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *); NTSTATUS WINAPI NtEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
NTSTATUS WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG); NTSTATUS WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtFlushKey(HANDLE); NTSTATUS WINAPI NtFlushKey(HANDLE);

View File

@ -98,28 +98,13 @@ BOOL WINAPI SetHandleInformation( HANDLE handle, DWORD mask, DWORD flags )
* DuplicateHandle (KERNEL32.@) * DuplicateHandle (KERNEL32.@)
*/ */
BOOL WINAPI DuplicateHandle( HANDLE source_process, HANDLE source, BOOL WINAPI DuplicateHandle( HANDLE source_process, HANDLE source,
HANDLE dest_process, HANDLE *dest, HANDLE dest_process, HANDLE *dest,
DWORD access, BOOL inherit, DWORD options ) DWORD access, BOOL inherit, DWORD options )
{ {
BOOL ret; NTSTATUS status = NtDuplicateObject( source_process, source, dest_process, dest,
SERVER_START_REQ( dup_handle ) access, inherit ? OBJ_INHERIT : 0, options );
{ if (status) SetLastError( RtlNtStatusToDosError(status) );
req->src_process = source_process; return !status;
req->src_handle = source;
req->dst_process = dest_process;
req->access = access;
req->inherit = inherit;
req->options = options;
ret = !wine_server_call_err( req );
if (ret)
{
if (dest) *dest = reply->handle;
if (reply->fd != -1) close( reply->fd );
}
}
SERVER_END_REQ;
return ret;
} }