Use aliases for calls to ordinals.

This commit is contained in:
Paul Vriens 2005-02-10 17:10:43 +00:00 committed by Alexandre Julliard
parent fccb667f0e
commit 0543774845
1 changed files with 21 additions and 13 deletions

View File

@ -30,6 +30,10 @@
#include "shlwapi.h" #include "shlwapi.h"
#include "wininet.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_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_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"; 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 0x00000000, 0x00000100, 0x00000100
}; };
BOOL WINAPI PathIsValidCharA( char c, DWORD class );
BOOL WINAPI PathIsValidCharW( WCHAR c, DWORD class );
static void test_PathIsValidCharA(void) static void test_PathIsValidCharA(void)
{ {
BOOL ret; BOOL ret;
unsigned int c; unsigned int c;
ret = PathIsValidCharA( 0x7f, 0 ); ret = pPathIsValidCharA( 0x7f, 0 );
ok ( !ret, "PathIsValidCharA succeeded: 0x%08lx\n", (DWORD)ret ); 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 ); ok ( !ret, "PathIsValidCharA succeeded: 0x%08lx\n", (DWORD)ret );
for (c = 0; c < 0x7f; c++) 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), ok ( ret == SHELL_charclass[c] || (ret == 1 && SHELL_charclass[c] == 0xffffffff),
"PathIsValidCharA failed: 0x%02x got 0x%08lx expected 0x%08lx\n", "PathIsValidCharA failed: 0x%02x got 0x%08lx expected 0x%08lx\n",
c, (DWORD)ret, SHELL_charclass[c] ); c, (DWORD)ret, SHELL_charclass[c] );
@ -666,7 +667,7 @@ static void test_PathIsValidCharA(void)
for (c = 0x7f; c <= 0xff; c++) for (c = 0x7f; c <= 0xff; c++)
{ {
ret = PathIsValidCharA( c, ~0U ); ret = pPathIsValidCharA( c, ~0U );
ok ( ret == 0x00000100, ok ( ret == 0x00000100,
"PathIsValidCharA failed: 0x%02x got 0x%08lx expected 0x00000100\n", "PathIsValidCharA failed: 0x%02x got 0x%08lx expected 0x00000100\n",
c, (DWORD)ret ); c, (DWORD)ret );
@ -678,15 +679,15 @@ static void test_PathIsValidCharW(void)
BOOL ret; BOOL ret;
unsigned int c; unsigned int c;
ret = PathIsValidCharW( 0x7f, 0 ); ret = pPathIsValidCharW( 0x7f, 0 );
ok ( !ret, "PathIsValidCharW succeeded: 0x%08lx\n", (DWORD)ret ); 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 ); ok ( !ret, "PathIsValidCharW succeeded: 0x%08lx\n", (DWORD)ret );
for (c = 0; c < 0x7f; c++) 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), ok ( ret == SHELL_charclass[c] || (ret == 1 && SHELL_charclass[c] == 0xffffffff),
"PathIsValidCharW failed: 0x%02x got 0x%08lx expected 0x%08lx\n", "PathIsValidCharW failed: 0x%02x got 0x%08lx expected 0x%08lx\n",
c, (DWORD)ret, SHELL_charclass[c] ); c, (DWORD)ret, SHELL_charclass[c] );
@ -694,7 +695,7 @@ static void test_PathIsValidCharW(void)
for (c = 0x007f; c <= 0xffff; c++) for (c = 0x007f; c <= 0xffff; c++)
{ {
ret = PathIsValidCharW( c, ~0U ); ret = pPathIsValidCharW( c, ~0U );
ok ( ret == 0x00000100, ok ( ret == 0x00000100,
"PathIsValidCharW failed: 0x%02x got 0x%08lx expected 0x00000100\n", "PathIsValidCharW failed: 0x%02x got 0x%08lx expected 0x00000100\n",
c, (DWORD)ret ); c, (DWORD)ret );
@ -703,6 +704,9 @@ static void test_PathIsValidCharW(void)
START_TEST(path) START_TEST(path)
{ {
hShlwapi = LoadLibraryA("shlwapi.dll");
if (!hShlwapi) return;
test_UrlHash(); test_UrlHash();
test_UrlGetPart(); test_UrlGetPart();
test_UrlCanonicalize(); test_UrlCanonicalize();
@ -715,6 +719,10 @@ START_TEST(path)
test_PathSearchAndQualify(); test_PathSearchAndQualify();
test_PathCreateFromUrl(); test_PathCreateFromUrl();
test_PathIsUrl(); 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();
} }