Commit c5868eed authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

kernel32/tests: Use SetFilePointer instead of GetFileSize with WriteFile.

parent e685bed6
...@@ -2744,12 +2744,7 @@ static void test_ResolveDelayLoadedAPI(void) ...@@ -2744,12 +2744,7 @@ static void test_ResolveDelayLoadedAPI(void)
ok(ret, "WriteFile error %d\n", GetLastError()); ok(ret, "WriteFile error %d\n", GetLastError());
/* fill up to delay data */ /* fill up to delay data */
file_size = GetFileSize(hfile, NULL); SetFilePointer( hfile, nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT].VirtualAddress, NULL, SEEK_SET );
SetLastError(0xdeadbeef);
ret = WriteFile(hfile, filler,
nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT].VirtualAddress - file_size,
&dummy, NULL);
ok(ret, "WriteFile error %d\n", GetLastError());
/* delay data */ /* delay data */
idd.Attributes.AllAttributes = 1; idd.Attributes.AllAttributes = 1;
...@@ -2770,10 +2765,7 @@ static void test_ResolveDelayLoadedAPI(void) ...@@ -2770,10 +2765,7 @@ static void test_ResolveDelayLoadedAPI(void)
ok(ret, "WriteFile error %d\n", GetLastError()); ok(ret, "WriteFile error %d\n", GetLastError());
/* fill up to extended delay data */ /* fill up to extended delay data */
file_size = GetFileSize(hfile, NULL); SetFilePointer( hfile, idd.DllNameRVA, NULL, SEEK_SET );
SetLastError(0xdeadbeef);
ret = WriteFile(hfile, filler, idd.DllNameRVA - file_size, &dummy, NULL);
ok(ret, "WriteFile error %d\n", GetLastError());
/* extended delay data */ /* extended delay data */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -2810,10 +2802,8 @@ static void test_ResolveDelayLoadedAPI(void) ...@@ -2810,10 +2802,8 @@ static void test_ResolveDelayLoadedAPI(void)
ok(ret, "WriteFile error %d\n", GetLastError()); ok(ret, "WriteFile error %d\n", GetLastError());
/* fill up to eof */ /* fill up to eof */
file_size = GetFileSize(hfile, NULL); SetFilePointer( hfile, section.VirtualAddress + section.Misc.VirtualSize, NULL, SEEK_SET );
SetLastError(0xdeadbeef); SetEndOfFile( hfile );
ret = WriteFile(hfile, filler, section.VirtualAddress + section.Misc.VirtualSize - file_size, &dummy, NULL);
ok(ret, "WriteFile error %d\n", GetLastError());
CloseHandle(hfile); CloseHandle(hfile);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
......
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