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 /******************************************************************************
791 IClassFactory ITF_IClassFactory
;
794 HRESULT (*pfnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
797 struct object_creation_info
801 HRESULT (*pfnCreateInstance
)(IUnknown
*pUnkOuter
, LPVOID
*ppObj
);
804 static const struct object_creation_info object_creation
[] =
806 { &CLSID_CMultiLanguage
, "CLSID_CMultiLanguage", MultiLanguage_create
},
809 static HRESULT WINAPI
810 MLANGCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
812 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
814 TRACE("%s\n", debugstr_guid(riid
) );
816 if (IsEqualGUID(riid
, &IID_IUnknown
)
817 || IsEqualGUID(riid
, &IID_IClassFactory
))
819 IClassFactory_AddRef(iface
);
824 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
825 return E_NOINTERFACE
;
828 static ULONG WINAPI
MLANGCF_AddRef(LPCLASSFACTORY iface
)
830 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
831 return InterlockedIncrement(&This
->ref
);
834 static ULONG WINAPI
MLANGCF_Release(LPCLASSFACTORY iface
)
836 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
838 ULONG ref
= InterlockedDecrement(&This
->ref
);
842 TRACE("Destroying %p\n", This
);
843 HeapFree(GetProcessHeap(), 0, This
);
849 static HRESULT WINAPI
MLANGCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
,
850 REFIID riid
, LPVOID
*ppobj
)
852 IClassFactoryImpl
*This
= (IClassFactoryImpl
*)iface
;
856 TRACE("(%p)->(%p,%s,%p)\n",This
,pOuter
,debugstr_guid(riid
),ppobj
);
859 hres
= This
->pfnCreateInstance(pOuter
, (LPVOID
*) &punk
);
860 if (SUCCEEDED(hres
)) {
861 hres
= IUnknown_QueryInterface(punk
, riid
, ppobj
);
862 IUnknown_Release(punk
);
864 TRACE("returning (%p) -> %x\n", *ppobj
, hres
);
868 static HRESULT WINAPI
MLANGCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
878 static const IClassFactoryVtbl MLANGCF_Vtbl
=
880 MLANGCF_QueryInterface
,
883 MLANGCF_CreateInstance
,
887 /******************************************************************
888 * DllGetClassObject (MLANG.@)
890 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
893 IClassFactoryImpl
*factory
;
895 TRACE("%s %s %p\n",debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
897 if ( !IsEqualGUID( &IID_IClassFactory
, iid
)
898 && ! IsEqualGUID( &IID_IUnknown
, iid
) )
899 return E_NOINTERFACE
;
901 for (i
=0; i
< sizeof(object_creation
)/sizeof(object_creation
[0]); i
++)
903 if (IsEqualGUID(object_creation
[i
].clsid
, rclsid
))
907 if (i
== sizeof(object_creation
)/sizeof(object_creation
[0]))
909 FIXME("%s: no class found.\n", debugstr_guid(rclsid
));
910 return CLASS_E_CLASSNOTAVAILABLE
;
913 TRACE("Creating a class factory for %s\n",object_creation
[i
].szClassName
);
915 factory
= HeapAlloc(GetProcessHeap(), 0, sizeof(*factory
));
916 if (factory
== NULL
) return E_OUTOFMEMORY
;
918 factory
->ITF_IClassFactory
.lpVtbl
= &MLANGCF_Vtbl
;
921 factory
->pfnCreateInstance
= object_creation
[i
].pfnCreateInstance
;
923 *ppv
= &(factory
->ITF_IClassFactory
);
925 TRACE("(%p) <- %p\n", ppv
, &(factory
->ITF_IClassFactory
) );
931 /******************************************************************************/
933 typedef struct tagMLang_impl
935 const IMLangFontLinkVtbl
*vtbl_IMLangFontLink
;
936 const IMultiLanguageVtbl
*vtbl_IMultiLanguage
;
937 const IMultiLanguage3Vtbl
*vtbl_IMultiLanguage3
;
939 DWORD total_cp
, total_scripts
;
942 static ULONG WINAPI
MLang_AddRef( MLang_impl
* This
)
944 return InterlockedIncrement(&This
->ref
);
947 static ULONG WINAPI
MLang_Release( MLang_impl
* This
)
949 ULONG ref
= InterlockedDecrement(&This
->ref
);
951 TRACE("%p ref = %d\n", This
, ref
);
954 TRACE("Destroying %p\n", This
);
955 HeapFree(GetProcessHeap(), 0, This
);
962 static HRESULT WINAPI
MLang_QueryInterface(
967 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
969 if (IsEqualGUID(riid
, &IID_IUnknown
)
970 || IsEqualGUID(riid
, &IID_IMLangCodePages
)
971 || IsEqualGUID(riid
, &IID_IMLangFontLink
))
974 TRACE("Returning IID_IMLangFontLink %p ref = %d\n", This
, This
->ref
);
975 *ppvObject
= &(This
->vtbl_IMLangFontLink
);
979 if (IsEqualGUID(riid
, &IID_IMultiLanguage
) )
982 TRACE("Returning IID_IMultiLanguage %p ref = %d\n", This
, This
->ref
);
983 *ppvObject
= &(This
->vtbl_IMultiLanguage
);
987 if (IsEqualGUID(riid
, &IID_IMultiLanguage2
) )
990 *ppvObject
= &(This
->vtbl_IMultiLanguage3
);
991 TRACE("Returning IID_IMultiLanguage2 %p ref = %d\n", This
, This
->ref
);
995 if (IsEqualGUID(riid
, &IID_IMultiLanguage3
) )
998 *ppvObject
= &(This
->vtbl_IMultiLanguage3
);
999 TRACE("Returning IID_IMultiLanguage3 %p ref = %d\n", This
, This
->ref
);
1003 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1004 return E_NOINTERFACE
;
1007 /******************************************************************************/
1009 typedef struct tagEnumCodePage_impl
1011 const IEnumCodePageVtbl
*vtbl_IEnumCodePage
;
1015 } EnumCodePage_impl
;
1017 static HRESULT WINAPI
fnIEnumCodePage_QueryInterface(
1018 IEnumCodePage
* iface
,
1022 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1024 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1026 if (IsEqualGUID(riid
, &IID_IUnknown
)
1027 || IsEqualGUID(riid
, &IID_IEnumCodePage
))
1029 IEnumCodePage_AddRef(iface
);
1030 TRACE("Returning IID_IEnumCodePage %p ref = %d\n", This
, This
->ref
);
1031 *ppvObject
= &(This
->vtbl_IEnumCodePage
);
1035 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1036 return E_NOINTERFACE
;
1039 static ULONG WINAPI
fnIEnumCodePage_AddRef(
1040 IEnumCodePage
* iface
)
1042 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1043 return InterlockedIncrement(&This
->ref
);
1046 static ULONG WINAPI
fnIEnumCodePage_Release(
1047 IEnumCodePage
* iface
)
1049 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1050 ULONG ref
= InterlockedDecrement(&This
->ref
);
1052 TRACE("%p ref = %d\n", This
, ref
);
1055 TRACE("Destroying %p\n", This
);
1056 HeapFree(GetProcessHeap(), 0, This
->cpinfo
);
1057 HeapFree(GetProcessHeap(), 0, This
);
1063 static HRESULT WINAPI
fnIEnumCodePage_Clone(
1064 IEnumCodePage
* iface
,
1065 IEnumCodePage
** ppEnum
)
1067 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1068 FIXME("%p %p\n", This
, ppEnum
);
1072 static HRESULT WINAPI
fnIEnumCodePage_Next(
1073 IEnumCodePage
* iface
,
1076 ULONG
* pceltFetched
)
1080 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1081 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1083 if (!pceltFetched
) return S_FALSE
;
1086 if (!rgelt
) return S_FALSE
;
1088 if (This
->pos
+ celt
> This
->total
)
1089 celt
= This
->total
- This
->pos
;
1091 if (!celt
) return S_FALSE
;
1093 memcpy(rgelt
, This
->cpinfo
+ This
->pos
, celt
* sizeof(MIMECPINFO
));
1094 *pceltFetched
= celt
;
1097 for (i
= 0; i
< celt
; i
++)
1099 TRACE("#%u: %08x %u %u %s %s %s %s %s %s %d\n",
1100 i
, rgelt
[i
].dwFlags
, rgelt
[i
].uiCodePage
,
1101 rgelt
[i
].uiFamilyCodePage
,
1102 wine_dbgstr_w(rgelt
[i
].wszDescription
),
1103 wine_dbgstr_w(rgelt
[i
].wszWebCharset
),
1104 wine_dbgstr_w(rgelt
[i
].wszHeaderCharset
),
1105 wine_dbgstr_w(rgelt
[i
].wszBodyCharset
),
1106 wine_dbgstr_w(rgelt
[i
].wszFixedWidthFont
),
1107 wine_dbgstr_w(rgelt
[i
].wszProportionalFont
),
1108 rgelt
[i
].bGDICharset
);
1113 static HRESULT WINAPI
fnIEnumCodePage_Reset(
1114 IEnumCodePage
* iface
)
1116 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1117 TRACE("%p\n", This
);
1123 static HRESULT WINAPI
fnIEnumCodePage_Skip(
1124 IEnumCodePage
* iface
,
1127 ICOM_THIS_MULTI(EnumCodePage_impl
, vtbl_IEnumCodePage
, iface
);
1128 TRACE("%p %u\n", This
, celt
);
1130 if (celt
>= This
->total
) return S_FALSE
;
1136 static const IEnumCodePageVtbl IEnumCodePage_vtbl
=
1138 fnIEnumCodePage_QueryInterface
,
1139 fnIEnumCodePage_AddRef
,
1140 fnIEnumCodePage_Release
,
1141 fnIEnumCodePage_Clone
,
1142 fnIEnumCodePage_Next
,
1143 fnIEnumCodePage_Reset
,
1144 fnIEnumCodePage_Skip
1147 static HRESULT
EnumCodePage_create( MLang_impl
* mlang
, DWORD grfFlags
,
1148 LANGID LangId
, IEnumCodePage
** ppEnumCodePage
)
1150 EnumCodePage_impl
*ecp
;
1154 TRACE("%p, %08x, %04x, %p\n", mlang
, grfFlags
, LangId
, ppEnumCodePage
);
1156 if (!grfFlags
) /* enumerate internal data base of encodings */
1157 grfFlags
= MIMECONTF_MIME_LATEST
;
1159 ecp
= HeapAlloc( GetProcessHeap(), 0, sizeof (EnumCodePage_impl
) );
1160 ecp
->vtbl_IEnumCodePage
= &IEnumCodePage_vtbl
;
1164 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1166 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1168 if (mlang_data
[i
].mime_cp_info
[n
].flags
& grfFlags
)
1173 ecp
->cpinfo
= HeapAlloc(GetProcessHeap(), 0,
1174 sizeof(MIMECPINFO
) * ecp
->total
);
1175 cpinfo
= ecp
->cpinfo
;
1177 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1179 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1181 if (mlang_data
[i
].mime_cp_info
[n
].flags
& grfFlags
)
1182 fill_cp_info(&mlang_data
[i
], n
, cpinfo
++);
1186 TRACE("enumerated %d codepages with flags %08x\n", ecp
->total
, grfFlags
);
1188 *ppEnumCodePage
= (IEnumCodePage
*) ecp
;
1193 /******************************************************************************/
1195 typedef struct tagEnumScript_impl
1197 const IEnumScriptVtbl
*vtbl_IEnumScript
;
1199 SCRIPTINFO
*script_info
;
1203 static HRESULT WINAPI
fnIEnumScript_QueryInterface(
1208 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1210 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1212 if (IsEqualGUID(riid
, &IID_IUnknown
)
1213 || IsEqualGUID(riid
, &IID_IEnumScript
))
1215 IEnumScript_AddRef(iface
);
1216 TRACE("Returning IID_IEnumScript %p ref = %d\n", This
, This
->ref
);
1217 *ppvObject
= &(This
->vtbl_IEnumScript
);
1221 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppvObject
);
1222 return E_NOINTERFACE
;
1225 static ULONG WINAPI
fnIEnumScript_AddRef(
1228 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1229 return InterlockedIncrement(&This
->ref
);
1232 static ULONG WINAPI
fnIEnumScript_Release(
1235 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1236 ULONG ref
= InterlockedDecrement(&This
->ref
);
1238 TRACE("%p ref = %d\n", This
, ref
);
1241 TRACE("Destroying %p\n", This
);
1242 HeapFree(GetProcessHeap(), 0, This
->script_info
);
1243 HeapFree(GetProcessHeap(), 0, This
);
1249 static HRESULT WINAPI
fnIEnumScript_Clone(
1251 IEnumScript
** ppEnum
)
1253 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1254 FIXME("%p %p: stub!\n", This
, ppEnum
);
1258 static HRESULT WINAPI
fnIEnumScript_Next(
1262 ULONG
* pceltFetched
)
1264 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1265 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1267 if (!pceltFetched
|| !rgelt
) return E_FAIL
;
1271 if (This
->pos
+ celt
> This
->total
)
1272 celt
= This
->total
- This
->pos
;
1274 if (!celt
) return S_FALSE
;
1276 memcpy(rgelt
, This
->script_info
+ This
->pos
, celt
* sizeof(SCRIPTINFO
));
1277 *pceltFetched
= celt
;
1283 static HRESULT WINAPI
fnIEnumScript_Reset(
1286 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1287 TRACE("%p\n", This
);
1293 static HRESULT WINAPI
fnIEnumScript_Skip(
1297 ICOM_THIS_MULTI(EnumScript_impl
, vtbl_IEnumScript
, iface
);
1298 TRACE("%p %u\n", This
, celt
);
1300 if (celt
>= This
->total
) return S_FALSE
;
1306 static const IEnumScriptVtbl IEnumScript_vtbl
=
1308 fnIEnumScript_QueryInterface
,
1309 fnIEnumScript_AddRef
,
1310 fnIEnumScript_Release
,
1311 fnIEnumScript_Clone
,
1313 fnIEnumScript_Reset
,
1317 static HRESULT
EnumScript_create( MLang_impl
* mlang
, DWORD dwFlags
,
1318 LANGID LangId
, IEnumScript
** ppEnumScript
)
1320 EnumScript_impl
*es
;
1323 TRACE("%p, %08x, %04x, %p: stub!\n", mlang
, dwFlags
, LangId
, ppEnumScript
);
1325 if (!dwFlags
) /* enumerate all available scripts */
1326 dwFlags
= SCRIPTCONTF_SCRIPT_USER
| SCRIPTCONTF_SCRIPT_HIDE
| SCRIPTCONTF_SCRIPT_SYSTEM
;
1328 es
= HeapAlloc( GetProcessHeap(), 0, sizeof (EnumScript_impl
) );
1329 es
->vtbl_IEnumScript
= &IEnumScript_vtbl
;
1332 /* do not enumerate unicode flavours */
1333 es
->total
= sizeof(mlang_data
)/sizeof(mlang_data
[0]) - 1;
1334 es
->script_info
= HeapAlloc(GetProcessHeap(), 0, sizeof(SCRIPTINFO
) * es
->total
);
1336 for (i
= 0; i
< es
->total
; i
++)
1338 es
->script_info
[i
].ScriptId
= i
;
1339 es
->script_info
[i
].uiCodePage
= mlang_data
[i
].family_codepage
;
1340 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].description
, -1,
1341 es
->script_info
[i
].wszDescription
, MAX_SCRIPT_NAME
);
1342 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].fixed_font
, -1,
1343 es
->script_info
[i
].wszFixedWidthFont
, MAX_MIMEFACE_NAME
);
1344 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].proportional_font
, -1,
1345 es
->script_info
[i
].wszProportionalFont
, MAX_MIMEFACE_NAME
);
1348 TRACE("enumerated %d scripts with flags %08x\n", es
->total
, dwFlags
);
1350 *ppEnumScript
= (IEnumScript
*)es
;
1355 /******************************************************************************/
1357 static HRESULT WINAPI
fnIMLangFontLink_QueryInterface(
1358 IMLangFontLink
* iface
,
1362 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1363 return MLang_QueryInterface( This
, riid
, ppvObject
);
1366 static ULONG WINAPI
fnIMLangFontLink_AddRef(
1367 IMLangFontLink
* iface
)
1369 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1370 return MLang_AddRef( This
);
1373 static ULONG WINAPI
fnIMLangFontLink_Release(
1374 IMLangFontLink
* iface
)
1376 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1377 return MLang_Release( This
);
1380 static HRESULT WINAPI
fnIMLangFontLink_GetCharCodePages(
1381 IMLangFontLink
* iface
,
1383 DWORD
* pdwCodePages
)
1389 static HRESULT WINAPI
fnIMLangFontLink_GetStrCodePages(
1390 IMLangFontLink
* iface
,
1391 const WCHAR
* pszSrc
,
1393 DWORD dwPriorityCodePages
,
1394 DWORD
* pdwCodePages
,
1395 long* pcchCodePages
)
1397 FIXME("(pszSrc=%s, cchSrc=%ld, dwPriorityCodePages=%d) stub\n", debugstr_w(pszSrc
), cchSrc
, dwPriorityCodePages
);
1403 static HRESULT WINAPI
fnIMLangFontLink_CodePageToCodePages(
1404 IMLangFontLink
* iface
,
1406 DWORD
* pdwCodePages
)
1408 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1412 TRACE("(%p) Seeking %u\n",This
, uCodePage
);
1413 memset(&cs
, 0, sizeof(cs
));
1415 rc
= TranslateCharsetInfo((DWORD
*)uCodePage
, &cs
, TCI_SRCCODEPAGE
);
1419 *pdwCodePages
= cs
.fs
.fsCsb
[0];
1420 TRACE("resulting CodePages 0x%x\n",*pdwCodePages
);
1423 TRACE("CodePage Not Found\n");
1428 static HRESULT WINAPI
fnIMLangFontLink_CodePagesToCodePage(
1429 IMLangFontLink
* iface
,
1431 UINT uDefaultCodePage
,
1434 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1435 DWORD mask
= 0x00000000;
1440 TRACE("(%p) scanning 0x%x default page %u\n",This
, dwCodePages
,
1443 *puCodePage
= 0x00000000;
1445 rc
= TranslateCharsetInfo((DWORD
*)uDefaultCodePage
, &cs
, TCI_SRCCODEPAGE
);
1447 if (rc
&& (dwCodePages
& cs
.fs
.fsCsb
[0]))
1449 TRACE("Found Default Codepage\n");
1450 *puCodePage
= uDefaultCodePage
;
1455 for (i
= 0; i
< 32; i
++)
1459 if (dwCodePages
& mask
)
1464 rc
= TranslateCharsetInfo((DWORD
*)Csb
, &cs
, TCI_SRCFONTSIG
);
1468 TRACE("Falling back to least significant found CodePage %u\n",
1470 *puCodePage
= cs
.ciACP
;
1475 TRACE("no codepage found\n");
1479 static HRESULT WINAPI
fnIMLangFontLink_GetFontCodePages(
1480 IMLangFontLink
* iface
,
1483 DWORD
* pdwCodePages
)
1486 FONTSIGNATURE fontsig
;
1487 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMLangFontLink
, iface
);
1489 TRACE("(%p)\n",This
);
1491 old_font
= SelectObject(hDC
,hFont
);
1492 GetTextCharsetInfo(hDC
,&fontsig
, 0);
1493 SelectObject(hDC
,old_font
);
1495 *pdwCodePages
= fontsig
.fsCsb
[0];
1496 TRACE("CodePages is 0x%x\n",fontsig
.fsCsb
[0]);
1501 static HRESULT WINAPI
fnIMLangFontLink_MapFont(
1502 IMLangFontLink
* iface
,
1512 static HRESULT WINAPI
fnIMLangFontLink_ReleaseFont(
1513 IMLangFontLink
* iface
,
1520 static HRESULT WINAPI
fnIMLangFontLink_ResetFontMapping(
1521 IMLangFontLink
* iface
)
1528 static const IMLangFontLinkVtbl IMLangFontLink_vtbl
=
1530 fnIMLangFontLink_QueryInterface
,
1531 fnIMLangFontLink_AddRef
,
1532 fnIMLangFontLink_Release
,
1533 fnIMLangFontLink_GetCharCodePages
,
1534 fnIMLangFontLink_GetStrCodePages
,
1535 fnIMLangFontLink_CodePageToCodePages
,
1536 fnIMLangFontLink_CodePagesToCodePage
,
1537 fnIMLangFontLink_GetFontCodePages
,
1538 fnIMLangFontLink_MapFont
,
1539 fnIMLangFontLink_ReleaseFont
,
1540 fnIMLangFontLink_ResetFontMapping
,
1543 /******************************************************************************/
1545 static HRESULT WINAPI
fnIMultiLanguage_QueryInterface(
1546 IMultiLanguage
* iface
,
1550 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1551 return MLang_QueryInterface( This
, riid
, ppvObject
);
1554 static ULONG WINAPI
fnIMultiLanguage_AddRef( IMultiLanguage
* iface
)
1556 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1557 return IMLangFontLink_AddRef( ((IMLangFontLink
*)This
) );
1560 static ULONG WINAPI
fnIMultiLanguage_Release( IMultiLanguage
* iface
)
1562 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1563 return IMLangFontLink_Release( ((IMLangFontLink
*)This
) );
1566 static HRESULT WINAPI
fnIMultiLanguage_GetNumberOfCodePageInfo(
1567 IMultiLanguage
* iface
,
1574 static HRESULT WINAPI
fnIMultiLanguage_GetCodePageInfo(
1575 IMultiLanguage
* iface
,
1577 PMIMECPINFO pCodePageInfo
)
1581 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1582 TRACE("%p, %u, %p\n", This
, uiCodePage
, pCodePageInfo
);
1584 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
1586 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
1588 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
1590 fill_cp_info(&mlang_data
[i
], n
, pCodePageInfo
);
1599 static HRESULT WINAPI
fnIMultiLanguage_GetFamilyCodePage(
1600 IMultiLanguage
* iface
,
1602 UINT
* puiFamilyCodePage
)
1604 return GetFamilyCodePage(uiCodePage
, puiFamilyCodePage
);
1607 static HRESULT WINAPI
fnIMultiLanguage_EnumCodePages(
1608 IMultiLanguage
* iface
,
1610 IEnumCodePage
** ppEnumCodePage
)
1612 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1613 TRACE("%p %08x %p\n", This
, grfFlags
, ppEnumCodePage
);
1615 return EnumCodePage_create( This
, grfFlags
, 0, ppEnumCodePage
);
1618 static HRESULT WINAPI
fnIMultiLanguage_GetCharsetInfo(
1619 IMultiLanguage
* iface
,
1621 PMIMECSETINFO pCharsetInfo
)
1627 static HRESULT WINAPI
fnIMultiLanguage_IsConvertible(
1628 IMultiLanguage
* iface
,
1629 DWORD dwSrcEncoding
,
1630 DWORD dwDstEncoding
)
1632 return IsConvertINetStringAvailable(dwSrcEncoding
, dwDstEncoding
);
1635 static HRESULT WINAPI
fnIMultiLanguage_ConvertString(
1636 IMultiLanguage
* iface
,
1638 DWORD dwSrcEncoding
,
1639 DWORD dwDstEncoding
,
1645 return ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
,
1646 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, (LPSTR
)pDstStr
, (LPINT
)pcDstSize
);
1649 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringToUnicode(
1650 IMultiLanguage
* iface
,
1658 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
1659 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
1662 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringFromUnicode(
1663 IMultiLanguage
* iface
,
1671 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
1672 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
1675 static HRESULT WINAPI
fnIMultiLanguage_ConvertStringReset(
1676 IMultiLanguage
* iface
)
1682 static HRESULT WINAPI
fnIMultiLanguage_GetRfc1766FromLcid(
1683 IMultiLanguage
* iface
,
1687 WCHAR buf
[MAX_RFC1766_NAME
];
1689 TRACE("%p %04x %p\n", iface
, lcid
, pbstrRfc1766
);
1691 if (lcid_to_rfc1766W( lcid
, buf
, MAX_RFC1766_NAME
))
1693 *pbstrRfc1766
= SysAllocString( buf
);
1699 static HRESULT WINAPI
fnIMultiLanguage_GetLcidFromRfc1766(
1700 IMultiLanguage
* iface
,
1705 IEnumRfc1766
*rfc1766
;
1707 TRACE("%p %p %s\n", iface
, pLocale
, debugstr_w(bstrRfc1766
));
1709 if (!pLocale
|| !bstrRfc1766
)
1710 return E_INVALIDARG
;
1712 hr
= IMultiLanguage_EnumRfc1766(iface
, &rfc1766
);
1716 hr
= lcid_from_rfc1766(rfc1766
, pLocale
, bstrRfc1766
);
1718 IEnumRfc1766_Release(rfc1766
);
1722 /******************************************************************************/
1724 typedef struct tagEnumRfc1766_impl
1726 const IEnumRfc1766Vtbl
*vtbl_IEnumRfc1766
;
1732 static HRESULT WINAPI
fnIEnumRfc1766_QueryInterface(
1733 IEnumRfc1766
*iface
,
1737 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1739 TRACE("%p -> %s\n", This
, debugstr_guid(riid
) );
1741 if (IsEqualGUID(riid
, &IID_IUnknown
)
1742 || IsEqualGUID(riid
, &IID_IEnumRfc1766
))
1744 IEnumRfc1766_AddRef(iface
);
1745 TRACE("Returning IID_IEnumRfc1766 %p ref = %d\n", This
, This
->ref
);
1746 *ppvObject
= &(This
->vtbl_IEnumRfc1766
);
1750 WARN("(%p) -> (%s,%p), not found\n",This
,debugstr_guid(riid
),ppvObject
);
1751 return E_NOINTERFACE
;
1754 static ULONG WINAPI
fnIEnumRfc1766_AddRef(
1755 IEnumRfc1766
*iface
)
1757 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1758 return InterlockedIncrement(&This
->ref
);
1761 static ULONG WINAPI
fnIEnumRfc1766_Release(
1762 IEnumRfc1766
*iface
)
1764 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1765 ULONG ref
= InterlockedDecrement(&This
->ref
);
1767 TRACE("%p ref = %d\n", This
, ref
);
1770 TRACE("Destroying %p\n", This
);
1771 HeapFree(GetProcessHeap(), 0, This
->info
);
1772 HeapFree(GetProcessHeap(), 0, This
);
1777 static HRESULT WINAPI
fnIEnumRfc1766_Clone(
1778 IEnumRfc1766
*iface
,
1779 IEnumRfc1766
**ppEnum
)
1781 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1782 FIXME("%p %p\n", This
, ppEnum
);
1786 static HRESULT WINAPI
fnIEnumRfc1766_Next(
1787 IEnumRfc1766
*iface
,
1790 ULONG
*pceltFetched
)
1794 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1795 TRACE("%p %u %p %p\n", This
, celt
, rgelt
, pceltFetched
);
1797 if (!pceltFetched
) return S_FALSE
;
1800 if (!rgelt
) return S_FALSE
;
1802 if (This
->pos
+ celt
> This
->total
)
1803 celt
= This
->total
- This
->pos
;
1805 if (!celt
) return S_FALSE
;
1807 memcpy(rgelt
, This
->info
+ This
->pos
, celt
* sizeof(RFC1766INFO
));
1808 *pceltFetched
= celt
;
1811 for (i
= 0; i
< celt
; i
++)
1813 TRACE("#%u: %08x %s %s\n",
1815 wine_dbgstr_w(rgelt
[i
].wszRfc1766
),
1816 wine_dbgstr_w(rgelt
[i
].wszLocaleName
));
1821 static HRESULT WINAPI
fnIEnumRfc1766_Reset(
1822 IEnumRfc1766
*iface
)
1824 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1825 TRACE("%p\n", This
);
1831 static HRESULT WINAPI
fnIEnumRfc1766_Skip(
1832 IEnumRfc1766
*iface
,
1835 ICOM_THIS_MULTI(EnumRfc1766_impl
, vtbl_IEnumRfc1766
, iface
);
1836 TRACE("%p %u\n", This
, celt
);
1838 if (celt
>= This
->total
) return S_FALSE
;
1844 static const IEnumRfc1766Vtbl IEnumRfc1766_vtbl
=
1846 fnIEnumRfc1766_QueryInterface
,
1847 fnIEnumRfc1766_AddRef
,
1848 fnIEnumRfc1766_Release
,
1849 fnIEnumRfc1766_Clone
,
1850 fnIEnumRfc1766_Next
,
1851 fnIEnumRfc1766_Reset
,
1855 struct enum_locales_data
1858 DWORD total
, allocated
;
1861 static BOOL CALLBACK
enum_locales_proc(LPWSTR locale
)
1864 struct enum_locales_data
*data
= TlsGetValue(MLANG_tls_index
);
1867 TRACE("%s\n", debugstr_w(locale
));
1869 if (data
->total
>= data
->allocated
)
1871 data
->allocated
+= 32;
1872 data
->info
= HeapReAlloc(GetProcessHeap(), 0, data
->info
, data
->allocated
* sizeof(RFC1766INFO
));
1873 if (!data
->info
) return FALSE
;
1876 info
= &data
->info
[data
->total
];
1878 info
->lcid
= strtolW(locale
, &end
, 16);
1879 if (*end
) /* invalid number */
1882 info
->wszRfc1766
[0] = 0;
1883 lcid_to_rfc1766W( info
->lcid
, info
->wszRfc1766
, MAX_RFC1766_NAME
);
1885 info
->wszLocaleName
[0] = 0;
1886 GetLocaleInfoW(info
->lcid
, LOCALE_SLANGUAGE
, info
->wszLocaleName
, MAX_LOCALE_NAME
);
1887 TRACE("ISO639: %s SLANGUAGE: %s\n", wine_dbgstr_w(info
->wszRfc1766
), wine_dbgstr_w(info
->wszLocaleName
));
1894 static HRESULT
EnumRfc1766_create(LANGID LangId
, IEnumRfc1766
**ppEnum
)
1896 EnumRfc1766_impl
*rfc
;
1897 struct enum_locales_data data
;
1899 TRACE("%04x, %p\n", LangId
, ppEnum
);
1901 rfc
= HeapAlloc( GetProcessHeap(), 0, sizeof(EnumRfc1766_impl
) );
1902 rfc
->vtbl_IEnumRfc1766
= &IEnumRfc1766_vtbl
;
1908 data
.allocated
= 32;
1909 data
.info
= HeapAlloc(GetProcessHeap(), 0, data
.allocated
* sizeof(RFC1766INFO
));
1912 HeapFree(GetProcessHeap(), 0, rfc
);
1916 TlsSetValue(MLANG_tls_index
, &data
);
1917 EnumSystemLocalesW(enum_locales_proc
, 0/*LOCALE_SUPPORTED*/);
1918 TlsSetValue(MLANG_tls_index
, NULL
);
1920 TRACE("enumerated %d rfc1766 structures\n", data
.total
);
1924 HeapFree(GetProcessHeap(), 0, data
.info
);
1925 HeapFree(GetProcessHeap(), 0, rfc
);
1929 rfc
->info
= data
.info
;
1930 rfc
->total
= data
.total
;
1932 *ppEnum
= (IEnumRfc1766
*)rfc
;
1936 static HRESULT WINAPI
fnIMultiLanguage_EnumRfc1766(
1937 IMultiLanguage
*iface
,
1938 IEnumRfc1766
**ppEnumRfc1766
)
1940 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
1941 TRACE("%p %p\n", This
, ppEnumRfc1766
);
1943 return EnumRfc1766_create(0, ppEnumRfc1766
);
1946 /******************************************************************************/
1948 static HRESULT WINAPI
fnIMultiLanguage_GetRfc1766Info(
1949 IMultiLanguage
* iface
,
1951 PRFC1766INFO pRfc1766Info
)
1957 static HRESULT WINAPI
fnIMultiLanguage_CreateConvertCharset(
1958 IMultiLanguage
* iface
,
1962 IMLangConvertCharset
** ppMLangConvertCharset
)
1968 static const IMultiLanguageVtbl IMultiLanguage_vtbl
=
1970 fnIMultiLanguage_QueryInterface
,
1971 fnIMultiLanguage_AddRef
,
1972 fnIMultiLanguage_Release
,
1973 fnIMultiLanguage_GetNumberOfCodePageInfo
,
1974 fnIMultiLanguage_GetCodePageInfo
,
1975 fnIMultiLanguage_GetFamilyCodePage
,
1976 fnIMultiLanguage_EnumCodePages
,
1977 fnIMultiLanguage_GetCharsetInfo
,
1978 fnIMultiLanguage_IsConvertible
,
1979 fnIMultiLanguage_ConvertString
,
1980 fnIMultiLanguage_ConvertStringToUnicode
,
1981 fnIMultiLanguage_ConvertStringFromUnicode
,
1982 fnIMultiLanguage_ConvertStringReset
,
1983 fnIMultiLanguage_GetRfc1766FromLcid
,
1984 fnIMultiLanguage_GetLcidFromRfc1766
,
1985 fnIMultiLanguage_EnumRfc1766
,
1986 fnIMultiLanguage_GetRfc1766Info
,
1987 fnIMultiLanguage_CreateConvertCharset
,
1991 /******************************************************************************/
1993 static HRESULT WINAPI
fnIMultiLanguage2_QueryInterface(
1994 IMultiLanguage3
* iface
,
1998 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
1999 return MLang_QueryInterface( This
, riid
, ppvObject
);
2002 static ULONG WINAPI
fnIMultiLanguage2_AddRef( IMultiLanguage3
* iface
)
2004 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2005 return MLang_AddRef( This
);
2008 static ULONG WINAPI
fnIMultiLanguage2_Release( IMultiLanguage3
* iface
)
2010 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2011 return MLang_Release( This
);
2014 static HRESULT WINAPI
fnIMultiLanguage2_GetNumberOfCodePageInfo(
2015 IMultiLanguage3
* iface
,
2018 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2019 TRACE("%p, %p\n", This
, pcCodePage
);
2021 if (!pcCodePage
) return S_FALSE
;
2023 *pcCodePage
= This
->total_cp
;
2027 static void fill_cp_info(const struct mlang_data
*ml_data
, UINT index
, MIMECPINFO
*mime_cp_info
)
2031 if (TranslateCharsetInfo((DWORD
*)ml_data
->family_codepage
, &csi
, TCI_SRCCODEPAGE
))
2032 mime_cp_info
->bGDICharset
= csi
.ciCharset
;
2034 mime_cp_info
->bGDICharset
= DEFAULT_CHARSET
;
2036 mime_cp_info
->dwFlags
= ml_data
->mime_cp_info
[index
].flags
;
2037 mime_cp_info
->uiCodePage
= ml_data
->mime_cp_info
[index
].cp
;
2038 mime_cp_info
->uiFamilyCodePage
= ml_data
->family_codepage
;
2039 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].description
, -1,
2040 mime_cp_info
->wszDescription
, sizeof(mime_cp_info
->wszDescription
)/sizeof(WCHAR
));
2041 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].web_charset
, -1,
2042 mime_cp_info
->wszWebCharset
, sizeof(mime_cp_info
->wszWebCharset
)/sizeof(WCHAR
));
2043 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].header_charset
, -1,
2044 mime_cp_info
->wszHeaderCharset
, sizeof(mime_cp_info
->wszHeaderCharset
)/sizeof(WCHAR
));
2045 MultiByteToWideChar(CP_ACP
, 0, ml_data
->mime_cp_info
[index
].body_charset
, -1,
2046 mime_cp_info
->wszBodyCharset
, sizeof(mime_cp_info
->wszBodyCharset
)/sizeof(WCHAR
));
2048 MultiByteToWideChar(CP_ACP
, 0, ml_data
->fixed_font
, -1,
2049 mime_cp_info
->wszFixedWidthFont
, sizeof(mime_cp_info
->wszFixedWidthFont
)/sizeof(WCHAR
));
2050 MultiByteToWideChar(CP_ACP
, 0, ml_data
->proportional_font
, -1,
2051 mime_cp_info
->wszProportionalFont
, sizeof(mime_cp_info
->wszProportionalFont
)/sizeof(WCHAR
));
2053 TRACE("%08x %u %u %s %s %s %s %s %s %d\n",
2054 mime_cp_info
->dwFlags
, mime_cp_info
->uiCodePage
,
2055 mime_cp_info
->uiFamilyCodePage
,
2056 wine_dbgstr_w(mime_cp_info
->wszDescription
),
2057 wine_dbgstr_w(mime_cp_info
->wszWebCharset
),
2058 wine_dbgstr_w(mime_cp_info
->wszHeaderCharset
),
2059 wine_dbgstr_w(mime_cp_info
->wszBodyCharset
),
2060 wine_dbgstr_w(mime_cp_info
->wszFixedWidthFont
),
2061 wine_dbgstr_w(mime_cp_info
->wszProportionalFont
),
2062 mime_cp_info
->bGDICharset
);
2065 static HRESULT WINAPI
fnIMultiLanguage2_GetCodePageInfo(
2066 IMultiLanguage3
* iface
,
2069 PMIMECPINFO pCodePageInfo
)
2073 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2074 TRACE("%p, %u, %04x, %p\n", This
, uiCodePage
, LangId
, pCodePageInfo
);
2076 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2078 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2080 if (mlang_data
[i
].mime_cp_info
[n
].cp
== uiCodePage
)
2082 fill_cp_info(&mlang_data
[i
], n
, pCodePageInfo
);
2091 static HRESULT WINAPI
fnIMultiLanguage2_GetFamilyCodePage(
2092 IMultiLanguage3
* iface
,
2094 UINT
* puiFamilyCodePage
)
2096 return GetFamilyCodePage(uiCodePage
, puiFamilyCodePage
);
2099 static HRESULT WINAPI
fnIMultiLanguage2_EnumCodePages(
2100 IMultiLanguage3
* iface
,
2103 IEnumCodePage
** ppEnumCodePage
)
2105 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2106 TRACE("%p %08x %04x %p\n", This
, grfFlags
, LangId
, ppEnumCodePage
);
2108 return EnumCodePage_create( This
, grfFlags
, LangId
, ppEnumCodePage
);
2111 static HRESULT WINAPI
fnIMultiLanguage2_GetCharsetInfo(
2112 IMultiLanguage3
* iface
,
2114 PMIMECSETINFO pCharsetInfo
)
2118 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2119 TRACE("%p %s %p\n", This
, debugstr_w(Charset
), pCharsetInfo
);
2121 if (!pCharsetInfo
) return E_FAIL
;
2123 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2125 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2127 WCHAR csetW
[MAX_MIMECSET_NAME
];
2129 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].mime_cp_info
[n
].web_charset
, -1, csetW
, MAX_MIMECSET_NAME
);
2130 if (!lstrcmpiW(Charset
, csetW
))
2132 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2133 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2134 strcpyW(pCharsetInfo
->wszCharset
, csetW
);
2141 * Since we do not support charsets like iso-2022-jp and do not have
2142 * them in our database as a primary (web_charset) encoding this loop
2143 * does an attempt to 'approximate' charset name by header_charset.
2145 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2147 for (n
= 0; n
< mlang_data
[i
].number_of_cp
; n
++)
2149 WCHAR csetW
[MAX_MIMECSET_NAME
];
2151 MultiByteToWideChar(CP_ACP
, 0, mlang_data
[i
].mime_cp_info
[n
].header_charset
, -1, csetW
, MAX_MIMECSET_NAME
);
2152 if (!lstrcmpiW(Charset
, csetW
))
2154 pCharsetInfo
->uiCodePage
= mlang_data
[i
].family_codepage
;
2155 pCharsetInfo
->uiInternetEncoding
= mlang_data
[i
].mime_cp_info
[n
].cp
;
2156 strcpyW(pCharsetInfo
->wszCharset
, csetW
);
2165 static HRESULT WINAPI
fnIMultiLanguage2_IsConvertible(
2166 IMultiLanguage3
* iface
,
2167 DWORD dwSrcEncoding
,
2168 DWORD dwDstEncoding
)
2170 return IsConvertINetStringAvailable(dwSrcEncoding
, dwDstEncoding
);
2173 static HRESULT WINAPI
fnIMultiLanguage2_ConvertString(
2174 IMultiLanguage3
* iface
,
2176 DWORD dwSrcEncoding
,
2177 DWORD dwDstEncoding
,
2183 return ConvertINetString(pdwMode
, dwSrcEncoding
, dwDstEncoding
,
2184 (LPCSTR
)pSrcStr
, (LPINT
)pcSrcSize
, (LPSTR
)pDstStr
, (LPINT
)pcDstSize
);
2187 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringToUnicode(
2188 IMultiLanguage3
* iface
,
2196 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
2197 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2200 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringFromUnicode(
2201 IMultiLanguage3
* iface
,
2209 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
2210 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2213 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringReset(
2214 IMultiLanguage3
* iface
)
2220 static HRESULT WINAPI
fnIMultiLanguage2_GetRfc1766FromLcid(
2221 IMultiLanguage3
* iface
,
2225 WCHAR buf
[MAX_RFC1766_NAME
];
2227 TRACE("%p %04x %p\n", iface
, lcid
, pbstrRfc1766
);
2229 if (lcid_to_rfc1766W( lcid
, buf
, MAX_RFC1766_NAME
))
2231 *pbstrRfc1766
= SysAllocString( buf
);
2237 static HRESULT WINAPI
fnIMultiLanguage2_GetLcidFromRfc1766(
2238 IMultiLanguage3
* iface
,
2243 IEnumRfc1766
*rfc1766
;
2245 TRACE("%p %p %s\n", iface
, pLocale
, debugstr_w(bstrRfc1766
));
2247 if (!pLocale
|| !bstrRfc1766
)
2248 return E_INVALIDARG
;
2250 hr
= IMultiLanguage2_EnumRfc1766(iface
, 0, &rfc1766
);
2254 hr
= lcid_from_rfc1766(rfc1766
, pLocale
, bstrRfc1766
);
2256 IEnumRfc1766_Release(rfc1766
);
2260 static HRESULT WINAPI
fnIMultiLanguage2_EnumRfc1766(
2261 IMultiLanguage3
* iface
,
2263 IEnumRfc1766
** ppEnumRfc1766
)
2265 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage
, iface
);
2266 TRACE("%p %p\n", This
, ppEnumRfc1766
);
2268 return EnumRfc1766_create(LangId
, ppEnumRfc1766
);
2271 static HRESULT WINAPI
fnIMultiLanguage2_GetRfc1766Info(
2272 IMultiLanguage3
* iface
,
2275 PRFC1766INFO pRfc1766Info
)
2281 static HRESULT WINAPI
fnIMultiLanguage2_CreateConvertCharset(
2282 IMultiLanguage3
* iface
,
2286 IMLangConvertCharset
** ppMLangConvertCharset
)
2292 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringInIStream(
2293 IMultiLanguage3
* iface
,
2297 DWORD dwSrcEncoding
,
2298 DWORD dwDstEncoding
,
2307 * TODO: handle dwFlag and lpFallBack
2309 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringToUnicodeEx(
2310 IMultiLanguage3
* iface
,
2321 return ConvertINetMultiByteToUnicode(pdwMode
, dwEncoding
,
2322 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2325 /*****************************************************************************
2326 * MultiLanguage2::ConvertStringToUnicodeEx
2328 * Translates the multibyte string from the specified code page to Unicode.
2331 * see ConvertStringToUnicode
2333 * lpFallBack if dwFlag contains MLCONVCHARF_USEDEFCHAR, lpFallBack string used
2334 * instead unconvertible characters.
2338 * S_FALSE The conversion is not supported.
2339 * E_FAIL Some error has occurred.
2341 * TODO: handle dwFlag and lpFallBack
2343 static HRESULT WINAPI
fnIMultiLanguage2_ConvertStringFromUnicodeEx(
2344 IMultiLanguage3
* This
,
2355 return ConvertINetUnicodeToMultiByte(pdwMode
, dwEncoding
,
2356 pSrcStr
, (LPINT
)pcSrcSize
, pDstStr
, (LPINT
)pcDstSize
);
2359 static HRESULT WINAPI
fnIMultiLanguage2_DetectCodepageInIStream(
2360 IMultiLanguage3
* iface
,
2362 DWORD dwPrefWinCodePage
,
2364 DetectEncodingInfo
* lpEncoding
,
2371 static HRESULT WINAPI
fnIMultiLanguage2_DetectInputCodepage(
2372 IMultiLanguage3
* iface
,
2374 DWORD dwPrefWinCodePage
,
2377 DetectEncodingInfo
* lpEncoding
,
2384 static HRESULT WINAPI
fnIMultiLanguage2_ValidateCodePage(
2385 IMultiLanguage3
* iface
,
2389 FIXME("%u, %p\n", uiCodePage
, hwnd
);
2393 static HRESULT WINAPI
fnIMultiLanguage2_GetCodePageDescription(
2394 IMultiLanguage3
* iface
,
2397 LPWSTR lpWideCharStr
,
2400 FIXME("%u, %04x, %p, %d\n", uiCodePage
, lcid
, lpWideCharStr
, cchWideChar
);
2404 static HRESULT WINAPI
fnIMultiLanguage2_IsCodePageInstallable(
2405 IMultiLanguage3
* iface
,
2408 FIXME("%u\n", uiCodePage
);
2412 static HRESULT WINAPI
fnIMultiLanguage2_SetMimeDBSource(
2413 IMultiLanguage3
* iface
,
2416 FIXME("0x%08x\n", dwSource
);
2420 static HRESULT WINAPI
fnIMultiLanguage2_GetNumberOfScripts(
2421 IMultiLanguage3
* iface
,
2424 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2425 TRACE("%p %p\n", This
, pnScripts
);
2427 if (!pnScripts
) return S_FALSE
;
2429 *pnScripts
= This
->total_scripts
;
2433 static HRESULT WINAPI
fnIMultiLanguage2_EnumScripts(
2434 IMultiLanguage3
* iface
,
2437 IEnumScript
** ppEnumScript
)
2439 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2440 TRACE("%p %08x %04x %p\n", This
, dwFlags
, LangId
, ppEnumScript
);
2442 return EnumScript_create( This
, dwFlags
, LangId
, ppEnumScript
);
2445 static HRESULT WINAPI
fnIMultiLanguage2_ValidateCodePageEx(
2446 IMultiLanguage3
* iface
,
2449 DWORD dwfIODControl
)
2451 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2452 FIXME("%p %u %p %08x: stub!\n", This
, uiCodePage
, hwnd
, dwfIODControl
);
2457 static HRESULT WINAPI
fnIMultiLanguage3_DetectOutboundCodePage(
2458 IMultiLanguage3
*iface
,
2460 LPCWSTR lpWideCharStr
,
2462 UINT
*puiPreferredCodePages
,
2463 UINT nPreferredCodePages
,
2464 UINT
*puiDetectedCodePages
,
2465 UINT
*pnDetectedCodePages
,
2466 WCHAR
*lpSpecialChar
)
2468 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2469 FIXME("(%p)->(%08x %s %u %p %u %p %p %p)\n", This
, dwFlags
, debugstr_w(lpWideCharStr
),
2470 cchWideChar
, puiPreferredCodePages
, nPreferredCodePages
, puiDetectedCodePages
,
2471 pnDetectedCodePages
, lpSpecialChar
);
2475 static HRESULT WINAPI
fnIMultiLanguage3_DetectOutboundCodePageInIStream(
2476 IMultiLanguage3
*iface
,
2479 UINT
*puiPreferredCodePages
,
2480 UINT nPreferredCodePages
,
2481 UINT
*puiDetectedCodePages
,
2482 UINT
*pnDetectedCodePages
,
2483 WCHAR
*lpSpecialChar
)
2485 ICOM_THIS_MULTI(MLang_impl
, vtbl_IMultiLanguage3
, iface
);
2486 FIXME("(%p)->(%08x %p %p %u %p %p %p)\n", This
, dwFlags
, pStrIn
,
2487 puiPreferredCodePages
, nPreferredCodePages
, puiDetectedCodePages
,
2488 pnDetectedCodePages
, lpSpecialChar
);
2492 static const IMultiLanguage3Vtbl IMultiLanguage3_vtbl
=
2494 fnIMultiLanguage2_QueryInterface
,
2495 fnIMultiLanguage2_AddRef
,
2496 fnIMultiLanguage2_Release
,
2497 fnIMultiLanguage2_GetNumberOfCodePageInfo
,
2498 fnIMultiLanguage2_GetCodePageInfo
,
2499 fnIMultiLanguage2_GetFamilyCodePage
,
2500 fnIMultiLanguage2_EnumCodePages
,
2501 fnIMultiLanguage2_GetCharsetInfo
,
2502 fnIMultiLanguage2_IsConvertible
,
2503 fnIMultiLanguage2_ConvertString
,
2504 fnIMultiLanguage2_ConvertStringToUnicode
,
2505 fnIMultiLanguage2_ConvertStringFromUnicode
,
2506 fnIMultiLanguage2_ConvertStringReset
,
2507 fnIMultiLanguage2_GetRfc1766FromLcid
,
2508 fnIMultiLanguage2_GetLcidFromRfc1766
,
2509 fnIMultiLanguage2_EnumRfc1766
,
2510 fnIMultiLanguage2_GetRfc1766Info
,
2511 fnIMultiLanguage2_CreateConvertCharset
,
2512 fnIMultiLanguage2_ConvertStringInIStream
,
2513 fnIMultiLanguage2_ConvertStringToUnicodeEx
,
2514 fnIMultiLanguage2_ConvertStringFromUnicodeEx
,
2515 fnIMultiLanguage2_DetectCodepageInIStream
,
2516 fnIMultiLanguage2_DetectInputCodepage
,
2517 fnIMultiLanguage2_ValidateCodePage
,
2518 fnIMultiLanguage2_GetCodePageDescription
,
2519 fnIMultiLanguage2_IsCodePageInstallable
,
2520 fnIMultiLanguage2_SetMimeDBSource
,
2521 fnIMultiLanguage2_GetNumberOfScripts
,
2522 fnIMultiLanguage2_EnumScripts
,
2523 fnIMultiLanguage2_ValidateCodePageEx
,
2524 fnIMultiLanguage3_DetectOutboundCodePage
,
2525 fnIMultiLanguage3_DetectOutboundCodePageInIStream
2528 static HRESULT
MultiLanguage_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
2533 TRACE("Creating MultiLanguage object\n");
2536 return CLASS_E_NOAGGREGATION
;
2538 mlang
= HeapAlloc( GetProcessHeap(), 0, sizeof (MLang_impl
) );
2539 mlang
->vtbl_IMLangFontLink
= &IMLangFontLink_vtbl
;
2540 mlang
->vtbl_IMultiLanguage
= &IMultiLanguage_vtbl
;
2541 mlang
->vtbl_IMultiLanguage3
= &IMultiLanguage3_vtbl
;
2543 mlang
->total_cp
= 0;
2544 for (i
= 0; i
< sizeof(mlang_data
)/sizeof(mlang_data
[0]); i
++)
2545 mlang
->total_cp
+= mlang_data
[i
].number_of_cp
;
2547 /* do not enumerate unicode flavours */
2548 mlang
->total_scripts
= sizeof(mlang_data
)/sizeof(mlang_data
[0]) - 1;
2551 *ppObj
= (LPVOID
) mlang
;
2552 TRACE("returning %p\n", mlang
);
2559 /******************************************************************************/
2561 HRESULT WINAPI
DllCanUnloadNow(void)
2563 return dll_count
== 0 ? S_OK
: S_FALSE
;
2566 HRESULT WINAPI
GetGlobalFontLinkObject(void)