Commit 75b93ff1 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Match OVERLAPPED structure to the SDK definition.

parent 99042cfe
......@@ -1975,8 +1975,8 @@ static BOOL COMM_WaitCommEvent(
commio->fd = fd; /* FIXME */
lpOverlapped->InternalHigh = 0;
lpOverlapped->Offset = 0;
lpOverlapped->OffsetHigh = 0;
lpOverlapped->u.s.Offset = 0;
lpOverlapped->u.s.OffsetHigh = 0;
SERVER_START_REQ( register_async )
{
......
......@@ -323,8 +323,8 @@ BOOL WINAPI ReadFileEx(HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
return FALSE;
}
offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->OffsetHigh;
offset.u.LowPart = overlapped->u.s.Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh;
io_status = (PIO_STATUS_BLOCK)overlapped;
io_status->u.Status = STATUS_PENDING;
......@@ -364,8 +364,8 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
if (overlapped != NULL)
{
offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->OffsetHigh;
offset.u.LowPart = overlapped->u.s.Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh;
poffset = &offset;
hEvent = overlapped->hEvent;
io_status = (PIO_STATUS_BLOCK)overlapped;
......@@ -405,8 +405,8 @@ BOOL WINAPI WriteFileEx(HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->OffsetHigh;
offset.u.LowPart = overlapped->u.s.Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh;
io_status = (PIO_STATUS_BLOCK)overlapped;
io_status->u.Status = STATUS_PENDING;
......@@ -439,8 +439,8 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
if (overlapped)
{
offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->OffsetHigh;
offset.u.LowPart = overlapped->u.s.Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh;
poffset = &offset;
hEvent = overlapped->hEvent;
piosb = (PIO_STATUS_BLOCK)overlapped;
......@@ -999,13 +999,13 @@ BOOL WINAPI LockFileEx( HANDLE hFile, DWORD flags, DWORD reserved,
}
TRACE( "%p %lx%08lx %lx%08lx flags %lx\n",
hFile, overlapped->OffsetHigh, overlapped->Offset,
hFile, overlapped->u.s.OffsetHigh, overlapped->u.s.Offset,
count_high, count_low, flags );
count.u.LowPart = count_low;
count.u.HighPart = count_high;
offset.u.LowPart = overlapped->Offset;
offset.u.HighPart = overlapped->OffsetHigh;
offset.u.LowPart = overlapped->u.s.Offset;
offset.u.HighPart = overlapped->u.s.OffsetHigh;
status = NtLockFile( hFile, overlapped->hEvent, NULL, NULL,
NULL, &offset, &count, NULL,
......@@ -1050,7 +1050,7 @@ BOOL WINAPI UnlockFileEx( HANDLE hFile, DWORD reserved, DWORD count_low, DWORD c
}
if (overlapped->hEvent) FIXME("Unimplemented overlapped operation\n");
return UnlockFile( hFile, overlapped->Offset, overlapped->OffsetHigh, count_low, count_high );
return UnlockFile( hFile, overlapped->u.s.Offset, overlapped->u.s.OffsetHigh, count_low, count_high );
}
......
......@@ -28,6 +28,17 @@
#include "winbase.h"
#include "winerror.h"
#ifdef NONAMELESSUNION
# define U(x) (x).u
#else
# define U(x) (x)
#endif
#ifdef NONAMELESSSTRUCT
# define S(x) (x).s
#else
# define S(x) (x)
#endif
static int dll_capable(const char *dll, const char *function)
{
HMODULE module = GetModuleHandleA(dll);
......@@ -912,8 +923,8 @@ static void test_offset_in_overlapped_structure(void)
ok(done == sizeof(buf), "expected number of bytes written %lu\n", done);
memset(&ov, 0, sizeof(ov));
ov.Offset = PATTERN_OFFSET;
ov.OffsetHigh = 0;
S(U(ov)).Offset = PATTERN_OFFSET;
S(U(ov)).OffsetHigh = 0;
rc=WriteFile(hFile, pattern, sizeof(pattern), &done, &ov);
/* Win 9x does not support the overlapped I/O on files */
if (rc || GetLastError()!=ERROR_INVALID_PARAMETER) {
......@@ -923,8 +934,8 @@ static void test_offset_in_overlapped_structure(void)
ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (PATTERN_OFFSET + sizeof(pattern)),
"expected file offset %d\n", PATTERN_OFFSET + sizeof(pattern));
ov.Offset = sizeof(buf) * 2;
ov.OffsetHigh = 0;
S(U(ov)).Offset = sizeof(buf) * 2;
S(U(ov)).OffsetHigh = 0;
ret = WriteFile(hFile, pattern, sizeof(pattern), &done, &ov);
ok( ret, "WriteFile error %ld\n", GetLastError());
ok(done == sizeof(pattern), "expected number of bytes written %lu\n", done);
......@@ -942,8 +953,8 @@ static void test_offset_in_overlapped_structure(void)
memset(buf, 0, sizeof(buf));
memset(&ov, 0, sizeof(ov));
ov.Offset = PATTERN_OFFSET;
ov.OffsetHigh = 0;
S(U(ov)).Offset = PATTERN_OFFSET;
S(U(ov)).OffsetHigh = 0;
rc=ReadFile(hFile, buf, sizeof(pattern), &done, &ov);
/* Win 9x does not support the overlapped I/O on files */
if (rc || GetLastError()!=ERROR_INVALID_PARAMETER) {
......@@ -1001,8 +1012,8 @@ static void test_LockFile(void)
ok( !UnlockFile( handle, 10, 0, 20, 0 ), "UnlockFile 10,20 again succeeded\n" );
ok( UnlockFile( handle, 5, 0, 5, 0 ), "UnlockFile 5,5 failed\n" );
overlapped.Offset = 100;
overlapped.OffsetHigh = 0;
S(U(overlapped)).Offset = 100;
S(U(overlapped)).OffsetHigh = 0;
overlapped.hEvent = 0;
lockfileex_capable = dll_capable("kernel32", "LockFileEx");
......@@ -1018,7 +1029,7 @@ static void test_LockFile(void)
}
/* overlapping shared locks are OK */
overlapped.Offset = 150;
S(U(overlapped)).Offset = 150;
limited_UnLockFile || ok( LockFileEx( handle, 0, 0, 100, 0, &overlapped ), "LockFileEx 150,100 failed\n" );
/* but exclusive is not */
......@@ -1031,7 +1042,7 @@ static void test_LockFile(void)
{
if (!UnlockFileEx( handle, 0, 100, 0, &overlapped ))
{ /* UnLockFile is capable. */
overlapped.Offset = 100;
S(U(overlapped)).Offset = 100;
ok( !UnlockFileEx( handle, 0, 100, 0, &overlapped ),
"UnlockFileEx 150,100 again succeeded\n" );
}
......@@ -1299,8 +1310,8 @@ static void test_async_file_errors(void)
HANDLE hFile;
LPVOID lpBuffer = HeapAlloc(GetProcessHeap(), 0, 4096);
OVERLAPPED ovl;
ovl.Offset = 0;
ovl.OffsetHigh = 0;
S(U(ovl)).Offset = 0;
S(U(ovl)).OffsetHigh = 0;
ovl.hEvent = hSem;
completion_count = 0;
szFile[0] = '\0';
......@@ -1317,7 +1328,7 @@ static void test_async_file_errors(void)
/*printf("Offset = %ld, result = %s\n", ovl.Offset, res ? "TRUE" : "FALSE");*/
if (!res)
break;
ovl.Offset += 4096;
S(U(ovl)).Offset += 4096;
/* i/o completion routine only called if ReadFileEx returned success.
* we only care about violations of this rule so undo what should have
* been done */
......
......@@ -835,10 +835,10 @@ static void test_pack_OVERLAPPED(void)
{
/* OVERLAPPED (pack 4) */
TEST_TYPE(OVERLAPPED, 20, 4);
TEST_FIELD(OVERLAPPED, DWORD, Internal, 0, 4, 4);
TEST_FIELD(OVERLAPPED, DWORD, InternalHigh, 4, 4, 4);
TEST_FIELD(OVERLAPPED, DWORD, Offset, 8, 4, 4);
TEST_FIELD(OVERLAPPED, DWORD, OffsetHigh, 12, 4, 4);
TEST_FIELD(OVERLAPPED, ULONG_PTR, Internal, 0, 4, 4);
TEST_FIELD(OVERLAPPED, ULONG_PTR, InternalHigh, 4, 4, 4);
/*TEST_FIELD(OVERLAPPED, DWORD, Offset, 8, 4, 4);*/
/*TEST_FIELD(OVERLAPPED, DWORD, OffsetHigh, 12, 4, 4);*/
TEST_FIELD(OVERLAPPED, HANDLE, hEvent, 16, 4, 4);
}
......
......@@ -25,6 +25,9 @@
#include <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
......
......@@ -18,6 +18,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "quartz_private.h"
#include "wine/debug.h"
......@@ -966,8 +969,8 @@ static HRESULT WINAPI FileAsyncReader_Request(IAsyncReader * iface, IMediaSample
{
DWORD dwLength = (DWORD) BYTES_FROM_MEDIATIME(Stop - Start);
pDataRq->ovl.Offset = (DWORD) BYTES_FROM_MEDIATIME(Start);
pDataRq->ovl.OffsetHigh = (DWORD)(BYTES_FROM_MEDIATIME(Start) >> (sizeof(DWORD) * 8));
pDataRq->ovl.u.s.Offset = (DWORD) BYTES_FROM_MEDIATIME(Start);
pDataRq->ovl.u.s.OffsetHigh = (DWORD)(BYTES_FROM_MEDIATIME(Start) >> (sizeof(DWORD) * 8));
pDataRq->ovl.hEvent = This->hEvent;
pDataRq->dwUserData = dwUser;
pDataRq->pNext = NULL;
......@@ -1120,8 +1123,8 @@ static HRESULT WINAPI FileAsyncReader_SyncRead(IAsyncReader * iface, LONGLONG ll
ovl.hEvent = CreateEventW(NULL, 0, 0, NULL);
/* NOTE: llPosition is the actual byte position to start reading from */
ovl.Offset = (DWORD) llPosition;
ovl.OffsetHigh = (DWORD) (llPosition >> (sizeof(DWORD) * 8));
ovl.u.s.Offset = (DWORD) llPosition;
ovl.u.s.OffsetHigh = (DWORD) (llPosition >> (sizeof(DWORD) * 8));
if (!ReadFile(This->hFile, pBuffer, lLength, NULL, &ovl))
hr = HRESULT_FROM_WIN32(GetLastError());
......
......@@ -32,6 +32,9 @@
#include <string.h>
#include <time.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
......
......@@ -2993,7 +2993,7 @@ BOOL WINAPI WSAGetOverlappedResult( SOCKET s, LPWSAOVERLAPPED lpOverlapped,
*lpcbTransfer = lpOverlapped->InternalHigh;
if ( lpdwFlags )
*lpdwFlags = lpOverlapped->Offset;
*lpdwFlags = lpOverlapped->u.s.Offset;
switch ( lpOverlapped->Internal )
{
......
......@@ -485,10 +485,25 @@ typedef struct _SYSTEMTIME{
/* The 'overlapped' data structure used by async I/O functions.
*/
typedef struct _OVERLAPPED {
DWORD Internal;
DWORD InternalHigh;
DWORD Offset;
DWORD OffsetHigh;
#ifdef WORDS_BIGENDIAN
ULONG_PTR InternalHigh;
ULONG_PTR Internal;
#else
ULONG_PTR Internal;
ULONG_PTR InternalHigh;
#endif
union {
struct {
#ifdef WORDS_BIGENDIAN
DWORD OffsetHigh;
DWORD Offset;
#else
DWORD Offset;
DWORD OffsetHigh;
#endif
} DUMMYSTRUCTNAME;
PVOID Pointer;
} DUMMYUNIONNAME;
HANDLE hEvent;
} OVERLAPPED, *LPOVERLAPPED;
......
......@@ -1366,7 +1366,7 @@ typedef struct _INTERNET_CACHE_ENTRY_INFOA {
union {
DWORD dwReserved;
DWORD dwExemptDelta;
} u;
} DUMMYUNIONNAME;
} INTERNET_CACHE_ENTRY_INFOA,* LPINTERNET_CACHE_ENTRY_INFOA;
typedef struct _INTERNET_CACHE_ENTRY_INFOW {
......@@ -1389,7 +1389,7 @@ typedef struct _INTERNET_CACHE_ENTRY_INFOW {
union {
DWORD dwReserved;
DWORD dwExemptDelta;
} u;
} DUMMYUNIONNAME;
} INTERNET_CACHE_ENTRY_INFOW,* LPINTERNET_CACHE_ENTRY_INFOW;
DECL_WINELIB_TYPE_AW(INTERNET_CACHE_ENTRY_INFO)
......
......@@ -2189,7 +2189,7 @@ typedef struct _IMAGE_IMPORT_DESCRIPTOR {
union {
DWORD Characteristics; /* 0 for terminating null import descriptor */
PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */
} u;
} DUMMYUNIONNAME;
DWORD TimeDateStamp; /* 0 if not bound,
* -1 if bound, and real date\time stamp
* in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
......
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