Module: wine Branch: master Commit: aa14c2daa5e390b74d0a4f60c1f1d80afe84d21b URL: http://source.winehq.org/git/wine.git/?a=commit;h=aa14c2daa5e390b74d0a4f60c1...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Wed Aug 21 18:33:46 2013 +0900
ntdll/tests: Add the tests for some error cases.
---
dlls/ntdll/tests/file.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 879c3f2..e30ada0 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -1941,11 +1941,41 @@ static void test_read_write(void) DWORD ret, bytes, status; LARGE_INTEGER offset;
+ 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(iob.Information == -1, "expected -1, got %lu\n", iob.Information); + + 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(iob.Information == -1, "expected -1, got %lu\n", iob.Information); + hfile = create_temp_file(0); if (!hfile) return;
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(iob.Information == -1, "expected -1, got %lu\n", iob.Information); + + 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(iob.Information == -1, "expected -1, got %lu\n", iob.Information); + + iob.Status = -1; + iob.Information = -1; status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), NULL, NULL); ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status); ok(iob.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iob.Status);