Skip to content
Snippets Groups Projects
Commit 94a9d33b authored by Alexandre Julliard's avatar Alexandre Julliard
Browse files

Authors: Dmitry Timoshkov <dmitry@codeweavers.com>, Mike McCormack <mike@codeweavers.com>

Added an implementation of mlang.dll and test cases for it.
parent a6b9d70c
No related branches found
No related tags found
No related merge requests found
......@@ -20271,7 +20271,7 @@ MAKE_LIB_RULES=libs/Makelib.rules
MAKE_PROG_RULES=programs/Makeprog.rules
 
 
ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
 
 
cat >confcache <<\_ACEOF
......@@ -20876,6 +20876,8 @@ do
"dlls/lzexpand/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/lzexpand/Makefile" ;;
"dlls/mapi32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mapi32/Makefile" ;;
"dlls/mapi32/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mapi32/tests/Makefile" ;;
"dlls/mlang/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mlang/Makefile" ;;
"dlls/mlang/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mlang/tests/Makefile" ;;
"dlls/mmdevldr.vxd/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mmdevldr.vxd/Makefile" ;;
"dlls/monodebg.vxd/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/monodebg.vxd/Makefile" ;;
"dlls/mpr/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mpr/Makefile" ;;
......
......@@ -1584,6 +1584,8 @@ dlls/kernel/tests/Makefile
dlls/lzexpand/Makefile
dlls/mapi32/Makefile
dlls/mapi32/tests/Makefile
dlls/mlang/Makefile
dlls/mlang/tests/Makefile
dlls/mmdevldr.vxd/Makefile
dlls/monodebg.vxd/Makefile
dlls/mpr/Makefile
......
......@@ -66,6 +66,7 @@ BASEDIRS = \
kernel \
lzexpand \
mapi32 \
mlang \
mmdevldr.vxd \
monodebg.vxd \
mpr \
......@@ -299,6 +300,7 @@ SYMLINKS_SO = \
mciseq.drv.so \
mciwave.drv.so \
midimap.drv.so \
mlang.dll.so \
mmdevldr.vxd.so \
monodebg.vxd.so \
mpr.dll.so \
......@@ -612,6 +614,9 @@ mciwave.drv.so: winmm/mciwave/mciwave.drv.so
midimap.drv.so: winmm/midimap/midimap.drv.so
$(RM) $@ && $(LN_S) winmm/midimap/midimap.drv.so $@
mlang.dll.so: mlang/mlang.dll.so
$(RM) $@ && $(LN_S) mlang/mlang.dll.so $@
mmdevldr.vxd.so: mmdevldr.vxd/mmdevldr.vxd.so
$(RM) $@ && $(LN_S) mmdevldr.vxd/mmdevldr.vxd.so $@
......@@ -1006,6 +1011,7 @@ IMPORT_LIBS = \
libkernel32 \
liblz32 \
libmapi32 \
libmlang \
libmpr \
libmsacm32 \
libmsdmo \
......@@ -1354,6 +1360,11 @@ libmapi32.def: mapi32/mapi32.spec.def
libmapi32.a: mapi32/mapi32.spec.def
$(DLLTOOL) -k -l $@ -d mapi32/mapi32.spec.def
libmlang.def: mlang/mlang.spec.def
$(RM) $@ && $(LN_S) mlang/mlang.spec.def $@
libmlang.a: mlang/mlang.spec.def
$(DLLTOOL) -k -l $@ -d mlang/mlang.spec.def
libmpr.def: mpr/mpr.spec.def
$(RM) $@ && $(LN_S) mpr/mpr.spec.def $@
libmpr.a: mpr/mpr.spec.def
......@@ -1748,6 +1759,7 @@ iphlpapi/iphlpapi.spec.def: $(WINEBUILD)
kernel/kernel32.spec.def: $(WINEBUILD)
lzexpand/lz32.spec.def: $(WINEBUILD)
mapi32/mapi32.spec.def: $(WINEBUILD)
mlang/mlang.spec.def: $(WINEBUILD)
mpr/mpr.spec.def: $(WINEBUILD)
msacm/msacm32.spec.def: $(WINEBUILD)
msdmo/msdmo.spec.def: $(WINEBUILD)
......@@ -1886,6 +1898,7 @@ winmm/mcicda/mcicda.drv.so: winmm/mcicda
winmm/mciseq/mciseq.drv.so: winmm/mciseq
winmm/mciwave/mciwave.drv.so: winmm/mciwave
winmm/midimap/midimap.drv.so: winmm/midimap
mlang/mlang.dll.so: mlang
mmdevldr.vxd/mmdevldr.vxd.so: mmdevldr.vxd
monodebg.vxd/monodebg.vxd.so: monodebg.vxd
mpr/mpr.dll.so: mpr
......
Makefile
mlang.dll.dbg.c
mlang.spec.def
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = mlang.dll
IMPORTS = ole32 user32 gdi32 advapi32 kernel32 ntdll
EXTRALIBS = $(LIBUNICODE) -luuid
EXTRADEFS = -DCOM_NO_WINDOWS_H
C_SRCS = \
mlang.c
SUBDIRS = tests
@MAKE_DLL_RULES@
### Dependencies:
This diff is collapsed.
@ stub ConvertINetMultiByteToUnicode
@ stub ConvertINetReset
@ stub ConvertINetString
@ stub ConvertINetUnicodeToMultiByte
@ stdcall DllCanUnloadNow() MLANG_DllCanUnloadNow
@ stdcall DllGetClassObject(ptr ptr ptr) MLANG_DllGetClassObject
@ stdcall DllRegisterServer() MLANG_DllRegisterServer
@ stdcall DllUnregisterServer() MLANG_DllUnregisterServer
@ stub GetGlobalFontLinkObject
@ stub IsConvertINetStringAvailable
@ stub LcidToRfc1766A
@ stub LcidToRfc1766W
@ stub Rfc1766ToLcidA
@ stub Rfc1766ToLcidW
Makefile
mlang.ok
testlist.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = mlang.dll
IMPORTS = ole32 gdi32 kernel32 ntdll
EXTRALIBS = -luuid
CTESTS = \
mlang.c
@MAKE_TEST_RULES@
### Dependencies:
/*
* Unit test suite for MLANG APIs.
*
* Copyright 2004 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define COBJMACROS
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "mlang.h"
#include "wine/test.h"
#include "wine/debug.h"
#ifndef CP_UNICODE
#define CP_UNICODE 1200
#endif
/*#define DUMP_CP_INFO*/
#define TRACE_2 OutputDebugStringA
static void test_multibyte_to_unicode_translations(IMultiLanguage2 *iML2)
{
/* these APIs are broken regarding constness of the input buffer */
char stringA[] = "Just a test string\0"; /* double 0 for CP_UNICODE tests */
WCHAR stringW[] = {'J','u','s','t',' ','a',' ','t','e','s','t',' ','s','t','r','i','n','g',0};
char bufA[256];
WCHAR bufW[256];
UINT lenA, lenW;
HRESULT ret;
/* IMultiLanguage2_ConvertStringToUnicode tests */
memset(bufW, 'x', sizeof(bufW));
lenA = 0;
lenW = sizeof(bufW)/sizeof(bufW[0]);
TRACE_2("Call IMultiLanguage2_ConvertStringToUnicode\n");
ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, 1252, stringA, &lenA, bufW, &lenW);
ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret);
ok(lenA == 0, "expected lenA 0, got %u\n", lenA);
ok(lenW == 0, "expected lenW 0, got %u\n", lenW);
memset(bufW, 'x', sizeof(bufW));
lenA = -1;
lenW = sizeof(bufW)/sizeof(bufW[0]);
TRACE_2("Call IMultiLanguage2_ConvertStringToUnicode\n");
ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, 1252, stringA, &lenA, bufW, &lenW);
ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret);
ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
ok(lenW == lstrlenW(stringW), "expected lenW %u, got %u\n", lstrlenW(stringW), lenW);
ok(bufW[lenW] != 0, "buf should not be 0 terminated\n");
bufW[lenW] = 0; /* -1 doesn't include 0 terminator */
ok(!lstrcmpW(bufW, stringW), "bufW/stringW mismatch\n");
memset(bufW, 'x', sizeof(bufW));
lenA = -1;
lenW = 5;
TRACE_2("Call IMultiLanguage2_ConvertStringToUnicode\n");
ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, 1252, stringA, &lenA, bufW, &lenW);
ok(ret == E_FAIL, "IMultiLanguage2_ConvertStringToUnicode should fail: %08lx\n", ret);
ok(lenW == 0, "expected lenW 0, got %u\n", lenW);
/* still has to do partial conversion */
ok(!memcmp(bufW, stringW, 5 * sizeof(WCHAR)), "bufW/stringW mismatch\n");
memset(bufW, 'x', sizeof(bufW));
lenA = -1;
lenW = sizeof(bufW)/sizeof(bufW[0]);
TRACE_2("Call IMultiLanguage2_ConvertStringToUnicode\n");
ret = IMultiLanguage2_ConvertStringToUnicode(iML2, NULL, CP_UNICODE, stringA, &lenA, bufW, &lenW);
ok(ret == S_OK, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret);
ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
ok(lenW == lstrlenW(stringW)/sizeof(WCHAR), "expected lenW %u, got %u\n", lstrlenW(stringW)/sizeof(WCHAR), lenW);
ok(bufW[lenW] != 0, "buf should not be 0 terminated\n");
bufW[lenW] = 0; /* -1 doesn't include 0 terminator */
ok(!lstrcmpA((LPCSTR)bufW, stringA), "bufW/stringA mismatch\n");
/* IMultiLanguage2_ConvertStringFromUnicode tests */
memset(bufA, 'x', sizeof(bufA));
lenW = 0;
lenA = sizeof(bufA);
TRACE_2("Call IMultiLanguage2_ConvertStringFromUnicode\n");
ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, stringW, &lenW, bufA, &lenA);
ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret);
ok(lenA == 0, "expected lenA 0, got %u\n", lenA);
ok(lenW == 0, "expected lenW 0, got %u\n", lenW);
memset(bufA, 'x', sizeof(bufA));
lenW = -1;
lenA = sizeof(bufA);
TRACE_2("Call IMultiLanguage2_ConvertStringFromUnicode\n");
ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, stringW, &lenW, bufA, &lenA);
ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret);
ok(lenA == lstrlenA(stringA), "expected lenA %u, got %u\n", lstrlenA(stringA), lenA);
ok(lenW == lstrlenW(stringW), "expected lenW %u, got %u\n", lstrlenW(stringW), lenW);
ok(bufA[lenA] != 0, "buf should not be 0 terminated\n");
bufA[lenA] = 0; /* -1 doesn't include 0 terminator */
ok(!lstrcmpA(bufA, stringA), "bufA/stringA mismatch\n");
memset(bufA, 'x', sizeof(bufA));
lenW = -1;
lenA = 5;
TRACE_2("Call IMultiLanguage2_ConvertStringFromUnicode\n");
ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, 1252, stringW, &lenW, bufA, &lenA);
ok(ret == E_FAIL, "IMultiLanguage2_ConvertStringFromUnicode should fail: %08lx\n", ret);
ok(lenA == 0, "expected lenA 0, got %u\n", lenA);
/* still has to do partial conversion */
ok(!memcmp(bufA, stringA, 5), "bufW/stringW mismatch\n");
memset(bufA, 'x', sizeof(bufA));
lenW = -1;
lenA = sizeof(bufA);
TRACE_2("Call IMultiLanguage2_ConvertStringFromUnicode\n");
ret = IMultiLanguage2_ConvertStringFromUnicode(iML2, NULL, CP_UNICODE, stringW, &lenW, bufA, &lenA);
ok(ret == S_OK, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret);
ok(lenA == lstrlenA(stringA) * sizeof(WCHAR), "expected lenA %u, got %u\n", lstrlenA(stringA) * sizeof(WCHAR), lenA);
ok(lenW == lstrlenW(stringW), "expected lenW %u, got %u\n", lstrlenW(stringW), lenW);
ok(bufA[lenA] != 0 && bufA[lenA+1] != 0, "buf should not be 0 terminated\n");
bufA[lenA] = 0; /* -1 doesn't include 0 terminator */
bufA[lenA+1] = 0; /* sizeof(WCHAR) */
ok(!lstrcmpW((LPCWSTR)bufA, stringW), "bufA/stringW mismatch\n");
}
static void inline cpinfo_cmp(MIMECPINFO *cpinfo1, MIMECPINFO *cpinfo2)
{
ok(cpinfo1->dwFlags == cpinfo2->dwFlags, "dwFlags mismatch: %08lx != %08lx\n", cpinfo1->dwFlags, cpinfo2->dwFlags);
ok(cpinfo1->uiCodePage == cpinfo2->uiCodePage, "uiCodePage mismatch: %u != %u\n", cpinfo1->uiCodePage, cpinfo2->uiCodePage);
ok(cpinfo1->uiFamilyCodePage == cpinfo2->uiFamilyCodePage, "uiFamilyCodePage mismatch: %u != %u\n", cpinfo1->uiFamilyCodePage, cpinfo2->uiFamilyCodePage);
ok(!lstrcmpW(cpinfo1->wszDescription, cpinfo2->wszDescription), "wszDescription mismatch\n");
ok(!lstrcmpW(cpinfo1->wszWebCharset, cpinfo2->wszWebCharset), "wszWebCharset mismatch\n");
ok(!lstrcmpW(cpinfo1->wszHeaderCharset, cpinfo2->wszHeaderCharset), "wszHeaderCharset mismatch\n");
ok(!lstrcmpW(cpinfo1->wszBodyCharset, cpinfo2->wszBodyCharset), "wszBodyCharset mismatch\n");
ok(!lstrcmpW(cpinfo1->wszFixedWidthFont, cpinfo2->wszFixedWidthFont), "wszFixedWidthFont mismatch\n");
ok(!lstrcmpW(cpinfo1->wszProportionalFont, cpinfo2->wszProportionalFont), "wszProportionalFont mismatch\n");
ok(cpinfo1->bGDICharset == cpinfo2->bGDICharset, "bGDICharset mismatch: %d != %d\n", cpinfo1->bGDICharset, cpinfo2->bGDICharset);
}
#ifdef DUMP_CP_INFO
static const char *dump_mime_flags(DWORD flags)
{
static char buf[1024];
buf[0] = 0;
if (flags & MIMECONTF_MAILNEWS) strcat(buf, " MIMECONTF_MAILNEWS");
if (flags & MIMECONTF_BROWSER) strcat(buf, " MIMECONTF_BROWSER");
if (flags & MIMECONTF_MINIMAL) strcat(buf, " MIMECONTF_MINIMAL");
if (flags & MIMECONTF_IMPORT) strcat(buf, " MIMECONTF_IMPORT");
if (flags & MIMECONTF_SAVABLE_MAILNEWS) strcat(buf, " MIMECONTF_SAVABLE_MAILNEWS");
if (flags & MIMECONTF_SAVABLE_BROWSER) strcat(buf, " MIMECONTF_SAVABLE_BROWSER");
if (flags & MIMECONTF_EXPORT) strcat(buf, " MIMECONTF_EXPORT");
if (flags & MIMECONTF_PRIVCONVERTER) strcat(buf, " MIMECONTF_PRIVCONVERTER");
if (flags & MIMECONTF_VALID) strcat(buf, " MIMECONTF_VALID");
if (flags & MIMECONTF_VALID_NLS) strcat(buf, " MIMECONTF_VALID_NLS");
if (flags & MIMECONTF_MIME_IE4) strcat(buf, " MIMECONTF_MIME_IE4");
if (flags & MIMECONTF_MIME_LATEST) strcat(buf, " MIMECONTF_MIME_LATEST");
if (flags & MIMECONTF_MIME_REGISTRY) strcat(buf, " MIMECONTF_MIME_REGISTRY");
return buf;
}
#endif
static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags)
{
IEnumCodePage *iEnumCP = NULL;
MIMECPINFO *cpinfo;
MIMECPINFO cpinfo2;
HRESULT ret;
ULONG i, n;
UINT total;
total = 0;
TRACE_2("Call IMultiLanguage2_GetNumberOfCodePageInfo\n");
ret = IMultiLanguage2_GetNumberOfCodePageInfo(iML2, &total);
ok(ret == S_OK && total != 0, "IMultiLanguage2_GetNumberOfCodePageInfo: expected S_OK/!0, got %08lx/%u\n", ret, total);
trace("total mlang supported codepages %u\n", total);
TRACE_2("Call IMultiLanguage2_EnumCodePages\n");
ret = IMultiLanguage2_EnumCodePages(iML2, flags, LANG_NEUTRAL, &iEnumCP);
trace("IMultiLanguage2_EnumCodePages = %08lx, iEnumCP = %p\n", ret, iEnumCP);
ok(ret == S_OK && iEnumCP, "IMultiLanguage2_EnumCodePages: expected S_OK/!NULL, got %08lx/%p\n", ret, iEnumCP);
TRACE_2("Call IEnumCodePage_Reset\n");
ret = IEnumCodePage_Reset(iEnumCP);
ok(ret == S_OK, "IEnumCodePage_Reset: expected S_OK, got %08lx\n", ret);
n = 65536;
TRACE_2("Call IEnumCodePage_Next\n");
ret = IEnumCodePage_Next(iEnumCP, 0, NULL, &n);
ok(n == 0 && ret == S_FALSE, "IEnumCodePage_Next: expected 0/S_FALSE, got %lu/%08lx\n", n, ret);
TRACE_2("Call IEnumCodePage_Next\n");
ret = IEnumCodePage_Next(iEnumCP, 0, NULL, NULL);
ok(ret == S_FALSE, "IEnumCodePage_Next: expected S_FALSE, got %08lx\n", ret);
cpinfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*cpinfo) * total * 2);
n = total * 2;
TRACE_2("Call IEnumCodePage_Next\n");
ret = IEnumCodePage_Next(iEnumCP, 0, cpinfo, &n);
trace("IEnumCodePage_Next = %08lx, n = %lu\n", ret, n);
ok(ret == S_FALSE && n == 0, "IEnumCodePage_Next: expected S_FALSE/0, got %08lx/%lu\n", ret, n);
n = total * 2;
TRACE_2("Call IEnumCodePage_Next\n");
ret = IEnumCodePage_Next(iEnumCP, n, cpinfo, &n);
ok(ret == S_OK && n != 0, "IEnumCodePage_Next: expected S_OK, got %08lx/%lu\n", ret, n);
trace("flags %08lx, enumerated codepages %lu\n", flags, n);
if (!flags)
{
ok(n == total, "IEnumCodePage_Next: expected %u, got %lu", total, n);
flags = MIMECONTF_MIME_LATEST;
}
total = n;
for (i = 0; i < n; i++)
{
CPINFOEXA cpinfoex;
CHARSETINFO csi;
#ifdef DUMP_CP_INFO
trace("MIMECPINFO #%lu:\n"
"dwFlags %08lx %s\n"
"uiCodePage %u\n"
"uiFamilyCodePage %u\n"
"wszDescription %s\n"
"wszWebCharset %s\n"
"wszHeaderCharset %s\n"
"wszBodyCharset %s\n"
"wszFixedWidthFont %s\n"
"wszProportionalFont %s\n"
"bGDICharset %d\n\n",
i,
cpinfo[i].dwFlags, dump_mime_flags(cpinfo[i].dwFlags),
cpinfo[i].uiCodePage,
cpinfo[i].uiFamilyCodePage,
wine_dbgstr_w(cpinfo[i].wszDescription),
wine_dbgstr_w(cpinfo[i].wszWebCharset),
wine_dbgstr_w(cpinfo[i].wszHeaderCharset),
wine_dbgstr_w(cpinfo[i].wszBodyCharset),
wine_dbgstr_w(cpinfo[i].wszFixedWidthFont),
wine_dbgstr_w(cpinfo[i].wszProportionalFont),
cpinfo[i].bGDICharset);
#endif
ok(cpinfo[i].dwFlags & flags, "enumerated flags %08lx do not include requested %08lx\n", cpinfo[i].dwFlags, flags);
if (TranslateCharsetInfo((DWORD *)cpinfo[i].uiFamilyCodePage, &csi, TCI_SRCCODEPAGE))
ok(cpinfo[i].bGDICharset == csi.ciCharset, "%d != %d\n", cpinfo[i].bGDICharset, csi.ciCharset);
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);
/* Win95 does not support UTF-7 */
if (cpinfo[i].uiCodePage == CP_UTF7) continue;
/* support files for some codepages might be not installed, or
* the codepage is just an alias.
*/
if (IsValidCodePage(cpinfo[i].uiCodePage))
{
TRACE_2("Call IMultiLanguage2_IsConvertible\n");
ret = IMultiLanguage2_IsConvertible(iML2, cpinfo[i].uiCodePage, CP_UNICODE);
ok(ret == S_OK, "IMultiLanguage2_IsConvertible(%u -> CP_UNICODE) = %08lx\n", cpinfo[i].uiCodePage, ret);
TRACE_2("Call IMultiLanguage2_IsConvertible\n");
ret = IMultiLanguage2_IsConvertible(iML2, CP_UNICODE, cpinfo[i].uiCodePage);
ok(ret == S_OK, "IMultiLanguage2_IsConvertible(CP_UNICODE -> %u) = %08lx\n", cpinfo[i].uiCodePage, ret);
TRACE_2("Call IMultiLanguage2_IsConvertible\n");
ret = IMultiLanguage2_IsConvertible(iML2, cpinfo[i].uiCodePage, CP_UTF8);
ok(ret == S_OK, "IMultiLanguage2_IsConvertible(%u -> CP_UTF8) = %08lx\n", cpinfo[i].uiCodePage, ret);
TRACE_2("Call IMultiLanguage2_IsConvertible\n");
ret = IMultiLanguage2_IsConvertible(iML2, CP_UTF8, cpinfo[i].uiCodePage);
ok(ret == S_OK, "IMultiLanguage2_IsConvertible(CP_UTF8 -> %u) = %08lx\n", cpinfo[i].uiCodePage, ret);
}
else
trace("IsValidCodePage failed for cp %u\n", cpinfo[i].uiCodePage);
trace("---\n");
}
/* now IEnumCodePage_Next should fail, since pointer is at the end */
n = 1;
ret = IEnumCodePage_Next(iEnumCP, 1, &cpinfo2, &n);
ok(ret == S_FALSE && n == 0, "IEnumCodePage_Next: expected S_OK/0, got %08lx/%lu\n", ret, n);
ret = IEnumCodePage_Reset(iEnumCP);
ok(ret == S_OK, "IEnumCodePage_Reset: expected S_OK, got %08lx\n", ret);
n = 0;
ret = IEnumCodePage_Next(iEnumCP, 1, &cpinfo2, &n);
ok(n == 1 && ret == S_OK, "IEnumCodePage_Next: expected 2/S_OK, got %lu/%08lx\n", n, ret);
cpinfo_cmp(&cpinfo[0], &cpinfo2);
#if 0
/* Due to a bug in MS' implementation of IEnumCodePage_Skip
* it's not used here.
*/
ret = IEnumCodePage_Skip(iEnumCP, 1);
ok(ret == S_OK, "IEnumCodePage_Skip: expected S_OK, got %08lx\n", ret);
#endif
for (i = 0; i < total - 1; i++)
{
n = 0;
ret = IEnumCodePage_Next(iEnumCP, 1, &cpinfo2, &n);
ok(n == 1 && ret == S_OK, "IEnumCodePage_Next: expected 1/S_OK, got %lu/%08lx\n", n, ret);
cpinfo_cmp(&cpinfo[i + 1], &cpinfo2);
}
HeapFree(GetProcessHeap(), 0, cpinfo);
IEnumCodePage_Release(iEnumCP);
}
START_TEST(mlang)
{
IMultiLanguage2 *iML2 = NULL;
HRESULT ret;
CoInitialize(NULL);
TRACE_2("Call CoCreateInstance\n");
ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
&IID_IMultiLanguage2, (void **)&iML2);
trace("ret = %08lx, MultiLanguage2 iML2 = %p\n", ret, iML2);
if (ret != S_OK || !iML2) return;
test_EnumCodePages(iML2, 0);
test_EnumCodePages(iML2, MIMECONTF_MIME_LATEST);
test_EnumCodePages(iML2, MIMECONTF_BROWSER);
test_EnumCodePages(iML2, MIMECONTF_MINIMAL);
test_EnumCodePages(iML2, MIMECONTF_VALID);
/* FIXME: why MIMECONTF_MIME_REGISTRY returns 0 of supported codepages? */
/*test_EnumCodePages(iML2, MIMECONTF_MIME_REGISTRY);*/
TRACE_2("Call IMultiLanguage2_IsConvertible\n");
ret = IMultiLanguage2_IsConvertible(iML2, CP_UTF8, CP_UNICODE);
ok(ret == S_OK, "IMultiLanguage2_IsConvertible(CP_UTF8 -> CP_UNICODE) = %08lx\n", ret);
TRACE_2("Call IMultiLanguage2_IsConvertible\n");
ret = IMultiLanguage2_IsConvertible(iML2, CP_UNICODE, CP_UTF8);
ok(ret == S_OK, "IMultiLanguage2_IsConvertible(CP_UNICODE -> CP_UTF8) = %08lx\n", ret);
test_multibyte_to_unicode_translations(iML2);
IMultiLanguage2_Release(iML2);
CoUninitialize();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment