[PATCH 1/7] Init pointers in common way, add some win_skip() while skipping
Nikolay Sivov
bunglehead at gmail.com
Mon Dec 21 11:21:16 CST 2009
---
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();
}
--
1.5.6.5
--=-YNQ0S+bRHx6+/37Wtkc7--
More information about the wine-patches
mailing list