Rewrote Get/SetHandleInformation to call the corresponding ntdll
functions.
This commit is contained in:
parent
b032243bdb
commit
73cb76542f
|
@ -2489,18 +2489,17 @@ BOOL WINAPI CloseHandle( HANDLE handle )
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI GetHandleInformation( HANDLE handle, LPDWORD flags )
|
BOOL WINAPI GetHandleInformation( HANDLE handle, LPDWORD flags )
|
||||||
{
|
{
|
||||||
BOOL ret;
|
OBJECT_DATA_INFORMATION info;
|
||||||
SERVER_START_REQ( set_handle_info )
|
NTSTATUS status = NtQueryObject( handle, ObjectDataInformation, &info, sizeof(info), NULL );
|
||||||
|
|
||||||
|
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||||
|
else if (flags)
|
||||||
{
|
{
|
||||||
req->handle = handle;
|
*flags = 0;
|
||||||
req->flags = 0;
|
if (info.InheritHandle) *flags |= HANDLE_FLAG_INHERIT;
|
||||||
req->mask = 0;
|
if (info.ProtectFromClose) *flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE;
|
||||||
req->fd = -1;
|
|
||||||
ret = !wine_server_call_err( req );
|
|
||||||
if (ret && flags) *flags = reply->old_flags;
|
|
||||||
}
|
}
|
||||||
SERVER_END_REQ;
|
return !status;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2509,17 +2508,27 @@ BOOL WINAPI GetHandleInformation( HANDLE handle, LPDWORD flags )
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetHandleInformation( HANDLE handle, DWORD mask, DWORD flags )
|
BOOL WINAPI SetHandleInformation( HANDLE handle, DWORD mask, DWORD flags )
|
||||||
{
|
{
|
||||||
BOOL ret;
|
OBJECT_DATA_INFORMATION info;
|
||||||
SERVER_START_REQ( set_handle_info )
|
NTSTATUS status;
|
||||||
|
|
||||||
|
/* if not setting both fields, retrieve current value first */
|
||||||
|
if ((mask & (HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE)) !=
|
||||||
|
(HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE))
|
||||||
{
|
{
|
||||||
req->handle = handle;
|
if ((status = NtQueryObject( handle, ObjectDataInformation, &info, sizeof(info), NULL )))
|
||||||
req->flags = flags;
|
{
|
||||||
req->mask = mask;
|
SetLastError( RtlNtStatusToDosError(status) );
|
||||||
req->fd = -1;
|
return FALSE;
|
||||||
ret = !wine_server_call_err( req );
|
}
|
||||||
}
|
}
|
||||||
SERVER_END_REQ;
|
if (mask & HANDLE_FLAG_INHERIT)
|
||||||
return ret;
|
info.InheritHandle = (flags & HANDLE_FLAG_INHERIT) != 0;
|
||||||
|
if (mask & HANDLE_FLAG_PROTECT_FROM_CLOSE)
|
||||||
|
info.ProtectFromClose = (flags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0;
|
||||||
|
|
||||||
|
status = NtSetInformationObject( handle, ObjectDataInformation, &info, sizeof(info) );
|
||||||
|
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||||
|
return !status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue