mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-04 20:27:43 +00:00
ntdll: Introduce a sync_ioctl() helper.
This commit is contained in:
parent
35ad787138
commit
d215435c78
|
@ -2268,7 +2268,6 @@ static NTSTATUS get_mountmgr_fs_info( HANDLE handle, int fd, struct mountmgr_uni
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
UNICODE_STRING string;
|
UNICODE_STRING string;
|
||||||
char *unix_name;
|
char *unix_name;
|
||||||
IO_STATUS_BLOCK io = {{0}};
|
|
||||||
HANDLE mountmgr;
|
HANDLE mountmgr;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
int letter;
|
int letter;
|
||||||
|
@ -2294,8 +2293,7 @@ static NTSTATUS get_mountmgr_fs_info( HANDLE handle, int fd, struct mountmgr_uni
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT );
|
FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT );
|
||||||
if (status) return status;
|
if (status) return status;
|
||||||
|
|
||||||
status = NtDeviceIoControlFile( mountmgr, NULL, NULL, NULL, &io, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE,
|
status = sync_ioctl( mountmgr, IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE, drive, sizeof(*drive), drive, size );
|
||||||
drive, sizeof(*drive), drive, size );
|
|
||||||
NtClose( mountmgr );
|
NtClose( mountmgr );
|
||||||
if (status == STATUS_BUFFER_OVERFLOW) status = STATUS_SUCCESS;
|
if (status == STATUS_BUFFER_OVERFLOW) status = STATUS_SUCCESS;
|
||||||
else if (status) WARN("failed to retrieve filesystem type from mountmgr, status %#x\n", status);
|
else if (status) WARN("failed to retrieve filesystem type from mountmgr, status %#x\n", status);
|
||||||
|
@ -5321,8 +5319,6 @@ struct io_timeouts
|
||||||
static unsigned int get_io_timeouts( HANDLE handle, enum server_fd_type type, ULONG count, BOOL is_read,
|
static unsigned int get_io_timeouts( HANDLE handle, enum server_fd_type type, ULONG count, BOOL is_read,
|
||||||
struct io_timeouts *timeouts )
|
struct io_timeouts *timeouts )
|
||||||
{
|
{
|
||||||
unsigned int status = STATUS_SUCCESS;
|
|
||||||
|
|
||||||
timeouts->interval = timeouts->total = -1;
|
timeouts->interval = timeouts->total = -1;
|
||||||
|
|
||||||
switch(type)
|
switch(type)
|
||||||
|
@ -5331,11 +5327,9 @@ static unsigned int get_io_timeouts( HANDLE handle, enum server_fd_type type, UL
|
||||||
{
|
{
|
||||||
/* GetCommTimeouts */
|
/* GetCommTimeouts */
|
||||||
SERIAL_TIMEOUTS st;
|
SERIAL_TIMEOUTS st;
|
||||||
IO_STATUS_BLOCK io = {{0}};
|
|
||||||
|
|
||||||
status = NtDeviceIoControlFile( handle, NULL, NULL, NULL, &io,
|
if (sync_ioctl( handle, IOCTL_SERIAL_GET_TIMEOUTS, NULL, 0, &st, sizeof(st) ))
|
||||||
IOCTL_SERIAL_GET_TIMEOUTS, NULL, 0, &st, sizeof(st) );
|
break;
|
||||||
if (status) break;
|
|
||||||
|
|
||||||
if (is_read)
|
if (is_read)
|
||||||
{
|
{
|
||||||
|
@ -5370,8 +5364,7 @@ static unsigned int get_io_timeouts( HANDLE handle, enum server_fd_type type, UL
|
||||||
{
|
{
|
||||||
req->handle = wine_server_obj_handle( handle );
|
req->handle = wine_server_obj_handle( handle );
|
||||||
req->flags = 0;
|
req->flags = 0;
|
||||||
if (!(status = wine_server_call( req )) &&
|
if (!wine_server_call( req ) && reply->read_timeout != TIMEOUT_INFINITE)
|
||||||
reply->read_timeout != TIMEOUT_INFINITE)
|
|
||||||
timeouts->total = reply->read_timeout / -10000;
|
timeouts->total = reply->read_timeout / -10000;
|
||||||
}
|
}
|
||||||
SERVER_END_REQ;
|
SERVER_END_REQ;
|
||||||
|
@ -5418,14 +5411,13 @@ static NTSTATUS get_io_avail_mode( HANDLE handle, enum server_fd_type type, BOOL
|
||||||
{
|
{
|
||||||
/* GetCommTimeouts */
|
/* GetCommTimeouts */
|
||||||
SERIAL_TIMEOUTS st;
|
SERIAL_TIMEOUTS st;
|
||||||
IO_STATUS_BLOCK io = {{0}};
|
|
||||||
|
|
||||||
status = NtDeviceIoControlFile( handle, NULL, NULL, NULL, &io,
|
if (!(status = sync_ioctl( handle, IOCTL_SERIAL_GET_TIMEOUTS, NULL, 0, &st, sizeof(st) )))
|
||||||
IOCTL_SERIAL_GET_TIMEOUTS, NULL, 0, &st, sizeof(st) );
|
{
|
||||||
if (status) break;
|
*avail_mode = (!st.ReadTotalTimeoutMultiplier &&
|
||||||
*avail_mode = (!st.ReadTotalTimeoutMultiplier &&
|
!st.ReadTotalTimeoutConstant &&
|
||||||
!st.ReadTotalTimeoutConstant &&
|
st.ReadIntervalTimeout == MAXDWORD);
|
||||||
st.ReadIntervalTimeout == MAXDWORD);
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FD_TYPE_MAILSLOT:
|
case FD_TYPE_MAILSLOT:
|
||||||
|
@ -6182,6 +6174,15 @@ NTSTATUS WINAPI NtDeviceIoControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* helper for internal ioctl calls */
|
||||||
|
NTSTATUS sync_ioctl( HANDLE file, ULONG code, void *in_buffer, ULONG in_size, void *out_buffer, ULONG out_size )
|
||||||
|
{
|
||||||
|
IO_STATUS_BLOCK io;
|
||||||
|
|
||||||
|
return NtDeviceIoControlFile( file, NULL, NULL, NULL, &io, code, in_buffer, in_size, out_buffer, out_size );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Tell Valgrind to ignore any holes in structs we will be passing to the
|
/* Tell Valgrind to ignore any holes in structs we will be passing to the
|
||||||
* server */
|
* server */
|
||||||
static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, ULONG in_size )
|
static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer, ULONG in_size )
|
||||||
|
|
|
@ -413,9 +413,7 @@ static void set_stdio_fd( int stdin_fd, int stdout_fd )
|
||||||
*/
|
*/
|
||||||
static BOOL is_unix_console_handle( HANDLE handle )
|
static BOOL is_unix_console_handle( HANDLE handle )
|
||||||
{
|
{
|
||||||
IO_STATUS_BLOCK io = {{0}};
|
return !sync_ioctl( handle, IOCTL_CONDRV_IS_UNIX, NULL, 0, NULL, 0 );
|
||||||
return !NtDeviceIoControlFile( handle, NULL, NULL, NULL, &io, IOCTL_CONDRV_IS_UNIX,
|
|
||||||
NULL, 0, NULL, 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -312,6 +312,8 @@ extern NTSTATUS set_thread_wow64_context( HANDLE handle, const void *ctx, ULONG
|
||||||
extern void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid );
|
extern void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid );
|
||||||
extern NTSTATUS open_hkcu_key( const char *path, HANDLE *key );
|
extern NTSTATUS open_hkcu_key( const char *path, HANDLE *key );
|
||||||
|
|
||||||
|
extern NTSTATUS sync_ioctl( HANDLE file, ULONG code, void *in_buffer, ULONG in_size,
|
||||||
|
void *out_buffer, ULONG out_size );
|
||||||
extern NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
|
extern NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
|
||||||
IO_STATUS_BLOCK *io, UINT code, void *in_buffer,
|
IO_STATUS_BLOCK *io, UINT code, void *in_buffer,
|
||||||
UINT in_size, void *out_buffer, UINT out_size );
|
UINT in_size, void *out_buffer, UINT out_size );
|
||||||
|
|
Loading…
Reference in a new issue