Commit ae3c49d8 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

ntdll/tests: Add a test for file position after NtWriteFile in FILE_APPEND_DATA mode.

parent 0160b9a3
......@@ -857,6 +857,7 @@ static void append_file_test(void)
IO_STATUS_BLOCK iosb;
LARGE_INTEGER offset;
char path[MAX_PATH], buffer[MAX_PATH], buf[16];
DWORD ret;
GetTempPathA( MAX_PATH, path );
GetTempFileNameA( path, "foo", 0, buffer );
......@@ -866,10 +867,10 @@ static void append_file_test(void)
U(iosb).Status = -1;
iosb.Information = -1;
status = pNtWriteFile(handle, NULL, NULL, NULL, &iosb, text, 3, NULL, NULL);
status = pNtWriteFile(handle, NULL, NULL, NULL, &iosb, text, 2, NULL, NULL);
ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status);
ok(iosb.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iosb.Status);
ok(iosb.Information == 3, "expected 3, got %lu\n", iosb.Information);
ok(iosb.Information == 2, "expected 2, got %lu\n", iosb.Information);
CloseHandle(handle);
......@@ -880,14 +881,33 @@ static void append_file_test(void)
U(iosb).Status = -1;
iosb.Information = -1;
offset.QuadPart = 0;
status = pNtWriteFile(handle, NULL, NULL, NULL, &iosb, text + 3, 3, &offset, NULL);
offset.QuadPart = 1;
status = pNtWriteFile(handle, NULL, NULL, NULL, &iosb, text + 2, 2, &offset, NULL);
todo_wine
ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status);
todo_wine
ok(iosb.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iosb.Status);
todo_wine
ok(iosb.Information == 3, "expected 3, got %lu\n", iosb.Information);
ok(iosb.Information == 2, "expected 2, got %lu\n", iosb.Information);
ret = SetFilePointer(handle, 0, NULL, FILE_CURRENT);
todo_wine
ok(ret == 4, "expected 4, got %u\n", ret);
U(iosb).Status = -1;
iosb.Information = -1;
offset.QuadPart = 3;
status = pNtWriteFile(handle, NULL, NULL, NULL, &iosb, text + 4, 2, &offset, NULL);
todo_wine
ok(status == STATUS_SUCCESS, "NtWriteFile error %#x\n", status);
todo_wine
ok(iosb.Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", iosb.Status);
todo_wine
ok(iosb.Information == 2, "expected 2, got %lu\n", iosb.Information);
ret = SetFilePointer(handle, 0, NULL, FILE_CURRENT);
todo_wine
ok(ret == 6, "expected 6, got %u\n", ret);
CloseHandle(handle);
......
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