Module: wine Branch: master Commit: 08a778c568f628c1ac366f06100122fbb28f8d6f URL: http://source.winehq.org/git/wine.git/?a=commit;h=08a778c568f628c1ac366f0610...
Author: Nikolay Sivov bunglehead@gmail.com Date: Mon Dec 21 20:21:16 2009 +0300
kernel32/tests: Init pointers in common way, add some win_skip() while skipping.
---
dlls/kernel32/tests/path.c | 46 ++++++++++++++++++++++++++----------------- 1 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c index 1c899c8..4641c5e 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c @@ -1323,6 +1323,12 @@ static void test_GetWindowsDirectory(void)
static void test_NeedCurrentDirectoryForExePathA(void) { + if (!pNeedCurrentDirectoryForExePathA) + { + win_skip("NeedCurrentDirectoryForExePathA is not available\n"); + return; + } + /* Crashes in Windows */ if (0) ok(pNeedCurrentDirectoryForExePathA(NULL), "returned FALSE for NULL\n"); @@ -1344,6 +1350,12 @@ static void test_NeedCurrentDirectoryForExePathW(void) const WCHAR fullpath[] = {'c', ':', '\', 0}; const WCHAR cmdname[] = {'c', 'm', 'd', '.', 'e', 'x', 'e', 0};
+ if (!pNeedCurrentDirectoryForExePathW) + { + win_skip("NeedCurrentDirectoryForExePathW is not available\n"); + return; + } + /* Crashes in Windows */ if (0) ok(pNeedCurrentDirectoryForExePathW(NULL), "returned FALSE for NULL\n"); @@ -1444,19 +1456,23 @@ static void test_drive_letter_case(void) #undef is_upper_case_letter }
+static void init_pointers(void) +{ + HMODULE hKernel32 = GetModuleHandleA("kernel32.dll"); + +#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hKernel32, #f)) + MAKEFUNC(GetLongPathNameA); + MAKEFUNC(GetLongPathNameW); + MAKEFUNC(NeedCurrentDirectoryForExePathA); + MAKEFUNC(NeedCurrentDirectoryForExePathW); +#undef MAKEFUNC +} + START_TEST(path) { CHAR origdir[MAX_PATH],curdir[MAX_PATH], curDrive, otherDrive; - pGetLongPathNameA = (void*)GetProcAddress( GetModuleHandleA("kernel32.dll"), - "GetLongPathNameA" ); - pGetLongPathNameW = (void*)GetProcAddress(GetModuleHandleA("kernel32.dll") , - "GetLongPathNameW" ); - pNeedCurrentDirectoryForExePathA = - (void*)GetProcAddress( GetModuleHandleA("kernel32.dll"), - "NeedCurrentDirectoryForExePathA" ); - pNeedCurrentDirectoryForExePathW = - (void*)GetProcAddress( GetModuleHandleA("kernel32.dll"), - "NeedCurrentDirectoryForExePathW" ); + + init_pointers();
/* Report only once */ if (!pGetLongPathNameA) @@ -1474,13 +1490,7 @@ START_TEST(path) test_GetShortPathNameW(); test_GetSystemDirectory(); test_GetWindowsDirectory(); - if (pNeedCurrentDirectoryForExePathA) - { - test_NeedCurrentDirectoryForExePathA(); - } - if (pNeedCurrentDirectoryForExePathW) - { - test_NeedCurrentDirectoryForExePathW(); - } + test_NeedCurrentDirectoryForExePathA(); + test_NeedCurrentDirectoryForExePathW(); test_drive_letter_case(); }