2 * Unit test suite for MLANG APIs.
4 * Copyright 2004 Dmitry Timoshkov
5 * Copyright 2009 Detlef Riekenberg
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/test.h"
36 #define CP_UNICODE 1200
39 /* #define DUMP_CP_INFO */
40 /* #define DUMP_SCRIPT_INFO */
42 static BOOL (WINAPI
*pGetCPInfoExA
)(UINT
, DWORD
, LPCPINFOEXA
);
43 static HRESULT (WINAPI
*pConvertINetMultiByteToUnicode
)(LPDWORD
, DWORD
, LPCSTR
,
44 LPINT
, LPWSTR
, LPINT
);
45 static HRESULT (WINAPI
*pConvertINetUnicodeToMultiByte
)(LPDWORD
, DWORD
, LPCWSTR
,
47 static HRESULT (WINAPI
*pRfc1766ToLcidA
)(LCID
*, LPCSTR
);
48 static HRESULT (WINAPI
*pLcidToRfc1766A
)(LCID
, LPSTR
, INT
);
50 typedef struct lcid_tag_table
{
58 /* en, ar and zh use SUBLANG_NEUTRAL for the rfc1766 name without the country
59 all others suppress the country with SUBLANG_DEFAULT.
60 For 3 letter language codes, the rfc1766 is too small for the country */
62 static const lcid_table_entry lcid_table
[] = {
72 {"de-ch", 0x0807, S_OK
},
73 {"de-at", 0x0c07, S_OK
},
74 {"de-lu", 0x1007, S_OK
},
75 {"de-li", 0x1407, S_OK
},
78 {"en-gb", 0x809, S_OK
},
79 {"en-GB", 0x809, S_OK
},
80 {"EN-GB", 0x809, S_OK
},
81 {"en-US", 0x409, S_OK
},
82 {"en-us", 0x409, S_OK
},
85 {"fr-be", 0x080c, S_OK
},
86 {"fr-ca", 0x0c0c, S_OK
},
87 {"fr-ch", 0x100c, S_OK
},
88 {"fr-lu", 0x140c, S_OK
},
89 {"fr-mc", 0x180c, S_OK
, 0x040c, "fr"},
92 {"it-ch", 0x0810, S_OK
},
95 {"nl-be", 0x0813, S_OK
},
99 {"kok", 0x0457, S_OK
, 0x0412, "x-kok"}
105 typedef struct info_table_tag
{
114 static const WCHAR de_en
[] = {'E','n','g','l','i','s','c','h',0};
115 static const WCHAR de_enca
[] = {'E','n','g','l','i','s','c','h',' ',
116 '(','K','a','n','a','d','a',')',0};
117 static const WCHAR de_engb
[] = {'E','n','g','l','i','s','c','h',' ',
118 '(','G','r','o',0xDF,'b','r','i','t','a','n','n','i','e','n',')',0};
119 static const WCHAR de_engb2
[] ={'E','n','g','l','i','s','c','h',' ',
120 '(','V','e','r','e','i','n','i','g','t','e','s',' ',
121 'K',0xF6,'n','i','g','r','e','i','c',0};
122 static const WCHAR de_enus
[] = {'E','n','g','l','i','s','c','h',' ',
123 '(','U','S','A',')',0};
124 static const WCHAR de_enus2
[] ={'E','n','g','l','i','s','c','h',' ',
125 '(','V','e','r','e','i','n','i','g','t','e',' ',
126 'S','t','a','a','t','e','n',')',0};
127 static const WCHAR de_de
[] = {'D','e','u','t','s','c','h',' ',
128 '(','D','e','u','t','s','c','h','l','a','n','d',')',0};
129 static const WCHAR de_deat
[] = {'D','e','u','t','s','c','h',' ',
130 '(',0xD6,'s','t','e','r','r','e','i','c','h',')',0};
131 static const WCHAR de_dech
[] = {'D','e','u','t','s','c','h',' ',
132 '(','S','c','h','w','e','i','z',')',0};
134 static const WCHAR en_en
[] = {'E','n','g','l','i','s','h',0};
135 static const WCHAR en_enca
[] = {'E','n','g','l','i','s','h',' ',
136 '(','C','a','n','a','d','a',')',0};
137 static const WCHAR en_engb
[] = {'E','n','g','l','i','s','h',' ',
138 '(','U','n','i','t','e','d',' ','K','i','n','g','d','o','m',')',0};
139 static const WCHAR en_enus
[] = {'E','n','g','l','i','s','h',' ',
140 '(','U','n','i','t','e','d',' ','S','t','a','t','e','s',')',0};
141 static const WCHAR en_de
[] = {'G','e','r','m','a','n',' ',
142 '(','G','e','r','m','a','n','y',')',0};
143 static const WCHAR en_deat
[] = {'G','e','r','m','a','n',' ',
144 '(','A','u','s','t','r','i','a',')',0};
145 static const WCHAR en_dech
[] = {'G','e','r','m','a','n',' ',
146 '(','S','w','i','t','z','e','r','l','a','n','d',')',0};
148 static const WCHAR fr_en
[] = {'A','n','g','l','a','i','s',0};
149 static const WCHAR fr_enca
[] = {'A','n','g','l','a','i','s',' ',
150 '(','C','a','n','a','d','a',')',0};
151 static const WCHAR fr_engb
[] = {'A','n','g','l','a','i','s',' ',
152 '(','R','o','y','a','u','m','e','-','U','n','i',')',0};
153 static const WCHAR fr_enus
[] = {'A','n','g','l','a','i','s',' ',
154 '(',0xC9, 't','a','t','s','-','U','n','i','s',')',0};
155 static const WCHAR fr_enus2
[] ={'A','n','g','l','a','i','s',' ',
156 '(','U','.','S','.',')',0};
157 static const WCHAR fr_de
[] = {'A','l','l','e','m','a','n','d',' ',
158 '(','A','l','l','e','m','a','g','n','e',')',0};
159 static const WCHAR fr_de2
[] = {'A','l','l','e','m','a','n','d',' ',
160 '(','S','t','a','n','d','a','r','d',')',0};
161 static const WCHAR fr_deat
[] = {'A','l','l','e','m','a','n','d',' ',
162 '(','A','u','t','r','i','c','h','e',')',0};
163 static const WCHAR fr_dech
[] = {'A','l','l','e','m','a','n','d',' ',
164 '(','S','u','i','s','s','e',')',0};
166 static const info_table_entry info_table
[] = {
167 {MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
169 {MAKELANGID(LANG_ENGLISH
, SUBLANG_DEFAULT
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
170 0, "en-us", en_enus
},
171 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_UK
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
172 0, "en-gb", en_engb
},
173 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
174 0, "en-us", en_enus
},
175 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_CAN
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
176 0, "en-ca", en_enca
},
178 {MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
180 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
182 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN_SWISS
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
183 0, "de-ch", en_dech
},
184 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN_AUSTRIAN
), MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
),
185 0, "de-at", en_deat
},
187 {MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
188 TODO_NAME
, "en", de_en
},
189 {MAKELANGID(LANG_ENGLISH
, SUBLANG_DEFAULT
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
190 TODO_NAME
, "en-us", de_enus
, de_enus2
},
191 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_UK
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
192 TODO_NAME
, "en-gb", de_engb
, de_engb2
},
193 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
194 TODO_NAME
, "en-us", de_enus
, de_enus2
},
195 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_CAN
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
196 TODO_NAME
, "en-ca", de_enca
},
198 {MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
199 TODO_NAME
, "de", de_de
},
200 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
201 TODO_NAME
, "de",de_de
},
202 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN_SWISS
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
203 TODO_NAME
, "de-ch", de_dech
},
204 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN_AUSTRIAN
), MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
),
205 TODO_NAME
, "de-at", de_deat
},
207 {MAKELANGID(LANG_ENGLISH
, SUBLANG_NEUTRAL
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
208 TODO_NAME
, "en", fr_en
},
209 {MAKELANGID(LANG_ENGLISH
, SUBLANG_DEFAULT
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
210 TODO_NAME
, "en-us", fr_enus
, fr_enus2
},
211 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_UK
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
212 TODO_NAME
, "en-gb", fr_engb
},
213 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
214 TODO_NAME
, "en-us", fr_enus
, fr_enus2
},
215 {MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_CAN
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
216 TODO_NAME
, "en-ca", fr_enca
},
218 {MAKELANGID(LANG_GERMAN
, SUBLANG_DEFAULT
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
219 TODO_NAME
, "de", fr_de
, fr_de2
},
220 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
221 TODO_NAME
, "de", fr_de
, fr_de2
},
222 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN_SWISS
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
223 TODO_NAME
, "de-ch", fr_dech
},
224 {MAKELANGID(LANG_GERMAN
, SUBLANG_GERMAN_AUSTRIAN
), MAKELANGID(LANG_FRENCH
, SUBLANG_DEFAULT
),
225 TODO_NAME
, "de-at", fr_deat
}
229 struct cpinfo_test_data
233 BOOL todo_GetCodePageInfo
;
235 BOOL todo_uiFamilyCodePage
;
236 BOOL todo_wszDescription
;
237 BOOL todo_wszWebCharset
;
238 BOOL todo_wszHeaderCharset
;
239 BOOL todo_wszBodyCharset
;
240 BOOL todo_wszFixedWidthFont
;
241 BOOL todo_wszProportionalFont
;
244 const static struct cpinfo_test_data iml2_cpinfo_data
[] =
246 /* 0. Chinese Simplified (Auto-Select) */
249 MIMECONTF_IMPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
250 50936, 936, {'C','h','i','n','e','s','e',' ','S','i','m','p','l','i','f','i','e','d',' ','(','A','u','t','o','-','S','e','l','e','c','t',')',0},
251 {'_','a','u','t','o','d','e','t','e','c','t','_','c','h','s',0},
252 {'_','a','u','t','o','d','e','t','e','c','t','_','c','h','s',0},
253 {'_','a','u','t','o','d','e','t','e','c','t','_','c','h','s',0},
254 {'S','i','m','s','u','n',0},
255 {'S','i','m','s','u','n',0}, 134
258 /* 1. Chinese Simplified (GB2312) */
261 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
262 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
263 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
264 936, 936, {'C','h','i','n','e','s','e',' ','S','i','m','p','l','i','f','i','e','d',' ','(','G','B','2','3','1','2',')',0},
265 {'g','b','2','3','1','2',0},
266 {'g','b','2','3','1','2',0},
267 {'g','b','2','3','1','2',0},
268 {'S','i','m','s','u','n',0},
269 {'S','i','m','s','u','n',0}, 134
272 /* 2. Chinese Simplified (GB2312-80) */
275 MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
276 MIMECONTF_MIME_LATEST
,
277 20936, 936, {'C','h','i','n','e','s','e',' ','S','i','m','p','l','i','f','i','e','d',' ','(','G','B','2','3','1','2','-','8','0',')',0},
278 {'x','-','c','p','2','0','9','3','6',0},
279 {'x','-','c','p','2','0','9','3','6',0},
280 {'x','-','c','p','2','0','9','3','6',0},
281 {'S','i','m','s','u','n',0},
282 {'S','i','m','s','u','n',0}, 134
285 /* 3. Chinese Simplified (HZ) */
288 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
289 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
290 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
291 52936, 936, {'C','h','i','n','e','s','e',' ','S','i','m','p','l','i','f','i','e','d',' ','(','H','Z',')',0},
292 {'h','z','-','g','b','-','2','3','1','2',0},
293 {'h','z','-','g','b','-','2','3','1','2',0},
294 {'h','z','-','g','b','-','2','3','1','2',0},
295 {'S','i','m','s','u','n',0},
296 {'S','i','m','s','u','n',0}, 134
299 /* 4. Chinese Simplified (GB18030) */
302 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
303 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
304 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
305 54936, 936, {'C','h','i','n','e','s','e',' ','S','i','m','p','l','i','f','i','e','d',' ','(','G','B','1','8','0','3','0',')',0},
306 {'G','B','1','8','0','3','0',0},
307 {'G','B','1','8','0','3','0',0},
308 {'G','B','1','8','0','3','0',0},
309 {'S','i','m','s','u','n',0},
310 {'S','i','m','s','u','n',0}, 134
313 /* 5. Chinese Traditional (Auto-Select) */
316 MIMECONTF_IMPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
317 50950, 950, {'C','h','i','n','e','s','e',' ','T','r','a','d','i','t','i','o','n','a','l',' ','(','A','u','t','o','-','S','e','l','e','c','t',')',0},
318 {'_','a','u','t','o','d','e','t','e','c','t','_','c','h','t',0},
319 {'_','a','u','t','o','d','e','t','e','c','t','_','c','h','t',0},
320 {'_','a','u','t','o','d','e','t','e','c','t','_','c','h','t',0},
321 {'M','i','n','g','L','i','u',0},
322 {'N','e','w',' ','M','i','n','g','L','i','u',0}, 136
325 /* 6. Chinese Traditional (Big5) */
328 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
329 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
330 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
331 950, 950, {'C','h','i','n','e','s','e',' ','T','r','a','d','i','t','i','o','n','a','l',' ','(','B','i','g','5',')',0},
335 {'M','i','n','g','L','i','u',0},
336 {'N','e','w',' ','M','i','n','g','L','i','u',0}, 136
339 /* 7. Chinese Traditional (CNS) */
342 MIMECONTF_IMPORT
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
343 MIMECONTF_MIME_LATEST
,
344 20000, 950, {'C','h','i','n','e','s','e',' ','T','r','a','d','i','t','i','o','n','a','l',' ','(','C','N','S',')',0},
345 {'x','-','C','h','i','n','e','s','e','-','C','N','S',0},
346 {'x','-','C','h','i','n','e','s','e','-','C','N','S',0},
347 {'x','-','C','h','i','n','e','s','e','-','C','N','S',0},
348 {'M','i','n','g','L','i','u',0},
349 {'N','e','w',' ','M','i','n','g','L','i','u',0}, 136
352 /* 8. Arabic (Windows) */
355 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
356 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
357 MIMECONTF_MIME_LATEST
,
358 1256, 1256, {'A','r','a','b','i','c',' ','(','W','i','n','d','o','w','s',')',0},
359 {'w','i','n','d','o','w','s','-','1','2','5','6',0},
360 {'w','i','n','d','o','w','s','-','1','2','5','6',0},
361 {'w','i','n','d','o','w','s','-','1','2','5','6',0},
362 {'S','i','m','p','l','i','f','i','e','d',' ','A','r','a','b','i','c',' ','F','i','x','e','d',0},
363 {'S','i','m','p','l','i','f','i','e','d',' ','A','r','a','b','i','c',0}, 178
366 /* 9. Baltic (Windows) */
369 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
370 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
371 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
372 1257, 1257, {'B','a','l','t','i','c',' ','(','W','i','n','d','o','w','s',')',0},
373 {'w','i','n','d','o','w','s','-','1','2','5','7',0},
374 {'w','i','n','d','o','w','s','-','1','2','5','7',0},
375 {'w','i','n','d','o','w','s','-','1','2','5','7',0},
376 {'C','o','u','r','i','e','r',' ','N','e','w',0},
377 {'A','r','i','a','l',0}, 186
380 /* 10. Central European (Windows) */
383 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
384 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
385 MIMECONTF_MIME_LATEST
,
386 1250, 1250, {'C','e','n','t','r','a','l',' ','E','u','r','o','p','e','a','n',' ','(','W','i','n','d','o','w','s',')',0},
387 {'w','i','n','d','o','w','s','-','1','2','5','0',0},
388 {'w','i','n','d','o','w','s','-','1','2','5','0',0},
389 {'i','s','o','-','8','8','5','9','-','2',0},
390 {'C','o','u','r','i','e','r',' ','N','e','w',0},
391 {'A','r','i','a','l',0}, 238
393 FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, TRUE
395 /* 11. Cyrillic (Windows) */
398 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
399 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
400 MIMECONTF_MIME_LATEST
,
401 1251, 1251, {'C','y','r','i','l','l','i','c',' ','(','W','i','n','d','o','w','s',')',0},
402 {'w','i','n','d','o','w','s','-','1','2','5','1',0},
403 {'w','i','n','d','o','w','s','-','1','2','5','1',0},
404 {'k','o','i','8','-','r',0},
405 {'C','o','u','r','i','e','r',' ','N','e','w',0},
406 {'A','r','i','a','l',0}, 204
408 FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, TRUE
410 /* 12. Greek (Windows) */
413 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
414 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
415 MIMECONTF_MIME_LATEST
,
416 1253, 1253, {'G','r','e','e','k',' ','(','W','i','n','d','o','w','s',')',0},
417 {'w','i','n','d','o','w','s','-','1','2','5','3',0},
418 {'w','i','n','d','o','w','s','-','1','2','5','3',0},
419 {'i','s','o','-','8','8','5','9','-','7',0},
420 {'C','o','u','r','i','e','r',' ','N','e','w',0},
421 {'A','r','i','a','l',0}, 161
423 FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, TRUE
425 /* 13. Hebrew (Windows) */
428 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
429 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
430 MIMECONTF_MIME_LATEST
,
431 1255, 1255, {'H','e','b','r','e','w',' ','(','W','i','n','d','o','w','s',')',0},
432 {'w','i','n','d','o','w','s','-','1','2','5','5',0},
433 {'w','i','n','d','o','w','s','-','1','2','5','5',0},
434 {'w','i','n','d','o','w','s','-','1','2','5','5',0},
435 {'M','i','r','i','a','m',' ','F','i','x','e','d',0},
436 {'D','a','v','i','d',0}, 177
439 /* 14. Japanese (Shift-JIS) */
442 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
443 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
444 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
445 932, 932, {'J','a','p','a','n','e','s','e',' ','(','S','h','i','f','t','-','J','I','S',')',0},
446 {'s','h','i','f','t','_','j','i','s',0},
447 {'i','s','o','-','2','0','2','2','-','j','p',0},
448 {'i','s','o','-','2','0','2','2','-','j','p',0},
449 {'M','S',' ','G','o','t','h','i','c',0},
450 {'M','S',' ','P','G','o','t','h','i','c',0}, 128
456 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
457 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
458 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
459 949, 949, {'K','o','r','e','a','n',0},
460 {'k','s','_','c','_','5','6','0','1','-','1','9','8','7',0},
461 {'k','s','_','c','_','5','6','0','1','-','1','9','8','7',0},
462 {'k','s','_','c','_','5','6','0','1','-','1','9','8','7',0},
463 {'G','u','l','i','m','C','h','e',0},
464 {'G','u','l','i','m',0}, 129
467 /* 16. Thai (Windows) */
470 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
471 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
472 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
473 874, 874, {'T','h','a','i',' ','(','W','i','n','d','o','w','s',')',0},
474 {'w','i','n','d','o','w','s','-','8','7','4',0},
475 {'w','i','n','d','o','w','s','-','8','7','4',0},
476 {'w','i','n','d','o','w','s','-','8','7','4',0},
477 {'T','a','h','o','m','a',0},
478 {'T','a','h','o','m','a',0}, 222
480 FALSE
, TRUE
, FALSE
, FALSE
, TRUE
, TRUE
, TRUE
482 /* 17. Turkish (Windows) */
485 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
486 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
487 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
488 1254, 1254, {'T','u','r','k','i','s','h',' ','(','W','i','n','d','o','w','s',')',0},
489 {'w','i','n','d','o','w','s','-','1','2','5','4',0},
490 {'w','i','n','d','o','w','s','-','1','2','5','4',0},
491 {'i','s','o','-','8','8','5','9','-','9',0},
492 {'C','o','u','r','i','e','r',' ','N','e','w',0},
493 {'A','r','i','a','l',0}, 162
495 FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, TRUE
497 /* 18. Vietnamese (Windows) */
500 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_MAILNEWS
|
501 MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
| MIMECONTF_VALID_NLS
|
502 MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
503 1258, 1258, {'V','i','e','t','n','a','m','e','s','e',' ','(','W','i','n','d','o','w','s',')',0},
504 {'w','i','n','d','o','w','s','-','1','2','5','8',0},
505 {'w','i','n','d','o','w','s','-','1','2','5','8',0},
506 {'w','i','n','d','o','w','s','-','1','2','5','8',0},
507 {'C','o','u','r','i','e','r',' ','N','e','w',0},
508 {'A','r','i','a','l',0}, 163
511 /* 19. Western European (Windows) */
514 MIMECONTF_MAILNEWS
| MIMECONTF_BROWSER
| MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
|
515 MIMECONTF_SAVABLE_MAILNEWS
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
| MIMECONTF_VALID
|
516 MIMECONTF_VALID_NLS
| MIMECONTF_MIME_LATEST
,
517 1252, 1252, {'W','e','s','t','e','r','n',' ','E','u','r','o','p','e','a','n',' ','(','W','i','n','d','o','w','s',')',0},
518 {'W','i','n','d','o','w','s','-','1','2','5','2',0},
519 {'W','i','n','d','o','w','s','-','1','2','5','2',0},
520 {'i','s','o','-','8','8','5','9','-','1',0},
521 {'C','o','u','r','i','e','r',' ','N','e','w',0},
522 {'A','r','i','a','l',0}, 0
524 FALSE
, FALSE
, FALSE
, FALSE
, TRUE
, TRUE
529 MIMECONTF_MINIMAL
| MIMECONTF_IMPORT
| MIMECONTF_SAVABLE_BROWSER
| MIMECONTF_EXPORT
|
530 MIMECONTF_VALID
| MIMECONTF_VALID_NLS
| MIMECONTF_MIME_IE4
| MIMECONTF_MIME_LATEST
,
531 1200, 1200, {'U','n','i','c','o','d','e',0},
532 {'u','n','i','c','o','d','e',0},
533 {'u','n','i','c','o','d','e',0},
534 {'u','n','i','c','o','d','e',0},
535 {'C','o','u','r','i','e','r',' ','N','e','w',0},
536 {'A','r','i','a','l',0}, 1
541 static BOOL
init_function_ptrs(void)
545 hMlang
= GetModuleHandleA("mlang.dll");
546 pConvertINetMultiByteToUnicode
= (void *)GetProcAddress(hMlang
, "ConvertINetMultiByteToUnicode");
547 pConvertINetUnicodeToMultiByte
= (void *)GetProcAddress(hMlang
, "ConvertINetUnicodeToMultiByte");
548 pRfc1766ToLcidA
= (void *)GetProcAddress(hMlang
, "Rfc1766ToLcidA");
549 pLcidToRfc1766A
= (void *)GetProcAddress(hMlang
, "LcidToRfc1766A");
551 pGetCPInfoExA
= (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetCPInfoExA");
556 #define ok_w2(format, szString1, szString2) \
558 if (lstrcmpW((szString1), (szString2)) != 0) \
560 CHAR string1[256], string2[256]; \
561 WideCharToMultiByte(CP_ACP, 0, (szString1), -1, string1, 256, NULL, NULL); \
562 WideCharToMultiByte(CP_ACP, 0, (szString2), -1, string2, 256, NULL, NULL); \
563 ok(0, (format), string1, string2); \
566 static void test_multibyte_to_unicode_translations(IMultiLanguage2
*iML2
)
568 /* these APIs are broken regarding constness of the input buffer */
569 char stringA
[] = "Just a test string\0"; /* double 0 for CP_UNICODE tests */
570 WCHAR stringW
[] = {'J','u','s','t',' ','a',' ','t','e','s','t',' ','s','t','r','i','n','g',0};
573 UINT lenA
, lenW
, expected_len
;
576 /* IMultiLanguage2_ConvertStringToUnicode tests */
578 memset(bufW
, 'x', sizeof(bufW
));
580 lenW
= ARRAY_SIZE(bufW
);
581 ret
= IMultiLanguage2_ConvertStringToUnicode(iML2
, NULL
, 1252, stringA
, &lenA
, bufW
, &lenW
);
582 ok(ret
== S_OK
, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret
);
583 ok(lenA
== 0, "expected lenA 0, got %u\n", lenA
);
584 ok(lenW
== 0, "expected lenW 0, got %u\n", lenW
);
586 memset(bufW
, 'x', sizeof(bufW
));
588 lenW
= ARRAY_SIZE(bufW
);
589 ret
= IMultiLanguage2_ConvertStringToUnicode(iML2
, NULL
, 1252, stringA
, &lenA
, bufW
, &lenW
);
590 ok(ret
== S_OK
, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret
);
591 ok(lenA
== lstrlenA(stringA
), "expected lenA %u, got %u\n", lstrlenA(stringA
), lenA
);
592 ok(lenW
== lstrlenW(stringW
), "expected lenW %u, got %u\n", lstrlenW(stringW
), lenW
);
593 if (lenW
< ARRAY_SIZE(bufW
)) {
594 /* can only happen if the convert call fails */
595 ok(bufW
[lenW
] != 0, "buf should not be 0 terminated\n");
596 bufW
[lenW
] = 0; /* -1 doesn't include 0 terminator */
598 ok(!lstrcmpW(bufW
, stringW
), "bufW/stringW mismatch\n");
600 memset(bufW
, 'x', sizeof(bufW
));
603 ret
= IMultiLanguage2_ConvertStringToUnicode(iML2
, NULL
, 1252, stringA
, &lenA
, bufW
, &lenW
);
604 ok(ret
== E_FAIL
, "IMultiLanguage2_ConvertStringToUnicode should fail: %08lx\n", ret
);
605 ok(lenW
== 0, "expected lenW 0, got %u\n", lenW
);
606 /* still has to do partial conversion */
607 ok(!memcmp(bufW
, stringW
, 5 * sizeof(WCHAR
)), "bufW/stringW mismatch\n");
609 memset(bufW
, 'x', sizeof(bufW
));
611 lenW
= ARRAY_SIZE(bufW
);
612 ret
= IMultiLanguage2_ConvertStringToUnicode(iML2
, NULL
, CP_UNICODE
, stringA
, &lenA
, bufW
, &lenW
);
613 ok(ret
== S_OK
, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret
);
614 ok(lenA
== lstrlenA(stringA
), "expected lenA %u, got %u\n", lstrlenA(stringA
), lenA
);
615 ok(lenW
== lstrlenW(stringW
)/(int)sizeof(WCHAR
), "wrong lenW %u\n", lenW
);
616 ok(bufW
[lenW
] != 0, "buf should not be 0 terminated\n");
617 bufW
[lenW
] = 0; /* -1 doesn't include 0 terminator */
618 ok(!lstrcmpA((LPCSTR
)bufW
, stringA
), "bufW/stringA mismatch\n");
620 memset(bufW
, 'x', sizeof(bufW
));
621 lenA
= lstrlenA(stringA
);
623 ret
= IMultiLanguage2_ConvertStringToUnicode(iML2
, NULL
, 1252, stringA
, &lenA
, NULL
, &lenW
);
624 ok(ret
== S_OK
, "IMultiLanguage2_ConvertStringToUnicode failed: %08lx\n", ret
);
625 ok(lenA
== lstrlenA(stringA
), "expected lenA %u, got %u\n", lstrlenA(stringA
), lenA
);
626 expected_len
= MultiByteToWideChar(1252, 0, stringA
, lenA
, NULL
, 0);
627 ok(lenW
== expected_len
, "expected lenW %u, got %u\n", expected_len
, lenW
);
629 memset(bufW
, 'x', sizeof(bufW
));
630 lenA
= lstrlenA(stringA
);
631 lenW
= ARRAY_SIZE(bufW
);
632 ret
= pConvertINetMultiByteToUnicode(NULL
, 1252, stringA
, (INT
*)&lenA
, NULL
, (INT
*)&lenW
);
633 ok(ret
== S_OK
, "ConvertINetMultiByteToUnicode failed: %08lx\n", ret
);
634 ok(lenA
== lstrlenA(stringA
), "expected lenA %u, got %u\n", lstrlenA(stringA
), lenA
);
635 expected_len
= MultiByteToWideChar(1252, 0, stringA
, lenA
, NULL
, 0);
636 ok(lenW
== expected_len
, "expected lenW %u, got %u\n", expected_len
, lenW
);
638 memset(bufW
, 'x', sizeof(bufW
));
639 lenA
= lstrlenA(stringA
);
641 ret
= pConvertINetMultiByteToUnicode(NULL
, 1252, stringA
, (INT
*)&lenA
, NULL
, (INT
*)&lenW
);
642 ok(ret
== S_OK
, "ConvertINetMultiByteToUnicode failed: %08lx\n", ret
);
643 ok(lenA
== lstrlenA(stringA
), "expected lenA %u, got %u\n", lstrlenA(stringA
), lenA
);
644 expected_len
= MultiByteToWideChar(1252, 0, stringA
, lenA
, NULL
, 0);
645 ok(lenW
== expected_len
, "expected lenW %u, got %u\n", expected_len
, lenW
);
647 /* IMultiLanguage2_ConvertStringFromUnicode tests */
649 memset(bufA
, 'x', sizeof(bufA
));
652 ret
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, stringW
, &lenW
, bufA
, &lenA
);
653 ok(ret
== S_OK
, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret
);
654 ok(lenA
== 0, "expected lenA 0, got %u\n", lenA
);
655 ok(lenW
== 0, "expected lenW 0, got %u\n", lenW
);
657 memset(bufA
, 'x', sizeof(bufA
));
660 ret
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, stringW
, &lenW
, bufA
, &lenA
);
661 ok(ret
== S_OK
, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret
);
662 ok(lenA
== lstrlenA(stringA
), "expected lenA %u, got %u\n", lstrlenA(stringA
), lenA
);
663 ok(lenW
== lstrlenW(stringW
), "expected lenW %u, got %u\n", lstrlenW(stringW
), lenW
);
664 ok(bufA
[lenA
] != 0, "buf should not be 0 terminated\n");
665 bufA
[lenA
] = 0; /* -1 doesn't include 0 terminator */
666 ok(!lstrcmpA(bufA
, stringA
), "bufA/stringA mismatch\n");
668 memset(bufA
, 'x', sizeof(bufA
));
671 ret
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, stringW
, &lenW
, bufA
, &lenA
);
672 ok(ret
== E_FAIL
, "IMultiLanguage2_ConvertStringFromUnicode should fail: %08lx\n", ret
);
673 ok(lenA
== 0, "expected lenA 0, got %u\n", lenA
);
674 /* still has to do partial conversion */
675 ok(!memcmp(bufA
, stringA
, 5), "bufW/stringW mismatch\n");
677 memset(bufA
, 'x', sizeof(bufA
));
680 ret
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, CP_UNICODE
, stringW
, &lenW
, bufA
, &lenA
);
681 ok(ret
== S_OK
, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret
);
682 ok(lenA
== lstrlenA(stringA
) * (int)sizeof(WCHAR
), "wrong lenA %u\n", lenA
);
683 ok(lenW
== lstrlenW(stringW
), "expected lenW %u, got %u\n", lstrlenW(stringW
), lenW
);
684 ok(bufA
[lenA
] != 0 && bufA
[lenA
+1] != 0, "buf should not be 0 terminated\n");
685 bufA
[lenA
] = 0; /* -1 doesn't include 0 terminator */
686 bufA
[lenA
+1] = 0; /* sizeof(WCHAR) */
687 ok(!lstrcmpW((LPCWSTR
)bufA
, stringW
), "bufA/stringW mismatch\n");
689 memset(bufA
, 'x', sizeof(bufA
));
690 lenW
= lstrlenW(stringW
);
692 ret
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, stringW
, &lenW
, NULL
, &lenA
);
693 ok(ret
== S_OK
, "IMultiLanguage2_ConvertStringFromUnicode failed: %08lx\n", ret
);
694 ok(lenW
== lstrlenW(stringW
), "expected lenW %u, got %u\n", lstrlenW(stringW
), lenW
);
695 expected_len
= WideCharToMultiByte(1252, 0, stringW
, lenW
, NULL
, 0, NULL
, NULL
);
696 ok(lenA
== expected_len
, "expected lenA %u, got %u\n", expected_len
, lenA
);
699 static void cpinfo_cmp(MIMECPINFO
*cpinfo1
, MIMECPINFO
*cpinfo2
)
701 ok(cpinfo1
->dwFlags
== cpinfo2
->dwFlags
, "dwFlags mismatch: %08lx != %08lx\n", cpinfo1
->dwFlags
, cpinfo2
->dwFlags
);
702 ok(cpinfo1
->uiCodePage
== cpinfo2
->uiCodePage
, "uiCodePage mismatch: %u != %u\n", cpinfo1
->uiCodePage
, cpinfo2
->uiCodePage
);
703 ok(cpinfo1
->uiFamilyCodePage
== cpinfo2
->uiFamilyCodePage
, "uiFamilyCodePage mismatch: %u != %u\n", cpinfo1
->uiFamilyCodePage
, cpinfo2
->uiFamilyCodePage
);
704 ok(!lstrcmpW(cpinfo1
->wszDescription
, cpinfo2
->wszDescription
), "wszDescription mismatch\n");
705 ok(!lstrcmpW(cpinfo1
->wszWebCharset
, cpinfo2
->wszWebCharset
), "wszWebCharset mismatch\n");
706 ok(!lstrcmpW(cpinfo1
->wszHeaderCharset
, cpinfo2
->wszHeaderCharset
), "wszHeaderCharset mismatch\n");
707 ok(!lstrcmpW(cpinfo1
->wszBodyCharset
, cpinfo2
->wszBodyCharset
), "wszBodyCharset mismatch\n");
708 ok(!lstrcmpW(cpinfo1
->wszFixedWidthFont
, cpinfo2
->wszFixedWidthFont
), "wszFixedWidthFont mismatch\n");
709 ok(!lstrcmpW(cpinfo1
->wszProportionalFont
, cpinfo2
->wszProportionalFont
), "wszProportionalFont mismatch\n");
710 ok(cpinfo1
->bGDICharset
== cpinfo2
->bGDICharset
, "bGDICharset mismatch: %d != %d\n", cpinfo1
->bGDICharset
, cpinfo2
->bGDICharset
);
714 static const char *dump_mime_flags(DWORD flags
)
716 static char buf
[1024];
720 if (flags
& MIMECONTF_MAILNEWS
) strcat(buf
, " MIMECONTF_MAILNEWS");
721 if (flags
& MIMECONTF_BROWSER
) strcat(buf
, " MIMECONTF_BROWSER");
722 if (flags
& MIMECONTF_MINIMAL
) strcat(buf
, " MIMECONTF_MINIMAL");
723 if (flags
& MIMECONTF_IMPORT
) strcat(buf
, " MIMECONTF_IMPORT");
724 if (flags
& MIMECONTF_SAVABLE_MAILNEWS
) strcat(buf
, " MIMECONTF_SAVABLE_MAILNEWS");
725 if (flags
& MIMECONTF_SAVABLE_BROWSER
) strcat(buf
, " MIMECONTF_SAVABLE_BROWSER");
726 if (flags
& MIMECONTF_EXPORT
) strcat(buf
, " MIMECONTF_EXPORT");
727 if (flags
& MIMECONTF_PRIVCONVERTER
) strcat(buf
, " MIMECONTF_PRIVCONVERTER");
728 if (flags
& MIMECONTF_VALID
) strcat(buf
, " MIMECONTF_VALID");
729 if (flags
& MIMECONTF_VALID_NLS
) strcat(buf
, " MIMECONTF_VALID_NLS");
730 if (flags
& MIMECONTF_MIME_IE4
) strcat(buf
, " MIMECONTF_MIME_IE4");
731 if (flags
& MIMECONTF_MIME_LATEST
) strcat(buf
, " MIMECONTF_MIME_LATEST");
732 if (flags
& MIMECONTF_MIME_REGISTRY
) strcat(buf
, " MIMECONTF_MIME_REGISTRY");
738 static HRESULT
check_convertible(IMultiLanguage2
*iML2
, UINT from
, UINT to
)
740 CHAR convert
[MAX_PATH
];
745 static WCHAR strW
[] = {'a','b','c',0};
747 /* Check to see if the target codepage has these characters or not */
753 cb
= WideCharToMultiByte( from
, WC_NO_BEST_FIT_CHARS
| WC_COMPOSITECHECK
| WC_DEFAULTCHAR
,
754 strW
, 3, ch
, sizeof(ch
), NULL
, &fDefaultChar
);
756 if(cb
== 0 || fDefaultChar
)
758 trace("target codepage %i does not contain 'abc'\n",from
);
763 srcsz
= lstrlenW(strW
) + 1;
765 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, from
, strW
,
766 &srcsz
, convert
, &destsz
);
772 hr
= IMultiLanguage2_ConvertString(iML2
, NULL
, from
, to
, (BYTE
*)convert
,
773 &srcsz
, dest
, &destsz
);
780 static void test_EnumCodePages(IMultiLanguage2
*iML2
, DWORD flags
)
782 IEnumCodePage
*iEnumCP
= NULL
;
790 ret
= IMultiLanguage2_GetNumberOfCodePageInfo(iML2
, &total
);
791 ok(ret
== S_OK
&& total
!= 0, "IMultiLanguage2_GetNumberOfCodePageInfo: expected S_OK/!0, got %08lx/%u\n", ret
, total
);
793 trace("total mlang supported codepages %u\n", total
);
795 ret
= IMultiLanguage2_EnumCodePages(iML2
, flags
, LANG_NEUTRAL
, &iEnumCP
);
796 ok(ret
== S_OK
&& iEnumCP
, "IMultiLanguage2_EnumCodePages: expected S_OK/!NULL, got %08lx/%p\n", ret
, iEnumCP
);
798 ret
= IEnumCodePage_Reset(iEnumCP
);
799 ok(ret
== S_OK
, "IEnumCodePage_Reset: expected S_OK, got %08lx\n", ret
);
801 ret
= IEnumCodePage_Next(iEnumCP
, 0, NULL
, &n
);
802 ok(ret
== S_FALSE
|| ret
== E_FAIL
,
803 "IEnumCodePage_Next: expected S_FALSE or E_FAIL, got %08lx\n", ret
);
805 ok(n
== 0, "IEnumCodePage_Next: expected 0/S_FALSE, got %lu/%08lx\n", n
, ret
);
806 else if (ret
== E_FAIL
)
807 ok(n
== 65536, "IEnumCodePage_Next: expected 65536/E_FAIL, got %lu/%08lx\n", n
, ret
);
808 ret
= IEnumCodePage_Next(iEnumCP
, 0, NULL
, NULL
);
809 ok(ret
== S_FALSE
|| ret
== E_FAIL
,
810 "IEnumCodePage_Next: expected S_FALSE or E_FAIL, got %08lx\n", ret
);
812 cpinfo
= HeapAlloc(GetProcessHeap(), 0, sizeof(*cpinfo
) * total
* 2);
815 ret
= IEnumCodePage_Next(iEnumCP
, 0, cpinfo
, &n
);
816 ok(ret
== S_FALSE
&& n
== 0, "IEnumCodePage_Next: expected S_FALSE/0, got %08lx/%lu\n", ret
, n
);
819 ret
= IEnumCodePage_Next(iEnumCP
, n
, cpinfo
, &n
);
820 ok(ret
== S_OK
&& n
!= 0, "IEnumCodePage_Next: expected S_OK/!0, got %08lx/%lu\n", ret
, n
);
822 trace("flags %08lx, enumerated codepages %lu\n", flags
, n
);
826 ok(n
== total
, "IEnumCodePage_Next: expected %u, got %lu\n", total
, n
);
828 flags
= MIMECONTF_MIME_LATEST
;
833 for (i
= 0; i
< n
; i
++)
837 HRESULT convertible
= S_OK
;
838 static const WCHAR autoW
[] = {'_','a','u','t','o',0};
839 static const WCHAR feffW
[] = {'u','n','i','c','o','d','e','F','E','F','F',0};
842 trace("MIMECPINFO #%u:\n"
845 "uiFamilyCodePage %u\n"
846 "wszDescription %s\n"
848 "wszHeaderCharset %s\n"
849 "wszBodyCharset %s\n"
850 "wszFixedWidthFont %s\n"
851 "wszProportionalFont %s\n"
852 "bGDICharset %d\n\n",
854 cpinfo
[i
].dwFlags
, dump_mime_flags(cpinfo
[i
].dwFlags
),
855 cpinfo
[i
].uiCodePage
,
856 cpinfo
[i
].uiFamilyCodePage
,
857 wine_dbgstr_w(cpinfo
[i
].wszDescription
),
858 wine_dbgstr_w(cpinfo
[i
].wszWebCharset
),
859 wine_dbgstr_w(cpinfo
[i
].wszHeaderCharset
),
860 wine_dbgstr_w(cpinfo
[i
].wszBodyCharset
),
861 wine_dbgstr_w(cpinfo
[i
].wszFixedWidthFont
),
862 wine_dbgstr_w(cpinfo
[i
].wszProportionalFont
),
863 cpinfo
[i
].bGDICharset
);
865 ok(cpinfo
[i
].dwFlags
& flags
, "enumerated flags %08lx do not include requested %08lx\n", cpinfo
[i
].dwFlags
, flags
);
867 if (TranslateCharsetInfo((DWORD
*)(INT_PTR
)cpinfo
[i
].uiFamilyCodePage
, &csi
, TCI_SRCCODEPAGE
))
868 ok(cpinfo
[i
].bGDICharset
== csi
.ciCharset
, "%d != %d\n", cpinfo
[i
].bGDICharset
, csi
.ciCharset
);
870 if (winetest_debug
> 1)
871 trace("TranslateCharsetInfo failed for cp %u\n", cpinfo
[i
].uiFamilyCodePage
);
874 trace("%u: codepage %u family %u\n", i
, cpinfo
[i
].uiCodePage
, cpinfo
[i
].uiFamilyCodePage
);
877 /* support files for some codepages might be not installed, or
878 * the codepage is just an alias.
880 if (IsValidCodePage(cpinfo
[i
].uiCodePage
))
882 ret
= IMultiLanguage2_IsConvertible(iML2
, cpinfo
[i
].uiCodePage
, CP_UNICODE
);
883 ok(ret
== S_OK
, "IMultiLanguage2_IsConvertible(%u -> CP_UNICODE) = %08lx\n", cpinfo
[i
].uiCodePage
, ret
);
884 ret
= IMultiLanguage2_IsConvertible(iML2
, CP_UNICODE
, cpinfo
[i
].uiCodePage
);
885 ok(ret
== S_OK
, "IMultiLanguage2_IsConvertible(CP_UNICODE -> %u) = %08lx\n", cpinfo
[i
].uiCodePage
, ret
);
887 convertible
= check_convertible(iML2
, cpinfo
[i
].uiCodePage
, CP_UTF8
);
888 if (convertible
!= E_FAIL
)
890 ret
= IMultiLanguage2_IsConvertible(iML2
, cpinfo
[i
].uiCodePage
, CP_UTF8
);
891 ok(ret
== convertible
, "IMultiLanguage2_IsConvertible(%u -> CP_UTF8) = %08lx\n", cpinfo
[i
].uiCodePage
, ret
);
892 ret
= IMultiLanguage2_IsConvertible(iML2
, CP_UTF8
, cpinfo
[i
].uiCodePage
);
893 ok(ret
== convertible
, "IMultiLanguage2_IsConvertible(CP_UTF8 -> %u) = %08lx\n", cpinfo
[i
].uiCodePage
, ret
);
897 if (winetest_debug
> 1)
898 trace("IsValidCodePage failed for cp %u\n", cpinfo
[i
].uiCodePage
);
900 if (memcmp(cpinfo
[i
].wszWebCharset
,feffW
,sizeof(WCHAR
)*11)==0)
901 skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
904 ret
= IMultiLanguage2_GetCharsetInfo(iML2
, cpinfo
[i
].wszWebCharset
, &mcsi
);
905 /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
906 if (memcmp(cpinfo
[i
].wszWebCharset
, autoW
, 5 * sizeof(WCHAR
)))
908 ok (ret
== S_OK
, "IMultiLanguage2_GetCharsetInfo failed: %08lx\n", ret
);
910 trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo
[i
].wszWebCharset
), mcsi
.uiCodePage
, mcsi
.uiInternetEncoding
, wine_dbgstr_w(mcsi
.wszCharset
));
912 ok(!lstrcmpiW(cpinfo
[i
].wszWebCharset
, mcsi
.wszCharset
), "%s != %s\n",
913 wine_dbgstr_w(cpinfo
[i
].wszWebCharset
), wine_dbgstr_w(mcsi
.wszCharset
));
917 /* native mlang returns completely messed up encodings in some cases */
918 ok(mcsi
.uiInternetEncoding
== cpinfo
[i
].uiCodePage
|| mcsi
.uiInternetEncoding
== cpinfo
[i
].uiFamilyCodePage
,
919 "%u != %u || %u\n", mcsi
.uiInternetEncoding
, cpinfo
[i
].uiCodePage
, cpinfo
[i
].uiFamilyCodePage
);
920 ok(mcsi
.uiCodePage
== cpinfo
[i
].uiCodePage
|| mcsi
.uiCodePage
== cpinfo
[i
].uiFamilyCodePage
,
921 "%u != %u || %u\n", mcsi
.uiCodePage
, cpinfo
[i
].uiCodePage
, cpinfo
[i
].uiFamilyCodePage
);
926 if (memcmp(cpinfo
[i
].wszHeaderCharset
,feffW
,sizeof(WCHAR
)*11)==0)
927 skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
930 ret
= IMultiLanguage2_GetCharsetInfo(iML2
, cpinfo
[i
].wszHeaderCharset
, &mcsi
);
931 /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
932 if (memcmp(cpinfo
[i
].wszHeaderCharset
, autoW
, 5 * sizeof(WCHAR
)))
934 ok (ret
== S_OK
, "IMultiLanguage2_GetCharsetInfo failed: %08lx\n", ret
);
936 trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo
[i
].wszHeaderCharset
), mcsi
.uiCodePage
, mcsi
.uiInternetEncoding
, wine_dbgstr_w(mcsi
.wszCharset
));
938 ok(!lstrcmpiW(cpinfo
[i
].wszHeaderCharset
, mcsi
.wszCharset
), "%s != %s\n",
939 wine_dbgstr_w(cpinfo
[i
].wszHeaderCharset
), wine_dbgstr_w(mcsi
.wszCharset
));
943 /* native mlang returns completely messed up encodings in some cases */
944 ok(mcsi
.uiInternetEncoding
== cpinfo
[i
].uiCodePage
|| mcsi
.uiInternetEncoding
== cpinfo
[i
].uiFamilyCodePage
,
945 "%u != %u || %u\n", mcsi
.uiInternetEncoding
, cpinfo
[i
].uiCodePage
, cpinfo
[i
].uiFamilyCodePage
);
946 ok(mcsi
.uiCodePage
== cpinfo
[i
].uiCodePage
|| mcsi
.uiCodePage
== cpinfo
[i
].uiFamilyCodePage
,
947 "%u != %u || %u\n", mcsi
.uiCodePage
, cpinfo
[i
].uiCodePage
, cpinfo
[i
].uiFamilyCodePage
);
952 if (memcmp(cpinfo
[i
].wszBodyCharset
,feffW
,sizeof(WCHAR
)*11)==0)
953 skip("Legacy windows bug returning invalid charset of unicodeFEFF\n");
956 ret
= IMultiLanguage2_GetCharsetInfo(iML2
, cpinfo
[i
].wszBodyCharset
, &mcsi
);
957 /* _autoxxx charsets are a fake and GetCharsetInfo fails for them */
958 if (memcmp(cpinfo
[i
].wszBodyCharset
, autoW
, 5 * sizeof(WCHAR
)))
960 ok (ret
== S_OK
, "IMultiLanguage2_GetCharsetInfo failed: %08lx\n", ret
);
962 trace("%s: %u %u %s\n", wine_dbgstr_w(cpinfo
[i
].wszBodyCharset
), mcsi
.uiCodePage
, mcsi
.uiInternetEncoding
, wine_dbgstr_w(mcsi
.wszCharset
));
964 ok(!lstrcmpiW(cpinfo
[i
].wszBodyCharset
, mcsi
.wszCharset
), "%s != %s\n",
965 wine_dbgstr_w(cpinfo
[i
].wszBodyCharset
), wine_dbgstr_w(mcsi
.wszCharset
));
969 /* native mlang returns completely messed up encodings in some cases */
970 ok(mcsi
.uiInternetEncoding
== cpinfo
[i
].uiCodePage
|| mcsi
.uiInternetEncoding
== cpinfo
[i
].uiFamilyCodePage
,
971 "%u != %u || %u\n", mcsi
.uiInternetEncoding
, cpinfo
[i
].uiCodePage
, cpinfo
[i
].uiFamilyCodePage
);
972 ok(mcsi
.uiCodePage
== cpinfo
[i
].uiCodePage
|| mcsi
.uiCodePage
== cpinfo
[i
].uiFamilyCodePage
,
973 "%u != %u || %u\n", mcsi
.uiCodePage
, cpinfo
[i
].uiCodePage
, cpinfo
[i
].uiFamilyCodePage
);
979 /* now IEnumCodePage_Next should fail, since pointer is at the end */
981 ret
= IEnumCodePage_Next(iEnumCP
, 1, &cpinfo2
, &n
);
982 ok(ret
== S_FALSE
&& n
== 0, "IEnumCodePage_Next: expected S_FALSE/0, got %08lx/%lu\n", ret
, n
);
984 ret
= IEnumCodePage_Reset(iEnumCP
);
985 ok(ret
== S_OK
, "IEnumCodePage_Reset: expected S_OK, got %08lx\n", ret
);
987 ret
= IEnumCodePage_Next(iEnumCP
, 1, &cpinfo2
, &n
);
988 ok(n
== 1 && ret
== S_OK
, "IEnumCodePage_Next: expected 1/S_OK, got %lu/%08lx\n", n
, ret
);
989 cpinfo_cmp(cpinfo
, &cpinfo2
);
993 /* Due to a bug in MS' implementation of IEnumCodePage_Skip
994 * it's not used here.
996 ret
= IEnumCodePage_Skip(iEnumCP
, 1);
997 ok(ret
== S_OK
, "IEnumCodePage_Skip: expected S_OK, got %08lx\n", ret
);
999 for (i
= 0; i
< total
- 1; i
++)
1002 ret
= IEnumCodePage_Next(iEnumCP
, 1, &cpinfo2
, &n
);
1003 ok(n
== 1 && ret
== S_OK
, "IEnumCodePage_Next: expected 1/S_OK, got %lu/%08lx\n", n
, ret
);
1004 cpinfo_cmp(&cpinfo
[i
+ 1], &cpinfo2
);
1007 HeapFree(GetProcessHeap(), 0, cpinfo
);
1008 IEnumCodePage_Release(iEnumCP
);
1011 static void test_GetCharsetInfo_other(IMultiLanguage
*ml
)
1013 WCHAR asciiW
[] = {'a','s','c','i','i',0};
1014 WCHAR iso88591_1W
[] = {'I','S','O','-','8','8','5','9','-','1',0};
1015 WCHAR iso88591_1retW
[] = {'i','s','o','-','8','8','5','9','-','1',0};
1016 WCHAR iso88591_2W
[] = {'I','S','O','8','8','5','9','-','1',0};
1017 WCHAR iso88591_2retW
[] = {'i','s','o','8','8','5','9','-','1',0};
1018 WCHAR iso88591_3W
[] = {'I','S','O','8','8','5','9','1',0};
1019 WCHAR iso88591_4W
[] = {'I','S','O','-','8','8','5','9','1',0};
1020 WCHAR iso88591_5W
[] = {'I','S','O','8','8','-','5','9','1',0};
1021 WCHAR iso88591_6W
[] = {'-','I','S','O','8','8','5','9','1',0};
1022 WCHAR iso88591_7W
[] = {' ','I','S','O','-','8','8','5','9','-','1',0};
1029 { 0, S_OK
, asciiW
, asciiW
},
1030 { 0, S_OK
, iso88591_1W
, iso88591_1retW
},
1031 { 1, S_OK
, iso88591_2W
, iso88591_2retW
},
1032 { 0, E_FAIL
, iso88591_3W
, 0 },
1033 { 0, E_FAIL
, iso88591_4W
, 0 },
1034 { 0, E_FAIL
, iso88591_5W
, 0 },
1035 { 0, E_FAIL
, iso88591_6W
, 0 },
1036 { 0, E_FAIL
, iso88591_7W
, 0 },
1042 for (i
= 0; i
< ARRAY_SIZE(other
); i
++)
1044 hr
= IMultiLanguage_GetCharsetInfo(ml
, other
[i
].charset
, &info
);
1046 todo_wine_if(other
[i
].todo
)
1047 ok(hr
== other
[i
].hr
, "#%d: got %08lx, expected %08lx\n", i
, hr
, other
[i
].hr
);
1050 todo_wine_if(other
[i
].todo
)
1051 ok(!lstrcmpW(info
.wszCharset
, other
[i
].ret_charset
), "#%d: got %s, expected %s\n",
1052 i
, wine_dbgstr_w(info
.wszCharset
), wine_dbgstr_w(other
[i
].ret_charset
));
1056 static void scriptinfo_cmp(SCRIPTINFO
*sinfo1
, SCRIPTINFO
*sinfo2
)
1058 ok(sinfo1
->ScriptId
== sinfo2
->ScriptId
, "ScriptId mismatch: %d != %d\n", sinfo1
->ScriptId
, sinfo2
->ScriptId
);
1059 ok(sinfo1
->uiCodePage
== sinfo2
->uiCodePage
, "uiCodePage mismatch: %u != %u\n", sinfo1
->uiCodePage
, sinfo2
->uiCodePage
);
1060 ok(!lstrcmpW(sinfo1
->wszDescription
, sinfo2
->wszDescription
), "wszDescription mismatch\n");
1061 ok(!lstrcmpW(sinfo1
->wszFixedWidthFont
, sinfo2
->wszFixedWidthFont
), "wszFixedWidthFont mismatch\n");
1062 ok(!lstrcmpW(sinfo1
->wszProportionalFont
, sinfo2
->wszProportionalFont
), "wszProportionalFont mismatch\n");
1065 static void test_EnumScripts(IMultiLanguage2
*iML2
, DWORD flags
)
1067 IEnumScript
*iEnumScript
= NULL
;
1075 ret
= IMultiLanguage2_GetNumberOfScripts(iML2
, &total
);
1076 ok(ret
== S_OK
&& total
!= 0, "IMultiLanguage2_GetNumberOfScripts: expected S_OK/!0, got %08lx/%u\n", ret
, total
);
1078 trace("total mlang supported scripts %u\n", total
);
1080 ret
= IMultiLanguage2_EnumScripts(iML2
, flags
, LANG_NEUTRAL
, &iEnumScript
);
1081 ok(ret
== S_OK
&& iEnumScript
, "IMultiLanguage2_EnumScripts: expected S_OK/!NULL, got %08lx/%p\n", ret
, iEnumScript
);
1083 ret
= IEnumScript_Reset(iEnumScript
);
1084 ok(ret
== S_OK
, "IEnumScript_Reset: expected S_OK, got %08lx\n", ret
);
1086 ret
= IEnumScript_Next(iEnumScript
, 0, NULL
, &n
);
1087 ok(n
== 65536 && ret
== E_FAIL
, "IEnumScript_Next: expected 65536/E_FAIL, got %lu/%08lx\n", n
, ret
);
1088 ret
= IEnumScript_Next(iEnumScript
, 0, NULL
, NULL
);
1089 ok(ret
== E_FAIL
, "IEnumScript_Next: expected E_FAIL, got %08lx\n", ret
);
1091 sinfo
= HeapAlloc(GetProcessHeap(), 0, sizeof(*sinfo
) * total
* 2);
1094 ret
= IEnumScript_Next(iEnumScript
, 0, sinfo
, &n
);
1095 ok(ret
== S_FALSE
&& n
== 0, "IEnumScript_Next: expected S_FALSE/0, got %08lx/%lu\n", ret
, n
);
1098 ret
= IEnumScript_Next(iEnumScript
, n
, sinfo
, &n
);
1099 ok(ret
== S_OK
&& n
!= 0, "IEnumScript_Next: expected S_OK, got %08lx/%lu\n", ret
, n
);
1101 trace("flags %08lx, enumerated scripts %lu\n", flags
, n
);
1105 ok(n
== total
, "IEnumScript_Next: expected %u, got %lu\n", total
, n
);
1110 for (i
= 0; pGetCPInfoExA
&& i
< n
; i
++)
1112 #ifdef DUMP_SCRIPT_INFO
1113 trace("SCRIPTINFO #%u:\n"
1116 "wszDescription %s\n"
1117 "wszFixedWidthFont %s\n"
1118 "wszProportionalFont %s\n\n",
1121 sinfo
[i
].uiCodePage
,
1122 wine_dbgstr_w(sinfo
[i
].wszDescription
),
1123 wine_dbgstr_w(sinfo
[i
].wszFixedWidthFont
),
1124 wine_dbgstr_w(sinfo
[i
].wszProportionalFont
));
1125 trace("%u codepage %u\n", i
, sinfo
[i
].uiCodePage
);
1129 /* now IEnumScript_Next should fail, since pointer is at the end */
1131 ret
= IEnumScript_Next(iEnumScript
, 1, &sinfo2
, &n
);
1132 ok(ret
== S_FALSE
&& n
== 0, "IEnumScript_Next: expected S_FALSE/0, got %08lx/%lu\n", ret
, n
);
1134 ret
= IEnumScript_Reset(iEnumScript
);
1135 ok(ret
== S_OK
, "IEnumScript_Reset: expected S_OK, got %08lx\n", ret
);
1137 ret
= IEnumScript_Next(iEnumScript
, 1, &sinfo2
, &n
);
1138 ok(n
== 1 && ret
== S_OK
, "IEnumScript_Next: expected 1/S_OK, got %lu/%08lx\n", n
, ret
);
1139 scriptinfo_cmp(sinfo
, &sinfo2
);
1143 /* Due to a bug in MS' implementation of IEnumScript_Skip
1144 * it's not used here.
1146 ret
= IEnumScript_Skip(iEnumScript
, 1);
1147 ok(ret
== S_OK
, "IEnumScript_Skip: expected S_OK, got %08lx\n", ret
);
1149 for (i
= 0; i
< total
- 1; i
++)
1152 ret
= IEnumScript_Next(iEnumScript
, 1, &sinfo2
, &n
);
1153 ok(n
== 1 && ret
== S_OK
, "IEnumScript_Next: expected 1/S_OK, got %lu/%08lx\n", n
, ret
);
1154 scriptinfo_cmp(&sinfo
[i
+ 1], &sinfo2
);
1157 HeapFree(GetProcessHeap(), 0, sinfo
);
1158 IEnumScript_Release(iEnumScript
);
1161 static void IMLangFontLink_Test(IMLangFontLink
* iMLFL
)
1163 DWORD dwCodePages
, dwManyCodePages
;
1164 DWORD dwCmpCodePages
;
1166 static const WCHAR str
[] = { 'd', 0x0436, 0xff90 };
1171 ret
= IMLangFontLink_CodePageToCodePages(iMLFL
, -1, &dwCodePages
);
1172 ok(ret
== E_FAIL
, "IMLangFontLink_CodePageToCodePages should fail: %lx\n", ret
);
1173 ok(dwCodePages
== 0, "expected 0, got %lu\n", dwCodePages
);
1176 ret
= IMLangFontLink_CodePageToCodePages(iMLFL
, 932, &dwCodePages
);
1177 ok(ret
== S_OK
, "IMLangFontLink_CodePageToCodePages error %lx\n", ret
);
1178 ok(dwCodePages
== FS_JISJAPAN
, "expected FS_JISJAPAN, got %08lx\n", dwCodePages
);
1180 ret
= IMLangFontLink_CodePagesToCodePage(iMLFL
, dwCodePages
, 1035, &CodePage
);
1181 ok(ret
== S_OK
, "IMLangFontLink_CodePagesToCodePage error %lx\n", ret
);
1182 ok(CodePage
== 932, "Incorrect CodePage Returned (%i)\n",CodePage
);
1184 dwManyCodePages
= 0;
1185 ret
= IMLangFontLink_CodePageToCodePages(iMLFL
, 1252, &dwManyCodePages
);
1186 ok(ret
== S_OK
, "IMLangFontLink_CodePageToCodePages error %lx\n", ret
);
1187 ok(dwManyCodePages
== FS_LATIN1
, "expected FS_LATIN1, got %08lx\n", dwManyCodePages
);
1189 ret
= IMLangFontLink_CodePageToCodePages(iMLFL
, 1256, &dwCodePages
);
1190 ok(ret
== S_OK
, "IMLangFontLink_CodePageToCodePages error %lx\n", ret
);
1191 ok(dwCodePages
== FS_ARABIC
, "expected FS_ARABIC, got %08lx\n", dwCodePages
);
1192 dwManyCodePages
|= dwCodePages
;
1193 ret
= IMLangFontLink_CodePageToCodePages(iMLFL
, 874, &dwCodePages
);
1194 ok(ret
== S_OK
, "IMLangFontLink_CodePageToCodePages error %lx\n", ret
);
1195 ok(dwCodePages
== FS_THAI
, "expected FS_THAI, got %08lx\n", dwCodePages
);
1196 dwManyCodePages
|= dwCodePages
;
1198 ret
= IMLangFontLink_CodePagesToCodePage(iMLFL
, dwManyCodePages
, 1256, &CodePage
);
1199 ok(ret
== S_OK
, "IMLangFontLink_CodePagesToCodePage error %lx\n", ret
);
1200 ok(CodePage
== 1256, "Incorrect CodePage Returned (%i)\n",CodePage
);
1202 ret
= IMLangFontLink_CodePagesToCodePage(iMLFL
, dwManyCodePages
, 936, &CodePage
);
1203 ok(ret
== S_OK
, "IMLangFontLink_CodePagesToCodePage error %lx\n", ret
);
1204 ok(CodePage
== 1252, "Incorrect CodePage Returned (%i)\n",CodePage
);
1206 /* Tests for GetCharCodePages */
1209 dwCmpCodePages
= FS_LATIN1
| FS_LATIN2
| FS_CYRILLIC
| FS_GREEK
| FS_TURKISH
1210 | FS_HEBREW
| FS_ARABIC
| FS_BALTIC
| FS_VIETNAMESE
| FS_THAI
1211 | FS_JISJAPAN
| FS_CHINESESIMP
| FS_WANSUNG
| FS_CHINESETRAD
;
1212 ret
= IMLangFontLink_GetCharCodePages(iMLFL
, 'd', &dwCodePages
);
1213 ok(ret
== S_OK
, "IMLangFontLink_GetCharCodePages error %lx\n", ret
);
1214 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1218 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, str
, 1, 0, &dwCodePages
, &processed
);
1219 ok(ret
== S_OK
, "IMLangFontLink_GetStrCodePages error %lx\n", ret
);
1220 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1221 ok(processed
== 1, "expected 1, got %ld\n", processed
);
1224 dwCmpCodePages
= FS_CYRILLIC
| FS_JISJAPAN
| FS_CHINESESIMP
| FS_WANSUNG
;
1225 ret
= IMLangFontLink_GetCharCodePages(iMLFL
, 0x0436, &dwCodePages
);
1226 ok(ret
== S_OK
, "IMLangFontLink_GetCharCodePages error %lx\n", ret
);
1227 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1231 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, &str
[1], 1, 0, &dwCodePages
, &processed
);
1232 ok(ret
== S_OK
, "IMLangFontLink_GetStrCodePages error %lx\n", ret
);
1233 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1234 ok(processed
== 1, "expected 1, got %ld\n", processed
);
1237 dwCmpCodePages
= FS_JISJAPAN
;
1238 ret
= IMLangFontLink_GetCharCodePages(iMLFL
, 0xff90, &dwCodePages
);
1239 ok(ret
== S_OK
, "IMLangFontLink_GetCharCodePages error %lx\n", ret
);
1240 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1244 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, &str
[2], 1, 0, &dwCodePages
, &processed
);
1245 ok(ret
== S_OK
, "IMLangFontLink_GetStrCodePages error %lx\n", ret
);
1246 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1247 ok(processed
== 1, "expected 1, got %ld\n", processed
);
1249 dwCmpCodePages
= FS_CYRILLIC
| FS_JISJAPAN
| FS_CHINESESIMP
| FS_WANSUNG
;
1252 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, str
, 2, 0, &dwCodePages
, &processed
);
1253 ok(ret
== S_OK
, "IMLangFontLink_GetStrCodePages error %lx\n", ret
);
1254 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1255 ok(processed
== 2, "expected 2, got %ld\n", processed
);
1257 dwCmpCodePages
= FS_JISJAPAN
;
1260 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, str
, 3, 0, &dwCodePages
, &processed
);
1261 ok(ret
== S_OK
, "IMLangFontLink_GetStrCodePages error %lx\n", ret
);
1262 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1263 ok(processed
== 3, "expected 3, got %ld\n", processed
);
1265 dwCodePages
= 0xffff;
1267 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, &str
[2], 1, 0, &dwCodePages
, &processed
);
1268 ok(ret
== S_OK
, "IMLangFontLink_GetStrCodePages error %lx\n", ret
);
1269 ok(dwCodePages
== dwCmpCodePages
, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1270 ok(processed
== 1, "expected 0, got %ld\n", processed
);
1272 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, &str
[2], 1, 0, NULL
, NULL
);
1273 ok(ret
== S_OK
, "IMLangFontLink_GetStrCodePages error %lx\n", ret
);
1275 dwCodePages
= 0xffff;
1277 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, str
, -1, 0, &dwCodePages
, &processed
);
1278 ok(ret
== E_INVALIDARG
, "IMLangFontLink_GetStrCodePages should fail: %lx\n", ret
);
1279 ok(dwCodePages
== 0, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1280 ok(processed
== 0, "expected 0, got %ld\n", processed
);
1282 dwCodePages
= 0xffff;
1284 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, NULL
, 1, 0, &dwCodePages
, &processed
);
1285 ok(ret
== E_INVALIDARG
, "IMLangFontLink_GetStrCodePages should fail: %lx\n", ret
);
1286 ok(dwCodePages
== 0, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1287 ok(processed
== 0, "expected 0, got %ld\n", processed
);
1289 dwCodePages
= 0xffff;
1291 ret
= IMLangFontLink_GetStrCodePages(iMLFL
, str
, 0, 0, &dwCodePages
, &processed
);
1292 ok(ret
== E_INVALIDARG
, "IMLangFontLink_GetStrCodePages should fail: %lx\n", ret
);
1293 ok(dwCodePages
== 0, "expected %lx, got %lx\n", dwCmpCodePages
, dwCodePages
);
1294 ok(processed
== 0, "expected 0, got %ld\n", processed
);
1297 static void test_rfc1766(IMultiLanguage2
*iML2
)
1299 IEnumRfc1766
*pEnumRfc1766
;
1305 ret
= IMultiLanguage2_EnumRfc1766(iML2
, LANG_NEUTRAL
, &pEnumRfc1766
);
1306 ok(ret
== S_OK
, "IMultiLanguage2_EnumRfc1766 error %08lx\n", ret
);
1310 ret
= IEnumRfc1766_Next(pEnumRfc1766
, 1, &info
, &n
);
1311 if (ret
!= S_OK
) break;
1314 trace("lcid %04x rfc_name %s locale_name %s\n",
1315 info
.lcid
, wine_dbgstr_w(info
.wszRfc1766
), wine_dbgstr_w(info
.wszLocaleName
));
1318 ok(n
== 1, "couldn't fetch 1 RFC1766INFO structure\n");
1320 /* verify the Rfc1766 value */
1321 ret
= IMultiLanguage2_GetRfc1766FromLcid(iML2
, info
.lcid
, &rfcstr
);
1322 ok(ret
== S_OK
, "Expected S_OK, got %08lx\n", ret
);
1324 /* not an exact 1:1 correspondence between lcid and rfc1766 in the
1325 * mlang database, e.g., nb-no -> 1044 -> no */
1326 ok(wcsstr(info
.wszRfc1766
, rfcstr
) != NULL
,
1327 "Expected matching locale names\n");
1329 SysFreeString(rfcstr
);
1331 IEnumRfc1766_Release(pEnumRfc1766
);
1334 static void test_GetLcidFromRfc1766(IMultiLanguage2
*iML2
)
1336 WCHAR rfc1766W
[MAX_RFC1766_NAME
+ 1];
1341 static WCHAR en
[] = { 'e','n',0 };
1342 static WCHAR en_them
[] = { 'e','n','-','t','h','e','m',0 };
1343 static WCHAR english
[] = { 'e','n','g','l','i','s','h',0 };
1346 for(i
= 0; i
< ARRAY_SIZE(lcid_table
); i
++) {
1348 MultiByteToWideChar(CP_ACP
, 0, lcid_table
[i
].rfc1766
, -1, rfc1766W
, MAX_RFC1766_NAME
);
1349 ret
= IMultiLanguage2_GetLcidFromRfc1766(iML2
, &lcid
, rfc1766W
);
1351 /* IE <6.0 guess 0x412 (ko) from "kok" */
1352 ok((ret
== lcid_table
[i
].hr
) ||
1353 broken(lcid_table
[i
].broken_lcid
&& (ret
== S_FALSE
)),
1354 "#%02ld: HRESULT 0x%lx (expected 0x%lx)\n", i
, ret
, lcid_table
[i
].hr
);
1356 ok((lcid
== lcid_table
[i
].lcid
) ||
1357 broken(lcid
== lcid_table
[i
].broken_lcid
), /* IE <6.0 */
1358 "#%02ld: got LCID 0x%lx (expected 0x%lx)\n", i
, lcid
, lcid_table
[i
].lcid
);
1362 ret
= IMultiLanguage2_GetLcidFromRfc1766(iML2
, NULL
, en
);
1363 ok(ret
== E_INVALIDARG
, "GetLcidFromRfc1766 returned: %08lx\n", ret
);
1365 ret
= IMultiLanguage2_GetLcidFromRfc1766(iML2
, &lcid
, NULL
);
1366 ok(ret
== E_INVALIDARG
, "GetLcidFromRfc1766 returned: %08lx\n", ret
);
1368 ret
= IMultiLanguage2_GetLcidFromRfc1766(iML2
, &lcid
, en_them
);
1369 ok((ret
== E_FAIL
|| ret
== S_FALSE
), "GetLcidFromRfc1766 returned: %08lx\n", ret
);
1373 static WCHAR en
[] = {'e','n',0};
1375 ret
= IMultiLanguage2_GetRfc1766FromLcid(iML2
, lcid
, &rfcstr
);
1376 ok(ret
== S_OK
, "Expected S_OK, got %08lx\n", ret
);
1377 ok_w2("Expected \"%s\", got \"%s\"n", en
, rfcstr
);
1380 ret
= IMultiLanguage2_GetLcidFromRfc1766(iML2
, &lcid
, english
);
1381 ok((ret
== E_FAIL
|| ret
== S_FALSE
), "GetLcidFromRfc1766 returned: %08lx\n", ret
);
1385 static WCHAR en
[] = {'e','n',0};
1387 ret
= IMultiLanguage2_GetRfc1766FromLcid(iML2
, lcid
, &rfcstr
);
1388 ok(ret
== S_OK
, "Expected S_OK, got %08lx\n", ret
);
1389 ok_w2("Expected \"%s\", got \"%s\"n", en
, rfcstr
);
1394 static void test_Rfc1766ToLcid(void)
1400 for(i
= 0; i
< ARRAY_SIZE(lcid_table
); i
++) {
1402 ret
= pRfc1766ToLcidA(&lcid
, lcid_table
[i
].rfc1766
);
1404 /* IE <6.0 guess 0x412 (ko) from "kok" */
1405 ok( (ret
== lcid_table
[i
].hr
) ||
1406 broken(lcid_table
[i
].broken_lcid
&& (ret
== S_FALSE
)),
1407 "#%02ld: HRESULT 0x%lx (expected 0x%lx)\n", i
, ret
, lcid_table
[i
].hr
);
1409 ok( (lcid
== lcid_table
[i
].lcid
) ||
1410 broken(lcid
== lcid_table
[i
].broken_lcid
), /* IE <6.0 */
1411 "#%02ld: got LCID 0x%lx (expected 0x%lx)\n", i
, lcid
, lcid_table
[i
].lcid
);
1414 ret
= pRfc1766ToLcidA(&lcid
, NULL
);
1415 ok(ret
== E_INVALIDARG
, "got 0x%08lx (expected E_INVALIDARG)\n", ret
);
1417 ret
= pRfc1766ToLcidA(NULL
, "en");
1418 ok(ret
== E_INVALIDARG
, "got 0x%08lx (expected E_INVALIDARG)\n", ret
);
1421 static void test_GetNumberOfCodePageInfo(IMultiLanguage2
*iML2
)
1427 hr
= IMultiLanguage2_GetNumberOfCodePageInfo(iML2
, &value
);
1428 ok( (hr
== S_OK
) && value
,
1429 "got 0x%lx with %d (expected S_OK with '!= 0')\n", hr
, value
);
1431 hr
= IMultiLanguage2_GetNumberOfCodePageInfo(iML2
, NULL
);
1432 ok(hr
== E_INVALIDARG
, "got 0x%lx (expected E_INVALIDARG)\n", hr
);
1436 static void test_GetRfc1766FromLcid(IMultiLanguage2
*iML2
)
1438 CHAR expected
[MAX_RFC1766_NAME
];
1439 CHAR buffer
[MAX_RFC1766_NAME
+ 1];
1444 for(i
= 0; i
< ARRAY_SIZE(lcid_table
); i
++) {
1448 hr
= IMultiLanguage2_GetRfc1766FromLcid(iML2
, lcid_table
[i
].lcid
, &rfcstr
);
1449 ok(hr
== lcid_table
[i
].hr
,
1450 "#%02ld: HRESULT 0x%lx (expected 0x%lx)\n", i
, hr
, lcid_table
[i
].hr
);
1453 continue; /* no result-string created */
1455 WideCharToMultiByte(CP_ACP
, 0, rfcstr
, -1, buffer
, sizeof(buffer
), NULL
, NULL
);
1456 LCMapStringA(LOCALE_USER_DEFAULT
, LCMAP_LOWERCASE
, lcid_table
[i
].rfc1766
,
1457 lstrlenA(lcid_table
[i
].rfc1766
) + 1, expected
, MAX_RFC1766_NAME
);
1459 /* IE <6.0 return "x-kok" for LCID 0x457 ("kok") */
1460 ok( (!lstrcmpA(buffer
, expected
)) ||
1461 broken(!lstrcmpA(buffer
, lcid_table
[i
].broken_rfc
)),
1462 "#%02ld: got '%s' (expected '%s')\n", i
, buffer
, expected
);
1464 SysFreeString(rfcstr
);
1467 hr
= IMultiLanguage2_GetRfc1766FromLcid(iML2
, MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), NULL
);
1468 ok(hr
== E_INVALIDARG
, "got 0x%lx (expected E_INVALIDARG)\n", hr
);
1471 static void test_LcidToRfc1766(void)
1473 CHAR expected
[MAX_RFC1766_NAME
];
1474 CHAR buffer
[MAX_RFC1766_NAME
* 2];
1478 for(i
= 0; i
< ARRAY_SIZE(lcid_table
); i
++) {
1480 memset(buffer
, '#', sizeof(buffer
)-1);
1481 buffer
[sizeof(buffer
)-1] = '\0';
1483 hr
= pLcidToRfc1766A(lcid_table
[i
].lcid
, buffer
, MAX_RFC1766_NAME
);
1485 /* IE <5.0 does not recognize 0x180c (fr-mc) and 0x457 (kok) */
1486 ok( (hr
== lcid_table
[i
].hr
) ||
1487 broken(lcid_table
[i
].broken_lcid
&& (hr
== E_FAIL
)),
1488 "#%02ld: HRESULT 0x%lx (expected 0x%lx)\n", i
, hr
, lcid_table
[i
].hr
);
1493 LCMapStringA(LOCALE_USER_DEFAULT
, LCMAP_LOWERCASE
, lcid_table
[i
].rfc1766
,
1494 lstrlenA(lcid_table
[i
].rfc1766
) + 1, expected
, MAX_RFC1766_NAME
);
1496 /* IE <6.0 return "x-kok" for LCID 0x457 ("kok") */
1497 /* IE <5.0 return "fr" for LCID 0x180c ("fr-mc") */
1498 ok( (!lstrcmpA(buffer
, expected
)) ||
1499 broken(!lstrcmpA(buffer
, lcid_table
[i
].broken_rfc
)),
1500 "#%02ld: got '%s' (expected '%s')\n", i
, buffer
, expected
);
1504 memset(buffer
, '#', sizeof(buffer
)-1);
1505 buffer
[sizeof(buffer
)-1] = '\0';
1506 hr
= pLcidToRfc1766A(-1, buffer
, MAX_RFC1766_NAME
);
1507 ok(hr
== E_FAIL
, "got 0x%08lx and '%s' (expected E_FAIL)\n", hr
, buffer
);
1509 hr
= pLcidToRfc1766A(LANG_ENGLISH
, NULL
, MAX_RFC1766_NAME
);
1510 ok(hr
== E_INVALIDARG
, "got 0x%08lx (expected E_INVALIDARG)\n", hr
);
1512 memset(buffer
, '#', sizeof(buffer
)-1);
1513 buffer
[sizeof(buffer
)-1] = '\0';
1514 hr
= pLcidToRfc1766A(LANG_ENGLISH
, buffer
, -1);
1515 ok(hr
== E_INVALIDARG
, "got 0x%08lx and '%s' (expected E_INVALIDARG)\n", hr
, buffer
);
1517 memset(buffer
, '#', sizeof(buffer
)-1);
1518 buffer
[sizeof(buffer
)-1] = '\0';
1519 hr
= pLcidToRfc1766A(LANG_ENGLISH
, buffer
, 0);
1520 ok(hr
== E_INVALIDARG
, "got 0x%08lx and '%s' (expected E_INVALIDARG)\n", hr
, buffer
);
1523 static void test_GetRfc1766Info(IMultiLanguage2
*iML2
)
1525 WCHAR short_broken_name
[MAX_LOCALE_NAME
];
1526 CHAR rfc1766A
[MAX_RFC1766_NAME
+ 1];
1527 BYTE buffer
[sizeof(RFC1766INFO
) + 4];
1528 PRFC1766INFO prfc
= (RFC1766INFO
*) buffer
;
1532 for(i
= 0; i
< ARRAY_SIZE(info_table
); i
++) {
1533 memset(buffer
, 'x', sizeof(RFC1766INFO
) + 2);
1534 buffer
[sizeof(buffer
) -1] = 0;
1535 buffer
[sizeof(buffer
) -2] = 0;
1537 ret
= IMultiLanguage2_GetRfc1766Info(iML2
, info_table
[i
].lcid
, info_table
[i
].lang
, prfc
);
1538 WideCharToMultiByte(CP_ACP
, 0, prfc
->wszRfc1766
, -1, rfc1766A
, MAX_RFC1766_NAME
, NULL
, NULL
);
1539 ok(ret
== S_OK
, "#%02ld: got 0x%lx (expected S_OK)\n", i
, ret
);
1540 ok(prfc
->lcid
== info_table
[i
].lcid
,
1541 "#%02ld: got 0x%04lx (expected 0x%04lx)\n", i
, prfc
->lcid
, info_table
[i
].lcid
);
1543 ok(!lstrcmpA(rfc1766A
, info_table
[i
].rfc1766
),
1544 "#%02ld: got '%s' (expected '%s')\n", i
, rfc1766A
, info_table
[i
].rfc1766
);
1546 /* Some IE versions truncate an oversized name one character too short */
1547 if (info_table
[i
].broken_name
) {
1548 lstrcpyW(short_broken_name
, info_table
[i
].broken_name
);
1549 short_broken_name
[MAX_LOCALE_NAME
- 2] = 0;
1552 todo_wine_if (info_table
[i
].todo
& TODO_NAME
) {
1553 ok( (!lstrcmpW(prfc
->wszLocaleName
, info_table
[i
].localename
)) ||
1554 (info_table
[i
].broken_name
&& (
1555 broken(!lstrcmpW(prfc
->wszLocaleName
, info_table
[i
].broken_name
)) || /* IE < 6.0 */
1556 broken(!lstrcmpW(prfc
->wszLocaleName
, short_broken_name
)))),
1557 "#%02ld: got %s (expected %s)\n", i
,
1558 wine_dbgstr_w(prfc
->wszLocaleName
), wine_dbgstr_w(info_table
[i
].localename
));
1562 /* SUBLANG_NEUTRAL only allowed for English, Arabic, Chinese */
1563 ret
= IMultiLanguage2_GetRfc1766Info(iML2
, MAKELANGID(LANG_GERMAN
, SUBLANG_NEUTRAL
), LANG_ENGLISH
, prfc
);
1564 ok(ret
== E_FAIL
, "got 0x%lx (expected E_FAIL)\n", ret
);
1566 ret
= IMultiLanguage2_GetRfc1766Info(iML2
, MAKELANGID(LANG_ITALIAN
, SUBLANG_NEUTRAL
), LANG_ENGLISH
, prfc
);
1567 ok(ret
== E_FAIL
, "got 0x%lx (expected E_FAIL)\n", ret
);
1569 /* NULL not allowed */
1570 ret
= IMultiLanguage2_GetRfc1766Info(iML2
, 0, LANG_ENGLISH
, prfc
);
1571 ok(ret
== E_FAIL
, "got 0x%lx (expected E_FAIL)\n", ret
);
1573 ret
= IMultiLanguage2_GetRfc1766Info(iML2
, LANG_ENGLISH
, LANG_ENGLISH
, NULL
);
1574 ok(ret
== E_INVALIDARG
, "got 0x%lx (expected E_INVALIDARG)\n", ret
);
1577 static void test_IMultiLanguage2_ConvertStringFromUnicode(IMultiLanguage2
*iML2
)
1579 CHAR dest
[MAX_PATH
];
1580 CHAR invariate
[MAX_PATH
];
1584 static WCHAR src
[] = {'a','b','c',0};
1586 memset(invariate
, 'x', sizeof(invariate
));
1589 memset(dest
, 'x', sizeof(dest
));
1590 srcsz
= lstrlenW(src
) + 1;
1591 destsz
= sizeof(dest
);
1592 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, NULL
,
1593 &srcsz
, dest
, &destsz
);
1594 ok(hr
== S_OK
|| hr
== E_FAIL
,"expected S_OK or E_FAIL, got %08lx\n",hr
);
1597 ok(srcsz
== lstrlenW(src
) + 1,
1598 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1600 else if (hr
== E_FAIL
)
1603 "Expected %u, got %u\n", 0, srcsz
);
1606 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1607 "Expected dest to be unchanged, got %s\n", dest
);
1608 ok(destsz
== 0, "Expected 0, got %u\n", destsz
);
1610 /* pcSrcSize NULL */
1611 memset(dest
, 'x', sizeof(dest
));
1612 destsz
= sizeof(dest
);
1613 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1614 NULL
, dest
, &destsz
);
1615 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1616 ok(!strncmp(dest
, "abc", 3),
1617 "Expected first three chars to be \"abc\"\n");
1618 ok(!memcmp(&dest
[3], invariate
, sizeof(dest
) - 3),
1619 "Expected rest of dest to be unchanged, got %s\n", dest
);
1620 ok(destsz
== lstrlenW(src
),
1621 "Expected %u, got %u\n", lstrlenW(src
), destsz
);
1623 /* both pSrcStr and pcSrcSize NULL */
1624 memset(dest
, 'x', sizeof(dest
));
1625 destsz
= sizeof(dest
);
1626 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, NULL
,
1627 NULL
, dest
, &destsz
);
1628 ok(hr
== S_OK
|| hr
== E_FAIL
, "Expected S_OK or E_FAIL, got %08lx\n", hr
);
1629 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1630 "Expected dest to be unchanged, got %s\n", dest
);
1631 ok(destsz
== 0, "Expected 0, got %u\n", destsz
);
1634 memset(dest
, 'x', sizeof(dest
));
1635 srcsz
= lstrlenW(src
) + 1;
1636 destsz
= sizeof(dest
);
1637 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1638 &srcsz
, NULL
, &destsz
);
1639 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1640 ok(srcsz
== lstrlenW(src
) + 1,
1641 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1642 ok(destsz
== lstrlenW(src
) + 1,
1643 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1645 /* pcDstSize NULL */
1646 memset(dest
, 'x', sizeof(dest
));
1647 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1648 &srcsz
, dest
, NULL
);
1649 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1650 ok(srcsz
== lstrlenW(src
) + 1,
1651 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1652 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1653 "Expected dest to be unchanged, got %s\n", dest
);
1655 /* pcSrcSize is 0 */
1656 memset(dest
, 'x', sizeof(dest
));
1658 destsz
= sizeof(dest
);
1659 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1660 &srcsz
, dest
, &destsz
);
1661 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1662 ok(srcsz
== 0, "Expected 0, got %u\n", srcsz
);
1663 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1664 "Expected dest to be unchanged, got %s\n", dest
);
1665 ok(destsz
== 0, "Expected 0, got %u\n", destsz
);
1667 /* pcSrcSize does not include NULL terminator */
1668 memset(dest
, 'x', sizeof(dest
));
1669 srcsz
= lstrlenW(src
);
1670 destsz
= sizeof(dest
);
1671 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1672 &srcsz
, dest
, &destsz
);
1673 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1674 ok(srcsz
== lstrlenW(src
),
1675 "Expected %u, got %u\n", lstrlenW(src
), srcsz
);
1676 ok(!strncmp(dest
, "abc", 3), "Expected first three chars to be \"abc\"\n");
1677 ok(!memcmp(&dest
[3], invariate
, sizeof(dest
) - 3),
1678 "Expected rest of dest to be unchanged, got %s\n", dest
);
1679 ok(destsz
== lstrlenW(src
),
1680 "Expected %u, got %u\n", lstrlenW(src
), destsz
);
1682 /* pcSrcSize includes NULL terminator */
1683 memset(dest
, 'x', sizeof(dest
));
1684 srcsz
= lstrlenW(src
) + 1;
1685 destsz
= sizeof(dest
);
1686 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1687 &srcsz
, dest
, &destsz
);
1688 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1689 ok(srcsz
== lstrlenW(src
) + 1, "Expected 3, got %u\n", srcsz
);
1690 ok(!lstrcmpA(dest
, "abc"), "Expected \"abc\", got \"%s\"\n", dest
);
1691 ok(destsz
== lstrlenW(src
) + 1,
1692 "Expected %u, got %u\n", lstrlenW(src
) + 1, destsz
);
1694 /* pcSrcSize is -1 */
1695 memset(dest
, 'x', sizeof(dest
));
1697 destsz
= sizeof(dest
);
1698 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1699 &srcsz
, dest
, &destsz
);
1700 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1701 ok(srcsz
== lstrlenW(src
),
1702 "Expected %u, got %u\n", lstrlenW(src
), srcsz
);
1703 ok(!strncmp(dest
, "abc", 3), "Expected first three chars to be \"abc\"\n");
1704 ok(!memcmp(&dest
[3], invariate
, sizeof(dest
) - 3),
1705 "Expected rest of dest to be unchanged, got %s\n", dest
);
1706 ok(destsz
== lstrlenW(src
),
1707 "Expected %u, got %u\n", lstrlenW(src
), destsz
);
1709 /* pcDstSize is 0 */
1710 memset(dest
, 'x', sizeof(dest
));
1711 srcsz
= lstrlenW(src
) + 1;
1713 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1714 &srcsz
, dest
, &destsz
);
1715 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1716 ok(srcsz
== lstrlenW(src
) + 1,
1717 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1718 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1719 "Expected dest to be unchanged, got %s\n", dest
);
1720 ok(destsz
== lstrlenW(src
) + 1,
1721 "Expected %u, got %u\n", lstrlenW(src
) + 1, destsz
);
1723 /* pcDstSize is not large enough */
1724 memset(dest
, 'x', sizeof(dest
));
1725 srcsz
= lstrlenW(src
) + 1;
1726 destsz
= lstrlenW(src
);
1727 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1728 &srcsz
, dest
, &destsz
);
1729 ok(hr
== E_FAIL
, "Expected E_FAIL, got %08lx\n", hr
);
1730 ok(srcsz
== 0, "Expected 0, got %u\n", srcsz
);
1731 ok(!strncmp(dest
, "abc", 3), "Expected first three chars to be \"abc\"\n");
1732 ok(!memcmp(&dest
[3], invariate
, sizeof(dest
) - 3),
1733 "Expected rest of dest to be unchanged, got %s\n", dest
);
1734 ok(destsz
== 0, "Expected 0, got %u\n", srcsz
);
1736 /* pcDstSize (bytes) does not leave room for NULL terminator */
1737 memset(dest
, 'x', sizeof(dest
));
1738 srcsz
= lstrlenW(src
) + 1;
1739 destsz
= lstrlenW(src
) * sizeof(WCHAR
);
1740 hr
= IMultiLanguage2_ConvertStringFromUnicode(iML2
, NULL
, 1252, src
,
1741 &srcsz
, dest
, &destsz
);
1742 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1743 ok(srcsz
== lstrlenW(src
) + 1,
1744 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1745 ok(!lstrcmpA(dest
, "abc"), "Expected \"abc\", got \"%s\"\n", dest
);
1746 ok(destsz
== lstrlenW(src
) + 1,
1747 "Expected %u, got %u\n", lstrlenW(src
) + 1, destsz
);
1750 static void test_ConvertINetUnicodeToMultiByte(void)
1752 CHAR dest
[MAX_PATH
];
1753 CHAR invariate
[MAX_PATH
];
1757 static WCHAR src
[] = {'a','b','c',0};
1759 memset(invariate
, 'x', sizeof(invariate
));
1762 memset(dest
, 'x', sizeof(dest
));
1763 srcsz
= lstrlenW(src
) + 1;
1764 destsz
= sizeof(dest
);
1765 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, NULL
, &srcsz
, dest
, &destsz
);
1766 ok(hr
== S_OK
|| hr
== E_FAIL
, "Expected S_OK or E_FAIL, got %08lx\n", hr
);
1768 ok(srcsz
== lstrlenW(src
) + 1,
1769 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1770 else if (hr
== E_FAIL
)
1772 "Expected %u, got %u\n", 0, srcsz
);
1773 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1774 "Expected dest to be unchanged, got %s\n", dest
);
1775 ok(destsz
== 0, "Expected 0, got %u\n", destsz
);
1777 /* lpnWideCharCount NULL */
1778 memset(dest
, 'x', sizeof(dest
));
1779 destsz
= sizeof(dest
);
1780 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, NULL
, dest
, &destsz
);
1781 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1782 ok(!strncmp(dest
, "abc", 3),
1783 "Expected first three chars to be \"abc\"\n");
1784 ok(!memcmp(&dest
[3], invariate
, sizeof(dest
) - 3),
1785 "Expected rest of dest to be unchanged, got %s\n", dest
);
1786 ok(destsz
== lstrlenW(src
),
1787 "Expected %u, got %u\n", lstrlenW(src
), destsz
);
1789 /* both lpSrcStr and lpnWideCharCount NULL */
1790 memset(dest
, 'x', sizeof(dest
));
1791 destsz
= sizeof(dest
);
1792 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, NULL
, NULL
, dest
, &destsz
);
1793 ok(hr
== S_OK
|| hr
== E_FAIL
, "Expected S_OK or E_FAIL, got %08lx\n", hr
);
1794 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1795 "Expected dest to be unchanged, got %s\n", dest
);
1796 ok(destsz
== 0, "Expected 0, got %u\n", destsz
);
1799 memset(dest
, 'x', sizeof(dest
));
1800 srcsz
= lstrlenW(src
) + 1;
1801 destsz
= sizeof(dest
);
1802 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, NULL
, &destsz
);
1803 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1804 ok(srcsz
== lstrlenW(src
) + 1,
1805 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1806 ok(destsz
== lstrlenW(src
) + 1,
1807 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1809 /* lpnMultiCharCount NULL */
1810 memset(dest
, 'x', sizeof(dest
));
1811 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, dest
, NULL
);
1812 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1813 ok(srcsz
== lstrlenW(src
) + 1,
1814 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1815 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1816 "Expected dest to be unchanged, got %s\n", dest
);
1818 /* lpnWideCharCount is 0 */
1819 memset(dest
, 'x', sizeof(dest
));
1821 destsz
= sizeof(dest
);
1822 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, dest
, &destsz
);
1823 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1824 ok(srcsz
== 0, "Expected 0, got %u\n", srcsz
);
1825 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1826 "Expected dest to be unchanged, got %s\n", dest
);
1827 ok(destsz
== 0, "Expected 0, got %u\n", destsz
);
1829 /* lpnWideCharCount does not include NULL terminator */
1830 memset(dest
, 'x', sizeof(dest
));
1831 srcsz
= lstrlenW(src
);
1832 destsz
= sizeof(dest
);
1833 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, dest
, &destsz
);
1834 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1835 ok(srcsz
== lstrlenW(src
),
1836 "Expected %u, got %u\n", lstrlenW(src
), srcsz
);
1837 ok(!strncmp(dest
, "abc", 3), "Expected first three chars to be \"abc\"\n");
1838 ok(!memcmp(&dest
[3], invariate
, sizeof(dest
) - 3),
1839 "Expected rest of dest to be unchanged, got %s\n", dest
);
1840 ok(destsz
== lstrlenW(src
),
1841 "Expected %u, got %u\n", lstrlenW(src
), destsz
);
1843 /* lpnWideCharCount includes NULL terminator */
1844 memset(dest
, 'x', sizeof(dest
));
1845 srcsz
= lstrlenW(src
) + 1;
1846 destsz
= sizeof(dest
);
1847 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, dest
, &destsz
);
1848 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1849 ok(srcsz
== lstrlenW(src
) + 1, "Expected 3, got %u\n", srcsz
);
1850 ok(!lstrcmpA(dest
, "abc"), "Expected \"abc\", got \"%s\"\n", dest
);
1851 ok(destsz
== lstrlenW(src
) + 1,
1852 "Expected %u, got %u\n", lstrlenW(src
) + 1, destsz
);
1854 /* lpnWideCharCount is -1 */
1855 memset(dest
, 'x', sizeof(dest
));
1857 destsz
= sizeof(dest
);
1858 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, dest
, &destsz
);
1859 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1860 ok(srcsz
== lstrlenW(src
),
1861 "Expected %u, got %u\n", lstrlenW(src
), srcsz
);
1862 ok(!strncmp(dest
, "abc", 3), "Expected first three chars to be \"abc\"\n");
1863 ok(!memcmp(&dest
[3], invariate
, sizeof(dest
) - 3),
1864 "Expected rest of dest to be unchanged, got %s\n", dest
);
1865 ok(destsz
== lstrlenW(src
),
1866 "Expected %u, got %u\n", lstrlenW(src
), destsz
);
1868 /* lpnMultiCharCount is 0 */
1869 memset(dest
, 'x', sizeof(dest
));
1870 srcsz
= lstrlenW(src
) + 1;
1872 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, dest
, &destsz
);
1873 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1874 ok(srcsz
== lstrlenW(src
) + 1,
1875 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1876 ok(!memcmp(dest
, invariate
, sizeof(dest
)),
1877 "Expected dest to be unchanged, got %s\n", dest
);
1878 ok(destsz
== lstrlenW(src
) + 1,
1879 "Expected %u, got %u\n", lstrlenW(src
) + 1, destsz
);
1881 /* lpnMultiCharCount is not large enough */
1882 memset(dest
, 'x', sizeof(dest
));
1883 srcsz
= lstrlenW(src
) + 1;
1884 destsz
= lstrlenW(src
);
1885 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, dest
, &destsz
);
1886 ok(hr
== E_FAIL
, "Expected E_FAIL, got %08lx\n", hr
);
1887 ok(srcsz
== 0, "Expected 0, got %u\n", srcsz
);
1888 ok(!strncmp(dest
, "abc", 3), "Expected first three chars to be \"abc\"\n");
1889 ok(!memcmp(&dest
[3], invariate
, sizeof(dest
) - 3),
1890 "Expected rest of dest to be unchanged, got %s\n", dest
);
1891 ok(destsz
== 0, "Expected 0, got %u\n", srcsz
);
1893 /* lpnMultiCharCount (bytes) does not leave room for NULL terminator */
1894 memset(dest
, 'x', sizeof(dest
));
1895 srcsz
= lstrlenW(src
) + 1;
1896 destsz
= lstrlenW(src
) * sizeof(WCHAR
);
1897 hr
= pConvertINetUnicodeToMultiByte(NULL
, 1252, src
, &srcsz
, dest
, &destsz
);
1898 ok(hr
== S_OK
, "Expected S_OK, got %08lx\n", hr
);
1899 ok(srcsz
== lstrlenW(src
) + 1,
1900 "Expected %u, got %u\n", lstrlenW(src
) + 1, srcsz
);
1901 ok(!lstrcmpA(dest
, "abc"), "Expected \"abc\", got \"%s\"\n", dest
);
1902 ok(destsz
== lstrlenW(src
) + 1,
1903 "Expected %u, got %u\n", lstrlenW(src
) + 1, destsz
);
1906 static void test_JapaneseConversion(void)
1909 static WCHAR unc_jp
[9][12] = {
1910 {9,0x31,0x20,0x3042,0x3044,0x3046,0x3048,0x304a,0x000d,0x000a},
1911 {9,0x31,0x20,0x30a2,0x30a4,0x30a6,0x30a8,0x30aa,0x000d,0x000a},
1912 {9,0x31,0x20,0xff71,0xff72,0xff73,0xff74,0xff75,0x000d,0x000a},
1913 {9,0x31,0x20,0x3041,0x3043,0x3045,0x3047,0x3049,0x000d,0x000a},
1914 {9,0x31,0x20,0x30a1,0x30a3,0x30a5,0x30a7,0x30a9,0x000d,0x000a},
1915 {9,0x31,0x20,0xff67,0xff68,0xff69,0xff6a,0xff6b,0x000d,0x000a},
1916 {9,0x31,0x20,0x300c,0x65e5,0x672c,0x8a9e,0x300d,0x000d,0x000a},
1917 {7,0x31,0x20,0x25c7,0x25c7,0x3012,0x000d,0x000a},
1918 {11,0x31,0x20,0x203b,0x3010,0x0074,0x0065,0x0073,0x0074,0x3011,0x000d,0x000a}
1920 static CHAR jis_jp
[9][27] = {
1921 {20,0x31,0x20,0x1b,0x24,0x42,0x24,0x22,0x24,0x24,0x24,0x26,0x24,0x28,
1922 0x24,0x2a,0x1b,0x28,0x42,0x0d,0x0a},
1923 {20,0x31,0x20,0x1b,0x24,0x42,0x25,0x22,0x25,0x24,0x25,0x26,0x25,0x28,
1924 0x25,0x2a,0x1b,0x28,0x42,0x0d,0x0a},
1925 {20,0x31,0x20,0x1b,0x24,0x42,0x25,0x22,0x25,0x24,0x25,0x26,0x25,0x28,
1926 0x25,0x2a,0x1b,0x28,0x42,0x0d,0x0a},
1927 {20,0x31,0x20,0x1b,0x24,0x42,0x24,0x21,0x24,0x23,0x24,0x25,0x24,0x27,
1928 0x24,0x29,0x1b,0x28,0x42,0x0d,0x0a},
1929 {20,0x31,0x20,0x1b,0x24,0x42,0x25,0x21,0x25,0x23,0x25,0x25,0x25,0x27,
1930 0x25,0x29,0x1b,0x28,0x42,0x0d,0x0a},
1931 {20,0x31,0x20,0x1b,0x24,0x42,0x25,0x21,0x25,0x23,0x25,0x25,0x25,0x27,
1932 0x25,0x29,0x1b,0x28,0x42,0x0d,0x0a},
1933 {20,0x31,0x20,0x1b,0x24,0x42,0x21,0x56,0x46,0x7c,0x4b,0x5c,0x38,0x6c,
1934 0x21,0x57,0x1b,0x28,0x42,0x0d,0x0a},
1935 {16,0x31,0x20,0x1b,0x24,0x42,0x21,0x7e,0x21,0x7e,0x22,0x29,0x1b,0x28,
1937 {26,0x31,0x20,0x1b,0x24,0x42,0x22,0x28,0x21,0x5a,0x1b,0x28,0x42,0x74,
1938 0x65,0x73,0x74,0x1b,0x24,0x42,0x21,0x5b,0x1b,0x28,0x42,0x0d,0x0a}
1940 static CHAR sjis_jp
[9][15] = {
1941 {14,0x31,0x20,0x82,0xa0,0x82,0xa2,0x82,0xa4,0x82,0xa6,0x82,0xa8,0x0d,0x0a},
1942 {14,0x31,0x20,0x83,0x41,0x83,0x43,0x83,0x45,0x83,0x47,0x83,0x49,0x0d,0x0a},
1943 {9,0x31,0x20,0xb1,0xb2,0xb3,0xb4,0xb5,0x0d,0x0a},
1944 {14,0x31,0x20,0x82,0x9f,0x82,0xa1,0x82,0xa3,0x82,0xa5,0x82,0xa7,0x0d,0x0a},
1945 {14,0x31,0x20,0x83,0x40,0x83,0x42,0x83,0x44,0x83,0x46,0x83,0x48,0x0d,0x0a},
1946 {9,0x31,0x20,0xa7,0xa8,0xa9,0xaa,0xab,0x0d,0x0a},
1947 {14,0x31,0x20,0x81,0x75,0x93,0xfa,0x96,0x7b,0x8c,0xea,0x81,0x76,0x0d,0x0a},
1948 {10,0x31,0x20,0x81,0x9e,0x81,0x9e,0x81,0xa7,0x0d,0x0a},
1949 {14,0x31,0x20,0x81,0xa6,0x81,0x79,0x74,0x65,0x73,0x74,0x81,0x7a,0x0d,0x0a}
1951 static CHAR euc_jp
[9][15] = {
1952 {14,0x31,0x20,0xa4,0xa2,0xa4,0xa4,0xa4,0xa6,0xa4,0xa8,0xa4,0xaa,0x0d,0x0a},
1953 {14,0x31,0x20,0xa5,0xa2,0xa5,0xa4,0xa5,0xa6,0xa5,0xa8,0xa5,0xaa,0x0d,0x0a},
1954 {14,0x31,0x20,0x8e,0xb1,0x8e,0xb2,0x8e,0xb3,0x8e,0xb4,0x8e,0xb5,0x0d,0x0a},
1955 {14,0x31,0x20,0xa4,0xa1,0xa4,0xa3,0xa4,0xa5,0xa4,0xa7,0xa4,0xa9,0x0d,0x0a},
1956 {14,0x31,0x20,0xa5,0xa1,0xa5,0xa3,0xa5,0xa5,0xa5,0xa7,0xa5,0xa9,0x0d,0x0a},
1957 {14,0x31,0x20,0x8e,0xa7,0x8e,0xa8,0x8e,0xa9,0x8e,0xaa,0x8e,0xab,0x0d,0x0a},
1958 {14,0x31,0x20,0xa1,0xd6,0xc6,0xfc,0xcb,0xdc,0xb8,0xec,0xa1,0xd7,0x0d,0x0a},
1959 {10,0x31,0x20,0xa1,0xfe,0xa1,0xfe,0xa2,0xa9,0x0d,0x0a},
1960 {14,0x31,0x20,0xa2,0xa8,0xa1,0xda,0x74,0x65,0x73,0x74,0xa1,0xdb,0x0d,0x0a}
1971 for (i
= 0; i
< 9; i
++)
1975 outlen
= jis_jp
[i
][0];
1976 srcsz
= unc_jp
[i
][0];
1977 hr
= pConvertINetUnicodeToMultiByte(NULL
, 50220, &unc_jp
[i
][1], &srcsz
, output
, &destsz
);
1980 skip("Code page identifier 50220 is not supported\n");
1983 ok(hr
== S_OK
,"(%i) Expected S_OK, got %08lx\n", i
, hr
);
1984 ok(destsz
== outlen
, "(%i) Expected %i, got %i\n",i
,outlen
,destsz
);
1985 ok(srcsz
== unc_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,unc_jp
[i
][0],srcsz
);
1986 ok(memcmp(output
,&jis_jp
[i
][1],destsz
)==0,"(%i) Strings do not match\n",i
);
1991 hr
= pConvertINetMultiByteToUnicode(NULL
, 50220, output
, &srcsz
, outputW
,&destsz
);
1994 * JIS does not have hankata so it get automatically converted to
1995 * zenkata. this means that strings 1 and 2 are identical as well as
2002 ok(hr
== S_OK
,"(%i) Expected S_OK, got %08lx\n",i
, hr
);
2003 ok(destsz
== unc_jp
[j
][0],"(%i) Expected %i, got %i\n",i
,unc_jp
[j
][0],destsz
);
2004 ok(srcsz
== outlen
,"(%i) Expected %i, got %i\n",i
,outlen
,srcsz
);
2005 ok(memcmp(outputW
,&unc_jp
[j
][1],destsz
)==0,"(%i) Strings do not match\n",i
);
2008 /* test unc->sjis */
2009 for (i
= 0; i
< 9; i
++)
2012 outlen
= sjis_jp
[i
][0];
2013 srcsz
= unc_jp
[i
][0];
2015 hr
= pConvertINetUnicodeToMultiByte(NULL
, 932, &unc_jp
[i
][1], &srcsz
, output
, &destsz
);
2018 skip("Code page identifier 932 is not supported\n");
2021 ok(hr
== S_OK
,"(%i) Expected S_OK, got %08lx\n",i
,hr
);
2022 ok(destsz
== outlen
,"(%i) Expected %i, got %i\n",i
,outlen
,destsz
);
2023 ok(srcsz
== unc_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,unc_jp
[i
][0],srcsz
);
2024 ok(memcmp(output
,&sjis_jp
[i
][1],outlen
)==0,"(%i) Strings do not match\n",i
);
2028 hr
= pConvertINetMultiByteToUnicode(NULL
, 932, output
, &srcsz
, outputW
,&destsz
);
2030 ok(hr
== S_OK
,"(%i) Expected S_OK, got %08lx\n", i
, hr
);
2031 ok(destsz
== unc_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,unc_jp
[i
][0],destsz
);
2032 ok(srcsz
== outlen
,"(%i) Expected %i, got %i\n",i
,outlen
,srcsz
);
2033 ok(memcmp(outputW
,&unc_jp
[i
][1],destsz
)==0,"(%i) Strings do not match\n",i
);
2037 for (i
= 0; i
< 9; i
++)
2040 outlen
= euc_jp
[i
][0];
2041 srcsz
= unc_jp
[i
][0];
2043 hr
= pConvertINetUnicodeToMultiByte(NULL
, 51932, &unc_jp
[i
][1], &srcsz
, output
, &destsz
);
2046 skip("Code page identifier 51932 is not supported\n");
2049 ok(hr
== S_OK
, "(%i) Expected S_OK, got %08lx\n",i
,hr
);
2050 ok(destsz
== outlen
, "(%i) Expected %i, got %i\n",i
,outlen
,destsz
);
2051 ok(srcsz
== unc_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,unc_jp
[i
][0],destsz
);
2052 ok(memcmp(output
,&euc_jp
[i
][1],outlen
)==0,"(%i) Strings do not match\n",i
);
2056 hr
= pConvertINetMultiByteToUnicode(NULL
, 51932, output
, &srcsz
, outputW
,&destsz
);
2058 ok(hr
== S_OK
,"(%i) Expected S_OK, got %08lx\n",i
,hr
);
2059 ok(destsz
== unc_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,unc_jp
[i
][0],destsz
);
2060 ok(srcsz
== outlen
,"(%i) Expected %i, got %i\n",i
,outlen
,srcsz
);
2061 ok(memcmp(outputW
,&unc_jp
[i
][1],destsz
)==0,"(%i) Strings do not match\n",i
);
2064 /* Japanese autodetect */
2067 srcsz
= jis_jp
[i
][0];
2068 hr
= pConvertINetMultiByteToUnicode(NULL
, 50932, &jis_jp
[i
][1], &srcsz
, outputW
, &destsz
);
2071 skip("Code page identifier 50932 is not supported\n");
2074 ok(hr
== S_OK
,"(%i) Expected S_OK, got %08lx\n",i
,hr
);
2075 ok(destsz
== unc_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,unc_jp
[i
][0],destsz
);
2076 ok(srcsz
== jis_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,jis_jp
[i
][0],srcsz
);
2077 ok(memcmp(outputW
,&unc_jp
[i
][1],destsz
)==0,"(%i) Strings do not match\n",i
);
2081 srcsz
= sjis_jp
[i
][0];
2082 hr
= pConvertINetMultiByteToUnicode(NULL
, 50932, &sjis_jp
[i
][1], &srcsz
, outputW
, &destsz
);
2083 ok(hr
== S_OK
,"(%i) Expected S_OK, got %08lx\n",i
,hr
);
2084 ok(destsz
== unc_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,unc_jp
[i
][0],destsz
);
2085 ok(srcsz
== sjis_jp
[i
][0],"(%i) Expected %i, got %i\n",i
,sjis_jp
[i
][0],srcsz
);
2086 ok(memcmp(outputW
,&unc_jp
[i
][1],destsz
)==0,"(%i) Strings do not match\n",i
);
2089 static void test_GetScriptFontInfo(IMLangFontLink2
*font_link
)
2093 SCRIPTFONTINFO sfi
[1];
2096 hr
= IMLangFontLink2_GetScriptFontInfo(font_link
, sidAsciiLatin
, 0, &nfonts
, NULL
);
2097 ok(hr
== S_OK
, "GetScriptFontInfo failed %lu\n", GetLastError());
2098 ok(nfonts
, "unexpected result\n");
2101 hr
= IMLangFontLink2_GetScriptFontInfo(font_link
, sidAsciiLatin
, SCRIPTCONTF_FIXED_FONT
, &nfonts
, NULL
);
2102 ok(hr
== S_OK
, "GetScriptFontInfo failed %lu\n", GetLastError());
2103 ok(nfonts
, "unexpected result\n");
2106 hr
= IMLangFontLink2_GetScriptFontInfo(font_link
, sidAsciiLatin
, SCRIPTCONTF_PROPORTIONAL_FONT
, &nfonts
, NULL
);
2107 ok(hr
== S_OK
, "GetScriptFontInfo failed %lu\n", GetLastError());
2108 ok(nfonts
, "unexpected result\n");
2111 memset(sfi
, 0, sizeof(sfi
));
2112 hr
= IMLangFontLink2_GetScriptFontInfo(font_link
, sidAsciiLatin
, SCRIPTCONTF_FIXED_FONT
, &nfonts
, sfi
);
2113 ok(hr
== S_OK
, "GetScriptFontInfo failed %lu\n", GetLastError());
2114 ok(nfonts
== 1, "got %u, expected 1\n", nfonts
);
2115 ok(sfi
[0].scripts
!= 0, "unexpected result\n");
2116 ok(sfi
[0].wszFont
[0], "unexpected result\n");
2119 memset(sfi
, 0, sizeof(sfi
));
2120 hr
= IMLangFontLink2_GetScriptFontInfo(font_link
, sidAsciiLatin
, SCRIPTCONTF_PROPORTIONAL_FONT
, &nfonts
, sfi
);
2121 ok(hr
== S_OK
, "GetScriptFontInfo failed %lu\n", GetLastError());
2122 ok(nfonts
== 1, "got %u, expected 1\n", nfonts
);
2123 ok(sfi
[0].scripts
!= 0, "unexpected result\n");
2124 ok(sfi
[0].wszFont
[0], "unexpected result\n");
2127 static void test_CodePageToScriptID(IMLangFontLink2
*font_link
)
2145 {1250, sidAsciiLatin
},
2146 {1251, sidCyrillic
},
2147 {1252, sidAsciiLatin
},
2149 {1254, sidAsciiLatin
},
2152 {1257, sidAsciiLatin
},
2153 {1258, sidAsciiLatin
},
2154 {CP_UNICODE
, 0, E_FAIL
}
2157 for (i
= 0; i
< ARRAY_SIZE(cp_sid
); i
++)
2159 hr
= IMLangFontLink2_CodePageToScriptID(font_link
, cp_sid
[i
].cp
, &sid
);
2160 ok(hr
== cp_sid
[i
].hr
, "%u CodePageToScriptID failed 0x%08lx %lu\n", i
, hr
, GetLastError());
2163 ok(sid
== cp_sid
[i
].sid
,
2164 "%u got sid %u for codepage %u, expected %u\n", i
, sid
, cp_sid
[i
].cp
, cp_sid
[i
].sid
);
2169 static void test_GetFontUnicodeRanges(IMLangFontLink2
*font_link
)
2173 HFONT hfont
, old_hfont
;
2178 hdc
= CreateCompatibleDC(0);
2179 memset(&lf
, 0, sizeof(lf
));
2180 lstrcpyA(lf
.lfFaceName
, "Arial");
2181 hfont
= CreateFontIndirectA(&lf
);
2182 old_hfont
= SelectObject(hdc
, hfont
);
2185 hr
= IMLangFontLink2_GetFontUnicodeRanges(font_link
, NULL
, &count
, NULL
);
2186 ok(hr
== E_FAIL
, "expected E_FAIL, got 0x%08lx\n", hr
);
2188 hr
= IMLangFontLink2_GetFontUnicodeRanges(font_link
, hdc
, NULL
, NULL
);
2189 ok(hr
== E_INVALIDARG
, "expected E_FAIL, got 0x%08lx\n", hr
);
2192 hr
= IMLangFontLink2_GetFontUnicodeRanges(font_link
, hdc
, &count
, NULL
);
2193 ok(hr
== S_OK
, "expected S_OK, got 0x%08lx\n", hr
);
2194 ok(count
, "expected count > 0\n");
2196 ur
= HeapAlloc(GetProcessHeap(), 0, sizeof(*ur
) * count
);
2198 hr
= IMLangFontLink2_GetFontUnicodeRanges(font_link
, hdc
, &count
, ur
);
2199 ok(hr
== S_OK
, "expected S_OK, got 0x%08lx\n", hr
);
2202 hr
= IMLangFontLink2_GetFontUnicodeRanges(font_link
, hdc
, &count
, ur
);
2203 ok(hr
== S_OK
, "expected S_OK, got 0x%08lx\n", hr
);
2205 HeapFree(GetProcessHeap(), 0, ur
);
2207 SelectObject(hdc
, old_hfont
);
2208 DeleteObject(hfont
);
2212 static void test_IsCodePageInstallable(IMultiLanguage2
*ml2
)
2217 for (i
= 0; i
< 1000; i
++)
2219 hr
= IMultiLanguage2_IsCodePageInstallable(ml2
, i
);
2221 /* it would be better to use IMultiLanguage2_ValidateCodePageEx here but that brings
2222 * up an installation dialog on some platforms, even when specifying CPIOD_PEEK.
2224 if (IsValidCodePage(i
))
2226 broken(hr
== S_FALSE
) || /* win2k */
2227 broken(hr
== E_INVALIDARG
), /* win2k */
2228 "code page %u is valid but not installable 0x%08lx\n", i
, hr
);
2232 static void test_GetGlobalFontLinkObject(void)
2237 ret
= GetGlobalFontLinkObject(NULL
);
2238 ok(ret
== E_INVALIDARG
, "expected E_INVALIDARG got %#lx\n", ret
);
2240 unknown
= (void *)0xdeadbeef;
2241 ret
= GetGlobalFontLinkObject(&unknown
);
2243 ok(ret
== S_OK
, "expected S_OK got %#lx\n", ret
);
2244 ok(unknown
!= NULL
&& unknown
!= (void *)0xdeadbeef,
2245 "GetGlobalFontLinkObject() returned %p\n", unknown
);
2249 static void test_IMLangConvertCharset(IMultiLanguage
*ml
)
2251 IMLangConvertCharset
*convert
;
2252 WCHAR strW
[] = {'a','b','c','d',0};
2253 UINT cp
, src_size
, dst_size
;
2254 char strA
[] = "abcd";
2258 hr
= IMultiLanguage_CreateConvertCharset(ml
, CP_ACP
, CP_UTF8
, 0, &convert
);
2260 ok(hr
== S_FALSE
, "expected S_FALSE got 0x%08lx\n", hr
);
2262 hr
= IMLangConvertCharset_GetSourceCodePage(convert
, NULL
);
2263 ok(hr
== E_INVALIDARG
, "got 0x%08lx\n", hr
);
2266 hr
= IMLangConvertCharset_GetSourceCodePage(convert
, &cp
);
2267 ok(hr
== S_OK
, "expected S_OK got 0x%08lx\n", hr
);
2268 ok(cp
== CP_ACP
, "got %d\n", cp
);
2270 hr
= IMLangConvertCharset_GetDestinationCodePage(convert
, NULL
);
2271 ok(hr
== E_INVALIDARG
, "got 0x%08lx\n", hr
);
2274 hr
= IMLangConvertCharset_GetDestinationCodePage(convert
, &cp
);
2275 ok(hr
== S_OK
, "expected S_OK got 0x%08lx\n", hr
);
2276 ok(cp
== CP_UTF8
, "got %d\n", cp
);
2278 /* DoConversionToUnicode */
2279 hr
= IMLangConvertCharset_Initialize(convert
, CP_UTF8
, CP_UNICODE
, 0);
2280 ok(hr
== S_OK
, "expected S_OK got 0x%08lx\n", hr
);
2282 hr
= IMLangConvertCharset_DoConversionToUnicode(convert
, NULL
, NULL
, NULL
, NULL
);
2283 ok(hr
== E_FAIL
|| broken(hr
== S_OK
) /* win2k */, "got 0x%08lx\n", hr
);
2289 hr
= IMLangConvertCharset_DoConversionToUnicode(convert
, strA
, &src_size
, buffW
, &dst_size
);
2290 ok(hr
== S_OK
, "got 0x%08lx\n", hr
);
2291 ok(!memcmp(buffW
, strW
, 4*sizeof(WCHAR
)), "got converted string %s\n", wine_dbgstr_wn(buffW
, dst_size
));
2292 ok(dst_size
== 4, "got %d\n", dst_size
);
2293 ok(buffW
[4] == 4, "got %d\n", buffW
[4]);
2294 ok(src_size
== 4, "got %d\n", src_size
);
2299 hr
= IMLangConvertCharset_DoConversionToUnicode(convert
, strA
, &src_size
, buffW
, &dst_size
);
2300 ok(hr
== S_OK
, "got 0x%08lx\n", hr
);
2301 ok(buffW
[0] == 1, "got %d\n", buffW
[0]);
2302 ok(dst_size
== 4, "got %d\n", dst_size
);
2303 ok(src_size
== 4, "got %d\n", src_size
);
2305 hr
= IMLangConvertCharset_Initialize(convert
, CP_UNICODE
, CP_UNICODE
, 0);
2306 ok(hr
== S_OK
, "expected S_OK got 0x%08lx\n", hr
);
2308 IMLangConvertCharset_Release(convert
);
2311 static const char stream_data
[] = "VCARD2.1test;test";
2312 static ULONG stream_pos
;
2314 static HRESULT WINAPI
stream_QueryInterface(IStream
*iface
, REFIID riid
, void **obj
)
2316 ok(FALSE
, "unexpected call\n");
2317 return E_NOINTERFACE
;
2320 static ULONG WINAPI
stream_AddRef(IStream
*iface
)
2322 ok(FALSE
, "unexpected call\n");
2326 static ULONG WINAPI
stream_Release(IStream
*iface
)
2328 ok(FALSE
, "unexpected call\n");
2332 static HRESULT WINAPI
stream_Read(IStream
*iface
, void *buf
, ULONG len
, ULONG
*read
)
2336 if (stream_pos
== sizeof(stream_data
) - 1)
2341 size
= min(sizeof(stream_data
) - 1 - stream_pos
, len
);
2342 memcpy(buf
, stream_data
+ stream_pos
, size
);
2348 static HRESULT WINAPI
stream_Write(IStream
*iface
, const void *buf
, ULONG len
, ULONG
*written
)
2350 ok(FALSE
, "unexpected call\n");
2354 static HRESULT WINAPI
stream_Seek(IStream
*iface
, LARGE_INTEGER move
, DWORD origin
,
2355 ULARGE_INTEGER
*newpos
)
2357 if (origin
== STREAM_SEEK_SET
)
2358 stream_pos
= move
.QuadPart
;
2359 else if (origin
== STREAM_SEEK_CUR
)
2360 stream_pos
+= move
.QuadPart
;
2361 else if (origin
== STREAM_SEEK_END
)
2362 stream_pos
= sizeof(stream_data
) - 1 - move
.QuadPart
;
2364 if (newpos
) newpos
->QuadPart
= stream_pos
;
2368 static HRESULT WINAPI
stream_SetSize(IStream
*iface
, ULARGE_INTEGER newsize
)
2370 ok(FALSE
, "unexpected call\n");
2374 static HRESULT WINAPI
stream_CopyTo(IStream
*iface
, IStream
*stream
, ULARGE_INTEGER len
,
2375 ULARGE_INTEGER
*read
, ULARGE_INTEGER
*written
)
2377 ok(FALSE
, "unexpected call\n");
2381 static HRESULT WINAPI
stream_Commit(IStream
*iface
, DWORD flags
)
2383 ok(FALSE
, "unexpected call\n");
2387 static HRESULT WINAPI
stream_Revert(IStream
*iface
)
2389 ok(FALSE
, "unexpected call\n");
2393 static HRESULT WINAPI
stream_LockRegion(IStream
*iface
, ULARGE_INTEGER offset
,
2394 ULARGE_INTEGER len
, DWORD locktype
)
2396 ok(FALSE
, "unexpected call\n");
2400 static HRESULT WINAPI
stream_UnlockRegion(IStream
*iface
, ULARGE_INTEGER offset
,
2401 ULARGE_INTEGER len
, DWORD locktype
)
2403 ok(FALSE
, "unexpected call\n");
2407 static HRESULT WINAPI
stream_Stat(IStream
*iface
, STATSTG
*stg
, DWORD flag
)
2409 ok(FALSE
, "unexpected call\n");
2413 static HRESULT WINAPI
stream_Clone(IStream
*iface
, IStream
**stream
)
2415 ok(FALSE
, "unexpected call\n");
2419 static const IStreamVtbl stream_vtbl
=
2421 stream_QueryInterface
,
2432 stream_UnlockRegion
,
2437 static IStream test_stream
= { &stream_vtbl
};
2439 static void test_DetectOutboundCodePageInIStream(IMultiLanguage3
*ml
)
2442 UINT nb_detected
, detected
[4];
2443 UINT preferred
[] = {1250,1251,1252,65001};
2444 UINT preferred2
[] = {1250,1251,1252};
2447 memset(detected
, 0, sizeof(detected
));
2448 hr
= IMultiLanguage3_DetectOutboundCodePageInIStream(ml
,
2449 MLDETECTF_PRESERVE_ORDER
, &test_stream
, preferred
,
2450 ARRAY_SIZE(preferred
), detected
, &nb_detected
, NULL
);
2451 ok(hr
== E_INVALIDARG
, "got %08lx\n", hr
);
2454 memset(detected
, 0, sizeof(detected
));
2455 hr
= IMultiLanguage3_DetectOutboundCodePageInIStream(ml
,
2456 MLDETECTF_PRESERVE_ORDER
, &test_stream
, preferred
,
2457 ARRAY_SIZE(preferred
), NULL
, &nb_detected
, NULL
);
2458 ok(hr
== E_INVALIDARG
, "got %08lx\n", hr
);
2461 memset(detected
, 0, sizeof(detected
));
2462 hr
= IMultiLanguage3_DetectOutboundCodePageInIStream(ml
,
2463 MLDETECTF_PRESERVE_ORDER
, &test_stream
, preferred
,
2464 ARRAY_SIZE(preferred
), detected
, &nb_detected
, NULL
);
2465 ok(hr
== S_OK
, "got %08lx\n", hr
);
2466 ok(nb_detected
== 1, "got %u\n", nb_detected
);
2467 ok(detected
[0] == 65001, "got %u\n", detected
[0]);
2470 memset(detected
, 0, sizeof(detected
));
2471 hr
= IMultiLanguage3_DetectOutboundCodePageInIStream(ml
,
2472 MLDETECTF_PRESERVE_ORDER
, &test_stream
, preferred
,
2473 ARRAY_SIZE(preferred
), detected
, &nb_detected
, NULL
);
2474 ok(hr
== S_OK
, "got %08lx\n", hr
);
2475 todo_wine
ok(nb_detected
== 2, "got %u\n", nb_detected
);
2476 ok(detected
[0] == 65001, "got %u\n", detected
[0]);
2477 todo_wine
ok(detected
[1] == 65000, "got %u\n", detected
[1]);
2480 memset(detected
, 0, sizeof(detected
));
2481 hr
= IMultiLanguage3_DetectOutboundCodePageInIStream(ml
,
2482 MLDETECTF_PRESERVE_ORDER
, &test_stream
, preferred
,
2483 ARRAY_SIZE(preferred
), detected
, &nb_detected
, NULL
);
2484 ok(hr
== S_OK
, "got %08lx\n", hr
);
2485 todo_wine
ok(nb_detected
== 3, "got %u\n", nb_detected
);
2486 ok(detected
[0] == 65001, "got %u\n", detected
[0]);
2487 todo_wine
ok(detected
[1] == 65000, "got %u\n", detected
[1]);
2488 todo_wine
ok(detected
[2] == 1200, "got %u\n", detected
[2]);
2491 memset(detected
, 0, sizeof(detected
));
2492 hr
= IMultiLanguage3_DetectOutboundCodePageInIStream(ml
,
2493 MLDETECTF_PRESERVE_ORDER
, &test_stream
, preferred
,
2494 ARRAY_SIZE(preferred
), detected
, &nb_detected
, NULL
);
2495 ok(hr
== S_OK
, "got %08lx\n", hr
);
2496 todo_wine
ok(nb_detected
== 3, "got %u\n", nb_detected
);
2497 ok(detected
[0] == 65001, "got %u\n", detected
[0]);
2498 todo_wine
ok(detected
[1] == 65000, "got %u\n", detected
[1]);
2499 todo_wine
ok(detected
[2] == 1200, "got %u\n", detected
[2]);
2500 ok(detected
[3] == 0, "got %u\n", detected
[3]);
2503 memset(detected
, 0, sizeof(detected
));
2504 hr
= IMultiLanguage3_DetectOutboundCodePageInIStream(ml
,
2505 MLDETECTF_PRESERVE_ORDER
, &test_stream
, preferred2
,
2506 ARRAY_SIZE(preferred2
), detected
, &nb_detected
, NULL
);
2507 ok(hr
== S_OK
, "got %08lx\n", hr
);
2508 todo_wine
ok(nb_detected
== 3, "got %u\n", nb_detected
);
2509 ok(detected
[0] == 65001, "got %u\n", detected
[0]);
2510 todo_wine
ok(detected
[1] == 65000, "got %u\n", detected
[1]);
2511 todo_wine
ok(detected
[2] == 1200, "got %u\n", detected
[2]);
2514 /* Returns true if the user interface is in English. Note that this does not
2515 * presume of the formatting of dates, numbers, etc.
2517 static BOOL
is_lang_english(void)
2519 static HMODULE hkernel32
= NULL
;
2520 static LANGID (WINAPI
*pGetThreadUILanguage
)(void) = NULL
;
2521 static LANGID (WINAPI
*pGetUserDefaultUILanguage
)(void) = NULL
;
2525 hkernel32
= GetModuleHandleA("kernel32.dll");
2526 pGetThreadUILanguage
= (void*)GetProcAddress(hkernel32
, "GetThreadUILanguage");
2527 pGetUserDefaultUILanguage
= (void*)GetProcAddress(hkernel32
, "GetUserDefaultUILanguage");
2529 if (pGetThreadUILanguage
)
2530 return PRIMARYLANGID(pGetThreadUILanguage()) == LANG_ENGLISH
;
2531 if (pGetUserDefaultUILanguage
)
2532 return PRIMARYLANGID(pGetUserDefaultUILanguage()) == LANG_ENGLISH
;
2534 return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH
;
2537 static void test_GetCodePageInfo(IMultiLanguage2
*iML2
)
2539 static const DWORD VALID_MASK
= (DWORD
)(~(MIMECONTF_VALID_NLS
| MIMECONTF_VALID
));
2541 const struct cpinfo_test_data
*test_data
= NULL
;
2543 MIMECPINFO cpinfo_cmp
;
2548 test_data
= iml2_cpinfo_data
;
2549 test_data_num
= ARRAY_SIZE(iml2_cpinfo_data
);
2550 for (i
= 0; i
< test_data_num
; i
++)
2552 ret
= IMultiLanguage2_GetCodePageInfo(iML2
, test_data
[i
].cpinfo
.uiCodePage
, LANG_NEUTRAL
, &cpinfo
);
2553 todo_wine_if(test_data
[i
].todo_GetCodePageInfo
)
2554 ok(ret
== S_OK
, "%d: IMultiLanguage2_GetCodePageInfo failed: 0x%08lx.\n", i
, ret
);
2558 cpinfo_cmp
= test_data
[i
].cpinfo
;
2559 todo_wine_if(test_data
[i
].todo_dwFlags
)
2560 ok((cpinfo
.dwFlags
== cpinfo_cmp
.dwFlags
) ||
2561 /* some code pages are not installed on the Wine Test Bot */
2562 ((cpinfo
.dwFlags
& VALID_MASK
) == (cpinfo_cmp
.dwFlags
& VALID_MASK
)),
2563 "%d: got wrong dwFlags expected 0x%lx return 0x%lx.\n",
2564 i
, cpinfo_cmp
.dwFlags
, cpinfo
.dwFlags
);
2565 ok(cpinfo
.uiCodePage
== cpinfo_cmp
.uiCodePage
,
2566 "%d: got wrong uiCodePage expected %u return %u.\n",
2567 i
, cpinfo_cmp
.uiCodePage
, cpinfo
.uiCodePage
);
2568 todo_wine_if(test_data
[i
].todo_uiFamilyCodePage
)
2569 ok(cpinfo
.uiFamilyCodePage
== cpinfo_cmp
.uiFamilyCodePage
,
2570 "%d: got wrong uiFamilyCodePage expected %u return %u.\n",
2571 i
, cpinfo_cmp
.uiFamilyCodePage
, cpinfo
.uiFamilyCodePage
);
2573 todo_wine_if(test_data
[i
].todo_wszWebCharset
)
2574 ok(!lstrcmpW(cpinfo
.wszWebCharset
, cpinfo_cmp
.wszWebCharset
),
2575 "%d: got wrong wszWebCharset expected %s return %s.\n",
2576 i
, wine_dbgstr_w(cpinfo_cmp
.wszWebCharset
), wine_dbgstr_w(cpinfo
.wszWebCharset
));
2577 todo_wine_if(test_data
[i
].todo_wszHeaderCharset
)
2578 ok(!lstrcmpW(cpinfo
.wszHeaderCharset
, cpinfo_cmp
.wszHeaderCharset
),
2579 "%d: got wrong wszHeaderCharset expected %s return %s.\n",
2580 i
, wine_dbgstr_w(cpinfo_cmp
.wszHeaderCharset
), wine_dbgstr_w(cpinfo
.wszHeaderCharset
));
2581 todo_wine_if(test_data
[i
].todo_wszBodyCharset
)
2582 ok(!lstrcmpW(cpinfo
.wszBodyCharset
, cpinfo_cmp
.wszBodyCharset
),
2583 "%d: got wrong wszBodyCharset expected %s return %s.\n",
2584 i
, wine_dbgstr_w(cpinfo_cmp
.wszBodyCharset
), wine_dbgstr_w(cpinfo
.wszBodyCharset
));
2586 if (!is_lang_english())
2588 /* FIXME: Cannot test non-English descriptions and font names */
2589 skip("Non-English locale\n");
2593 todo_wine_if(test_data
[i
].todo_wszDescription
)
2594 ok(!lstrcmpW(cpinfo
.wszDescription
, cpinfo_cmp
.wszDescription
),
2595 "%d: got wrong wszDescription expected %s return %s.\n",
2596 i
, wine_dbgstr_w(cpinfo_cmp
.wszDescription
), wine_dbgstr_w(cpinfo
.wszDescription
));
2597 todo_wine_if(test_data
[i
].todo_wszFixedWidthFont
)
2598 ok(!lstrcmpW(cpinfo
.wszFixedWidthFont
, cpinfo_cmp
.wszFixedWidthFont
),
2599 "%d: got wrong wszFixedWidthFont expected %s return %s.\n",
2600 i
, wine_dbgstr_w(cpinfo_cmp
.wszFixedWidthFont
), wine_dbgstr_w(cpinfo
.wszFixedWidthFont
));
2601 todo_wine_if(test_data
[i
].todo_wszProportionalFont
)
2602 ok(!lstrcmpW(cpinfo
.wszProportionalFont
, cpinfo_cmp
.wszProportionalFont
),
2603 "%d: got wrong wszProportionalFont expected %s return %s.\n",
2604 i
, wine_dbgstr_w(cpinfo_cmp
.wszProportionalFont
), wine_dbgstr_w(cpinfo
.wszProportionalFont
));
2610 static void test_MapFont(IMLangFontLink
*font_link
, IMLangFontLink2
*font_link2
)
2612 HFONT old_font
= NULL
;
2613 HFONT new_font
= NULL
;
2614 HFONT last_font
= NULL
;
2618 DWORD font_codepages
;
2624 codepages
= FS_LATIN1
| FS_LATIN2
| FS_CYRILLIC
| FS_GREEK
| FS_TURKISH
|
2625 FS_HEBREW
| FS_ARABIC
| FS_BALTIC
| FS_VIETNAMESE
| FS_THAI
|
2626 FS_JISJAPAN
| FS_CHINESESIMP
| FS_WANSUNG
| FS_CHINESETRAD
;
2627 old_font
= GetCurrentObject(hdc
, OBJ_FONT
);
2630 /* Tests for IMLangFontLink */
2632 ret
= IMLangFontLink_ResetFontMapping(font_link
);
2633 ok(ret
== S_OK
, "IMLangFontLink_ResetFontMapping: expected S_OK, got %08lx\n", ret
);
2635 ret
= IMLangFontLink_MapFont(font_link
, NULL
, 0, NULL
, NULL
);
2636 ok(ret
== E_FAIL
, "IMLangFontLink_MapFont: expected E_FAIL, got %08lx\n", ret
);
2637 ret
= IMLangFontLink_MapFont(font_link
, NULL
, codepages
, old_font
, &new_font
);
2638 ok(ret
== E_FAIL
, "IMLangFontLink_MapFont: expected E_FAIL, got %08lx\n", ret
);
2639 ret
= IMLangFontLink_MapFont(font_link
, hdc
, codepages
, NULL
, &new_font
);
2640 ok(ret
== E_FAIL
, "IMLangFontLink_MapFont: expected E_FAIL, got %08lx\n", ret
);
2642 ret
= IMLangFontLink_MapFont(font_link
, hdc
, codepages
, old_font
, NULL
);
2643 ok(ret
== S_OK
, "IMLangFontLink_MapFont: expected S_OK, got %08lx\n", ret
);
2644 ret
= IMLangFontLink_MapFont(font_link
, hdc
, codepages
, old_font
, &new_font
);
2645 ok(ret
== S_OK
&& new_font
!= NULL
, "IMLangFontLink_MapFont: expected S_OK/!NULL, got %08lx/%p\n", ret
, new_font
);
2646 last_font
= new_font
;
2647 ret
= IMLangFontLink_MapFont(font_link
, hdc
, codepages
, old_font
, &new_font
);
2648 ok(ret
== S_OK
&& new_font
== last_font
, "IMLangFontLink_MapFont: expected S_OK/%p, got %08lx/%p\n", last_font
, ret
, new_font
);
2650 ret
= IMLangFontLink_ReleaseFont(font_link
, NULL
);
2651 ok(ret
== E_FAIL
, "IMLangFontLink_ReleaseFont: expected E_FAIL, got %08lx\n", ret
);
2652 ret
= IMLangFontLink_ReleaseFont(font_link
, new_font
);
2653 ok(ret
== S_OK
, "IMLangFontLink_ReleaseFont: expected S_OK, got %08lx\n", ret
);
2654 ret
= IMLangFontLink_ResetFontMapping(font_link
);
2655 ok(ret
== S_OK
, "IMLangFontLink_ResetFontMapping: expected S_OK, got %08lx\n", ret
);
2657 /* Tests for IMLangFontLink2 */
2659 ret
= IMLangFontLink2_ResetFontMapping(font_link2
);
2660 ok(ret
== S_OK
, "IMLangFontLink2_ResetFontMapping: expected S_OK, got %08lx\n", ret
);
2662 ret
= IMLangFontLink2_MapFont(font_link2
, NULL
, 0, 0, NULL
);
2663 ok(ret
== E_FAIL
, "IMLangFontLink2_MapFont: expected E_FAIL, got %08lx\n", ret
);
2664 ret
= IMLangFontLink2_MapFont(font_link2
, NULL
, codepages
, ch
, &new_font
);
2665 ok(ret
== E_FAIL
, "IMLangFontLink2_MapFont: expected E_FAIL, got %08lx\n", ret
);
2666 ret
= IMLangFontLink2_MapFont(font_link2
, hdc
, 0, 0, NULL
);
2667 ok(ret
== E_INVALIDARG
, "IMLangFontLink2_MapFont: expected E_INVALIDARG, got %08lx\n", ret
);
2668 ret
= IMLangFontLink2_MapFont(font_link2
, hdc
, 0, ch
, NULL
);
2669 ok(ret
== E_INVALIDARG
, "IMLangFontLink2_MapFont: expected E_INVALIDARG, got %08lx\n", ret
);
2671 ret
= IMLangFontLink2_MapFont(font_link2
, hdc
, 0, ch
, &new_font
);
2673 ok(ret
== S_OK
|| broken(ret
== E_FAIL
), /* got E_FAIL on winxp and win2k */
2674 "IMLangFontLink2_MapFont: expected S_OK || E_FAIL, got %08lx\n", ret
);
2675 ret
= IMLangFontLink2_MapFont(font_link2
, hdc
, codepages
, 0, NULL
);
2676 ok(ret
== S_OK
, "IMLangFontLink2_MapFont: expected S_OK, got %08lx\n", ret
);
2677 ret
= IMLangFontLink2_MapFont(font_link2
, hdc
, codepages
, 0, &new_font
);
2678 ok(ret
== S_OK
&& new_font
!= NULL
, "IMLangFontLink2_MapFont: expected S_OK/!NULL, got %08lx/%p\n", ret
, new_font
);
2679 last_font
= new_font
;
2680 ret
= IMLangFontLink2_MapFont(font_link2
, hdc
, codepages
, 0, &new_font
);
2681 ok(ret
== S_OK
&& new_font
== last_font
, "IMLangFontLink2_MapFont: expected S_OK/%p, got %08lx/%p\n", last_font
, ret
, new_font
);
2683 ret
= IMLangFontLink2_ReleaseFont(font_link2
, NULL
);
2684 ok(ret
== E_FAIL
, "IMLangFontLink2_ReleaseFont: expected E_FAIL, got %08lx\n", ret
);
2685 ret
= IMLangFontLink2_ReleaseFont(font_link2
, new_font
);
2686 ok(ret
== S_OK
, "IMLangFontLink2_ReleaseFont: expected S_OK, got %08lx\n", ret
);
2687 ret
= IMLangFontLink2_ResetFontMapping(font_link2
);
2688 ok(ret
== S_OK
, "IMLangFontLink2_ResetFontMapping: expected S_OK, got %08lx\n", ret
);
2690 /* Show that the font cache is global */
2691 ret
= IMLangFontLink_MapFont(font_link
, hdc
, codepages
, old_font
, &font1
);
2692 ok(ret
== S_OK
, "MapFont() failed, hr %#lx.\n", ret
);
2693 ret
= IMLangFontLink2_MapFont(font_link2
, hdc
, codepages
, 0, &font2
);
2694 ok(ret
== S_OK
, "MapFont() failed, hr %#lx.\n", ret
);
2695 ok(font1
!= NULL
&& font2
!= NULL
, "expected !NULL/!NULL, got %p/%p\n", font1
, font2
);
2696 ok(font1
== font2
, "expected equal, got not equal\n");
2698 IMLangFontLink_GetFontCodePages(font_link
, hdc
, font1
, &font_codepages
);
2699 ok((codepages
& (~font_codepages
)) != 0 && (codepages
& font_codepages
) != 0,
2700 "code pages of font is incorrect\n");
2702 IMLangFontLink_ResetFontMapping(font_link
);
2703 IMLangFontLink2_ResetFontMapping(font_link2
);
2704 ReleaseDC(NULL
, hdc
);
2709 IMultiLanguage
*iML
= NULL
;
2710 IMultiLanguage2
*iML2
= NULL
;
2711 IMultiLanguage3
*iML3
= NULL
;
2712 IMLangFontLink
*iMLFL
= NULL
;
2713 IMLangFontLink2
*iMLFL2
= NULL
;
2716 if (!init_function_ptrs())
2720 test_Rfc1766ToLcid();
2721 test_LcidToRfc1766();
2723 test_ConvertINetUnicodeToMultiByte();
2724 test_JapaneseConversion();
2726 test_GetGlobalFontLinkObject();
2728 trace("IMultiLanguage\n");
2729 ret
= CoCreateInstance(&CLSID_CMultiLanguage
, NULL
, CLSCTX_INPROC_SERVER
,
2730 &IID_IMultiLanguage
, (void **)&iML
);
2731 if (ret
!= S_OK
|| !iML
) return;
2733 test_GetNumberOfCodePageInfo((IMultiLanguage2
*)iML
);
2734 test_IMLangConvertCharset(iML
);
2735 test_GetCharsetInfo_other(iML
);
2736 IMultiLanguage_Release(iML
);
2739 /* IMultiLanguage2 (IE5.0 and above) */
2740 trace("IMultiLanguage2\n");
2741 ret
= CoCreateInstance(&CLSID_CMultiLanguage
, NULL
, CLSCTX_INPROC_SERVER
,
2742 &IID_IMultiLanguage2
, (void **)&iML2
);
2743 if (ret
!= S_OK
|| !iML2
) return;
2746 test_GetLcidFromRfc1766(iML2
);
2747 test_GetRfc1766FromLcid(iML2
);
2748 test_GetRfc1766Info(iML2
);
2749 test_GetNumberOfCodePageInfo(iML2
);
2750 test_GetCodePageInfo(iML2
);
2752 test_EnumCodePages(iML2
, 0);
2753 test_EnumCodePages(iML2
, MIMECONTF_MIME_LATEST
);
2754 test_EnumCodePages(iML2
, MIMECONTF_BROWSER
);
2755 test_EnumCodePages(iML2
, MIMECONTF_MINIMAL
);
2756 test_EnumCodePages(iML2
, MIMECONTF_VALID
);
2757 /* FIXME: why MIMECONTF_MIME_REGISTRY returns 0 of supported codepages? */
2758 /*test_EnumCodePages(iML2, MIMECONTF_MIME_REGISTRY);*/
2760 test_EnumScripts(iML2
, 0);
2761 test_EnumScripts(iML2
, SCRIPTCONTF_SCRIPT_USER
);
2762 test_EnumScripts(iML2
, SCRIPTCONTF_SCRIPT_USER
| SCRIPTCONTF_SCRIPT_HIDE
| SCRIPTCONTF_SCRIPT_SYSTEM
);
2764 ret
= IMultiLanguage2_IsConvertible(iML2
, CP_UTF8
, CP_UNICODE
);
2765 ok(ret
== S_OK
, "IMultiLanguage2_IsConvertible(CP_UTF8 -> CP_UNICODE) = %08lx\n", ret
);
2766 ret
= IMultiLanguage2_IsConvertible(iML2
, CP_UNICODE
, CP_UTF8
);
2767 ok(ret
== S_OK
, "IMultiLanguage2_IsConvertible(CP_UNICODE -> CP_UTF8) = %08lx\n", ret
);
2769 test_multibyte_to_unicode_translations(iML2
);
2770 test_IMultiLanguage2_ConvertStringFromUnicode(iML2
);
2772 test_IsCodePageInstallable(iML2
);
2774 IMultiLanguage2_Release(iML2
);
2777 /* IMLangFontLink */
2778 ret
= CoCreateInstance(&CLSID_CMultiLanguage
, NULL
, CLSCTX_INPROC_SERVER
,
2779 &IID_IMLangFontLink
, (void **)&iMLFL
);
2780 if (ret
!= S_OK
|| !iMLFL
) return;
2782 IMLangFontLink_Test(iMLFL
);
2784 /* IMLangFontLink2 */
2785 ret
= CoCreateInstance(&CLSID_CMultiLanguage
, NULL
, CLSCTX_INPROC_SERVER
,
2786 &IID_IMLangFontLink2
, (void **)&iMLFL2
);
2787 if (ret
!= S_OK
|| !iMLFL2
) return;
2789 test_GetScriptFontInfo(iMLFL2
);
2790 test_GetFontUnicodeRanges(iMLFL2
);
2791 test_CodePageToScriptID(iMLFL2
);
2792 test_MapFont(iMLFL
, iMLFL2
);
2794 IMLangFontLink_Release(iMLFL
);
2795 IMLangFontLink2_Release(iMLFL2
);
2797 trace("IMultiLanguage3\n");
2798 ret
= CoCreateInstance(&CLSID_CMultiLanguage
, NULL
, CLSCTX_INPROC_SERVER
,
2799 &IID_IMultiLanguage3
, (void **)&iML3
);
2802 test_DetectOutboundCodePageInIStream(iML3
);
2803 IMultiLanguage3_Release(iML3
);