Commit 0d2046cc authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Use nameless unions/structs for IO_STATUS_BLOCK.

parent 4f6a40b1
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#define NONAMELESSUNION
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "winerror.h" #include "winerror.h"
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
...@@ -75,7 +73,7 @@ static BOOL oem_file_apis; ...@@ -75,7 +73,7 @@ static BOOL oem_file_apis;
static void WINAPI read_write_apc( void *apc_user, PIO_STATUS_BLOCK io, ULONG reserved ) static void WINAPI read_write_apc( void *apc_user, PIO_STATUS_BLOCK io, ULONG reserved )
{ {
LPOVERLAPPED_COMPLETION_ROUTINE func = apc_user; LPOVERLAPPED_COMPLETION_ROUTINE func = apc_user;
func( RtlNtStatusToDosError( io->u.Status ), io->Information, (LPOVERLAPPED)io ); func( RtlNtStatusToDosError( io->Status ), io->Information, (LPOVERLAPPED)io );
} }
static const WCHAR *get_machine_wow64_dir( WORD machine ) static const WCHAR *get_machine_wow64_dir( WORD machine )
...@@ -3230,12 +3228,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH LockFileEx( HANDLE file, DWORD flags, DWORD reserv ...@@ -3230,12 +3228,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH LockFileEx( HANDLE file, DWORD flags, DWORD reserv
} }
TRACE( "%p %lx%08lx %lx%08lx flags %lx\n", TRACE( "%p %lx%08lx %lx%08lx flags %lx\n",
file, overlapped->u.s.OffsetHigh, overlapped->u.s.Offset, count_high, count_low, flags ); file, overlapped->OffsetHigh, overlapped->Offset, count_high, count_low, flags );
count.u.LowPart = count_low; count.u.LowPart = count_low;
count.u.HighPart = count_high; count.u.HighPart = count_high;
offset.u.LowPart = overlapped->u.s.Offset; offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh; offset.u.HighPart = overlapped->OffsetHigh;
if (((ULONG_PTR)overlapped->hEvent & 1) == 0) cvalue = overlapped; if (((ULONG_PTR)overlapped->hEvent & 1) == 0) cvalue = overlapped;
...@@ -3276,7 +3274,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileById( HANDLE handle, LPFILE_ID_DESCRIPTO ...@@ -3276,7 +3274,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileById( HANDLE handle, LPFILE_ID_DESCRIPTO
flags &= FILE_ATTRIBUTE_VALID_FLAGS; flags &= FILE_ATTRIBUTE_VALID_FLAGS;
objectName.Length = sizeof(ULONGLONG); objectName.Length = sizeof(ULONGLONG);
objectName.Buffer = (WCHAR *)&id->u.FileId; objectName.Buffer = (WCHAR *)&id->FileId;
attr.Length = sizeof(attr); attr.Length = sizeof(attr);
attr.RootDirectory = handle; attr.RootDirectory = handle;
attr.Attributes = 0; attr.Attributes = 0;
...@@ -3336,7 +3334,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH ReOpenFile( HANDLE handle, DWORD access, DWORD s ...@@ -3336,7 +3334,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH ReOpenFile( HANDLE handle, DWORD access, DWORD s
static void WINAPI invoke_completion( void *context, IO_STATUS_BLOCK *io, ULONG res ) static void WINAPI invoke_completion( void *context, IO_STATUS_BLOCK *io, ULONG res )
{ {
LPOVERLAPPED_COMPLETION_ROUTINE completion = context; LPOVERLAPPED_COMPLETION_ROUTINE completion = context;
completion( RtlNtStatusToDosError( io->u.Status ), io->Information, (LPOVERLAPPED)io ); completion( RtlNtStatusToDosError( io->Status ), io->Information, (LPOVERLAPPED)io );
} }
/**************************************************************************** /****************************************************************************
...@@ -3369,7 +3367,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadDirectoryChangesW( HANDLE handle, LPVOID buffe ...@@ -3369,7 +3367,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadDirectoryChangesW( HANDLE handle, LPVOID buffe
} }
ios = (PIO_STATUS_BLOCK)pov; ios = (PIO_STATUS_BLOCK)pov;
ios->u.Status = STATUS_PENDING; ios->Status = STATUS_PENDING;
status = NtNotifyChangeDirectoryFile( handle, completion && overlapped ? NULL : pov->hEvent, status = NtNotifyChangeDirectoryFile( handle, completion && overlapped ? NULL : pov->hEvent,
completion && overlapped ? invoke_completion : NULL, completion && overlapped ? invoke_completion : NULL,
...@@ -3379,7 +3377,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadDirectoryChangesW( HANDLE handle, LPVOID buffe ...@@ -3379,7 +3377,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadDirectoryChangesW( HANDLE handle, LPVOID buffe
if (overlapped) return TRUE; if (overlapped) return TRUE;
WaitForSingleObjectEx( ov.hEvent, INFINITE, TRUE ); WaitForSingleObjectEx( ov.hEvent, INFINITE, TRUE );
if (returned) *returned = ios->Information; if (returned) *returned = ios->Information;
status = ios->u.Status; status = ios->Status;
} }
if (!overlapped) CloseHandle( ov.hEvent ); if (!overlapped) CloseHandle( ov.hEvent );
return set_ntstatus( status ); return set_ntstatus( status );
...@@ -3406,22 +3404,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadFile( HANDLE file, LPVOID buffer, DWORD count, ...@@ -3406,22 +3404,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadFile( HANDLE file, LPVOID buffer, DWORD count,
if (overlapped) if (overlapped)
{ {
offset.u.LowPart = overlapped->u.s.Offset; offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh; offset.u.HighPart = overlapped->OffsetHigh;
poffset = &offset; poffset = &offset;
event = overlapped->hEvent; event = overlapped->hEvent;
io_status = (PIO_STATUS_BLOCK)overlapped; io_status = (PIO_STATUS_BLOCK)overlapped;
if (((ULONG_PTR)event & 1) == 0) cvalue = overlapped; if (((ULONG_PTR)event & 1) == 0) cvalue = overlapped;
} }
else io_status->Information = 0; else io_status->Information = 0;
io_status->u.Status = STATUS_PENDING; io_status->Status = STATUS_PENDING;
status = NtReadFile( file, event, NULL, cvalue, io_status, buffer, count, poffset, NULL); status = NtReadFile( file, event, NULL, cvalue, io_status, buffer, count, poffset, NULL);
if (status == STATUS_PENDING && !overlapped) if (status == STATUS_PENDING && !overlapped)
{ {
WaitForSingleObject( file, INFINITE ); WaitForSingleObject( file, INFINITE );
status = io_status->u.Status; status = io_status->Status;
} }
if (result) *result = overlapped && status ? 0 : io_status->Information; if (result) *result = overlapped && status ? 0 : io_status->Information;
...@@ -3461,10 +3459,10 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadFileEx( HANDLE file, LPVOID buffer, DWORD coun ...@@ -3461,10 +3459,10 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadFileEx( HANDLE file, LPVOID buffer, DWORD coun
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
offset.u.LowPart = overlapped->u.s.Offset; offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh; offset.u.HighPart = overlapped->OffsetHigh;
io = (PIO_STATUS_BLOCK)overlapped; io = (PIO_STATUS_BLOCK)overlapped;
io->u.Status = STATUS_PENDING; io->Status = STATUS_PENDING;
io->Information = 0; io->Information = 0;
status = NtReadFile( file, NULL, read_write_apc, completion, io, buffer, count, &offset, NULL); status = NtReadFile( file, NULL, read_write_apc, completion, io, buffer, count, &offset, NULL);
...@@ -3485,11 +3483,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadFileScatter( HANDLE file, FILE_SEGMENT_ELEMENT ...@@ -3485,11 +3483,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReadFileScatter( HANDLE file, FILE_SEGMENT_ELEMENT
TRACE( "(%p %p %lu %p)\n", file, segments, count, overlapped ); TRACE( "(%p %p %lu %p)\n", file, segments, count, overlapped );
offset.u.LowPart = overlapped->u.s.Offset; offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh; offset.u.HighPart = overlapped->OffsetHigh;
if (!((ULONG_PTR)overlapped->hEvent & 1)) cvalue = overlapped; if (!((ULONG_PTR)overlapped->hEvent & 1)) cvalue = overlapped;
io = (PIO_STATUS_BLOCK)overlapped; io = (PIO_STATUS_BLOCK)overlapped;
io->u.Status = STATUS_PENDING; io->Status = STATUS_PENDING;
io->Information = 0; io->Information = 0;
return set_ntstatus( NtReadFileScatter( file, overlapped->hEvent, NULL, cvalue, io, return set_ntstatus( NtReadFileScatter( file, overlapped->hEvent, NULL, cvalue, io,
...@@ -3702,7 +3700,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetFilePointerEx( HANDLE file, LARGE_INTEGER dista ...@@ -3702,7 +3700,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetFilePointerEx( HANDLE file, LARGE_INTEGER dista
} }
error: error:
return set_ntstatus( io.u.Status ); return set_ntstatus( io.Status );
} }
...@@ -3779,7 +3777,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH UnlockFileEx( HANDLE file, DWORD reserved, ...@@ -3779,7 +3777,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH UnlockFileEx( HANDLE file, DWORD reserved,
} }
if (overlapped->hEvent) FIXME("Unimplemented overlapped operation\n"); if (overlapped->hEvent) FIXME("Unimplemented overlapped operation\n");
return UnlockFile( file, overlapped->u.s.Offset, overlapped->u.s.OffsetHigh, count_low, count_high ); return UnlockFile( file, overlapped->Offset, overlapped->OffsetHigh, count_low, count_high );
} }
...@@ -3801,22 +3799,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteFile( HANDLE file, LPCVOID buffer, DWORD coun ...@@ -3801,22 +3799,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteFile( HANDLE file, LPCVOID buffer, DWORD coun
if (overlapped) if (overlapped)
{ {
offset.u.LowPart = overlapped->u.s.Offset; offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh; offset.u.HighPart = overlapped->OffsetHigh;
poffset = &offset; poffset = &offset;
event = overlapped->hEvent; event = overlapped->hEvent;
piosb = (PIO_STATUS_BLOCK)overlapped; piosb = (PIO_STATUS_BLOCK)overlapped;
if (((ULONG_PTR)event & 1) == 0) cvalue = overlapped; if (((ULONG_PTR)event & 1) == 0) cvalue = overlapped;
} }
else piosb->Information = 0; else piosb->Information = 0;
piosb->u.Status = STATUS_PENDING; piosb->Status = STATUS_PENDING;
status = NtWriteFile( file, event, NULL, cvalue, piosb, buffer, count, poffset, NULL ); status = NtWriteFile( file, event, NULL, cvalue, piosb, buffer, count, poffset, NULL );
if (status == STATUS_PENDING && !overlapped) if (status == STATUS_PENDING && !overlapped)
{ {
WaitForSingleObject( file, INFINITE ); WaitForSingleObject( file, INFINITE );
status = piosb->u.Status; status = piosb->Status;
} }
if (result) *result = overlapped && status ? 0 : piosb->Information; if (result) *result = overlapped && status ? 0 : piosb->Information;
...@@ -3848,11 +3846,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteFileEx( HANDLE file, LPCVOID buffer, ...@@ -3848,11 +3846,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteFileEx( HANDLE file, LPCVOID buffer,
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return FALSE; return FALSE;
} }
offset.u.LowPart = overlapped->u.s.Offset; offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh; offset.u.HighPart = overlapped->OffsetHigh;
io = (PIO_STATUS_BLOCK)overlapped; io = (PIO_STATUS_BLOCK)overlapped;
io->u.Status = STATUS_PENDING; io->Status = STATUS_PENDING;
io->Information = 0; io->Information = 0;
status = NtWriteFile( file, NULL, read_write_apc, completion, io, buffer, count, &offset, NULL ); status = NtWriteFile( file, NULL, read_write_apc, completion, io, buffer, count, &offset, NULL );
...@@ -3873,11 +3871,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteFileGather( HANDLE file, FILE_SEGMENT_ELEMENT ...@@ -3873,11 +3871,11 @@ BOOL WINAPI DECLSPEC_HOTPATCH WriteFileGather( HANDLE file, FILE_SEGMENT_ELEMENT
TRACE( "%p %p %lu %p\n", file, segments, count, overlapped ); TRACE( "%p %p %lu %p\n", file, segments, count, overlapped );
offset.u.LowPart = overlapped->u.s.Offset; offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh; offset.u.HighPart = overlapped->OffsetHigh;
if (!((ULONG_PTR)overlapped->hEvent & 1)) cvalue = overlapped; if (!((ULONG_PTR)overlapped->hEvent & 1)) cvalue = overlapped;
io = (PIO_STATUS_BLOCK)overlapped; io = (PIO_STATUS_BLOCK)overlapped;
io->u.Status = STATUS_PENDING; io->Status = STATUS_PENDING;
io->Information = 0; io->Information = 0;
return set_ntstatus( NtWriteFileGather( file, overlapped->hEvent, NULL, cvalue, return set_ntstatus( NtWriteFileGather( file, overlapped->hEvent, NULL, cvalue,
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wincon.h" #include "wincon.h"
...@@ -183,7 +182,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetSystemTimes( FILETIME *idle, FILETIME *kernel, ...@@ -183,7 +182,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetSystemTimes( FILETIME *idle, FILETIME *kernel,
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void) ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
{ {
/* note: we ignore TickCountMultiplier */ /* note: we ignore TickCountMultiplier */
return user_shared_data->u.TickCount.LowPart; return user_shared_data->TickCount.LowPart;
} }
...@@ -196,10 +195,10 @@ ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void) ...@@ -196,10 +195,10 @@ ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
do do
{ {
high = user_shared_data->u.TickCount.High1Time; high = user_shared_data->TickCount.High1Time;
low = user_shared_data->u.TickCount.LowPart; low = user_shared_data->TickCount.LowPart;
} }
while (high != user_shared_data->u.TickCount.High2Time); while (high != user_shared_data->TickCount.High2Time);
/* note: we ignore TickCountMultiplier */ /* note: we ignore TickCountMultiplier */
return (ULONGLONG)high << 32 | low; return (ULONGLONG)high << 32 | low;
} }
...@@ -1128,8 +1127,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetQueuedCompletionStatus( HANDLE port, LPDWORD co ...@@ -1128,8 +1127,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetQueuedCompletionStatus( HANDLE port, LPDWORD co
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
{ {
*count = iosb.Information; *count = iosb.Information;
if (iosb.u.Status >= 0) return TRUE; if (iosb.Status >= 0) return TRUE;
SetLastError( RtlNtStatusToDosError(iosb.u.Status) ); SetLastError( RtlNtStatusToDosError(iosb.Status) );
return FALSE; return FALSE;
} }
...@@ -1231,7 +1230,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH ConnectNamedPipe( HANDLE pipe, LPOVERLAPPED overla ...@@ -1231,7 +1230,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH ConnectNamedPipe( HANDLE pipe, LPOVERLAPPED overla
if (status == STATUS_PENDING && !overlapped) if (status == STATUS_PENDING && !overlapped)
{ {
WaitForSingleObject( pipe, INFINITE ); WaitForSingleObject( pipe, INFINITE );
status = status_block.u.Status; status = status_block.Status;
} }
return set_ntstatus( status ); return set_ntstatus( status );
} }
...@@ -1533,7 +1532,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH TransactNamedPipe( HANDLE handle, LPVOID write_buf ...@@ -1533,7 +1532,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH TransactNamedPipe( HANDLE handle, LPVOID write_buf
if (status == STATUS_PENDING && !overlapped) if (status == STATUS_PENDING && !overlapped)
{ {
WaitForSingleObject(handle, INFINITE); WaitForSingleObject(handle, INFINITE);
status = iosb->u.Status; status = iosb->Status;
} }
if (bytes_read) *bytes_read = overlapped && status ? 0 : iosb->Information; if (bytes_read) *bytes_read = overlapped && status ? 0 : iosb->Information;
......
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