4 * Copyright 2002 Lionel Ulmer
5 * Copyright 2003,2004 Mike McCormack
6 * Copyright 2004,2005 Dmitry Timoshkov
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
37 #include "wine/unicode.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(mlang
);
44 #define CP_UNICODE 1200
46 #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
48 static HRESULT
MultiLanguage_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
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
;
68 /* These data are based on the codepage info in libs/unicode/cpmap.pl */
69 /* FIXME: Add 28604 (Celtic), 28606 (Balkan) */
71 static const MIME_CP_INFO arabic_cp
[] =
74 864, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
75 MIMECONTF_MIME_LATEST
,
76 "ibm864", "ibm864", "ibm864" },
78 1006, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
79 MIMECONTF_MIME_LATEST
,
80 "ibm1006", "ibm1006", "ibm1006" },
82 1256, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
83 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
84 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
85 "windows-1256", "windows-1256", "windows-1256" },
87 28596, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
88 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
89 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
90 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
91 "iso-8859-6", "iso-8859-6", "iso-8859-6" }
93 static const MIME_CP_INFO baltic_cp
[] =
96 775, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
97 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
98 "ibm775", "ibm775", "ibm775" },
100 1257, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
101 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
102 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
103 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
104 "windows-1257", "windows-1257", "windows-1257" },
106 28594, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
107 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
108 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
109 MIMECONTF_MIME_LATEST
,
110 "iso-8859-4", "iso-8859-4", "iso-8859-4" },
112 28603, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
113 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
114 "iso-8859-13", "iso-8859-13", "iso-8859-13" }
116 static const MIME_CP_INFO chinese_simplified_cp
[] =
118 { "Chinese Simplified (GB2312)",
119 936, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
120 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
121 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
122 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
123 "gb2312", "gb2312", "gb2312" }
125 static const MIME_CP_INFO chinese_traditional_cp
[] =
127 { "Chinese Traditional (Big5)",
128 950, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
129 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
130 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
131 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
132 "big5", "big5", "big5" }
134 static const MIME_CP_INFO central_european_cp
[] =
136 { "Central European (DOS)",
137 852, MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_BROWSER
|
138 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
139 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
140 "ibm852", "ibm852", "ibm852" },
141 { "Central European (Windows)",
142 1250, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
143 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
144 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
145 MIMECONTF_MIME_LATEST
,
146 "windows-1250", "windows-1250", "windows-1250" },
147 { "Central European (Mac)",
148 10029, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
149 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
150 "x-mac-ce", "x-mac-ce", "x-mac-ce" },
151 { "Central European (ISO)",
152 28592, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
153 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
154 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
155 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
156 "iso-8859-2", "iso-8859-2", "iso-8859-2" }
158 static const MIME_CP_INFO cyrillic_cp
[] =
161 855, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
162 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
163 "ibm855", "ibm855", "ibm855" },
165 866, MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_BROWSER
|
166 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
|
167 MIMECONTF_MIME_LATEST
,
168 "cp866", "cp866", "cp866" },
169 #if 0 /* Windows has 20866 as an official code page for KOI8-R */
170 { "Cyrillic (KOI8-R)",
171 878, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
172 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
173 "koi8-r", "koi8-r", "koi8-r" },
175 { "Cyrillic (Windows)",
176 1251, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
177 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
178 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
179 "windows-1251", "windows-1251", "windows-1251" },
181 10007, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
182 MIMECONTF_MIME_LATEST
,
183 "x-mac-cyrillic", "x-mac-cyrillic", "x-mac-cyrillic" },
184 { "Cyrillic (KOI8-R)",
185 20866, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
186 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
187 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
188 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
189 "koi8-r", "koi8-r", "koi8-r" },
190 { "Cyrillic (KOI8-U)",
191 21866, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
192 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
193 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
194 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
195 "koi8-u", "koi8-u", "koi8-u" },
197 28595, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
198 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
199 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
200 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
201 "iso-8859-5", "iso-8859-5", "iso-8859-5" }
203 static const MIME_CP_INFO greek_cp
[] =
206 737, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
207 MIMECONTF_MIME_LATEST
,
208 "ibm737", "ibm737", "ibm737" },
209 { "Greek, Modern (DOS)",
210 869, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
211 MIMECONTF_MIME_LATEST
,
212 "ibm869", "ibm869", "ibm869" },
213 { "IBM EBCDIC (Greek Modern)",
214 875, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
215 MIMECONTF_MIME_LATEST
,
216 "cp875", "cp875", "cp875" },
218 1253, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
219 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
220 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
221 "windows-1253", "windows-1253", "windows-1253" },
223 10006, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
224 MIMECONTF_MIME_LATEST
,
225 "x-mac-greek", "x-mac-greek", "x-mac-greek" },
227 28597, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
228 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
229 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
230 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
231 "iso-8859-7", "iso-8859-7", "iso-8859-7" }
233 static const MIME_CP_INFO hebrew_cp
[] =
236 424, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
237 MIMECONTF_MIME_LATEST
,
238 "ibm424", "ibm424", "ibm424" },
240 856, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
241 MIMECONTF_MIME_LATEST
,
242 "cp856", "cp856", "cp856" },
244 862, MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
245 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
246 MIMECONTF_MIME_LATEST
,
247 "dos-862", "dos-862", "dos-862" },
248 { "Hebrew (Windows)",
249 1255, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
250 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
251 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
252 "windows-1255", "windows-1255", "windows-1255" },
253 { "Hebrew (ISO-Visual)",
254 28598, MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
255 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
256 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
257 "iso-8859-8", "iso-8859-8", "iso-8859-8" }
259 static const MIME_CP_INFO japanese_cp
[] =
261 { "Japanese (Shift-JIS)",
262 932, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
263 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
264 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
265 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
266 "shift_jis", "iso-2022-jp", "iso-2022-jp" },
267 { "Japanese (JIS 0208-1990 and 0212-1990)",
268 20932, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
269 MIMECONTF_MIME_LATEST
,
270 "euc-jp", "euc-jp", "euc-jp" }
272 static const MIME_CP_INFO korean_cp
[] =
275 949, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
276 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
277 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
|
278 MIMECONTF_MIME_LATEST
,
279 "ks_c_5601-1987", "ks_c_5601-1987", "ks_c_5601-1987" }
281 static const MIME_CP_INFO thai_cp
[] =
284 874, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_MIME_LATEST
,
285 "ibm-thai", "ibm-thai", "ibm-thai" }
287 static const MIME_CP_INFO turkish_cp
[] =
290 857, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
291 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
292 "ibm857", "ibm857", "ibm857" },
293 { "IBM EBCDIC (Turkish Latin-5)",
294 1026, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
295 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
296 "ibm1026", "ibm1026", "ibm1026" },
297 { "Turkish (Windows)",
298 1254, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
299 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
300 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
301 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
302 "windows-1254", "windows-1254", "windows-1254" },
304 10081, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
305 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
306 "x-mac-turkish", "x-mac-turkish", "x-mac-turkish" },
308 28593, MIMECONTF_MAILNEWS
| MIMECONTF_IMPORT
|
309 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
310 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
311 "iso-8859-3", "iso-8859-3", "iso-8859-3" },
313 28599, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
|
314 MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
315 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
316 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
317 "iso-8859-9", "iso-8859-9", "iso-8859-9" }
319 static const MIME_CP_INFO vietnamese_cp
[] =
321 { "Vietnamese (Windows)",
322 1258, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
323 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
324 MIMECONTF_EXPORT
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
|
325 MIMECONTF_MIME_LATEST
,
326 "windows-1258", "windows-1258", "windows-1258" }
328 static const MIME_CP_INFO western_cp
[] =
330 { "IBM EBCDIC (US-Canada)",
331 37, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
332 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
333 "ibm037", "ibm037", "ibm037" },
334 { "OEM United States",
335 437, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
336 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
337 "ibm437", "ibm437", "ibm437" },
338 { "IBM EBCDIC (International)",
339 500, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
340 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
341 "ibm500", "ibm500", "ibm500" },
342 { "Western European (DOS)",
343 850, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
344 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
345 "ibm850", "ibm850", "ibm850" },
346 { "Portuguese (DOS)",
347 860, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
348 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
349 "ibm860", "ibm860", "ibm860" },
351 861, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
352 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
353 "ibm861", "ibm861", "ibm861" },
354 { "French Canadian (DOS)",
355 863, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
356 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
357 "ibm863", "ibm863", "ibm863" },
359 865, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
360 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
361 "ibm865", "ibm865", "ibm865" },
362 { "Western European (Windows)",
363 1252, 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-1252", "windows-1252", "iso-8859-1" },
368 { "Western European (Mac)",
369 10000, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
370 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
371 "macintosh", "macintosh", "macintosh" },
373 10079, MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
374 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
375 "x-mac-icelandic", "x-mac-icelandic", "x-mac-icelandic" },
377 20127, MIMECONTF_MAILNEWS
| MIMECONTF_IMPORT
| MIMECONTF_EXPORT
|
378 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_VALID
|
379 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
380 "us-ascii", "us-ascii", "us-ascii" },
381 { "Western European (ISO)",
382 28591, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
383 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
384 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
385 MIMECONTF_MIME_LATEST
,
386 "iso-8859-1", "iso-8859-1", "iso-8859-1" },
388 28605, MIMECONTF_MAILNEWS
| MIMECONTF_IMPORT
|
389 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
390 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
391 MIMECONTF_MIME_LATEST
,
392 "iso-8859-15", "iso-8859-15", "iso-8859-15" }
394 static const MIME_CP_INFO unicode_cp
[] =
397 CP_UNICODE
, MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
398 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
399 MIMECONTF_VALID
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
|
400 MIMECONTF_MIME_LATEST
,
401 "unicode", "unicode", "unicode" },
403 CP_UTF7
, MIMECONTF_MAILNEWS
| MIMECONTF_IMPORT
|
404 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
405 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
406 "utf-7", "utf-7", "utf-7" },
408 CP_UTF8
, MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
|
409 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
|
410 MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
411 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
412 "utf-8", "utf-8", "utf-8" }
415 static const struct mlang_data
417 const char *description
;
418 UINT family_codepage
;
420 const MIME_CP_INFO
*mime_cp_info
;
421 const char *fixed_font
;
422 const char *proportional_font
;
425 { "Arabic",1256,sizeof(arabic_cp
)/sizeof(arabic_cp
[0]),arabic_cp
,
426 "Courier","Arial" }, /* FIXME */
427 { "Baltic",1257,sizeof(baltic_cp
)/sizeof(baltic_cp
[0]),baltic_cp
,
428 "Courier","Arial" }, /* FIXME */
429 { "Chinese Simplified",936,sizeof(chinese_simplified_cp
)/sizeof(chinese_simplified_cp
[0]),chinese_simplified_cp
,
430 "Courier","Arial" }, /* FIXME */
431 { "Chinese Traditional",950,sizeof(chinese_traditional_cp
)/sizeof(chinese_traditional_cp
[0]),chinese_traditional_cp
,
432 "Courier","Arial" }, /* FIXME */
433 { "Central European",1250,sizeof(central_european_cp
)/sizeof(central_european_cp
[0]),central_european_cp
,
434 "Courier","Arial" }, /* FIXME */
435 { "Cyrillic",1251,sizeof(cyrillic_cp
)/sizeof(cyrillic_cp
[0]),cyrillic_cp
,
436 "Courier","Arial" }, /* FIXME */
437 { "Greek",1253,sizeof(greek_cp
)/sizeof(greek_cp
[0]),greek_cp
,
438 "Courier","Arial" }, /* FIXME */
439 { "Hebrew",1255,sizeof(hebrew_cp
)/sizeof(hebrew_cp
[0]),hebrew_cp
,
440 "Courier","Arial" }, /* FIXME */
441 { "Japanese",932,sizeof(japanese_cp
)/sizeof(japanese_cp
[0]),japanese_cp
,
442 "Courier","Arial" }, /* FIXME */
443 { "Korean",949,sizeof(korean_cp
)/sizeof(korean_cp
[0]),korean_cp
,
444 "Courier","Arial" }, /* FIXME */
445 { "Thai",874,sizeof(thai_cp
)/sizeof(thai_cp
[0]),thai_cp
,
446 "Courier","Arial" }, /* FIXME */
447 { "Turkish",1254,sizeof(turkish_cp
)/sizeof(turkish_cp
[0]),turkish_cp
,
448 "Courier","Arial" }, /* FIXME */
449 { "Vietnamese",1258,sizeof(vietnamese_cp
)/sizeof(vietnamese_cp
[0]),vietnamese_cp
,
450 "Courier","Arial" }, /* FIXME */
451 { "Western European",1252,sizeof(western_cp
)/sizeof(western_cp
[0]),western_cp
,
452 "Courier","Arial" }, /* FIXME */
453 { "Unicode",CP_UNICODE
,sizeof(unicode_cp
)/sizeof(unicode_cp
[0]),unicode_cp
,
454 "Courier","Arial" } /* FIXME */
457 static void fill_cp_info(const struct mlang_data
*ml_data
, UINT index
, MIMECPINFO
*mime_cp_info
);
459 static LONG dll_count
;
462 * Dll lifetime tracking declaration
464 static void LockModule(void)
466 InterlockedIncrement(&dll_count
);
469 static void UnlockModule(void)
471 InterlockedDecrement(&dll_count
);
474 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
477 case DLL_PROCESS_ATTACH
:
478 MLANG_tls_index
= TlsAlloc();
479 DisableThreadLibraryCalls(hInstDLL
);
481 case DLL_PROCESS_DETACH
:
482 TlsFree(MLANG_tls_index
);
488 HRESULT WINAPI
ConvertINetMultiByteToUnicode(
498 TRACE("%p %d %s %p %p %p\n", pdwMode
, dwEncoding
,
499 debugstr_a(pSrcStr
), pcSrcSize
, pDstStr
, pcDstSize
);
505 pcSrcSize
= &src_len
;
516 if (*pcSrcSize
== -1)
517 *pcSrcSize
= lstrlenW((LPCWSTR
)pSrcStr
);
518 *pcDstSize
= min(*pcSrcSize
, *pcDstSize
);
519 *pcSrcSize
*= sizeof(WCHAR
);
521 memmove(pDstStr
, pSrcStr
, *pcDstSize
* sizeof(WCHAR
));
525 if (*pcSrcSize
== -1)
526 *pcSrcSize
= lstrlenA(pSrcStr
);
529 *pcDstSize
= MultiByteToWideChar(dwEncoding
, 0, pSrcStr
, *pcSrcSize
, pDstStr
, *pcDstSize
);
531 *pcDstSize
= MultiByteToWideChar(dwEncoding
, 0, pSrcStr
, *pcSrcSize
, NULL
, 0);
541 HRESULT WINAPI
ConvertINetUnicodeToMultiByte(
552 TRACE("%p %d %s %p %p %p\n", pdwMode
, dwEncoding
,
553 debugstr_w(pSrcStr
), pcSrcSize
, pDstStr
, pcDstSize
);
559 pcSrcSize
= &src_len
;
561 destsz
= (pDstStr
) ? *pcDstSize
: 0;
564 if (!pSrcStr
|| !*pcSrcSize
)
567 if (*pcSrcSize
== -1)
568 *pcSrcSize
= lstrlenW(pSrcStr
);
570 if (dwEncoding
== CP_UNICODE
)
572 if (*pcSrcSize
== -1)
573 *pcSrcSize
= lstrlenW(pSrcStr
);
575 size
= min(*pcSrcSize
, destsz
) * sizeof(WCHAR
);
577 memmove(pDstStr
, pSrcStr
, size
);
584 size
= WideCharToMultiByte(dwEncoding
, 0, pSrcStr
, *pcSrcSize
,
585 NULL
, 0, NULL
, NULL
);
591 size
= min(size
, destsz
);
592 size
= WideCharToMultiByte(dwEncoding
, 0, pSrcStr
, *pcSrcSize
,
593 pDstStr
, destsz
, NULL
, NULL
);
608 HRESULT WINAPI
ConvertINetString(
618 TRACE("%p %d %d %s %p %p %p\n", pdwMode
, dwSrcEncoding
, dwDstEncoding
,
619 debugstr_a(pSrcStr
), pcSrcSize
, pDstStr
, pcDstSize
);
621 if (dwSrcEncoding
== CP_UNICODE
)
624 if (pcSrcSize
&& *pcSrcSize
!= -1)
626 cSrcSizeW
= *pcSrcSize
/ sizeof(WCHAR
);
627 pcSrcSize
= &cSrcSizeW
;
629 return ConvertINetUnicodeToMultiByte(pdwMode
, dwDstEncoding
, (LPCWSTR
)pSrcStr
, pcSrcSize
, pDstStr
, pcDstSize
);
631 else if (dwDstEncoding
== CP_UNICODE
)
633 HRESULT hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, (LPWSTR
)pDstStr
, pcDstSize
);
634 *pcDstSize
*= sizeof(WCHAR
);
643 TRACE("convert %s from %d to %d\n", debugstr_a(pSrcStr
), dwSrcEncoding
, dwDstEncoding
);
645 hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, NULL
, &cDstSizeW
);
649 pDstStrW
= HeapAlloc(GetProcessHeap(), 0, cDstSizeW
* sizeof(WCHAR
));
650 hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, pDstStrW
, &cDstSizeW
);
652 hr
= ConvertINetUnicodeToMultiByte(pdwMode
, dwDstEncoding
, pDstStrW
, &cDstSizeW
, pDstStr
, pcDstSize
);
654 HeapFree(GetProcessHeap(), 0, pDstStrW
);
659 static HRESULT
GetFamilyCodePage(
661 UINT
* puiFamilyCodePage
)
665 TRACE("%u %p\n", uiCodePage
, puiFamilyCodePage
);
667 if (!puiFamilyCodePage
) return S_FALSE
;
669 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
671 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
673 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
675 *puiFamilyCodePage
= mlang_data
[i
].family_codepage
;
684 HRESULT WINAPI
IsConvertINetStringAvailable(
688 UINT src_family
, dst_family
;
690 TRACE("%d %d\n", dwSrcEncoding
, dwDstEncoding
);
692 if (GetFamilyCodePage(dwSrcEncoding
, &src_family
) != S_OK
||
693 GetFamilyCodePage(dwDstEncoding
, &dst_family
) != S_OK
)
696 if (src_family
== dst_family
) return S_OK
;
698 /* we can convert any codepage to/from unicode */
699 if (src_family
== CP_UNICODE
|| dst_family
== CP_UNICODE
) return S_OK
;
704 static inline INT
lcid_to_rfc1766A( LCID lcid
, LPSTR rfc1766
, INT len
)
706 INT n
= GetLocaleInfoA( lcid
, LOCALE_SISO639LANGNAME
, rfc1766
, len
);
709 rfc1766
[n
- 1] = '-';
710 n
+= GetLocaleInfoA( lcid
, LOCALE_SISO3166CTRYNAME
, rfc1766
+ n
, len
- n
);
711 LCMapStringA( LOCALE_USER_DEFAULT
, LCMAP_LOWERCASE
, rfc1766
, n
, rfc1766
, len
);
717 static inline INT
lcid_to_rfc1766W( LCID lcid
, LPWSTR rfc1766
, INT len
)
719 INT n
= GetLocaleInfoW( lcid
, LOCALE_SISO639LANGNAME
, rfc1766
, len
);
723 rfc1766
[n
- 1] = '-';
724 n
+= GetLocaleInfoW( lcid
, LOCALE_SISO3166CTRYNAME
, rfc1766
+ n
, len
- n
);
726 rfc1766
[n
- 1] = '\0';
727 LCMapStringW( LOCALE_USER_DEFAULT
, LCMAP_LOWERCASE
, rfc1766
, n
, rfc1766
, len
);
733 HRESULT WINAPI
LcidToRfc1766A(
738 TRACE("%04x %p %u\n", lcid
, pszRfc1766
, nChar
);
740 if (lcid_to_rfc1766A( lcid
, pszRfc1766
, nChar
))
746 HRESULT WINAPI
LcidToRfc1766W(
751 TRACE("%04x %p %u\n", lcid
, pszRfc1766
, nChar
);
753 if (lcid_to_rfc1766W( lcid
, pszRfc1766
, nChar
))
759 static HRESULT
lcid_from_rfc1766(IEnumRfc1766
*iface
, LCID
*lcid
, LPCWSTR rfc1766
)
764 while (IEnumRfc1766_Next(iface
, 1, &info
, &num
) == S_OK
)
766 if (!strcmpW(info
.wszRfc1766
, rfc1766
))
771 if (strlenW(rfc1766
) == 2 && !memcmp(info
.wszRfc1766
, rfc1766
, 2 * sizeof(WCHAR
)))
773 *lcid
= PRIMARYLANGID(info
.lcid
);
781 HRESULT WINAPI
Rfc1766ToLcidW(LCID
*pLocale
, LPCWSTR pszRfc1766
)
783 IEnumRfc1766
*enumrfc1766
;
786 TRACE("(%p, %s)\n", pLocale
, debugstr_w(pszRfc1766
));
788 if (!pLocale
|| !pszRfc1766
)
793 hr
= EnumRfc1766_create(0, &enumrfc1766
);
797 hr
= lcid_from_rfc1766(enumrfc1766
, pLocale
, pszRfc1766
);
798 IEnumRfc1766_Release(enumrfc1766
);
803 HRESULT WINAPI
Rfc1766ToLcidA(LCID
*lcid
, LPCSTR rfc1766A
)
805 WCHAR rfc1766W
[MAX_RFC1766_NAME
+ 1];
807 MultiByteToWideChar(CP_ACP
, 0, rfc1766A
, -1, rfc1766W
, MAX_RFC1766_NAME
);
808 rfc1766W
[MAX_RFC1766_NAME
] = 0;
810 return Rfc1766ToLcidW(lcid
, rfc1766W
);
813 /******************************************************************************
817 IClassFactory ITF_IClassFactory
;
820 HRESULT (*pfnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
823 struct object_creation_info
827 HRESULT (*pfnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
830 static const struct object_creation_info object_creation
[] =
832 { &CLSID_CMultiLanguage
, "CLSID_CMultiLanguage", MultiLanguage_create
},
835 static HRESULT WINAPI
836 MLANGCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
838 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
840 TRACE("%s\n", debugstr_guid(riid
) );
842 if (IsEqualGUID(riid
, &IID_IUnknown
)
843 || IsEqualGUID(riid
, &IID_IClassFactory
))
845 IClassFactory_AddRef(iface
);
850 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
851 return E_NOINTERFACE
;
854 static ULONG WINAPI
MLANGCF_AddRef(LPCLASSFACTORY iface
)
856 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
857 return InterlockedIncrement(&This
->ref
);
860 static ULONG WINAPI
MLANGCF_Release(LPCLASSFACTORY iface
)
862 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
864 ULONG ref
= InterlockedDecrement(&This
->ref
);
868 TRACE("Destroying %p\n", This
);
869 HeapFree(GetProcessHeap(), 0, This
);
875 static HRESULT WINAPI
MLANGCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
,
876 REFIID riid
, LPVOID
*ppobj
)
878 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
882 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
885 hres
= This
->pfnCreateInstance(pOuter
, (LPVOID
*) &punk
);
886 if (SUCCEEDED(hres
)) {
887 hres
= IUnknown_QueryInterface(punk
, riid
, ppobj
);
888 IUnknown_Release(punk
);
890 TRACE("returning (%p) -> %x\n", *ppobj
, hres
);
894 static HRESULT WINAPI
MLANGCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
904 static const IClassFactoryVtbl MLANGCF_Vtbl
=
906 MLANGCF_QueryInterface
,
909 MLANGCF_CreateInstance
,
913 /******************************************************************
914 * DllGetClassObject (MLANG.@)
916 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
919 IClassFactoryImpl
*factory
;
921 TRACE("%s %s %p\n",debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
923 if ( !IsEqualGUID( &IID_IClassFactory
, iid
)
924 && ! IsEqualGUID( &IID_IUnknown
, iid
) )
925 return E_NOINTERFACE
;
927 for (i
=0; i
< sizeof(object_creation
)/sizeof(object_creation
[0]); i
++)
929 if (IsEqualGUID(object_creation
[i
].clsid
, rclsid
))
933 if (i
== sizeof(object_creation
)/sizeof(object_creation
[0]))
935 FIXME("%s: no class found.\n", debugstr_guid(rclsid
));
936 return CLASS_E_CLASSNOTAVAILABLE
;
939 TRACE("Creating a class factory for %s\n",object_creation
[i
].szClassName
);
941 factory
= HeapAlloc(GetProcessHeap(), 0, sizeof(*factory
));
942 if (factory
== NULL
) return E_OUTOFMEMORY
;
944 factory
->ITF_IClassFactory
.lpVtbl
= &MLANGCF_Vtbl
;
947 factory
->pfnCreateInstance
= object_creation
[i
].pfnCreateInstance
;
949 *ppv
= &(factory
->ITF_IClassFactory
);
951 TRACE("(%p) <- %p\n", ppv
, &(factory
->ITF_IClassFactory
) );
957 /******************************************************************************/
959 typedef struct tagMLang_impl
961 const IMLangFontLinkVtbl
*vtbl_IMLangFontLink
;
962 const IMultiLanguageVtbl
*vtbl_IMultiLanguage
;
963 const IMultiLanguage3Vtbl
*vtbl_IMultiLanguage3
;
964 const IMLangFontLink2Vtbl
*vtbl_IMLangFontLink2
;
966 DWORD total_cp
, total_scripts
;
969 static ULONG WINAPI
MLang_AddRef( MLang_impl
* This
)
971 return InterlockedIncrement(&This
->ref
);
974 static ULONG WINAPI
MLang_Release( MLang_impl
* This
)
976 ULONG ref
= InterlockedDecrement(&This
->ref
);
978 TRACE("%p ref = %d\n", This
, ref
);
981 TRACE("Destroying %p\n", This
);
982 HeapFree(GetProcessHeap(), 0, This
);
989 static HRESULT WINAPI
MLang_QueryInterface(
994 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
996 if (IsEqualGUID(riid
, &IID_IUnknown
)
997 || IsEqualGUID(riid
, &IID_IMLangCodePages
)
998 || IsEqualGUID(riid
, &IID_IMLangFontLink
))
1001 TRACE("Returning IID_IMLangFontLink %p ref = %d\n", This
, This
->ref
);
1002 *ppvObject
= &(This
->vtbl_IMLangFontLink
);
1006 if (IsEqualGUID(riid
, &IID_IMLangFontLink2
))
1009 TRACE("Returning IID_IMLangFontLink2 %p ref = %d\n", This
, This
->ref
);
1010 *ppvObject
= &(This
->vtbl_IMLangFontLink2
);
1014 if (IsEqualGUID(riid
, &IID_IMultiLanguage
) )
1017 TRACE("Returning IID_IMultiLanguage %p ref = %d\n", This
, This
->ref
);
1018 *ppvObject
= &(This
->vtbl_IMultiLanguage
);
1022 if (IsEqualGUID(riid
, &IID_IMultiLanguage2
) )
1025 *ppvObject
= &(This
->vtbl_IMultiLanguage3
);
1026 TRACE("Returning IID_IMultiLanguage2 %p ref = %d\n", This
, This
->ref
);
1030 if (IsEqualGUID(riid
, &IID_IMultiLanguage3
) )
1033 *ppvObject
= &(This
->vtbl_IMultiLanguage3
);
1034 TRACE("Returning IID_IMultiLanguage3 %p ref = %d\n", This
, This
->ref
);
1038 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1039 return E_NOINTERFACE
;
1042 /******************************************************************************/
1044 typedef struct tagEnumCodePage_impl
1046 const IEnumCodePageVtbl
*vtbl_IEnumCodePage
;
1050 } EnumCodePage_impl
;
1052 static HRESULT WINAPI
fnIEnumCodePage_QueryInterface(
1053 IEnumCodePage
* iface
,
1057 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1059 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1061 if (IsEqualGUID(riid
, &IID_IUnknown
)
1062 || IsEqualGUID(riid
, &IID_IEnumCodePage
))
1064 IEnumCodePage_AddRef(iface
);
1065 TRACE("Returning IID_IEnumCodePage %p ref = %d\n", This
, This
->ref
);
1066 *ppvObject
= &(This
->vtbl_IEnumCodePage
);
1070 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1071 return E_NOINTERFACE
;
1074 static ULONG WINAPI
fnIEnumCodePage_AddRef(
1075 IEnumCodePage
* iface
)
1077 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1078 return InterlockedIncrement(&This
->ref
);
1081 static ULONG WINAPI
fnIEnumCodePage_Release(
1082 IEnumCodePage
* iface
)
1084 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1085 ULONG ref
= InterlockedDecrement(&This
->ref
);
1087 TRACE("%p ref = %d\n", This
, ref
);
1090 TRACE("Destroying %p\n", This
);
1091 HeapFree(GetProcessHeap(), 0, This
->cpinfo
);
1092 HeapFree(GetProcessHeap(), 0, This
);
1098 static HRESULT WINAPI
fnIEnumCodePage_Clone(
1099 IEnumCodePage
* iface
,
1100 IEnumCodePage
** ppEnum
)
1102 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1103 FIXME("%p %p\n", This
, ppEnum
);
1107 static HRESULT WINAPI
fnIEnumCodePage_Next(
1108 IEnumCodePage
* iface
,
1111 ULONG
* pceltFetched
)
1115 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1116 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1118 if (!pceltFetched
) return S_FALSE
;
1121 if (!rgelt
) return S_FALSE
;
1123 if (This
->pos
+ celt
> This
->total
)
1124 celt
= This
->total
- This
->pos
;
1126 if (!celt
) return S_FALSE
;
1128 memcpy(rgelt
, This
->cpinfo
+ This
->pos
, celt
* sizeof(MIMECPINFO
));
1129 *pceltFetched
= celt
;
1132 for (i
= 0; i
< celt
; i
++)
1134 TRACE("#%u: %08x %u %u %s %s %s %s %s %s %d\n",
1135 i
, rgelt
[i
].dwFlags
, rgelt
[i
].uiCodePage
,
1136 rgelt
[i
].uiFamilyCodePage
,
1137 wine_dbgstr_w(rgelt
[i
].wszDescription
),
1138 wine_dbgstr_w(rgelt
[i
].wszWebCharset
),
1139 wine_dbgstr_w(rgelt
[i
].wszHeaderCharset
),
1140 wine_dbgstr_w(rgelt
[i
].wszBodyCharset
),
1141 wine_dbgstr_w(rgelt
[i
].wszFixedWidthFont
),
1142 wine_dbgstr_w(rgelt
[i
].wszProportionalFont
),
1143 rgelt
[i
].bGDICharset
);
1148 static HRESULT WINAPI
fnIEnumCodePage_Reset(
1149 IEnumCodePage
* iface
)
1151 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1152 TRACE("%p\n", This
);
1158 static HRESULT WINAPI
fnIEnumCodePage_Skip(
1159 IEnumCodePage
* iface
,
1162 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1163 TRACE("%p %u\n", This
, celt
);
1165 if (celt
>= This
->total
) return S_FALSE
;
1171 static const IEnumCodePageVtbl IEnumCodePage_vtbl
=
1173 fnIEnumCodePage_QueryInterface
,
1174 fnIEnumCodePage_AddRef
,
1175 fnIEnumCodePage_Release
,
1176 fnIEnumCodePage_Clone
,
1177 fnIEnumCodePage_Next
,
1178 fnIEnumCodePage_Reset
,
1179 fnIEnumCodePage_Skip
1182 static HRESULT
EnumCodePage_create( MLang_impl
* mlang
, DWORD grfFlags
,
1183 LANGID LangId
, IEnumCodePage
** ppEnumCodePage
)
1185 EnumCodePage_impl
*ecp
;
1189 TRACE("%p, %08x, %04x, %p\n", mlang
, grfFlags
, LangId
, ppEnumCodePage
);
1191 if (!grfFlags
) /* enumerate internal data base of encodings */
1192 grfFlags
= MIMECONTF_MIME_LATEST
;
1194 ecp
= HeapAlloc( GetProcessHeap(), 0, sizeof (EnumCodePage_impl
) );
1195 ecp
->vtbl_IEnumCodePage
= &IEnumCodePage_vtbl
;
1199 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1201 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1203 if (mlang_data
[i
].mime_cp_info
[n
].flags
& grfFlags
)
1208 ecp
->cpinfo
= HeapAlloc(GetProcessHeap(), 0,
1209 sizeof(MIMECPINFO
) * ecp
->total
);
1210 cpinfo
= ecp
->cpinfo
;
1212 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1214 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1216 if (mlang_data
[i
].mime_cp_info
[n
].flags
& grfFlags
)
1217 fill_cp_info(&mlang_data
[i
], n
, cpinfo
++);
1221 TRACE("enumerated %d codepages with flags %08x\n", ecp
->total
, grfFlags
);
1223 *ppEnumCodePage
= (IEnumCodePage
*) ecp
;
1228 /******************************************************************************/
1230 typedef struct tagEnumScript_impl
1232 const IEnumScriptVtbl
*vtbl_IEnumScript
;
1234 SCRIPTINFO
*script_info
;
1238 static HRESULT WINAPI
fnIEnumScript_QueryInterface(
1243 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1245 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1247 if (IsEqualGUID(riid
, &IID_IUnknown
)
1248 || IsEqualGUID(riid
, &IID_IEnumScript
))
1250 IEnumScript_AddRef(iface
);
1251 TRACE("Returning IID_IEnumScript %p ref = %d\n", This
, This
->ref
);
1252 *ppvObject
= &(This
->vtbl_IEnumScript
);
1256 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1257 return E_NOINTERFACE
;
1260 static ULONG WINAPI
fnIEnumScript_AddRef(
1263 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1264 return InterlockedIncrement(&This
->ref
);
1267 static ULONG WINAPI
fnIEnumScript_Release(
1270 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1271 ULONG ref
= InterlockedDecrement(&This
->ref
);
1273 TRACE("%p ref = %d\n", This
, ref
);
1276 TRACE("Destroying %p\n", This
);
1277 HeapFree(GetProcessHeap(), 0, This
->script_info
);
1278 HeapFree(GetProcessHeap(), 0, This
);
1284 static HRESULT WINAPI
fnIEnumScript_Clone(
1286 IEnumScript
** ppEnum
)
1288 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1289 FIXME("%p %p: stub!\n", This
, ppEnum
);
1293 static HRESULT WINAPI
fnIEnumScript_Next(
1297 ULONG
* pceltFetched
)
1299 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1300 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1302 if (!pceltFetched
|| !rgelt
) return E_FAIL
;
1306 if (This
->pos
+ celt
> This
->total
)
1307 celt
= This
->total
- This
->pos
;
1309 if (!celt
) return S_FALSE
;
1311 memcpy(rgelt
, This
->script_info
+ This
->pos
, celt
* sizeof(SCRIPTINFO
));
1312 *pceltFetched
= celt
;
1318 static HRESULT WINAPI
fnIEnumScript_Reset(
1321 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1322 TRACE("%p\n", This
);
1328 static HRESULT WINAPI
fnIEnumScript_Skip(
1332 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1333 TRACE("%p %u\n", This
, celt
);
1335 if (celt
>= This
->total
) return S_FALSE
;
1341 static const IEnumScriptVtbl IEnumScript_vtbl
=
1343 fnIEnumScript_QueryInterface
,
1344 fnIEnumScript_AddRef
,
1345 fnIEnumScript_Release
,
1346 fnIEnumScript_Clone
,
1348 fnIEnumScript_Reset
,
1352 static HRESULT
EnumScript_create( MLang_impl
* mlang
, DWORD dwFlags
,
1353 LANGID LangId
, IEnumScript
** ppEnumScript
)
1355 EnumScript_impl
*es
;
1358 TRACE("%p, %08x, %04x, %p: stub!\n", mlang
, dwFlags
, LangId
, ppEnumScript
);
1360 if (!dwFlags
) /* enumerate all available scripts */
1361 dwFlags
= SCRIPTCONTF_SCRIPT_USER
| SCRIPTCONTF_SCRIPT_HIDE
| SCRIPTCONTF_SCRIPT_SYSTEM
;
1363 es
= HeapAlloc( GetProcessHeap(), 0, sizeof (EnumScript_impl
) );
1364 es
->vtbl_IEnumScript
= &IEnumScript_vtbl
;
1367 /* do not enumerate unicode flavours */
1368 es
->total
= sizeof(mlang_data
)/sizeof(mlang_data
[0]) - 1;
1369 es
->script_info
= HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPTINFO
) * es
->total
);
1371 for (i
= 0; i
< es
->total
; i
++)
1373 es
->script_info
[i
].ScriptId
= i
;
1374 es
->script_info
[i
].uiCodePage
= mlang_data
[i
].family_codepage
;
1375 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].description
, -1,
1376 es
->script_info
[i
].wszDescription
, MAX_SCRIPT_NAME
);
1377 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].fixed_font
, -1,
1378 es
->script_info
[i
].wszFixedWidthFont
, MAX_MIMEFACE_NAME
);
1379 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].proportional_font
, -1,
1380 es
->script_info
[i
].wszProportionalFont
, MAX_MIMEFACE_NAME
);
1383 TRACE("enumerated %d scripts with flags %08x\n", es
->total
, dwFlags
);
1385 *ppEnumScript
= (IEnumScript
*)es
;
1390 /******************************************************************************/
1392 static HRESULT WINAPI
fnIMLangFontLink_QueryInterface(
1393 IMLangFontLink
* iface
,
1397 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1398 return MLang_QueryInterface( This
, riid
, ppvObject
);
1401 static ULONG WINAPI
fnIMLangFontLink_AddRef(
1402 IMLangFontLink
* iface
)
1404 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1405 return MLang_AddRef( This
);
1408 static ULONG WINAPI
fnIMLangFontLink_Release(
1409 IMLangFontLink
* iface
)
1411 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1412 return MLang_Release( This
);
1415 static HRESULT WINAPI
fnIMLangFontLink_GetCharCodePages(
1416 IMLangFontLink
* iface
,
1418 DWORD
* pdwCodePages
)
1424 static HRESULT WINAPI
fnIMLangFontLink_GetStrCodePages(
1425 IMLangFontLink
* iface
,
1426 const WCHAR
* pszSrc
,
1428 DWORD dwPriorityCodePages
,
1429 DWORD
* pdwCodePages
,
1430 long* pcchCodePages
)
1432 FIXME("(pszSrc=%s, cchSrc=%ld, dwPriorityCodePages=%d) stub\n", debugstr_w(pszSrc
), cchSrc
, dwPriorityCodePages
);
1438 static HRESULT WINAPI
fnIMLangFontLink_CodePageToCodePages(
1439 IMLangFontLink
* iface
,
1441 DWORD
* pdwCodePages
)
1443 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1447 TRACE("(%p) Seeking %u\n",This
, uCodePage
);
1448 memset(&cs
, 0, sizeof(cs
));
1450 rc
= TranslateCharsetInfo((DWORD
*)uCodePage
, &cs
, TCI_SRCCODEPAGE
);
1454 *pdwCodePages
= cs
.fs
.fsCsb
[0];
1455 TRACE("resulting CodePages 0x%x\n",*pdwCodePages
);
1458 TRACE("CodePage Not Found\n");
1463 static HRESULT WINAPI
fnIMLangFontLink_CodePagesToCodePage(
1464 IMLangFontLink
* iface
,
1466 UINT uDefaultCodePage
,
1469 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1470 DWORD mask
= 0x00000000;
1475 TRACE("(%p) scanning 0x%x default page %u\n",This
, dwCodePages
,
1478 *puCodePage
= 0x00000000;
1480 rc
= TranslateCharsetInfo((DWORD
*)uDefaultCodePage
, &cs
, TCI_SRCCODEPAGE
);
1482 if (rc
&& (dwCodePages
& cs
.fs
.fsCsb
[0]))
1484 TRACE("Found Default Codepage\n");
1485 *puCodePage
= uDefaultCodePage
;
1490 for (i
= 0; i
< 32; i
++)
1494 if (dwCodePages
& mask
)
1499 rc
= TranslateCharsetInfo((DWORD
*)Csb
, &cs
, TCI_SRCFONTSIG
);
1503 TRACE("Falling back to least significant found CodePage %u\n",
1505 *puCodePage
= cs
.ciACP
;
1510 TRACE("no codepage found\n");
1514 static HRESULT WINAPI
fnIMLangFontLink_GetFontCodePages(
1515 IMLangFontLink
* iface
,
1518 DWORD
* pdwCodePages
)
1521 FONTSIGNATURE fontsig
;
1522 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1524 TRACE("(%p)\n",This
);
1526 old_font
= SelectObject(hDC
,hFont
);
1527 GetTextCharsetInfo(hDC
,&fontsig
, 0);
1528 SelectObject(hDC
,old_font
);
1530 *pdwCodePages
= fontsig
.fsCsb
[0];
1531 TRACE("CodePages is 0x%x\n",fontsig
.fsCsb
[0]);
1536 static HRESULT WINAPI
fnIMLangFontLink_MapFont(
1537 IMLangFontLink
* iface
,
1547 static HRESULT WINAPI
fnIMLangFontLink_ReleaseFont(
1548 IMLangFontLink
* iface
,
1555 static HRESULT WINAPI
fnIMLangFontLink_ResetFontMapping(
1556 IMLangFontLink
* iface
)
1563 static const IMLangFontLinkVtbl IMLangFontLink_vtbl
=
1565 fnIMLangFontLink_QueryInterface
,
1566 fnIMLangFontLink_AddRef
,
1567 fnIMLangFontLink_Release
,
1568 fnIMLangFontLink_GetCharCodePages
,
1569 fnIMLangFontLink_GetStrCodePages
,
1570 fnIMLangFontLink_CodePageToCodePages
,
1571 fnIMLangFontLink_CodePagesToCodePage
,
1572 fnIMLangFontLink_GetFontCodePages
,
1573 fnIMLangFontLink_MapFont
,
1574 fnIMLangFontLink_ReleaseFont
,
1575 fnIMLangFontLink_ResetFontMapping
,
1578 /******************************************************************************/
1580 static HRESULT WINAPI
fnIMultiLanguage_QueryInterface(
1581 IMultiLanguage
* iface
,
1585 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1586 return MLang_QueryInterface( This
, riid
, ppvObject
);
1589 static ULONG WINAPI
fnIMultiLanguage_AddRef( IMultiLanguage
* iface
)
1591 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1592 return IMLangFontLink_AddRef( ((IMLangFontLink
*)This
) );
1595 static ULONG WINAPI
fnIMultiLanguage_Release( IMultiLanguage
* iface
)
1597 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1598 return IMLangFontLink_Release( ((IMLangFontLink
*)This
) );
1601 static HRESULT WINAPI
fnIMultiLanguage_GetNumberOfCodePageInfo(
1602 IMultiLanguage
* iface
,
1609 static HRESULT WINAPI
fnIMultiLanguage_GetCodePageInfo(
1610 IMultiLanguage
* iface
,
1612 PMIMECPINFO pCodePageInfo
)
1616 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1617 TRACE("%p, %u, %p\n", This
, uiCodePage
, pCodePageInfo
);
1619 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1621 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1623 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
1625 fill_cp_info(&mlang_data
[i
], n
, pCodePageInfo
);
1634 static HRESULT WINAPI
fnIMultiLanguage_GetFamilyCodePage(
1635 IMultiLanguage
* iface
,
1637 UINT
* puiFamilyCodePage
)
1639 return GetFamilyCodePage(uiCodePage
, puiFamilyCodePage
);
1642 static HRESULT WINAPI
fnIMultiLanguage_EnumCodePages(
1643 IMultiLanguage
* iface
,
1645 IEnumCodePage
** ppEnumCodePage
)
1647 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1648 TRACE("%p %08x %p\n", This
, grfFlags
, ppEnumCodePage
);
1650 return EnumCodePage_create( This
, grfFlags
, 0, ppEnumCodePage
);
1653 static HRESULT WINAPI
fnIMultiLanguage_GetCharsetInfo(
1654 IMultiLanguage
* iface
,
1656 PMIMECSETINFO pCharsetInfo
)
1662 static HRESULT WINAPI
fnIMultiLanguage_IsConvertible(
1663 IMultiLanguage
* iface
,
1664 DWORD dwSrcEncoding
,
1665 DWORD dwDstEncoding
)
1667 return IsConvertINetStringAvailable(dwSrcEncoding
, dwDstEncoding
);
1670 static HRESULT WINAPI
fnIMultiLanguage_ConvertString(
1671 IMultiLanguage
* iface
,
1673 DWORD dwSrcEncoding
,
1674 DWORD dwDstEncoding
,
1680 return ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
,
1681 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, (LPSTR
)pDstStr
, (LPINT
)pcDstSize
);
1684 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringToUnicode(
1685 IMultiLanguage
* iface
,
1693 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
1694 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
1697 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringFromUnicode(
1698 IMultiLanguage
* iface
,
1706 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
1707 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
1710 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringReset(
1711 IMultiLanguage
* iface
)
1717 static HRESULT WINAPI
fnIMultiLanguage_GetRfc1766FromLcid(
1718 IMultiLanguage
* iface
,
1722 WCHAR buf
[MAX_RFC1766_NAME
];
1724 TRACE("%p %04x %p\n", iface
, lcid
, pbstrRfc1766
);
1726 if (lcid_to_rfc1766W( lcid
, buf
, MAX_RFC1766_NAME
))
1728 *pbstrRfc1766
= SysAllocString( buf
);
1734 static HRESULT WINAPI
fnIMultiLanguage_GetLcidFromRfc1766(
1735 IMultiLanguage
* iface
,
1740 IEnumRfc1766
*rfc1766
;
1742 TRACE("%p %p %s\n", iface
, pLocale
, debugstr_w(bstrRfc1766
));
1744 if (!pLocale
|| !bstrRfc1766
)
1745 return E_INVALIDARG
;
1747 hr
= IMultiLanguage_EnumRfc1766(iface
, &rfc1766
);
1751 hr
= lcid_from_rfc1766(rfc1766
, pLocale
, bstrRfc1766
);
1753 IEnumRfc1766_Release(rfc1766
);
1757 /******************************************************************************/
1759 typedef struct tagEnumRfc1766_impl
1761 const IEnumRfc1766Vtbl
*vtbl_IEnumRfc1766
;
1767 static HRESULT WINAPI
fnIEnumRfc1766_QueryInterface(
1768 IEnumRfc1766
*iface
,
1772 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1774 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1776 if (IsEqualGUID(riid
, &IID_IUnknown
)
1777 || IsEqualGUID(riid
, &IID_IEnumRfc1766
))
1779 IEnumRfc1766_AddRef(iface
);
1780 TRACE("Returning IID_IEnumRfc1766 %p ref = %d\n", This
, This
->ref
);
1781 *ppvObject
= &(This
->vtbl_IEnumRfc1766
);
1785 WARN("(%p) -> (%s,%p), not found\n",This
,debugstr_guid(riid
),ppvObject
);
1786 return E_NOINTERFACE
;
1789 static ULONG WINAPI
fnIEnumRfc1766_AddRef(
1790 IEnumRfc1766
*iface
)
1792 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1793 return InterlockedIncrement(&This
->ref
);
1796 static ULONG WINAPI
fnIEnumRfc1766_Release(
1797 IEnumRfc1766
*iface
)
1799 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1800 ULONG ref
= InterlockedDecrement(&This
->ref
);
1802 TRACE("%p ref = %d\n", This
, ref
);
1805 TRACE("Destroying %p\n", This
);
1806 HeapFree(GetProcessHeap(), 0, This
->info
);
1807 HeapFree(GetProcessHeap(), 0, This
);
1812 static HRESULT WINAPI
fnIEnumRfc1766_Clone(
1813 IEnumRfc1766
*iface
,
1814 IEnumRfc1766
**ppEnum
)
1816 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1817 FIXME("%p %p\n", This
, ppEnum
);
1821 static HRESULT WINAPI
fnIEnumRfc1766_Next(
1822 IEnumRfc1766
*iface
,
1825 ULONG
*pceltFetched
)
1829 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1830 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1832 if (!pceltFetched
) return S_FALSE
;
1835 if (!rgelt
) return S_FALSE
;
1837 if (This
->pos
+ celt
> This
->total
)
1838 celt
= This
->total
- This
->pos
;
1840 if (!celt
) return S_FALSE
;
1842 memcpy(rgelt
, This
->info
+ This
->pos
, celt
* sizeof(RFC1766INFO
));
1843 *pceltFetched
= celt
;
1846 for (i
= 0; i
< celt
; i
++)
1848 TRACE("#%u: %08x %s %s\n",
1850 wine_dbgstr_w(rgelt
[i
].wszRfc1766
),
1851 wine_dbgstr_w(rgelt
[i
].wszLocaleName
));
1856 static HRESULT WINAPI
fnIEnumRfc1766_Reset(
1857 IEnumRfc1766
*iface
)
1859 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1860 TRACE("%p\n", This
);
1866 static HRESULT WINAPI
fnIEnumRfc1766_Skip(
1867 IEnumRfc1766
*iface
,
1870 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1871 TRACE("%p %u\n", This
, celt
);
1873 if (celt
>= This
->total
) return S_FALSE
;
1879 static const IEnumRfc1766Vtbl IEnumRfc1766_vtbl
=
1881 fnIEnumRfc1766_QueryInterface
,
1882 fnIEnumRfc1766_AddRef
,
1883 fnIEnumRfc1766_Release
,
1884 fnIEnumRfc1766_Clone
,
1885 fnIEnumRfc1766_Next
,
1886 fnIEnumRfc1766_Reset
,
1890 struct enum_locales_data
1893 DWORD total
, allocated
;
1896 static BOOL CALLBACK
enum_locales_proc(LPWSTR locale
)
1899 struct enum_locales_data
*data
= TlsGetValue(MLANG_tls_index
);
1902 TRACE("%s\n", debugstr_w(locale
));
1904 if (data
->total
>= data
->allocated
)
1906 data
->allocated
+= 32;
1907 data
->info
= HeapReAlloc(GetProcessHeap(), 0, data
->info
, data
->allocated
* sizeof(RFC1766INFO
));
1908 if (!data
->info
) return FALSE
;
1911 info
= &data
->info
[data
->total
];
1913 info
->lcid
= strtolW(locale
, &end
, 16);
1914 if (*end
) /* invalid number */
1917 info
->wszRfc1766
[0] = 0;
1918 lcid_to_rfc1766W( info
->lcid
, info
->wszRfc1766
, MAX_RFC1766_NAME
);
1920 info
->wszLocaleName
[0] = 0;
1921 GetLocaleInfoW(info
->lcid
, LOCALE_SLANGUAGE
, info
->wszLocaleName
, MAX_LOCALE_NAME
);
1922 TRACE("ISO639: %s SLANGUAGE: %s\n", wine_dbgstr_w(info
->wszRfc1766
), wine_dbgstr_w(info
->wszLocaleName
));
1929 static HRESULT
EnumRfc1766_create(LANGID LangId
, IEnumRfc1766
**ppEnum
)
1931 EnumRfc1766_impl
*rfc
;
1932 struct enum_locales_data data
;
1934 TRACE("%04x, %p\n", LangId
, ppEnum
);
1936 rfc
= HeapAlloc( GetProcessHeap(), 0, sizeof(EnumRfc1766_impl
) );
1937 rfc
->vtbl_IEnumRfc1766
= &IEnumRfc1766_vtbl
;
1943 data
.allocated
= 32;
1944 data
.info
= HeapAlloc(GetProcessHeap(), 0, data
.allocated
* sizeof(RFC1766INFO
));
1947 HeapFree(GetProcessHeap(), 0, rfc
);
1951 TlsSetValue(MLANG_tls_index
, &data
);
1952 EnumSystemLocalesW(enum_locales_proc
, 0/*LOCALE_SUPPORTED*/);
1953 TlsSetValue(MLANG_tls_index
, NULL
);
1955 TRACE("enumerated %d rfc1766 structures\n", data
.total
);
1959 HeapFree(GetProcessHeap(), 0, data
.info
);
1960 HeapFree(GetProcessHeap(), 0, rfc
);
1964 rfc
->info
= data
.info
;
1965 rfc
->total
= data
.total
;
1967 *ppEnum
= (IEnumRfc1766
*)rfc
;
1971 static HRESULT WINAPI
fnIMultiLanguage_EnumRfc1766(
1972 IMultiLanguage
*iface
,
1973 IEnumRfc1766
**ppEnumRfc1766
)
1975 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1976 TRACE("%p %p\n", This
, ppEnumRfc1766
);
1978 return EnumRfc1766_create(0, ppEnumRfc1766
);
1981 /******************************************************************************/
1983 static HRESULT WINAPI
fnIMultiLanguage_GetRfc1766Info(
1984 IMultiLanguage
* iface
,
1986 PRFC1766INFO pRfc1766Info
)
1992 static HRESULT WINAPI
fnIMultiLanguage_CreateConvertCharset(
1993 IMultiLanguage
* iface
,
1997 IMLangConvertCharset
** ppMLangConvertCharset
)
2003 static const IMultiLanguageVtbl IMultiLanguage_vtbl
=
2005 fnIMultiLanguage_QueryInterface
,
2006 fnIMultiLanguage_AddRef
,
2007 fnIMultiLanguage_Release
,
2008 fnIMultiLanguage_GetNumberOfCodePageInfo
,
2009 fnIMultiLanguage_GetCodePageInfo
,
2010 fnIMultiLanguage_GetFamilyCodePage
,
2011 fnIMultiLanguage_EnumCodePages
,
2012 fnIMultiLanguage_GetCharsetInfo
,
2013 fnIMultiLanguage_IsConvertible
,
2014 fnIMultiLanguage_ConvertString
,
2015 fnIMultiLanguage_ConvertStringToUnicode
,
2016 fnIMultiLanguage_ConvertStringFromUnicode
,
2017 fnIMultiLanguage_ConvertStringReset
,
2018 fnIMultiLanguage_GetRfc1766FromLcid
,
2019 fnIMultiLanguage_GetLcidFromRfc1766
,
2020 fnIMultiLanguage_EnumRfc1766
,
2021 fnIMultiLanguage_GetRfc1766Info
,
2022 fnIMultiLanguage_CreateConvertCharset
,
2026 /******************************************************************************/
2028 static HRESULT WINAPI
fnIMultiLanguage2_QueryInterface(
2029 IMultiLanguage3
* iface
,
2033 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2034 return MLang_QueryInterface( This
, riid
, ppvObject
);
2037 static ULONG WINAPI
fnIMultiLanguage2_AddRef( IMultiLanguage3
* iface
)
2039 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2040 return MLang_AddRef( This
);
2043 static ULONG WINAPI
fnIMultiLanguage2_Release( IMultiLanguage3
* iface
)
2045 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2046 return MLang_Release( This
);
2049 static HRESULT WINAPI
fnIMultiLanguage2_GetNumberOfCodePageInfo(
2050 IMultiLanguage3
* iface
,
2053 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2054 TRACE("%p, %p\n", This
, pcCodePage
);
2056 if (!pcCodePage
) return S_FALSE
;
2058 *pcCodePage
= This
->total_cp
;
2062 static void fill_cp_info(const struct mlang_data
*ml_data
, UINT index
, MIMECPINFO
*mime_cp_info
)
2066 if (TranslateCharsetInfo((DWORD
*)ml_data
->family_codepage
, &csi
, TCI_SRCCODEPAGE
))
2067 mime_cp_info
->bGDICharset
= csi
.ciCharset
;
2069 mime_cp_info
->bGDICharset
= DEFAULT_CHARSET
;
2071 mime_cp_info
->dwFlags
= ml_data
->mime_cp_info
[index
].flags
;
2072 mime_cp_info
->uiCodePage
= ml_data
->mime_cp_info
[index
].cp
;
2073 mime_cp_info
->uiFamilyCodePage
= ml_data
->family_codepage
;
2074 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].description
, -1,
2075 mime_cp_info
->wszDescription
, sizeof(mime_cp_info
->wszDescription
)/sizeof(WCHAR
));
2076 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].web_charset
, -1,
2077 mime_cp_info
->wszWebCharset
, sizeof(mime_cp_info
->wszWebCharset
)/sizeof(WCHAR
));
2078 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].header_charset
, -1,
2079 mime_cp_info
->wszHeaderCharset
, sizeof(mime_cp_info
->wszHeaderCharset
)/sizeof(WCHAR
));
2080 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].body_charset
, -1,
2081 mime_cp_info
->wszBodyCharset
, sizeof(mime_cp_info
->wszBodyCharset
)/sizeof(WCHAR
));
2083 MultiByteToWideChar(CP_ACP
, 0, ml_data
->fixed_font
, -1,
2084 mime_cp_info
->wszFixedWidthFont
, sizeof(mime_cp_info
->wszFixedWidthFont
)/sizeof(WCHAR
));
2085 MultiByteToWideChar(CP_ACP
, 0, ml_data
->proportional_font
, -1,
2086 mime_cp_info
->wszProportionalFont
, sizeof(mime_cp_info
->wszProportionalFont
)/sizeof(WCHAR
));
2088 TRACE("%08x %u %u %s %s %s %s %s %s %d\n",
2089 mime_cp_info
->dwFlags
, mime_cp_info
->uiCodePage
,
2090 mime_cp_info
->uiFamilyCodePage
,
2091 wine_dbgstr_w(mime_cp_info
->wszDescription
),
2092 wine_dbgstr_w(mime_cp_info
->wszWebCharset
),
2093 wine_dbgstr_w(mime_cp_info
->wszHeaderCharset
),
2094 wine_dbgstr_w(mime_cp_info
->wszBodyCharset
),
2095 wine_dbgstr_w(mime_cp_info
->wszFixedWidthFont
),
2096 wine_dbgstr_w(mime_cp_info
->wszProportionalFont
),
2097 mime_cp_info
->bGDICharset
);
2100 static HRESULT WINAPI
fnIMultiLanguage2_GetCodePageInfo(
2101 IMultiLanguage3
* iface
,
2104 PMIMECPINFO pCodePageInfo
)
2108 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2109 TRACE("%p, %u, %04x, %p\n", This
, uiCodePage
, LangId
, pCodePageInfo
);
2111 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2113 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2115 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
2117 fill_cp_info(&mlang_data
[i
], n
, pCodePageInfo
);
2126 static HRESULT WINAPI
fnIMultiLanguage2_GetFamilyCodePage(
2127 IMultiLanguage3
* iface
,
2129 UINT
* puiFamilyCodePage
)
2131 return GetFamilyCodePage(uiCodePage
, puiFamilyCodePage
);
2134 static HRESULT WINAPI
fnIMultiLanguage2_EnumCodePages(
2135 IMultiLanguage3
* iface
,
2138 IEnumCodePage
** ppEnumCodePage
)
2140 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2141 TRACE("%p %08x %04x %p\n", This
, grfFlags
, LangId
, ppEnumCodePage
);
2143 return EnumCodePage_create( This
, grfFlags
, LangId
, ppEnumCodePage
);
2146 static HRESULT WINAPI
fnIMultiLanguage2_GetCharsetInfo(
2147 IMultiLanguage3
* iface
,
2149 PMIMECSETINFO pCharsetInfo
)
2153 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2154 TRACE("%p %s %p\n", This
, debugstr_w(Charset
), pCharsetInfo
);
2156 if (!pCharsetInfo
) return E_FAIL
;
2158 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2160 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2162 WCHAR csetW
[MAX_MIMECSET_NAME
];
2164 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].mime_cp_info
[n
].web_charset
, -1, csetW
, MAX_MIMECSET_NAME
);
2165 if (!lstrcmpiW(Charset
, csetW
))
2167 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2168 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2169 strcpyW(pCharsetInfo
->wszCharset
, csetW
);
2176 * Since we do not support charsets like iso-2022-jp and do not have
2177 * them in our database as a primary (web_charset) encoding this loop
2178 * does an attempt to 'approximate' charset name by header_charset.
2180 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2182 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2184 WCHAR csetW
[MAX_MIMECSET_NAME
];
2186 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].mime_cp_info
[n
].header_charset
, -1, csetW
, MAX_MIMECSET_NAME
);
2187 if (!lstrcmpiW(Charset
, csetW
))
2189 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2190 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2191 strcpyW(pCharsetInfo
->wszCharset
, csetW
);
2200 static HRESULT WINAPI
fnIMultiLanguage2_IsConvertible(
2201 IMultiLanguage3
* iface
,
2202 DWORD dwSrcEncoding
,
2203 DWORD dwDstEncoding
)
2205 return IsConvertINetStringAvailable(dwSrcEncoding
, dwDstEncoding
);
2208 static HRESULT WINAPI
fnIMultiLanguage2_ConvertString(
2209 IMultiLanguage3
* iface
,
2211 DWORD dwSrcEncoding
,
2212 DWORD dwDstEncoding
,
2218 return ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
,
2219 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, (LPSTR
)pDstStr
, (LPINT
)pcDstSize
);
2222 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringToUnicode(
2223 IMultiLanguage3
* iface
,
2231 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
2232 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2235 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringFromUnicode(
2236 IMultiLanguage3
* iface
,
2244 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
2245 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2248 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringReset(
2249 IMultiLanguage3
* iface
)
2255 static HRESULT WINAPI
fnIMultiLanguage2_GetRfc1766FromLcid(
2256 IMultiLanguage3
* iface
,
2260 WCHAR buf
[MAX_RFC1766_NAME
];
2262 TRACE("%p %04x %p\n", iface
, lcid
, pbstrRfc1766
);
2264 if (lcid_to_rfc1766W( lcid
, buf
, MAX_RFC1766_NAME
))
2266 *pbstrRfc1766
= SysAllocString( buf
);
2272 static HRESULT WINAPI
fnIMultiLanguage2_GetLcidFromRfc1766(
2273 IMultiLanguage3
* iface
,
2278 IEnumRfc1766
*rfc1766
;
2280 TRACE("%p %p %s\n", iface
, pLocale
, debugstr_w(bstrRfc1766
));
2282 if (!pLocale
|| !bstrRfc1766
)
2283 return E_INVALIDARG
;
2285 hr
= IMultiLanguage2_EnumRfc1766(iface
, 0, &rfc1766
);
2289 hr
= lcid_from_rfc1766(rfc1766
, pLocale
, bstrRfc1766
);
2291 IEnumRfc1766_Release(rfc1766
);
2295 static HRESULT WINAPI
fnIMultiLanguage2_EnumRfc1766(
2296 IMultiLanguage3
* iface
,
2298 IEnumRfc1766
** ppEnumRfc1766
)
2300 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
2301 TRACE("%p %p\n", This
, ppEnumRfc1766
);
2303 return EnumRfc1766_create(LangId
, ppEnumRfc1766
);
2306 static HRESULT WINAPI
fnIMultiLanguage2_GetRfc1766Info(
2307 IMultiLanguage3
* iface
,
2310 PRFC1766INFO pRfc1766Info
)
2316 static HRESULT WINAPI
fnIMultiLanguage2_CreateConvertCharset(
2317 IMultiLanguage3
* iface
,
2321 IMLangConvertCharset
** ppMLangConvertCharset
)
2327 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringInIStream(
2328 IMultiLanguage3
* iface
,
2332 DWORD dwSrcEncoding
,
2333 DWORD dwDstEncoding
,
2342 * TODO: handle dwFlag and lpFallBack
2344 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringToUnicodeEx(
2345 IMultiLanguage3
* iface
,
2356 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
2357 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2360 /*****************************************************************************
2361 * MultiLanguage2::ConvertStringToUnicodeEx
2363 * Translates the multibyte string from the specified code page to Unicode.
2366 * see ConvertStringToUnicode
2368 * lpFallBack if dwFlag contains MLCONVCHARF_USEDEFCHAR, lpFallBack string used
2369 * instead unconvertible characters.
2373 * S_FALSE The conversion is not supported.
2374 * E_FAIL Some error has occurred.
2376 * TODO: handle dwFlag and lpFallBack
2378 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringFromUnicodeEx(
2379 IMultiLanguage3
* This
,
2390 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
2391 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2394 static HRESULT WINAPI
fnIMultiLanguage2_DetectCodepageInIStream(
2395 IMultiLanguage3
* iface
,
2397 DWORD dwPrefWinCodePage
,
2399 DetectEncodingInfo
* lpEncoding
,
2406 static HRESULT WINAPI
fnIMultiLanguage2_DetectInputCodepage(
2407 IMultiLanguage3
* iface
,
2409 DWORD dwPrefWinCodePage
,
2412 DetectEncodingInfo
* lpEncoding
,
2419 static HRESULT WINAPI
fnIMultiLanguage2_ValidateCodePage(
2420 IMultiLanguage3
* iface
,
2424 FIXME("%u, %p\n", uiCodePage
, hwnd
);
2428 static HRESULT WINAPI
fnIMultiLanguage2_GetCodePageDescription(
2429 IMultiLanguage3
* iface
,
2432 LPWSTR lpWideCharStr
,
2435 /* Find first instance */
2438 TRACE ("%u, %04x, %p, %d\n", uiCodePage
, lcid
, lpWideCharStr
, cchWideChar
);
2439 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2441 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2443 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
2445 MultiByteToWideChar(CP_ACP
, 0,
2446 mlang_data
[i
].mime_cp_info
[n
].description
,
2447 -1, lpWideCharStr
, cchWideChar
);
2456 static HRESULT WINAPI
fnIMultiLanguage2_IsCodePageInstallable(
2457 IMultiLanguage3
* iface
,
2460 FIXME("%u\n", uiCodePage
);
2464 static HRESULT WINAPI
fnIMultiLanguage2_SetMimeDBSource(
2465 IMultiLanguage3
* iface
,
2468 FIXME("0x%08x\n", dwSource
);
2472 static HRESULT WINAPI
fnIMultiLanguage2_GetNumberOfScripts(
2473 IMultiLanguage3
* iface
,
2476 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2477 TRACE("%p %p\n", This
, pnScripts
);
2479 if (!pnScripts
) return S_FALSE
;
2481 *pnScripts
= This
->total_scripts
;
2485 static HRESULT WINAPI
fnIMultiLanguage2_EnumScripts(
2486 IMultiLanguage3
* iface
,
2489 IEnumScript
** ppEnumScript
)
2491 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2492 TRACE("%p %08x %04x %p\n", This
, dwFlags
, LangId
, ppEnumScript
);
2494 return EnumScript_create( This
, dwFlags
, LangId
, ppEnumScript
);
2497 static HRESULT WINAPI
fnIMultiLanguage2_ValidateCodePageEx(
2498 IMultiLanguage3
* iface
,
2501 DWORD dwfIODControl
)
2503 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2504 FIXME("%p %u %p %08x: stub!\n", This
, uiCodePage
, hwnd
, dwfIODControl
);
2509 static HRESULT WINAPI
fnIMultiLanguage3_DetectOutboundCodePage(
2510 IMultiLanguage3
*iface
,
2512 LPCWSTR lpWideCharStr
,
2514 UINT
*puiPreferredCodePages
,
2515 UINT nPreferredCodePages
,
2516 UINT
*puiDetectedCodePages
,
2517 UINT
*pnDetectedCodePages
,
2518 WCHAR
*lpSpecialChar
)
2520 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2521 FIXME("(%p)->(%08x %s %u %p %u %p %p %p)\n", This
, dwFlags
, debugstr_w(lpWideCharStr
),
2522 cchWideChar
, puiPreferredCodePages
, nPreferredCodePages
, puiDetectedCodePages
,
2523 pnDetectedCodePages
, lpSpecialChar
);
2527 static HRESULT WINAPI
fnIMultiLanguage3_DetectOutboundCodePageInIStream(
2528 IMultiLanguage3
*iface
,
2531 UINT
*puiPreferredCodePages
,
2532 UINT nPreferredCodePages
,
2533 UINT
*puiDetectedCodePages
,
2534 UINT
*pnDetectedCodePages
,
2535 WCHAR
*lpSpecialChar
)
2537 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2538 FIXME("(%p)->(%08x %p %p %u %p %p %p)\n", This
, dwFlags
, pStrIn
,
2539 puiPreferredCodePages
, nPreferredCodePages
, puiDetectedCodePages
,
2540 pnDetectedCodePages
, lpSpecialChar
);
2544 static const IMultiLanguage3Vtbl IMultiLanguage3_vtbl
=
2546 fnIMultiLanguage2_QueryInterface
,
2547 fnIMultiLanguage2_AddRef
,
2548 fnIMultiLanguage2_Release
,
2549 fnIMultiLanguage2_GetNumberOfCodePageInfo
,
2550 fnIMultiLanguage2_GetCodePageInfo
,
2551 fnIMultiLanguage2_GetFamilyCodePage
,
2552 fnIMultiLanguage2_EnumCodePages
,
2553 fnIMultiLanguage2_GetCharsetInfo
,
2554 fnIMultiLanguage2_IsConvertible
,
2555 fnIMultiLanguage2_ConvertString
,
2556 fnIMultiLanguage2_ConvertStringToUnicode
,
2557 fnIMultiLanguage2_ConvertStringFromUnicode
,
2558 fnIMultiLanguage2_ConvertStringReset
,
2559 fnIMultiLanguage2_GetRfc1766FromLcid
,
2560 fnIMultiLanguage2_GetLcidFromRfc1766
,
2561 fnIMultiLanguage2_EnumRfc1766
,
2562 fnIMultiLanguage2_GetRfc1766Info
,
2563 fnIMultiLanguage2_CreateConvertCharset
,
2564 fnIMultiLanguage2_ConvertStringInIStream
,
2565 fnIMultiLanguage2_ConvertStringToUnicodeEx
,
2566 fnIMultiLanguage2_ConvertStringFromUnicodeEx
,
2567 fnIMultiLanguage2_DetectCodepageInIStream
,
2568 fnIMultiLanguage2_DetectInputCodepage
,
2569 fnIMultiLanguage2_ValidateCodePage
,
2570 fnIMultiLanguage2_GetCodePageDescription
,
2571 fnIMultiLanguage2_IsCodePageInstallable
,
2572 fnIMultiLanguage2_SetMimeDBSource
,
2573 fnIMultiLanguage2_GetNumberOfScripts
,
2574 fnIMultiLanguage2_EnumScripts
,
2575 fnIMultiLanguage2_ValidateCodePageEx
,
2576 fnIMultiLanguage3_DetectOutboundCodePage
,
2577 fnIMultiLanguage3_DetectOutboundCodePageInIStream
2580 /******************************************************************************/
2581 static HRESULT WINAPI
fnIMLangFontLink2_QueryInterface(
2582 IMLangFontLink2
* iface
,
2586 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink2
, iface
);
2587 return MLang_QueryInterface( This
, riid
, ppvObject
);
2590 static ULONG WINAPI
fnIMLangFontLink2_AddRef( IMLangFontLink2
* iface
)
2592 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink2
, iface
);
2593 return MLang_AddRef( This
);
2596 static ULONG WINAPI
fnIMLangFontLink2_Release( IMLangFontLink2
* iface
)
2598 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink2
, iface
);
2599 return MLang_Release( This
);
2602 static HRESULT WINAPI
fnIMLangFontLink2_GetCharCodePages( IMLangFontLink2
* This
,
2603 WCHAR chSrc
, DWORD
*pdwCodePages
)
2605 FIXME("(%p)->%s %p\n",This
, debugstr_wn(&chSrc
,1),pdwCodePages
);
2609 static HRESULT WINAPI
fnIMLangFontLink2_GetStrCodePages( IMLangFontLink2
* This
,
2610 const WCHAR
*pszSrc
, long cchSrc
, DWORD dwPriorityCodePages
,
2611 DWORD
*pdwCodePages
, long *pcchCodePages
)
2613 FIXME("(%p)->%s %li %x %p %p\n",This
, debugstr_wn(pszSrc
,cchSrc
),cchSrc
,dwPriorityCodePages
,pdwCodePages
,pcchCodePages
);
2617 static HRESULT WINAPI
fnIMLangFontLink2_CodePageToCodePages(IMLangFontLink2
* This
,
2619 DWORD
*pdwCodePages
)
2621 FIXME("(%p)->%i %p\n",This
, uCodePage
, pdwCodePages
);
2625 static HRESULT WINAPI
fnIMLangFontLink2_CodePagesToCodePage(IMLangFontLink2
* This
,
2626 DWORD dwCodePages
, UINT uDefaultCodePage
, UINT
*puCodePage
)
2628 FIXME("(%p)->%i %i %p\n",This
, dwCodePages
, uDefaultCodePage
, puCodePage
);
2632 static HRESULT WINAPI
fnIMLangFontLink2_GetFontCodePages(IMLangFontLink2
* This
,
2633 HDC hDC
, HFONT hFont
, DWORD
*pdwCodePages
)
2635 FIXME("(%p)->%p %p %p\n",This
, hDC
, hFont
, pdwCodePages
);
2639 static HRESULT WINAPI
fnIMLangFontLink2_ReleaseFont(IMLangFontLink2
* This
,
2642 FIXME("(%p)->%p\n",This
, hFont
);
2646 static HRESULT WINAPI
fnIMLangFontLink2_ResetFontMapping(IMLangFontLink2
* This
)
2648 FIXME("(%p)->\n",This
);
2652 static HRESULT WINAPI
fnIMLangFontLink2_MapFont(IMLangFontLink2
* This
,
2653 HDC hDC
, DWORD dwCodePages
, WCHAR chSrc
, HFONT
*pFont
)
2655 FIXME("(%p)->%p %i %s %p\n",This
, hDC
, dwCodePages
, debugstr_wn(&chSrc
,1), pFont
);
2659 static HRESULT WINAPI
fnIMLangFontLink2_GetFontUnicodeRanges(IMLangFontLink2
* This
,
2660 HDC hDC
, UINT
*puiRanges
, UNICODERANGE
*pUranges
)
2662 FIXME("(%p)->%p %p %p\n",This
, hDC
, puiRanges
, pUranges
);
2666 static HRESULT WINAPI
fnIMLangFontLink2_GetScriptFontInfo(IMLangFontLink2
* This
,
2667 SCRIPT_ID sid
, DWORD dwFlags
, UINT
*puiFonts
,
2668 SCRIPTFONTINFO
*pScriptFont
)
2670 FIXME("(%p)->%i %i %p %p\n",This
, sid
, dwFlags
, puiFonts
, pScriptFont
);
2674 static HRESULT WINAPI
fnIMLangFontLink2_CodePageToScriptID(IMLangFontLink2
* This
,
2675 UINT uiCodePage
, SCRIPT_ID
*pSid
)
2677 FIXME("(%p)->%i %p\n",This
, uiCodePage
, pSid
);
2681 static const IMLangFontLink2Vtbl IMLangFontLink2_vtbl
=
2683 fnIMLangFontLink2_QueryInterface
,
2684 fnIMLangFontLink2_AddRef
,
2685 fnIMLangFontLink2_Release
,
2686 fnIMLangFontLink2_GetCharCodePages
,
2687 fnIMLangFontLink2_GetStrCodePages
,
2688 fnIMLangFontLink2_CodePageToCodePages
,
2689 fnIMLangFontLink2_CodePagesToCodePage
,
2690 fnIMLangFontLink2_GetFontCodePages
,
2691 fnIMLangFontLink2_ReleaseFont
,
2692 fnIMLangFontLink2_ResetFontMapping
,
2693 fnIMLangFontLink2_MapFont
,
2694 fnIMLangFontLink2_GetFontUnicodeRanges
,
2695 fnIMLangFontLink2_GetScriptFontInfo
,
2696 fnIMLangFontLink2_CodePageToScriptID
2700 static HRESULT
MultiLanguage_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
2705 TRACE("Creating MultiLanguage object\n");
2708 return CLASS_E_NOAGGREGATION
;
2710 mlang
= HeapAlloc( GetProcessHeap(), 0, sizeof (MLang_impl
) );
2711 mlang
->vtbl_IMLangFontLink
= &IMLangFontLink_vtbl
;
2712 mlang
->vtbl_IMultiLanguage
= &IMultiLanguage_vtbl
;
2713 mlang
->vtbl_IMultiLanguage3
= &IMultiLanguage3_vtbl
;
2714 mlang
->vtbl_IMLangFontLink2
= &IMLangFontLink2_vtbl
;
2716 mlang
->total_cp
= 0;
2717 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2718 mlang
->total_cp
+= mlang_data
[i
].number_of_cp
;
2720 /* do not enumerate unicode flavours */
2721 mlang
->total_scripts
= sizeof(mlang_data
)/sizeof(mlang_data
[0]) - 1;
2724 *ppObj
= (LPVOID
) mlang
;
2725 TRACE("returning %p\n", mlang
);
2732 /******************************************************************************/
2734 HRESULT WINAPI
DllCanUnloadNow(void)
2736 return dll_count
== 0 ? S_OK
: S_FALSE
;
2739 HRESULT WINAPI
GetGlobalFontLinkObject(void)