ntdll/tests: Add the tests for some error cases.

This commit is contained in:
Dmitry Timoshkov 2013-08-21 18:33:46 +09:00 committed by Alexandre Julliard
parent 8ec8d70ada
commit aa14c2daa5

View file

@ -1941,9 +1941,39 @@ 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);