Fix mlang test compilation on Windows

Francois Gouget fgouget at free.fr
Wed Aug 11 10:14:03 CDT 2004


Changelog:

 * dlls/mlang/tests/mlang.c

   Don't include wine/debug.h when compiling on Windows.
   GetCPInfoExA() is missing on some Windows platforms, load it
dynamically.


Index: dlls/mlang/tests/mlang.c
===================================================================
RCS file: /var/cvs/wine/dlls/mlang/tests/mlang.c,v
retrieving revision 1.1
diff -u -r1.1 mlang.c
--- dlls/mlang/tests/mlang.c	4 Aug 2004 18:33:06 -0000	1.1
+++ dlls/mlang/tests/mlang.c	11 Aug 2004 08:03:20 -0000
@@ -28,16 +28,20 @@
 #include "mlang.h"

 #include "wine/test.h"
+
+/*#define DUMP_CP_INFO*/
+#ifdef DUMP_CP_INFO
 #include "wine/debug.h"
+#endif

 #ifndef CP_UNICODE
 #define CP_UNICODE 1200
 #endif

-/*#define DUMP_CP_INFO*/
-
 #define TRACE_2 OutputDebugStringA

+static BOOL (WINAPI *pGetCPInfoExA)(UINT,DWORD,LPCPINFOEXA);
+
 static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2)
 {
     /* these APIs are broken regarding constness of the input buffer */
@@ -270,14 +274,17 @@
 	else
 	    trace("TranslateCharsetInfo failed for cp %u\n", cpinfo[i].uiFamilyCodePage);

-	if (GetCPInfoExA(cpinfo[i].uiCodePage, 0, &cpinfoex))
-	    trace("CodePage %u name: %s\n", cpinfo[i].uiCodePage, cpinfoex.CodePageName);
-	else
-	    trace("GetCPInfoExA failed for cp %u\n", cpinfo[i].uiCodePage);
-	if (GetCPInfoExA(cpinfo[i].uiFamilyCodePage, 0, &cpinfoex))
-	    trace("CodePage %u name: %s\n", cpinfo[i].uiFamilyCodePage, cpinfoex.CodePageName);
-	else
-	    trace("GetCPInfoExA failed for cp %u\n", cpinfo[i].uiFamilyCodePage);
+        if (pGetCPInfoExA)
+        {
+            if (pGetCPInfoExA(cpinfo[i].uiCodePage, 0, &cpinfoex))
+                trace("CodePage %u name: %s\n", cpinfo[i].uiCodePage, cpinfoex.CodePageName);
+            else
+                trace("GetCPInfoExA failed for cp %u\n", cpinfo[i].uiCodePage);
+            if (pGetCPInfoExA(cpinfo[i].uiFamilyCodePage, 0, &cpinfoex))
+                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 */
         if (cpinfo[i].uiCodePage == CP_UTF7) continue;
@@ -340,9 +347,12 @@

 START_TEST(mlang)
 {
+    HINSTANCE lib;
     IMultiLanguage2 *iML2 = NULL;
     HRESULT ret;

+    lib=LoadLibraryA("mlang");
+    pGetCPInfoExA=(void*)GetProcAddress(lib,"GetCPInfoExA");
     CoInitialize(NULL);
     TRACE_2("Call CoCreateInstance\n");
     ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,



-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
Nouvelle version : les anciens bogues ont \xE9t\xE9 remplac\xE9s par de nouveaux.



More information about the wine-patches mailing list