Don't include wine/debug.h when compiling on Windows.

GetCPInfoExA() is missing on some Windows platforms, load it
dynamically.
This commit is contained in:
Francois Gouget 2004-08-11 19:34:45 +00:00 committed by Alexandre Julliard
parent dbf5b2a320
commit a560bcb834
1 changed files with 20 additions and 9 deletions

View File

@ -28,7 +28,6 @@
#include "mlang.h" #include "mlang.h"
#include "wine/test.h" #include "wine/test.h"
#include "wine/debug.h"
#ifndef CP_UNICODE #ifndef CP_UNICODE
#define CP_UNICODE 1200 #define CP_UNICODE 1200
@ -37,8 +36,14 @@
/*#define DUMP_CP_INFO*/ /*#define DUMP_CP_INFO*/
/*#define DUMP_SCRIPT_INFO*/ /*#define DUMP_SCRIPT_INFO*/
#ifdef DUMP_CP_INFO
#include "wine/debug.h"
#endif
#define TRACE_2 OutputDebugStringA #define TRACE_2 OutputDebugStringA
static BOOL (WINAPI *pGetCPInfoExA)(UINT,DWORD,LPCPINFOEXA);
static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2) static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2)
{ {
/* these APIs are broken regarding constness of the input buffer */ /* these APIs are broken regarding constness of the input buffer */
@ -336,14 +341,17 @@ static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags)
else else
trace("TranslateCharsetInfo failed for cp %u\n", cpinfo[i].uiFamilyCodePage); trace("TranslateCharsetInfo failed for cp %u\n", cpinfo[i].uiFamilyCodePage);
if (GetCPInfoExA(cpinfo[i].uiCodePage, 0, &cpinfoex)) if (pGetCPInfoExA)
trace("CodePage %u name: %s\n", cpinfo[i].uiCodePage, cpinfoex.CodePageName); {
else if (pGetCPInfoExA(cpinfo[i].uiCodePage, 0, &cpinfoex))
trace("GetCPInfoExA failed for cp %u\n", cpinfo[i].uiCodePage); trace("CodePage %u name: %s\n", cpinfo[i].uiCodePage, cpinfoex.CodePageName);
if (GetCPInfoExA(cpinfo[i].uiFamilyCodePage, 0, &cpinfoex)) else
trace("CodePage %u name: %s\n", cpinfo[i].uiFamilyCodePage, cpinfoex.CodePageName); trace("GetCPInfoExA failed for cp %u\n", cpinfo[i].uiCodePage);
else if (pGetCPInfoExA(cpinfo[i].uiFamilyCodePage, 0, &cpinfoex))
trace("GetCPInfoExA failed for cp %u\n", cpinfo[i].uiFamilyCodePage); trace("CodePage %u name: %s\n", cpinfo[i].uiFamilyCodePage, cpinfoex.CodePageName);
else
trace("GetCPInfoExA failed for cp %u\n", cpinfo[i].uiFamilyCodePage);
}
/* Win95 does not support UTF-7 */ /* Win95 does not support UTF-7 */
if (cpinfo[i].uiCodePage == CP_UTF7) continue; if (cpinfo[i].uiCodePage == CP_UTF7) continue;
@ -525,9 +533,12 @@ static void test_EnumScripts(IMultiLanguage2 *iML2, DWORD flags)
START_TEST(mlang) START_TEST(mlang)
{ {
HINSTANCE lib;
IMultiLanguage2 *iML2 = NULL; IMultiLanguage2 *iML2 = NULL;
HRESULT ret; HRESULT ret;
lib=LoadLibraryA("mlang");
pGetCPInfoExA=(void*)GetProcAddress(lib,"GetCPInfoExA");
CoInitialize(NULL); CoInitialize(NULL);
TRACE_2("Call CoCreateInstance\n"); TRACE_2("Call CoCreateInstance\n");
ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,