From c5868eed11e3ff49b1f70b28c57431dd68a6fb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Sun, 7 Aug 2016 22:15:56 +0200 Subject: [PATCH] kernel32/tests: Use SetFilePointer instead of GetFileSize with WriteFile. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Hentschel Signed-off-by: Alexandre Julliard --- dlls/kernel32/tests/loader.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index f59f674cbca..9aaecc218b5 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -2744,12 +2744,7 @@ static void test_ResolveDelayLoadedAPI(void) ok(ret, "WriteFile error %d\n", GetLastError()); /* fill up to delay data */ - file_size = GetFileSize(hfile, NULL); - 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()); + SetFilePointer( hfile, nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT].VirtualAddress, NULL, SEEK_SET ); /* delay data */ idd.Attributes.AllAttributes = 1; @@ -2770,10 +2765,7 @@ static void test_ResolveDelayLoadedAPI(void) ok(ret, "WriteFile error %d\n", GetLastError()); /* fill up to extended delay data */ - file_size = GetFileSize(hfile, NULL); - SetLastError(0xdeadbeef); - ret = WriteFile(hfile, filler, idd.DllNameRVA - file_size, &dummy, NULL); - ok(ret, "WriteFile error %d\n", GetLastError()); + SetFilePointer( hfile, idd.DllNameRVA, NULL, SEEK_SET ); /* extended delay data */ SetLastError(0xdeadbeef); @@ -2810,10 +2802,8 @@ static void test_ResolveDelayLoadedAPI(void) ok(ret, "WriteFile error %d\n", GetLastError()); /* fill up to eof */ - file_size = GetFileSize(hfile, NULL); - SetLastError(0xdeadbeef); - ret = WriteFile(hfile, filler, section.VirtualAddress + section.Misc.VirtualSize - file_size, &dummy, NULL); - ok(ret, "WriteFile error %d\n", GetLastError()); + SetFilePointer( hfile, section.VirtualAddress + section.Misc.VirtualSize, NULL, SEEK_SET ); + SetEndOfFile( hfile ); CloseHandle(hfile); SetLastError(0xdeadbeef);