4 * Copyright 2002 Lionel Ulmer
5 * Copyright 2003,2004 Mike McCormack
6 * Copyright 2004,2005 Dmitry Timoshkov
7 * Copyright 2009 Detlef Riekenberg
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
40 #include "wine/debug.h"
41 #include "wine/list.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(mlang
);
47 static HRESULT
MultiLanguage_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
48 static HRESULT
MLangConvertCharset_create(IUnknown
*outer
, void **obj
);
49 static HRESULT
EnumRfc1766_create(LANGID LangId
, IEnumRfc1766
**ppEnum
);
51 static DWORD MLANG_tls_index
; /* to store various per thead data */
54 * Under what circumstances HKEY_CLASSES_ROOT\MIME\Database\Codepage and
55 * HKEY_CLASSES_ROOT\MIME\Database\Charset are used?
60 const char *description
;
63 const char *web_charset
;
64 const char *header_charset
;
65 const char *body_charset
;
69 /* These data are based on the codepage info in libs/unicode/cpmap.pl */
70 /* FIXME: Add 28604 (Celtic), 28606 (Balkan) */
72 static const MIME_CP_INFO arabic_cp
[] =
75 864, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
76 MIMECONTF_MIME_LATEST
,
77 "ibm864", "ibm864", "ibm864" },
79 1006, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
80 MIMECONTF_MIME_LATEST
,
81 "ibm1006", "ibm1006", "ibm1006" },
83 1256, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
84 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
85 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
86 "windows-1256", "windows-1256", "windows-1256" },
88 28596, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
89 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
90 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
91 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
92 "iso-8859-6", "iso-8859-6", "iso-8859-6" }
94 static const MIME_CP_INFO baltic_cp
[] =
97 775, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
98 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
99 "ibm775", "ibm775", "ibm775" },
100 { "Baltic (Windows)",
101 1257, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
102 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
103 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
104 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
105 "windows-1257", "windows-1257", "windows-1257" },
107 28594, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
108 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
109 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
110 MIMECONTF_MIME_LATEST
,
111 "iso-8859-4", "iso-8859-4", "iso-8859-4" },
113 28603, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
114 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
115 "iso-8859-13", "iso-8859-13", "iso-8859-13" }
117 static const MIME_CP_INFO chinese_simplified_cp
[] =
119 { "Chinese Simplified (Auto-Select)",
120 50936, MIMECONTF_IMPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
121 MIMECONTF_MIME_LATEST
,
122 "_autodetect_chs", "_autodetect_chs", "_autodetect_chs" },
123 { "Chinese Simplified (GB2312)",
124 936, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
125 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_VALID
|
126 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
127 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
128 "gb2312", "gb2312", "gb2312" },
129 { "Chinese Simplified (GB2312-80)",
130 20936, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
131 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
132 "x-cp20936", "x-cp20936", "x-cp20936" },
133 { "Chinese Simplified (HZ)",
134 52936, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
135 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
136 MIMECONTF_VALID
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
|
137 MIMECONTF_MIME_LATEST
,
138 "hz-gb-2312", "hz-gb-2312", "hz-gb-2312" },
139 { "Chinese Simplified (GB18030)",
140 54936, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
141 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
142 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
143 MIMECONTF_MIME_LATEST
,
144 "GB18030", "GB18030", "GB18030" },
145 { "Chinese Simplified (GBK)",
146 936, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
147 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
148 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
149 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
150 "gbk", "gbk", "gbk" }
152 static const MIME_CP_INFO chinese_traditional_cp
[] =
154 { "Chinese Traditional (Auto-Select)",
155 50950, MIMECONTF_IMPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
156 MIMECONTF_MIME_LATEST
,
157 "_autodetect_cht", "_autodetect_cht", "_autodetect_cht" },
158 { "Chinese Traditional (Big5)",
159 950, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
160 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
161 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
162 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
163 "big5", "big5", "big5" },
164 { "Chinese Traditional (CNS)",
165 20000, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
166 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
167 "x-Chinese-CNS", "x-Chinese-CNS", "x-Chinese-CNS" }
169 static const MIME_CP_INFO central_european_cp
[] =
171 { "Central European (DOS)",
172 852, MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_BROWSER
|
173 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
174 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
175 "ibm852", "ibm852", "ibm852" },
176 { "Central European (Windows)",
177 1250, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
178 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
179 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
180 MIMECONTF_MIME_LATEST
,
181 "windows-1250", "windows-1250", "windows-1250" },
182 { "Central European (Mac)",
183 10029, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
184 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
185 "x-mac-ce", "x-mac-ce", "x-mac-ce" },
186 { "Central European (ISO)",
187 28592, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
188 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
189 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
190 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
191 "iso-8859-2", "iso-8859-2", "iso-8859-2" }
193 static const MIME_CP_INFO cyrillic_cp
[] =
196 855, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
197 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
198 "ibm855", "ibm855", "ibm855" },
200 866, MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_BROWSER
|
201 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
|
202 MIMECONTF_MIME_LATEST
,
203 "cp866", "cp866", "cp866" },
204 #if 0 /* Windows has 20866 as an official code page for KOI8-R */
205 { "Cyrillic (KOI8-R)",
206 878, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
207 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
208 "koi8-r", "koi8-r", "koi8-r" },
210 { "Cyrillic (Windows)",
211 1251, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
212 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
213 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
214 "windows-1251", "windows-1251", "windows-1251" },
216 10007, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
217 MIMECONTF_MIME_LATEST
,
218 "x-mac-cyrillic", "x-mac-cyrillic", "x-mac-cyrillic" },
219 { "Cyrillic (KOI8-R)",
220 20866, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
221 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
222 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
223 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
224 "koi8-r", "koi8-r", "koi8-r" },
225 { "Cyrillic (KOI8-U)",
226 21866, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
227 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
228 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
229 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
230 "koi8-u", "koi8-u", "koi8-u" },
232 28595, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
233 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
234 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
235 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
236 "iso-8859-5", "iso-8859-5", "iso-8859-5" }
238 static const MIME_CP_INFO greek_cp
[] =
241 737, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
242 MIMECONTF_MIME_LATEST
,
243 "ibm737", "ibm737", "ibm737" },
244 { "Greek, Modern (DOS)",
245 869, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
246 MIMECONTF_MIME_LATEST
,
247 "ibm869", "ibm869", "ibm869" },
248 { "IBM EBCDIC (Greek Modern)",
249 875, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
250 MIMECONTF_MIME_LATEST
,
251 "cp875", "cp875", "cp875" },
253 1253, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
254 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
255 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
256 "windows-1253", "windows-1253", "windows-1253" },
258 10006, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
259 MIMECONTF_MIME_LATEST
,
260 "x-mac-greek", "x-mac-greek", "x-mac-greek" },
262 28597, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
263 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
264 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
265 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
266 "iso-8859-7", "iso-8859-7", "iso-8859-7" }
268 static const MIME_CP_INFO hebrew_cp
[] =
271 424, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
272 MIMECONTF_MIME_LATEST
,
273 "ibm424", "ibm424", "ibm424" },
275 856, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
276 MIMECONTF_MIME_LATEST
,
277 "cp856", "cp856", "cp856" },
279 862, MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
280 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
281 MIMECONTF_MIME_LATEST
,
282 "dos-862", "dos-862", "dos-862" },
283 { "Hebrew (Windows)",
284 1255, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
285 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
286 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
287 "windows-1255", "windows-1255", "windows-1255" },
288 { "Hebrew (ISO-Visual)",
289 28598, MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
290 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
291 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
292 "iso-8859-8", "iso-8859-8", "iso-8859-8" }
294 static const MIME_CP_INFO japanese_cp
[] =
296 { "Japanese (Auto-Select)",
297 50932, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
298 MIMECONTF_IMPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
299 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
300 "_autodetect", "_autodetect", "_autodetect" },
302 51932, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
303 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
304 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
305 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
306 "euc-jp", "euc-jp", "euc-jp" },
308 50220, MIMECONTF_IMPORT
| MIMECONTF_MAILNEWS
| MIMECONTF_EXPORT
|
309 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_VALID_NLS
|
310 MIMECONTF_PRIVCONVERTER
| MIMECONTF_MIME_LATEST
|
312 "iso-2022-jp","iso-2022-jp","iso-2022-jp"},
313 { "Japanese (JIS 0208-1990 and 0212-1990)",
314 20932, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
315 MIMECONTF_VALID
| MIMECONTF_PRIVCONVERTER
| MIMECONTF_MIME_LATEST
,
316 "EUC-JP","EUC-JP","EUC-JP"},
317 { "Japanese (JIS-Allow 1 byte Kana)",
318 50221, MIMECONTF_MAILNEWS
| MIMECONTF_EXPORT
| MIMECONTF_SAVABLE_BROWSER
|
319 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_VALID_NLS
|
320 MIMECONTF_VALID
| MIMECONTF_PRIVCONVERTER
| MIMECONTF_MIME_LATEST
,
321 "csISO2022JP","iso-2022-jp","iso-2022-jp"},
322 { "Japanese (JIS-Allow 1 byte Kana - SO/SI)",
323 50222, MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_VALID
|
324 MIMECONTF_PRIVCONVERTER
| MIMECONTF_MIME_LATEST
,
325 "iso-2022-jp","iso-2022-jp","iso-2022-jp"},
327 10001, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
328 MIMECONTF_VALID
| MIMECONTF_PRIVCONVERTER
| MIMECONTF_MIME_LATEST
,
329 "x-mac-japanese","x-mac-japanese","x-mac-japanese"},
330 { "Japanese (Shift-JIS)",
331 932, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
332 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
333 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
334 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
335 "shift_jis", "iso-2022-jp", "iso-2022-jp" }
337 static const MIME_CP_INFO korean_cp
[] =
340 949, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
341 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
342 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
343 MIMECONTF_MIME_LATEST
,
344 "ks_c_5601-1987", "ks_c_5601-1987", "ks_c_5601-1987" }
346 static const MIME_CP_INFO thai_cp
[] =
349 874, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_MIME_LATEST
,
350 "ibm-thai", "ibm-thai", "ibm-thai" }
352 static const MIME_CP_INFO turkish_cp
[] =
355 857, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
356 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
357 "ibm857", "ibm857", "ibm857" },
358 { "IBM EBCDIC (Turkish Latin-5)",
359 1026, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
360 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
361 "ibm1026", "ibm1026", "ibm1026" },
362 { "Turkish (Windows)",
363 1254, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
364 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
365 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
366 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
367 "windows-1254", "windows-1254", "windows-1254" },
369 10081, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
370 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
371 "x-mac-turkish", "x-mac-turkish", "x-mac-turkish" },
373 28593, MIMECONTF_MAILNEWS
| MIMECONTF_IMPORT
|
374 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
375 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
376 "iso-8859-3", "iso-8859-3", "iso-8859-3" },
378 28599, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
379 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
380 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
381 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
382 "iso-8859-9", "iso-8859-9", "iso-8859-9" }
384 static const MIME_CP_INFO vietnamese_cp
[] =
386 { "Vietnamese (Windows)",
387 1258, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
388 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
389 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
|
390 MIMECONTF_MIME_LATEST
,
391 "windows-1258", "windows-1258", "windows-1258" }
394 static const MIME_CP_INFO western_cp
[] =
396 { "IBM EBCDIC (US-Canada)",
397 37, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
398 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
399 "ibm037", "ibm037", "ibm037" },
400 { "OEM United States",
401 437, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
402 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
403 "ibm437", "ibm437", "ibm437" },
404 { "IBM EBCDIC (International)",
405 500, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
406 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
407 "ibm500", "ibm500", "ibm500" },
408 { "Western European (DOS)",
409 850, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
410 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
411 "ibm850", "ibm850", "ibm850" },
412 { "Portuguese (DOS)",
413 860, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
414 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
415 "ibm860", "ibm860", "ibm860" },
417 861, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
418 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
419 "ibm861", "ibm861", "ibm861" },
420 { "French Canadian (DOS)",
421 863, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
422 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
423 "ibm863", "ibm863", "ibm863" },
425 865, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
426 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
427 "ibm865", "ibm865", "ibm865" },
428 { "Western European (Windows)",
429 1252, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
430 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
431 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
432 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
433 "windows-1252", "windows-1252", "iso-8859-1" },
434 { "Western European (Mac)",
435 10000, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
436 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
437 "macintosh", "macintosh", "macintosh" },
439 10079, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
440 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
441 "x-mac-icelandic", "x-mac-icelandic", "x-mac-icelandic" },
443 20127, MIMECONTF_MAILNEWS
| MIMECONTF_IMPORT
| MIMECONTF_EXPORT
|
444 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_VALID
|
445 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
446 "us-ascii", "us-ascii", "us-ascii", L
"ascii" },
447 { "Western European (ISO)",
448 28591, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
449 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
450 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
451 MIMECONTF_MIME_LATEST
,
452 "iso-8859-1", "iso-8859-1", "iso-8859-1" },
454 28605, MIMECONTF_MAILNEWS
| MIMECONTF_IMPORT
|
455 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
456 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
457 MIMECONTF_MIME_LATEST
,
458 "iso-8859-15", "iso-8859-15", "iso-8859-15" }
460 static const MIME_CP_INFO unicode_cp
[] =
463 CP_UNICODE
, MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
464 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
465 MIMECONTF_VALID
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
|
466 MIMECONTF_MIME_LATEST
,
467 "unicode", "unicode", "unicode" },
469 CP_UTF7
, MIMECONTF_MAILNEWS
| MIMECONTF_IMPORT
|
470 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
471 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
472 "utf-7", "utf-7", "utf-7" },
474 CP_UTF8
, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
475 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
476 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
477 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
478 "utf-8", "utf-8", "utf-8" }
481 static const struct mlang_data
483 const char *description
;
484 UINT family_codepage
;
486 const MIME_CP_INFO
*mime_cp_info
;
487 const char *fixed_font
;
488 const char *proportional_font
;
492 { "Arabic", 1256, ARRAY_SIZE(arabic_cp
), arabic_cp
,
493 "Simplified Arabic Fixed","Simplified Arabic", sidArabic
},
494 { "Baltic", 1257, ARRAY_SIZE(baltic_cp
), baltic_cp
,
495 "Courier New","Arial", sidAsciiLatin
},
496 { "Chinese Simplified", 936, ARRAY_SIZE(chinese_simplified_cp
), chinese_simplified_cp
,
497 "Simsun","Simsun", sidHan
},
498 { "Chinese Traditional", 950, ARRAY_SIZE(chinese_traditional_cp
), chinese_traditional_cp
,
499 "MingLiu","New MingLiu", sidBopomofo
},
500 { "Central European", 1250, ARRAY_SIZE(central_european_cp
), central_european_cp
,
501 "Courier New","Arial", sidAsciiLatin
},
502 { "Cyrillic", 1251, ARRAY_SIZE(cyrillic_cp
), cyrillic_cp
,
503 "Courier New","Arial", sidCyrillic
},
504 { "Greek", 1253, ARRAY_SIZE(greek_cp
), greek_cp
,
505 "Courier New","Arial", sidGreek
},
506 { "Hebrew", 1255, ARRAY_SIZE(hebrew_cp
), hebrew_cp
,
507 "Miriam Fixed","David", sidHebrew
},
508 { "Japanese", 932, ARRAY_SIZE(japanese_cp
), japanese_cp
,
509 "MS Gothic","MS PGothic", sidKana
},
510 { "Korean", 949, ARRAY_SIZE(korean_cp
), korean_cp
,
511 "GulimChe","Gulim", sidHangul
},
512 { "Thai", 874, ARRAY_SIZE(thai_cp
), thai_cp
,
513 "Tahoma","Tahoma", sidThai
},
514 { "Turkish", 1254, ARRAY_SIZE(turkish_cp
), turkish_cp
,
515 "Courier New","Arial", sidAsciiLatin
},
516 { "Vietnamese", 1258, ARRAY_SIZE(vietnamese_cp
), vietnamese_cp
,
517 "Courier New","Arial", sidAsciiLatin
},
518 { "Western European", 1252, ARRAY_SIZE(western_cp
), western_cp
,
519 "Courier New","Arial", sidAsciiLatin
},
520 { "Unicode", CP_UNICODE
, ARRAY_SIZE(unicode_cp
), unicode_cp
,
521 "Courier New","Arial" }
526 struct list list_entry
;
532 static struct list font_cache
= LIST_INIT(font_cache
);
533 static CRITICAL_SECTION font_cache_critical
;
534 static CRITICAL_SECTION_DEBUG font_cache_critical_debug
=
536 0, 0, &font_cache_critical
,
537 { &font_cache_critical_debug
.ProcessLocksList
, &font_cache_critical_debug
.ProcessLocksList
},
538 0, 0, { (DWORD_PTR
)(__FILE__
": font_cache_critical") }
540 static CRITICAL_SECTION font_cache_critical
= { &font_cache_critical_debug
, -1, 0, 0, 0, 0 };
542 static void fill_cp_info(const struct mlang_data
*ml_data
, UINT index
, MIMECPINFO
*mime_cp_info
);
544 static LONG dll_count
;
547 * Japanese Detection and Conversion Functions
550 #define HANKATA(A) ((A >= 161) && (A <= 223))
551 #define ISEUC(A) ((A >= 161) && (A <= 254))
552 #define NOTEUC(A,B) (((A >= 129) && (A <= 159)) && ((B >= 64) && (B <= 160)))
553 #define SJIS1(A) (((A >= 129) && (A <= 159)) || ((A >= 224) && (A <= 239)))
554 #define SJIS2(A) ((A >= 64) && (A <= 252))
555 #define ISMARU(A) ((A >= 202) && (A <= 206))
556 #define ISNIGORI(A) (((A >= 182) && (A <= 196)) || ((A >= 202) && (A <= 206)))
558 static UINT
DetectJapaneseCode(LPCSTR input
, DWORD count
)
564 while ((code
== 0 || code
== 51932) && i
< count
)
567 if (c1
== 0x1b /* ESC */)
579 if (c1
=='B' || c1
== '@')
593 else if (ISEUC(c1
) && ISEUC(c2
))
595 else if (((c1
== 142)) && HANKATA(c2
))
603 static inline void jis2sjis(unsigned char *p1
, unsigned char *p2
)
605 unsigned char c1
= *p1
;
606 unsigned char c2
= *p2
;
607 int row
= c1
< 95 ? 112 : 176;
608 int cell
= c1
% 2 ? 31 + (c2
> 95) : 126;
610 *p1
= ((c1
+ 1) >> 1) + row
;
614 static inline void sjis2jis(unsigned char *p1
, unsigned char *p2
)
616 unsigned char c1
= *p1
;
617 unsigned char c2
= *p2
;
618 int shift
= c2
< 159;
619 int row
= c1
< 160 ? 112 : 176;
620 int cell
= shift
? (31 + (c2
> 127)): 126;
622 *p1
= ((c1
- row
) << 1) - shift
;
626 static int han2zen(unsigned char *p1
, unsigned char *p2
)
630 static const unsigned char char1
[] = {129,129,129,129,129,131,131,131,131,
631 131,131,131,131,131,131,129,131,131,131,131,131,131,131,131,131,131,
632 131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
633 131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
635 static const unsigned char char2
[] = {66,117,118,65,69,146,64,66,68,70,
636 72,131,133,135,98,91,65,67,69,71,73,74,76,78,80,82,84,86,88,90,92,94,
637 96,99,101,103,105,106,107,108,109,110,113,116,119,122,125,126,128,
638 129,130,132,134,136,137,138,139,140,141,143,147,74,75};
640 if (( *p2
== 222) && ((ISNIGORI(*p1
) || (*p1
== 179))))
642 else if ((*p2
== 223) && (ISMARU(*p1
)))
645 if (*p1
>= 161 && *p1
<= 223)
647 unsigned char index
= *p1
- 161;
656 if (((*p2
>= 74) && (*p2
<= 103)) || ((*p2
>= 110) && (*p2
<= 122)))
658 else if ((*p1
== 131) && (*p2
== 69))
661 else if ((maru
) && ((*p2
>= 110) && (*p2
<= 122)))
671 static UINT
ConvertJIS2SJIS(LPCSTR input
, DWORD count
, LPSTR output
)
676 BOOL shifted
= FALSE
;
681 if (p
== 0x1b /* ESC */)
687 if (p2
== '$' || p2
=='(')
689 if (p2
== 'K' || p2
=='$')
716 static inline int exit_shift(LPSTR out
, int c
)
727 static inline int enter_shift(LPSTR out
, int c
)
739 static UINT
ConvertSJIS2JIS(LPCSTR input
, DWORD count
, LPSTR output
)
744 BOOL shifted
= FALSE
;
749 if (p
== 10 || p
== 13) /* NL and CR */
754 j
+= exit_shift(output
,j
);
768 p2
= input
[i
] & 0xff;
775 j
+=enter_shift(output
,j
);
793 p2
= input
[i
+1] & 0xff;
799 j
+=enter_shift(output
,j
);
814 j
+= exit_shift(output
,j
);
826 j
+= exit_shift(output
,j
);
830 static UINT
ConvertJISJapaneseToUnicode(LPCSTR input
, DWORD count
,
831 LPWSTR output
, DWORD out_count
)
835 sjis_string
= HeapAlloc(GetProcessHeap(),0,count
);
836 rc
= ConvertJIS2SJIS(input
,count
,sjis_string
);
839 TRACE("%s\n",debugstr_an(sjis_string
,rc
));
841 rc
= MultiByteToWideChar(932,0,sjis_string
,rc
,output
,out_count
);
843 rc
= MultiByteToWideChar(932,0,sjis_string
,rc
,0,0);
845 HeapFree(GetProcessHeap(),0,sjis_string
);
850 static UINT
ConvertUnknownJapaneseToUnicode(LPCSTR input
, DWORD count
,
851 LPWSTR output
, DWORD out_count
)
855 int code
= DetectJapaneseCode(input
,count
);
856 TRACE("Japanese code %i\n",code
);
862 rc
= MultiByteToWideChar(CP_ACP
,0,input
,count
,output
,out_count
);
864 rc
= MultiByteToWideChar(CP_ACP
,0,input
,count
,0,0);
869 rc
= MultiByteToWideChar(932,0,input
,count
,output
,out_count
);
871 rc
= MultiByteToWideChar(932,0,input
,count
,0,0);
876 rc
= MultiByteToWideChar(20932,0,input
,count
,output
,out_count
);
878 rc
= MultiByteToWideChar(20932,0,input
,count
,0,0);
882 sjis_string
= HeapAlloc(GetProcessHeap(),0,count
);
883 rc
= ConvertJIS2SJIS(input
,count
,sjis_string
);
886 TRACE("%s\n",debugstr_an(sjis_string
,rc
));
888 rc
= MultiByteToWideChar(932,0,sjis_string
,rc
,output
,out_count
);
890 rc
= MultiByteToWideChar(932,0,sjis_string
,rc
,0,0);
892 HeapFree(GetProcessHeap(),0,sjis_string
);
898 static UINT
ConvertJapaneseUnicodeToJIS(LPCWSTR input
, DWORD count
,
899 LPSTR output
, DWORD out_count
)
905 len
= WideCharToMultiByte(932,0,input
,count
,0,0,NULL
,NULL
);
906 sjis_string
= HeapAlloc(GetProcessHeap(),0,len
);
907 WideCharToMultiByte(932,0,input
,count
,sjis_string
,len
,NULL
,NULL
);
908 TRACE("%s\n",debugstr_an(sjis_string
,len
));
910 rc
= ConvertSJIS2JIS(sjis_string
, len
, NULL
);
913 ConvertSJIS2JIS(sjis_string
, len
, output
);
915 HeapFree(GetProcessHeap(),0,sjis_string
);
921 * Dll lifetime tracking declaration
923 static void LockModule(void)
925 InterlockedIncrement(&dll_count
);
928 static void UnlockModule(void)
930 InterlockedDecrement(&dll_count
);
933 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
936 case DLL_PROCESS_ATTACH
:
937 MLANG_tls_index
= TlsAlloc();
938 DisableThreadLibraryCalls(hInstDLL
);
940 case DLL_PROCESS_DETACH
:
942 TlsFree(MLANG_tls_index
);
948 HRESULT WINAPI
ConvertINetMultiByteToUnicode(
958 TRACE("%p %d %s %p %p %p\n", pdwMode
, dwEncoding
,
959 debugstr_a(pSrcStr
), pcSrcSize
, pDstStr
, pcDstSize
);
965 pcSrcSize
= &src_len
;
973 /* forwarding euc-jp to EUC-JP */
974 if (dwEncoding
== 51932)
980 if (*pcSrcSize
== -1)
981 *pcSrcSize
= lstrlenW((LPCWSTR
)pSrcStr
);
982 *pcDstSize
= min(*pcSrcSize
, *pcDstSize
);
983 *pcSrcSize
*= sizeof(WCHAR
);
985 memmove(pDstStr
, pSrcStr
, *pcDstSize
* sizeof(WCHAR
));
991 *pcDstSize
= ConvertJISJapaneseToUnicode(pSrcStr
,*pcSrcSize
,pDstStr
,*pcDstSize
);
994 *pcDstSize
= ConvertUnknownJapaneseToUnicode(pSrcStr
,*pcSrcSize
,pDstStr
,*pcDstSize
);
998 if (*pcSrcSize
== -1)
999 *pcSrcSize
= lstrlenA(pSrcStr
);
1002 *pcDstSize
= MultiByteToWideChar(dwEncoding
, 0, pSrcStr
, *pcSrcSize
, pDstStr
, *pcDstSize
);
1004 *pcDstSize
= MultiByteToWideChar(dwEncoding
, 0, pSrcStr
, *pcSrcSize
, NULL
, 0);
1014 HRESULT WINAPI
ConvertINetUnicodeToMultiByte(
1025 TRACE("%p %d %s %p %p %p\n", pdwMode
, dwEncoding
,
1026 debugstr_w(pSrcStr
), pcSrcSize
, pDstStr
, pcDstSize
);
1032 pcSrcSize
= &src_len
;
1034 destsz
= (pDstStr
) ? *pcDstSize
: 0;
1037 if (!pSrcStr
|| !*pcSrcSize
)
1040 if (*pcSrcSize
== -1)
1041 *pcSrcSize
= lstrlenW(pSrcStr
);
1043 /* forwarding euc-jp to EUC-JP */
1044 if (dwEncoding
== 51932)
1047 if (dwEncoding
== CP_UNICODE
)
1049 if (*pcSrcSize
== -1)
1050 *pcSrcSize
= lstrlenW(pSrcStr
);
1052 size
= min(*pcSrcSize
, destsz
) * sizeof(WCHAR
);
1054 memmove(pDstStr
, pSrcStr
, size
);
1059 else if (dwEncoding
== 50220 || dwEncoding
== 50221 || dwEncoding
== 50222)
1061 size
= ConvertJapaneseUnicodeToJIS(pSrcStr
, *pcSrcSize
, NULL
, 0);
1067 size
= ConvertJapaneseUnicodeToJIS(pSrcStr
, *pcSrcSize
, pDstStr
,
1076 size
= WideCharToMultiByte(dwEncoding
, 0, pSrcStr
, *pcSrcSize
,
1077 NULL
, 0, NULL
, NULL
);
1083 size
= WideCharToMultiByte(dwEncoding
, 0, pSrcStr
, *pcSrcSize
,
1084 pDstStr
, destsz
, NULL
, NULL
);
1099 HRESULT WINAPI
ConvertINetString(
1101 DWORD dwSrcEncoding
,
1102 DWORD dwDstEncoding
,
1109 TRACE("%p %d %d %s %p %p %p\n", pdwMode
, dwSrcEncoding
, dwDstEncoding
,
1110 debugstr_a(pSrcStr
), pcSrcSize
, pDstStr
, pcDstSize
);
1112 if (dwSrcEncoding
== CP_UNICODE
)
1115 if (pcSrcSize
&& *pcSrcSize
!= -1)
1117 cSrcSizeW
= *pcSrcSize
/ sizeof(WCHAR
);
1118 pcSrcSize
= &cSrcSizeW
;
1120 return ConvertINetUnicodeToMultiByte(pdwMode
, dwDstEncoding
, (LPCWSTR
)pSrcStr
, pcSrcSize
, pDstStr
, pcDstSize
);
1122 else if (dwDstEncoding
== CP_UNICODE
)
1124 HRESULT hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, (LPWSTR
)pDstStr
, pcDstSize
);
1125 *pcDstSize
*= sizeof(WCHAR
);
1134 TRACE("convert %s from %d to %d\n", debugstr_a(pSrcStr
), dwSrcEncoding
, dwDstEncoding
);
1136 hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, NULL
, &cDstSizeW
);
1140 pDstStrW
= HeapAlloc(GetProcessHeap(), 0, cDstSizeW
* sizeof(WCHAR
));
1141 hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, pDstStrW
, &cDstSizeW
);
1143 hr
= ConvertINetUnicodeToMultiByte(pdwMode
, dwDstEncoding
, pDstStrW
, &cDstSizeW
, pDstStr
, pcDstSize
);
1145 HeapFree(GetProcessHeap(), 0, pDstStrW
);
1150 static HRESULT
GetFamilyCodePage(
1152 UINT
* puiFamilyCodePage
)
1156 TRACE("%u %p\n", uiCodePage
, puiFamilyCodePage
);
1158 if (!puiFamilyCodePage
) return S_FALSE
;
1160 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
1162 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1164 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
1166 *puiFamilyCodePage
= mlang_data
[i
].family_codepage
;
1175 HRESULT WINAPI
IsConvertINetStringAvailable(
1176 DWORD dwSrcEncoding
,
1177 DWORD dwDstEncoding
)
1179 UINT src_family
, dst_family
;
1181 TRACE("%d %d\n", dwSrcEncoding
, dwDstEncoding
);
1183 if (GetFamilyCodePage(dwSrcEncoding
, &src_family
) != S_OK
||
1184 GetFamilyCodePage(dwDstEncoding
, &dst_family
) != S_OK
)
1187 if (src_family
== dst_family
) return S_OK
;
1189 /* we can convert any codepage to/from unicode */
1190 if (src_family
== CP_UNICODE
|| dst_family
== CP_UNICODE
) return S_OK
;
1195 static inline HRESULT
lcid_to_rfc1766A( LCID lcid
, LPSTR rfc1766
, INT len
)
1197 CHAR buffer
[MAX_RFC1766_NAME
];
1198 INT n
= GetLocaleInfoA(lcid
, LOCALE_SISO639LANGNAME
, buffer
, MAX_RFC1766_NAME
);
1203 i
= PRIMARYLANGID(lcid
);
1204 if ((((i
== LANG_ENGLISH
) || (i
== LANG_CHINESE
) || (i
== LANG_ARABIC
)) &&
1205 (SUBLANGID(lcid
) == SUBLANG_DEFAULT
)) ||
1206 (SUBLANGID(lcid
) > SUBLANG_DEFAULT
)) {
1208 buffer
[n
- 1] = '-';
1209 i
= GetLocaleInfoA(lcid
, LOCALE_SISO3166CTRYNAME
, buffer
+ n
, MAX_RFC1766_NAME
- n
);
1211 buffer
[n
- 1] = '\0';
1216 LCMapStringA( LOCALE_USER_DEFAULT
, LCMAP_LOWERCASE
, buffer
, n
+ i
, rfc1766
, len
);
1217 return ((n
+ i
) > len
) ? E_INVALIDARG
: S_OK
;
1222 static inline HRESULT
lcid_to_rfc1766W( LCID lcid
, LPWSTR rfc1766
, INT len
)
1224 WCHAR buffer
[MAX_RFC1766_NAME
];
1225 INT n
= GetLocaleInfoW(lcid
, LOCALE_SISO639LANGNAME
, buffer
, MAX_RFC1766_NAME
);
1230 i
= PRIMARYLANGID(lcid
);
1231 if ((((i
== LANG_ENGLISH
) || (i
== LANG_CHINESE
) || (i
== LANG_ARABIC
)) &&
1232 (SUBLANGID(lcid
) == SUBLANG_DEFAULT
)) ||
1233 (SUBLANGID(lcid
) > SUBLANG_DEFAULT
)) {
1235 buffer
[n
- 1] = '-';
1236 i
= GetLocaleInfoW(lcid
, LOCALE_SISO3166CTRYNAME
, buffer
+ n
, MAX_RFC1766_NAME
- n
);
1238 buffer
[n
- 1] = '\0';
1243 LCMapStringW(LOCALE_USER_DEFAULT
, LCMAP_LOWERCASE
, buffer
, n
+ i
, rfc1766
, len
);
1244 return ((n
+ i
) > len
) ? E_INVALIDARG
: S_OK
;
1249 HRESULT WINAPI
LcidToRfc1766A(
1254 TRACE("%04x %p %u\n", lcid
, pszRfc1766
, nChar
);
1256 return E_INVALIDARG
;
1258 return lcid_to_rfc1766A(lcid
, pszRfc1766
, nChar
);
1261 HRESULT WINAPI
LcidToRfc1766W(
1266 TRACE("%04x %p %u\n", lcid
, pszRfc1766
, nChar
);
1268 return E_INVALIDARG
;
1270 return lcid_to_rfc1766W(lcid
, pszRfc1766
, nChar
);
1273 static HRESULT
lcid_from_rfc1766(IEnumRfc1766
*iface
, LCID
*lcid
, LPCWSTR rfc1766
)
1278 while (IEnumRfc1766_Next(iface
, 1, &info
, &num
) == S_OK
)
1280 if (!wcsicmp(info
.wszRfc1766
, rfc1766
))
1285 if (lstrlenW(rfc1766
) == 2 && !memcmp(info
.wszRfc1766
, rfc1766
, 2 * sizeof(WCHAR
)))
1287 *lcid
= PRIMARYLANGID(info
.lcid
);
1295 HRESULT WINAPI
Rfc1766ToLcidW(LCID
*pLocale
, LPCWSTR pszRfc1766
)
1297 IEnumRfc1766
*enumrfc1766
;
1300 TRACE("(%p, %s)\n", pLocale
, debugstr_w(pszRfc1766
));
1302 if (!pLocale
|| !pszRfc1766
)
1303 return E_INVALIDARG
;
1305 hr
= EnumRfc1766_create(0, &enumrfc1766
);
1309 hr
= lcid_from_rfc1766(enumrfc1766
, pLocale
, pszRfc1766
);
1310 IEnumRfc1766_Release(enumrfc1766
);
1315 HRESULT WINAPI
Rfc1766ToLcidA(LCID
*lcid
, LPCSTR rfc1766A
)
1317 WCHAR rfc1766W
[MAX_RFC1766_NAME
+ 1];
1320 return E_INVALIDARG
;
1322 MultiByteToWideChar(CP_ACP
, 0, rfc1766A
, -1, rfc1766W
, MAX_RFC1766_NAME
);
1323 rfc1766W
[MAX_RFC1766_NAME
] = 0;
1325 return Rfc1766ToLcidW(lcid
, rfc1766W
);
1328 static HRESULT
map_font(HDC hdc
, DWORD codepages
, HFONT src_font
, HFONT
*dst_font
)
1330 struct font_list
*font_list_entry
;
1331 CHARSETINFO charset_info
;
1332 HFONT new_font
, old_font
;
1340 if (hdc
== NULL
|| src_font
== NULL
) return E_FAIL
;
1342 for (i
= 0; i
< 32; i
++)
1344 mask
= (DWORD
)(1 << i
);
1345 if (codepages
& mask
)
1349 ret
= TranslateCharsetInfo(Csb
, &charset_info
, TCI_SRCFONTSIG
);
1352 /* use cached font if possible */
1353 found_cached
= FALSE
;
1354 EnterCriticalSection(&font_cache_critical
);
1355 LIST_FOR_EACH_ENTRY(font_list_entry
, &font_cache
, struct font_list
, list_entry
)
1357 if (font_list_entry
->charset
== charset_info
.ciCharset
&&
1358 font_list_entry
->base_font
== src_font
)
1360 if (dst_font
!= NULL
)
1361 *dst_font
= font_list_entry
->font
;
1362 found_cached
= TRUE
;
1365 LeaveCriticalSection(&font_cache_critical
);
1366 if (found_cached
) return S_OK
;
1368 GetObjectW(src_font
, sizeof(font_attr
), &font_attr
);
1369 font_attr
.lfCharSet
= (BYTE
)charset_info
.ciCharset
;
1370 font_attr
.lfWidth
= 0;
1371 font_attr
.lfFaceName
[0] = 0;
1372 new_font
= CreateFontIndirectW(&font_attr
);
1373 if (new_font
== NULL
) continue;
1375 old_font
= SelectObject(hdc
, new_font
);
1376 charset
= GetTextCharset(hdc
);
1377 SelectObject(hdc
, old_font
);
1378 if (charset
== charset_info
.ciCharset
)
1380 font_list_entry
= HeapAlloc(GetProcessHeap(), 0, sizeof(*font_list_entry
));
1381 if (font_list_entry
== NULL
) return E_OUTOFMEMORY
;
1383 font_list_entry
->base_font
= src_font
;
1384 font_list_entry
->font
= new_font
;
1385 font_list_entry
->charset
= charset
;
1387 EnterCriticalSection(&font_cache_critical
);
1388 list_add_tail(&font_cache
, &font_list_entry
->list_entry
);
1389 LeaveCriticalSection(&font_cache_critical
);
1391 if (dst_font
!= NULL
)
1392 *dst_font
= new_font
;
1401 static HRESULT
release_font(HFONT font
)
1403 struct font_list
*font_list_entry
;
1407 EnterCriticalSection(&font_cache_critical
);
1408 LIST_FOR_EACH_ENTRY(font_list_entry
, &font_cache
, struct font_list
, list_entry
)
1410 if (font_list_entry
->font
== font
)
1412 list_remove(&font_list_entry
->list_entry
);
1414 HeapFree(GetProcessHeap(), 0, font_list_entry
);
1419 LeaveCriticalSection(&font_cache_critical
);
1424 static HRESULT
clear_font_cache(void)
1426 struct font_list
*font_list_entry
;
1427 struct font_list
*font_list_entry2
;
1429 EnterCriticalSection(&font_cache_critical
);
1430 LIST_FOR_EACH_ENTRY_SAFE(font_list_entry
, font_list_entry2
, &font_cache
, struct font_list
, list_entry
)
1432 list_remove(&font_list_entry
->list_entry
);
1433 DeleteObject(font_list_entry
->font
);
1434 HeapFree(GetProcessHeap(), 0, font_list_entry
);
1436 LeaveCriticalSection(&font_cache_critical
);
1441 /******************************************************************************
1442 * MLANG ClassFactory
1445 IClassFactory IClassFactory_iface
;
1447 HRESULT (*pfnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
1448 } IClassFactoryImpl
;
1450 static inline IClassFactoryImpl
*impl_from_IClassFactory(IClassFactory
*iface
)
1452 return CONTAINING_RECORD(iface
, IClassFactoryImpl
, IClassFactory_iface
);
1455 struct object_creation_info
1459 HRESULT (*pfnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
1462 static const struct object_creation_info object_creation
[] =
1464 { &CLSID_CMultiLanguage
, "CLSID_CMultiLanguage", MultiLanguage_create
},
1465 { &CLSID_CMLangConvertCharset
, "CLSID_CMLangConvertCharset", MLangConvertCharset_create
}
1468 static HRESULT WINAPI
MLANGCF_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppobj
)
1470 TRACE("%s\n", debugstr_guid(riid
) );
1472 if (IsEqualGUID(riid
, &IID_IUnknown
)
1473 || IsEqualGUID(riid
, &IID_IClassFactory
))
1475 IClassFactory_AddRef(iface
);
1481 WARN("(%p)->(%s,%p), not found\n", iface
, debugstr_guid(riid
), ppobj
);
1482 return E_NOINTERFACE
;
1485 static ULONG WINAPI
MLANGCF_AddRef(IClassFactory
*iface
)
1487 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
1488 return InterlockedIncrement(&This
->ref
);
1491 static ULONG WINAPI
MLANGCF_Release(IClassFactory
*iface
)
1493 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
1494 ULONG ref
= InterlockedDecrement(&This
->ref
);
1498 TRACE("Destroying %p\n", This
);
1499 HeapFree(GetProcessHeap(), 0, This
);
1505 static HRESULT WINAPI
MLANGCF_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
1506 REFIID riid
, void **ppobj
)
1508 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
1512 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
1515 hres
= This
->pfnCreateInstance(pOuter
, (LPVOID
*) &punk
);
1516 if (SUCCEEDED(hres
)) {
1517 hres
= IUnknown_QueryInterface(punk
, riid
, ppobj
);
1518 IUnknown_Release(punk
);
1520 TRACE("returning (%p) -> %x\n", *ppobj
, hres
);
1524 static HRESULT WINAPI
MLANGCF_LockServer(IClassFactory
*iface
, BOOL dolock
)
1534 static const IClassFactoryVtbl MLANGCF_Vtbl
=
1536 MLANGCF_QueryInterface
,
1539 MLANGCF_CreateInstance
,
1543 /******************************************************************
1544 * DllGetClassObject (MLANG.@)
1546 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
1549 IClassFactoryImpl
*factory
;
1551 TRACE("%s %s %p\n",debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
1553 if ( !IsEqualGUID( &IID_IClassFactory
, iid
)
1554 && ! IsEqualGUID( &IID_IUnknown
, iid
) )
1555 return E_NOINTERFACE
;
1557 for (i
= 0; i
< ARRAY_SIZE(object_creation
); i
++)
1559 if (IsEqualGUID(object_creation
[i
].clsid
, rclsid
))
1563 if (i
== ARRAY_SIZE(object_creation
))
1565 FIXME("%s: no class found.\n", debugstr_guid(rclsid
));
1566 return CLASS_E_CLASSNOTAVAILABLE
;
1569 TRACE("Creating a class factory for %s\n",object_creation
[i
].szClassName
);
1571 factory
= HeapAlloc(GetProcessHeap(), 0, sizeof(*factory
));
1572 if (factory
== NULL
) return E_OUTOFMEMORY
;
1574 factory
->IClassFactory_iface
.lpVtbl
= &MLANGCF_Vtbl
;
1577 factory
->pfnCreateInstance
= object_creation
[i
].pfnCreateInstance
;
1579 *ppv
= &factory
->IClassFactory_iface
;
1581 TRACE("(%p) <- %p\n", ppv
, &factory
->IClassFactory_iface
);
1587 /******************************************************************************/
1589 typedef struct tagMLang_impl
1591 IMLangFontLink IMLangFontLink_iface
;
1592 IMultiLanguage IMultiLanguage_iface
;
1593 IMultiLanguage3 IMultiLanguage3_iface
;
1594 IMLangFontLink2 IMLangFontLink2_iface
;
1595 IMLangLineBreakConsole IMLangLineBreakConsole_iface
;
1597 DWORD total_cp
, total_scripts
;
1600 /******************************************************************************/
1602 typedef struct tagEnumCodePage_impl
1604 IEnumCodePage IEnumCodePage_iface
;
1608 } EnumCodePage_impl
;
1610 static inline EnumCodePage_impl
*impl_from_IEnumCodePage( IEnumCodePage
*iface
)
1612 return CONTAINING_RECORD( iface
, EnumCodePage_impl
, IEnumCodePage_iface
);
1615 static HRESULT WINAPI
fnIEnumCodePage_QueryInterface(
1616 IEnumCodePage
* iface
,
1620 EnumCodePage_impl
*This
= impl_from_IEnumCodePage( iface
);
1622 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1624 if (IsEqualGUID(riid
, &IID_IUnknown
)
1625 || IsEqualGUID(riid
, &IID_IEnumCodePage
))
1627 IEnumCodePage_AddRef(iface
);
1628 TRACE("Returning IID_IEnumCodePage %p ref = %d\n", This
, This
->ref
);
1629 *ppvObject
= &This
->IEnumCodePage_iface
;
1633 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1634 return E_NOINTERFACE
;
1637 static ULONG WINAPI
fnIEnumCodePage_AddRef(
1638 IEnumCodePage
* iface
)
1640 EnumCodePage_impl
*This
= impl_from_IEnumCodePage( iface
);
1641 return InterlockedIncrement(&This
->ref
);
1644 static ULONG WINAPI
fnIEnumCodePage_Release(
1645 IEnumCodePage
* iface
)
1647 EnumCodePage_impl
*This
= impl_from_IEnumCodePage( iface
);
1648 ULONG ref
= InterlockedDecrement(&This
->ref
);
1650 TRACE("%p ref = %d\n", This
, ref
);
1653 TRACE("Destroying %p\n", This
);
1654 HeapFree(GetProcessHeap(), 0, This
->cpinfo
);
1655 HeapFree(GetProcessHeap(), 0, This
);
1661 static HRESULT WINAPI
fnIEnumCodePage_Clone(
1662 IEnumCodePage
* iface
,
1663 IEnumCodePage
** ppEnum
)
1665 EnumCodePage_impl
*This
= impl_from_IEnumCodePage( iface
);
1666 FIXME("%p %p\n", This
, ppEnum
);
1670 static HRESULT WINAPI
fnIEnumCodePage_Next(
1671 IEnumCodePage
* iface
,
1674 ULONG
* pceltFetched
)
1677 EnumCodePage_impl
*This
= impl_from_IEnumCodePage( iface
);
1679 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1681 if (!pceltFetched
) return S_FALSE
;
1684 if (!rgelt
) return S_FALSE
;
1686 if (This
->pos
+ celt
> This
->total
)
1687 celt
= This
->total
- This
->pos
;
1689 if (!celt
) return S_FALSE
;
1691 memcpy(rgelt
, This
->cpinfo
+ This
->pos
, celt
* sizeof(MIMECPINFO
));
1692 *pceltFetched
= celt
;
1695 for (i
= 0; i
< celt
; i
++)
1697 TRACE("#%u: %08x %u %u %s %s %s %s %s %s %d\n",
1698 i
, rgelt
[i
].dwFlags
, rgelt
[i
].uiCodePage
,
1699 rgelt
[i
].uiFamilyCodePage
,
1700 wine_dbgstr_w(rgelt
[i
].wszDescription
),
1701 wine_dbgstr_w(rgelt
[i
].wszWebCharset
),
1702 wine_dbgstr_w(rgelt
[i
].wszHeaderCharset
),
1703 wine_dbgstr_w(rgelt
[i
].wszBodyCharset
),
1704 wine_dbgstr_w(rgelt
[i
].wszFixedWidthFont
),
1705 wine_dbgstr_w(rgelt
[i
].wszProportionalFont
),
1706 rgelt
[i
].bGDICharset
);
1711 static HRESULT WINAPI
fnIEnumCodePage_Reset(
1712 IEnumCodePage
* iface
)
1714 EnumCodePage_impl
*This
= impl_from_IEnumCodePage( iface
);
1716 TRACE("%p\n", This
);
1722 static HRESULT WINAPI
fnIEnumCodePage_Skip(
1723 IEnumCodePage
* iface
,
1726 EnumCodePage_impl
*This
= impl_from_IEnumCodePage( iface
);
1728 TRACE("%p %u\n", This
, celt
);
1730 if (celt
>= This
->total
) return S_FALSE
;
1736 static const IEnumCodePageVtbl IEnumCodePage_vtbl
=
1738 fnIEnumCodePage_QueryInterface
,
1739 fnIEnumCodePage_AddRef
,
1740 fnIEnumCodePage_Release
,
1741 fnIEnumCodePage_Clone
,
1742 fnIEnumCodePage_Next
,
1743 fnIEnumCodePage_Reset
,
1744 fnIEnumCodePage_Skip
1747 static HRESULT
EnumCodePage_create( MLang_impl
* mlang
, DWORD grfFlags
,
1748 LANGID LangId
, IEnumCodePage
** ppEnumCodePage
)
1750 EnumCodePage_impl
*ecp
;
1754 TRACE("%p, %08x, %04x, %p\n", mlang
, grfFlags
, LangId
, ppEnumCodePage
);
1756 if (!grfFlags
) /* enumerate internal data base of encodings */
1757 grfFlags
= MIMECONTF_MIME_LATEST
;
1759 ecp
= HeapAlloc( GetProcessHeap(), 0, sizeof (EnumCodePage_impl
) );
1760 ecp
->IEnumCodePage_iface
.lpVtbl
= &IEnumCodePage_vtbl
;
1764 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
1766 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1768 if (mlang_data
[i
].mime_cp_info
[n
].flags
& grfFlags
)
1773 ecp
->cpinfo
= HeapAlloc(GetProcessHeap(), 0,
1774 sizeof(MIMECPINFO
) * ecp
->total
);
1775 cpinfo
= ecp
->cpinfo
;
1777 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
1779 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1781 if (mlang_data
[i
].mime_cp_info
[n
].flags
& grfFlags
)
1782 fill_cp_info(&mlang_data
[i
], n
, cpinfo
++);
1786 TRACE("enumerated %d codepages with flags %08x\n", ecp
->total
, grfFlags
);
1788 *ppEnumCodePage
= &ecp
->IEnumCodePage_iface
;
1793 /******************************************************************************/
1795 typedef struct tagEnumScript_impl
1797 IEnumScript IEnumScript_iface
;
1799 SCRIPTINFO
*script_info
;
1803 static inline EnumScript_impl
*impl_from_IEnumScript( IEnumScript
*iface
)
1805 return CONTAINING_RECORD( iface
, EnumScript_impl
, IEnumScript_iface
);
1808 static HRESULT WINAPI
fnIEnumScript_QueryInterface(
1813 EnumScript_impl
*This
= impl_from_IEnumScript( iface
);
1815 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1817 if (IsEqualGUID(riid
, &IID_IUnknown
)
1818 || IsEqualGUID(riid
, &IID_IEnumScript
))
1820 IEnumScript_AddRef(iface
);
1821 TRACE("Returning IID_IEnumScript %p ref = %d\n", This
, This
->ref
);
1822 *ppvObject
= &This
->IEnumScript_iface
;
1826 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1827 return E_NOINTERFACE
;
1830 static ULONG WINAPI
fnIEnumScript_AddRef(
1833 EnumScript_impl
*This
= impl_from_IEnumScript( iface
);
1834 return InterlockedIncrement(&This
->ref
);
1837 static ULONG WINAPI
fnIEnumScript_Release(
1840 EnumScript_impl
*This
= impl_from_IEnumScript( iface
);
1841 ULONG ref
= InterlockedDecrement(&This
->ref
);
1843 TRACE("%p ref = %d\n", This
, ref
);
1846 TRACE("Destroying %p\n", This
);
1847 HeapFree(GetProcessHeap(), 0, This
->script_info
);
1848 HeapFree(GetProcessHeap(), 0, This
);
1854 static HRESULT WINAPI
fnIEnumScript_Clone(
1856 IEnumScript
** ppEnum
)
1858 EnumScript_impl
*This
= impl_from_IEnumScript( iface
);
1859 FIXME("%p %p: stub!\n", This
, ppEnum
);
1863 static HRESULT WINAPI
fnIEnumScript_Next(
1867 ULONG
* pceltFetched
)
1869 EnumScript_impl
*This
= impl_from_IEnumScript( iface
);
1871 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1873 if (!pceltFetched
|| !rgelt
) return E_FAIL
;
1877 if (This
->pos
+ celt
> This
->total
)
1878 celt
= This
->total
- This
->pos
;
1880 if (!celt
) return S_FALSE
;
1882 memcpy(rgelt
, This
->script_info
+ This
->pos
, celt
* sizeof(SCRIPTINFO
));
1883 *pceltFetched
= celt
;
1889 static HRESULT WINAPI
fnIEnumScript_Reset(
1892 EnumScript_impl
*This
= impl_from_IEnumScript( iface
);
1894 TRACE("%p\n", This
);
1900 static HRESULT WINAPI
fnIEnumScript_Skip(
1904 EnumScript_impl
*This
= impl_from_IEnumScript( iface
);
1906 TRACE("%p %u\n", This
, celt
);
1908 if (celt
>= This
->total
) return S_FALSE
;
1914 static const IEnumScriptVtbl IEnumScript_vtbl
=
1916 fnIEnumScript_QueryInterface
,
1917 fnIEnumScript_AddRef
,
1918 fnIEnumScript_Release
,
1919 fnIEnumScript_Clone
,
1921 fnIEnumScript_Reset
,
1925 static HRESULT
EnumScript_create( MLang_impl
* mlang
, DWORD dwFlags
,
1926 LANGID LangId
, IEnumScript
** ppEnumScript
)
1928 EnumScript_impl
*es
;
1931 TRACE("%p, %08x, %04x, %p\n", mlang
, dwFlags
, LangId
, ppEnumScript
);
1933 if (!dwFlags
) /* enumerate all available scripts */
1934 dwFlags
= SCRIPTCONTF_SCRIPT_USER
| SCRIPTCONTF_SCRIPT_HIDE
| SCRIPTCONTF_SCRIPT_SYSTEM
;
1936 es
= HeapAlloc( GetProcessHeap(), 0, sizeof (EnumScript_impl
) );
1937 es
->IEnumScript_iface
.lpVtbl
= &IEnumScript_vtbl
;
1940 /* do not enumerate unicode flavours */
1941 es
->total
= ARRAY_SIZE(mlang_data
) - 1;
1942 es
->script_info
= HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPTINFO
) * es
->total
);
1944 for (i
= 0; i
< es
->total
; i
++)
1946 es
->script_info
[i
].ScriptId
= i
;
1947 es
->script_info
[i
].uiCodePage
= mlang_data
[i
].family_codepage
;
1948 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].description
, -1,
1949 es
->script_info
[i
].wszDescription
, MAX_SCRIPT_NAME
);
1950 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].fixed_font
, -1,
1951 es
->script_info
[i
].wszFixedWidthFont
, MAX_MIMEFACE_NAME
);
1952 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].proportional_font
, -1,
1953 es
->script_info
[i
].wszProportionalFont
, MAX_MIMEFACE_NAME
);
1956 TRACE("enumerated %d scripts with flags %08x\n", es
->total
, dwFlags
);
1958 *ppEnumScript
= &es
->IEnumScript_iface
;
1963 /******************************************************************************/
1965 static inline MLang_impl
*impl_from_IMLangFontLink( IMLangFontLink
*iface
)
1967 return CONTAINING_RECORD( iface
, MLang_impl
, IMLangFontLink_iface
);
1970 static HRESULT WINAPI
fnIMLangFontLink_QueryInterface(
1971 IMLangFontLink
* iface
,
1975 MLang_impl
*This
= impl_from_IMLangFontLink( iface
);
1976 return IMultiLanguage3_QueryInterface( &This
->IMultiLanguage3_iface
, riid
, ppvObject
);
1979 static ULONG WINAPI
fnIMLangFontLink_AddRef(
1980 IMLangFontLink
* iface
)
1982 MLang_impl
*This
= impl_from_IMLangFontLink( iface
);
1983 return IMultiLanguage3_AddRef( &This
->IMultiLanguage3_iface
);
1986 static ULONG WINAPI
fnIMLangFontLink_Release(
1987 IMLangFontLink
* iface
)
1989 MLang_impl
*This
= impl_from_IMLangFontLink( iface
);
1990 return IMultiLanguage3_Release( &This
->IMultiLanguage3_iface
);
1993 static HRESULT WINAPI
fnIMLangFontLink_GetCharCodePages(
1994 IMLangFontLink
* iface
,
1998 MLang_impl
*This
= impl_from_IMLangFontLink( iface
);
1999 return IMLangFontLink2_GetCharCodePages(&This
->IMLangFontLink2_iface
, ch_src
, codepages
);
2002 static HRESULT WINAPI
fnIMLangFontLink_GetStrCodePages(
2003 IMLangFontLink
* iface
,
2010 MLang_impl
*This
= impl_from_IMLangFontLink( iface
);
2011 return IMLangFontLink2_GetStrCodePages(&This
->IMLangFontLink2_iface
, src
, src_len
, priority_cp
,
2012 codepages
, ret_len
);
2015 static HRESULT WINAPI
fnIMLangFontLink_CodePageToCodePages(
2016 IMLangFontLink
* iface
,
2020 MLang_impl
*This
= impl_from_IMLangFontLink( iface
);
2021 return IMLangFontLink2_CodePageToCodePages(&This
->IMLangFontLink2_iface
, codepage
, codepages
);
2024 static HRESULT WINAPI
fnIMLangFontLink_CodePagesToCodePage(
2025 IMLangFontLink
* iface
,
2030 MLang_impl
*This
= impl_from_IMLangFontLink(iface
);
2031 return IMLangFontLink2_CodePagesToCodePage(&This
->IMLangFontLink2_iface
, codepages
,
2032 def_codepage
, codepage
);
2035 static HRESULT WINAPI
fnIMLangFontLink_GetFontCodePages(
2036 IMLangFontLink
* iface
,
2041 MLang_impl
*This
= impl_from_IMLangFontLink(iface
);
2042 return IMLangFontLink2_GetFontCodePages(&This
->IMLangFontLink2_iface
, hdc
, hfont
, codepages
);
2045 static HRESULT WINAPI
fnIMLangFontLink_MapFont(
2046 IMLangFontLink
* iface
,
2052 TRACE("(%p)->%p %08x %p %p\n",iface
, hDC
, dwCodePages
, hSrcFont
, phDestFont
);
2054 return map_font(hDC
, dwCodePages
, hSrcFont
, phDestFont
);
2057 static HRESULT WINAPI
fnIMLangFontLink_ReleaseFont(
2058 IMLangFontLink
* iface
,
2061 TRACE("(%p)->%p\n",iface
, hFont
);
2063 return release_font(hFont
);
2066 static HRESULT WINAPI
fnIMLangFontLink_ResetFontMapping(
2067 IMLangFontLink
* iface
)
2069 TRACE("(%p)\n",iface
);
2071 return clear_font_cache();
2075 static const IMLangFontLinkVtbl IMLangFontLink_vtbl
=
2077 fnIMLangFontLink_QueryInterface
,
2078 fnIMLangFontLink_AddRef
,
2079 fnIMLangFontLink_Release
,
2080 fnIMLangFontLink_GetCharCodePages
,
2081 fnIMLangFontLink_GetStrCodePages
,
2082 fnIMLangFontLink_CodePageToCodePages
,
2083 fnIMLangFontLink_CodePagesToCodePage
,
2084 fnIMLangFontLink_GetFontCodePages
,
2085 fnIMLangFontLink_MapFont
,
2086 fnIMLangFontLink_ReleaseFont
,
2087 fnIMLangFontLink_ResetFontMapping
,
2090 /******************************************************************************/
2092 static inline MLang_impl
*impl_from_IMultiLanguage( IMultiLanguage
*iface
)
2094 return CONTAINING_RECORD( iface
, MLang_impl
, IMultiLanguage_iface
);
2097 static HRESULT WINAPI
fnIMultiLanguage_QueryInterface(
2098 IMultiLanguage
* iface
,
2102 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2103 return IMultiLanguage3_QueryInterface(&This
->IMultiLanguage3_iface
, riid
, obj
);
2106 static ULONG WINAPI
fnIMultiLanguage_AddRef( IMultiLanguage
* iface
)
2108 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2109 return IMultiLanguage3_AddRef(&This
->IMultiLanguage3_iface
);
2112 static ULONG WINAPI
fnIMultiLanguage_Release( IMultiLanguage
* iface
)
2114 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2115 return IMultiLanguage3_Release(&This
->IMultiLanguage3_iface
);
2118 static HRESULT WINAPI
fnIMultiLanguage_GetNumberOfCodePageInfo(
2119 IMultiLanguage
* iface
,
2122 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2123 TRACE("(%p, %p)\n", This
, cp
);
2124 return IMultiLanguage3_GetNumberOfCodePageInfo(&This
->IMultiLanguage3_iface
, cp
);
2127 static HRESULT WINAPI
fnIMultiLanguage_GetCodePageInfo(
2128 IMultiLanguage
* iface
,
2130 PMIMECPINFO pCodePageInfo
)
2133 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2135 TRACE("%p, %u, %p\n", This
, uiCodePage
, pCodePageInfo
);
2137 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
2139 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2141 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
2143 fill_cp_info(&mlang_data
[i
], n
, pCodePageInfo
);
2152 static HRESULT WINAPI
fnIMultiLanguage_GetFamilyCodePage(
2153 IMultiLanguage
* iface
,
2157 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2158 return IMultiLanguage3_GetFamilyCodePage(&This
->IMultiLanguage3_iface
, cp
, family_cp
);
2161 static HRESULT WINAPI
fnIMultiLanguage_EnumCodePages(
2162 IMultiLanguage
* iface
,
2164 IEnumCodePage
** ppEnumCodePage
)
2166 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2168 TRACE("%p %08x %p\n", This
, grfFlags
, ppEnumCodePage
);
2170 return EnumCodePage_create( This
, grfFlags
, 0, ppEnumCodePage
);
2173 static HRESULT WINAPI
fnIMultiLanguage_GetCharsetInfo(
2174 IMultiLanguage
* iface
,
2176 PMIMECSETINFO pCharsetInfo
)
2178 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2179 return IMultiLanguage3_GetCharsetInfo( &This
->IMultiLanguage3_iface
, Charset
, pCharsetInfo
);
2182 static HRESULT WINAPI
fnIMultiLanguage_IsConvertible(
2183 IMultiLanguage
* iface
,
2187 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2188 return IMultiLanguage3_IsConvertible(&This
->IMultiLanguage3_iface
, src_enc
, dst_enc
);
2191 static HRESULT WINAPI
fnIMultiLanguage_ConvertString(
2192 IMultiLanguage
* iface
,
2201 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2202 return IMultiLanguage3_ConvertString(&This
->IMultiLanguage3_iface
, mode
, src_enc
,
2203 dst_enc
, src
, src_size
, dest
, dest_size
);
2206 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringToUnicode(
2207 IMultiLanguage
* iface
,
2215 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2216 return IMultiLanguage3_ConvertStringToUnicode(&This
->IMultiLanguage3_iface
,
2217 mode
, src_enc
, src
, src_size
, dest
, dest_size
);
2220 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringFromUnicode(
2221 IMultiLanguage
* iface
,
2229 MLang_impl
*This
= impl_from_IMultiLanguage(iface
);
2230 return IMultiLanguage3_ConvertStringFromUnicode(&This
->IMultiLanguage3_iface
,
2231 mode
, encoding
, src
, src_size
, dest
, dest_size
);
2234 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringReset(
2235 IMultiLanguage
* iface
)
2237 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2238 return IMultiLanguage3_ConvertStringReset(&This
->IMultiLanguage3_iface
);
2241 static HRESULT WINAPI
fnIMultiLanguage_GetRfc1766FromLcid(
2242 IMultiLanguage
* iface
,
2246 MLang_impl
*This
= impl_from_IMultiLanguage(iface
);
2247 return IMultiLanguage3_GetRfc1766FromLcid(&This
->IMultiLanguage3_iface
, lcid
, pbstrRfc1766
);
2250 static HRESULT WINAPI
fnIMultiLanguage_GetLcidFromRfc1766(
2251 IMultiLanguage
* iface
,
2255 MLang_impl
*This
= impl_from_IMultiLanguage(iface
);
2256 return IMultiLanguage3_GetLcidFromRfc1766(&This
->IMultiLanguage3_iface
, locale
, rfc1766
);
2259 /******************************************************************************/
2261 typedef struct tagEnumRfc1766_impl
2263 IEnumRfc1766 IEnumRfc1766_iface
;
2269 static inline EnumRfc1766_impl
*impl_from_IEnumRfc1766( IEnumRfc1766
*iface
)
2271 return CONTAINING_RECORD( iface
, EnumRfc1766_impl
, IEnumRfc1766_iface
);
2274 static HRESULT WINAPI
fnIEnumRfc1766_QueryInterface(
2275 IEnumRfc1766
*iface
,
2279 EnumRfc1766_impl
*This
= impl_from_IEnumRfc1766( iface
);
2281 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
2283 if (IsEqualGUID(riid
, &IID_IUnknown
)
2284 || IsEqualGUID(riid
, &IID_IEnumRfc1766
))
2286 IEnumRfc1766_AddRef(iface
);
2287 TRACE("Returning IID_IEnumRfc1766 %p ref = %d\n", This
, This
->ref
);
2288 *ppvObject
= &This
->IEnumRfc1766_iface
;
2292 WARN("(%p) -> (%s,%p), not found\n",This
,debugstr_guid(riid
),ppvObject
);
2293 return E_NOINTERFACE
;
2296 static ULONG WINAPI
fnIEnumRfc1766_AddRef(
2297 IEnumRfc1766
*iface
)
2299 EnumRfc1766_impl
*This
= impl_from_IEnumRfc1766( iface
);
2300 return InterlockedIncrement(&This
->ref
);
2303 static ULONG WINAPI
fnIEnumRfc1766_Release(
2304 IEnumRfc1766
*iface
)
2306 EnumRfc1766_impl
*This
= impl_from_IEnumRfc1766( iface
);
2307 ULONG ref
= InterlockedDecrement(&This
->ref
);
2309 TRACE("%p ref = %d\n", This
, ref
);
2312 TRACE("Destroying %p\n", This
);
2313 HeapFree(GetProcessHeap(), 0, This
->info
);
2314 HeapFree(GetProcessHeap(), 0, This
);
2319 static HRESULT WINAPI
fnIEnumRfc1766_Clone(
2320 IEnumRfc1766
*iface
,
2321 IEnumRfc1766
**ppEnum
)
2323 EnumRfc1766_impl
*This
= impl_from_IEnumRfc1766( iface
);
2325 FIXME("%p %p\n", This
, ppEnum
);
2329 static HRESULT WINAPI
fnIEnumRfc1766_Next(
2330 IEnumRfc1766
*iface
,
2333 ULONG
*pceltFetched
)
2336 EnumRfc1766_impl
*This
= impl_from_IEnumRfc1766( iface
);
2338 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
2340 if (!pceltFetched
) return S_FALSE
;
2343 if (!rgelt
) return S_FALSE
;
2345 if (This
->pos
+ celt
> This
->total
)
2346 celt
= This
->total
- This
->pos
;
2348 if (!celt
) return S_FALSE
;
2350 memcpy(rgelt
, This
->info
+ This
->pos
, celt
* sizeof(RFC1766INFO
));
2351 *pceltFetched
= celt
;
2354 for (i
= 0; i
< celt
; i
++)
2356 TRACE("#%u: %08x %s %s\n",
2358 wine_dbgstr_w(rgelt
[i
].wszRfc1766
),
2359 wine_dbgstr_w(rgelt
[i
].wszLocaleName
));
2364 static HRESULT WINAPI
fnIEnumRfc1766_Reset(
2365 IEnumRfc1766
*iface
)
2367 EnumRfc1766_impl
*This
= impl_from_IEnumRfc1766( iface
);
2369 TRACE("%p\n", This
);
2375 static HRESULT WINAPI
fnIEnumRfc1766_Skip(
2376 IEnumRfc1766
*iface
,
2379 EnumRfc1766_impl
*This
= impl_from_IEnumRfc1766( iface
);
2381 TRACE("%p %u\n", This
, celt
);
2383 if (celt
>= This
->total
) return S_FALSE
;
2389 static const IEnumRfc1766Vtbl IEnumRfc1766_vtbl
=
2391 fnIEnumRfc1766_QueryInterface
,
2392 fnIEnumRfc1766_AddRef
,
2393 fnIEnumRfc1766_Release
,
2394 fnIEnumRfc1766_Clone
,
2395 fnIEnumRfc1766_Next
,
2396 fnIEnumRfc1766_Reset
,
2400 struct enum_locales_data
2403 DWORD total
, allocated
;
2406 static BOOL CALLBACK
enum_locales_proc(LPWSTR locale
)
2409 struct enum_locales_data
*data
= TlsGetValue(MLANG_tls_index
);
2412 TRACE("%s\n", debugstr_w(locale
));
2414 if (data
->total
>= data
->allocated
)
2416 data
->allocated
+= 32;
2417 data
->info
= HeapReAlloc(GetProcessHeap(), 0, data
->info
, data
->allocated
* sizeof(RFC1766INFO
));
2418 if (!data
->info
) return FALSE
;
2421 info
= &data
->info
[data
->total
];
2423 info
->lcid
= wcstol(locale
, &end
, 16);
2424 if (*end
) /* invalid number */
2427 info
->wszRfc1766
[0] = 0;
2428 lcid_to_rfc1766W( info
->lcid
, info
->wszRfc1766
, MAX_RFC1766_NAME
);
2430 info
->wszLocaleName
[0] = 0;
2431 GetLocaleInfoW(info
->lcid
, LOCALE_SLANGUAGE
, info
->wszLocaleName
, MAX_LOCALE_NAME
);
2432 TRACE("ISO639: %s SLANGUAGE: %s\n", wine_dbgstr_w(info
->wszRfc1766
), wine_dbgstr_w(info
->wszLocaleName
));
2439 static HRESULT
EnumRfc1766_create(LANGID LangId
, IEnumRfc1766
**ppEnum
)
2441 EnumRfc1766_impl
*rfc
;
2442 struct enum_locales_data data
;
2444 TRACE("%04x, %p\n", LangId
, ppEnum
);
2446 rfc
= HeapAlloc( GetProcessHeap(), 0, sizeof(EnumRfc1766_impl
) );
2447 rfc
->IEnumRfc1766_iface
.lpVtbl
= &IEnumRfc1766_vtbl
;
2453 data
.allocated
= 160;
2454 data
.info
= HeapAlloc(GetProcessHeap(), 0, data
.allocated
* sizeof(RFC1766INFO
));
2457 HeapFree(GetProcessHeap(), 0, rfc
);
2458 return E_OUTOFMEMORY
;
2461 TlsSetValue(MLANG_tls_index
, &data
);
2462 EnumSystemLocalesW(enum_locales_proc
, 0/*LOCALE_SUPPORTED*/);
2463 TlsSetValue(MLANG_tls_index
, NULL
);
2465 TRACE("enumerated %d rfc1766 structures\n", data
.total
);
2469 HeapFree(GetProcessHeap(), 0, data
.info
);
2470 HeapFree(GetProcessHeap(), 0, rfc
);
2474 rfc
->info
= data
.info
;
2475 rfc
->total
= data
.total
;
2477 *ppEnum
= &rfc
->IEnumRfc1766_iface
;
2481 static HRESULT WINAPI
fnIMultiLanguage_EnumRfc1766(
2482 IMultiLanguage
*iface
,
2483 IEnumRfc1766
**ppEnumRfc1766
)
2485 MLang_impl
*This
= impl_from_IMultiLanguage( iface
);
2487 TRACE("%p %p\n", This
, ppEnumRfc1766
);
2489 return EnumRfc1766_create(0, ppEnumRfc1766
);
2492 /******************************************************************************/
2494 static HRESULT WINAPI
fnIMultiLanguage_GetRfc1766Info(
2495 IMultiLanguage
* iface
,
2497 PRFC1766INFO pRfc1766Info
)
2499 LCTYPE type
= LOCALE_SLANGUAGE
;
2501 TRACE("(%p, 0x%04x, %p)\n", iface
, Locale
, pRfc1766Info
);
2504 return E_INVALIDARG
;
2506 if ((PRIMARYLANGID(Locale
) == LANG_ENGLISH
) ||
2507 (PRIMARYLANGID(Locale
) == LANG_CHINESE
) ||
2508 (PRIMARYLANGID(Locale
) == LANG_ARABIC
)) {
2510 if (!SUBLANGID(Locale
))
2511 type
= LOCALE_SENGLANGUAGE
; /* suppress country */
2515 if (!SUBLANGID(Locale
)) {
2516 TRACE("SUBLANGID missing in 0x%04x\n", Locale
);
2521 pRfc1766Info
->lcid
= Locale
;
2522 pRfc1766Info
->wszRfc1766
[0] = 0;
2523 pRfc1766Info
->wszLocaleName
[0] = 0;
2525 if ((!lcid_to_rfc1766W(Locale
, pRfc1766Info
->wszRfc1766
, MAX_RFC1766_NAME
)) &&
2526 (GetLocaleInfoW(Locale
, type
, pRfc1766Info
->wszLocaleName
, MAX_LOCALE_NAME
) > 0))
2529 /* Locale not supported */
2530 return E_INVALIDARG
;
2533 static HRESULT WINAPI
fnIMultiLanguage_CreateConvertCharset(
2534 IMultiLanguage
* iface
,
2538 IMLangConvertCharset
** convert_charset
)
2540 MLang_impl
*This
= impl_from_IMultiLanguage(iface
);
2541 return IMultiLanguage3_CreateConvertCharset(&This
->IMultiLanguage3_iface
, src_cp
, dst_cp
, prop
, convert_charset
);
2544 static const IMultiLanguageVtbl IMultiLanguage_vtbl
=
2546 fnIMultiLanguage_QueryInterface
,
2547 fnIMultiLanguage_AddRef
,
2548 fnIMultiLanguage_Release
,
2549 fnIMultiLanguage_GetNumberOfCodePageInfo
,
2550 fnIMultiLanguage_GetCodePageInfo
,
2551 fnIMultiLanguage_GetFamilyCodePage
,
2552 fnIMultiLanguage_EnumCodePages
,
2553 fnIMultiLanguage_GetCharsetInfo
,
2554 fnIMultiLanguage_IsConvertible
,
2555 fnIMultiLanguage_ConvertString
,
2556 fnIMultiLanguage_ConvertStringToUnicode
,
2557 fnIMultiLanguage_ConvertStringFromUnicode
,
2558 fnIMultiLanguage_ConvertStringReset
,
2559 fnIMultiLanguage_GetRfc1766FromLcid
,
2560 fnIMultiLanguage_GetLcidFromRfc1766
,
2561 fnIMultiLanguage_EnumRfc1766
,
2562 fnIMultiLanguage_GetRfc1766Info
,
2563 fnIMultiLanguage_CreateConvertCharset
,
2567 /******************************************************************************/
2569 static inline MLang_impl
*impl_from_IMultiLanguage3( IMultiLanguage3
*iface
)
2571 return CONTAINING_RECORD( iface
, MLang_impl
, IMultiLanguage3_iface
);
2574 static HRESULT WINAPI
fnIMultiLanguage3_QueryInterface(
2575 IMultiLanguage3
* iface
,
2579 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
2581 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), obj
);
2583 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
2584 IsEqualGUID(riid
, &IID_IMultiLanguage
))
2586 *obj
= &This
->IMultiLanguage_iface
;
2588 else if (IsEqualGUID(riid
, &IID_IMLangCodePages
) ||
2589 IsEqualGUID(riid
, &IID_IMLangFontLink
))
2591 *obj
= &This
->IMLangFontLink_iface
;
2593 else if (IsEqualGUID(riid
, &IID_IMLangFontLink2
))
2595 *obj
= &This
->IMLangFontLink2_iface
;
2597 else if (IsEqualGUID(riid
, &IID_IMultiLanguage2
) ||
2598 IsEqualGUID(riid
, &IID_IMultiLanguage3
))
2600 *obj
= &This
->IMultiLanguage3_iface
;
2602 else if (IsEqualGUID(riid
, &IID_IMLangLineBreakConsole
))
2604 *obj
= &This
->IMLangLineBreakConsole_iface
;
2608 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), obj
);
2610 return E_NOINTERFACE
;
2613 IMultiLanguage3_AddRef(iface
);
2617 static ULONG WINAPI
fnIMultiLanguage3_AddRef( IMultiLanguage3
* iface
)
2619 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
2620 return InterlockedIncrement(&This
->ref
);
2623 static ULONG WINAPI
fnIMultiLanguage3_Release( IMultiLanguage3
* iface
)
2625 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
2626 ULONG ref
= InterlockedDecrement(&This
->ref
);
2628 TRACE("(%p)->(%d)\n", This
, ref
);
2631 HeapFree(GetProcessHeap(), 0, This
);
2638 static HRESULT WINAPI
fnIMultiLanguage3_GetNumberOfCodePageInfo(
2639 IMultiLanguage3
* iface
,
2642 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
2644 TRACE("%p, %p\n", This
, pcCodePage
);
2646 if (!pcCodePage
) return E_INVALIDARG
;
2648 *pcCodePage
= This
->total_cp
;
2652 static void fill_cp_info(const struct mlang_data
*ml_data
, UINT index
, MIMECPINFO
*mime_cp_info
)
2656 if (TranslateCharsetInfo((DWORD
*)(DWORD_PTR
)ml_data
->family_codepage
, &csi
,
2658 mime_cp_info
->bGDICharset
= csi
.ciCharset
;
2660 mime_cp_info
->bGDICharset
= DEFAULT_CHARSET
;
2662 mime_cp_info
->dwFlags
= ml_data
->mime_cp_info
[index
].flags
;
2663 mime_cp_info
->uiCodePage
= ml_data
->mime_cp_info
[index
].cp
;
2664 mime_cp_info
->uiFamilyCodePage
= ml_data
->family_codepage
;
2665 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].description
, -1,
2666 mime_cp_info
->wszDescription
, ARRAY_SIZE(mime_cp_info
->wszDescription
));
2667 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].web_charset
, -1,
2668 mime_cp_info
->wszWebCharset
, ARRAY_SIZE(mime_cp_info
->wszWebCharset
));
2669 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].header_charset
, -1,
2670 mime_cp_info
->wszHeaderCharset
, ARRAY_SIZE(mime_cp_info
->wszHeaderCharset
));
2671 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].body_charset
, -1,
2672 mime_cp_info
->wszBodyCharset
, ARRAY_SIZE(mime_cp_info
->wszBodyCharset
));
2674 MultiByteToWideChar(CP_ACP
, 0, ml_data
->fixed_font
, -1,
2675 mime_cp_info
->wszFixedWidthFont
, ARRAY_SIZE(mime_cp_info
->wszFixedWidthFont
));
2676 MultiByteToWideChar(CP_ACP
, 0, ml_data
->proportional_font
, -1,
2677 mime_cp_info
->wszProportionalFont
, ARRAY_SIZE(mime_cp_info
->wszProportionalFont
));
2679 TRACE("%08x %u %u %s %s %s %s %s %s %d\n",
2680 mime_cp_info
->dwFlags
, mime_cp_info
->uiCodePage
,
2681 mime_cp_info
->uiFamilyCodePage
,
2682 wine_dbgstr_w(mime_cp_info
->wszDescription
),
2683 wine_dbgstr_w(mime_cp_info
->wszWebCharset
),
2684 wine_dbgstr_w(mime_cp_info
->wszHeaderCharset
),
2685 wine_dbgstr_w(mime_cp_info
->wszBodyCharset
),
2686 wine_dbgstr_w(mime_cp_info
->wszFixedWidthFont
),
2687 wine_dbgstr_w(mime_cp_info
->wszProportionalFont
),
2688 mime_cp_info
->bGDICharset
);
2691 static HRESULT WINAPI
fnIMultiLanguage3_GetCodePageInfo(
2692 IMultiLanguage3
* iface
,
2695 PMIMECPINFO pCodePageInfo
)
2698 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
2700 TRACE("%p, %u, %04x, %p\n", This
, uiCodePage
, LangId
, pCodePageInfo
);
2702 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
2704 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2706 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
2708 fill_cp_info(&mlang_data
[i
], n
, pCodePageInfo
);
2717 static HRESULT WINAPI
fnIMultiLanguage3_GetFamilyCodePage(
2718 IMultiLanguage3
* iface
,
2720 UINT
* puiFamilyCodePage
)
2722 return GetFamilyCodePage(uiCodePage
, puiFamilyCodePage
);
2725 static HRESULT WINAPI
fnIMultiLanguage3_EnumCodePages(
2726 IMultiLanguage3
* iface
,
2729 IEnumCodePage
** ppEnumCodePage
)
2731 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
2733 TRACE("%p %08x %04x %p\n", This
, grfFlags
, LangId
, ppEnumCodePage
);
2735 return EnumCodePage_create( This
, grfFlags
, LangId
, ppEnumCodePage
);
2738 static HRESULT WINAPI
fnIMultiLanguage3_GetCharsetInfo(
2739 IMultiLanguage3
* iface
,
2741 PMIMECSETINFO pCharsetInfo
)
2744 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
2746 TRACE("%p %s %p\n", This
, debugstr_w(Charset
), pCharsetInfo
);
2748 if (!pCharsetInfo
) return E_FAIL
;
2750 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
2752 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2754 WCHAR csetW
[MAX_MIMECSET_NAME
];
2756 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].mime_cp_info
[n
].web_charset
, -1, csetW
, MAX_MIMECSET_NAME
);
2757 if (!lstrcmpiW(Charset
, csetW
))
2759 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2760 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2761 lstrcpyW(pCharsetInfo
->wszCharset
, csetW
);
2764 if (mlang_data
[i
].mime_cp_info
[n
].alias
&& !lstrcmpiW(Charset
, mlang_data
[i
].mime_cp_info
[n
].alias
))
2766 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2767 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2768 lstrcpyW(pCharsetInfo
->wszCharset
, mlang_data
[i
].mime_cp_info
[n
].alias
);
2775 * Since we do not support charsets like iso-2022-jp and do not have
2776 * them in our database as a primary (web_charset) encoding this loop
2777 * does an attempt to 'approximate' charset name by header_charset.
2779 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
2781 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2783 WCHAR csetW
[MAX_MIMECSET_NAME
];
2785 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].mime_cp_info
[n
].header_charset
, -1, csetW
, MAX_MIMECSET_NAME
);
2786 if (!lstrcmpiW(Charset
, csetW
))
2788 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2789 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2790 lstrcpyW(pCharsetInfo
->wszCharset
, csetW
);
2799 static HRESULT WINAPI
fnIMultiLanguage3_IsConvertible(
2800 IMultiLanguage3
* iface
,
2801 DWORD dwSrcEncoding
,
2802 DWORD dwDstEncoding
)
2804 return IsConvertINetStringAvailable(dwSrcEncoding
, dwDstEncoding
);
2807 static HRESULT WINAPI
fnIMultiLanguage3_ConvertString(
2808 IMultiLanguage3
* iface
,
2810 DWORD dwSrcEncoding
,
2811 DWORD dwDstEncoding
,
2817 return ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
,
2818 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, (LPSTR
)pDstStr
, (LPINT
)pcDstSize
);
2821 static HRESULT WINAPI
fnIMultiLanguage3_ConvertStringToUnicode(
2822 IMultiLanguage3
* iface
,
2830 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
2831 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2834 static HRESULT WINAPI
fnIMultiLanguage3_ConvertStringFromUnicode(
2835 IMultiLanguage3
* iface
,
2843 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
2844 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2847 static HRESULT WINAPI
fnIMultiLanguage3_ConvertStringReset(
2848 IMultiLanguage3
* iface
)
2854 static HRESULT WINAPI
fnIMultiLanguage3_GetRfc1766FromLcid(
2855 IMultiLanguage3
* iface
,
2859 WCHAR buf
[MAX_RFC1766_NAME
];
2861 TRACE("%p %04x %p\n", iface
, lcid
, pbstrRfc1766
);
2863 return E_INVALIDARG
;
2865 if (!lcid_to_rfc1766W( lcid
, buf
, MAX_RFC1766_NAME
))
2867 *pbstrRfc1766
= SysAllocString( buf
);
2873 static HRESULT WINAPI
fnIMultiLanguage3_GetLcidFromRfc1766(
2874 IMultiLanguage3
* iface
,
2879 IEnumRfc1766
*rfc1766
;
2881 TRACE("%p %p %s\n", iface
, pLocale
, debugstr_w(bstrRfc1766
));
2883 if (!pLocale
|| !bstrRfc1766
)
2884 return E_INVALIDARG
;
2886 hr
= IMultiLanguage3_EnumRfc1766(iface
, 0, &rfc1766
);
2890 hr
= lcid_from_rfc1766(rfc1766
, pLocale
, bstrRfc1766
);
2892 IEnumRfc1766_Release(rfc1766
);
2896 static HRESULT WINAPI
fnIMultiLanguage3_EnumRfc1766(
2897 IMultiLanguage3
* iface
,
2899 IEnumRfc1766
** ppEnumRfc1766
)
2901 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
2903 TRACE("%p %p\n", This
, ppEnumRfc1766
);
2905 return EnumRfc1766_create(LangId
, ppEnumRfc1766
);
2908 static HRESULT WINAPI
fnIMultiLanguage3_GetRfc1766Info(
2909 IMultiLanguage3
* iface
,
2912 PRFC1766INFO pRfc1766Info
)
2914 static LANGID last_lang
= -1;
2915 LCTYPE type
= LOCALE_SLANGUAGE
;
2917 TRACE("(%p, 0x%04x, 0x%04x, %p)\n", iface
, Locale
, LangId
, pRfc1766Info
);
2920 return E_INVALIDARG
;
2922 if ((PRIMARYLANGID(Locale
) == LANG_ENGLISH
) ||
2923 (PRIMARYLANGID(Locale
) == LANG_CHINESE
) ||
2924 (PRIMARYLANGID(Locale
) == LANG_ARABIC
)) {
2926 if (!SUBLANGID(Locale
))
2927 type
= LOCALE_SENGLANGUAGE
; /* suppress country */
2931 if (!SUBLANGID(Locale
)) {
2932 TRACE("SUBLANGID missing in 0x%04x\n", Locale
);
2937 pRfc1766Info
->lcid
= Locale
;
2938 pRfc1766Info
->wszRfc1766
[0] = 0;
2939 pRfc1766Info
->wszLocaleName
[0] = 0;
2941 if ((PRIMARYLANGID(LangId
) != LANG_ENGLISH
) &&
2942 (last_lang
!= LangId
)) {
2943 FIXME("Only English names supported (requested: 0x%04x)\n", LangId
);
2947 if ((!lcid_to_rfc1766W(Locale
, pRfc1766Info
->wszRfc1766
, MAX_RFC1766_NAME
)) &&
2948 (GetLocaleInfoW(Locale
, type
, pRfc1766Info
->wszLocaleName
, MAX_LOCALE_NAME
) > 0))
2951 /* Locale not supported */
2952 return E_INVALIDARG
;
2955 static HRESULT WINAPI
fnIMultiLanguage3_CreateConvertCharset(
2956 IMultiLanguage3
* iface
,
2960 IMLangConvertCharset
** convert_charset
)
2964 TRACE("(%u %u 0x%08x %p)\n", src_cp
, dst_cp
, prop
, convert_charset
);
2966 hr
= MLangConvertCharset_create(NULL
, (void**)convert_charset
);
2967 if (FAILED(hr
)) return hr
;
2969 return IMLangConvertCharset_Initialize(*convert_charset
, src_cp
, dst_cp
, prop
);
2972 static HRESULT WINAPI
fnIMultiLanguage3_ConvertStringInIStream(
2973 IMultiLanguage3
* iface
,
2977 DWORD dwSrcEncoding
,
2978 DWORD dwDstEncoding
,
2982 char *src
, *dst
= NULL
;
2987 TRACE("%p %0x8 %s %u %u %p %p\n",
2988 pdwMode
, dwFlag
, debugstr_w(lpFallBack
), dwSrcEncoding
, dwDstEncoding
, pstmIn
, pstmOut
);
2990 FIXME("dwFlag and lpFallBack not handled\n");
2992 hr
= IStream_Stat(pstmIn
, &stat
, STATFLAG_NONAME
);
2993 if (FAILED(hr
)) return hr
;
2995 if (stat
.cbSize
.QuadPart
> MAXLONG
) return E_INVALIDARG
;
2996 if (!(src
= HeapAlloc(GetProcessHeap(), 0, stat
.cbSize
.QuadPart
))) return E_OUTOFMEMORY
;
2998 hr
= IStream_Read(pstmIn
, src
, stat
.cbSize
.QuadPart
, (ULONG
*)&srclen
);
2999 if (FAILED(hr
)) goto exit
;
3001 hr
= ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
, src
, &srclen
, NULL
, &dstlen
);
3002 if (FAILED(hr
)) goto exit
;
3004 if (!(dst
= HeapAlloc(GetProcessHeap(), 0, dstlen
)))
3009 hr
= ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
, src
, &srclen
, dst
, &dstlen
);
3010 if (FAILED(hr
)) goto exit
;
3012 hr
= IStream_Write(pstmOut
, dst
, dstlen
, NULL
);
3015 HeapFree(GetProcessHeap(), 0, src
);
3016 HeapFree(GetProcessHeap(), 0, dst
);
3020 static HRESULT WINAPI
fnIMultiLanguage3_ConvertStringToUnicodeEx(
3021 IMultiLanguage3
* iface
,
3031 if (dwFlag
|| lpFallBack
)
3032 FIXME("Ignoring dwFlag (0x%x/%d) and lpFallBack (%p)\n",
3033 dwFlag
, dwFlag
, lpFallBack
);
3035 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
3036 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
3039 /*****************************************************************************
3040 * MultiLanguage2::ConvertStringToUnicodeEx
3042 * Translates the multibyte string from the specified code page to Unicode.
3045 * see ConvertStringToUnicode
3047 * lpFallBack if dwFlag contains MLCONVCHARF_USEDEFCHAR, lpFallBack string used
3048 * instead unconvertible characters.
3052 * S_FALSE The conversion is not supported.
3053 * E_FAIL Some error has occurred.
3055 * TODO: handle dwFlag and lpFallBack
3057 static HRESULT WINAPI
fnIMultiLanguage3_ConvertStringFromUnicodeEx(
3058 IMultiLanguage3
* This
,
3069 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
3070 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
3073 static HRESULT WINAPI
fnIMultiLanguage3_DetectCodepageInIStream(
3074 IMultiLanguage3
* iface
,
3076 DWORD dwPrefWinCodePage
,
3078 DetectEncodingInfo
* lpEncoding
,
3085 static HRESULT WINAPI
fnIMultiLanguage3_DetectInputCodepage(
3086 IMultiLanguage3
* iface
,
3088 DWORD dwPrefWinCodePage
,
3091 DetectEncodingInfo
* lpEncoding
,
3098 static HRESULT WINAPI
fnIMultiLanguage3_ValidateCodePage(
3099 IMultiLanguage3
* iface
,
3103 return IMultiLanguage3_ValidateCodePageEx(iface
,uiCodePage
,hwnd
,0);
3106 static HRESULT WINAPI
fnIMultiLanguage3_GetCodePageDescription(
3107 IMultiLanguage3
* iface
,
3110 LPWSTR lpWideCharStr
,
3113 /* Find first instance */
3116 TRACE ("%u, %04x, %p, %d\n", uiCodePage
, lcid
, lpWideCharStr
, cchWideChar
);
3117 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
3119 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
3121 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
3123 MultiByteToWideChar(CP_ACP
, 0,
3124 mlang_data
[i
].mime_cp_info
[n
].description
,
3125 -1, lpWideCharStr
, cchWideChar
);
3134 static HRESULT WINAPI
fnIMultiLanguage3_IsCodePageInstallable(
3135 IMultiLanguage3
* iface
,
3138 TRACE("%u\n", uiCodePage
);
3140 /* FIXME: the installable set is usually larger than the set of valid codepages */
3141 return IMultiLanguage3_ValidateCodePageEx(iface
, uiCodePage
, NULL
, CPIOD_PEEK
);
3144 static HRESULT WINAPI
fnIMultiLanguage3_SetMimeDBSource(
3145 IMultiLanguage3
* iface
,
3148 FIXME("0x%08x\n", dwSource
);
3152 static HRESULT WINAPI
fnIMultiLanguage3_GetNumberOfScripts(
3153 IMultiLanguage3
* iface
,
3156 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
3158 TRACE("%p %p\n", This
, pnScripts
);
3160 if (!pnScripts
) return S_FALSE
;
3162 *pnScripts
= This
->total_scripts
;
3166 static HRESULT WINAPI
fnIMultiLanguage3_EnumScripts(
3167 IMultiLanguage3
* iface
,
3170 IEnumScript
** ppEnumScript
)
3172 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
3174 TRACE("%p %08x %04x %p\n", This
, dwFlags
, LangId
, ppEnumScript
);
3176 return EnumScript_create( This
, dwFlags
, LangId
, ppEnumScript
);
3179 static HRESULT WINAPI
fnIMultiLanguage3_ValidateCodePageEx(
3180 IMultiLanguage3
* iface
,
3183 DWORD dwfIODControl
)
3186 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
3188 TRACE("%p %u %p %08x\n", This
, uiCodePage
, hwnd
, dwfIODControl
);
3190 /* quick check for kernel32 supported code pages */
3191 if (IsValidCodePage(uiCodePage
))
3194 /* check for mlang supported code pages */
3195 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
3198 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
3200 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
3205 if (dwfIODControl
!= CPIOD_PEEK
)
3206 FIXME("Request to install codepage language pack not handled\n");
3211 static HRESULT WINAPI
fnIMultiLanguage3_DetectOutboundCodePage(
3212 IMultiLanguage3
*iface
,
3214 LPCWSTR lpWideCharStr
,
3216 UINT
*puiPreferredCodePages
,
3217 UINT nPreferredCodePages
,
3218 UINT
*puiDetectedCodePages
,
3219 UINT
*pnDetectedCodePages
,
3220 WCHAR
*lpSpecialChar
)
3222 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
3224 FIXME("(%p)->(%08x %s %p %u %p %p(%u) %s)\n", This
, dwFlags
, debugstr_w(lpWideCharStr
),
3225 puiPreferredCodePages
, nPreferredCodePages
, puiDetectedCodePages
,
3226 pnDetectedCodePages
, pnDetectedCodePages
? *pnDetectedCodePages
: 0,
3227 debugstr_w(lpSpecialChar
));
3229 if (!puiDetectedCodePages
|| !pnDetectedCodePages
|| !*pnDetectedCodePages
)
3230 return E_INVALIDARG
;
3232 puiDetectedCodePages
[0] = CP_UTF8
;
3233 *pnDetectedCodePages
= 1;
3237 static HRESULT WINAPI
fnIMultiLanguage3_DetectOutboundCodePageInIStream(
3238 IMultiLanguage3
*iface
,
3241 UINT
*puiPreferredCodePages
,
3242 UINT nPreferredCodePages
,
3243 UINT
*puiDetectedCodePages
,
3244 UINT
*pnDetectedCodePages
,
3245 WCHAR
*lpSpecialChar
)
3247 MLang_impl
*This
= impl_from_IMultiLanguage3( iface
);
3249 FIXME("(%p)->(%08x %p %p %u %p %p(%u) %s)\n", This
, dwFlags
, pStrIn
,
3250 puiPreferredCodePages
, nPreferredCodePages
, puiDetectedCodePages
,
3251 pnDetectedCodePages
, pnDetectedCodePages
? *pnDetectedCodePages
: 0,
3252 debugstr_w(lpSpecialChar
));
3254 if (!puiDetectedCodePages
|| !pnDetectedCodePages
|| !*pnDetectedCodePages
)
3255 return E_INVALIDARG
;
3257 puiDetectedCodePages
[0] = CP_UTF8
;
3258 *pnDetectedCodePages
= 1;
3262 static const IMultiLanguage3Vtbl IMultiLanguage3_vtbl
=
3264 fnIMultiLanguage3_QueryInterface
,
3265 fnIMultiLanguage3_AddRef
,
3266 fnIMultiLanguage3_Release
,
3267 fnIMultiLanguage3_GetNumberOfCodePageInfo
,
3268 fnIMultiLanguage3_GetCodePageInfo
,
3269 fnIMultiLanguage3_GetFamilyCodePage
,
3270 fnIMultiLanguage3_EnumCodePages
,
3271 fnIMultiLanguage3_GetCharsetInfo
,
3272 fnIMultiLanguage3_IsConvertible
,
3273 fnIMultiLanguage3_ConvertString
,
3274 fnIMultiLanguage3_ConvertStringToUnicode
,
3275 fnIMultiLanguage3_ConvertStringFromUnicode
,
3276 fnIMultiLanguage3_ConvertStringReset
,
3277 fnIMultiLanguage3_GetRfc1766FromLcid
,
3278 fnIMultiLanguage3_GetLcidFromRfc1766
,
3279 fnIMultiLanguage3_EnumRfc1766
,
3280 fnIMultiLanguage3_GetRfc1766Info
,
3281 fnIMultiLanguage3_CreateConvertCharset
,
3282 fnIMultiLanguage3_ConvertStringInIStream
,
3283 fnIMultiLanguage3_ConvertStringToUnicodeEx
,
3284 fnIMultiLanguage3_ConvertStringFromUnicodeEx
,
3285 fnIMultiLanguage3_DetectCodepageInIStream
,
3286 fnIMultiLanguage3_DetectInputCodepage
,
3287 fnIMultiLanguage3_ValidateCodePage
,
3288 fnIMultiLanguage3_GetCodePageDescription
,
3289 fnIMultiLanguage3_IsCodePageInstallable
,
3290 fnIMultiLanguage3_SetMimeDBSource
,
3291 fnIMultiLanguage3_GetNumberOfScripts
,
3292 fnIMultiLanguage3_EnumScripts
,
3293 fnIMultiLanguage3_ValidateCodePageEx
,
3294 fnIMultiLanguage3_DetectOutboundCodePage
,
3295 fnIMultiLanguage3_DetectOutboundCodePageInIStream
3298 /******************************************************************************/
3300 static inline MLang_impl
*impl_from_IMLangFontLink2( IMLangFontLink2
*iface
)
3302 return CONTAINING_RECORD( iface
, MLang_impl
, IMLangFontLink2_iface
);
3305 static HRESULT WINAPI
fnIMLangFontLink2_QueryInterface(
3306 IMLangFontLink2
* iface
,
3310 MLang_impl
*This
= impl_from_IMLangFontLink2( iface
);
3311 return IMultiLanguage3_QueryInterface( &This
->IMultiLanguage3_iface
, riid
, ppvObject
);
3314 static ULONG WINAPI
fnIMLangFontLink2_AddRef( IMLangFontLink2
* iface
)
3316 MLang_impl
*This
= impl_from_IMLangFontLink2( iface
);
3317 return IMultiLanguage3_AddRef( &This
->IMultiLanguage3_iface
);
3320 static ULONG WINAPI
fnIMLangFontLink2_Release( IMLangFontLink2
* iface
)
3322 MLang_impl
*This
= impl_from_IMLangFontLink2( iface
);
3323 return IMultiLanguage3_Release( &This
->IMultiLanguage3_iface
);
3326 static HRESULT WINAPI
fnIMLangFontLink2_GetCharCodePages( IMLangFontLink2
* iface
,
3327 WCHAR ch_src
, DWORD
*ret_codepages
)
3329 MLang_impl
*This
= impl_from_IMLangFontLink2(iface
);
3332 TRACE("(%p)->(%s %p)\n", This
, debugstr_wn(&ch_src
, 1), ret_codepages
);
3336 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
3341 WideCharToMultiByte(mlang_data
[i
].family_codepage
, WC_NO_BEST_FIT_CHARS
,
3342 &ch_src
, 1, &buf
, 1, NULL
, &used_dc
);
3344 /* If default char is not used, current codepage include the given symbol */
3349 IMLangFontLink2_CodePageToCodePages(iface
,
3350 mlang_data
[i
].family_codepage
, &codepages
);
3351 *ret_codepages
|= codepages
;
3357 static HRESULT WINAPI
fnIMLangFontLink2_GetStrCodePages( IMLangFontLink2
* iface
,
3358 const WCHAR
*src
, LONG src_len
, DWORD priority_cp
,
3359 DWORD
*codepages
, LONG
*ret_len
)
3361 MLang_impl
*This
= impl_from_IMLangFontLink2(iface
);
3365 TRACE("(%p)->(%s:%d %x %p %p)\n", This
, debugstr_wn(src
, src_len
), src_len
, priority_cp
,
3366 codepages
, ret_len
);
3368 if (codepages
) *codepages
= 0;
3369 if (ret_len
) *ret_len
= 0;
3371 if (!src
|| !src_len
|| src_len
< 0)
3372 return E_INVALIDARG
;
3374 for (i
= 0; i
< src_len
; i
++)
3379 ret
= IMLangFontLink2_GetCharCodePages(iface
, src
[i
], &cp
);
3380 if (ret
!= S_OK
) return E_FAIL
;
3385 /* FIXME: not tested */
3386 if (priority_cp
& cps
) break;
3389 if (codepages
) *codepages
= cps
;
3390 if (ret_len
) *ret_len
= min( i
+ 1, src_len
);
3394 static HRESULT WINAPI
fnIMLangFontLink2_CodePageToCodePages(IMLangFontLink2
* iface
,
3398 MLang_impl
*This
= impl_from_IMLangFontLink2(iface
);
3402 TRACE("(%p)->(%u %p)\n", This
, codepage
, codepages
);
3404 rc
= TranslateCharsetInfo((DWORD
*)(DWORD_PTR
)codepage
, &cs
, TCI_SRCCODEPAGE
);
3407 *codepages
= cs
.fs
.fsCsb
[0];
3408 TRACE("resulting codepages 0x%x\n", *codepages
);
3412 TRACE("codepage not found\n");
3417 static HRESULT WINAPI
fnIMLangFontLink2_CodePagesToCodePage(IMLangFontLink2
* iface
,
3418 DWORD codepages
, UINT def_codepage
, UINT
*codepage
)
3420 MLang_impl
*This
= impl_from_IMLangFontLink2(iface
);
3426 TRACE("(%p)->(0x%x %u %p)\n", This
, codepages
, def_codepage
, codepage
);
3430 rc
= TranslateCharsetInfo((DWORD
*)(DWORD_PTR
)def_codepage
, &cs
, TCI_SRCCODEPAGE
);
3431 if (rc
&& (codepages
& cs
.fs
.fsCsb
[0]))
3433 TRACE("Found Default Codepage\n");
3434 *codepage
= def_codepage
;
3438 for (i
= 0; i
< 32; i
++)
3441 if (codepages
& mask
)
3446 rc
= TranslateCharsetInfo(Csb
, &cs
, TCI_SRCFONTSIG
);
3450 TRACE("Falling back to least significant found CodePage %u\n",
3452 *codepage
= cs
.ciACP
;
3457 TRACE("no codepage found\n");
3461 static HRESULT WINAPI
fnIMLangFontLink2_GetFontCodePages(IMLangFontLink2
*iface
,
3462 HDC hdc
, HFONT hfont
, DWORD
*codepages
)
3464 MLang_impl
*This
= impl_from_IMLangFontLink2(iface
);
3465 FONTSIGNATURE fontsig
;
3468 TRACE("(%p)->(%p %p %p)\n", This
, hdc
, hfont
, codepages
);
3470 old_font
= SelectObject(hdc
, hfont
);
3471 GetTextCharsetInfo(hdc
, &fontsig
, 0);
3472 SelectObject(hdc
, old_font
);
3474 *codepages
= fontsig
.fsCsb
[0];
3475 TRACE("ret 0x%x\n", fontsig
.fsCsb
[0]);
3480 static HRESULT WINAPI
fnIMLangFontLink2_ReleaseFont(IMLangFontLink2
* This
,
3483 TRACE("(%p)->%p\n",This
, hFont
);
3485 return release_font(hFont
);
3488 static HRESULT WINAPI
fnIMLangFontLink2_ResetFontMapping(IMLangFontLink2
* This
)
3490 TRACE("(%p)\n",This
);
3492 return clear_font_cache();
3495 static HRESULT WINAPI
fnIMLangFontLink2_MapFont(IMLangFontLink2
* This
,
3496 HDC hDC
, DWORD dwCodePages
, WCHAR chSrc
, HFONT
*pFont
)
3500 TRACE("(%p)->%p %08x %04x %p\n",This
, hDC
, dwCodePages
, chSrc
, pFont
);
3502 if (!hDC
) return E_FAIL
;
3504 if (dwCodePages
!= 0)
3506 old_font
= GetCurrentObject(hDC
, OBJ_FONT
);
3507 return map_font(hDC
, dwCodePages
, old_font
, pFont
);
3511 if (pFont
== NULL
) return E_INVALIDARG
;
3512 FIXME("the situation where dwCodepages is set to zero is not implemented\n");
3517 static HRESULT WINAPI
fnIMLangFontLink2_GetFontUnicodeRanges(IMLangFontLink2
* This
,
3518 HDC hDC
, UINT
*puiRanges
, UNICODERANGE
*pUranges
)
3523 TRACE("(%p)->%p %p %p\n", This
, hDC
, puiRanges
, pUranges
);
3525 if (!puiRanges
) return E_INVALIDARG
;
3526 if (!(size
= GetFontUnicodeRanges(hDC
, NULL
))) return E_FAIL
;
3527 if (!(gs
= HeapAlloc(GetProcessHeap(), 0, size
))) return E_OUTOFMEMORY
;
3529 GetFontUnicodeRanges(hDC
, gs
);
3530 *puiRanges
= gs
->cRanges
;
3534 for (i
= 0; i
< gs
->cRanges
; i
++)
3536 if (i
>= *puiRanges
) break;
3537 pUranges
[i
].wcFrom
= gs
->ranges
[i
].wcLow
;
3538 pUranges
[i
].wcTo
= gs
->ranges
[i
].wcLow
+ gs
->ranges
[i
].cGlyphs
;
3542 HeapFree(GetProcessHeap(), 0, gs
);
3546 static HRESULT WINAPI
fnIMLangFontLink2_GetScriptFontInfo(IMLangFontLink2
* This
,
3547 SCRIPT_ID sid
, DWORD dwFlags
, UINT
*puiFonts
,
3548 SCRIPTFONTINFO
*pScriptFont
)
3552 TRACE("(%p)->%u %x %p %p\n", This
, sid
, dwFlags
, puiFonts
, pScriptFont
);
3554 if (!dwFlags
) dwFlags
= SCRIPTCONTF_PROPORTIONAL_FONT
;
3556 for (i
= 0, j
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
3558 if (sid
== mlang_data
[i
].sid
)
3562 if (j
>= *puiFonts
) break;
3564 pScriptFont
[j
].scripts
= (SCRIPT_IDS
)1 << mlang_data
[i
].sid
;
3565 if (dwFlags
== SCRIPTCONTF_FIXED_FONT
)
3567 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].fixed_font
, -1,
3568 pScriptFont
[j
].wszFont
, MAX_MIMEFACE_NAME
);
3570 else if (dwFlags
== SCRIPTCONTF_PROPORTIONAL_FONT
)
3572 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].proportional_font
, -1,
3573 pScriptFont
[j
].wszFont
, MAX_MIMEFACE_NAME
);
3583 static HRESULT WINAPI
fnIMLangFontLink2_CodePageToScriptID(IMLangFontLink2
* This
,
3584 UINT uiCodePage
, SCRIPT_ID
*pSid
)
3588 TRACE("(%p)->%i %p\n", This
, uiCodePage
, pSid
);
3590 if (uiCodePage
== CP_UNICODE
) return E_FAIL
;
3592 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
3594 if (uiCodePage
== mlang_data
[i
].family_codepage
)
3596 if (pSid
) *pSid
= mlang_data
[i
].sid
;
3603 static const IMLangFontLink2Vtbl IMLangFontLink2_vtbl
=
3605 fnIMLangFontLink2_QueryInterface
,
3606 fnIMLangFontLink2_AddRef
,
3607 fnIMLangFontLink2_Release
,
3608 fnIMLangFontLink2_GetCharCodePages
,
3609 fnIMLangFontLink2_GetStrCodePages
,
3610 fnIMLangFontLink2_CodePageToCodePages
,
3611 fnIMLangFontLink2_CodePagesToCodePage
,
3612 fnIMLangFontLink2_GetFontCodePages
,
3613 fnIMLangFontLink2_ReleaseFont
,
3614 fnIMLangFontLink2_ResetFontMapping
,
3615 fnIMLangFontLink2_MapFont
,
3616 fnIMLangFontLink2_GetFontUnicodeRanges
,
3617 fnIMLangFontLink2_GetScriptFontInfo
,
3618 fnIMLangFontLink2_CodePageToScriptID
3621 /******************************************************************************/
3623 static inline MLang_impl
*impl_from_IMLangLineBreakConsole( IMLangLineBreakConsole
*iface
)
3625 return CONTAINING_RECORD( iface
, MLang_impl
, IMLangLineBreakConsole_iface
);
3628 static HRESULT WINAPI
fnIMLangLineBreakConsole_QueryInterface(
3629 IMLangLineBreakConsole
* iface
,
3633 MLang_impl
*This
= impl_from_IMLangLineBreakConsole( iface
);
3634 return IMultiLanguage3_QueryInterface( &This
->IMultiLanguage3_iface
, riid
, ppvObject
);
3637 static ULONG WINAPI
fnIMLangLineBreakConsole_AddRef(
3638 IMLangLineBreakConsole
* iface
)
3640 MLang_impl
*This
= impl_from_IMLangLineBreakConsole( iface
);
3641 return IMultiLanguage3_AddRef( &This
->IMultiLanguage3_iface
);
3644 static ULONG WINAPI
fnIMLangLineBreakConsole_Release(
3645 IMLangLineBreakConsole
* iface
)
3647 MLang_impl
*This
= impl_from_IMLangLineBreakConsole( iface
);
3648 return IMultiLanguage3_Release( &This
->IMultiLanguage3_iface
);
3651 static HRESULT WINAPI
fnIMLangLineBreakConsole_BreakLineML(
3652 IMLangLineBreakConsole
* iface
,
3653 IMLangString
* pSrcMLStr
,
3661 FIXME("(%p)->%p %i %i %i %i %p %p\n", iface
, pSrcMLStr
, lSrcPos
, lSrcLen
, cMinColumns
, cMaxColumns
, plLineLen
, plSkipLen
);
3665 static HRESULT WINAPI
fnIMLangLineBreakConsole_BreakLineW(
3666 IMLangLineBreakConsole
* iface
,
3668 const WCHAR
* pszSrc
,
3674 FIXME("(%p)->%i %s %i %i %p %p\n", iface
, locale
, debugstr_wn(pszSrc
,cchSrc
), cchSrc
, cMaxColumns
, pcchLine
, pcchSkip
);
3681 static HRESULT WINAPI
fnIMLangLineBreakConsole_BreakLineA(
3682 IMLangLineBreakConsole
* iface
,
3691 LONG i
, line
= cchSrc
, skip
= 0;
3693 FIXME("(%p)->%i %i %s %i %i %p %p\n", iface
, locale
, uCodePage
, debugstr_an(pszSrc
,cchSrc
), cchSrc
, cMaxColumns
, pcchLine
, pcchSkip
);
3695 if (uCodePage
== CP_USASCII
&& cchSrc
> cMaxColumns
)
3697 for (line
= cMaxColumns
, i
= cMaxColumns
- 1; i
>= 0; i
--)
3699 if (pszSrc
[i
] == ' ')
3701 while (i
>= 0 && pszSrc
[i
] == ' ')
3716 static const IMLangLineBreakConsoleVtbl IMLangLineBreakConsole_vtbl
=
3718 fnIMLangLineBreakConsole_QueryInterface
,
3719 fnIMLangLineBreakConsole_AddRef
,
3720 fnIMLangLineBreakConsole_Release
,
3721 fnIMLangLineBreakConsole_BreakLineML
,
3722 fnIMLangLineBreakConsole_BreakLineW
,
3723 fnIMLangLineBreakConsole_BreakLineA
3726 struct convert_charset
{
3727 IMLangConvertCharset IMLangConvertCharset_iface
;
3734 static inline struct convert_charset
*impl_from_IMLangConvertCharset(IMLangConvertCharset
*iface
)
3736 return CONTAINING_RECORD(iface
, struct convert_charset
, IMLangConvertCharset_iface
);
3739 static HRESULT WINAPI
MLangConvertCharset_QueryInterface(IMLangConvertCharset
*iface
, REFIID riid
, void **obj
)
3741 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3743 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), obj
);
3745 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IMLangConvertCharset
))
3747 *obj
= &This
->IMLangConvertCharset_iface
;
3748 IMLangConvertCharset_AddRef(iface
);
3753 return E_NOINTERFACE
;
3756 static ULONG WINAPI
MLangConvertCharset_AddRef(IMLangConvertCharset
*iface
)
3758 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3759 ULONG ref
= InterlockedIncrement(&This
->ref
);
3760 TRACE("(%p)->(%u)\n", This
, ref
);
3764 static ULONG WINAPI
MLangConvertCharset_Release(IMLangConvertCharset
*iface
)
3766 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3767 ULONG ref
= InterlockedDecrement(&This
->ref
);
3769 TRACE("(%p)->(%u)\n", This
, ref
);
3772 HeapFree(GetProcessHeap(), 0, This
);
3779 static HRESULT WINAPI
MLangConvertCharset_Initialize(IMLangConvertCharset
*iface
,
3780 UINT src_cp
, UINT dst_cp
, DWORD prop
)
3782 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3784 TRACE("(%p)->(%u %u 0x%08x)\n", This
, src_cp
, dst_cp
, prop
);
3786 prop
&= ~MLCONVCHARF_USEDEFCHAR
;
3788 FIXME("property 0x%08x not supported\n", prop
);
3790 This
->src_cp
= src_cp
;
3791 This
->dst_cp
= dst_cp
;
3796 static HRESULT WINAPI
MLangConvertCharset_GetSourceCodePage(IMLangConvertCharset
*iface
, UINT
*src_cp
)
3798 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3800 TRACE("(%p)->(%p)\n", This
, src_cp
);
3802 if (!src_cp
) return E_INVALIDARG
;
3803 *src_cp
= This
->src_cp
;
3807 static HRESULT WINAPI
MLangConvertCharset_GetDestinationCodePage(IMLangConvertCharset
*iface
, UINT
*dst_cp
)
3809 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3811 TRACE("(%p)->(%p)\n", This
, dst_cp
);
3813 if (!dst_cp
) return E_INVALIDARG
;
3814 *dst_cp
= This
->dst_cp
;
3818 static HRESULT WINAPI
MLangConvertCharset_GetProperty(IMLangConvertCharset
*iface
, DWORD
*prop
)
3820 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3821 FIXME("(%p)->(%p): stub\n", This
, prop
);
3825 static HRESULT WINAPI
MLangConvertCharset_DoConversion(IMLangConvertCharset
*iface
, BYTE
*src
,
3826 UINT
*src_size
, BYTE
*dest
, UINT
*dest_size
)
3828 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3829 FIXME("(%p)->(%p %p %p %p): stub\n", This
, src
, src_size
, dest
, dest_size
);
3833 static HRESULT WINAPI
MLangConvertCharset_DoConversionToUnicode(IMLangConvertCharset
*iface
, CHAR
*src
,
3834 UINT
*src_size
, WCHAR
*dest
, UINT
*dest_size
)
3836 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3837 TRACE("(%p)->(%p %p %p %p)\n", This
, src
, src_size
, dest
, dest_size
);
3838 return ConvertINetMultiByteToUnicode(NULL
, This
->src_cp
, src
, (INT
*)src_size
, dest
, (INT
*)dest_size
);
3841 static HRESULT WINAPI
MLangConvertCharset_DoConversionFromUnicode(IMLangConvertCharset
*iface
,
3842 WCHAR
*src
, UINT
*src_size
, CHAR
*dest
, UINT
*dest_size
)
3844 struct convert_charset
*This
= impl_from_IMLangConvertCharset(iface
);
3845 TRACE("(%p)->(%p %p %p %p)\n", This
, src
, src_size
, dest
, dest_size
);
3846 return ConvertINetUnicodeToMultiByte(NULL
, This
->dst_cp
, src
, (INT
*)src_size
, dest
, (INT
*)dest_size
);
3849 static const IMLangConvertCharsetVtbl MLangConvertCharsetVtbl
=
3851 MLangConvertCharset_QueryInterface
,
3852 MLangConvertCharset_AddRef
,
3853 MLangConvertCharset_Release
,
3854 MLangConvertCharset_Initialize
,
3855 MLangConvertCharset_GetSourceCodePage
,
3856 MLangConvertCharset_GetDestinationCodePage
,
3857 MLangConvertCharset_GetProperty
,
3858 MLangConvertCharset_DoConversion
,
3859 MLangConvertCharset_DoConversionToUnicode
,
3860 MLangConvertCharset_DoConversionFromUnicode
3863 static HRESULT
MultiLanguage_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
3868 TRACE("Creating MultiLanguage object\n");
3871 return CLASS_E_NOAGGREGATION
;
3873 mlang
= HeapAlloc( GetProcessHeap(), 0, sizeof (MLang_impl
) );
3874 mlang
->IMLangFontLink_iface
.lpVtbl
= &IMLangFontLink_vtbl
;
3875 mlang
->IMultiLanguage_iface
.lpVtbl
= &IMultiLanguage_vtbl
;
3876 mlang
->IMultiLanguage3_iface
.lpVtbl
= &IMultiLanguage3_vtbl
;
3877 mlang
->IMLangFontLink2_iface
.lpVtbl
= &IMLangFontLink2_vtbl
;
3878 mlang
->IMLangLineBreakConsole_iface
.lpVtbl
= &IMLangLineBreakConsole_vtbl
;
3880 mlang
->total_cp
= 0;
3881 for (i
= 0; i
< ARRAY_SIZE(mlang_data
); i
++)
3882 mlang
->total_cp
+= mlang_data
[i
].number_of_cp
;
3884 /* do not enumerate unicode flavours */
3885 mlang
->total_scripts
= ARRAY_SIZE(mlang_data
) - 1;
3888 *ppObj
= &mlang
->IMultiLanguage_iface
;
3889 TRACE("returning %p\n", mlang
);
3896 static HRESULT
MLangConvertCharset_create(IUnknown
*outer
, void **obj
)
3898 struct convert_charset
*convert
;
3901 return CLASS_E_NOAGGREGATION
;
3905 convert
= HeapAlloc(GetProcessHeap(), 0, sizeof(struct convert_charset
));
3906 if (!convert
) return E_OUTOFMEMORY
;
3908 convert
->IMLangConvertCharset_iface
.lpVtbl
= &MLangConvertCharsetVtbl
;
3911 *obj
= &convert
->IMLangConvertCharset_iface
;
3918 /******************************************************************************/
3920 HRESULT WINAPI
DllCanUnloadNow(void)
3922 return dll_count
== 0 ? S_OK
: S_FALSE
;
3925 static BOOL
register_codepages(void)
3927 const struct mlang_data
*family
;
3928 const MIME_CP_INFO
*info
;
3933 status
= RegCreateKeyW(HKEY_CLASSES_ROOT
, L
"MIME\\Database\\Codepage", &db_key
);
3934 if (status
!= ERROR_SUCCESS
)
3937 for (family
= mlang_data
; family
< mlang_data
+ ARRAY_SIZE(mlang_data
); family
++)
3939 for (info
= family
->mime_cp_info
; info
< family
->mime_cp_info
+ family
->number_of_cp
; info
++)
3941 swprintf(buf
, ARRAY_SIZE(buf
), L
"%u", info
->cp
);
3942 status
= RegCreateKeyW(db_key
, buf
, &key
);
3943 if (status
!= ERROR_SUCCESS
)
3946 RegSetValueExA(key
, "BodyCharset", 0, REG_SZ
, (BYTE
*)info
->body_charset
,
3947 strlen(info
->body_charset
) + 1);
3949 if (info
->cp
== family
->family_codepage
)
3951 RegSetValueExA(key
, "FixedWidthFont", 0, REG_SZ
, (BYTE
*)family
->fixed_font
,
3952 strlen(family
->fixed_font
) + 1);
3953 RegSetValueExA(key
, "ProportionalFont", 0, REG_SZ
, (BYTE
*)family
->proportional_font
,
3954 strlen(family
->proportional_font
) + 1);
3958 RegSetValueExW(key
, L
"Family", 0, REG_DWORD
, (BYTE
*)&family
->family_codepage
,
3959 sizeof(family
->family_codepage
));
3966 RegCloseKey(db_key
);
3970 /***********************************************************************
3971 * DllRegisterServer (MLANG.@)
3973 HRESULT WINAPI
DllRegisterServer(void)
3975 if(!register_codepages())
3977 return __wine_register_resources();
3980 /***********************************************************************
3981 * DllUnregisterServer (MLANG.@)
3983 HRESULT WINAPI
DllUnregisterServer(void)
3985 return __wine_unregister_resources();
3988 HRESULT WINAPI
GetGlobalFontLinkObject(void **unknown
)
3990 if (!unknown
) return E_INVALIDARG
;
3992 FIXME("%p: stub\n", unknown
);