diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c index cefd367646d..ace9442d598 100644 --- a/dlls/shlwapi/tests/path.c +++ b/dlls/shlwapi/tests/path.c @@ -30,6 +30,10 @@ #include "shlwapi.h" #include "wininet.h" +static HMODULE hShlwapi; +static HRESULT (WINAPI *pPathIsValidCharA)(char,DWORD); +static HRESULT (WINAPI *pPathIsValidCharW)(WCHAR,DWORD); + const char* TEST_URL_1 = "http://www.winehq.org/tests?date=10/10/1923"; const char* TEST_URL_2 = "http://localhost:8080/tests%2e.html?date=Mon%2010/10/1923"; const char* TEST_URL_3 = "http://foo:bar@localhost:21/internal.php?query=x&return=y"; @@ -642,23 +646,20 @@ static const DWORD SHELL_charclass[] = 0x00000000, 0x00000100, 0x00000100 }; -BOOL WINAPI PathIsValidCharA( char c, DWORD class ); -BOOL WINAPI PathIsValidCharW( WCHAR c, DWORD class ); - static void test_PathIsValidCharA(void) { BOOL ret; unsigned int c; - ret = PathIsValidCharA( 0x7f, 0 ); + ret = pPathIsValidCharA( 0x7f, 0 ); ok ( !ret, "PathIsValidCharA succeeded: 0x%08lx\n", (DWORD)ret ); - ret = PathIsValidCharA( 0x7f, 1 ); + ret = pPathIsValidCharA( 0x7f, 1 ); ok ( !ret, "PathIsValidCharA succeeded: 0x%08lx\n", (DWORD)ret ); for (c = 0; c < 0x7f; c++) { - ret = PathIsValidCharA( c, ~0U ); + ret = pPathIsValidCharA( c, ~0U ); ok ( ret == SHELL_charclass[c] || (ret == 1 && SHELL_charclass[c] == 0xffffffff), "PathIsValidCharA failed: 0x%02x got 0x%08lx expected 0x%08lx\n", c, (DWORD)ret, SHELL_charclass[c] ); @@ -666,7 +667,7 @@ static void test_PathIsValidCharA(void) for (c = 0x7f; c <= 0xff; c++) { - ret = PathIsValidCharA( c, ~0U ); + ret = pPathIsValidCharA( c, ~0U ); ok ( ret == 0x00000100, "PathIsValidCharA failed: 0x%02x got 0x%08lx expected 0x00000100\n", c, (DWORD)ret ); @@ -678,15 +679,15 @@ static void test_PathIsValidCharW(void) BOOL ret; unsigned int c; - ret = PathIsValidCharW( 0x7f, 0 ); + ret = pPathIsValidCharW( 0x7f, 0 ); ok ( !ret, "PathIsValidCharW succeeded: 0x%08lx\n", (DWORD)ret ); - ret = PathIsValidCharW( 0x7f, 1 ); + ret = pPathIsValidCharW( 0x7f, 1 ); ok ( !ret, "PathIsValidCharW succeeded: 0x%08lx\n", (DWORD)ret ); for (c = 0; c < 0x7f; c++) { - ret = PathIsValidCharW( c, ~0U ); + ret = pPathIsValidCharW( c, ~0U ); ok ( ret == SHELL_charclass[c] || (ret == 1 && SHELL_charclass[c] == 0xffffffff), "PathIsValidCharW failed: 0x%02x got 0x%08lx expected 0x%08lx\n", c, (DWORD)ret, SHELL_charclass[c] ); @@ -694,7 +695,7 @@ static void test_PathIsValidCharW(void) for (c = 0x007f; c <= 0xffff; c++) { - ret = PathIsValidCharW( c, ~0U ); + ret = pPathIsValidCharW( c, ~0U ); ok ( ret == 0x00000100, "PathIsValidCharW failed: 0x%02x got 0x%08lx expected 0x00000100\n", c, (DWORD)ret ); @@ -703,6 +704,9 @@ static void test_PathIsValidCharW(void) START_TEST(path) { + hShlwapi = LoadLibraryA("shlwapi.dll"); + if (!hShlwapi) return; + test_UrlHash(); test_UrlGetPart(); test_UrlCanonicalize(); @@ -715,6 +719,10 @@ START_TEST(path) test_PathSearchAndQualify(); test_PathCreateFromUrl(); test_PathIsUrl(); - test_PathIsValidCharA(); - test_PathIsValidCharW(); + + pPathIsValidCharA = (void*)GetProcAddress(hShlwapi, (LPSTR)455); + if (pPathIsValidCharA) test_PathIsValidCharA(); + + pPathIsValidCharW = (void*)GetProcAddress(hShlwapi, (LPSTR)456); + if (pPathIsValidCharW) test_PathIsValidCharW(); }