From c1c0a083882aaf394671e73c3da3f0be70e72548 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Sun, 14 Oct 2018 10:44:33 +0300 Subject: [PATCH] kernel32/tests: Fix a bunch of access denied errors by using a dedicated TEMP directory. Signed-off-by: Dmitry Timoshkov Signed-off-by: Alexandre Julliard --- dlls/kernel32/tests/file.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 58ce74b9b7b..acf657f8c7f 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -62,7 +62,7 @@ static BOOL (WINAPI *pGetQueuedCompletionStatusEx)(HANDLE, OVERLAPPED_ENTRY*, UL static void (WINAPI *pRtlInitAnsiString)(PANSI_STRING,PCSZ); static void (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING); -static const char filename[] = "testfile.xxx"; +static char filename[MAX_PATH]; static const char sillytext[] = "en larvig liten text dx \033 gx hej 84 hej 4484 ! \001\033 bla bl\na.. bla bla." "1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3" @@ -457,10 +457,15 @@ static void test__lcreat( void ) if (INVALID_HANDLE_VALUE==find) ok (0, "file \"%s\" not found\n", filename); else { + const char *name = strrchr(filename, '\\'); + + if (name) name++; + else name = filename; + ret = FindClose(find); ok ( 0 != ret, "FindClose complains (%d)\n", GetLastError ()); - ok (!strcmp (filename, search_results.cFileName), - "found unexpected name \"%s\"\n", search_results.cFileName); + ok (!strcmp (name, search_results.cFileName), + "expected \"%s\", got \"%s\"\n", name, search_results.cFileName); search_results.dwFileAttributes &= ~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED; search_results.dwFileAttributes &= ~FILE_ATTRIBUTE_COMPRESSED; ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes, @@ -5103,8 +5108,18 @@ static void test_post_completion(void) START_TEST(file) { + char temp_path[MAX_PATH]; + DWORD ret; + InitFunctionPointers(); + ret = GetTempPathA(MAX_PATH, temp_path); + ok(ret != 0, "GetTempPath error %u\n", GetLastError()); + ret = GetTempFileNameA(temp_path, "tmp", 0, filename); + ok(ret != 0, "GetTempFileName error %u\n", GetLastError()); + ret = DeleteFileA(filename); + ok(ret != 0, "DeleteFile error %u\n", GetLastError()); + test__hread( ); test__hwrite( ); test__lclose( );