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
;
570 if (*pcSrcSize
== -1)
571 *pcSrcSize
= lstrlenW(pSrcStr
);
572 *pcDstSize
= min(*pcSrcSize
* sizeof(WCHAR
), *pcDstSize
);
574 memmove(pDstStr
, pSrcStr
, *pcDstSize
);
578 if (*pcSrcSize
== -1)
579 *pcSrcSize
= lstrlenW(pSrcStr
);
582 *pcDstSize
= WideCharToMultiByte(dwEncoding
, 0, pSrcStr
, *pcSrcSize
, pDstStr
, *pcDstSize
, NULL
, NULL
);
584 *pcDstSize
= WideCharToMultiByte(dwEncoding
, 0, pSrcStr
, *pcSrcSize
, NULL
, 0, NULL
, NULL
);
595 HRESULT WINAPI
ConvertINetString(
605 TRACE("%p %d %d %s %p %p %p\n", pdwMode
, dwSrcEncoding
, dwDstEncoding
,
606 debugstr_a(pSrcStr
), pcSrcSize
, pDstStr
, pcDstSize
);
608 if (dwSrcEncoding
== CP_UNICODE
)
611 if (pcSrcSize
&& *pcSrcSize
!= -1)
613 cSrcSizeW
= *pcSrcSize
/ sizeof(WCHAR
);
614 pcSrcSize
= &cSrcSizeW
;
616 return ConvertINetUnicodeToMultiByte(pdwMode
, dwDstEncoding
, (LPCWSTR
)pSrcStr
, pcSrcSize
, pDstStr
, pcDstSize
);
618 else if (dwDstEncoding
== CP_UNICODE
)
620 HRESULT hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, (LPWSTR
)pDstStr
, pcDstSize
);
621 *pcDstSize
*= sizeof(WCHAR
);
630 TRACE("convert %s from %d to %d\n", debugstr_a(pSrcStr
), dwSrcEncoding
, dwDstEncoding
);
632 hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, NULL
, &cDstSizeW
);
636 pDstStrW
= HeapAlloc(GetProcessHeap(), 0, cDstSizeW
* sizeof(WCHAR
));
637 hr
= ConvertINetMultiByteToUnicode(pdwMode
, dwSrcEncoding
, pSrcStr
, pcSrcSize
, pDstStrW
, &cDstSizeW
);
639 hr
= ConvertINetUnicodeToMultiByte(pdwMode
, dwDstEncoding
, pDstStrW
, &cDstSizeW
, pDstStr
, pcDstSize
);
641 HeapFree(GetProcessHeap(), 0, pDstStrW
);
646 static HRESULT
GetFamilyCodePage(
648 UINT
* puiFamilyCodePage
)
652 TRACE("%u %p\n", uiCodePage
, puiFamilyCodePage
);
654 if (!puiFamilyCodePage
) return S_FALSE
;
656 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
658 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
660 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
662 *puiFamilyCodePage
= mlang_data
[i
].family_codepage
;
671 HRESULT WINAPI
IsConvertINetStringAvailable(
675 UINT src_family
, dst_family
;
677 TRACE("%d %d\n", dwSrcEncoding
, dwDstEncoding
);
679 if (GetFamilyCodePage(dwSrcEncoding
, &src_family
) != S_OK
||
680 GetFamilyCodePage(dwDstEncoding
, &dst_family
) != S_OK
)
683 if (src_family
== dst_family
) return S_OK
;
685 /* we can convert any codepage to/from unicode */
686 if (src_family
== CP_UNICODE
|| dst_family
== CP_UNICODE
) return S_OK
;
691 static inline INT
lcid_to_rfc1766A( LCID lcid
, LPSTR rfc1766
, INT len
)
693 INT n
= GetLocaleInfoA( lcid
, LOCALE_SISO639LANGNAME
, rfc1766
, len
);
696 rfc1766
[n
- 1] = '-';
697 n
+= GetLocaleInfoA( lcid
, LOCALE_SISO3166CTRYNAME
, rfc1766
+ n
, len
- n
);
698 LCMapStringA( LOCALE_USER_DEFAULT
, LCMAP_LOWERCASE
, rfc1766
, n
, rfc1766
, len
);
704 static inline INT
lcid_to_rfc1766W( LCID lcid
, LPWSTR rfc1766
, INT len
)
706 INT n
= GetLocaleInfoW( lcid
, LOCALE_SISO639LANGNAME
, rfc1766
, len
);
709 rfc1766
[n
- 1] = '-';
710 n
+= GetLocaleInfoW( lcid
, LOCALE_SISO3166CTRYNAME
, rfc1766
+ n
, len
- n
);
711 LCMapStringW( LOCALE_USER_DEFAULT
, LCMAP_LOWERCASE
, rfc1766
, n
, rfc1766
, len
);
717 HRESULT WINAPI
LcidToRfc1766A(
722 TRACE("%04x %p %u\n", lcid
, pszRfc1766
, nChar
);
724 if (lcid_to_rfc1766A( lcid
, pszRfc1766
, nChar
))
730 HRESULT WINAPI
LcidToRfc1766W(
735 TRACE("%04x %p %u\n", lcid
, pszRfc1766
, nChar
);
737 if (lcid_to_rfc1766W( lcid
, pszRfc1766
, nChar
))
743 static HRESULT
lcid_from_rfc1766(IEnumRfc1766
*iface
, LCID
*lcid
, LPCWSTR rfc1766
)
748 while (IEnumRfc1766_Next(iface
, 1, &info
, &num
) == S_OK
)
750 if (!strcmpW(info
.wszRfc1766
, rfc1766
))
755 if (strlenW(rfc1766
) == 2 && !memcmp(info
.wszRfc1766
, rfc1766
, 2 * sizeof(WCHAR
)))
757 *lcid
= PRIMARYLANGID(info
.lcid
);
765 HRESULT WINAPI
Rfc1766ToLcidW(LCID
*pLocale
, LPCWSTR pszRfc1766
)
767 IEnumRfc1766
*enumrfc1766
;
770 TRACE("(%p, %s)\n", pLocale
, debugstr_w(pszRfc1766
));
772 if (!pLocale
|| !pszRfc1766
)
777 hr
= EnumRfc1766_create(0, &enumrfc1766
);
781 hr
= lcid_from_rfc1766(enumrfc1766
, pLocale
, pszRfc1766
);
782 IEnumRfc1766_Release(enumrfc1766
);
787 HRESULT WINAPI
Rfc1766ToLcidA(LCID
*lcid
, LPCSTR rfc1766A
)
789 WCHAR rfc1766W
[MAX_RFC1766_NAME
+ 1];
791 MultiByteToWideChar(CP_ACP
, 0, rfc1766A
, -1, rfc1766W
, MAX_RFC1766_NAME
);
792 rfc1766W
[MAX_RFC1766_NAME
] = 0;
794 return Rfc1766ToLcidW(lcid
, rfc1766W
);
797 /******************************************************************************
801 IClassFactory ITF_IClassFactory
;
804 HRESULT (*pfnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
807 struct object_creation_info
811 HRESULT (*pfnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
814 static const struct object_creation_info object_creation
[] =
816 { &CLSID_CMultiLanguage
, "CLSID_CMultiLanguage", MultiLanguage_create
},
819 static HRESULT WINAPI
820 MLANGCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
822 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
824 TRACE("%s\n", debugstr_guid(riid
) );
826 if (IsEqualGUID(riid
, &IID_IUnknown
)
827 || IsEqualGUID(riid
, &IID_IClassFactory
))
829 IClassFactory_AddRef(iface
);
834 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
835 return E_NOINTERFACE
;
838 static ULONG WINAPI
MLANGCF_AddRef(LPCLASSFACTORY iface
)
840 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
841 return InterlockedIncrement(&This
->ref
);
844 static ULONG WINAPI
MLANGCF_Release(LPCLASSFACTORY iface
)
846 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
848 ULONG ref
= InterlockedDecrement(&This
->ref
);
852 TRACE("Destroying %p\n", This
);
853 HeapFree(GetProcessHeap(), 0, This
);
859 static HRESULT WINAPI
MLANGCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
,
860 REFIID riid
, LPVOID
*ppobj
)
862 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
866 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
869 hres
= This
->pfnCreateInstance(pOuter
, (LPVOID
*) &punk
);
870 if (SUCCEEDED(hres
)) {
871 hres
= IUnknown_QueryInterface(punk
, riid
, ppobj
);
872 IUnknown_Release(punk
);
874 TRACE("returning (%p) -> %x\n", *ppobj
, hres
);
878 static HRESULT WINAPI
MLANGCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
888 static const IClassFactoryVtbl MLANGCF_Vtbl
=
890 MLANGCF_QueryInterface
,
893 MLANGCF_CreateInstance
,
897 /******************************************************************
898 * DllGetClassObject (MLANG.@)
900 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
903 IClassFactoryImpl
*factory
;
905 TRACE("%s %s %p\n",debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
907 if ( !IsEqualGUID( &IID_IClassFactory
, iid
)
908 && ! IsEqualGUID( &IID_IUnknown
, iid
) )
909 return E_NOINTERFACE
;
911 for (i
=0; i
< sizeof(object_creation
)/sizeof(object_creation
[0]); i
++)
913 if (IsEqualGUID(object_creation
[i
].clsid
, rclsid
))
917 if (i
== sizeof(object_creation
)/sizeof(object_creation
[0]))
919 FIXME("%s: no class found.\n", debugstr_guid(rclsid
));
920 return CLASS_E_CLASSNOTAVAILABLE
;
923 TRACE("Creating a class factory for %s\n",object_creation
[i
].szClassName
);
925 factory
= HeapAlloc(GetProcessHeap(), 0, sizeof(*factory
));
926 if (factory
== NULL
) return E_OUTOFMEMORY
;
928 factory
->ITF_IClassFactory
.lpVtbl
= &MLANGCF_Vtbl
;
931 factory
->pfnCreateInstance
= object_creation
[i
].pfnCreateInstance
;
933 *ppv
= &(factory
->ITF_IClassFactory
);
935 TRACE("(%p) <- %p\n", ppv
, &(factory
->ITF_IClassFactory
) );
941 /******************************************************************************/
943 typedef struct tagMLang_impl
945 const IMLangFontLinkVtbl
*vtbl_IMLangFontLink
;
946 const IMultiLanguageVtbl
*vtbl_IMultiLanguage
;
947 const IMultiLanguage3Vtbl
*vtbl_IMultiLanguage3
;
949 DWORD total_cp
, total_scripts
;
952 static ULONG WINAPI
MLang_AddRef( MLang_impl
* This
)
954 return InterlockedIncrement(&This
->ref
);
957 static ULONG WINAPI
MLang_Release( MLang_impl
* This
)
959 ULONG ref
= InterlockedDecrement(&This
->ref
);
961 TRACE("%p ref = %d\n", This
, ref
);
964 TRACE("Destroying %p\n", This
);
965 HeapFree(GetProcessHeap(), 0, This
);
972 static HRESULT WINAPI
MLang_QueryInterface(
977 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
979 if (IsEqualGUID(riid
, &IID_IUnknown
)
980 || IsEqualGUID(riid
, &IID_IMLangCodePages
)
981 || IsEqualGUID(riid
, &IID_IMLangFontLink
))
984 TRACE("Returning IID_IMLangFontLink %p ref = %d\n", This
, This
->ref
);
985 *ppvObject
= &(This
->vtbl_IMLangFontLink
);
989 if (IsEqualGUID(riid
, &IID_IMultiLanguage
) )
992 TRACE("Returning IID_IMultiLanguage %p ref = %d\n", This
, This
->ref
);
993 *ppvObject
= &(This
->vtbl_IMultiLanguage
);
997 if (IsEqualGUID(riid
, &IID_IMultiLanguage2
) )
1000 *ppvObject
= &(This
->vtbl_IMultiLanguage3
);
1001 TRACE("Returning IID_IMultiLanguage2 %p ref = %d\n", This
, This
->ref
);
1005 if (IsEqualGUID(riid
, &IID_IMultiLanguage3
) )
1008 *ppvObject
= &(This
->vtbl_IMultiLanguage3
);
1009 TRACE("Returning IID_IMultiLanguage3 %p ref = %d\n", This
, This
->ref
);
1013 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1014 return E_NOINTERFACE
;
1017 /******************************************************************************/
1019 typedef struct tagEnumCodePage_impl
1021 const IEnumCodePageVtbl
*vtbl_IEnumCodePage
;
1025 } EnumCodePage_impl
;
1027 static HRESULT WINAPI
fnIEnumCodePage_QueryInterface(
1028 IEnumCodePage
* iface
,
1032 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1034 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1036 if (IsEqualGUID(riid
, &IID_IUnknown
)
1037 || IsEqualGUID(riid
, &IID_IEnumCodePage
))
1039 IEnumCodePage_AddRef(iface
);
1040 TRACE("Returning IID_IEnumCodePage %p ref = %d\n", This
, This
->ref
);
1041 *ppvObject
= &(This
->vtbl_IEnumCodePage
);
1045 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1046 return E_NOINTERFACE
;
1049 static ULONG WINAPI
fnIEnumCodePage_AddRef(
1050 IEnumCodePage
* iface
)
1052 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1053 return InterlockedIncrement(&This
->ref
);
1056 static ULONG WINAPI
fnIEnumCodePage_Release(
1057 IEnumCodePage
* iface
)
1059 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1060 ULONG ref
= InterlockedDecrement(&This
->ref
);
1062 TRACE("%p ref = %d\n", This
, ref
);
1065 TRACE("Destroying %p\n", This
);
1066 HeapFree(GetProcessHeap(), 0, This
->cpinfo
);
1067 HeapFree(GetProcessHeap(), 0, This
);
1073 static HRESULT WINAPI
fnIEnumCodePage_Clone(
1074 IEnumCodePage
* iface
,
1075 IEnumCodePage
** ppEnum
)
1077 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1078 FIXME("%p %p\n", This
, ppEnum
);
1082 static HRESULT WINAPI
fnIEnumCodePage_Next(
1083 IEnumCodePage
* iface
,
1086 ULONG
* pceltFetched
)
1090 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1091 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1093 if (!pceltFetched
) return S_FALSE
;
1096 if (!rgelt
) return S_FALSE
;
1098 if (This
->pos
+ celt
> This
->total
)
1099 celt
= This
->total
- This
->pos
;
1101 if (!celt
) return S_FALSE
;
1103 memcpy(rgelt
, This
->cpinfo
+ This
->pos
, celt
* sizeof(MIMECPINFO
));
1104 *pceltFetched
= celt
;
1107 for (i
= 0; i
< celt
; i
++)
1109 TRACE("#%u: %08x %u %u %s %s %s %s %s %s %d\n",
1110 i
, rgelt
[i
].dwFlags
, rgelt
[i
].uiCodePage
,
1111 rgelt
[i
].uiFamilyCodePage
,
1112 wine_dbgstr_w(rgelt
[i
].wszDescription
),
1113 wine_dbgstr_w(rgelt
[i
].wszWebCharset
),
1114 wine_dbgstr_w(rgelt
[i
].wszHeaderCharset
),
1115 wine_dbgstr_w(rgelt
[i
].wszBodyCharset
),
1116 wine_dbgstr_w(rgelt
[i
].wszFixedWidthFont
),
1117 wine_dbgstr_w(rgelt
[i
].wszProportionalFont
),
1118 rgelt
[i
].bGDICharset
);
1123 static HRESULT WINAPI
fnIEnumCodePage_Reset(
1124 IEnumCodePage
* iface
)
1126 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1127 TRACE("%p\n", This
);
1133 static HRESULT WINAPI
fnIEnumCodePage_Skip(
1134 IEnumCodePage
* iface
,
1137 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1138 TRACE("%p %u\n", This
, celt
);
1140 if (celt
>= This
->total
) return S_FALSE
;
1146 static const IEnumCodePageVtbl IEnumCodePage_vtbl
=
1148 fnIEnumCodePage_QueryInterface
,
1149 fnIEnumCodePage_AddRef
,
1150 fnIEnumCodePage_Release
,
1151 fnIEnumCodePage_Clone
,
1152 fnIEnumCodePage_Next
,
1153 fnIEnumCodePage_Reset
,
1154 fnIEnumCodePage_Skip
1157 static HRESULT
EnumCodePage_create( MLang_impl
* mlang
, DWORD grfFlags
,
1158 LANGID LangId
, IEnumCodePage
** ppEnumCodePage
)
1160 EnumCodePage_impl
*ecp
;
1164 TRACE("%p, %08x, %04x, %p\n", mlang
, grfFlags
, LangId
, ppEnumCodePage
);
1166 if (!grfFlags
) /* enumerate internal data base of encodings */
1167 grfFlags
= MIMECONTF_MIME_LATEST
;
1169 ecp
= HeapAlloc( GetProcessHeap(), 0, sizeof (EnumCodePage_impl
) );
1170 ecp
->vtbl_IEnumCodePage
= &IEnumCodePage_vtbl
;
1174 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1176 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1178 if (mlang_data
[i
].mime_cp_info
[n
].flags
& grfFlags
)
1183 ecp
->cpinfo
= HeapAlloc(GetProcessHeap(), 0,
1184 sizeof(MIMECPINFO
) * ecp
->total
);
1185 cpinfo
= ecp
->cpinfo
;
1187 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1189 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1191 if (mlang_data
[i
].mime_cp_info
[n
].flags
& grfFlags
)
1192 fill_cp_info(&mlang_data
[i
], n
, cpinfo
++);
1196 TRACE("enumerated %d codepages with flags %08x\n", ecp
->total
, grfFlags
);
1198 *ppEnumCodePage
= (IEnumCodePage
*) ecp
;
1203 /******************************************************************************/
1205 typedef struct tagEnumScript_impl
1207 const IEnumScriptVtbl
*vtbl_IEnumScript
;
1209 SCRIPTINFO
*script_info
;
1213 static HRESULT WINAPI
fnIEnumScript_QueryInterface(
1218 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1220 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1222 if (IsEqualGUID(riid
, &IID_IUnknown
)
1223 || IsEqualGUID(riid
, &IID_IEnumScript
))
1225 IEnumScript_AddRef(iface
);
1226 TRACE("Returning IID_IEnumScript %p ref = %d\n", This
, This
->ref
);
1227 *ppvObject
= &(This
->vtbl_IEnumScript
);
1231 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1232 return E_NOINTERFACE
;
1235 static ULONG WINAPI
fnIEnumScript_AddRef(
1238 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1239 return InterlockedIncrement(&This
->ref
);
1242 static ULONG WINAPI
fnIEnumScript_Release(
1245 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1246 ULONG ref
= InterlockedDecrement(&This
->ref
);
1248 TRACE("%p ref = %d\n", This
, ref
);
1251 TRACE("Destroying %p\n", This
);
1252 HeapFree(GetProcessHeap(), 0, This
->script_info
);
1253 HeapFree(GetProcessHeap(), 0, This
);
1259 static HRESULT WINAPI
fnIEnumScript_Clone(
1261 IEnumScript
** ppEnum
)
1263 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1264 FIXME("%p %p: stub!\n", This
, ppEnum
);
1268 static HRESULT WINAPI
fnIEnumScript_Next(
1272 ULONG
* pceltFetched
)
1274 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1275 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1277 if (!pceltFetched
|| !rgelt
) return E_FAIL
;
1281 if (This
->pos
+ celt
> This
->total
)
1282 celt
= This
->total
- This
->pos
;
1284 if (!celt
) return S_FALSE
;
1286 memcpy(rgelt
, This
->script_info
+ This
->pos
, celt
* sizeof(SCRIPTINFO
));
1287 *pceltFetched
= celt
;
1293 static HRESULT WINAPI
fnIEnumScript_Reset(
1296 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1297 TRACE("%p\n", This
);
1303 static HRESULT WINAPI
fnIEnumScript_Skip(
1307 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1308 TRACE("%p %u\n", This
, celt
);
1310 if (celt
>= This
->total
) return S_FALSE
;
1316 static const IEnumScriptVtbl IEnumScript_vtbl
=
1318 fnIEnumScript_QueryInterface
,
1319 fnIEnumScript_AddRef
,
1320 fnIEnumScript_Release
,
1321 fnIEnumScript_Clone
,
1323 fnIEnumScript_Reset
,
1327 static HRESULT
EnumScript_create( MLang_impl
* mlang
, DWORD dwFlags
,
1328 LANGID LangId
, IEnumScript
** ppEnumScript
)
1330 EnumScript_impl
*es
;
1333 TRACE("%p, %08x, %04x, %p: stub!\n", mlang
, dwFlags
, LangId
, ppEnumScript
);
1335 if (!dwFlags
) /* enumerate all available scripts */
1336 dwFlags
= SCRIPTCONTF_SCRIPT_USER
| SCRIPTCONTF_SCRIPT_HIDE
| SCRIPTCONTF_SCRIPT_SYSTEM
;
1338 es
= HeapAlloc( GetProcessHeap(), 0, sizeof (EnumScript_impl
) );
1339 es
->vtbl_IEnumScript
= &IEnumScript_vtbl
;
1342 /* do not enumerate unicode flavours */
1343 es
->total
= sizeof(mlang_data
)/sizeof(mlang_data
[0]) - 1;
1344 es
->script_info
= HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPTINFO
) * es
->total
);
1346 for (i
= 0; i
< es
->total
; i
++)
1348 es
->script_info
[i
].ScriptId
= i
;
1349 es
->script_info
[i
].uiCodePage
= mlang_data
[i
].family_codepage
;
1350 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].description
, -1,
1351 es
->script_info
[i
].wszDescription
, MAX_SCRIPT_NAME
);
1352 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].fixed_font
, -1,
1353 es
->script_info
[i
].wszFixedWidthFont
, MAX_MIMEFACE_NAME
);
1354 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].proportional_font
, -1,
1355 es
->script_info
[i
].wszProportionalFont
, MAX_MIMEFACE_NAME
);
1358 TRACE("enumerated %d scripts with flags %08x\n", es
->total
, dwFlags
);
1360 *ppEnumScript
= (IEnumScript
*)es
;
1365 /******************************************************************************/
1367 static HRESULT WINAPI
fnIMLangFontLink_QueryInterface(
1368 IMLangFontLink
* iface
,
1372 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1373 return MLang_QueryInterface( This
, riid
, ppvObject
);
1376 static ULONG WINAPI
fnIMLangFontLink_AddRef(
1377 IMLangFontLink
* iface
)
1379 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1380 return MLang_AddRef( This
);
1383 static ULONG WINAPI
fnIMLangFontLink_Release(
1384 IMLangFontLink
* iface
)
1386 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1387 return MLang_Release( This
);
1390 static HRESULT WINAPI
fnIMLangFontLink_GetCharCodePages(
1391 IMLangFontLink
* iface
,
1393 DWORD
* pdwCodePages
)
1399 static HRESULT WINAPI
fnIMLangFontLink_GetStrCodePages(
1400 IMLangFontLink
* iface
,
1401 const WCHAR
* pszSrc
,
1403 DWORD dwPriorityCodePages
,
1404 DWORD
* pdwCodePages
,
1405 long* pcchCodePages
)
1407 FIXME("(pszSrc=%s, cchSrc=%ld, dwPriorityCodePages=%d) stub\n", debugstr_w(pszSrc
), cchSrc
, dwPriorityCodePages
);
1413 static HRESULT WINAPI
fnIMLangFontLink_CodePageToCodePages(
1414 IMLangFontLink
* iface
,
1416 DWORD
* pdwCodePages
)
1418 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1422 TRACE("(%p) Seeking %u\n",This
, uCodePage
);
1423 memset(&cs
, 0, sizeof(cs
));
1425 rc
= TranslateCharsetInfo((DWORD
*)uCodePage
, &cs
, TCI_SRCCODEPAGE
);
1429 *pdwCodePages
= cs
.fs
.fsCsb
[0];
1430 TRACE("resulting CodePages 0x%x\n",*pdwCodePages
);
1433 TRACE("CodePage Not Found\n");
1438 static HRESULT WINAPI
fnIMLangFontLink_CodePagesToCodePage(
1439 IMLangFontLink
* iface
,
1441 UINT uDefaultCodePage
,
1444 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1445 DWORD mask
= 0x00000000;
1450 TRACE("(%p) scanning 0x%x default page %u\n",This
, dwCodePages
,
1453 *puCodePage
= 0x00000000;
1455 rc
= TranslateCharsetInfo((DWORD
*)uDefaultCodePage
, &cs
, TCI_SRCCODEPAGE
);
1457 if (rc
&& (dwCodePages
& cs
.fs
.fsCsb
[0]))
1459 TRACE("Found Default Codepage\n");
1460 *puCodePage
= uDefaultCodePage
;
1465 for (i
= 0; i
< 32; i
++)
1469 if (dwCodePages
& mask
)
1474 rc
= TranslateCharsetInfo((DWORD
*)Csb
, &cs
, TCI_SRCFONTSIG
);
1478 TRACE("Falling back to least significant found CodePage %u\n",
1480 *puCodePage
= cs
.ciACP
;
1485 TRACE("no codepage found\n");
1489 static HRESULT WINAPI
fnIMLangFontLink_GetFontCodePages(
1490 IMLangFontLink
* iface
,
1493 DWORD
* pdwCodePages
)
1496 FONTSIGNATURE fontsig
;
1497 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1499 TRACE("(%p)\n",This
);
1501 old_font
= SelectObject(hDC
,hFont
);
1502 GetTextCharsetInfo(hDC
,&fontsig
, 0);
1503 SelectObject(hDC
,old_font
);
1505 *pdwCodePages
= fontsig
.fsCsb
[0];
1506 TRACE("CodePages is 0x%x\n",fontsig
.fsCsb
[0]);
1511 static HRESULT WINAPI
fnIMLangFontLink_MapFont(
1512 IMLangFontLink
* iface
,
1522 static HRESULT WINAPI
fnIMLangFontLink_ReleaseFont(
1523 IMLangFontLink
* iface
,
1530 static HRESULT WINAPI
fnIMLangFontLink_ResetFontMapping(
1531 IMLangFontLink
* iface
)
1538 static const IMLangFontLinkVtbl IMLangFontLink_vtbl
=
1540 fnIMLangFontLink_QueryInterface
,
1541 fnIMLangFontLink_AddRef
,
1542 fnIMLangFontLink_Release
,
1543 fnIMLangFontLink_GetCharCodePages
,
1544 fnIMLangFontLink_GetStrCodePages
,
1545 fnIMLangFontLink_CodePageToCodePages
,
1546 fnIMLangFontLink_CodePagesToCodePage
,
1547 fnIMLangFontLink_GetFontCodePages
,
1548 fnIMLangFontLink_MapFont
,
1549 fnIMLangFontLink_ReleaseFont
,
1550 fnIMLangFontLink_ResetFontMapping
,
1553 /******************************************************************************/
1555 static HRESULT WINAPI
fnIMultiLanguage_QueryInterface(
1556 IMultiLanguage
* iface
,
1560 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1561 return MLang_QueryInterface( This
, riid
, ppvObject
);
1564 static ULONG WINAPI
fnIMultiLanguage_AddRef( IMultiLanguage
* iface
)
1566 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1567 return IMLangFontLink_AddRef( ((IMLangFontLink
*)This
) );
1570 static ULONG WINAPI
fnIMultiLanguage_Release( IMultiLanguage
* iface
)
1572 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1573 return IMLangFontLink_Release( ((IMLangFontLink
*)This
) );
1576 static HRESULT WINAPI
fnIMultiLanguage_GetNumberOfCodePageInfo(
1577 IMultiLanguage
* iface
,
1584 static HRESULT WINAPI
fnIMultiLanguage_GetCodePageInfo(
1585 IMultiLanguage
* iface
,
1587 PMIMECPINFO pCodePageInfo
)
1591 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1592 TRACE("%p, %u, %p\n", This
, uiCodePage
, pCodePageInfo
);
1594 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1596 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1598 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
1600 fill_cp_info(&mlang_data
[i
], n
, pCodePageInfo
);
1609 static HRESULT WINAPI
fnIMultiLanguage_GetFamilyCodePage(
1610 IMultiLanguage
* iface
,
1612 UINT
* puiFamilyCodePage
)
1614 return GetFamilyCodePage(uiCodePage
, puiFamilyCodePage
);
1617 static HRESULT WINAPI
fnIMultiLanguage_EnumCodePages(
1618 IMultiLanguage
* iface
,
1620 IEnumCodePage
** ppEnumCodePage
)
1622 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1623 TRACE("%p %08x %p\n", This
, grfFlags
, ppEnumCodePage
);
1625 return EnumCodePage_create( This
, grfFlags
, 0, ppEnumCodePage
);
1628 static HRESULT WINAPI
fnIMultiLanguage_GetCharsetInfo(
1629 IMultiLanguage
* iface
,
1631 PMIMECSETINFO pCharsetInfo
)
1637 static HRESULT WINAPI
fnIMultiLanguage_IsConvertible(
1638 IMultiLanguage
* iface
,
1639 DWORD dwSrcEncoding
,
1640 DWORD dwDstEncoding
)
1642 return IsConvertINetStringAvailable(dwSrcEncoding
, dwDstEncoding
);
1645 static HRESULT WINAPI
fnIMultiLanguage_ConvertString(
1646 IMultiLanguage
* iface
,
1648 DWORD dwSrcEncoding
,
1649 DWORD dwDstEncoding
,
1655 return ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
,
1656 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, (LPSTR
)pDstStr
, (LPINT
)pcDstSize
);
1659 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringToUnicode(
1660 IMultiLanguage
* iface
,
1668 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
1669 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
1672 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringFromUnicode(
1673 IMultiLanguage
* iface
,
1681 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
1682 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
1685 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringReset(
1686 IMultiLanguage
* iface
)
1692 static HRESULT WINAPI
fnIMultiLanguage_GetRfc1766FromLcid(
1693 IMultiLanguage
* iface
,
1697 WCHAR buf
[MAX_RFC1766_NAME
];
1699 TRACE("%p %04x %p\n", iface
, lcid
, pbstrRfc1766
);
1701 if (lcid_to_rfc1766W( lcid
, buf
, MAX_RFC1766_NAME
))
1703 *pbstrRfc1766
= SysAllocString( buf
);
1709 static HRESULT WINAPI
fnIMultiLanguage_GetLcidFromRfc1766(
1710 IMultiLanguage
* iface
,
1715 IEnumRfc1766
*rfc1766
;
1717 TRACE("%p %p %s\n", iface
, pLocale
, debugstr_w(bstrRfc1766
));
1719 if (!pLocale
|| !bstrRfc1766
)
1720 return E_INVALIDARG
;
1722 hr
= IMultiLanguage_EnumRfc1766(iface
, &rfc1766
);
1726 hr
= lcid_from_rfc1766(rfc1766
, pLocale
, bstrRfc1766
);
1728 IEnumRfc1766_Release(rfc1766
);
1732 /******************************************************************************/
1734 typedef struct tagEnumRfc1766_impl
1736 const IEnumRfc1766Vtbl
*vtbl_IEnumRfc1766
;
1742 static HRESULT WINAPI
fnIEnumRfc1766_QueryInterface(
1743 IEnumRfc1766
*iface
,
1747 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1749 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1751 if (IsEqualGUID(riid
, &IID_IUnknown
)
1752 || IsEqualGUID(riid
, &IID_IEnumRfc1766
))
1754 IEnumRfc1766_AddRef(iface
);
1755 TRACE("Returning IID_IEnumRfc1766 %p ref = %d\n", This
, This
->ref
);
1756 *ppvObject
= &(This
->vtbl_IEnumRfc1766
);
1760 WARN("(%p) -> (%s,%p), not found\n",This
,debugstr_guid(riid
),ppvObject
);
1761 return E_NOINTERFACE
;
1764 static ULONG WINAPI
fnIEnumRfc1766_AddRef(
1765 IEnumRfc1766
*iface
)
1767 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1768 return InterlockedIncrement(&This
->ref
);
1771 static ULONG WINAPI
fnIEnumRfc1766_Release(
1772 IEnumRfc1766
*iface
)
1774 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1775 ULONG ref
= InterlockedDecrement(&This
->ref
);
1777 TRACE("%p ref = %d\n", This
, ref
);
1780 TRACE("Destroying %p\n", This
);
1781 HeapFree(GetProcessHeap(), 0, This
->info
);
1782 HeapFree(GetProcessHeap(), 0, This
);
1787 static HRESULT WINAPI
fnIEnumRfc1766_Clone(
1788 IEnumRfc1766
*iface
,
1789 IEnumRfc1766
**ppEnum
)
1791 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1792 FIXME("%p %p\n", This
, ppEnum
);
1796 static HRESULT WINAPI
fnIEnumRfc1766_Next(
1797 IEnumRfc1766
*iface
,
1800 ULONG
*pceltFetched
)
1804 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1805 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1807 if (!pceltFetched
) return S_FALSE
;
1810 if (!rgelt
) return S_FALSE
;
1812 if (This
->pos
+ celt
> This
->total
)
1813 celt
= This
->total
- This
->pos
;
1815 if (!celt
) return S_FALSE
;
1817 memcpy(rgelt
, This
->info
+ This
->pos
, celt
* sizeof(RFC1766INFO
));
1818 *pceltFetched
= celt
;
1821 for (i
= 0; i
< celt
; i
++)
1823 TRACE("#%u: %08x %s %s\n",
1825 wine_dbgstr_w(rgelt
[i
].wszRfc1766
),
1826 wine_dbgstr_w(rgelt
[i
].wszLocaleName
));
1831 static HRESULT WINAPI
fnIEnumRfc1766_Reset(
1832 IEnumRfc1766
*iface
)
1834 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1835 TRACE("%p\n", This
);
1841 static HRESULT WINAPI
fnIEnumRfc1766_Skip(
1842 IEnumRfc1766
*iface
,
1845 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1846 TRACE("%p %u\n", This
, celt
);
1848 if (celt
>= This
->total
) return S_FALSE
;
1854 static const IEnumRfc1766Vtbl IEnumRfc1766_vtbl
=
1856 fnIEnumRfc1766_QueryInterface
,
1857 fnIEnumRfc1766_AddRef
,
1858 fnIEnumRfc1766_Release
,
1859 fnIEnumRfc1766_Clone
,
1860 fnIEnumRfc1766_Next
,
1861 fnIEnumRfc1766_Reset
,
1865 struct enum_locales_data
1868 DWORD total
, allocated
;
1871 static BOOL CALLBACK
enum_locales_proc(LPWSTR locale
)
1874 struct enum_locales_data
*data
= TlsGetValue(MLANG_tls_index
);
1877 TRACE("%s\n", debugstr_w(locale
));
1879 if (data
->total
>= data
->allocated
)
1881 data
->allocated
+= 32;
1882 data
->info
= HeapReAlloc(GetProcessHeap(), 0, data
->info
, data
->allocated
* sizeof(RFC1766INFO
));
1883 if (!data
->info
) return FALSE
;
1886 info
= &data
->info
[data
->total
];
1888 info
->lcid
= strtolW(locale
, &end
, 16);
1889 if (*end
) /* invalid number */
1892 info
->wszRfc1766
[0] = 0;
1893 lcid_to_rfc1766W( info
->lcid
, info
->wszRfc1766
, MAX_RFC1766_NAME
);
1895 info
->wszLocaleName
[0] = 0;
1896 GetLocaleInfoW(info
->lcid
, LOCALE_SLANGUAGE
, info
->wszLocaleName
, MAX_LOCALE_NAME
);
1897 TRACE("ISO639: %s SLANGUAGE: %s\n", wine_dbgstr_w(info
->wszRfc1766
), wine_dbgstr_w(info
->wszLocaleName
));
1904 static HRESULT
EnumRfc1766_create(LANGID LangId
, IEnumRfc1766
**ppEnum
)
1906 EnumRfc1766_impl
*rfc
;
1907 struct enum_locales_data data
;
1909 TRACE("%04x, %p\n", LangId
, ppEnum
);
1911 rfc
= HeapAlloc( GetProcessHeap(), 0, sizeof(EnumRfc1766_impl
) );
1912 rfc
->vtbl_IEnumRfc1766
= &IEnumRfc1766_vtbl
;
1918 data
.allocated
= 32;
1919 data
.info
= HeapAlloc(GetProcessHeap(), 0, data
.allocated
* sizeof(RFC1766INFO
));
1922 HeapFree(GetProcessHeap(), 0, rfc
);
1926 TlsSetValue(MLANG_tls_index
, &data
);
1927 EnumSystemLocalesW(enum_locales_proc
, 0/*LOCALE_SUPPORTED*/);
1928 TlsSetValue(MLANG_tls_index
, NULL
);
1930 TRACE("enumerated %d rfc1766 structures\n", data
.total
);
1934 HeapFree(GetProcessHeap(), 0, data
.info
);
1935 HeapFree(GetProcessHeap(), 0, rfc
);
1939 rfc
->info
= data
.info
;
1940 rfc
->total
= data
.total
;
1942 *ppEnum
= (IEnumRfc1766
*)rfc
;
1946 static HRESULT WINAPI
fnIMultiLanguage_EnumRfc1766(
1947 IMultiLanguage
*iface
,
1948 IEnumRfc1766
**ppEnumRfc1766
)
1950 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1951 TRACE("%p %p\n", This
, ppEnumRfc1766
);
1953 return EnumRfc1766_create(0, ppEnumRfc1766
);
1956 /******************************************************************************/
1958 static HRESULT WINAPI
fnIMultiLanguage_GetRfc1766Info(
1959 IMultiLanguage
* iface
,
1961 PRFC1766INFO pRfc1766Info
)
1967 static HRESULT WINAPI
fnIMultiLanguage_CreateConvertCharset(
1968 IMultiLanguage
* iface
,
1972 IMLangConvertCharset
** ppMLangConvertCharset
)
1978 static const IMultiLanguageVtbl IMultiLanguage_vtbl
=
1980 fnIMultiLanguage_QueryInterface
,
1981 fnIMultiLanguage_AddRef
,
1982 fnIMultiLanguage_Release
,
1983 fnIMultiLanguage_GetNumberOfCodePageInfo
,
1984 fnIMultiLanguage_GetCodePageInfo
,
1985 fnIMultiLanguage_GetFamilyCodePage
,
1986 fnIMultiLanguage_EnumCodePages
,
1987 fnIMultiLanguage_GetCharsetInfo
,
1988 fnIMultiLanguage_IsConvertible
,
1989 fnIMultiLanguage_ConvertString
,
1990 fnIMultiLanguage_ConvertStringToUnicode
,
1991 fnIMultiLanguage_ConvertStringFromUnicode
,
1992 fnIMultiLanguage_ConvertStringReset
,
1993 fnIMultiLanguage_GetRfc1766FromLcid
,
1994 fnIMultiLanguage_GetLcidFromRfc1766
,
1995 fnIMultiLanguage_EnumRfc1766
,
1996 fnIMultiLanguage_GetRfc1766Info
,
1997 fnIMultiLanguage_CreateConvertCharset
,
2001 /******************************************************************************/
2003 static HRESULT WINAPI
fnIMultiLanguage2_QueryInterface(
2004 IMultiLanguage3
* iface
,
2008 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2009 return MLang_QueryInterface( This
, riid
, ppvObject
);
2012 static ULONG WINAPI
fnIMultiLanguage2_AddRef( IMultiLanguage3
* iface
)
2014 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2015 return MLang_AddRef( This
);
2018 static ULONG WINAPI
fnIMultiLanguage2_Release( IMultiLanguage3
* iface
)
2020 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2021 return MLang_Release( This
);
2024 static HRESULT WINAPI
fnIMultiLanguage2_GetNumberOfCodePageInfo(
2025 IMultiLanguage3
* iface
,
2028 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2029 TRACE("%p, %p\n", This
, pcCodePage
);
2031 if (!pcCodePage
) return S_FALSE
;
2033 *pcCodePage
= This
->total_cp
;
2037 static void fill_cp_info(const struct mlang_data
*ml_data
, UINT index
, MIMECPINFO
*mime_cp_info
)
2041 if (TranslateCharsetInfo((DWORD
*)ml_data
->family_codepage
, &csi
, TCI_SRCCODEPAGE
))
2042 mime_cp_info
->bGDICharset
= csi
.ciCharset
;
2044 mime_cp_info
->bGDICharset
= DEFAULT_CHARSET
;
2046 mime_cp_info
->dwFlags
= ml_data
->mime_cp_info
[index
].flags
;
2047 mime_cp_info
->uiCodePage
= ml_data
->mime_cp_info
[index
].cp
;
2048 mime_cp_info
->uiFamilyCodePage
= ml_data
->family_codepage
;
2049 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].description
, -1,
2050 mime_cp_info
->wszDescription
, sizeof(mime_cp_info
->wszDescription
)/sizeof(WCHAR
));
2051 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].web_charset
, -1,
2052 mime_cp_info
->wszWebCharset
, sizeof(mime_cp_info
->wszWebCharset
)/sizeof(WCHAR
));
2053 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].header_charset
, -1,
2054 mime_cp_info
->wszHeaderCharset
, sizeof(mime_cp_info
->wszHeaderCharset
)/sizeof(WCHAR
));
2055 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].body_charset
, -1,
2056 mime_cp_info
->wszBodyCharset
, sizeof(mime_cp_info
->wszBodyCharset
)/sizeof(WCHAR
));
2058 MultiByteToWideChar(CP_ACP
, 0, ml_data
->fixed_font
, -1,
2059 mime_cp_info
->wszFixedWidthFont
, sizeof(mime_cp_info
->wszFixedWidthFont
)/sizeof(WCHAR
));
2060 MultiByteToWideChar(CP_ACP
, 0, ml_data
->proportional_font
, -1,
2061 mime_cp_info
->wszProportionalFont
, sizeof(mime_cp_info
->wszProportionalFont
)/sizeof(WCHAR
));
2063 TRACE("%08x %u %u %s %s %s %s %s %s %d\n",
2064 mime_cp_info
->dwFlags
, mime_cp_info
->uiCodePage
,
2065 mime_cp_info
->uiFamilyCodePage
,
2066 wine_dbgstr_w(mime_cp_info
->wszDescription
),
2067 wine_dbgstr_w(mime_cp_info
->wszWebCharset
),
2068 wine_dbgstr_w(mime_cp_info
->wszHeaderCharset
),
2069 wine_dbgstr_w(mime_cp_info
->wszBodyCharset
),
2070 wine_dbgstr_w(mime_cp_info
->wszFixedWidthFont
),
2071 wine_dbgstr_w(mime_cp_info
->wszProportionalFont
),
2072 mime_cp_info
->bGDICharset
);
2075 static HRESULT WINAPI
fnIMultiLanguage2_GetCodePageInfo(
2076 IMultiLanguage3
* iface
,
2079 PMIMECPINFO pCodePageInfo
)
2083 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2084 TRACE("%p, %u, %04x, %p\n", This
, uiCodePage
, LangId
, pCodePageInfo
);
2086 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2088 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2090 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
2092 fill_cp_info(&mlang_data
[i
], n
, pCodePageInfo
);
2101 static HRESULT WINAPI
fnIMultiLanguage2_GetFamilyCodePage(
2102 IMultiLanguage3
* iface
,
2104 UINT
* puiFamilyCodePage
)
2106 return GetFamilyCodePage(uiCodePage
, puiFamilyCodePage
);
2109 static HRESULT WINAPI
fnIMultiLanguage2_EnumCodePages(
2110 IMultiLanguage3
* iface
,
2113 IEnumCodePage
** ppEnumCodePage
)
2115 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2116 TRACE("%p %08x %04x %p\n", This
, grfFlags
, LangId
, ppEnumCodePage
);
2118 return EnumCodePage_create( This
, grfFlags
, LangId
, ppEnumCodePage
);
2121 static HRESULT WINAPI
fnIMultiLanguage2_GetCharsetInfo(
2122 IMultiLanguage3
* iface
,
2124 PMIMECSETINFO pCharsetInfo
)
2128 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2129 TRACE("%p %s %p\n", This
, debugstr_w(Charset
), pCharsetInfo
);
2131 if (!pCharsetInfo
) return E_FAIL
;
2133 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2135 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2137 WCHAR csetW
[MAX_MIMECSET_NAME
];
2139 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].mime_cp_info
[n
].web_charset
, -1, csetW
, MAX_MIMECSET_NAME
);
2140 if (!lstrcmpiW(Charset
, csetW
))
2142 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2143 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2144 strcpyW(pCharsetInfo
->wszCharset
, csetW
);
2151 * Since we do not support charsets like iso-2022-jp and do not have
2152 * them in our database as a primary (web_charset) encoding this loop
2153 * does an attempt to 'approximate' charset name by header_charset.
2155 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2157 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2159 WCHAR csetW
[MAX_MIMECSET_NAME
];
2161 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].mime_cp_info
[n
].header_charset
, -1, csetW
, MAX_MIMECSET_NAME
);
2162 if (!lstrcmpiW(Charset
, csetW
))
2164 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2165 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2166 strcpyW(pCharsetInfo
->wszCharset
, csetW
);
2175 static HRESULT WINAPI
fnIMultiLanguage2_IsConvertible(
2176 IMultiLanguage3
* iface
,
2177 DWORD dwSrcEncoding
,
2178 DWORD dwDstEncoding
)
2180 return IsConvertINetStringAvailable(dwSrcEncoding
, dwDstEncoding
);
2183 static HRESULT WINAPI
fnIMultiLanguage2_ConvertString(
2184 IMultiLanguage3
* iface
,
2186 DWORD dwSrcEncoding
,
2187 DWORD dwDstEncoding
,
2193 return ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
,
2194 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, (LPSTR
)pDstStr
, (LPINT
)pcDstSize
);
2197 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringToUnicode(
2198 IMultiLanguage3
* iface
,
2206 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
2207 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2210 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringFromUnicode(
2211 IMultiLanguage3
* iface
,
2219 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
2220 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2223 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringReset(
2224 IMultiLanguage3
* iface
)
2230 static HRESULT WINAPI
fnIMultiLanguage2_GetRfc1766FromLcid(
2231 IMultiLanguage3
* iface
,
2235 WCHAR buf
[MAX_RFC1766_NAME
];
2237 TRACE("%p %04x %p\n", iface
, lcid
, pbstrRfc1766
);
2239 if (lcid_to_rfc1766W( lcid
, buf
, MAX_RFC1766_NAME
))
2241 *pbstrRfc1766
= SysAllocString( buf
);
2247 static HRESULT WINAPI
fnIMultiLanguage2_GetLcidFromRfc1766(
2248 IMultiLanguage3
* iface
,
2253 IEnumRfc1766
*rfc1766
;
2255 TRACE("%p %p %s\n", iface
, pLocale
, debugstr_w(bstrRfc1766
));
2257 if (!pLocale
|| !bstrRfc1766
)
2258 return E_INVALIDARG
;
2260 hr
= IMultiLanguage2_EnumRfc1766(iface
, 0, &rfc1766
);
2264 hr
= lcid_from_rfc1766(rfc1766
, pLocale
, bstrRfc1766
);
2266 IEnumRfc1766_Release(rfc1766
);
2270 static HRESULT WINAPI
fnIMultiLanguage2_EnumRfc1766(
2271 IMultiLanguage3
* iface
,
2273 IEnumRfc1766
** ppEnumRfc1766
)
2275 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
2276 TRACE("%p %p\n", This
, ppEnumRfc1766
);
2278 return EnumRfc1766_create(LangId
, ppEnumRfc1766
);
2281 static HRESULT WINAPI
fnIMultiLanguage2_GetRfc1766Info(
2282 IMultiLanguage3
* iface
,
2285 PRFC1766INFO pRfc1766Info
)
2291 static HRESULT WINAPI
fnIMultiLanguage2_CreateConvertCharset(
2292 IMultiLanguage3
* iface
,
2296 IMLangConvertCharset
** ppMLangConvertCharset
)
2302 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringInIStream(
2303 IMultiLanguage3
* iface
,
2307 DWORD dwSrcEncoding
,
2308 DWORD dwDstEncoding
,
2317 * TODO: handle dwFlag and lpFallBack
2319 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringToUnicodeEx(
2320 IMultiLanguage3
* iface
,
2331 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
2332 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2335 /*****************************************************************************
2336 * MultiLanguage2::ConvertStringToUnicodeEx
2338 * Translates the multibyte string from the specified code page to Unicode.
2341 * see ConvertStringToUnicode
2343 * lpFallBack if dwFlag contains MLCONVCHARF_USEDEFCHAR, lpFallBack string used
2344 * instead unconvertible characters.
2348 * S_FALSE The conversion is not supported.
2349 * E_FAIL Some error has occurred.
2351 * TODO: handle dwFlag and lpFallBack
2353 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringFromUnicodeEx(
2354 IMultiLanguage3
* This
,
2365 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
2366 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2369 static HRESULT WINAPI
fnIMultiLanguage2_DetectCodepageInIStream(
2370 IMultiLanguage3
* iface
,
2372 DWORD dwPrefWinCodePage
,
2374 DetectEncodingInfo
* lpEncoding
,
2381 static HRESULT WINAPI
fnIMultiLanguage2_DetectInputCodepage(
2382 IMultiLanguage3
* iface
,
2384 DWORD dwPrefWinCodePage
,
2387 DetectEncodingInfo
* lpEncoding
,
2394 static HRESULT WINAPI
fnIMultiLanguage2_ValidateCodePage(
2395 IMultiLanguage3
* iface
,
2399 FIXME("%u, %p\n", uiCodePage
, hwnd
);
2403 static HRESULT WINAPI
fnIMultiLanguage2_GetCodePageDescription(
2404 IMultiLanguage3
* iface
,
2407 LPWSTR lpWideCharStr
,
2410 FIXME("%u, %04x, %p, %d\n", uiCodePage
, lcid
, lpWideCharStr
, cchWideChar
);
2414 static HRESULT WINAPI
fnIMultiLanguage2_IsCodePageInstallable(
2415 IMultiLanguage3
* iface
,
2418 FIXME("%u\n", uiCodePage
);
2422 static HRESULT WINAPI
fnIMultiLanguage2_SetMimeDBSource(
2423 IMultiLanguage3
* iface
,
2426 FIXME("0x%08x\n", dwSource
);
2430 static HRESULT WINAPI
fnIMultiLanguage2_GetNumberOfScripts(
2431 IMultiLanguage3
* iface
,
2434 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2435 TRACE("%p %p\n", This
, pnScripts
);
2437 if (!pnScripts
) return S_FALSE
;
2439 *pnScripts
= This
->total_scripts
;
2443 static HRESULT WINAPI
fnIMultiLanguage2_EnumScripts(
2444 IMultiLanguage3
* iface
,
2447 IEnumScript
** ppEnumScript
)
2449 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2450 TRACE("%p %08x %04x %p\n", This
, dwFlags
, LangId
, ppEnumScript
);
2452 return EnumScript_create( This
, dwFlags
, LangId
, ppEnumScript
);
2455 static HRESULT WINAPI
fnIMultiLanguage2_ValidateCodePageEx(
2456 IMultiLanguage3
* iface
,
2459 DWORD dwfIODControl
)
2461 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2462 FIXME("%p %u %p %08x: stub!\n", This
, uiCodePage
, hwnd
, dwfIODControl
);
2467 static HRESULT WINAPI
fnIMultiLanguage3_DetectOutboundCodePage(
2468 IMultiLanguage3
*iface
,
2470 LPCWSTR lpWideCharStr
,
2472 UINT
*puiPreferredCodePages
,
2473 UINT nPreferredCodePages
,
2474 UINT
*puiDetectedCodePages
,
2475 UINT
*pnDetectedCodePages
,
2476 WCHAR
*lpSpecialChar
)
2478 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2479 FIXME("(%p)->(%08x %s %u %p %u %p %p %p)\n", This
, dwFlags
, debugstr_w(lpWideCharStr
),
2480 cchWideChar
, puiPreferredCodePages
, nPreferredCodePages
, puiDetectedCodePages
,
2481 pnDetectedCodePages
, lpSpecialChar
);
2485 static HRESULT WINAPI
fnIMultiLanguage3_DetectOutboundCodePageInIStream(
2486 IMultiLanguage3
*iface
,
2489 UINT
*puiPreferredCodePages
,
2490 UINT nPreferredCodePages
,
2491 UINT
*puiDetectedCodePages
,
2492 UINT
*pnDetectedCodePages
,
2493 WCHAR
*lpSpecialChar
)
2495 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2496 FIXME("(%p)->(%08x %p %p %u %p %p %p)\n", This
, dwFlags
, pStrIn
,
2497 puiPreferredCodePages
, nPreferredCodePages
, puiDetectedCodePages
,
2498 pnDetectedCodePages
, lpSpecialChar
);
2502 static const IMultiLanguage3Vtbl IMultiLanguage3_vtbl
=
2504 fnIMultiLanguage2_QueryInterface
,
2505 fnIMultiLanguage2_AddRef
,
2506 fnIMultiLanguage2_Release
,
2507 fnIMultiLanguage2_GetNumberOfCodePageInfo
,
2508 fnIMultiLanguage2_GetCodePageInfo
,
2509 fnIMultiLanguage2_GetFamilyCodePage
,
2510 fnIMultiLanguage2_EnumCodePages
,
2511 fnIMultiLanguage2_GetCharsetInfo
,
2512 fnIMultiLanguage2_IsConvertible
,
2513 fnIMultiLanguage2_ConvertString
,
2514 fnIMultiLanguage2_ConvertStringToUnicode
,
2515 fnIMultiLanguage2_ConvertStringFromUnicode
,
2516 fnIMultiLanguage2_ConvertStringReset
,
2517 fnIMultiLanguage2_GetRfc1766FromLcid
,
2518 fnIMultiLanguage2_GetLcidFromRfc1766
,
2519 fnIMultiLanguage2_EnumRfc1766
,
2520 fnIMultiLanguage2_GetRfc1766Info
,
2521 fnIMultiLanguage2_CreateConvertCharset
,
2522 fnIMultiLanguage2_ConvertStringInIStream
,
2523 fnIMultiLanguage2_ConvertStringToUnicodeEx
,
2524 fnIMultiLanguage2_ConvertStringFromUnicodeEx
,
2525 fnIMultiLanguage2_DetectCodepageInIStream
,
2526 fnIMultiLanguage2_DetectInputCodepage
,
2527 fnIMultiLanguage2_ValidateCodePage
,
2528 fnIMultiLanguage2_GetCodePageDescription
,
2529 fnIMultiLanguage2_IsCodePageInstallable
,
2530 fnIMultiLanguage2_SetMimeDBSource
,
2531 fnIMultiLanguage2_GetNumberOfScripts
,
2532 fnIMultiLanguage2_EnumScripts
,
2533 fnIMultiLanguage2_ValidateCodePageEx
,
2534 fnIMultiLanguage3_DetectOutboundCodePage
,
2535 fnIMultiLanguage3_DetectOutboundCodePageInIStream
2538 static HRESULT
MultiLanguage_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
2543 TRACE("Creating MultiLanguage object\n");
2546 return CLASS_E_NOAGGREGATION
;
2548 mlang
= HeapAlloc( GetProcessHeap(), 0, sizeof (MLang_impl
) );
2549 mlang
->vtbl_IMLangFontLink
= &IMLangFontLink_vtbl
;
2550 mlang
->vtbl_IMultiLanguage
= &IMultiLanguage_vtbl
;
2551 mlang
->vtbl_IMultiLanguage3
= &IMultiLanguage3_vtbl
;
2553 mlang
->total_cp
= 0;
2554 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2555 mlang
->total_cp
+= mlang_data
[i
].number_of_cp
;
2557 /* do not enumerate unicode flavours */
2558 mlang
->total_scripts
= sizeof(mlang_data
)/sizeof(mlang_data
[0]) - 1;
2561 *ppObj
= (LPVOID
) mlang
;
2562 TRACE("returning %p\n", mlang
);
2569 /******************************************************************************/
2571 HRESULT WINAPI
DllCanUnloadNow(void)
2573 return dll_count
== 0 ? S_OK
: S_FALSE
;
2576 HRESULT WINAPI
GetGlobalFontLinkObject(void)