server: Add functions for conversions between server object handles and pointer-style handles.

This commit is contained in:
Alexandre Julliard 2008-12-08 16:05:17 +01:00
parent 0d3d456bd0
commit d1b3d484f7
30 changed files with 341 additions and 316 deletions

View File

@ -295,13 +295,13 @@ HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creat
SERVER_START_REQ( open_console )
{
req->from = output;
req->from = wine_server_obj_handle( output );
req->access = access;
req->attributes = inherit ? OBJ_INHERIT : 0;
req->share = FILE_SHARE_READ | FILE_SHARE_WRITE;
SetLastError(0);
wine_server_call_err( req );
ret = reply->handle;
ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
if (ret)
@ -353,7 +353,7 @@ HANDLE WINAPI DuplicateConsoleHandle(HANDLE handle, DWORD access, BOOL inherit,
HANDLE ret;
if (!is_console_handle(handle) ||
!DuplicateHandle(GetCurrentProcess(), console_handle_unmap(handle),
!DuplicateHandle(GetCurrentProcess(), wine_server_ptr_handle(console_handle_unmap(handle)),
GetCurrentProcess(), &ret, access, inherit, options))
return INVALID_HANDLE_VALUE;
return console_handle_map(ret);
@ -371,7 +371,7 @@ BOOL WINAPI CloseConsoleHandle(HANDLE handle)
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return CloseHandle(console_handle_unmap(handle));
return CloseHandle(wine_server_ptr_handle(console_handle_unmap(handle)));
}
/******************************************************************
@ -385,7 +385,8 @@ HANDLE WINAPI GetConsoleInputWaitHandle(void)
{
SERVER_START_REQ(get_console_wait_event)
{
if (!wine_server_call_err( req )) console_wait_event = reply->handle;
if (!wine_server_call_err( req ))
console_wait_event = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
}
@ -1794,7 +1795,8 @@ HANDLE WINAPI CreateConsoleScreenBuffer(DWORD dwDesiredAccess, DWORD dwShareMode
req->access = dwDesiredAccess;
req->attributes = (sa && sa->bInheritHandle) ? OBJ_INHERIT : 0;
req->share = dwShareMode;
if (!wine_server_call_err( req )) ret = console_handle_map(reply->handle_out);
if (!wine_server_call_err( req ))
ret = console_handle_map( wine_server_ptr_handle( reply->handle_out ));
}
SERVER_END_REQ;
@ -1857,7 +1859,7 @@ BOOL WINAPI SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)
{
req->handle = 0;
req->mask = SET_CONSOLE_INPUT_INFO_ACTIVE_SB;
req->active_sb = hConsoleOutput;
req->active_sb = wine_server_obj_handle( hConsoleOutput );
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;

View File

@ -64,7 +64,7 @@ BOOL WINAPI WaitForDebugEvent(
if (!wine_server_reply_size(reply)) /* timeout */
{
wait = reply->wait;
wait = wine_server_ptr_handle( reply->wait );
ret = FALSE;
goto done;
}
@ -78,14 +78,14 @@ BOOL WINAPI WaitForDebugEvent(
event->u.Exception.dwFirstChance = data.info.exception.first;
break;
case CREATE_THREAD_DEBUG_EVENT:
event->u.CreateThread.hThread = data.info.create_thread.handle;
event->u.CreateThread.hThread = wine_server_ptr_handle( data.info.create_thread.handle );
event->u.CreateThread.lpThreadLocalBase = data.info.create_thread.teb;
event->u.CreateThread.lpStartAddress = data.info.create_thread.start;
break;
case CREATE_PROCESS_DEBUG_EVENT:
event->u.CreateProcessInfo.hFile = data.info.create_process.file;
event->u.CreateProcessInfo.hProcess = data.info.create_process.process;
event->u.CreateProcessInfo.hThread = data.info.create_process.thread;
event->u.CreateProcessInfo.hFile = wine_server_ptr_handle( data.info.create_process.file );
event->u.CreateProcessInfo.hProcess = wine_server_ptr_handle( data.info.create_process.process );
event->u.CreateProcessInfo.hThread = wine_server_ptr_handle( data.info.create_process.thread );
event->u.CreateProcessInfo.lpBaseOfImage = data.info.create_process.base;
event->u.CreateProcessInfo.dwDebugInfoFileOffset = data.info.create_process.dbg_offset;
event->u.CreateProcessInfo.nDebugInfoSize = data.info.create_process.dbg_size;
@ -101,7 +101,7 @@ BOOL WINAPI WaitForDebugEvent(
event->u.ExitProcess.dwExitCode = data.info.exit.exit_code;
break;
case LOAD_DLL_DEBUG_EVENT:
event->u.LoadDll.hFile = data.info.load_dll.handle;
event->u.LoadDll.hFile = wine_server_ptr_handle( data.info.load_dll.handle );
event->u.LoadDll.lpBaseOfDll = data.info.load_dll.base;
event->u.LoadDll.dwDebugInfoFileOffset = data.info.load_dll.dbg_offset;
event->u.LoadDll.nDebugInfoSize = data.info.load_dll.dbg_size;
@ -327,7 +327,7 @@ BOOL WINAPI DebugBreakProcess(HANDLE hProc)
SERVER_START_REQ( debug_break )
{
req->handle = hProc;
req->handle = wine_server_obj_handle( hProc );
ret = !wine_server_call_err( req );
self = ret && reply->self;
}

View File

@ -149,8 +149,8 @@ static DWORD wait_input_idle( HANDLE process, DWORD timeout )
handles[0] = process;
SERVER_START_REQ( get_process_idle_event )
{
req->handle = process;
if (!(ret = wine_server_call_err( req ))) handles[1] = reply->event;
req->handle = wine_server_obj_handle(process);
if (!(ret = wine_server_call_err( req ))) handles[1] = wine_server_ptr_handle( reply->event );
}
SERVER_END_REQ;
if (ret) return WAIT_FAILED; /* error */

View File

@ -21,6 +21,8 @@
#ifndef __WINE_KERNEL_PRIVATE_H
#define __WINE_KERNEL_PRIVATE_H
#include "wine/server.h"
struct tagSYSLEVEL;
struct kernel_thread_data
@ -56,9 +58,9 @@ static inline HANDLE console_handle_map(HANDLE h)
}
/* map a kernel32 console handle onto a real wineserver handle */
static inline HANDLE console_handle_unmap(HANDLE h)
static inline obj_handle_t console_handle_unmap(HANDLE h)
{
return h != INVALID_HANDLE_VALUE ? (HANDLE)((UINT_PTR)h ^ 3) : INVALID_HANDLE_VALUE;
return wine_server_obj_handle( h != INVALID_HANDLE_VALUE ? (HANDLE)((UINT_PTR)h ^ 3) : INVALID_HANDLE_VALUE );
}
extern HMODULE kernel32_handle;

View File

@ -1276,8 +1276,10 @@ static int fork_and_exec( const char *filename, const WCHAR *cmdline, const WCHA
hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
}
if (is_console_handle( hstdin )) hstdin = console_handle_unmap( hstdin );
if (is_console_handle( hstdout )) hstdout = console_handle_unmap( hstdout );
if (is_console_handle( hstdin ))
hstdin = wine_server_ptr_handle( console_handle_unmap( hstdin ));
if (is_console_handle( hstdout ))
hstdout = wine_server_ptr_handle( console_handle_unmap( hstdout ));
wine_server_handle_to_fd( hstdin, FILE_READ_DATA, &stdin_fd, NULL );
wine_server_handle_to_fd( hstdout, FILE_WRITE_DATA, &stdout_fd, NULL );
}
@ -1492,30 +1494,30 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
req->inherit_all = inherit;
req->create_flags = flags;
req->socket_fd = socketfd[1];
req->exe_file = hFile;
req->exe_file = wine_server_obj_handle( hFile );
req->process_access = PROCESS_ALL_ACCESS;
req->process_attr = (psa && (psa->nLength >= sizeof(*psa)) && psa->bInheritHandle) ? OBJ_INHERIT : 0;
req->thread_access = THREAD_ALL_ACCESS;
req->thread_attr = (tsa && (tsa->nLength >= sizeof(*tsa)) && tsa->bInheritHandle) ? OBJ_INHERIT : 0;
req->hstdin = params->hStdInput;
req->hstdout = params->hStdOutput;
req->hstderr = params->hStdError;
req->hstdin = wine_server_obj_handle( params->hStdInput );
req->hstdout = wine_server_obj_handle( params->hStdOutput );
req->hstderr = wine_server_obj_handle( params->hStdError );
if ((flags & (CREATE_NEW_CONSOLE | DETACHED_PROCESS)) != 0)
{
/* this is temporary (for console handles). We have no way to control that the handle is invalid in child process otherwise */
if (is_console_handle(req->hstdin)) req->hstdin = INVALID_HANDLE_VALUE;
if (is_console_handle(req->hstdout)) req->hstdout = INVALID_HANDLE_VALUE;
if (is_console_handle(req->hstderr)) req->hstderr = INVALID_HANDLE_VALUE;
if (is_console_handle(params->hStdInput)) req->hstdin = wine_server_obj_handle( INVALID_HANDLE_VALUE );
if (is_console_handle(params->hStdOutput)) req->hstdout = wine_server_obj_handle( INVALID_HANDLE_VALUE );
if (is_console_handle(params->hStdError)) req->hstderr = wine_server_obj_handle( INVALID_HANDLE_VALUE );
hstdin = hstdout = 0;
}
else
{
if (is_console_handle(req->hstdin)) req->hstdin = console_handle_unmap(req->hstdin);
if (is_console_handle(req->hstdout)) req->hstdout = console_handle_unmap(req->hstdout);
if (is_console_handle(req->hstderr)) req->hstderr = console_handle_unmap(req->hstderr);
hstdin = req->hstdin;
hstdout = req->hstdout;
if (is_console_handle(params->hStdInput)) req->hstdin = console_handle_unmap(params->hStdInput);
if (is_console_handle(params->hStdOutput)) req->hstdout = console_handle_unmap(params->hStdOutput);
if (is_console_handle(params->hStdError)) req->hstderr = console_handle_unmap(params->hStdError);
hstdin = wine_server_ptr_handle( req->hstdin );
hstdout = wine_server_ptr_handle( req->hstdout );
}
wine_server_add_data( req, params, params->Size );
@ -1524,10 +1526,10 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
{
info->dwProcessId = (DWORD)reply->pid;
info->dwThreadId = (DWORD)reply->tid;
info->hProcess = reply->phandle;
info->hThread = reply->thandle;
info->hProcess = wine_server_ptr_handle( reply->phandle );
info->hThread = wine_server_ptr_handle( reply->thandle );
}
process_info = reply->info;
process_info = wine_server_ptr_handle( reply->info );
}
SERVER_END_REQ;
@ -1610,7 +1612,7 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
WaitForSingleObject( process_info, INFINITE );
SERVER_START_REQ( get_new_process_info )
{
req->info = process_info;
req->info = wine_server_obj_handle( process_info );
wine_server_call( req );
success = reply->success;
err = reply->exit_code;

View File

@ -89,7 +89,7 @@ NTSTATUS WINAPI RtlDeleteAtomFromAtomTable( RTL_ATOM_TABLE table, RTL_ATOM atom
SERVER_START_REQ( delete_atom )
{
req->atom = atom;
req->table = table;
req->table = wine_server_obj_handle( table );
status = wine_server_call( req );
}
SERVER_END_REQ;
@ -138,7 +138,7 @@ NTSTATUS WINAPI RtlQueryAtomInAtomTable( RTL_ATOM_TABLE table, RTL_ATOM atom, UL
SERVER_START_REQ( get_atom_information )
{
req->atom = atom;
req->table = table;
req->table = wine_server_obj_handle( table );
if (len && *len && name)
wine_server_set_reply( req, name, *len );
status = wine_server_call( req );
@ -185,7 +185,7 @@ NTSTATUS WINAPI RtlCreateAtomTable( ULONG size, RTL_ATOM_TABLE* table )
{
req->entries = size;
status = wine_server_call( req );
*table = reply->table;
*table = wine_server_ptr_handle( reply->table );
}
SERVER_END_REQ;
}
@ -218,7 +218,7 @@ NTSTATUS WINAPI RtlAddAtomToAtomTable( RTL_ATOM_TABLE table, const WCHAR* name,
SERVER_START_REQ( add_atom )
{
wine_server_add_data( req, name, len * sizeof(WCHAR) );
req->table = table;
req->table = wine_server_obj_handle( table );
status = wine_server_call( req );
*atom = reply->atom;
}
@ -248,7 +248,7 @@ NTSTATUS WINAPI RtlLookupAtomInAtomTable( RTL_ATOM_TABLE table, const WCHAR* nam
SERVER_START_REQ( find_atom )
{
wine_server_add_data( req, name, len * sizeof(WCHAR) );
req->table = table;
req->table = wine_server_obj_handle( table );
status = wine_server_call( req );
*atom = reply->atom;
}
@ -272,7 +272,7 @@ NTSTATUS WINAPI RtlEmptyAtomTable( RTL_ATOM_TABLE table, BOOLEAN delete_pinned )
{
SERVER_START_REQ( empty_atom_table )
{
req->table = table;
req->table = wine_server_obj_handle( table );
req->if_pinned = delete_pinned;
status = wine_server_call( req );
}
@ -293,7 +293,7 @@ NTSTATUS WINAPI RtlPinAtomInAtomTable( RTL_ATOM_TABLE table, RTL_ATOM atom )
SERVER_START_REQ( set_atom_information )
{
req->table = table;
req->table = wine_server_obj_handle( table );
req->atom = atom;
req->pinned = TRUE;
status = wine_server_call( req );
@ -320,7 +320,7 @@ NTSTATUS WINAPI NtAddAtom( const WCHAR* name, ULONG length, RTL_ATOM* atom )
SERVER_START_REQ( add_atom )
{
wine_server_add_data( req, name, length );
req->table = NULL;
req->table = 0;
status = wine_server_call( req );
*atom = reply->atom;
}
@ -341,7 +341,7 @@ NTSTATUS WINAPI NtDeleteAtom(RTL_ATOM atom)
SERVER_START_REQ( delete_atom )
{
req->atom = atom;
req->table = NULL;
req->table = 0;
status = wine_server_call( req );
}
SERVER_END_REQ;
@ -361,7 +361,7 @@ NTSTATUS WINAPI NtFindAtom( const WCHAR* name, ULONG length, RTL_ATOM* atom )
SERVER_START_REQ( find_atom )
{
wine_server_add_data( req, name, length );
req->table = NULL;
req->table = 0;
status = wine_server_call( req );
*atom = reply->atom;
}
@ -407,7 +407,7 @@ NTSTATUS WINAPI NtQueryInformationAtom( RTL_ATOM atom, ATOM_INFORMATION_CLASS cl
SERVER_START_REQ( get_atom_information )
{
req->atom = atom;
req->table = NULL;
req->table = 0;
if (name_len) wine_server_set_reply( req, abi->Name, name_len );
status = wine_server_call( req );
if (status == STATUS_SUCCESS)

View File

@ -2311,7 +2311,7 @@ static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS st
SERVER_START_REQ( read_change )
{
req->handle = info->FileHandle;
req->handle = wine_server_obj_handle( info->FileHandle );
wine_server_set_reply( req, path, PATH_MAX );
ret = wine_server_call( req );
action = reply->action;
@ -2396,7 +2396,7 @@ NtNotifyChangeDirectoryFile( HANDLE FileHandle, HANDLE Event,
SERVER_START_REQ( read_directory_changes )
{
req->handle = FileHandle;
req->handle = wine_server_obj_handle( FileHandle );
req->filter = CompletionFilter;
req->want_data = (Buffer != NULL);
req->subtree = WatchTree;
@ -2404,7 +2404,7 @@ NtNotifyChangeDirectoryFile( HANDLE FileHandle, HANDLE Event,
req->async.iosb = IoStatusBlock;
req->async.arg = info;
req->async.apc = read_changes_user_apc;
req->async.event = Event;
req->async.event = wine_server_obj_handle( Event );
req->async.cvalue = cvalue;
status = wine_server_call( req );
}

View File

@ -153,7 +153,7 @@ void wait_suspend( CONTEXT *context )
/* store the context we got at suspend time */
SERVER_START_REQ( set_thread_context )
{
req->handle = GetCurrentThread();
req->handle = wine_server_obj_handle( GetCurrentThread() );
req->flags = CONTEXT_FULL;
req->suspend = 1;
wine_server_add_data( req, context, sizeof(*context) );
@ -168,7 +168,7 @@ void wait_suspend( CONTEXT *context )
/* retrieve the new context */
SERVER_START_REQ( get_thread_context )
{
req->handle = GetCurrentThread();
req->handle = wine_server_obj_handle( GetCurrentThread() );
req->flags = CONTEXT_FULL;
req->suspend = 1;
wine_server_set_reply( req, context, sizeof(*context) );
@ -197,7 +197,7 @@ static NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTE
req->first = first_chance;
wine_server_add_data( req, context, sizeof(*context) );
wine_server_add_data( req, rec, sizeof(*rec) );
if (!wine_server_call( req )) handle = reply->handle;
if (!wine_server_call( req )) handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
if (!handle) return 0;
@ -206,7 +206,7 @@ static NTSTATUS send_debug_event( EXCEPTION_RECORD *rec, int first_chance, CONTE
SERVER_START_REQ( get_exception_status )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
wine_server_set_reply( req, context, sizeof(*context) );
ret = wine_server_call( req );
}

View File

@ -166,12 +166,12 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
{
req->access = access;
req->attributes = attr->Attributes;
req->rootdir = attr->RootDirectory;
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
req->sharing = sharing;
req->options = options;
wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
io->u.Status = wine_server_call( req );
*handle = reply->handle;
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
if (io->u.Status == STATUS_SUCCESS) io->Information = FILE_OPENED;
@ -215,7 +215,7 @@ NTSTATUS WINAPI NtCreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATTRIB
if (objattr.sd_len) wine_server_add_data( req, sd, objattr.sd_len );
wine_server_add_data( req, unix_name.Buffer, unix_name.Length );
io->u.Status = wine_server_call( req );
*handle = reply->handle;
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
NTDLL_free_struct_sd( sd );
@ -448,7 +448,7 @@ static NTSTATUS get_io_timeouts( HANDLE handle, enum server_fd_type type, ULONG
timeouts->interval = 0; /* return as soon as we got something */
SERVER_START_REQ( set_mailslot_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = 0;
if (!(status = wine_server_call( req )) &&
reply->read_timeout != TIMEOUT_INFINITE)
@ -652,14 +652,14 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent,
SERVER_START_REQ( register_async )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
req->type = ASYNC_TYPE_READ;
req->count = length;
req->async.callback = FILE_AsyncReadService;
req->async.iosb = io_status;
req->async.arg = fileio;
req->async.apc = fileio_apc;
req->async.event = hEvent;
req->async.event = wine_server_obj_handle( hEvent );
req->async.cvalue = cvalue;
status = wine_server_call( req );
}
@ -976,14 +976,14 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent,
SERVER_START_REQ( register_async )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
req->type = ASYNC_TYPE_WRITE;
req->count = length;
req->async.callback = FILE_AsyncWriteService;
req->async.iosb = io_status;
req->async.arg = fileio;
req->async.apc = fileio_apc;
req->async.event = hEvent;
req->async.event = wine_server_obj_handle( hEvent );
req->async.cvalue = cvalue;
status = wine_server_call( req );
}
@ -1154,7 +1154,7 @@ static NTSTATUS ioctl_completion( void *arg, IO_STATUS_BLOCK *io, NTSTATUS statu
{
SERVER_START_REQ( get_ioctl_result )
{
req->handle = async->handle;
req->handle = wine_server_obj_handle( async->handle );
req->user_arg = async;
wine_server_set_reply( req, async->buffer, async->size );
if (!(status = wine_server_call( req )))
@ -1197,19 +1197,19 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
SERVER_START_REQ( ioctl )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->code = code;
req->async.callback = ioctl_completion;
req->async.iosb = io;
req->async.arg = async;
req->async.apc = (apc || event) ? ioctl_apc : NULL;
req->async.event = event;
req->async.event = wine_server_obj_handle( event );
req->async.cvalue = cvalue;
wine_server_add_data( req, in_buffer, in_size );
wine_server_set_reply( req, out_buffer, out_size );
if (!(status = wine_server_call( req )))
io->Information = wine_server_reply_size( reply );
wait_handle = reply->wait;
wait_handle = wine_server_ptr_handle( reply->wait );
options = reply->options;
}
SERVER_END_REQ;
@ -1688,7 +1688,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
SERVER_START_REQ( set_mailslot_info )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
req->flags = 0;
io->u.Status = wine_server_call( req );
if( io->u.Status == STATUS_SUCCESS )
@ -1727,7 +1727,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io,
SERVER_START_REQ( get_named_pipe_info )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
if (!(io->u.Status = wine_server_call( req )))
{
pli->NamedPipeType = (reply->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) ?
@ -1901,7 +1901,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
SERVER_START_REQ( set_mailslot_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = MAILSLOT_SET_READ_TIMEOUT;
req->read_timeout = info->ReadTimeout.QuadPart;
io->u.Status = wine_server_call( req );
@ -1917,8 +1917,8 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
SERVER_START_REQ( set_completion_info )
{
req->handle = handle;
req->chandle = info->CompletionPort;
req->handle = wine_server_obj_handle( handle );
req->chandle = wine_server_obj_handle( info->CompletionPort );
req->ckey = info->CompletionKey;
io->u.Status = wine_server_call( req );
}
@ -2384,9 +2384,9 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock
SERVER_START_REQ( flush_file )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
ret = wine_server_call( req );
hEvent = reply->event;
hEvent = wine_server_ptr_handle( reply->event );
}
SERVER_END_REQ;
if (!ret && hEvent)
@ -2429,13 +2429,13 @@ NTSTATUS WINAPI NtLockFile( HANDLE hFile, HANDLE lock_granted_event,
{
SERVER_START_REQ( lock_file )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
req->offset = offset->QuadPart;
req->count = count->QuadPart;
req->shared = !exclusive;
req->wait = !dont_wait;
ret = wine_server_call( req );
handle = reply->handle;
handle = wine_server_ptr_handle( reply->handle );
async = reply->overlapped;
}
SERVER_END_REQ;
@ -2491,7 +2491,7 @@ NTSTATUS WINAPI NtUnlockFile( HANDLE hFile, PIO_STATUS_BLOCK io_status,
SERVER_START_REQ( unlock_file )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
req->offset = offset->QuadPart;
req->count = count->QuadPart;
status = wine_server_call( req );
@ -2528,7 +2528,7 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE handle, ULONG access,
{
req->access = access;
req->attributes = attr->Attributes;
req->rootdir = attr->RootDirectory;
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
req->options = options;
req->flags =
(pipe_type) ? NAMED_PIPE_MESSAGE_STREAM_WRITE : 0 |
@ -2541,7 +2541,7 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( PHANDLE handle, ULONG access,
wine_server_add_data( req, attr->ObjectName->Buffer,
attr->ObjectName->Length );
status = wine_server_call( req );
if (!status) *handle = reply->handle;
if (!status) *handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;
@ -2580,7 +2580,7 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE hFile, PIO_STATUS_BLOCK io_status )
SERVER_START_REQ( cancel_async )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
wine_server_call( req );
}
SERVER_END_REQ;
@ -2638,14 +2638,14 @@ NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE pHandle, ULONG DesiredAccess,
{
req->access = DesiredAccess;
req->attributes = attr->Attributes;
req->rootdir = attr->RootDirectory;
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
req->max_msgsize = MaxMessageSize;
req->read_timeout = timeout.QuadPart;
wine_server_add_data( req, attr->ObjectName->Buffer,
attr->ObjectName->Length );
ret = wine_server_call( req );
if( ret == STATUS_SUCCESS )
*pHandle = reply->handle;
*pHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;

View File

@ -1467,7 +1467,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
SERVER_START_REQ( load_dll )
{
req->handle = file;
req->handle = wine_server_obj_handle( file );
req->base = module;
req->size = nt->OptionalHeader.SizeOfImage;
req->dbg_offset = nt->FileHeader.PointerToSymbolTable;

View File

@ -80,13 +80,13 @@ NTSTATUS WINAPI NtDuplicateToken(
SERVER_START_REQ( duplicate_token )
{
req->handle = ExistingToken;
req->handle = wine_server_obj_handle( ExistingToken );
req->access = DesiredAccess;
req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
req->primary = (TokenType == TokenPrimary);
req->impersonation_level = ImpersonationLevel;
status = wine_server_call( req );
if (!status) *NewToken = reply->new_handle;
if (!status) *NewToken = wine_server_ptr_handle( reply->new_handle );
}
SERVER_END_REQ;
@ -118,12 +118,12 @@ NTSTATUS WINAPI NtOpenProcessTokenEx( HANDLE process, DWORD access, DWORD attrib
SERVER_START_REQ( open_token )
{
req->handle = process;
req->handle = wine_server_obj_handle( process );
req->access = access;
req->attributes = attributes;
req->flags = 0;
ret = wine_server_call( req );
if (!ret) *handle = reply->token;
if (!ret) *handle = wine_server_ptr_handle( reply->token );
}
SERVER_END_REQ;
return ret;
@ -155,13 +155,13 @@ NTSTATUS WINAPI NtOpenThreadTokenEx( HANDLE thread, DWORD access, BOOLEAN as_sel
SERVER_START_REQ( open_token )
{
req->handle = thread;
req->handle = wine_server_obj_handle( thread );
req->access = access;
req->attributes = attributes;
req->flags = OPEN_TOKEN_THREAD;
if (as_self) req->flags |= OPEN_TOKEN_AS_SELF;
ret = wine_server_call( req );
if (!ret) *handle = reply->token;
if (!ret) *handle = wine_server_ptr_handle( reply->token );
}
SERVER_END_REQ;
@ -189,7 +189,7 @@ NTSTATUS WINAPI NtAdjustPrivilegesToken(
SERVER_START_REQ( adjust_token_privileges )
{
req->handle = TokenHandle;
req->handle = wine_server_obj_handle( TokenHandle );
req->disable_all = DisableAllPrivileges;
req->get_modified_state = (PreviousState != NULL);
if (!DisableAllPrivileges)
@ -276,7 +276,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
PSID sid = (PSID) (tuser + 1);
DWORD sid_len = tokeninfolength < sizeof(TOKEN_USER) ? 0 : tokeninfolength - sizeof(TOKEN_USER);
req->handle = token;
req->handle = wine_server_obj_handle( token );
wine_server_set_reply( req, sid, sid_len );
status = wine_server_call( req );
if (retlen) *retlen = reply->user_len + sizeof(TOKEN_USER);
@ -304,7 +304,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
{
TOKEN_GROUPS *groups = tokeninfo;
req->handle = token;
req->handle = wine_server_obj_handle( token );
wine_server_set_reply( req, buffer, server_buf_len );
status = wine_server_call( req );
if (status == STATUS_BUFFER_TOO_SMALL)
@ -369,7 +369,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
SERVER_START_REQ( get_token_privileges )
{
TOKEN_PRIVILEGES *tpriv = tokeninfo;
req->handle = token;
req->handle = wine_server_obj_handle( token );
if (tpriv && tokeninfolength > FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
wine_server_set_reply( req, tpriv->Privileges, tokeninfolength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
status = wine_server_call( req );
@ -393,7 +393,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
SERVER_START_REQ( get_token_impersonation_level )
{
SECURITY_IMPERSONATION_LEVEL *impersonation_level = tokeninfo;
req->handle = token;
req->handle = wine_server_obj_handle( token );
status = wine_server_call( req );
if (status == STATUS_SUCCESS)
*impersonation_level = reply->impersonation_level;
@ -404,7 +404,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
SERVER_START_REQ( get_token_statistics )
{
TOKEN_STATISTICS *statistics = tokeninfo;
req->handle = token;
req->handle = wine_server_obj_handle( token );
status = wine_server_call( req );
if (status == STATUS_SUCCESS)
{
@ -433,7 +433,7 @@ NTSTATUS WINAPI NtQueryInformationToken(
SERVER_START_REQ( get_token_statistics )
{
TOKEN_TYPE *token_type = tokeninfo;
req->handle = token;
req->handle = wine_server_obj_handle( token );
status = wine_server_call( req );
if (status == STATUS_SUCCESS)
*token_type = reply->primary ? TokenPrimary : TokenImpersonation;
@ -493,7 +493,7 @@ NTSTATUS WINAPI NtPrivilegeCheck(
NTSTATUS status;
SERVER_START_REQ( check_token_privileges )
{
req->handle = ClientToken;
req->handle = wine_server_obj_handle( ClientToken );
req->all_required = ((RequiredPrivileges->Control & PRIVILEGE_SET_ALL_NECESSARY) ? TRUE : FALSE);
wine_server_add_data( req, RequiredPrivileges->Privilege,
RequiredPrivileges->PrivilegeCount * sizeof(RequiredPrivileges->Privilege[0]) );
@ -788,7 +788,8 @@ NTSTATUS WINAPI NtQuerySystemInformation(
req->flags = SNAP_PROCESS | SNAP_THREAD;
req->attributes = 0;
req->pid = 0;
if (!(ret = wine_server_call( req ))) hSnap = reply->handle;
if (!(ret = wine_server_call( req )))
hSnap = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
len = 0;
@ -796,7 +797,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
{
SERVER_START_REQ( next_process )
{
req->handle = hSnap;
req->handle = wine_server_obj_handle( hSnap );
req->reset = (len == 0);
wine_server_set_reply( req, procname, sizeof(procname)-sizeof(WCHAR) );
if (!(ret = wine_server_call( req )))
@ -854,7 +855,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
{
SERVER_START_REQ( next_thread )
{
req->handle = hSnap;
req->handle = wine_server_obj_handle( hSnap );
req->reset = (j == 0);
if (!(ret = wine_server_call( req )))
{

View File

@ -76,8 +76,8 @@ extern void DECLSPEC_NORETURN server_abort_thread( int status );
extern sigset_t server_block_set;
extern void server_enter_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset );
extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sigset );
extern int server_remove_fd_from_cache( obj_handle_t handle );
extern int server_get_unix_fd( obj_handle_t handle, unsigned int access, int *unix_fd,
extern int server_remove_fd_from_cache( HANDLE handle );
extern int server_get_unix_fd( HANDLE handle, unsigned int access, int *unix_fd,
int *needs_close, enum server_fd_type *type, unsigned int *options );
/* security descriptors */

View File

@ -71,7 +71,7 @@ NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
SERVER_START_REQ( get_object_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
status = wine_server_call( req );
if (status == STATUS_SUCCESS)
{
@ -93,7 +93,7 @@ NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
SERVER_START_REQ( set_handle_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = 0;
req->mask = 0;
status = wine_server_call( req );
@ -139,7 +139,7 @@ NTSTATUS WINAPI NtSetInformationObject(IN HANDLE handle,
SERVER_START_REQ( set_handle_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = 0;
req->mask = HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE;
if (p->InheritHandle) req->flags |= HANDLE_FLAG_INHERIT;
@ -189,7 +189,7 @@ NtQuerySecurityObject(
SERVER_START_REQ( get_security_object )
{
req->handle = Object;
req->handle = wine_server_obj_handle( Object );
req->security_info = RequestedInformation;
wine_server_set_reply( req, buffer, buffer_size );
status = wine_server_call( req );
@ -256,16 +256,16 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
NTSTATUS ret;
SERVER_START_REQ( dup_handle )
{
req->src_process = source_process;
req->src_handle = source;
req->dst_process = dest_process;
req->src_process = wine_server_obj_handle( source_process );
req->src_handle = wine_server_obj_handle( source );
req->dst_process = wine_server_obj_handle( dest_process );
req->access = access;
req->attributes = attributes;
req->options = options;
if (!(ret = wine_server_call( req )))
{
if (dest) *dest = reply->handle;
if (dest) *dest = wine_server_ptr_handle( reply->handle );
if (reply->closed)
{
if (reply->self)
@ -301,7 +301,7 @@ NTSTATUS WINAPI NtClose( HANDLE Handle )
SERVER_START_REQ( close_handle )
{
req->handle = Handle;
req->handle = wine_server_obj_handle( Handle );
ret = wine_server_call( req );
}
SERVER_END_REQ;
@ -351,12 +351,12 @@ NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK Desir
{
req->access = DesiredAccess;
req->attributes = ObjectAttributes->Attributes;
req->rootdir = ObjectAttributes->RootDirectory;
req->rootdir = wine_server_obj_handle( ObjectAttributes->RootDirectory );
if (ObjectAttributes->ObjectName)
wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
ObjectAttributes->ObjectName->Length);
ret = wine_server_call( req );
*DirectoryHandle = reply->handle;
*DirectoryHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -390,12 +390,12 @@ NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK Des
{
req->access = DesiredAccess;
req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
req->rootdir = ObjectAttributes ? ObjectAttributes->RootDirectory : 0;
req->rootdir = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
if (ObjectAttributes && ObjectAttributes->ObjectName)
wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
ObjectAttributes->ObjectName->Length);
ret = wine_server_call( req );
*DirectoryHandle = reply->handle;
*DirectoryHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -434,7 +434,7 @@ NTSTATUS WINAPI NtQueryDirectoryObject(HANDLE handle, PDIRECTORY_BASIC_INFORMATI
SERVER_START_REQ( get_directory_entry )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->index = *context;
wine_server_set_reply( req, buffer + 1, size - sizeof(*buffer) - 2*sizeof(WCHAR) );
if (!(ret = wine_server_call( req )))
@ -508,12 +508,12 @@ NTSTATUS WINAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK
{
req->access = DesiredAccess;
req->attributes = ObjectAttributes->Attributes;
req->rootdir = ObjectAttributes->RootDirectory;
req->rootdir = wine_server_obj_handle( ObjectAttributes->RootDirectory );
if (ObjectAttributes->ObjectName)
wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
ObjectAttributes->ObjectName->Length);
ret = wine_server_call( req );
*LinkHandle = reply->handle;
*LinkHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -551,7 +551,7 @@ NTSTATUS WINAPI NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,IN ACC
{
req->access = DesiredAccess;
req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
req->rootdir = ObjectAttributes ? ObjectAttributes->RootDirectory : 0;
req->rootdir = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
if (ObjectAttributes && ObjectAttributes->ObjectName)
{
req->name_len = ObjectAttributes->ObjectName->Length;
@ -562,7 +562,7 @@ NTSTATUS WINAPI NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,IN ACC
req->name_len = 0;
wine_server_add_data(req, TargetName->Buffer, TargetName->Length);
ret = wine_server_call( req );
*SymbolicLinkHandle = reply->handle;
*SymbolicLinkHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -593,7 +593,7 @@ NTSTATUS WINAPI NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, IN OUT PUNICODE_
SERVER_START_REQ(query_symlink)
{
req->handle = LinkHandle;
req->handle = wine_server_obj_handle( LinkHandle );
wine_server_set_reply( req, LinkTarget->Buffer, LinkTarget->MaximumLength );
if (!(ret = wine_server_call( req )))
{

View File

@ -52,7 +52,7 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
BOOL self;
SERVER_START_REQ( terminate_process )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->exit_code = exit_code;
ret = wine_server_call( req );
self = !ret && reply->self;
@ -82,7 +82,7 @@ HANDLE __wine_make_process_system(void)
HANDLE ret = 0;
SERVER_START_REQ( make_process_system )
{
if (!wine_server_call( req )) ret = reply->event;
if (!wine_server_call( req )) ret = wine_server_ptr_handle( reply->event );
}
SERVER_END_REQ;
return ret;
@ -158,7 +158,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
{
SERVER_START_REQ(get_process_info)
{
req->handle = ProcessHandle;
req->handle = wine_server_obj_handle( ProcessHandle );
if ((ret = wine_server_call( req )) == STATUS_SUCCESS)
{
pbi.ExitStatus = reply->exit_code;
@ -251,7 +251,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
SERVER_START_REQ(get_process_info)
{
req->handle = ProcessHandle;
req->handle = wine_server_obj_handle( ProcessHandle );
if ((ret = wine_server_call( req )) == STATUS_SUCCESS)
{
pti.CreateTime.QuadPart = reply->start_time;
@ -314,7 +314,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
{
UNICODE_STRING *image_file_name_str = ProcessInformation;
req->handle = ProcessHandle;
req->handle = wine_server_obj_handle( ProcessHandle );
req->base_address = NULL; /* main module */
wine_server_set_reply( req, image_file_name_str ? image_file_name_str + 1 : NULL,
ProcessInformationLength > sizeof(UNICODE_STRING) ? ProcessInformationLength - sizeof(UNICODE_STRING) : 0 );
@ -364,7 +364,7 @@ NTSTATUS WINAPI NtSetInformationProcess(
return STATUS_INVALID_PARAMETER;
SERVER_START_REQ( set_process_info )
{
req->handle = ProcessHandle;
req->handle = wine_server_obj_handle( ProcessHandle );
req->affinity = *(PDWORD_PTR)ProcessInformation;
req->mask = SET_PROCESS_INFO_AFFINITY;
ret = wine_server_call( req );
@ -380,7 +380,7 @@ NTSTATUS WINAPI NtSetInformationProcess(
SERVER_START_REQ( set_process_info )
{
req->handle = ProcessHandle;
req->handle = wine_server_obj_handle( ProcessHandle );
/* FIXME Foreground isn't used */
req->priority = ppc->PriorityClass;
req->mask = SET_PROCESS_INFO_PRIORITY;
@ -453,7 +453,7 @@ NTSTATUS WINAPI NtOpenProcess(PHANDLE handle, ACCESS_MASK access,
req->access = access;
req->attributes = attr ? attr->Attributes : 0;
status = wine_server_call( req );
if (!status) *handle = reply->handle;
if (!status) *handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;

View File

@ -64,7 +64,7 @@ NTSTATUS WINAPI NtCreateKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_AT
SERVER_START_REQ( create_key )
{
req->parent = attr->RootDirectory;
req->parent = wine_server_obj_handle( attr->RootDirectory );
req->access = access;
req->attributes = attr->Attributes;
req->options = options;
@ -73,7 +73,7 @@ NTSTATUS WINAPI NtCreateKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_AT
if (class) wine_server_add_data( req, class->Buffer, class->Length );
if (!(ret = wine_server_call( req )))
{
*retkey = reply->hkey;
*retkey = wine_server_ptr_handle( reply->hkey );
if (dispos) *dispos = reply->created ? REG_CREATED_NEW_KEY : REG_OPENED_EXISTING_KEY;
}
}
@ -124,12 +124,12 @@ NTSTATUS WINAPI NtOpenKey( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTR
SERVER_START_REQ( open_key )
{
req->parent = attr->RootDirectory;
req->parent = wine_server_obj_handle( attr->RootDirectory );
req->access = access;
req->attributes = attr->Attributes;
wine_server_add_data( req, attr->ObjectName->Buffer, len );
ret = wine_server_call( req );
*retkey = reply->hkey;
*retkey = wine_server_ptr_handle( reply->hkey );
}
SERVER_END_REQ;
TRACE("<- %p\n", *retkey);
@ -160,7 +160,7 @@ NTSTATUS WINAPI NtDeleteKey( HANDLE hkey )
SERVER_START_REQ( delete_key )
{
req->hkey = hkey;
req->hkey = wine_server_obj_handle( hkey );
ret = wine_server_call( req );
}
SERVER_END_REQ;
@ -190,7 +190,7 @@ NTSTATUS WINAPI NtDeleteValueKey( HANDLE hkey, const UNICODE_STRING *name )
SERVER_START_REQ( delete_key_value )
{
req->hkey = hkey;
req->hkey = wine_server_obj_handle( hkey );
wine_server_add_data( req, name->Buffer, name->Length );
ret = wine_server_call( req );
}
@ -225,7 +225,7 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i
SERVER_START_REQ( enum_key )
{
req->hkey = handle;
req->hkey = wine_server_obj_handle( handle );
req->index = index;
req->info_class = info_class;
if (length > fixed_size) wine_server_set_reply( req, data_ptr, length - fixed_size );
@ -436,7 +436,7 @@ NTSTATUS WINAPI NtEnumerateValueKey( HANDLE handle, ULONG index,
SERVER_START_REQ( enum_key_value )
{
req->hkey = handle;
req->hkey = wine_server_obj_handle( handle );
req->index = index;
req->info_class = info_class;
if (length > fixed_size) wine_server_set_reply( req, ptr, length - fixed_size );
@ -510,7 +510,7 @@ NTSTATUS WINAPI NtQueryValueKey( HANDLE handle, const UNICODE_STRING *name,
SERVER_START_REQ( get_key_value )
{
req->hkey = handle;
req->hkey = wine_server_obj_handle( handle );
wine_server_add_data( req, name->Buffer, name->Length );
if (length > fixed_size && data_ptr) wine_server_set_reply( req, data_ptr, length - fixed_size );
if (!(ret = wine_server_call( req )))
@ -573,7 +573,7 @@ NTSTATUS WINAPI NtFlushKey(HANDLE key)
SERVER_START_REQ( flush_key )
{
req->hkey = key;
req->hkey = wine_server_obj_handle( key );
ret = wine_server_call( req );
}
SERVER_END_REQ;
@ -599,8 +599,8 @@ NTSTATUS WINAPI NtLoadKey( const OBJECT_ATTRIBUTES *attr, OBJECT_ATTRIBUTES *fil
SERVER_START_REQ( load_registry )
{
req->hkey = attr->RootDirectory;
req->file = hive;
req->hkey = wine_server_obj_handle( attr->RootDirectory );
req->file = wine_server_obj_handle( hive );
wine_server_add_data(req, attr->ObjectName->Buffer, attr->ObjectName->Length);
ret = wine_server_call( req );
}
@ -647,8 +647,8 @@ NTSTATUS WINAPI NtNotifyChangeKey(
SERVER_START_REQ( set_registry_notification )
{
req->hkey = KeyHandle;
req->event = Event;
req->hkey = wine_server_obj_handle( KeyHandle );
req->event = wine_server_obj_handle( Event );
req->subtree = WatchSubtree;
req->filter = CompletionFilter;
ret = wine_server_call( req );
@ -723,8 +723,8 @@ NTSTATUS WINAPI NtSaveKey(IN HANDLE KeyHandle, IN HANDLE FileHandle)
SERVER_START_REQ( save_registry )
{
req->hkey = KeyHandle;
req->file = FileHandle;
req->hkey = wine_server_obj_handle( KeyHandle );
req->file = wine_server_obj_handle( FileHandle );
ret = wine_server_call( req );
}
SERVER_END_REQ;
@ -766,7 +766,7 @@ NTSTATUS WINAPI NtSetValueKey( HANDLE hkey, const UNICODE_STRING *name, ULONG Ti
SERVER_START_REQ( set_key_value )
{
req->hkey = hkey;
req->hkey = wine_server_obj_handle( hkey );
req->type = type;
req->namelen = name->Length;
wine_server_add_data( req, name->Buffer, name->Length );
@ -802,7 +802,7 @@ NTSTATUS WINAPI NtUnloadKey(IN POBJECT_ATTRIBUTES attr)
SERVER_START_REQ( unload_registry )
{
req->hkey = attr->RootDirectory;
req->hkey = wine_server_obj_handle( attr->RootDirectory );
ret = wine_server_call(req);
}
SERVER_END_REQ;

View File

@ -1568,7 +1568,7 @@ NtAccessCheck(
DWORD revision;
SECURITY_DESCRIPTOR_CONTROL control;
req->handle = ClientToken;
req->handle = wine_server_obj_handle( ClientToken );
req->desired_access = DesiredAccess;
req->mapping_read = GenericMapping->GenericRead;
req->mapping_write = GenericMapping->GenericWrite;
@ -1681,7 +1681,7 @@ NTSTATUS WINAPI NtSetSecurityObject(HANDLE Handle,
SERVER_START_REQ( set_security_object )
{
req->handle = Handle;
req->handle = wine_server_obj_handle( Handle );
req->security_info = SecurityInformation;
wine_server_add_data( req, &sd, sizeof(sd) );

View File

@ -374,7 +374,7 @@ static NTSTATUS get_timeouts(HANDLE handle, SERIAL_TIMEOUTS* st)
NTSTATUS status;
SERVER_START_REQ( get_serial_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
if (!(status = wine_server_call( req )))
{
st->ReadIntervalTimeout = reply->readinterval;
@ -394,7 +394,7 @@ static NTSTATUS get_wait_mask(HANDLE hDevice, DWORD* mask)
SERVER_START_REQ( get_serial_info )
{
req->handle = hDevice;
req->handle = wine_server_obj_handle( hDevice );
if (!(status = wine_server_call( req )))
*mask = reply->eventmask;
}
@ -772,7 +772,7 @@ static NTSTATUS set_timeouts(HANDLE handle, const SERIAL_TIMEOUTS* st)
SERVER_START_REQ( set_serial_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = SERIALINFO_SET_TIMEOUTS;
req->readinterval = st->ReadIntervalTimeout ;
req->readmult = st->ReadTotalTimeoutMultiplier ;
@ -791,7 +791,7 @@ static NTSTATUS set_wait_mask(HANDLE hDevice, DWORD mask)
SERVER_START_REQ( set_serial_info )
{
req->handle = hDevice;
req->handle = wine_server_obj_handle( hDevice );
req->flags = SERIALINFO_SET_MASK;
req->eventmask = mask;
status = wine_server_call( req );

View File

@ -476,9 +476,9 @@ struct fd_cache_entry
static struct fd_cache_entry *fd_cache[FD_CACHE_ENTRIES];
static struct fd_cache_entry fd_cache_initial_block[FD_CACHE_BLOCK_SIZE];
static inline unsigned int handle_to_index( obj_handle_t handle, unsigned int *entry )
static inline unsigned int handle_to_index( HANDLE handle, unsigned int *entry )
{
unsigned long idx = ((unsigned long)handle >> 2) - 1;
unsigned int idx = (wine_server_obj_handle(handle) >> 2) - 1;
*entry = idx / FD_CACHE_BLOCK_SIZE;
return idx % FD_CACHE_BLOCK_SIZE;
}
@ -489,7 +489,7 @@ static inline unsigned int handle_to_index( obj_handle_t handle, unsigned int *e
*
* Caller must hold fd_cache_section.
*/
static int add_fd_to_cache( obj_handle_t handle, int fd, enum server_fd_type type,
static int add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
unsigned int access, unsigned int options )
{
unsigned int entry, idx = handle_to_index( handle, &entry );
@ -527,7 +527,7 @@ static int add_fd_to_cache( obj_handle_t handle, int fd, enum server_fd_type typ
*
* Caller must hold fd_cache_section.
*/
static inline int get_cached_fd( obj_handle_t handle, enum server_fd_type *type,
static inline int get_cached_fd( HANDLE handle, enum server_fd_type *type,
unsigned int *access, unsigned int *options )
{
unsigned int entry, idx = handle_to_index( handle, &entry );
@ -547,7 +547,7 @@ static inline int get_cached_fd( obj_handle_t handle, enum server_fd_type *type,
/***********************************************************************
* server_remove_fd_from_cache
*/
int server_remove_fd_from_cache( obj_handle_t handle )
int server_remove_fd_from_cache( HANDLE handle )
{
unsigned int entry, idx = handle_to_index( handle, &entry );
int fd = -1;
@ -564,7 +564,7 @@ int server_remove_fd_from_cache( obj_handle_t handle )
*
* The returned unix_fd should be closed iff needs_close is non-zero.
*/
int server_get_unix_fd( obj_handle_t handle, unsigned int wanted_access, int *unix_fd,
int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
int *needs_close, enum server_fd_type *type, unsigned int *options )
{
sigset_t sigset;
@ -583,7 +583,7 @@ int server_get_unix_fd( obj_handle_t handle, unsigned int wanted_access, int *un
SERVER_START_REQ( get_handle_fd )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
if (!(ret = wine_server_call( req )))
{
if (type) *type = reply->type;
@ -591,7 +591,7 @@ int server_get_unix_fd( obj_handle_t handle, unsigned int wanted_access, int *un
access = reply->access;
if ((fd = receive_fd( &fd_handle )) != -1)
{
assert( fd_handle == handle );
assert( wine_server_ptr_handle(fd_handle) == handle );
*needs_close = (reply->removable ||
!add_fd_to_cache( handle, fd, reply->type,
reply->access, reply->options ));
@ -627,7 +627,7 @@ done:
* RETURNS
* NTSTATUS code
*/
int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, obj_handle_t *handle )
int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle )
{
int ret;
@ -639,7 +639,7 @@ int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attribut
req->access = access;
req->attributes = attributes;
req->fd = fd;
if (!(ret = wine_server_call( req ))) *handle = reply->handle;
if (!(ret = wine_server_call( req ))) *handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -660,7 +660,7 @@ int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attribut
* RETURNS
* NTSTATUS code
*/
int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd,
int wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd,
unsigned int *options )
{
int needs_close, ret = server_get_unix_fd( handle, access, unix_fd, &needs_close, NULL, options );
@ -685,7 +685,7 @@ int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *uni
* RETURNS
* nothing
*/
void wine_server_release_fd( obj_handle_t handle, int unix_fd )
void wine_server_release_fd( HANDLE handle, int unix_fd )
{
close( unix_fd );
}

View File

@ -152,7 +152,7 @@ NTSTATUS WINAPI NtCreateSemaphore( OUT PHANDLE SemaphoreHandle,
return STATUS_INVALID_PARAMETER;
if (len >= MAX_PATH * sizeof(WCHAR)) return STATUS_NAME_TOO_LONG;
objattr.rootdir = attr ? attr->RootDirectory : 0;
objattr.rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
objattr.sd_len = 0;
objattr.name_len = len;
if (attr)
@ -171,7 +171,7 @@ NTSTATUS WINAPI NtCreateSemaphore( OUT PHANDLE SemaphoreHandle,
if (objattr.sd_len) wine_server_add_data( req, sd, objattr.sd_len );
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
ret = wine_server_call( req );
*SemaphoreHandle = reply->handle;
*SemaphoreHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
@ -196,10 +196,10 @@ NTSTATUS WINAPI NtOpenSemaphore( OUT PHANDLE SemaphoreHandle,
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = attr ? attr->RootDirectory : 0;
req->rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
ret = wine_server_call( req );
*SemaphoreHandle = reply->handle;
*SemaphoreHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -228,7 +228,7 @@ NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, PULONG previous
NTSTATUS ret;
SERVER_START_REQ( release_semaphore )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->count = count;
if (!(ret = wine_server_call( req )))
{
@ -261,7 +261,7 @@ NTSTATUS WINAPI NtCreateEvent(
if (len >= MAX_PATH * sizeof(WCHAR)) return STATUS_NAME_TOO_LONG;
objattr.rootdir = attr ? attr->RootDirectory : 0;
objattr.rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
objattr.sd_len = 0;
objattr.name_len = len;
if (attr)
@ -280,7 +280,7 @@ NTSTATUS WINAPI NtCreateEvent(
if (objattr.sd_len) wine_server_add_data( req, sd, objattr.sd_len );
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
ret = wine_server_call( req );
*EventHandle = reply->handle;
*EventHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
@ -307,10 +307,10 @@ NTSTATUS WINAPI NtOpenEvent(
{
req->access = DesiredAccess;
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = attr ? attr->RootDirectory : 0;
req->rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
ret = wine_server_call( req );
*EventHandle = reply->handle;
*EventHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -329,7 +329,7 @@ NTSTATUS WINAPI NtSetEvent( HANDLE handle, PULONG NumberOfThreadsReleased )
SERVER_START_REQ( event_op )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->op = SET_EVENT;
ret = wine_server_call( req );
}
@ -349,7 +349,7 @@ NTSTATUS WINAPI NtResetEvent( HANDLE handle, PULONG NumberOfThreadsReleased )
SERVER_START_REQ( event_op )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->op = RESET_EVENT;
ret = wine_server_call( req );
}
@ -383,7 +383,7 @@ NTSTATUS WINAPI NtPulseEvent( HANDLE handle, PULONG PulseCount )
SERVER_START_REQ( event_op )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->op = PULSE_EVENT;
ret = wine_server_call( req );
}
@ -425,7 +425,7 @@ NTSTATUS WINAPI NtCreateMutant(OUT HANDLE* MutantHandle,
if (len >= MAX_PATH * sizeof(WCHAR)) return STATUS_NAME_TOO_LONG;
objattr.rootdir = attr ? attr->RootDirectory : 0;
objattr.rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
objattr.sd_len = 0;
objattr.name_len = len;
if (attr)
@ -443,7 +443,7 @@ NTSTATUS WINAPI NtCreateMutant(OUT HANDLE* MutantHandle,
if (objattr.sd_len) wine_server_add_data( req, sd, objattr.sd_len );
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
status = wine_server_call( req );
*MutantHandle = reply->handle;
*MutantHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
@ -469,10 +469,10 @@ NTSTATUS WINAPI NtOpenMutant(OUT HANDLE* MutantHandle,
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = attr ? attr->RootDirectory : 0;
req->rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
status = wine_server_call( req );
*MutantHandle = reply->handle;
*MutantHandle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;
@ -488,7 +488,7 @@ NTSTATUS WINAPI NtReleaseMutant( IN HANDLE handle, OUT PLONG prev_count OPTIONAL
SERVER_START_REQ( release_mutex )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
status = wine_server_call( req );
if (prev_count) *prev_count = reply->prev_count;
}
@ -612,11 +612,11 @@ NTSTATUS WINAPI NtCreateTimer(OUT HANDLE *handle,
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = attr ? attr->RootDirectory : 0;
req->rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
req->manual = (timer_type == NotificationTimer) ? TRUE : FALSE;
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
status = wine_server_call( req );
*handle = reply->handle;
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;
@ -640,10 +640,10 @@ NTSTATUS WINAPI NtOpenTimer(OUT PHANDLE handle,
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
req->rootdir = attr ? attr->RootDirectory : 0;
req->rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
status = wine_server_call( req );
*handle = reply->handle;
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;
@ -668,7 +668,7 @@ NTSTATUS WINAPI NtSetTimer(IN HANDLE handle,
SERVER_START_REQ( set_timer )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->period = period;
req->expire = when->QuadPart;
req->callback = callback;
@ -693,7 +693,7 @@ NTSTATUS WINAPI NtCancelTimer(IN HANDLE handle, OUT BOOLEAN* state)
SERVER_START_REQ( cancel_timer )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
status = wine_server_call( req );
if (state) *state = reply->signaled;
}
@ -743,7 +743,7 @@ NTSTATUS WINAPI NtQueryTimer(
SERVER_START_REQ(get_timer_info)
{
req->handle = TimerHandle;
req->handle = wine_server_obj_handle( TimerHandle );
status = wine_server_call(req);
/* convert server time to absolute NTDLL time */
@ -946,11 +946,12 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
result->map_view.addr = call->map_view.addr;
result->map_view.size = call->map_view.size;
offset.QuadPart = call->map_view.offset;
result->map_view.status = NtMapViewOfSection( call->map_view.handle, NtCurrentProcess(),
&result->map_view.addr, call->map_view.zero_bits,
0, &offset, &result->map_view.size, ViewShare,
result->map_view.status = NtMapViewOfSection( wine_server_ptr_handle(call->map_view.handle),
NtCurrentProcess(), &result->map_view.addr,
call->map_view.zero_bits, 0, &offset,
&result->map_view.size, ViewShare,
call->map_view.alloc_type, call->map_view.prot );
NtClose( call->map_view.handle );
NtClose( wine_server_ptr_handle(call->map_view.handle) );
break;
}
case APC_UNMAP_VIEW:
@ -960,6 +961,7 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
case APC_CREATE_THREAD:
{
CLIENT_ID id;
HANDLE handle;
result->type = call->type;
result->create_thread.status = RtlCreateUserThread( NtCurrentProcess(), NULL,
call->create_thread.suspend, NULL,
@ -967,7 +969,8 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
call->create_thread.commit,
call->create_thread.func,
call->create_thread.arg,
&result->create_thread.handle, &id );
&handle, &id );
result->create_thread.handle = wine_server_obj_handle( handle );
result->create_thread.tid = HandleToULong(id.UniqueThread);
break;
}
@ -991,11 +994,11 @@ NTSTATUS NTDLL_queue_process_apc( HANDLE process, const apc_call_t *call, apc_re
SERVER_START_REQ( queue_apc )
{
req->process = process;
req->process = wine_server_obj_handle( process );
req->call = *call;
if (!(ret = wine_server_call( req )))
{
handle = reply->handle;
handle = wine_server_ptr_handle( reply->handle );
self = reply->self;
}
}
@ -1012,7 +1015,7 @@ NTSTATUS NTDLL_queue_process_apc( HANDLE process, const apc_call_t *call, apc_re
SERVER_START_REQ( get_apc_result )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
if (!(ret = wine_server_call( req ))) *result = reply->result;
}
SERVER_END_REQ;
@ -1049,7 +1052,7 @@ NTSTATUS NTDLL_wait_for_multiple_objects( UINT count, const HANDLE *handles, UIN
{
req->flags = flags;
req->cookie = &cookie;
req->signal = signal_object;
req->signal = wine_server_obj_handle( signal_object );
req->prev_apc = apc_handle;
req->timeout = abs_timeout;
wine_server_add_data( req, &result, sizeof(result) );
@ -1210,13 +1213,13 @@ NTSTATUS WINAPI NtCreateIoCompletion( PHANDLE CompletionPort, ACCESS_MASK Desire
{
req->access = DesiredAccess;
req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
req->rootdir = ObjectAttributes ? ObjectAttributes->RootDirectory : NULL;
req->rootdir = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
req->concurrent = NumberOfConcurrentThreads;
if (ObjectAttributes && ObjectAttributes->ObjectName)
wine_server_add_data( req, ObjectAttributes->ObjectName->Buffer,
ObjectAttributes->ObjectName->Length );
if (!(status = wine_server_call( req )))
*CompletionPort = reply->handle;
*CompletionPort = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;
@ -1246,7 +1249,7 @@ NTSTATUS WINAPI NtSetIoCompletion( HANDLE CompletionPort, ULONG_PTR CompletionKe
SERVER_START_REQ( add_completion )
{
req->handle = CompletionPort;
req->handle = wine_server_obj_handle( CompletionPort );
req->ckey = CompletionKey;
req->cvalue = CompletionValue;
req->status = Status;
@ -1284,7 +1287,7 @@ NTSTATUS WINAPI NtRemoveIoCompletion( HANDLE CompletionPort, PULONG_PTR Completi
{
SERVER_START_REQ( remove_completion )
{
req->handle = CompletionPort;
req->handle = wine_server_obj_handle( CompletionPort );
if (!(status = wine_server_call( req )))
{
*CompletionKey = reply->ckey;
@ -1327,11 +1330,11 @@ NTSTATUS WINAPI NtOpenIoCompletion( PHANDLE CompletionPort, ACCESS_MASK DesiredA
SERVER_START_REQ( open_completion )
{
req->access = DesiredAccess;
req->rootdir = ObjectAttributes->RootDirectory;
req->rootdir = wine_server_obj_handle( ObjectAttributes->RootDirectory );
wine_server_add_data( req, ObjectAttributes->ObjectName->Buffer,
ObjectAttributes->ObjectName->Length );
if (!(status = wine_server_call( req )))
*CompletionPort = reply->handle;
*CompletionPort = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;
@ -1373,7 +1376,7 @@ NTSTATUS WINAPI NtQueryIoCompletion( HANDLE CompletionPort, IO_COMPLETION_INFORM
{
SERVER_START_REQ( query_completion )
{
req->handle = CompletionPort;
req->handle = wine_server_obj_handle( CompletionPort );
if (!(status = wine_server_call( req )))
*info = reply->depth;
}
@ -1394,7 +1397,7 @@ NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue, NTSTATUS
SERVER_START_REQ( add_fd_completion )
{
req->handle = hFile;
req->handle = wine_server_obj_handle( hFile );
req->cvalue = CompletionValue;
req->status = CompletionStatus;
req->information = Information;

View File

@ -180,10 +180,10 @@ static NTSTATUS init_user_process_params( SIZE_T info_size, HANDLE *exe_file )
if (!(status = wine_server_call( req )))
{
info_size = wine_server_reply_size( reply );
*exe_file = reply->exe_file;
params->hStdInput = reply->hstdin;
params->hStdOutput = reply->hstdout;
params->hStdError = reply->hstderr;
*exe_file = wine_server_ptr_handle( reply->exe_file );
params->hStdInput = wine_server_ptr_handle( reply->hstdin );
params->hStdOutput = wine_server_ptr_handle( reply->hstdout );
params->hStdError = wine_server_ptr_handle( reply->hstderr );
}
}
SERVER_END_REQ;
@ -386,7 +386,7 @@ static void DECLSPEC_NORETURN call_thread_func( PRTL_THREAD_START_ROUTINE rtl_fu
/* send the exit code to the server */
SERVER_START_REQ( terminate_thread )
{
req->handle = GetCurrentThread();
req->handle = wine_server_obj_handle( GetCurrentThread() );
req->exit_code = exit_code;
wine_server_call( req );
last = reply->last;
@ -494,8 +494,8 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
if (result.create_thread.status == STATUS_SUCCESS)
{
if (id) id->UniqueThread = ULongToHandle(result.create_thread.tid);
if (handle_ptr) *handle_ptr = result.create_thread.handle;
else NtClose( result.create_thread.handle );
if (handle_ptr) *handle_ptr = wine_server_ptr_handle( result.create_thread.handle );
else NtClose( wine_server_ptr_handle( result.create_thread.handle ));
}
return result.create_thread.status;
}
@ -512,7 +512,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
req->request_fd = request_pipe[0];
if (!(status = wine_server_call( req )))
{
handle = reply->handle;
handle = wine_server_ptr_handle( reply->handle );
tid = reply->tid;
}
close( request_pipe[0] );
@ -610,7 +610,7 @@ void WINAPI RtlExitUserThread( ULONG status )
SERVER_START_REQ( terminate_thread )
{
/* send the exit code to the server */
req->handle = GetCurrentThread();
req->handle = wine_server_obj_handle( GetCurrentThread() );
req->exit_code = status;
wine_server_call( req );
last = reply->last;
@ -645,7 +645,7 @@ NTSTATUS WINAPI NtOpenThread( HANDLE *handle, ACCESS_MASK access,
req->access = access;
req->attributes = attr ? attr->Attributes : 0;
ret = wine_server_call( req );
*handle = reply->handle;
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -662,7 +662,7 @@ NTSTATUS WINAPI NtSuspendThread( HANDLE handle, PULONG count )
SERVER_START_REQ( suspend_thread )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
if (!(ret = wine_server_call( req ))) *count = reply->count;
}
SERVER_END_REQ;
@ -680,7 +680,7 @@ NTSTATUS WINAPI NtResumeThread( HANDLE handle, PULONG count )
SERVER_START_REQ( resume_thread )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
if (!(ret = wine_server_call( req ))) *count = reply->count;
}
SERVER_END_REQ;
@ -721,7 +721,7 @@ NTSTATUS WINAPI NtTerminateThread( HANDLE handle, LONG exit_code )
SERVER_START_REQ( terminate_thread )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->exit_code = exit_code;
ret = wine_server_call( req );
self = !ret && reply->self;
@ -747,7 +747,7 @@ NTSTATUS WINAPI NtQueueApcThread( HANDLE handle, PNTAPCFUNC func, ULONG_PTR arg1
NTSTATUS ret;
SERVER_START_REQ( queue_apc )
{
req->thread = handle;
req->thread = wine_server_obj_handle( handle );
if (func)
{
req->call.type = APC_USER;
@ -790,7 +790,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
{
SERVER_START_REQ( set_thread_context )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = context->ContextFlags;
req->suspend = 0;
wine_server_add_data( req, context, sizeof(*context) );
@ -807,7 +807,7 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
{
SERVER_START_REQ( set_thread_context )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = context->ContextFlags;
req->suspend = 0;
wine_server_add_data( req, context, sizeof(*context) );
@ -1089,7 +1089,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
{
SERVER_START_REQ( get_thread_context )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = context->ContextFlags;
req->suspend = 0;
wine_server_set_reply( req, &ctx, sizeof(ctx) );
@ -1106,7 +1106,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
{
SERVER_START_REQ( get_thread_context )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = context->ContextFlags;
req->suspend = 0;
wine_server_set_reply( req, &ctx, sizeof(ctx) );
@ -1173,7 +1173,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
SERVER_START_REQ( get_thread_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->tid_in = 0;
if (!(status = wine_server_call( req )))
{
@ -1201,7 +1201,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
/* This works on any thread */
SERVER_START_REQ( get_thread_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->tid_in = 0;
status = wine_server_call( req );
if (status == STATUS_SUCCESS)
@ -1281,7 +1281,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
{
SERVER_START_REQ( get_selector_entry )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->entry = tdi->Selector >> 3;
status = wine_server_call( req );
if (!status)
@ -1310,7 +1310,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
{
SERVER_START_REQ(get_thread_info)
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->tid_in = 0;
status = wine_server_call( req );
if (status == STATUS_SUCCESS)
@ -1396,8 +1396,8 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
TRACE("Setting ThreadImpersonationToken handle to %p\n", *phToken );
SERVER_START_REQ( set_thread_info )
{
req->handle = handle;
req->token = *phToken;
req->handle = wine_server_obj_handle( handle );
req->token = wine_server_obj_handle( *phToken );
req->mask = SET_THREAD_INFO_TOKEN;
status = wine_server_call( req );
}
@ -1410,7 +1410,7 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
if (length != sizeof(DWORD)) return STATUS_INVALID_PARAMETER;
SERVER_START_REQ( set_thread_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->priority = *pprio;
req->mask = SET_THREAD_INFO_PRIORITY;
status = wine_server_call( req );
@ -1426,7 +1426,7 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
if (*paff & ~affinity_mask) return STATUS_INVALID_PARAMETER;
SERVER_START_REQ( set_thread_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->affinity = *paff;
req->mask = SET_THREAD_INFO_AFFINITY;
status = wine_server_call( req );

View File

@ -875,7 +875,7 @@ static SIZE_T get_committed_size( struct file_view *view, void *base, BYTE *vpro
SIZE_T ret = 0;
SERVER_START_REQ( get_mapping_committed_range )
{
req->handle = view->mapping;
req->handle = wine_server_obj_handle( view->mapping );
req->offset = start << page_shift;
if (!wine_server_call( req ))
{
@ -1696,7 +1696,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_
{
SERVER_START_REQ( add_mapping_committed_range )
{
req->handle = view->mapping;
req->handle = wine_server_obj_handle( view->mapping );
req->offset = (char *)base - (char *)view->base;
req->size = size;
wine_server_call( req );
@ -2135,7 +2135,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC
if (len > MAX_PATH*sizeof(WCHAR)) return STATUS_NAME_TOO_LONG;
objattr.rootdir = attr ? attr->RootDirectory : 0;
objattr.rootdir = wine_server_obj_handle( attr ? attr->RootDirectory : 0 );
objattr.sd_len = 0;
objattr.name_len = len;
if (attr)
@ -2155,14 +2155,14 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC
{
req->access = access;
req->attributes = (attr) ? attr->Attributes : 0;
req->file_handle = file;
req->file_handle = wine_server_obj_handle( file );
req->size = size ? size->QuadPart : 0;
req->protect = vprot;
wine_server_add_data( req, &objattr, sizeof(objattr) );
if (objattr.sd_len) wine_server_add_data( req, sd, objattr.sd_len );
if (len) wine_server_add_data( req, attr->ObjectName->Buffer, len );
ret = wine_server_call( req );
*handle = reply->handle;
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
@ -2187,9 +2187,9 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *handle, ACCESS_MASK access, const OBJECT_
{
req->access = access;
req->attributes = attr->Attributes;
req->rootdir = attr->RootDirectory;
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
wine_server_add_data( req, attr->ObjectName->Buffer, len );
if (!(ret = wine_server_call( req ))) *handle = reply->handle;
if (!(ret = wine_server_call( req ))) *handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -2236,7 +2236,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
memset( &call, 0, sizeof(call) );
call.map_view.type = APC_MAP_VIEW;
call.map_view.handle = handle;
call.map_view.handle = wine_server_obj_handle( handle );
call.map_view.addr = *addr_ptr;
call.map_view.size = *size_ptr;
call.map_view.offset = offset.QuadPart;
@ -2276,15 +2276,15 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
SERVER_START_REQ( get_mapping_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->access = access;
res = wine_server_call( req );
map_vprot = reply->protect;
base = reply->base;
full_size = reply->size;
header_size = reply->header_size;
dup_mapping = reply->mapping;
shared_file = reply->shared_file;
dup_mapping = wine_server_ptr_handle( reply->mapping );
shared_file = wine_server_ptr_handle( reply->shared_file );
}
SERVER_END_REQ;
if (res) return res;
@ -2538,7 +2538,7 @@ NTSTATUS WINAPI NtReadVirtualMemory( HANDLE process, const void *addr, void *buf
SERVER_START_REQ( read_process_memory )
{
req->handle = process;
req->handle = wine_server_obj_handle( process );
req->addr = (void *)addr;
wine_server_set_reply( req, buffer, size );
if ((status = wine_server_call( req ))) size = 0;
@ -2560,7 +2560,7 @@ NTSTATUS WINAPI NtWriteVirtualMemory( HANDLE process, void *addr, const void *bu
SERVER_START_REQ( write_process_memory )
{
req->handle = process;
req->handle = wine_server_obj_handle( process );
req->addr = addr;
wine_server_add_data( req, buffer, size );
if ((status = wine_server_call( req ))) size = 0;

View File

@ -96,7 +96,7 @@ static HANDLE get_device_manager(void)
{
req->access = SYNCHRONIZE;
req->attributes = 0;
if (!wine_server_call( req )) handle = reply->handle;
if (!wine_server_call( req )) handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
@ -194,7 +194,7 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff,
NTSTATUS wine_ntoskrnl_main_loop( HANDLE stop_event )
{
HANDLE manager = get_device_manager();
HANDLE ioctl = 0;
obj_handle_t ioctl = 0;
NTSTATUS status = STATUS_SUCCESS;
ULONG code = 0;
void *in_buff, *out_buff = NULL;
@ -215,7 +215,7 @@ NTSTATUS wine_ntoskrnl_main_loop( HANDLE stop_event )
{
SERVER_START_REQ( get_next_device_request )
{
req->manager = manager;
req->manager = wine_server_obj_handle( manager );
req->prev = ioctl;
req->status = status;
wine_server_add_data( req, out_buff, out_size );
@ -464,10 +464,10 @@ NTSTATUS WINAPI IoCreateDevice( DRIVER_OBJECT *driver, ULONG ext_size,
req->access = 0;
req->attributes = 0;
req->rootdir = 0;
req->manager = manager;
req->manager = wine_server_obj_handle( manager );
req->user_ptr = device;
if (name) wine_server_add_data( req, name->Buffer, name->Length );
if (!(status = wine_server_call( req ))) handle = reply->handle;
if (!(status = wine_server_call( req ))) handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
@ -501,7 +501,7 @@ void WINAPI IoDeleteDevice( DEVICE_OBJECT *device )
SERVER_START_REQ( delete_device )
{
req->handle = device->Reserved;
req->handle = wine_server_obj_handle( device->Reserved );
status = wine_server_call( req );
}
SERVER_END_REQ;
@ -558,7 +558,7 @@ NTSTATUS WINAPI IoDeleteSymbolicLink( UNICODE_STRING *name )
{
SERVER_START_REQ( unlink_object )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
status = wine_server_call( req );
}
SERVER_END_REQ;

View File

@ -2232,7 +2232,7 @@ static HANDLE get_server_queue_handle(void)
SERVER_START_REQ( get_msg_queue )
{
wine_server_call( req );
ret = reply->handle;
ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
thread_info->server_queue = ret;
@ -3273,8 +3273,9 @@ DWORD WINAPI WaitForInputIdle( HANDLE hProcess, DWORD dwTimeOut )
handles[0] = hProcess;
SERVER_START_REQ( get_process_idle_event )
{
req->handle = hProcess;
if (!(ret = wine_server_call_err( req ))) handles[1] = reply->event;
req->handle = wine_server_obj_handle( hProcess );
if (!(ret = wine_server_call_err( req )))
handles[1] = wine_server_ptr_handle( reply->event );
}
SERVER_END_REQ;
if (ret) return WAIT_FAILED; /* error */

View File

@ -137,7 +137,7 @@ HANDLE WINAPI GetPropW( HWND hwnd, LPCWSTR str )
req->window = hwnd;
if (!HIWORD(str)) req->atom = LOWORD(str);
else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
if (!wine_server_call_err( req )) ret = reply->handle;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -167,7 +167,7 @@ BOOL WINAPI SetPropW( HWND hwnd, LPCWSTR str, HANDLE handle )
SERVER_START_REQ( set_window_property )
{
req->window = hwnd;
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
if (!HIWORD(str)) req->atom = LOWORD(str);
else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
ret = !wine_server_call_err( req );
@ -202,7 +202,7 @@ HANDLE WINAPI RemovePropW( HWND hwnd, LPCWSTR str )
req->window = hwnd;
if (!HIWORD(str)) req->atom = LOWORD(str);
else wine_server_add_data( req, str, strlenW(str) * sizeof(WCHAR) );
if (!wine_server_call_err( req )) ret = reply->handle;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
@ -224,7 +224,7 @@ INT WINAPI EnumPropsExA(HWND hwnd, PROPENUMPROCEXA func, LPARAM lParam)
{
char string[ATOM_BUFFER_SIZE];
if (!GlobalGetAtomNameA( list[i].atom, string, ATOM_BUFFER_SIZE )) continue;
if (!(ret = func( hwnd, string, list[i].handle, lParam ))) break;
if (!(ret = func( hwnd, string, wine_server_ptr_handle(list[i].handle), lParam ))) break;
}
HeapFree( GetProcessHeap(), 0, list );
}
@ -246,7 +246,7 @@ INT WINAPI EnumPropsExW(HWND hwnd, PROPENUMPROCEXW func, LPARAM lParam)
{
WCHAR string[ATOM_BUFFER_SIZE];
if (!GlobalGetAtomNameW( list[i].atom, string, ATOM_BUFFER_SIZE )) continue;
if (!(ret = func( hwnd, string, list[i].handle, lParam ))) break;
if (!(ret = func( hwnd, string, wine_server_ptr_handle(list[i].handle), lParam ))) break;
}
HeapFree( GetProcessHeap(), 0, list );
}
@ -277,14 +277,14 @@ INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func )
args[3] = hwnd;
args[2] = SELECTOROF(segptr);
args[1] = OFFSETOF(segptr);
args[0] = LOWORD(list[i].handle);
args[0] = LOWORD(wine_server_ptr_handle(list[i].handle));
}
else
{
args[3] = hwnd;
args[2] = 0;
args[1] = list[i].atom;
args[0] = LOWORD(list[i].handle);
args[0] = LOWORD(wine_server_ptr_handle(list[i].handle));
}
WOWCallback16Ex( (DWORD)func, WCB16_PASCAL, sizeof(args), args, &result );
if (!(ret = LOWORD(result))) break;

View File

@ -236,7 +236,7 @@ static HWND *list_window_children( HDESK desktop, HWND hwnd, LPCWSTR class, DWOR
SERVER_START_REQ( get_window_children )
{
req->desktop = desktop;
req->desktop = wine_server_obj_handle( desktop );
req->parent = hwnd;
req->tid = tid;
req->atom = atom;

View File

@ -96,7 +96,7 @@ HWINSTA WINAPI CreateWindowStationW( LPCWSTR name, DWORD reserved, ACCESS_MASK a
wine_server_add_data( req, name, len * sizeof(WCHAR) );
/* it doesn't seem to set last error */
wine_server_call( req );
ret = reply->handle;
ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -138,7 +138,7 @@ HWINSTA WINAPI OpenWindowStationW( LPCWSTR name, BOOL inherit, ACCESS_MASK acces
req->access = access;
req->attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0);
wine_server_add_data( req, name, len * sizeof(WCHAR) );
if (!wine_server_call_err( req )) ret = reply->handle;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -153,7 +153,7 @@ BOOL WINAPI CloseWindowStation( HWINSTA handle )
BOOL ret;
SERVER_START_REQ( close_winstation )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
@ -170,7 +170,8 @@ HWINSTA WINAPI GetProcessWindowStation(void)
SERVER_START_REQ( get_process_winstation )
{
if (!wine_server_call_err( req )) ret = reply->handle;
if (!wine_server_call_err( req ))
ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -186,7 +187,7 @@ BOOL WINAPI SetProcessWindowStation( HWINSTA handle )
SERVER_START_REQ( set_process_winstation )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
@ -292,7 +293,7 @@ HDESK WINAPI CreateDesktopW( LPCWSTR name, LPCWSTR device, LPDEVMODEW devmode,
wine_server_add_data( req, name, len * sizeof(WCHAR) );
/* it doesn't seem to set last error */
wine_server_call( req );
ret = reply->handle;
ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -328,12 +329,12 @@ HDESK open_winstation_desktop( HWINSTA hwinsta, LPCWSTR name, DWORD flags, BOOL
}
SERVER_START_REQ( open_desktop )
{
req->winsta = hwinsta;
req->winsta = wine_server_obj_handle( hwinsta );
req->flags = flags;
req->access = access;
req->attributes = OBJ_CASE_INSENSITIVE | (inherit ? OBJ_INHERIT : 0);
wine_server_add_data( req, name, len * sizeof(WCHAR) );
if (!wine_server_call( req )) ret = reply->handle;
if (!wine_server_call( req )) ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -357,7 +358,7 @@ BOOL WINAPI CloseDesktop( HDESK handle )
BOOL ret;
SERVER_START_REQ( close_desktop )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
@ -375,7 +376,7 @@ HDESK WINAPI GetThreadDesktop( DWORD thread )
SERVER_START_REQ( get_thread_desktop )
{
req->tid = thread;
if (!wine_server_call_err( req )) ret = reply->handle;
if (!wine_server_call_err( req )) ret = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
@ -391,7 +392,7 @@ BOOL WINAPI SetThreadDesktop( HDESK handle )
SERVER_START_REQ( set_thread_desktop )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
@ -434,7 +435,7 @@ BOOL WINAPI EnumDesktopsW( HWINSTA winsta, DESKTOPENUMPROCW func, LPARAM lparam
{
SERVER_START_REQ( enum_desktop )
{
req->winstation = winsta;
req->winstation = wine_server_obj_handle( winsta );
req->index = index;
wine_server_set_reply( req, name, sizeof(name) - sizeof(WCHAR) );
status = wine_server_call( req );
@ -514,7 +515,7 @@ BOOL WINAPI GetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DW
}
SERVER_START_REQ( set_user_object_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = 0;
ret = !wine_server_call_err( req );
if (ret)
@ -530,7 +531,7 @@ BOOL WINAPI GetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DW
case UOI_TYPE:
SERVER_START_REQ( set_user_object_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = 0;
ret = !wine_server_call_err( req );
if (ret)
@ -553,7 +554,7 @@ BOOL WINAPI GetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DW
WCHAR buffer[MAX_PATH];
SERVER_START_REQ( set_user_object_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = 0;
wine_server_set_reply( req, buffer, sizeof(buffer) - sizeof(WCHAR) );
ret = !wine_server_call_err( req );
@ -610,7 +611,7 @@ BOOL WINAPI SetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DW
/* FIXME: inherit flag */
SERVER_START_REQ( set_user_object_info )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
req->flags = SET_USER_OBJECT_FLAGS;
req->obj_flags = obj_flags->dwFlags;
ret = !wine_server_call_err( req );

View File

@ -605,7 +605,7 @@ static void set_queue_display_fd( Display *display )
}
SERVER_START_REQ( set_queue_fd )
{
req->handle = handle;
req->handle = wine_server_obj_handle( handle );
ret = wine_server_call( req );
}
SERVER_END_REQ;

View File

@ -422,7 +422,7 @@ static void _enable_event( HANDLE s, unsigned int event,
{
SERVER_START_REQ( enable_socket_event )
{
req->handle = s;
req->handle = wine_server_obj_handle( s );
req->mask = event;
req->sstate = sstate;
req->cstate = cstate;
@ -436,7 +436,7 @@ static int _is_blocking(SOCKET s)
int ret;
SERVER_START_REQ( get_socket_event )
{
req->handle = SOCKET2HANDLE(s);
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->service = FALSE;
req->c_event = 0;
wine_server_call( req );
@ -451,7 +451,7 @@ static unsigned int _get_sock_mask(SOCKET s)
unsigned int ret;
SERVER_START_REQ( get_socket_event )
{
req->handle = SOCKET2HANDLE(s);
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->service = FALSE;
req->c_event = 0;
wine_server_call( req );
@ -474,7 +474,7 @@ static int _get_sock_error(SOCKET s, unsigned int bit)
SERVER_START_REQ( get_socket_event )
{
req->handle = SOCKET2HANDLE(s);
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->service = FALSE;
req->c_event = 0;
wine_server_set_reply( req, events, sizeof(events) );
@ -1325,7 +1325,7 @@ static int WS2_register_async_shutdown( SOCKET s, int type )
SERVER_START_REQ( register_async )
{
req->handle = wsa->hSocket;
req->handle = wine_server_obj_handle( wsa->hSocket );
req->type = type;
req->async.callback = WS2_async_shutdown;
req->async.iosb = &wsa->local_iosb;
@ -1371,11 +1371,11 @@ SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr,
}
SERVER_START_REQ( accept_socket )
{
req->lhandle = SOCKET2HANDLE(s);
req->lhandle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->access = GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE;
req->attributes = OBJ_INHERIT;
set_error( wine_server_call( req ) );
as = HANDLE2SOCKET( reply->handle );
as = HANDLE2SOCKET( wine_server_ptr_handle( reply->handle ));
}
SERVER_END_REQ;
if (as)
@ -2609,7 +2609,7 @@ static void WS_AddCompletion( SOCKET sock, ULONG_PTR CompletionValue, NTSTATUS C
SERVER_START_REQ( add_fd_completion )
{
req->handle = SOCKET2HANDLE(sock);
req->handle = wine_server_obj_handle( SOCKET2HANDLE(sock) );
req->cvalue = CompletionValue;
req->status = CompletionStatus;
req->information = Information;
@ -2734,13 +2734,13 @@ INT WINAPI WSASendTo( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
SERVER_START_REQ( register_async )
{
req->handle = wsa->hSocket;
req->handle = wine_server_obj_handle( wsa->hSocket );
req->type = ASYNC_TYPE_WRITE;
req->async.callback = WS2_async_send;
req->async.iosb = iosb;
req->async.arg = wsa;
req->async.apc = ws2_async_apc;
req->async.event = lpCompletionRoutine ? 0 : lpOverlapped->hEvent;
req->async.event = wine_server_obj_handle( lpCompletionRoutine ? 0 : lpOverlapped->hEvent );
req->async.cvalue = cvalue;
err = wine_server_call( req );
}
@ -3625,9 +3625,9 @@ int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEvent, LPWSANETWORKEVENTS lp
SERVER_START_REQ( get_socket_event )
{
req->handle = SOCKET2HANDLE(s);
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->service = TRUE;
req->c_event = hEvent;
req->c_event = wine_server_obj_handle( hEvent );
wine_server_set_reply( req, lpEvent->iErrorCode, sizeof(lpEvent->iErrorCode) );
if (!(ret = wine_server_call(req))) lpEvent->lNetworkEvents = reply->pmask & reply->mask;
}
@ -3648,9 +3648,9 @@ int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEvent, LONG lEvent)
SERVER_START_REQ( set_socket_event )
{
req->handle = SOCKET2HANDLE(s);
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->mask = lEvent;
req->event = hEvent;
req->event = wine_server_obj_handle( hEvent );
req->window = 0;
req->msg = 0;
ret = wine_server_call( req );
@ -3717,7 +3717,7 @@ INT WINAPI WSAAsyncSelect(SOCKET s, HWND hWnd, UINT uMsg, LONG lEvent)
SERVER_START_REQ( set_socket_event )
{
req->handle = SOCKET2HANDLE(s);
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->mask = lEvent;
req->event = 0;
req->window = hWnd;
@ -3840,7 +3840,7 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
req->attributes = OBJ_INHERIT;
req->flags = dwFlags;
set_error( wine_server_call( req ) );
ret = HANDLE2SOCKET( reply->handle );
ret = HANDLE2SOCKET( wine_server_ptr_handle( reply->handle ));
}
SERVER_END_REQ;
if (ret)
@ -4257,13 +4257,13 @@ INT WINAPI WSARecvFrom( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
SERVER_START_REQ( register_async )
{
req->handle = wsa->hSocket;
req->handle = wine_server_obj_handle( wsa->hSocket );
req->type = ASYNC_TYPE_READ;
req->async.callback = WS2_async_recv;
req->async.iosb = iosb;
req->async.arg = wsa;
req->async.apc = ws2_async_apc;
req->async.event = lpCompletionRoutine ? 0 : lpOverlapped->hEvent;
req->async.event = wine_server_obj_handle( lpCompletionRoutine ? 0 : lpOverlapped->hEvent );
req->async.cvalue = cvalue;
err = wine_server_call( req );
}
@ -4412,8 +4412,8 @@ SOCKET WINAPI WSAAccept( SOCKET s, struct WS_sockaddr *addr, LPINT addrlen,
case CF_DEFER:
SERVER_START_REQ( set_socket_deferred )
{
req->handle = SOCKET2HANDLE(s);
req->deferred = SOCKET2HANDLE(cs);
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->deferred = wine_server_obj_handle( SOCKET2HANDLE(cs) );
if ( !wine_server_call_err ( req ) )
{
SetLastError( WSATRY_AGAIN );

View File

@ -51,9 +51,9 @@ struct __server_request_info
extern unsigned int wine_server_call( void *req_ptr );
extern void wine_server_send_fd( int fd );
extern int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, obj_handle_t *handle );
extern int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, unsigned int *options );
extern void wine_server_release_fd( obj_handle_t handle, int unix_fd );
extern int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle );
extern int wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, unsigned int *options );
extern void wine_server_release_fd( HANDLE handle, int unix_fd );
/* do a server call and set the last error code */
static inline unsigned int wine_server_call_err( void *req_ptr )
@ -89,6 +89,19 @@ static inline void wine_server_set_reply( void *req_ptr, void *ptr, data_size_t
req->u.req.request_header.reply_size = max_size;
}
/* convert an object handle to a server handle */
static inline obj_handle_t wine_server_obj_handle( HANDLE handle )
{
if ((int)(INT_PTR)handle != (INT_PTR)handle) return 0xfffffff0; /* some invalid handle */
return (INT_PTR)handle;
}
/* convert a server handle to a generic handle */
static inline HANDLE wine_server_ptr_handle( obj_handle_t handle )
{
return (HANDLE)(INT_PTR)(int)handle;
}
/* macros for server requests */

View File

@ -68,7 +68,7 @@ void WINECON_FetchCells(struct inner_data* data, int upd_tp, int upd_bm)
{
SERVER_START_REQ( read_console_output )
{
req->handle = data->hConOut;
req->handle = wine_server_obj_handle( data->hConOut );
req->x = 0;
req->y = upd_tp;
req->mode = CHAR_INFO_MODE_TEXTATTR;
@ -90,7 +90,7 @@ void WINECON_NotifyWindowChange(struct inner_data* data)
{
SERVER_START_REQ( set_console_output_info )
{
req->handle = data->hConOut;
req->handle = wine_server_obj_handle( data->hConOut );
req->win_left = data->curcfg.win_pos.X;
req->win_top = data->curcfg.win_pos.Y;
req->win_right = data->curcfg.win_pos.X + data->curcfg.win_width - 1;
@ -112,7 +112,7 @@ int WINECON_GetHistorySize(HANDLE hConIn)
SERVER_START_REQ(get_console_input_info)
{
req->handle = hConIn;
req->handle = wine_server_obj_handle( hConIn );
if (!wine_server_call_err( req )) ret = reply->history_size;
}
SERVER_END_REQ;
@ -130,7 +130,7 @@ BOOL WINECON_SetHistorySize(HANDLE hConIn, int size)
SERVER_START_REQ(set_console_input_info)
{
req->handle = hConIn;
req->handle = wine_server_obj_handle( hConIn );
req->mask = SET_CONSOLE_INPUT_INFO_HISTORY_SIZE;
req->history_size = size;
ret = !wine_server_call_err( req );
@ -151,7 +151,7 @@ int WINECON_GetHistoryMode(HANDLE hConIn)
SERVER_START_REQ(get_console_input_info)
{
req->handle = hConIn;
req->handle = wine_server_obj_handle( hConIn );
if (!wine_server_call_err( req )) ret = reply->history_mode;
}
SERVER_END_REQ;
@ -169,7 +169,7 @@ BOOL WINECON_SetHistoryMode(HANDLE hConIn, int mode)
SERVER_START_REQ(set_console_input_info)
{
req->handle = hConIn;
req->handle = wine_server_obj_handle( hConIn );
req->mask = SET_CONSOLE_INPUT_INFO_HISTORY_MODE;
req->history_mode = mode;
ret = !wine_server_call_err( req );
@ -191,7 +191,7 @@ BOOL WINECON_GetConsoleTitle(HANDLE hConIn, WCHAR* buffer, size_t len)
SERVER_START_REQ( get_console_input_info )
{
req->handle = hConIn;
req->handle = wine_server_obj_handle( hConIn );
wine_server_set_reply( req, buffer, len - sizeof(WCHAR) );
if ((ret = !wine_server_call_err( req )))
{
@ -214,7 +214,7 @@ static BOOL WINECON_SetEditionMode(HANDLE hConIn, int edition_mode)
SERVER_START_REQ( set_console_input_info )
{
req->handle = hConIn;
req->handle = wine_server_obj_handle( hConIn );
req->mask = SET_CONSOLE_INPUT_INFO_EDITION_MODE;
req->edition_mode = edition_mode;
ret = !wine_server_call_err( req );
@ -237,7 +237,7 @@ int WINECON_GrabChanges(struct inner_data* data)
SERVER_START_REQ( get_console_renderer_events )
{
wine_server_set_reply( req, evts, sizeof(evts) );
req->handle = data->hSynchro;
req->handle = wine_server_obj_handle( data->hSynchro );
if (!wine_server_call_err( req )) num = wine_server_reply_size(reply) / sizeof(evts[0]);
else num = 0;
}
@ -297,7 +297,7 @@ int WINECON_GrabChanges(struct inner_data* data)
case CONSOLE_RENDERER_ACTIVE_SB_EVENT:
SERVER_START_REQ( open_console )
{
req->from = data->hConIn;
req->from = wine_server_obj_handle( data->hConIn );
req->access = GENERIC_READ | GENERIC_WRITE;
req->attributes = 0;
req->share = FILE_SHARE_READ | FILE_SHARE_WRITE;
@ -554,7 +554,7 @@ static BOOL WINECON_GetServerConfig(struct inner_data* data)
SERVER_START_REQ(get_console_input_info)
{
req->handle = data->hConIn;
req->handle = wine_server_obj_handle( data->hConIn );
ret = !wine_server_call_err( req );
data->curcfg.history_size = reply->history_size;
data->curcfg.history_nodup = reply->history_mode;
@ -564,7 +564,7 @@ static BOOL WINECON_GetServerConfig(struct inner_data* data)
if (!ret) return FALSE;
SERVER_START_REQ(get_console_output_info)
{
req->handle = data->hConOut;
req->handle = wine_server_obj_handle( data->hConOut );
ret = !wine_server_call_err( req );
data->curcfg.cursor_size = reply->cursor_size;
data->curcfg.cursor_visible = reply->cursor_visible;
@ -644,7 +644,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
SERVER_START_REQ(create_console_output)
{
req->handle_in = data->hConIn;
req->handle_in = wine_server_obj_handle( data->hConIn );
req->access = GENERIC_WRITE|GENERIC_READ;
req->attributes = 0;
req->share = FILE_SHARE_READ|FILE_SHARE_WRITE;
@ -680,7 +680,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
WINECON_DumpConfig("fint", &data->curcfg);
SERVER_START_REQ( set_console_input_info )
{
req->handle = data->hConIn;
req->handle = wine_server_obj_handle( data->hConIn );
req->win = data->hWnd;
req->mask = SET_CONSOLE_INPUT_INFO_TITLE |
SET_CONSOLE_INPUT_INFO_WIN;