diff --git a/dlls/kernel/comm.c b/dlls/kernel/comm.c index 6a8ccbeb8ef..0eee0b0b3b6 100644 --- a/dlls/kernel/comm.c +++ b/dlls/kernel/comm.c @@ -110,7 +110,7 @@ static int get_comm_fd( HANDLE handle, DWORD access ) { int fd, ret; - ret = wine_server_handle_to_fd( handle, access, &fd, NULL, NULL ); + ret = wine_server_handle_to_fd( handle, access, &fd, NULL ); if (ret) SetLastError( RtlNtStatusToDosError(ret) ); return fd; } diff --git a/dlls/kernel/file.c b/dlls/kernel/file.c index fefe71506eb..bf86e583d87 100644 --- a/dlls/kernel/file.c +++ b/dlls/kernel/file.c @@ -866,7 +866,7 @@ BOOL WINAPI SetFilePointerEx( HANDLE hFile, LARGE_INTEGER distance, return ret; } - if (!(status = wine_server_handle_to_fd( hFile, 0, &fd, NULL, NULL ))) + if (!(status = wine_server_handle_to_fd( hFile, 0, &fd, NULL ))) { off_t pos, res; diff --git a/dlls/kernel/sync.c b/dlls/kernel/sync.c index 3f725cbca95..9b00360e787 100644 --- a/dlls/kernel/sync.c +++ b/dlls/kernel/sync.c @@ -1068,7 +1068,7 @@ BOOL WINAPI PeekNamedPipe( HANDLE hPipe, LPVOID lpvBuffer, DWORD cbBuffer, #ifdef FIONREAD int avail=0, fd, ret, flags; - ret = wine_server_handle_to_fd( hPipe, GENERIC_READ, &fd, NULL, &flags ); + ret = wine_server_handle_to_fd( hPipe, GENERIC_READ, &fd, &flags ); if (ret) { SetLastError( RtlNtStatusToDosError(ret) ); diff --git a/dlls/kernel/vxd.c b/dlls/kernel/vxd.c index a562d725022..ecd5bd04eb8 100644 --- a/dlls/kernel/vxd.c +++ b/dlls/kernel/vxd.c @@ -135,7 +135,7 @@ static DeviceIoProc get_vxd_proc( HANDLE handle ) DeviceIoProc ret = NULL; int status, i, fd; - status = wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL ); + status = wine_server_handle_to_fd( handle, 0, &fd, NULL ); if (status) { SetLastError( RtlNtStatusToDosError(status) ); @@ -236,7 +236,7 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa ) FreeLibrary( module ); goto done; } - wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL ); + wine_server_handle_to_fd( handle, 0, &fd, NULL ); if (fstat( fd, &st ) != -1) { vxd_modules[i].dev = st.st_dev; diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c index 5e5259fd14a..782f7d0355a 100644 --- a/dlls/ntdll/cdrom.c +++ b/dlls/ntdll/cdrom.c @@ -1925,7 +1925,7 @@ NTSTATUS CDROM_DeviceIoControl(HANDLE hDevice, piosb->Information = 0; - if ((status = wine_server_handle_to_fd( hDevice, 0, &fd, NULL, NULL ))) goto error; + if ((status = wine_server_handle_to_fd( hDevice, 0, &fd, NULL ))) goto error; if ((status = CDROM_Open(fd, &dev))) { wine_server_release_fd( hDevice, fd ); diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index ac589806312..e947d2c7c94 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -674,8 +674,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event, return io->u.Status = STATUS_NOT_IMPLEMENTED; } - if ((io->u.Status = wine_server_handle_to_fd( handle, GENERIC_READ, - &fd, NULL, NULL )) != STATUS_SUCCESS) + if ((io->u.Status = wine_server_handle_to_fd( handle, GENERIC_READ, &fd, NULL )) != STATUS_SUCCESS) return io->u.Status; io->Information = 0; diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 4d253fc43d5..843c055dfe2 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -408,7 +408,7 @@ NTSTATUS WINAPI NtReadFile(HANDLE hFile, HANDLE hEvent, hFile,hEvent,apc,apc_user,io_status,buffer,length,offset,key); io_status->Information = 0; - io_status->u.Status = wine_server_handle_to_fd( hFile, GENERIC_READ, &unix_handle, NULL, &flags ); + io_status->u.Status = wine_server_handle_to_fd( hFile, GENERIC_READ, &unix_handle, &flags ); if (io_status->u.Status) return io_status->u.Status; if (flags & FD_FLAG_RECV_SHUTDOWN) @@ -604,7 +604,7 @@ NTSTATUS WINAPI NtWriteFile(HANDLE hFile, HANDLE hEvent, hFile,hEvent,apc,apc_user,io_status,buffer,length,offset,key); io_status->Information = 0; - io_status->u.Status = wine_server_handle_to_fd( hFile, GENERIC_WRITE, &unix_handle, NULL, &flags ); + io_status->u.Status = wine_server_handle_to_fd( hFile, GENERIC_WRITE, &unix_handle, &flags ); if (io_status->u.Status) return io_status->u.Status; if (flags & FD_FLAG_SEND_SHUTDOWN) @@ -872,7 +872,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, if (len < info_sizes[class]) return io->u.Status = STATUS_INFO_LENGTH_MISMATCH; - if ((io->u.Status = wine_server_handle_to_fd( hFile, 0, &fd, NULL, NULL ))) + if ((io->u.Status = wine_server_handle_to_fd( hFile, 0, &fd, NULL ))) return io->u.Status; switch (class) @@ -1027,7 +1027,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io, TRACE("(%p,%p,%p,0x%08lx,0x%08x)\n", handle, io, ptr, len, class); - if ((io->u.Status = wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL ))) + if ((io->u.Status = wine_server_handle_to_fd( handle, 0, &fd, NULL ))) return io->u.Status; io->u.Status = STATUS_SUCCESS; @@ -1230,7 +1230,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io int fd; struct stat st; - if ((io->u.Status = wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL )) != STATUS_SUCCESS) + if ((io->u.Status = wine_server_handle_to_fd( handle, 0, &fd, NULL )) != STATUS_SUCCESS) return io->u.Status; io->u.Status = STATUS_NOT_IMPLEMENTED; diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index a8cef2fe55a..b57ca6c1850 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1121,7 +1121,7 @@ # Server interface @ cdecl -norelay wine_server_call(ptr) @ cdecl wine_server_fd_to_handle(long long long ptr) -@ cdecl wine_server_handle_to_fd(long long ptr ptr ptr) +@ cdecl wine_server_handle_to_fd(long long ptr ptr) @ cdecl wine_server_release_fd(long long) @ cdecl wine_server_send_fd(long) diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c index 11ac2071316..57a8db48f77 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -460,14 +460,12 @@ int wine_server_fd_to_handle( int fd, unsigned int access, int inherit, obj_hand * handle [I] Wine file handle. * access [I] Win32 file access rights requested. * unix_fd [O] Address where Unix file descriptor will be stored. - * type [O] Address where the file type will be stored. Optional. * flags [O] Address where the Unix flags associated with file will be stored. Optional. * * RETURNS * NTSTATUS code */ -int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, - enum fd_type *type, int *flags ) +int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, int *flags ) { obj_handle_t fd_handle; int ret, fd = -1; @@ -480,7 +478,6 @@ int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *uni req->handle = handle; req->access = access; if (!(ret = wine_server_call( req ))) fd = reply->fd; - if (type) *type = reply->type; if (flags) *flags = reply->flags; } SERVER_END_REQ; diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 7ef90434427..7ec0db7aabc 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1638,7 +1638,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p SERVER_END_REQ; if (res) return res; - if ((res = wine_server_handle_to_fd( handle, 0, &unix_handle, NULL, NULL ))) return res; + if ((res = wine_server_handle_to_fd( handle, 0, &unix_handle, NULL ))) return res; if (NtQueryVolumeInformationFile( handle, &io, &device_info, sizeof(device_info), FileFsDeviceInformation ) == STATUS_SUCCESS) @@ -1651,7 +1651,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p int shared_fd; if ((res = wine_server_handle_to_fd( shared_file, GENERIC_READ, &shared_fd, - NULL, NULL ))) goto done; + NULL ))) goto done; res = map_image( handle, unix_handle, base, size_low, header_size, shared_fd, removable, addr_ptr ); wine_server_release_fd( shared_file, shared_fd ); diff --git a/dlls/winedos/int13.c b/dlls/winedos/int13.c index 163a6f4768c..a65ef84bf03 100644 --- a/dlls/winedos/int13.c +++ b/dlls/winedos/int13.c @@ -122,7 +122,7 @@ static void INT13_ReadFloppyParams( CONTEXT86 *context ) h = CreateFileW(drive_root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (h == INVALID_HANDLE_VALUE || - wine_server_handle_to_fd(h, GENERIC_READ, &floppy_fd, NULL, NULL)) + wine_server_handle_to_fd(h, GENERIC_READ, &floppy_fd, NULL)) { WARN("Can't determine floppy geometry !\n"); INT13_SetStatus( context, 0x07 ); /* drive parameter activity failed */ diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c index c6dff3dafb6..12c1bc2f181 100644 --- a/dlls/winedos/int21.c +++ b/dlls/winedos/int21.c @@ -908,7 +908,7 @@ static HANDLE INT21_OpenMagicDevice( LPCWSTR name, DWORD access ) struct stat st; if (!(handle = INT21_CreateMagicDeviceHandle( magic_devices[i].name ))) return 0; - wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL ); + wine_server_handle_to_fd( handle, 0, &fd, NULL ); fstat( fd, &st ); wine_server_release_fd( handle, fd ); magic_devices[i].dev = st.st_dev; @@ -2684,7 +2684,7 @@ static void INT21_Ioctl_Char( CONTEXT86 *context ) int status, i, fd; HANDLE handle = DosFileHandleToWin32Handle(BX_reg(context)); - status = wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL ); + status = wine_server_handle_to_fd( handle, 0, &fd, NULL ); if (status) { SET_AX( context, RtlNtStatusToDosError(status) ); diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c index 0f1ba340458..02e8d35ef82 100644 --- a/dlls/winsock/socket.c +++ b/dlls/winsock/socket.c @@ -315,7 +315,7 @@ inline static unsigned int set_error( unsigned int err ) inline static int get_sock_fd( SOCKET s, DWORD access, int *flags ) { int fd; - if (set_error( wine_server_handle_to_fd( SOCKET2HANDLE(s), access, &fd, NULL, flags ) )) + if (set_error( wine_server_handle_to_fd( SOCKET2HANDLE(s), access, &fd, flags ) )) return -1; return fd; } diff --git a/include/wine/server.h b/include/wine/server.h index 780d02e8ba0..8bda4031e1b 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -53,8 +53,7 @@ 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, int inherit, obj_handle_t *handle ); -extern int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, - enum fd_type *type, int *flags ); +extern int wine_server_handle_to_fd( obj_handle_t handle, unsigned int access, int *unix_fd, int *flags ); extern void wine_server_release_fd( obj_handle_t handle, int unix_fd ); /* do a server call and set the last error code */ diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 40810a91eec..36c41c1eec8 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -792,15 +792,8 @@ struct get_handle_fd_reply { struct reply_header __header; int fd; - int type; int flags; }; -enum fd_type -{ - FD_TYPE_INVALID, - FD_TYPE_DEFAULT, - FD_TYPE_SOCKET -}; #define FD_FLAG_OVERLAPPED 0x01 #define FD_FLAG_TIMEOUT 0x02 #define FD_FLAG_RECV_SHUTDOWN 0x04 @@ -3649,6 +3642,6 @@ union generic_reply struct set_global_windows_reply set_global_windows_reply; }; -#define SERVER_PROTOCOL_VERSION 148 +#define SERVER_PROTOCOL_VERSION 149 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/misc/registry.c b/misc/registry.c index aead592dbbd..d187b9d6409 100644 --- a/misc/registry.c +++ b/misc/registry.c @@ -1706,7 +1706,7 @@ static void init_cdrom_registry( HANDLE handle ) #ifdef HDIO_GET_DMA { int fd, dma; - if (!wine_server_handle_to_fd( handle, 0, &fd, NULL, NULL )) + if (!wine_server_handle_to_fd( handle, 0, &fd, NULL )) { if (ioctl(fd,HDIO_GET_DMA, &dma) != -1) value = dma; wine_server_release_fd( handle, fd ); diff --git a/server/fd.c b/server/fd.c index 00b4c51254c..2ef48396c51 100644 --- a/server/fd.c +++ b/server/fd.c @@ -1117,11 +1117,10 @@ int no_flush( struct fd *fd, struct event **event ) } /* default get_file_info() routine */ -int no_get_file_info( struct fd *fd, int *flags ) +int no_get_file_info( struct fd *fd ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - *flags = 0; - return FD_TYPE_INVALID; + return 0; } /* default queue_async() routine */ @@ -1168,7 +1167,6 @@ DECL_HANDLER(get_handle_fd) struct fd *fd; reply->fd = -1; - reply->type = FD_TYPE_INVALID; if ((fd = get_handle_fd_obj( current->process, req->handle, req->access ))) { @@ -1179,7 +1177,7 @@ DECL_HANDLER(get_handle_fd) assert( fd->unix_fd != -1 ); send_client_fd( current->process, fd->unix_fd, req->handle ); } - reply->type = fd->fd_ops->get_file_info( fd, &reply->flags ); + reply->flags = fd->fd_ops->get_file_info( fd ); release_object( fd ); } } diff --git a/server/file.c b/server/file.c index 2e8012ebcc3..352932fc26e 100644 --- a/server/file.c +++ b/server/file.c @@ -69,7 +69,7 @@ static void file_destroy( struct object *obj ); static int file_get_poll_events( struct fd *fd ); static void file_poll_event( struct fd *fd, int event ); static int file_flush( struct fd *fd, struct event **event ); -static int file_get_info( struct fd *fd, int *flags ); +static int file_get_info( struct fd *fd ); static void file_queue_async( struct fd *fd, void *ptr, unsigned int status, int type, int count ); static const struct object_ops file_ops = @@ -258,13 +258,12 @@ static int file_flush( struct fd *fd, struct event **event ) return ret; } -static int file_get_info( struct fd *fd, int *flags ) +static int file_get_info( struct fd *fd ) { struct file *file = get_fd_user( fd ); - *flags = 0; - if (is_overlapped( file )) *flags |= FD_FLAG_OVERLAPPED; - return FD_TYPE_DEFAULT; + if (is_overlapped( file )) return FD_FLAG_OVERLAPPED; + else return 0; } static void file_queue_async(struct fd *fd, void *ptr, unsigned int status, int type, int count) diff --git a/server/file.h b/server/file.h index 92321e49ab5..80f936f5950 100644 --- a/server/file.h +++ b/server/file.h @@ -37,7 +37,7 @@ struct fd_ops /* flush the object buffers */ int (*flush)(struct fd *, struct event **); /* get file information */ - int (*get_file_info)(struct fd *, int *flags); + int (*get_file_info)(struct fd *); /* queue an async operation - see register_async handler in async.c*/ void (*queue_async)(struct fd *, void* ptr, unsigned int status, int type, int count); }; @@ -64,7 +64,7 @@ extern void default_fd_remove_queue( struct object *obj, struct wait_queue_entry extern int default_fd_signaled( struct object *obj, struct thread *thread ); extern void default_poll_event( struct fd *fd, int event ); extern int no_flush( struct fd *fd, struct event **event ); -extern int no_get_file_info( struct fd *fd, int *flags ); +extern int no_get_file_info( struct fd *fd ); extern void no_queue_async( struct fd *fd, void* ptr, unsigned int status, int type, int count ); extern void main_loop(void); diff --git a/server/named_pipe.c b/server/named_pipe.c index 8327e6b2537..85c81885a07 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -125,7 +125,7 @@ static const struct object_ops named_pipe_ops = /* common to clients and servers */ static int pipe_end_get_poll_events( struct fd *fd ); -static int pipe_end_get_info( struct fd *fd, int *flags ); +static int pipe_end_get_info( struct fd *fd ); /* server end functions */ static void pipe_server_dump( struct object *obj, int verbose ); @@ -476,10 +476,9 @@ static int pipe_client_flush( struct fd *fd, struct event **event ) return 0; } -static int pipe_end_get_info( struct fd *fd, int *flags ) +static int pipe_end_get_info( struct fd *fd ) { - *flags = 0; - return FD_TYPE_DEFAULT; + return 0; } static struct named_pipe *create_named_pipe( const WCHAR *name, size_t len ) diff --git a/server/protocol.def b/server/protocol.def index 38595338f03..7f4d10be7e4 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -603,15 +603,8 @@ enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT }; unsigned int access; /* wanted access rights */ @REPLY int fd; /* file descriptor */ - int type; /* the type of file (see below) */ int flags; /* file read/write flags (see below) */ @END -enum fd_type -{ - FD_TYPE_INVALID, - FD_TYPE_DEFAULT, - FD_TYPE_SOCKET -}; #define FD_FLAG_OVERLAPPED 0x01 /* fd opened in overlapped mode */ #define FD_FLAG_TIMEOUT 0x02 /* read/write is synchronous */ #define FD_FLAG_RECV_SHUTDOWN 0x04 diff --git a/server/serial.c b/server/serial.c index de0e373b733..c368a2b6106 100644 --- a/server/serial.c +++ b/server/serial.c @@ -61,7 +61,7 @@ static void serial_destroy(struct object *obj); static int serial_get_poll_events( struct fd *fd ); static void serial_poll_event( struct fd *fd, int event ); -static int serial_get_info( struct fd *fd, int *flags ); +static int serial_get_info( struct fd *fd ); static int serial_flush( struct fd *fd, struct event **event ); static void serial_queue_async(struct fd *fd, void *ptr, unsigned int status, int type, int count); @@ -201,22 +201,22 @@ static int serial_get_poll_events( struct fd *fd ) return events; } -static int serial_get_info( struct fd *fd, int *flags ) +static int serial_get_info( struct fd *fd ) { + int flags = 0; struct serial *serial = get_fd_user( fd ); assert( serial->obj.ops == &serial_ops ); - *flags = 0; if (!(serial->options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT))) - *flags |= FD_FLAG_OVERLAPPED; + flags |= FD_FLAG_OVERLAPPED; else if (!(serial->readinterval == MAXDWORD && serial->readmult == 0 && serial->readconst == 0)) - *flags |= FD_FLAG_TIMEOUT; - if (serial->readinterval == MAXDWORD && + flags |= FD_FLAG_TIMEOUT; + if (serial->readinterval == MAXDWORD && serial->readmult == 0 && serial->readconst == 0) - *flags |= FD_FLAG_AVAILABLE; + flags |= FD_FLAG_AVAILABLE; - return FD_TYPE_DEFAULT; + return flags; } static void serial_poll_event(struct fd *fd, int event) diff --git a/server/sock.c b/server/sock.c index 059bdba3326..fa911e9cd48 100644 --- a/server/sock.c +++ b/server/sock.c @@ -93,7 +93,7 @@ static void sock_destroy( struct object *obj ); static int sock_get_poll_events( struct fd *fd ); static void sock_poll_event( struct fd *fd, int event ); -static int sock_get_info( struct fd *fd, int *flags ); +static int sock_get_info( struct fd *fd ); static void sock_queue_async( struct fd *fd, void *ptr, unsigned int status, int type, int count ); static int sock_get_error( int err ); @@ -475,19 +475,19 @@ static int sock_get_poll_events( struct fd *fd ) return ev; } -static int sock_get_info( struct fd *fd, int *flags ) +static int sock_get_info( struct fd *fd ) { + int flags = FD_FLAG_AVAILABLE; struct sock *sock = get_fd_user( fd ); assert ( sock->obj.ops == &sock_ops ); - *flags = FD_FLAG_AVAILABLE; - if (sock->flags & WSA_FLAG_OVERLAPPED) *flags |= FD_FLAG_OVERLAPPED; + if (sock->flags & WSA_FLAG_OVERLAPPED) flags |= FD_FLAG_OVERLAPPED; if ( sock->type != SOCK_STREAM || sock->state & FD_WINE_CONNECTED ) { - if ( !(sock->state & FD_READ ) ) *flags |= FD_FLAG_RECV_SHUTDOWN; - if ( !(sock->state & FD_WRITE ) ) *flags |= FD_FLAG_SEND_SHUTDOWN; + if ( !(sock->state & FD_READ ) ) flags |= FD_FLAG_RECV_SHUTDOWN; + if ( !(sock->state & FD_WRITE ) ) flags |= FD_FLAG_SEND_SHUTDOWN; } - return FD_TYPE_SOCKET; + return flags; } static void sock_queue_async(struct fd *fd, void *ptr, unsigned int status, int type, int count) diff --git a/server/trace.c b/server/trace.c index 13896081f8f..5ff521325b1 100644 --- a/server/trace.c +++ b/server/trace.c @@ -890,7 +890,6 @@ static void dump_get_handle_fd_request( const struct get_handle_fd_request *req static void dump_get_handle_fd_reply( const struct get_handle_fd_reply *req ) { fprintf( stderr, " fd=%d,", req->fd ); - fprintf( stderr, " type=%d,", req->type ); fprintf( stderr, " flags=%d", req->flags ); }