Commit 08a778c5 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernel32/tests: Init pointers in common way, add some win_skip() while skipping.

parent ea0af93c
...@@ -1323,6 +1323,12 @@ static void test_GetWindowsDirectory(void) ...@@ -1323,6 +1323,12 @@ static void test_GetWindowsDirectory(void)
static void test_NeedCurrentDirectoryForExePathA(void) static void test_NeedCurrentDirectoryForExePathA(void)
{ {
if (!pNeedCurrentDirectoryForExePathA)
{
win_skip("NeedCurrentDirectoryForExePathA is not available\n");
return;
}
/* Crashes in Windows */ /* Crashes in Windows */
if (0) if (0)
ok(pNeedCurrentDirectoryForExePathA(NULL), "returned FALSE for NULL\n"); ok(pNeedCurrentDirectoryForExePathA(NULL), "returned FALSE for NULL\n");
...@@ -1344,6 +1350,12 @@ static void test_NeedCurrentDirectoryForExePathW(void) ...@@ -1344,6 +1350,12 @@ static void test_NeedCurrentDirectoryForExePathW(void)
const WCHAR fullpath[] = {'c', ':', '\\', 0}; const WCHAR fullpath[] = {'c', ':', '\\', 0};
const WCHAR cmdname[] = {'c', 'm', 'd', '.', 'e', 'x', 'e', 0}; const WCHAR cmdname[] = {'c', 'm', 'd', '.', 'e', 'x', 'e', 0};
if (!pNeedCurrentDirectoryForExePathW)
{
win_skip("NeedCurrentDirectoryForExePathW is not available\n");
return;
}
/* Crashes in Windows */ /* Crashes in Windows */
if (0) if (0)
ok(pNeedCurrentDirectoryForExePathW(NULL), "returned FALSE for NULL\n"); ok(pNeedCurrentDirectoryForExePathW(NULL), "returned FALSE for NULL\n");
...@@ -1444,19 +1456,23 @@ static void test_drive_letter_case(void) ...@@ -1444,19 +1456,23 @@ static void test_drive_letter_case(void)
#undef is_upper_case_letter #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) START_TEST(path)
{ {
CHAR origdir[MAX_PATH],curdir[MAX_PATH], curDrive, otherDrive; CHAR origdir[MAX_PATH],curdir[MAX_PATH], curDrive, otherDrive;
pGetLongPathNameA = (void*)GetProcAddress( GetModuleHandleA("kernel32.dll"),
"GetLongPathNameA" ); init_pointers();
pGetLongPathNameW = (void*)GetProcAddress(GetModuleHandleA("kernel32.dll") ,
"GetLongPathNameW" );
pNeedCurrentDirectoryForExePathA =
(void*)GetProcAddress( GetModuleHandleA("kernel32.dll"),
"NeedCurrentDirectoryForExePathA" );
pNeedCurrentDirectoryForExePathW =
(void*)GetProcAddress( GetModuleHandleA("kernel32.dll"),
"NeedCurrentDirectoryForExePathW" );
/* Report only once */ /* Report only once */
if (!pGetLongPathNameA) if (!pGetLongPathNameA)
...@@ -1474,13 +1490,7 @@ START_TEST(path) ...@@ -1474,13 +1490,7 @@ START_TEST(path)
test_GetShortPathNameW(); test_GetShortPathNameW();
test_GetSystemDirectory(); test_GetSystemDirectory();
test_GetWindowsDirectory(); test_GetWindowsDirectory();
if (pNeedCurrentDirectoryForExePathA)
{
test_NeedCurrentDirectoryForExePathA(); test_NeedCurrentDirectoryForExePathA();
}
if (pNeedCurrentDirectoryForExePathW)
{
test_NeedCurrentDirectoryForExePathW(); test_NeedCurrentDirectoryForExePathW();
}
test_drive_letter_case(); test_drive_letter_case();
} }
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