37 IMimeInternational *internat, *internat2;
47 if(internat == internat2)
51 ref = IMimeInternational_Release(internat2);
56 ref = IMimeInternational_Release(internat);
61 ref = IMimeInternational_Release(internat2);
64 ref = IMimeInternational_Release(internat);
72 return CoCreateInstance(&CLSID_CMultiLanguage,
NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
73 &IID_IMultiLanguage, (
void **)ml);
89 hr = IMultiLanguage_GetCharsetInfo(ml, bstr, mlang_info);
90 IMultiLanguage_Release(ml);
106 hr = IMultiLanguage_GetCodePageInfo(ml,
cp, mlang_cp_info);
107 IMultiLanguage_Release(ml);
114 MIMECPINFO mlang_cp_info;
125 charset_name = mlang_cp_info.wszBodyCharset;
128 charset_name = mlang_cp_info.wszHeaderCharset;
131 charset_name = mlang_cp_info.wszWebCharset;
139 hr = IMultiLanguage_GetCharsetInfo(ml, charset_name, mlang_info);
140 IMultiLanguage_Release(ml);
147 IMimeInternational *internat;
149 HCHARSET hcs, hcs_windows_1252, hcs_windows_1251;
150 INETCSETINFO cs_info;
151 MIMECSETINFO mlang_cs_info;
156 hr = IMimeInternational_FindCharset(internat,
"nonexistent", &hcs);
157 ok(
hr == MIME_E_NOT_FOUND,
"got %08lx\n",
hr);
159 hr = IMimeInternational_FindCharset(internat,
"windows-1252", &hcs_windows_1252);
161 hr = IMimeInternational_FindCharset(internat,
"windows-1252", &hcs);
163 ok(hcs_windows_1252 == hcs,
"got different hcharsets for the same name\n");
164 hr = IMimeInternational_FindCharset(internat,
"WiNdoWs-1252", &hcs);
166 ok(hcs_windows_1252 == hcs,
"got different hcharsets for the same name\n");
168 hr = IMimeInternational_FindCharset(internat,
"windows-1251", &hcs_windows_1251);
170 ok(hcs_windows_1252 != hcs_windows_1251,
"got the same hcharset for the different names\n");
172 hr = IMimeInternational_GetCharsetInfo(internat, hcs_windows_1252, &cs_info);
177 ok(cs_info.cpiWindows == mlang_cs_info.uiCodePage,
"cpiWindows %ld while mlang uiCodePage %d\n",
178 cs_info.cpiWindows, mlang_cs_info.uiCodePage);
179 ok(cs_info.cpiInternet == mlang_cs_info.uiInternetEncoding,
"cpiInternet %ld while mlang uiInternetEncoding %d\n",
180 cs_info.cpiInternet, mlang_cs_info.uiInternetEncoding);
181 ok(cs_info.hCharset == hcs_windows_1252,
"hCharset doesn't match requested\n");
182 ok(!
strcmp(cs_info.szName,
"windows-1252"),
"szName doesn't match requested\n");
184 hr = IMimeInternational_GetCodePageCharset(internat, 1252, CHARSET_BODY, &hcs);
186 hr = IMimeInternational_GetCharsetInfo(internat, hcs, &cs_info);
191 ok(cs_info.cpiWindows == mlang_cs_info.uiCodePage,
"cpiWindows %ld while mlang uiCodePage %d\n",
192 cs_info.cpiWindows, mlang_cs_info.uiCodePage);
193 ok(cs_info.cpiInternet == mlang_cs_info.uiInternetEncoding,
"cpiInternet %ld while mlang uiInternetEncoding %d\n",
194 cs_info.cpiInternet, mlang_cs_info.uiInternetEncoding);
196 IMimeInternational_Release(internat);
201 IMimeInternational *internat;
203 HCHARSET hcs_default, hcs, hcs_windows_1251;
208 hr = IMimeInternational_GetDefaultCharset(internat, &hcs_default);
210 hr = IMimeInternational_GetCodePageCharset(internat,
GetACP(), CHARSET_BODY, &hcs);
212 ok(hcs_default == hcs,
"Unexpected default charset\n");
214 hr = IMimeInternational_FindCharset(internat,
"windows-1251", &hcs_windows_1251);
216 hr = IMimeInternational_SetDefaultCharset(internat, hcs_windows_1251);
218 hr = IMimeInternational_GetDefaultCharset(internat, &hcs);
220 ok(hcs == hcs_windows_1251,
"didn't retrieve recently set default\n");
222 hr = IMimeInternational_SetDefaultCharset(internat, hcs_default);
225 IMimeInternational_Release(internat);
230 IMimeInternational *internat;
234 PROPVARIANT prop_in, prop_out;
236 static WCHAR test_stringW[] =
L"test string";
243 hr = IMimeInternational_ConvertBuffer(internat, 1252, 28591, &
src, &
dst, &
read);
250 hr = IMimeInternational_ConvertBuffer(internat, 1252, 28591, &
src, &
dst, &
read);
253 ok(
dst.cbSize == 2,
"got %ld\n",
dst.cbSize);
257 prop_in.pwszVal = test_stringW;
258 hr = IMimeInternational_ConvertString(internat,
CP_UNICODE, 1252, &prop_in, &prop_out);
260 ok(prop_out.vt ==
VT_LPSTR,
"got %d\n", prop_out.vt);
266 prop_in.pwszVal = test_stringW;
267 hr = IMimeInternational_ConvertString(internat, 28591, 1252, &prop_in, &prop_out);
269 ok(prop_out.vt ==
VT_LPSTR,
"got %d\n", prop_out.vt);
275 hr = IMimeInternational_ConvertString(internat, 28591,
CP_UNICODE, &prop_in, &prop_out);
277 ok(prop_out.vt ==
VT_LPWSTR,
"got %d\n", prop_out.vt);
278 ok(!
lstrcmpW(prop_out.pwszVal, test_stringW),
"mismatched strings\n");
286 ok(prop_out.vt ==
VT_LPWSTR,
"got %d\n", prop_out.vt);
287 ok(!
lstrcmpW(prop_out.pwszVal, test_stringW),
"mismatched strings\n");
290 IMimeInternational_Release(internat);
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
void WINAPI CoTaskMemFree(void *ptr)
#define MultiByteToWideChar
static HRESULT mlang_getcsetinfo(const char *charset, MIMECSETINFO *mlang_info)
HRESULT WINAPI MimeOleGetInternat(IMimeInternational **internat)
static HRESULT get_mlang(IMultiLanguage **ml)
static HRESULT mlang_getcodepageinfo(UINT cp, MIMECPINFO *mlang_cp_info)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
static HRESULT mlang_getcsetinfo_from_cp(UINT cp, CHARSETTYPE charset_type, MIMECSETINFO *mlang_info)
static void test_create(void)
static void test_convert(void)
static void test_charset(void)
static void test_defaultcharset(void)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)