Commit d5f23441 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use nameless unions/structs for IO_STATUS_BLOCK.

parent c3352feb
......@@ -30,7 +30,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winternl.h"
#include "wine/debug.h"
......
......@@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include "ntdll_test.h"
static NTSTATUS (WINAPI *pTpAllocCleanupGroup)(TP_CLEANUP_GROUP **);
......@@ -2018,7 +2016,7 @@ static void CALLBACK io_cb(TP_CALLBACK_INSTANCE *instance, void *userdata,
struct io_cb_ctx *ctx = userdata;
++ctx->count;
ctx->ovl = cvalue;
ctx->ret = iosb->u.Status;
ctx->ret = iosb->Status;
ctx->length = iosb->Information;
ctx->io = io;
}
......
......@@ -23,7 +23,6 @@
#include <stdarg.h>
#include <limits.h>
#define NONAMELESSUNION
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "winternl.h"
......@@ -483,10 +482,10 @@ static DWORD CALLBACK iocp_poller(LPVOID Arg)
DWORD transferred = 0;
DWORD err = 0;
if (iosb.u.Status == STATUS_SUCCESS)
if (iosb.Status == STATUS_SUCCESS)
transferred = iosb.Information;
else
err = RtlNtStatusToDosError(iosb.u.Status);
err = RtlNtStatusToDosError(iosb.Status);
callback( err, transferred, overlapped );
}
......@@ -1537,7 +1536,7 @@ static void CALLBACK ioqueue_thread_proc( void *param )
destroy = skip = FALSE;
io = (struct threadpool_object *)key;
TRACE( "io %p, iosb.Status %#lx.\n", io, iosb.u.Status );
TRACE( "io %p, iosb.Status %#lx.\n", io, iosb.Status );
if (io && (io->shutdown || io->u.io.shutting_down))
{
......
......@@ -117,7 +117,6 @@ typedef struct
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winternl.h"
#include "winioctl.h"
......@@ -3123,7 +3122,7 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
}
if (needs_close) close( fd );
error:
io->u.Status = status;
io->Status = status;
io->Information = sz;
if (event) NtSetEvent(event, NULL);
return status;
......
......@@ -111,7 +111,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winnt.h"
#include "winioctl.h"
......@@ -2050,13 +2049,13 @@ static NTSTATUS server_get_file_info( HANDLE handle, IO_STATUS_BLOCK *io, void *
req->handle = wine_server_obj_handle( handle );
req->info_class = info_class;
wine_server_set_reply( req, buffer, length );
io->u.Status = wine_server_call( req );
io->Status = wine_server_call( req );
io->Information = wine_server_reply_size( reply );
}
SERVER_END_REQ;
if (io->u.Status == STATUS_NOT_IMPLEMENTED)
if (io->Status == STATUS_NOT_IMPLEMENTED)
FIXME( "Unsupported info class %x\n", info_class );
return io->u.Status;
return io->Status;
}
......@@ -2685,7 +2684,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event, PIO_APC_ROUTI
if (!last_info) status = STATUS_NO_MORE_FILES;
else if (status == STATUS_MORE_ENTRIES) status = STATUS_SUCCESS;
io->u.Status = status;
io->Status = status;
}
if (cwd == -1 || fchdir( cwd ) == -1) chdir( "/" );
}
......@@ -4003,7 +4002,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
status = server_open_file_object( handle, access, &new_attr, sharing, options );
if (status == STATUS_SUCCESS) io->Information = FILE_OPENED;
free( nt_name.Buffer );
return io->u.Status = status;
return io->Status = status;
}
if (status == STATUS_NO_SUCH_FILE && disposition != FILE_OPEN && disposition != FILE_OVERWRITE)
......@@ -4064,7 +4063,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
}
free( nt_name.Buffer );
return io->u.Status = status;
return io->Status = status;
}
......@@ -4161,7 +4160,7 @@ NTSTATUS WINAPI NtCreateNamedPipeFile( HANDLE *handle, ULONG access, OBJECT_ATTR
SERVER_END_REQ;
free( objattr );
return io->u.Status = status;
return io->Status = status;
}
......@@ -4350,15 +4349,15 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
io->Information = 0;
if (class <= 0 || class >= FileMaximumInformation)
return io->u.Status = STATUS_INVALID_INFO_CLASS;
return io->Status = STATUS_INVALID_INFO_CLASS;
if (!info_sizes[class])
return server_get_file_info( handle, io, ptr, len, class );
if (len < info_sizes[class])
return io->u.Status = STATUS_INFO_LENGTH_MISMATCH;
return io->Status = STATUS_INFO_LENGTH_MISMATCH;
if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, &options )))
{
if (status != STATUS_BAD_DEVICE_TYPE) return io->u.Status = status;
if (status != STATUS_BAD_DEVICE_TYPE) return io->Status = status;
return server_get_file_info( handle, io, ptr, len, class );
}
......@@ -4550,7 +4549,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
}
if (needs_close) close( fd );
if (status == STATUS_SUCCESS && !io->Information) io->Information = info_sizes[class];
return io->u.Status = status;
return io->Status = status;
}
......@@ -4575,7 +4574,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
char *unix_name;
if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
return io->u.Status = status;
return io->Status = status;
if (server_get_unix_name( handle, &unix_name )) unix_name = NULL;
......@@ -4601,7 +4600,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
const FILE_POSITION_INFORMATION *info = ptr;
if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
return io->u.Status = status;
return io->Status = status;
if (lseek( fd, info->CurrentByteOffset.QuadPart, SEEK_SET ) == (off_t)-1)
status = errno_to_status( errno );
......@@ -4724,7 +4723,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
const FILE_VALID_DATA_LENGTH_INFORMATION *info = ptr;
if ((status = server_get_unix_fd( handle, FILE_WRITE_DATA, &fd, &needs_close, NULL, NULL )))
return io->u.Status = status;
return io->Status = status;
if (fstat( fd, &st ) == -1) status = errno_to_status( errno );
else if (info->ValidDataLength.QuadPart <= 0 || (off_t)info->ValidDataLength.QuadPart > st.st_size)
......@@ -4843,7 +4842,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
break;
}
io->Information = 0;
return io->u.Status = status;
return io->Status = status;
}
......@@ -5056,7 +5055,7 @@ static unsigned int server_read_file( HANDLE handle, HANDLE event, PIO_APC_ROUTI
options = reply->options;
if (wait_handle && status != STATUS_PENDING)
{
io->u.Status = status;
io->Status = status;
io->Information = wine_server_reply_size( reply );
}
}
......@@ -5094,7 +5093,7 @@ static unsigned int server_write_file( HANDLE handle, HANDLE event, PIO_APC_ROUT
options = reply->options;
if (wait_handle && status != STATUS_PENDING)
{
io->u.Status = status;
io->Status = status;
io->Information = reply->size;
}
}
......@@ -5135,7 +5134,7 @@ static NTSTATUS server_ioctl_file( HANDLE handle, HANDLE event,
options = reply->options;
if (wait_handle && status != STATUS_PENDING)
{
io->u.Status = status;
io->Status = status;
io->Information = wine_server_reply_size( reply );
}
}
......@@ -5523,7 +5522,7 @@ err:
if (needs_close) close( unix_handle );
if (status == STATUS_SUCCESS || (status == STATUS_END_OF_FILE && (!async_read || type == FD_TYPE_FILE)))
{
io->u.Status = status;
io->Status = status;
io->Information = total;
TRACE("= SUCCESS (%u)\n", total);
if (event) NtSetEvent( event, NULL );
......@@ -5604,7 +5603,7 @@ NTSTATUS WINAPI NtReadFileScatter( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap
send_completion = cvalue != 0;
if (needs_close) close( unix_handle );
io->u.Status = status;
io->Status = status;
io->Information = total;
TRACE("= 0x%08x (%u)\n", status, total);
if (event) NtSetEvent( event, NULL );
......@@ -5833,7 +5832,7 @@ err:
if (status == STATUS_SUCCESS)
{
io->u.Status = status;
io->Status = status;
io->Information = total;
TRACE("= SUCCESS (%u)\n", total);
if (event) NtSetEvent( event, NULL );
......@@ -5922,7 +5921,7 @@ NTSTATUS WINAPI NtWriteFileGather( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap
if (needs_close) close( unix_handle );
if (status == STATUS_SUCCESS)
{
io->u.Status = status;
io->Status = status;
io->Information = total;
TRACE("= SUCCESS (%u)\n", total);
if (event) NtSetEvent( event, NULL );
......@@ -5986,7 +5985,7 @@ NTSTATUS WINAPI NtDeviceIoControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUT
return server_ioctl_file( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
if (status != STATUS_PENDING && !NT_ERROR(status)) io->u.Status = status;
if (status != STATUS_PENDING && !NT_ERROR(status)) io->Status = status;
return status;
}
......@@ -6118,7 +6117,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
in_buffer, in_size, out_buffer, out_size );
}
if (status != STATUS_PENDING) io->u.Status = status;
if (status != STATUS_PENDING) io->Status = status;
return status;
}
......@@ -6142,7 +6141,7 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE handle, IO_STATUS_BLOCK *io )
if (!ret && (type == FD_TYPE_FILE || type == FD_TYPE_DIR || type == FD_TYPE_CHAR))
{
if (fsync(fd)) ret = errno_to_status( errno );
io->u.Status = ret;
io->Status = ret;
io->Information = 0;
}
else if (!ret && type == FD_TYPE_SERIAL)
......@@ -6165,7 +6164,7 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE handle, IO_STATUS_BLOCK *io )
wait_handle = wine_server_ptr_handle( reply->event );
if (wait_handle && ret != STATUS_PENDING)
{
io->u.Status = ret;
io->Status = ret;
io->Information = 0;
}
}
......@@ -6196,7 +6195,7 @@ NTSTATUS WINAPI NtCancelIoFile( HANDLE handle, IO_STATUS_BLOCK *io_status )
req->only_thread = TRUE;
if (!(status = wine_server_call( req )))
{
io_status->u.Status = status;
io_status->Status = status;
io_status->Information = 0;
}
}
......@@ -6221,7 +6220,7 @@ NTSTATUS WINAPI NtCancelIoFileEx( HANDLE handle, IO_STATUS_BLOCK *io, IO_STATUS_
req->iosb = wine_server_client_ptr( io );
if (!(status = wine_server_call( req )))
{
io_status->u.Status = status;
io_status->Status = status;
io_status->Information = 0;
}
}
......@@ -6248,7 +6247,7 @@ NTSTATUS WINAPI NtCancelSynchronousIoFile( HANDLE handle, IO_STATUS_BLOCK *io, I
}
SERVER_END_REQ;
io_status->u.Status = status;
io_status->Status = status;
io_status->Information = 0;
return status;
}
......@@ -6696,7 +6695,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io
status = wine_server_call( req );
if (status != STATUS_PENDING)
{
io->u.Status = status;
io->Status = status;
io->Information = wine_server_reply_size( reply );
}
wait_handle = wine_server_ptr_handle( reply->wait );
......@@ -6706,7 +6705,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io
if (wait_handle) status = wait_async( wait_handle, FALSE );
return status;
}
else if (status) return io->u.Status = status;
else if (status) return io->Status = status;
io->Information = 0;
......@@ -6900,7 +6899,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io
break;
}
if (needs_close) close( fd );
return io->u.Status = status;
return io->Status = status;
}
......
......@@ -49,7 +49,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winternl.h"
#include "winioctl.h"
......@@ -1310,7 +1309,7 @@ static NTSTATUS io_control( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, vo
}
if (needs_close) close( fd );
error:
io->u.Status = status;
io->Status = status;
io->Information = sz;
if (event && status != STATUS_PENDING) NtSetEvent(event, NULL);
return status;
......
......@@ -57,7 +57,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winternl.h"
#include "ddk/wdm.h"
......@@ -1686,7 +1685,7 @@ NTSTATUS WINAPI NtSetIntervalProfile( ULONG interval, KPROFILE_SOURCE source )
ULONG WINAPI NtGetTickCount(void)
{
/* note: we ignore TickCountMultiplier */
return user_shared_data->u.TickCount.LowPart;
return user_shared_data->TickCount.LowPart;
}
......@@ -1899,7 +1898,7 @@ NTSTATUS WINAPI NtRemoveIoCompletion( HANDLE handle, ULONG_PTR *key, ULONG_PTR *
*key = reply->ckey;
*value = reply->cvalue;
io->Information = reply->information;
io->u.Status = reply->status;
io->Status = reply->status;
}
}
SERVER_END_REQ;
......@@ -1933,7 +1932,7 @@ NTSTATUS WINAPI NtRemoveIoCompletionEx( HANDLE handle, FILE_IO_COMPLETION_INFORM
info[i].CompletionKey = reply->ckey;
info[i].CompletionValue = reply->cvalue;
info[i].IoStatusBlock.Information = reply->information;
info[i].IoStatusBlock.u.Status = reply->status;
info[i].IoStatusBlock.Status = reply->status;
}
}
SERVER_END_REQ;
......
......@@ -55,7 +55,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winternl.h"
#include "winioctl.h"
......@@ -582,7 +581,7 @@ NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc,
if (needs_close) close( fd );
error:
io->u.Status = status;
io->Status = status;
io->Information = sz;
if (event) NtSetEvent( event, NULL );
return status;
......
......@@ -433,21 +433,13 @@ static inline void set_async_iosb( client_ptr_t iosb, NTSTATUS status, ULONG_PTR
{
IO_STATUS_BLOCK *io = wine_server_get_ptr( iosb );
io->Information = info;
#ifdef NONAMELESSUNION
WriteRelease( &io->u.Status, status );
#else
WriteRelease( &io->Status, status );
#endif
}
}
static inline client_ptr_t iosb_client_ptr( IO_STATUS_BLOCK *io )
{
#ifdef NONAMELESSUNION
if (io && in_wow64_call()) return wine_server_client_ptr( io->u.Pointer );
#else
if (io && in_wow64_call()) return wine_server_client_ptr( io->Pointer );
#endif
return wine_server_client_ptr( io );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment