tests/win32_ordinal_test.c : Fix calling of GetProcAddress with ordinal under win64.

This commit is contained in:
Erik de Castro Lopo 2008-09-29 18:32:12 +10:00
parent f6ed5755a1
commit 7c08018650
2 changed files with 10 additions and 1 deletions

View File

@ -9,6 +9,9 @@
* examples/sndfile-play.c
Fix win64 issues.
* tests/win32_ordinal_test.c
Fix calling of GetProcAddress with ordinal under win64.
2008-09-25 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* examples/*

View File

@ -64,7 +64,13 @@ test_ordinal (HMODULE hmod, const char * func_name, int ordinal)
print_test_name ("win32_ordinal_test", func_name) ;
ord = GetProcAddress (hmod, (LPSTR) ordinal) ;
#if SIZEOF_VOIDP == 8
#define LPCSTR_OF_ORDINAL(x) ((LPCSTR) ((int64_t) (x)))
#else
#define LPCSTR_OF_ORDINAL(x) ((LPCSTR) (x))
#endif
ord = GetProcAddress (hmod, LPCSTR_OF_ORDINAL (ordinal)) ;
if ((name = GetProcAddress (hmod, func_name)) == NULL)
{ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (),
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpmsg, 0, NULL) ;