ntdll/tests: Fix compilation on systems that don't support nameless unions.
Francois Gouget
fgouget at free.fr
Thu Sep 12 16:55:33 CDT 2013
---
dlls/ntdll/tests/file.c | 106 ++++++++++++++++++++++++------------------------
1 file changed, 53 insertions(+), 53 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 86f8a77..26660c7 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -1930,68 +1930,68 @@ static void test_read_write(void)
LARGE_INTEGER offset;
LONG i;
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = 0;
status = pNtReadFile(INVALID_HANDLE_VALUE, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_OBJECT_TYPE_MISMATCH || status == STATUS_INVALID_HANDLE, "expected STATUS_OBJECT_TYPE_MISMATCH, got %#x\n", status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %lu\n", iob.Information);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = 0;
status = pNtWriteFile(INVALID_HANDLE_VALUE, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_OBJECT_TYPE_MISMATCH || status == STATUS_INVALID_HANDLE, "expected STATUS_OBJECT_TYPE_MISMATCH, got %#x\n", status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %lu\n", iob.Information);
hfile = create_temp_file(0);
if (!hfile) return;
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, NULL, sizeof(contents), NULL, NULL);
ok(status == STATUS_INVALID_USER_BUFFER, "expected STATUS_INVALID_USER_BUFFER, got %#x\n", status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %lu\n", iob.Information);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, NULL, sizeof(contents), NULL, NULL);
ok(status == STATUS_ACCESS_VIOLATION, "expected STATUS_ACCESS_VIOLATION, got %#x\n", status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %lu\n", iob.Information);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, 7, NULL, NULL);
ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == 7, "expected 7, got %lu\n", iob.Information);
SetFilePointer(hfile, 0, NULL, FILE_BEGIN);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)-1 /* FILE_WRITE_TO_END_OF_FILE */;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents + 7, sizeof(contents) - 7, &offset, NULL);
todo_wine
ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status);
todo_wine
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
todo_wine
ok(iob.Information == sizeof(contents) - 7, "expected sizeof(contents)-7, got %lu\n", iob.Information);
/* FIXME: Remove once Wine is fixed */
if (status != STATUS_SUCCESS)
{
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = 7;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents + 7, sizeof(contents) - 7, &offset, NULL);
ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == sizeof(contents) - 7, "expected sizeof(contents)-7, got %lu\n", iob.Information);
}
@@ -2018,34 +2018,34 @@ todo_wine
{
if (i == -2) continue;
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)i;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), &offset, NULL);
ok(status == STATUS_INVALID_PARAMETER, "%d: expected STATUS_INVALID_PARAMETER, got %#x\n", i, status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %ld\n", iob.Information);
}
SetFilePointer(hfile, sizeof(contents) - 4, NULL, FILE_BEGIN);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)-2 /* FILE_USE_FILE_POINTER_POSITION */;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, "DCBA", 4, &offset, NULL);
ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == 4, "expected 4, got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == sizeof(contents), "expected sizeof(contents), got %u\n", off);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), NULL, NULL);
ok(status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", status);
todo_wine
- ok(iob.Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", U(iob).Status);
todo_wine
ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information);
@@ -2073,12 +2073,12 @@ todo_wine
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == sizeof(contents), "expected sizeof(contents), got %u\n", off);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), NULL, NULL);
ok(status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", status);
todo_wine
- ok(iob.Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", U(iob).Status);
todo_wine
ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information);
@@ -2086,22 +2086,22 @@ todo_wine
{
if (i == -2) continue;
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)i;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_INVALID_PARAMETER, "%d: expected STATUS_INVALID_PARAMETER, got %#x\n", i, status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %ld\n", iob.Information);
}
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)-2 /* FILE_USE_FILE_POINTER_POSITION */;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", status);
todo_wine
- ok(iob.Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", U(iob).Status);
todo_wine
ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information);
@@ -2117,44 +2117,44 @@ todo_wine
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == sizeof(contents), "expected sizeof(contents), got %u\n", off);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), NULL, NULL);
ok(status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", status);
todo_wine
- ok(iob.Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", U(iob).Status);
todo_wine
ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = 0;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_SUCCESS, "NtReadFile error %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information);
ok(!memcmp(contents, buf, sizeof(contents)), "file contents mismatch\n");
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == sizeof(contents), "expected sizeof(contents), got %u\n", off);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = sizeof(contents) - 4;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, "DCBA", 4, &offset, NULL);
ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == 4, "expected 4, got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == sizeof(contents), "expected sizeof(contents), got %u\n", off);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = 0;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_SUCCESS, "NtReadFile error %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information);
ok(!memcmp(contents, buf, sizeof(contents) - 4), "file contents mismatch\n");
ok(!memcmp(buf + sizeof(contents) - 4, "DCBA", 4), "file contents mismatch\n");
@@ -2204,11 +2204,11 @@ todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ok(bytes == 0, "bytes %u\n", bytes);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), NULL, NULL);
ok(status == STATUS_INVALID_PARAMETER, "expected STATUS_INVALID_PARAMETER, got %#x\n", status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %ld\n", iob.Information);
for (i = -20; i < -1; i++)
@@ -2216,33 +2216,33 @@ todo_wine
/* FIXME: Remove once Wine is fixed */
if (i == -2) continue;
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)i;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), &offset, NULL);
ok(status == STATUS_INVALID_PARAMETER, "%d: expected STATUS_INVALID_PARAMETER, got %#x\n", i, status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %ld\n", iob.Information);
}
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)-2 /* FILE_USE_FILE_POINTER_POSITION */;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), &offset, NULL);
todo_wine
ok(status == STATUS_INVALID_PARAMETER, "expected STATUS_INVALID_PARAMETER, got %#x\n", status);
todo_wine
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
todo_wine
ok(iob.Information == -1, "expected -1, got %ld\n", iob.Information);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = 0;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), &offset, NULL);
todo_wine
ok(status == STATUS_PENDING || broken(status == STATUS_SUCCESS) /* see below */, "expected STATUS_PENDING, got %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information);
/* even fully updated XP passes this test, but it looks like some VMs
* in a testbot get never updated, so overlapped IO is broken. Instead
@@ -2270,21 +2270,21 @@ todo_wine
ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ok(bytes == 0, "bytes %u\n", bytes);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), NULL, NULL);
ok(status == STATUS_INVALID_PARAMETER, "expected STATUS_INVALID_PARAMETER, got %#x\n", status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %ld\n", iob.Information);
for (i = -20; i < 0; i++)
{
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)i;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_INVALID_PARAMETER, "%d: expected STATUS_INVALID_PARAMETER, got %#x\n", i, status);
- ok(iob.Status == -1, "expected -1, got %#x\n", iob.Status);
+ ok(U(iob).Status == -1, "expected -1, got %#x\n", U(iob).Status);
ok(iob.Information == -1, "expected -1, got %ld\n", iob.Information);
}
@@ -2328,12 +2328,12 @@ todo_wine
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == 0, "expected 0, got %u\n", off);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = sizeof(contents);
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %#x\n", status);
- ok(iob.Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", U(iob).Status);
ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
@@ -2341,7 +2341,7 @@ todo_wine
S(U(ovl)).Offset = offset.u.LowPart;
S(U(ovl)).OffsetHigh = offset.u.HighPart;
- ovl.Internal = iob.Status;
+ ovl.Internal = U(iob).Status;
ovl.InternalHigh = iob.Information;
ovl.hEvent = 0;
bytes = 0xdeadbeef;
@@ -2387,12 +2387,12 @@ todo_wine
SetEndOfFile(hfile);
SetFilePointer(hfile, 0, NULL, FILE_BEGIN);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = (LONGLONG)-1 /* FILE_WRITE_TO_END_OF_FILE */;
status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, "DCBA", 4, &offset, NULL);
ok(status == STATUS_PENDING || broken(status == STATUS_SUCCESS) /* before Vista */, "expected STATUS_PENDING, got %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == 4, "expected 4, got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
@@ -2404,12 +2404,12 @@ todo_wine
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
ok(off == 0, "expected 0, got %u\n", off);
- iob.Status = -1;
+ U(iob).Status = -1;
iob.Information = -1;
offset.QuadPart = 0;
status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL);
ok(status == STATUS_PENDING, "expected STATUS_PENDING, got %#x\n", status);
- ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);
+ ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status);
ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information);
off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT);
--
1.8.4.rc3
More information about the wine-patches
mailing list