wmiutils: Implement IWbemPath::RemoveAllNamespaces.
[wine] / dlls / msvcp90 / ios.c
1 /*
2  * Copyright 2011 Piotr Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include <limits.h>
24 #include <share.h>
25
26 #include "msvcp90.h"
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
31
32 /* ?_Index@ios_base@std@@0HA */
33 int ios_base_Index = 0;
34 /* ?_Sync@ios_base@std@@0_NA */
35 MSVCP_bool ios_base_Sync = FALSE;
36
37 typedef struct {
38     streamoff off;
39     __int64 DECLSPEC_ALIGN(8) pos;
40     int state;
41 } fpos_int;
42
43 static inline const char* debugstr_fpos_int(fpos_int *fpos)
44 {
45     return wine_dbg_sprintf("fpos(%ld %s %d)", fpos->off, wine_dbgstr_longlong(fpos->pos), fpos->state);
46 }
47
48 typedef struct {
49     void (__cdecl *pfunc)(ios_base*, streamsize);
50     streamsize arg;
51 } manip_streamsize;
52
53 typedef struct {
54     void (__cdecl *pfunc)(ios_base*, int);
55     int arg;
56 } manip_int;
57
58 typedef enum {
59     INITFL_new   = 0,
60     INITFL_open  = 1,
61     INITFL_close = 2
62 } basic_filebuf__Initfl;
63
64 typedef struct {
65     basic_streambuf_char base;
66     codecvt_char *cvt;
67     char putback;
68     MSVCP_bool wrotesome;
69     int state;
70     MSVCP_bool close;
71     FILE *file;
72 } basic_filebuf_char;
73
74 typedef struct {
75     basic_streambuf_wchar base;
76     codecvt_wchar *cvt;
77     wchar_t putback;
78     MSVCP_bool wrotesome;
79     int state;
80     MSVCP_bool close;
81     FILE *file;
82 } basic_filebuf_wchar;
83
84 typedef enum {
85     STRINGBUF_allocated = 1,
86     STRINGBUF_no_write = 2,
87     STRINGBUF_no_read = 4,
88     STRINGBUF_append = 8,
89     STRINGBUF_at_end = 16
90 } basic_stringbuf_state;
91
92 typedef struct {
93     basic_streambuf_char base;
94     char *seekhigh;
95     int state;
96     char allocator; /* empty struct */
97 } basic_stringbuf_char;
98
99 typedef struct {
100     basic_streambuf_wchar base;
101     wchar_t *seekhigh;
102     int state;
103     char allocator; /* empty struct */
104 } basic_stringbuf_wchar;
105
106 typedef struct {
107     ios_base base;
108     basic_streambuf_char *strbuf;
109     struct _basic_ostream_char *stream;
110     char fillch;
111 } basic_ios_char;
112
113 typedef struct {
114     ios_base base;
115     basic_streambuf_wchar *strbuf;
116     struct _basic_ostream_wchar *stream;
117     wchar_t fillch;
118 } basic_ios_wchar;
119
120 typedef struct _basic_ostream_char {
121     const int *vbtable;
122     /* virtual inheritance
123      * basic_ios_char basic_ios;
124      */
125 } basic_ostream_char;
126
127 typedef struct _basic_ostream_wchar {
128     const int *vbtable;
129     /* virtual inheritance
130      * basic_ios_wchar basic_ios;
131      */
132 } basic_ostream_wchar;
133
134 typedef struct {
135     const int *vbtable;
136     streamsize count;
137     /* virtual inheritance
138      * basic_ios_char basic_ios;
139      */
140 } basic_istream_char;
141
142 typedef struct {
143     const int *vbtable;
144     streamsize count;
145     /* virtual inheritance
146      * basic_ios_wchar basic_ios;
147      */
148 } basic_istream_wchar;
149
150 typedef struct {
151     basic_istream_char base1;
152     basic_ostream_char base2;
153     /* virtual inheritance
154      * basic_ios_char basic_ios;
155      */
156 } basic_iostream_char;
157
158 typedef struct {
159     basic_istream_wchar base1;
160     basic_ostream_wchar base2;
161     /* virtual inheritance
162      * basic_ios_wchar basic_ios;
163      */
164 } basic_iostream_wchar;
165
166 typedef struct {
167     basic_ostream_char base;
168     basic_filebuf_char filebuf;
169     /* virtual inheritance
170      * basic_ios_char basic_ios;
171      */
172 } basic_ofstream_char;
173
174 typedef struct {
175     basic_ostream_wchar base;
176     basic_filebuf_wchar filebuf;
177     /* virtual inheritance
178      * basic_ios_wchar basic_ios;
179      */
180 } basic_ofstream_wchar;
181
182 typedef struct {
183     basic_istream_char base;
184     basic_filebuf_char filebuf;
185     /* virtual inheritance
186      * basic_ios_char basic_ios;
187      */
188 } basic_ifstream_char;
189
190 typedef struct {
191     basic_istream_wchar base;
192     basic_filebuf_wchar filebuf;
193     /* virtual inheritance
194      * basic_ios_wchar basic_ios;
195      */
196 } basic_ifstream_wchar;
197
198 typedef struct {
199     basic_iostream_char base;
200     basic_filebuf_char filebuf;
201     /* virtual inheritance
202      * basic_ios_char basic_ios;
203      */
204 } basic_fstream_char;
205
206 typedef struct {
207     basic_iostream_wchar base;
208     basic_filebuf_wchar filebuf;
209     /* virtual inheritance
210      * basic_ios_char basic_ios;
211      */
212 } basic_fstream_wchar;
213
214 typedef struct {
215     basic_ostream_char base;
216     basic_stringbuf_char strbuf;
217     /* virtual inheritance
218      * basic_ios_char basic_ios;
219      */
220 } basic_ostringstream_char;
221
222 typedef struct {
223     basic_ostream_wchar base;
224     basic_stringbuf_wchar strbuf;
225     /* virtual inheritance
226      * basic_ios_wchar basic_ios;
227      */
228 } basic_ostringstream_wchar;
229
230 typedef struct {
231     basic_istream_char base;
232     basic_stringbuf_char strbuf;
233     /* virtual inheritance
234      * basic_ios_char basic_ios;
235      */
236 } basic_istringstream_char;
237
238 typedef struct {
239     basic_istream_wchar base;
240     basic_stringbuf_wchar strbuf;
241     /* virtual inheritance
242      * basic_ios_wchar basic_ios;
243      */
244 } basic_istringstream_wchar;
245
246 typedef struct {
247     basic_iostream_char base;
248     basic_stringbuf_char strbuf;
249     /* virtual inheritance
250      * basic_ios_char basic_ios;
251      */
252 } basic_stringstream_char;
253
254 typedef struct {
255     basic_iostream_wchar base;
256     basic_stringbuf_wchar strbuf;
257     /* virtual inheritance
258      * basic_ios_wchar basic_ios;
259      */
260 } basic_stringstream_wchar;
261
262 typedef enum {
263     STRSTATE_Allocated = 1,
264     STRSTATE_Constant = 2,
265     STRSTATE_Dynamic = 4,
266     STRSTATE_Frozen = 8
267 } strstreambuf__Strstate;
268
269 typedef struct {
270     basic_streambuf_char base;
271     streamsize minsize;
272     char *endsave;
273     char *seekhigh;
274     int strmode;
275     void* (__cdecl *palloc)(MSVCP_size_t);
276     void (__cdecl *pfree)(void*);
277 } strstreambuf;
278
279 extern const vtable_ptr MSVCP_iosb_vtable;
280
281 /* ??_7ios_base@std@@6B@ */
282 extern const vtable_ptr MSVCP_ios_base_vtable;
283
284 /* ??_7?$basic_ios@DU?$char_traits@D@std@@@std@@6B@ */
285 extern const vtable_ptr MSVCP_basic_ios_char_vtable;
286
287 /* ??_7?$basic_ios@_WU?$char_traits@_W@std@@@std@@6B@ */
288 extern const vtable_ptr MSVCP_basic_ios_wchar_vtable;
289
290 /* ??_7?$basic_ios@GU?$char_traits@G@std@@@std@@6B@ */
291 extern const vtable_ptr MSVCP_basic_ios_short_vtable;
292
293 /* ??_7?$basic_streambuf@DU?$char_traits@D@std@@@std@@6B@ */
294 extern const vtable_ptr MSVCP_basic_streambuf_char_vtable;
295
296 /* ??_7?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@6B@ */
297 extern const vtable_ptr MSVCP_basic_streambuf_wchar_vtable;
298
299 /* ??_7?$basic_streambuf@GU?$char_traits@G@std@@@std@@6B@ */
300 extern const vtable_ptr MSVCP_basic_streambuf_short_vtable;
301
302 /* ??_7?$basic_filebuf@DU?$char_traits@D@std@@@std@@6B@ */
303 extern const vtable_ptr MSVCP_basic_filebuf_char_vtable;
304
305 /* ??_7?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@6B@ */
306 extern const vtable_ptr MSVCP_basic_filebuf_wchar_vtable;
307
308 /* ??_7?$basic_filebuf@GU?$char_traits@G@std@@@std@@6B@ */
309 extern const vtable_ptr MSVCP_basic_filebuf_short_vtable;
310
311 /* ??_7?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
312 extern const vtable_ptr MSVCP_basic_stringbuf_char_vtable;
313
314 /* ??_7?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
315 extern const vtable_ptr MSVCP_basic_stringbuf_wchar_vtable;
316
317 /* ??_7?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
318 extern const vtable_ptr MSVCP_basic_stringbuf_short_vtable;
319
320 /* ??_8?$basic_ostream@DU?$char_traits@D@std@@@std@@7B@ */
321 const int basic_ostream_char_vbtable[] = {0, sizeof(basic_ostream_char)};
322 /* ??_7?$basic_ostream@DU?$char_traits@D@std@@@std@@6B@ */
323 extern const vtable_ptr MSVCP_basic_ostream_char_vtable;
324
325 /* ??_8?$basic_ostream@_WU?$char_traits@_W@std@@@std@@7B@ */
326 const int basic_ostream_wchar_vbtable[] = {0, sizeof(basic_ostream_wchar)};
327 /* ??_7?$basic_ostream@_WU?$char_traits@_W@std@@@std@@6B@ */
328 extern const vtable_ptr MSVCP_basic_ostream_wchar_vtable;
329
330 /* ??_8?$basic_ostream@GU?$char_traits@G@std@@@std@@7B@ */
331 const int basic_ostream_short_vbtable[] = {0, sizeof(basic_ostream_wchar)};
332 /* ??_7?$basic_ostream@GU?$char_traits@G@std@@@std@@6B@ */
333 extern const vtable_ptr MSVCP_basic_ostream_short_vtable;
334
335 /* ??_8?$basic_istream@DU?$char_traits@D@std@@@std@@7B@ */
336 const int basic_istream_char_vbtable[] = {0, sizeof(basic_istream_char)};
337 /* ??_7?$basic_istream@DU?$char_traits@D@std@@@std@@6B@ */
338 extern const vtable_ptr MSVCP_basic_istream_char_vtable;
339
340 /* ??_8?$basic_istream@_WU?$char_traits@_W@std@@@std@@7B@ */
341 const int basic_istream_wchar_vbtable[] = {0, sizeof(basic_istream_wchar)};
342 /* ??_7?$basic_istream@_WU?$char_traits@_W@std@@@std@@6B@ */
343 extern const vtable_ptr MSVCP_basic_istream_wchar_vtable;
344
345 /* ??_8?$basic_istream@GU?$char_traits@G@std@@@std@@7B@ */
346 const int basic_istream_short_vbtable[] = {0, sizeof(basic_istream_wchar)};
347 /* ??_7?$basic_istream@GU?$char_traits@G@std@@@std@@6B@ */
348 extern const vtable_ptr MSVCP_basic_istream_short_vtable;
349
350 /* ??_8?$basic_iostream@DU?$char_traits@D@std@@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
351 const int basic_iostream_char_vbtable1[] = {0, sizeof(basic_iostream_char)};
352 /* ??_8?$basic_iostream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
353 const int basic_iostream_char_vbtable2[] = {0, sizeof(basic_iostream_char)-FIELD_OFFSET(basic_iostream_char, base2)};
354 /* ??_7?$basic_iostream@DU?$char_traits@D@std@@@std@@6B@ */
355 extern const vtable_ptr MSVCP_basic_iostream_char_vtable;
356
357 /* ??_8?$basic_iostream@_WU?$char_traits@_W@std@@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
358 /* ??_8?$basic_iostream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
359 const int basic_iostream_wchar_vbtable1[] = {0, sizeof(basic_iostream_wchar)};
360 /* ??_8?$basic_iostream@_WU?$char_traits@_W@std@@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
361 /* ??_8?$basic_iostream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
362 const int basic_iostream_wchar_vbtable2[] = {0, sizeof(basic_iostream_wchar)-FIELD_OFFSET(basic_iostream_wchar, base2)};
363 /* ??_7?$basic_iostream@_WU?$char_traits@_W@std@@@std@@6B@ */
364 extern const vtable_ptr MSVCP_basic_iostream_wchar_vtable;
365 /* ??_7?$basic_iostream@GU?$char_traits@G@std@@@std@@6B@ */
366 extern const vtable_ptr MSVCP_basic_iostream_short_vtable;
367
368 /* ??_8?$basic_ofstream@DU?$char_traits@D@std@@@std@@7B@ */
369 const int basic_ofstream_char_vbtable[] = {0, sizeof(basic_ofstream_char)};
370 /* ??_7?$basic_ofstream@DU?$char_traits@D@std@@@std@@6B@ */
371 extern const vtable_ptr MSVCP_basic_ofstream_char_vtable;
372
373 /* ??_8?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@7B@ */
374 const int basic_ofstream_wchar_vbtable[] = {0, sizeof(basic_ofstream_wchar)};
375 /* ??_7?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@6B@ */
376 extern const vtable_ptr MSVCP_basic_ofstream_wchar_vtable;
377
378 /* ??_8?$basic_ofstream@GU?$char_traits@G@std@@@std@@7B@ */
379 const int basic_ofstream_short_vbtable[] = {0, sizeof(basic_ofstream_wchar)};
380 /* ??_7?$basic_ofstream@GU?$char_traits@G@std@@@std@@6B@ */
381 extern const vtable_ptr MSVCP_basic_ofstream_short_vtable;
382
383 /* ??_8?$basic_ifstream@DU?$char_traits@D@std@@@std@@7B@ */
384 const int basic_ifstream_char_vbtable[] = {0, sizeof(basic_ifstream_char)};
385 /* ??_7?$basic_ifstream@DU?$char_traits@D@std@@@std@@6B@ */
386 extern const vtable_ptr MSVCP_basic_ifstream_char_vtable;
387
388 /* ??_8?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@7B@ */
389 const int basic_ifstream_wchar_vbtable[] = {0, sizeof(basic_ifstream_wchar)};
390 /* ??_7?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@6B@ */
391 extern const vtable_ptr MSVCP_basic_ifstream_wchar_vtable;
392
393 /* ??_8?$basic_ifstream@GU?$char_traits@G@std@@@std@@7B@ */
394 const int basic_ifstream_short_vbtable[] = {0, sizeof(basic_ifstream_wchar)};
395 /* ??_7?$basic_ifstream@GU?$char_traits@G@std@@@std@@6B@ */
396 extern const vtable_ptr MSVCP_basic_ifstream_short_vtable;
397
398 /* ??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
399 const int basic_fstream_char_vbtable1[] = {0, sizeof(basic_fstream_char)};
400 /* ??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
401 const int basic_fstream_char_vbtable2[] = {0, sizeof(basic_fstream_char)-FIELD_OFFSET(basic_fstream_char, base.base2)};
402 /* ??_7?$basic_fstream@DU?$char_traits@D@std@@@std@@6B@ */
403 extern const vtable_ptr MSVCP_basic_fstream_char_vtable;
404
405 /* ??_8?$basic_fstream@_WU?$char_traits@_W@std@@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
406 /* ??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
407 const int basic_fstream_wchar_vbtable1[] = {0, sizeof(basic_fstream_wchar)};
408 /* ??_8?$basic_fstream@_WU?$char_traits@_W@std@@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
409 /* ??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
410 const int basic_fstream_wchar_vbtable2[] = {0, sizeof(basic_fstream_wchar)-FIELD_OFFSET(basic_fstream_wchar, base.base2)};
411 /* ??_7?$basic_fstream@_WU?$char_traits@_W@std@@@std@@6B@ */
412 extern const vtable_ptr MSVCP_basic_fstream_wchar_vtable;
413 /* ??_7?$basic_fstream@GU?$char_traits@G@std@@@std@@6B@ */
414 extern const vtable_ptr MSVCP_basic_fstream_short_vtable;
415
416 /* ??_8?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B@ */
417 const int basic_ostringstream_char_vbtable[] = {0, sizeof(basic_ostringstream_char)};
418 /* ??_7?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
419 extern const vtable_ptr MSVCP_basic_ostringstream_char_vtable;
420
421 /* ??_8?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B@ */
422 const int basic_ostringstream_wchar_vbtable[] = {0, sizeof(basic_ostringstream_wchar)};
423 /* ??_7?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
424 extern const vtable_ptr MSVCP_basic_ostringstream_wchar_vtable;
425
426 /* ??_8?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B@ */
427 const int basic_ostringstream_short_vbtable[] = {0, sizeof(basic_ostringstream_wchar)};
428 /* ??_7?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
429 extern const vtable_ptr MSVCP_basic_ostringstream_short_vtable;
430
431 /* ??_8?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B@ */
432 const int basic_istringstream_char_vbtable[] = {0, sizeof(basic_istringstream_char)};
433 /* ??_7?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
434 extern const vtable_ptr MSVCP_basic_istringstream_char_vtable;
435
436 /* ??_8?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B@ */
437 const int basic_istringstream_wchar_vbtable[] = {0, sizeof(basic_istringstream_wchar)};
438 /* ??_7?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
439 extern const vtable_ptr MSVCP_basic_istringstream_wchar_vtable;
440
441 /* ??_8?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B@ */
442 const int basic_istringstream_short_vbtable[] = {0, sizeof(basic_istringstream_wchar)};
443 /* ??_7?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
444 extern const vtable_ptr MSVCP_basic_istringstream_short_vtable;
445
446 /* ??_8?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
447 const int basic_stringstream_char_vbtable1[] = {0, sizeof(basic_stringstream_char)};
448 /* ??_8?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
449 const int basic_stringstream_char_vbtable2[] = {0, sizeof(basic_stringstream_char)-FIELD_OFFSET(basic_stringstream_char, base.base2)};
450 /* ??_7?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
451 extern const vtable_ptr MSVCP_basic_stringstream_char_vtable;
452
453 /* ??_8?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
454 const int basic_stringstream_wchar_vbtable1[] = {0, sizeof(basic_stringstream_wchar)};
455 /* ??_8?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
456 const int basic_stringstream_wchar_vbtable2[] = {0, sizeof(basic_stringstream_wchar)-FIELD_OFFSET(basic_stringstream_wchar, base.base2)};
457 /* ??_7?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
458 extern const vtable_ptr MSVCP_basic_stringstream_wchar_vtable;
459
460 /* ??_8?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
461 const int basic_stringstream_short_vbtable1[] = {0, sizeof(basic_stringstream_wchar)};
462 /* ??_8?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
463 const int basic_stringstream_short_vbtable2[] = {0, sizeof(basic_stringstream_wchar)-FIELD_OFFSET(basic_stringstream_wchar, base.base2)};
464 /* ??_7?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
465 extern const vtable_ptr MSVCP_basic_stringstream_short_vtable;
466
467 /* ??_7strstreambuf@std@@6B */
468 extern const vtable_ptr MSVCP_strstreambuf_vtable;
469
470 DEFINE_RTTI_DATA0(iosb, 0, ".?AV?$_Iosb@H@std@@")
471 DEFINE_RTTI_DATA1(ios_base, 0, &iosb_rtti_base_descriptor, ".?AV?$_Iosb@H@std@@")
472 DEFINE_RTTI_DATA2(basic_ios_char, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
473         ".?AV?$basic_ios@DU?$char_traits@D@std@@@std@@")
474 DEFINE_RTTI_DATA2(basic_ios_wchar, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
475         ".?AV?$basic_ios@_WU?$char_traits@_W@std@@@std@@")
476 DEFINE_RTTI_DATA2(basic_ios_short, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
477         ".?AV?$basic_ios@GU?$char_traits@G@std@@@std@@")
478 DEFINE_RTTI_DATA0(basic_streambuf_char, 0,
479         ".?AV?$basic_streambuf@DU?$char_traits@D@std@@@std@@")
480 DEFINE_RTTI_DATA0(basic_streambuf_wchar, 0,
481         ".?AV?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@")
482 DEFINE_RTTI_DATA0(basic_streambuf_short, 0,
483         ".?AV?$basic_streambuf@GU?$char_traits@G@std@@@std@@")
484 DEFINE_RTTI_DATA1(basic_filebuf_char, 0, &basic_streambuf_char_rtti_base_descriptor,
485         ".?AV?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@")
486 DEFINE_RTTI_DATA1(basic_filebuf_wchar, 0, &basic_streambuf_wchar_rtti_base_descriptor,
487         ".?AV?$basic_filebuf@GU?$char_traits@G@std@@@std@@")
488 DEFINE_RTTI_DATA1(basic_filebuf_short, 0, &basic_streambuf_short_rtti_base_descriptor,
489         ".?AV?$basic_filebuf@DU?$char_traits@D@std@@@std@@")
490 DEFINE_RTTI_DATA1(basic_stringbuf_char, 0, &basic_streambuf_char_rtti_base_descriptor,
491         ".?AV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@")
492 DEFINE_RTTI_DATA1(basic_stringbuf_wchar, 0, &basic_streambuf_wchar_rtti_base_descriptor,
493         ".?AV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@")
494 DEFINE_RTTI_DATA1(basic_stringbuf_short, 0, &basic_streambuf_short_rtti_base_descriptor,
495         ".?AV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@")
496 DEFINE_RTTI_DATA3(basic_ostream_char, sizeof(basic_ostream_char), &basic_ios_char_rtti_base_descriptor,
497         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
498         ".?AV?$basic_ostream@DU?$char_traits@D@std@@@std@@")
499 DEFINE_RTTI_DATA3(basic_ostream_wchar, sizeof(basic_ostream_wchar), &basic_ios_wchar_rtti_base_descriptor,
500         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
501         ".?AV?$basic_ostream@_WU?$char_traits@_W@std@@@std@@")
502 DEFINE_RTTI_DATA3(basic_ostream_short, sizeof(basic_ostream_wchar), &basic_ios_short_rtti_base_descriptor,
503         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
504         ".?AV?$basic_ostream@GU?$char_traits@G@std@@@std@@")
505 DEFINE_RTTI_DATA3(basic_istream_char, sizeof(basic_istream_char), &basic_ios_char_rtti_base_descriptor,
506         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
507         ".?AV?$basic_istream@DU?$char_traits@D@std@@@std@@")
508 DEFINE_RTTI_DATA3(basic_istream_wchar, sizeof(basic_istream_wchar), &basic_ios_wchar_rtti_base_descriptor,
509         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
510         ".?AV?$basic_istream@_WU?$char_traits@_W@std@@@std@@")
511 DEFINE_RTTI_DATA3(basic_istream_short, sizeof(basic_istream_wchar), &basic_ios_short_rtti_base_descriptor,
512         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
513         ".?AV?$basic_istream@GU?$char_traits@G@std@@@std@@")
514 DEFINE_RTTI_DATA8(basic_iostream_char, sizeof(basic_iostream_char),
515         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
516         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
517         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
518         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
519         ".?AV?$basic_iostream@DU?$char_traits@D@std@@@std@@")
520 DEFINE_RTTI_DATA8(basic_iostream_wchar, sizeof(basic_iostream_wchar),
521         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
522         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
523         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
524         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
525         ".?AV?$basic_iostream@_WU?$char_traits@_W@std@@@std@@")
526 DEFINE_RTTI_DATA8(basic_iostream_short, sizeof(basic_iostream_wchar),
527         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
528         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
529         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
530         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
531         ".?AV?$basic_iostream@GU?$char_traits@G@std@@@std@@")
532 DEFINE_RTTI_DATA4(basic_ofstream_char, sizeof(basic_ofstream_char),
533         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
534         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
535         ".?AV?$basic_ofstream@DU?$char_traits@D@std@@@std@@")
536 DEFINE_RTTI_DATA4(basic_ofstream_wchar, sizeof(basic_ofstream_wchar),
537         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
538         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
539         ".?AV?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@")
540 DEFINE_RTTI_DATA4(basic_ofstream_short, sizeof(basic_ofstream_wchar),
541         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
542         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
543         ".?AV?$basic_ofstream@GU?$char_traits@G@std@@@std@@")
544 DEFINE_RTTI_DATA4(basic_ifstream_char, sizeof(basic_ifstream_char),
545         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
546         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
547         ".?AV?$basic_ifstream@DU?$char_traits@D@std@@@std@@")
548 DEFINE_RTTI_DATA4(basic_ifstream_wchar, sizeof(basic_ifstream_wchar),
549         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
550         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
551         ".?AV?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@")
552 DEFINE_RTTI_DATA4(basic_ifstream_short, sizeof(basic_ifstream_wchar),
553         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
554         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
555         ".?AV?$basic_ifstream@GU?$char_traits@G@std@@@std@@")
556 DEFINE_RTTI_DATA8(basic_fstream_char, sizeof(basic_fstream_char),
557         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
558         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
559         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
560         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
561         ".?AV?$basic_fstream@DU?$char_traits@D@std@@@std@@")
562 DEFINE_RTTI_DATA8(basic_fstream_wchar, sizeof(basic_fstream_wchar),
563         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
564         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
565         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
566         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
567         ".?AV?$basic_fstream@_WU?$char_traits@_W@std@@@std@@")
568 DEFINE_RTTI_DATA8(basic_fstream_short, sizeof(basic_fstream_wchar),
569         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
570         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
571         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
572         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
573         ".?AV?$basic_fstream@GU?$char_traits@G@std@@@std@@")
574 DEFINE_RTTI_DATA4(basic_ostringstream_char, sizeof(basic_ostringstream_char),
575         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
576         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
577         ".?AV?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@")
578 DEFINE_RTTI_DATA4(basic_ostringstream_wchar, sizeof(basic_ostringstream_wchar),
579         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
580         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
581         ".?AV?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@")
582 DEFINE_RTTI_DATA4(basic_ostringstream_short, sizeof(basic_ostringstream_wchar),
583         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
584         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
585         ".?AV?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@")
586 DEFINE_RTTI_DATA4(basic_istringstream_char, sizeof(basic_istringstream_char),
587         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
588         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
589         ".?AV?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@")
590 DEFINE_RTTI_DATA4(basic_istringstream_wchar, sizeof(basic_istringstream_wchar),
591         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
592         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
593         ".?AV?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@")
594 DEFINE_RTTI_DATA4(basic_istringstream_short, sizeof(basic_istringstream_wchar),
595         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
596         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
597         ".?AV?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@")
598 DEFINE_RTTI_DATA8(basic_stringstream_char, sizeof(basic_stringstream_char),
599         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
600         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
601         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
602         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
603         ".?AV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@")
604 DEFINE_RTTI_DATA8(basic_stringstream_wchar, sizeof(basic_stringstream_wchar),
605         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
606         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
607         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
608         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
609         ".?AV?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@")
610 DEFINE_RTTI_DATA8(basic_stringstream_short, sizeof(basic_stringstream_wchar),
611         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
612         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
613         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
614         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
615         ".?AV?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@")
616 DEFINE_RTTI_DATA1(strstreambuf, sizeof(strstreambuf),
617         &basic_streambuf_char_rtti_base_descriptor, ".?AVstrstreambuf@std@@")
618
619 #ifndef __GNUC__
620 void __asm_dummy_vtables(void) {
621 #endif
622     __ASM_VTABLE(iosb,
623             VTABLE_ADD_FUNC(iosb_vector_dtor));
624     __ASM_VTABLE(ios_base,
625             VTABLE_ADD_FUNC(ios_base_vector_dtor));
626     __ASM_VTABLE(basic_ios_char,
627             VTABLE_ADD_FUNC(basic_ios_char_vector_dtor));
628     __ASM_VTABLE(basic_ios_wchar,
629             VTABLE_ADD_FUNC(basic_ios_wchar_vector_dtor));
630     __ASM_VTABLE(basic_ios_short,
631             VTABLE_ADD_FUNC(basic_ios_wchar_vector_dtor));
632     __ASM_VTABLE(basic_streambuf_char,
633             VTABLE_ADD_FUNC(basic_streambuf_char_vector_dtor)
634             VTABLE_ADD_FUNC(basic_streambuf_char_overflow)
635             VTABLE_ADD_FUNC(basic_streambuf_char_pbackfail)
636             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
637             VTABLE_ADD_FUNC(basic_streambuf_char_underflow)
638             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
639             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
640             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
641             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
642             VTABLE_ADD_FUNC(basic_streambuf_char_seekoff)
643             VTABLE_ADD_FUNC(basic_streambuf_char_seekpos)
644             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
645             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
646             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
647     __ASM_VTABLE(basic_streambuf_wchar,
648             VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
649             VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
650             VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
651             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
652             VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
653             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
654             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
655             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
656             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
657             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
658             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
659             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
660             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
661             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
662     __ASM_VTABLE(basic_streambuf_short,
663             VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
664             VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
665             VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
666             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
667             VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
668             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
669             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
670             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
671             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
672             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
673             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
674             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
675             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
676             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
677     __ASM_VTABLE(basic_filebuf_char,
678             VTABLE_ADD_FUNC(basic_filebuf_char_vector_dtor)
679             VTABLE_ADD_FUNC(basic_filebuf_char_overflow)
680             VTABLE_ADD_FUNC(basic_filebuf_char_pbackfail)
681             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
682             VTABLE_ADD_FUNC(basic_filebuf_char_underflow)
683             VTABLE_ADD_FUNC(basic_filebuf_char_uflow)
684             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
685             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
686             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
687             VTABLE_ADD_FUNC(basic_filebuf_char_seekoff)
688             VTABLE_ADD_FUNC(basic_filebuf_char_seekpos)
689             VTABLE_ADD_FUNC(basic_filebuf_char_setbuf)
690             VTABLE_ADD_FUNC(basic_filebuf_char_sync)
691             VTABLE_ADD_FUNC(basic_filebuf_char_imbue));
692     __ASM_VTABLE(basic_filebuf_wchar,
693             VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
694             VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
695             VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
696             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
697             VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
698             VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
699             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
700             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
701             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
702             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
703             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
704             VTABLE_ADD_FUNC(basic_filebuf_wchar_setbuf)
705             VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
706             VTABLE_ADD_FUNC(basic_filebuf_wchar_imbue));
707     __ASM_VTABLE(basic_filebuf_short,
708             VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
709             VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
710             VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
711             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
712             VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
713             VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
714             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
715             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
716             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
717             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
718             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
719             VTABLE_ADD_FUNC(basic_filebuf_short_setbuf)
720             VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
721             VTABLE_ADD_FUNC(basic_filebuf_short_imbue));
722     __ASM_VTABLE(basic_stringbuf_char,
723             VTABLE_ADD_FUNC(basic_stringbuf_char_vector_dtor)
724             VTABLE_ADD_FUNC(basic_stringbuf_char_overflow)
725             VTABLE_ADD_FUNC(basic_stringbuf_char_pbackfail)
726             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
727             VTABLE_ADD_FUNC(basic_stringbuf_char_underflow)
728             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
729             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
730             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
731             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
732             VTABLE_ADD_FUNC(basic_stringbuf_char_seekoff)
733             VTABLE_ADD_FUNC(basic_stringbuf_char_seekpos)
734             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
735             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
736             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
737     __ASM_VTABLE(basic_stringbuf_wchar,
738             VTABLE_ADD_FUNC(basic_stringbuf_wchar_vector_dtor)
739             VTABLE_ADD_FUNC(basic_stringbuf_wchar_overflow)
740             VTABLE_ADD_FUNC(basic_stringbuf_wchar_pbackfail)
741             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
742             VTABLE_ADD_FUNC(basic_stringbuf_wchar_underflow)
743             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
744             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
745             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
746             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
747             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekoff)
748             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekpos)
749             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
750             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
751             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
752     __ASM_VTABLE(basic_stringbuf_short,
753             VTABLE_ADD_FUNC(basic_stringbuf_wchar_vector_dtor)
754             VTABLE_ADD_FUNC(basic_stringbuf_wchar_overflow)
755             VTABLE_ADD_FUNC(basic_stringbuf_wchar_pbackfail)
756             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
757             VTABLE_ADD_FUNC(basic_stringbuf_wchar_underflow)
758             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
759             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
760             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
761             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
762             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekoff)
763             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekpos)
764             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
765             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
766             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
767     __ASM_VTABLE(basic_ostream_char,
768             VTABLE_ADD_FUNC(basic_ostream_char_vector_dtor));
769     __ASM_VTABLE(basic_ostream_wchar,
770             VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
771     __ASM_VTABLE(basic_ostream_short,
772             VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
773     __ASM_VTABLE(basic_istream_char,
774             VTABLE_ADD_FUNC(basic_istream_char_vector_dtor));
775     __ASM_VTABLE(basic_istream_wchar,
776             VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
777     __ASM_VTABLE(basic_istream_short,
778             VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
779     __ASM_VTABLE(basic_iostream_char,
780             VTABLE_ADD_FUNC(basic_iostream_char_vector_dtor));
781     __ASM_VTABLE(basic_iostream_wchar,
782             VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
783     __ASM_VTABLE(basic_iostream_short,
784             VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
785     __ASM_VTABLE(basic_ofstream_char,
786             VTABLE_ADD_FUNC(basic_ofstream_char_vector_dtor));
787     __ASM_VTABLE(basic_ofstream_wchar,
788             VTABLE_ADD_FUNC(basic_ofstream_wchar_vector_dtor));
789     __ASM_VTABLE(basic_ofstream_short,
790             VTABLE_ADD_FUNC(basic_ofstream_wchar_vector_dtor));
791     __ASM_VTABLE(basic_ifstream_char,
792             VTABLE_ADD_FUNC(basic_ifstream_char_vector_dtor));
793     __ASM_VTABLE(basic_ifstream_wchar,
794             VTABLE_ADD_FUNC(basic_ifstream_wchar_vector_dtor));
795     __ASM_VTABLE(basic_ifstream_short,
796             VTABLE_ADD_FUNC(basic_ifstream_wchar_vector_dtor));
797     __ASM_VTABLE(basic_fstream_char,
798             VTABLE_ADD_FUNC(basic_fstream_char_vector_dtor));
799     __ASM_VTABLE(basic_fstream_wchar,
800             VTABLE_ADD_FUNC(basic_fstream_wchar_vector_dtor));
801     __ASM_VTABLE(basic_fstream_short,
802             VTABLE_ADD_FUNC(basic_fstream_wchar_vector_dtor));
803     __ASM_VTABLE(basic_ostringstream_char,
804             VTABLE_ADD_FUNC(basic_ostringstream_char_vector_dtor));
805     __ASM_VTABLE(basic_ostringstream_wchar,
806             VTABLE_ADD_FUNC(basic_ostringstream_wchar_vector_dtor));
807     __ASM_VTABLE(basic_ostringstream_short,
808             VTABLE_ADD_FUNC(basic_ostringstream_wchar_vector_dtor));
809     __ASM_VTABLE(basic_istringstream_char,
810             VTABLE_ADD_FUNC(basic_istringstream_char_vector_dtor));
811     __ASM_VTABLE(basic_istringstream_wchar,
812             VTABLE_ADD_FUNC(basic_istringstream_wchar_vector_dtor));
813     __ASM_VTABLE(basic_istringstream_short,
814             VTABLE_ADD_FUNC(basic_istringstream_wchar_vector_dtor));
815     __ASM_VTABLE(basic_stringstream_char,
816             VTABLE_ADD_FUNC(basic_stringstream_char_vector_dtor));
817     __ASM_VTABLE(basic_stringstream_wchar,
818             VTABLE_ADD_FUNC(basic_stringstream_wchar_vector_dtor));
819     __ASM_VTABLE(basic_stringstream_short,
820             VTABLE_ADD_FUNC(basic_stringstream_wchar_vector_dtor));
821     __ASM_VTABLE(strstreambuf,
822             VTABLE_ADD_FUNC(strstreambuf_vector_dtor)
823             VTABLE_ADD_FUNC(strstreambuf_overflow)
824             VTABLE_ADD_FUNC(strstreambuf_pbackfail)
825             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
826             VTABLE_ADD_FUNC(strstreambuf_underflow)
827             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
828             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
829             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
830             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
831             VTABLE_ADD_FUNC(strstreambuf_seekoff)
832             VTABLE_ADD_FUNC(strstreambuf_seekpos)
833             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
834             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
835             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
836 #ifndef __GNUC__
837 }
838 #endif
839
840 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
841 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
842 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp_next, 16)
843 void __thiscall basic_streambuf_char_setp_next(basic_streambuf_char *this, char *first, char *next, char *last)
844 {
845     TRACE("(%p %p %p %p)\n", this, first, next, last);
846
847     this->wbuf = first;
848     this->wpos = next;
849     this->wsize = last-next;
850 }
851
852 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z */
853 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD0@Z */
854 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp, 12)
855 void __thiscall basic_streambuf_char_setp(basic_streambuf_char *this, char *first, char *last)
856 {
857     basic_streambuf_char_setp_next(this, first, first, last);
858 }
859
860 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
861 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
862 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setg, 16)
863 void __thiscall basic_streambuf_char_setg(basic_streambuf_char *this, char *first, char *next, char *last)
864 {
865     TRACE("(%p %p %p %p)\n", this, first, next, last);
866
867     this->rbuf = first;
868     this->rpos = next;
869     this->rsize = last-next;
870 }
871
872 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXXZ */
873 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXXZ */
874 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init_empty, 4)
875 void __thiscall basic_streambuf_char__Init_empty(basic_streambuf_char *this)
876 {
877     TRACE("(%p)\n", this);
878
879     this->prbuf = &this->rbuf;
880     this->pwbuf = &this->wbuf;
881     this->prpos = &this->rpos;
882     this->pwpos = &this->wpos;
883     this->prsize = &this->rsize;
884     this->pwsize = &this->wsize;
885
886     basic_streambuf_char_setp(this, NULL, NULL);
887     basic_streambuf_char_setg(this, NULL, NULL, NULL);
888 }
889
890 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@W4_Uninitialized@1@@Z */
891 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
892 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor_uninitialized, 8)
893 basic_streambuf_char* __thiscall basic_streambuf_char_ctor_uninitialized(basic_streambuf_char *this, int uninitialized)
894 {
895     TRACE("(%p %d)\n", this, uninitialized);
896     this->vtable = &MSVCP_basic_streambuf_char_vtable;
897     mutex_ctor(&this->lock);
898     return this;
899 }
900
901 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ */
902 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ */
903 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor, 4)
904 basic_streambuf_char* __thiscall basic_streambuf_char_ctor(basic_streambuf_char *this)
905 {
906     TRACE("(%p)\n", this);
907
908     this->vtable = &MSVCP_basic_streambuf_char_vtable;
909     mutex_ctor(&this->lock);
910     this->loc = MSVCRT_operator_new(sizeof(locale));
911     locale_ctor(this->loc);
912     basic_streambuf_char__Init_empty(this);
913
914     return this;
915 }
916
917 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
918 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
919 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_dtor, 4)
920 void __thiscall basic_streambuf_char_dtor(basic_streambuf_char *this)
921 {
922     TRACE("(%p)\n", this);
923
924     mutex_dtor(&this->lock);
925     locale_dtor(this->loc);
926     MSVCRT_operator_delete(this->loc);
927 }
928
929 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_vector_dtor, 8)
930 basic_streambuf_char* __thiscall basic_streambuf_char_vector_dtor(basic_streambuf_char *this, unsigned int flags)
931 {
932     TRACE("(%p %x)\n", this, flags);
933     if(flags & 2) {
934         /* we have an array, with the number of elements stored before the first object */
935         INT_PTR i, *ptr = (INT_PTR *)this-1;
936
937         for(i=*ptr-1; i>=0; i--)
938             basic_streambuf_char_dtor(this+i);
939         MSVCRT_operator_delete(ptr);
940     } else {
941         basic_streambuf_char_dtor(this);
942         if(flags & 1)
943             MSVCRT_operator_delete(this);
944     }
945
946     return this;
947 }
948
949 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
950 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
951 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnavail, 4)
952 streamsize __thiscall basic_streambuf_char__Gnavail(const basic_streambuf_char *this)
953 {
954     TRACE("(%p)\n", this);
955     return *this->prpos ? *this->prsize : 0;
956 }
957
958 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
959 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
960 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gndec, 4)
961 char* __thiscall basic_streambuf_char__Gndec(basic_streambuf_char *this)
962 {
963     TRACE("(%p)\n", this);
964     (*this->prsize)++;
965     (*this->prpos)--;
966     return *this->prpos;
967 }
968
969 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
970 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
971 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gninc, 4)
972 char* __thiscall basic_streambuf_char__Gninc(basic_streambuf_char *this)
973 {
974     TRACE("(%p)\n", this);
975     (*this->prsize)--;
976     return (*this->prpos)++;
977 }
978
979 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
980 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
981 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnpreinc, 4)
982 char* __thiscall basic_streambuf_char__Gnpreinc(basic_streambuf_char *this)
983 {
984     TRACE("(%p)\n", this);
985     (*this->prsize)--;
986     (*this->prpos)++;
987     return *this->prpos;
988 }
989
990 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAPAD0PAH001@Z */
991 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAPEAD0PEAH001@Z */
992 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init, 28)
993 void __thiscall basic_streambuf_char__Init(basic_streambuf_char *this, char **gf, char **gn, int *gc, char **pf, char **pn, int *pc)
994 {
995     TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
996
997     this->prbuf = gf;
998     this->pwbuf = pf;
999     this->prpos = gn;
1000     this->pwpos = pn;
1001     this->prsize = gc;
1002     this->pwsize = pc;
1003 }
1004
1005 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1006 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1007 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Lock, 4)
1008 void __thiscall basic_streambuf_char__Lock(basic_streambuf_char *this)
1009 {
1010     TRACE("(%p)\n", this);
1011     mutex_lock(&this->lock);
1012 }
1013
1014 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
1015 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
1016 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pnavail, 4)
1017 streamsize __thiscall basic_streambuf_char__Pnavail(const basic_streambuf_char *this)
1018 {
1019     TRACE("(%p)\n", this);
1020     return *this->pwpos ? *this->pwsize : 0;
1021 }
1022
1023 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
1024 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
1025 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pninc, 4)
1026 char* __thiscall basic_streambuf_char__Pninc(basic_streambuf_char *this)
1027 {
1028     TRACE("(%p)\n", this);
1029     (*this->pwsize)--;
1030     return (*this->pwpos)++;
1031 }
1032
1033 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1034 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1035 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_underflow, 4)
1036 #define call_basic_streambuf_char_underflow(this) CALL_VTBL_FUNC(this, 16, \
1037         int, (basic_streambuf_char*), (this))
1038 int __thiscall basic_streambuf_char_underflow(basic_streambuf_char *this)
1039 {
1040     TRACE("(%p)\n", this);
1041     return EOF;
1042 }
1043
1044 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1045 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1046 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_uflow, 4)
1047 #define call_basic_streambuf_char_uflow(this) CALL_VTBL_FUNC(this, 20, \
1048         int, (basic_streambuf_char*), (this))
1049 int __thiscall basic_streambuf_char_uflow(basic_streambuf_char *this)
1050 {
1051     int ret;
1052
1053     TRACE("(%p)\n", this);
1054
1055     if(call_basic_streambuf_char_underflow(this)==EOF)
1056         return EOF;
1057
1058     ret = (unsigned char)**this->prpos;
1059     (*this->prsize)--;
1060     (*this->prpos)++;
1061     return ret;
1062 }
1063
1064 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADIH@Z */
1065 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_K_J@Z */
1066 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Xsgetn_s, 16)
1067 #define call_basic_streambuf_char__Xsgetn_s(this, ptr, size, count) CALL_VTBL_FUNC(this, 28, \
1068         streamsize, (basic_streambuf_char*, char*, MSVCP_size_t, streamsize), (this, ptr, size, count))
1069 streamsize __thiscall basic_streambuf_char__Xsgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
1070 {
1071     streamsize copied, chunk;
1072     int c;
1073
1074     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1075
1076     for(copied=0; copied<count && size;) {
1077         chunk = basic_streambuf_char__Gnavail(this);
1078         if(chunk > count-copied)
1079             chunk = count-copied;
1080
1081         if(chunk > 0) {
1082             memcpy_s(ptr+copied, size, *this->prpos, chunk);
1083             *this->prpos += chunk;
1084             *this->prsize -= chunk;
1085             copied += chunk;
1086             size -= chunk;
1087         }else if((c = call_basic_streambuf_char_uflow(this)) != EOF) {
1088             ptr[copied] = c;
1089             copied++;
1090             size--;
1091         }else {
1092             break;
1093         }
1094     }
1095
1096     return copied;
1097 }
1098
1099 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
1100 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
1101 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Sgetn_s, 16)
1102 streamsize __thiscall basic_streambuf_char__Sgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
1103 {
1104     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1105     return call_basic_streambuf_char__Xsgetn_s(this, ptr, size, count);
1106 }
1107
1108 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1109 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1110 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Unlock, 4)
1111 void __thiscall basic_streambuf_char__Unlock(basic_streambuf_char *this)
1112 {
1113     TRACE("(%p)\n", this);
1114     mutex_unlock(&this->lock);
1115 }
1116
1117 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1118 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1119 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_eback, 4)
1120 char* __thiscall basic_streambuf_char_eback(const basic_streambuf_char *this)
1121 {
1122     TRACE("(%p)\n", this);
1123     return *this->prbuf;
1124 }
1125
1126 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1127 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1128 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gptr, 4)
1129 char* __thiscall basic_streambuf_char_gptr(const basic_streambuf_char *this)
1130 {
1131     TRACE("(%p)\n", this);
1132     return *this->prpos;
1133 }
1134
1135 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1136 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1137 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_egptr, 4)
1138 char* __thiscall basic_streambuf_char_egptr(const basic_streambuf_char *this)
1139 {
1140     TRACE("(%p)\n", this);
1141     return *this->prpos+*this->prsize;
1142 }
1143
1144 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1145 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1146 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_epptr, 4)
1147 char* __thiscall basic_streambuf_char_epptr(const basic_streambuf_char *this)
1148 {
1149     TRACE("(%p)\n", this);
1150     return *this->pwpos+*this->pwsize;
1151 }
1152
1153 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
1154 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
1155 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gbump, 8)
1156 void __thiscall basic_streambuf_char_gbump(basic_streambuf_char *this, int off)
1157 {
1158     TRACE("(%p %d)\n", this, off);
1159     *this->prpos += off;
1160     *this->prsize -= off;
1161 }
1162
1163 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QBE?AVlocale@2@XZ */
1164 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEBA?AVlocale@2@XZ */
1165 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_getloc, 8)
1166 locale* __thiscall basic_streambuf_char_getloc(const basic_streambuf_char *this, locale *ret)
1167 {
1168     TRACE("(%p)\n", this);
1169     return locale_copy_ctor(ret, this->loc);
1170 }
1171
1172 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
1173 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
1174 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_imbue, 8)
1175 #define call_basic_streambuf_char_imbue(this, loc) CALL_VTBL_FUNC(this, 52, \
1176         void, (basic_streambuf_char*, const locale*), (this, loc))
1177 void __thiscall basic_streambuf_char_imbue(basic_streambuf_char *this, const locale *loc)
1178 {
1179     TRACE("(%p %p)\n", this, loc);
1180 }
1181
1182 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
1183 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
1184 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_overflow, 8)
1185 #define call_basic_streambuf_char_overflow(this, ch) CALL_VTBL_FUNC(this, 4, \
1186         int, (basic_streambuf_char*, int), (this, ch))
1187 int __thiscall basic_streambuf_char_overflow(basic_streambuf_char *this, int ch)
1188 {
1189     TRACE("(%p %d)\n", this, ch);
1190     return EOF;
1191 }
1192
1193 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
1194 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
1195 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbackfail, 8)
1196 #define call_basic_streambuf_char_pbackfail(this, ch) CALL_VTBL_FUNC(this, 8, \
1197         int, (basic_streambuf_char*, int), (this, ch))
1198 int __thiscall basic_streambuf_char_pbackfail(basic_streambuf_char *this, int ch)
1199 {
1200     TRACE("(%p %d)\n", this, ch);
1201     return EOF;
1202 }
1203
1204 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1205 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1206 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbase, 4)
1207 char* __thiscall basic_streambuf_char_pbase(const basic_streambuf_char *this)
1208 {
1209     TRACE("(%p)\n", this);
1210     return *this->pwbuf;
1211 }
1212
1213 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
1214 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
1215 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbump, 8)
1216 void __thiscall basic_streambuf_char_pbump(basic_streambuf_char *this, int off)
1217 {
1218     TRACE("(%p %d)\n", this, off);
1219     *this->pwpos += off;
1220     *this->pwsize -= off;
1221 }
1222
1223 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1224 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1225 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pptr, 4)
1226 char* __thiscall basic_streambuf_char_pptr(const basic_streambuf_char *this)
1227 {
1228     TRACE("(%p)\n", this);
1229     return *this->pwpos;
1230 }
1231
1232 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1233 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
1234 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubimbue, 12)
1235 locale* __thiscall basic_streambuf_char_pubimbue(basic_streambuf_char *this, locale *ret, const locale *loc)
1236 {
1237     TRACE("(%p %p)\n", this, loc);
1238     memcpy(ret, this->loc, sizeof(locale));
1239     call_basic_streambuf_char_imbue(this, loc);
1240     locale_copy_ctor(this->loc, loc);
1241     return ret;
1242 }
1243
1244 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
1245 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
1246 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekoff, 20)
1247 #define call_basic_streambuf_char_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 36, \
1248         fpos_int*, (basic_streambuf_char*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
1249 fpos_int* __thiscall basic_streambuf_char_seekoff(basic_streambuf_char *this,
1250         fpos_int *ret, streamoff off, int way, int mode)
1251 {
1252     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1253     ret->off = -1;
1254     ret->pos = 0;
1255     ret->state = 0;
1256     return ret;
1257 }
1258
1259 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
1260 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
1261 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff, 20)
1262 fpos_int* __thiscall basic_streambuf_char_pubseekoff(basic_streambuf_char *this,
1263         fpos_int *ret, streamoff off, int way, int mode)
1264 {
1265     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1266     return call_basic_streambuf_char_seekoff(this, ret, off, way, mode);
1267 }
1268
1269 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
1270 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
1271 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff_old, 20)
1272 fpos_int* __thiscall basic_streambuf_char_pubseekoff_old(basic_streambuf_char *this,
1273         fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
1274 {
1275     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1276     return basic_streambuf_char_pubseekoff(this, ret, off, way, mode);
1277 }
1278
1279 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
1280 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
1281 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekpos, 36)
1282 #define call_basic_streambuf_char_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 40, \
1283         fpos_int*, (basic_streambuf_char*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
1284 fpos_int* __thiscall basic_streambuf_char_seekpos(basic_streambuf_char *this,
1285         fpos_int *ret, fpos_int pos, int mode)
1286 {
1287     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1288     ret->off = -1;
1289     ret->pos = 0;
1290     ret->state = 0;
1291     return ret;
1292 }
1293
1294 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
1295 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
1296 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos, 36)
1297 fpos_int* __thiscall basic_streambuf_char_pubseekpos(basic_streambuf_char *this,
1298         fpos_int *ret, fpos_int pos, int mode)
1299 {
1300     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1301     return call_basic_streambuf_char_seekpos(this, ret, pos, mode);
1302 }
1303
1304 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
1305 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
1306 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos_old, 36)
1307 fpos_int* __thiscall basic_streambuf_char_pubseekpos_old(basic_streambuf_char *this,
1308         fpos_int *ret, fpos_int pos, unsigned int mode)
1309 {
1310     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1311     return basic_streambuf_char_pubseekpos(this, ret, pos, mode);
1312 }
1313
1314 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEPAV12@PADH@Z */
1315 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAPEAV12@PEAD_J@Z */
1316 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setbuf, 12)
1317 #define call_basic_streambuf_char_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 44, \
1318         basic_streambuf_char*, (basic_streambuf_char*, char*, streamsize), (this, buf, count))
1319 basic_streambuf_char* __thiscall basic_streambuf_char_setbuf(basic_streambuf_char *this, char *buf, streamsize count)
1320 {
1321     TRACE("(%p %p %ld)\n", this, buf, count);
1322     return this;
1323 }
1324
1325 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PADH@Z */
1326 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEAD_J@Z */
1327 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsetbuf, 12)
1328 basic_streambuf_char* __thiscall basic_streambuf_char_pubsetbuf(basic_streambuf_char *this, char *buf, streamsize count)
1329 {
1330     TRACE("(%p %p %ld)\n", this, buf, count);
1331     return call_basic_streambuf_char_setbuf(this, buf, count);
1332 }
1333
1334 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1335 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1336 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sync, 4)
1337 #define call_basic_streambuf_char_sync(this) CALL_VTBL_FUNC(this, 48, \
1338         int, (basic_streambuf_char*), (this))
1339 int __thiscall basic_streambuf_char_sync(basic_streambuf_char *this)
1340 {
1341     TRACE("(%p)\n", this);
1342     return 0;
1343 }
1344
1345 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1346 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1347 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsync, 4)
1348 int __thiscall basic_streambuf_char_pubsync(basic_streambuf_char *this)
1349 {
1350     TRACE("(%p)\n", this);
1351     return call_basic_streambuf_char_sync(this);
1352 }
1353
1354 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
1355 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
1356 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetn, 12)
1357 streamsize __thiscall basic_streambuf_char_sgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1358 {
1359     TRACE("(%p %p %ld)\n", this, ptr, count);
1360     return call_basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1361 }
1362
1363 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1364 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JXZ */
1365 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_showmanyc, 4)
1366 #define call_basic_streambuf_char_showmanyc(this) CALL_VTBL_FUNC(this, 12, \
1367         streamsize, (basic_streambuf_char*), (this))
1368 streamsize __thiscall basic_streambuf_char_showmanyc(basic_streambuf_char *this)
1369 {
1370     TRACE("(%p)\n", this);
1371     return 0;
1372 }
1373
1374 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1375 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JXZ */
1376 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_in_avail, 4)
1377 streamsize __thiscall basic_streambuf_char_in_avail(basic_streambuf_char *this)
1378 {
1379     streamsize ret;
1380
1381     TRACE("(%p)\n", this);
1382
1383     ret = basic_streambuf_char__Gnavail(this);
1384     return ret ? ret : call_basic_streambuf_char_showmanyc(this);
1385 }
1386
1387 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
1388 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
1389 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputbackc, 8)
1390 int __thiscall basic_streambuf_char_sputbackc(basic_streambuf_char *this, char ch)
1391 {
1392     TRACE("(%p %d)\n", this, ch);
1393     if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
1394         (*this->prsize)++;
1395         (*this->prpos)--;
1396         return (unsigned char)ch;
1397     }
1398
1399     return call_basic_streambuf_char_pbackfail(this, (unsigned char)ch);
1400 }
1401
1402 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
1403 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
1404 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputc, 8)
1405 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char *this, char ch)
1406 {
1407     TRACE("(%p %d)\n", this, ch);
1408     return basic_streambuf_char__Pnavail(this) ?
1409         (*basic_streambuf_char__Pninc(this) = ch) :
1410         call_basic_streambuf_char_overflow(this, (unsigned char)ch);
1411 }
1412
1413 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1414 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1415 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sungetc, 4)
1416 int __thiscall basic_streambuf_char_sungetc(basic_streambuf_char *this)
1417 {
1418     TRACE("(%p)\n", this);
1419     if(*this->prpos && *this->prpos>*this->prbuf) {
1420         (*this->prsize)++;
1421         (*this->prpos)--;
1422         return (unsigned char)**this->prpos;
1423     }
1424
1425     return call_basic_streambuf_char_pbackfail(this, EOF);
1426 }
1427
1428 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1429 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1430 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_stossc, 4)
1431 void __thiscall basic_streambuf_char_stossc(basic_streambuf_char *this)
1432 {
1433     TRACE("(%p)\n", this);
1434     if(basic_streambuf_char__Gnavail(this))
1435         basic_streambuf_char__Gninc(this);
1436     else
1437         call_basic_streambuf_char_uflow(this);
1438 }
1439
1440 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1441 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1442 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sbumpc, 4)
1443 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char *this)
1444 {
1445     TRACE("(%p)\n", this);
1446     return basic_streambuf_char__Gnavail(this) ?
1447         (int)(unsigned char)*basic_streambuf_char__Gninc(this) : call_basic_streambuf_char_uflow(this);
1448 }
1449
1450 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1451 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1452 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetc, 4)
1453 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char *this)
1454 {
1455     TRACE("(%p)\n", this);
1456     return basic_streambuf_char__Gnavail(this) ?
1457         (int)(unsigned char)*basic_streambuf_char_gptr(this) : call_basic_streambuf_char_underflow(this);
1458 }
1459
1460 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1461 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1462 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_snextc, 4)
1463 int __thiscall basic_streambuf_char_snextc(basic_streambuf_char *this)
1464 {
1465     TRACE("(%p)\n", this);
1466
1467     if(basic_streambuf_char__Gnavail(this) > 1)
1468         return (unsigned char)*basic_streambuf_char__Gnpreinc(this);
1469     return basic_streambuf_char_sbumpc(this)==EOF ?
1470         EOF : basic_streambuf_char_sgetc(this);
1471 }
1472
1473 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADH@Z */
1474 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z */
1475 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsgetn, 12)
1476 #define call_basic_streambuf_char_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 24, \
1477         streamsize, (basic_streambuf_char*, char*, streamsize), (this, ptr, count))
1478 streamsize __thiscall basic_streambuf_char_xsgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1479 {
1480     TRACE("(%p %p %ld)\n", this, ptr, count);
1481     return call_basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1482 }
1483
1484 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPBDH@Z */
1485 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z */
1486 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsputn, 12)
1487 #define call_basic_streambuf_char_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
1488         streamsize, (basic_streambuf_char*, const char*, streamsize), (this, ptr, count))
1489 streamsize __thiscall basic_streambuf_char_xsputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1490 {
1491     streamsize copied, chunk;
1492
1493     TRACE("(%p %p %ld)\n", this, ptr, count);
1494
1495     for(copied=0; copied<count;) {
1496         chunk = basic_streambuf_char__Pnavail(this);
1497         if(chunk > count-copied)
1498             chunk = count-copied;
1499
1500         if(chunk > 0) {
1501             memcpy(*this->pwpos, ptr+copied, chunk);
1502             *this->pwpos += chunk;
1503             *this->pwsize -= chunk;
1504             copied += chunk;
1505         }else if(call_basic_streambuf_char_overflow(this, (unsigned char)ptr[copied]) != EOF) {
1506             copied++;
1507         }else {
1508             break;
1509         }
1510     }
1511
1512     return copied;
1513 }
1514
1515 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z */
1516 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEBD_J@Z */
1517 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputn, 12)
1518 streamsize __thiscall basic_streambuf_char_sputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1519 {
1520     TRACE("(%p %p %ld)\n", this, ptr, count);
1521     return call_basic_streambuf_char_xsputn(this, ptr, count);
1522 }
1523
1524 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1525 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1526 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1527 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1528 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp_next, 16)
1529 void __thiscall basic_streambuf_wchar_setp_next(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1530 {
1531     TRACE("(%p %p %p %p)\n", this, first, next, last);
1532
1533     this->wbuf = first;
1534     this->wpos = next;
1535     this->wsize = last-next;
1536 }
1537
1538 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W0@Z */
1539 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W0@Z */
1540 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG0@Z */
1541 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG0@Z */
1542 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp, 12)
1543 void __thiscall basic_streambuf_wchar_setp(basic_streambuf_wchar *this, wchar_t *first, wchar_t *last)
1544 {
1545     basic_streambuf_wchar_setp_next(this, first, first, last);
1546 }
1547
1548 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1549 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1550 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1551 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1552 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setg, 16)
1553 void __thiscall basic_streambuf_wchar_setg(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1554 {
1555     TRACE("(%p %p %p %p)\n", this, first, next, last);
1556
1557     this->rbuf = first;
1558     this->rpos = next;
1559     this->rsize = last-next;
1560 }
1561
1562 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXXZ */
1563 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXXZ */
1564 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXXZ */
1565 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXXZ */
1566 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init_empty, 4)
1567 void __thiscall basic_streambuf_wchar__Init_empty(basic_streambuf_wchar *this)
1568 {
1569     TRACE("(%p)\n", this);
1570
1571     this->prbuf = &this->rbuf;
1572     this->pwbuf = &this->wbuf;
1573     this->prpos = &this->rpos;
1574     this->pwpos = &this->wpos;
1575     this->prsize = &this->rsize;
1576     this->pwsize = &this->wsize;
1577
1578     basic_streambuf_wchar_setp(this, NULL, NULL);
1579     basic_streambuf_wchar_setg(this, NULL, NULL, NULL);
1580 }
1581
1582 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1583 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1584 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor_uninitialized, 8)
1585 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1586 {
1587     TRACE("(%p %d)\n", this, uninitialized);
1588     this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1589     mutex_ctor(&this->lock);
1590     return this;
1591 }
1592
1593 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1594 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1595 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor_uninitialized, 8)
1596 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1597 {
1598     TRACE("(%p %d)\n", this, uninitialized);
1599     basic_streambuf_wchar_ctor_uninitialized(this, uninitialized);
1600     this->vtable = &MSVCP_basic_streambuf_short_vtable;
1601     return this;
1602 }
1603
1604 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
1605 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
1606 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor, 4)
1607 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor(basic_streambuf_wchar *this)
1608 {
1609     TRACE("(%p)\n", this);
1610
1611     this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1612     mutex_ctor(&this->lock);
1613     this->loc = MSVCRT_operator_new(sizeof(locale));
1614     locale_ctor(this->loc);
1615     basic_streambuf_wchar__Init_empty(this);
1616
1617     return this;
1618 }
1619
1620 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@XZ */
1621 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@XZ */
1622 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor, 4)
1623 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor(basic_streambuf_wchar *this)
1624 {
1625     TRACE("(%p)\n", this);
1626     basic_streambuf_wchar_ctor(this);
1627     this->vtable = &MSVCP_basic_streambuf_short_vtable;
1628     return this;
1629 }
1630
1631 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
1632 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
1633 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
1634 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
1635 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_dtor, 4)
1636 void __thiscall basic_streambuf_wchar_dtor(basic_streambuf_wchar *this)
1637 {
1638     TRACE("(%p)\n", this);
1639
1640     mutex_dtor(&this->lock);
1641     locale_dtor(this->loc);
1642     MSVCRT_operator_delete(this->loc);
1643 }
1644
1645 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_vector_dtor, 8)
1646 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_vector_dtor(basic_streambuf_wchar *this, unsigned int flags)
1647 {
1648     TRACE("(%p %x)\n", this, flags);
1649     if(flags & 2) {
1650         /* we have an array, with the number of elements stored before the first object */
1651         INT_PTR i, *ptr = (INT_PTR *)this-1;
1652
1653         for(i=*ptr-1; i>=0; i--)
1654             basic_streambuf_wchar_dtor(this+i);
1655         MSVCRT_operator_delete(ptr);
1656     } else {
1657         basic_streambuf_wchar_dtor(this);
1658         if(flags & 1)
1659             MSVCRT_operator_delete(this);
1660     }
1661
1662     return this;
1663 }
1664
1665 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1666 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1667 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1668 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1669 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnavail, 4)
1670 streamsize __thiscall basic_streambuf_wchar__Gnavail(const basic_streambuf_wchar *this)
1671 {
1672     TRACE("(%p)\n", this);
1673     return *this->prpos ? *this->prsize : 0;
1674 }
1675
1676 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1677 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1678 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1679 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1680 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gndec, 4)
1681 wchar_t* __thiscall basic_streambuf_wchar__Gndec(basic_streambuf_wchar *this)
1682 {
1683     TRACE("(%p)\n", this);
1684     (*this->prsize)++;
1685     (*this->prpos)--;
1686     return *this->prpos;
1687 }
1688
1689 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1690 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1691 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1692 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1693 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gninc, 4)
1694 wchar_t* __thiscall basic_streambuf_wchar__Gninc(basic_streambuf_wchar *this)
1695 {
1696     TRACE("(%p)\n", this);
1697     (*this->prsize)--;
1698     return (*this->prpos)++;
1699 }
1700
1701 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1702 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1703 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1704 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1705 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnpreinc, 4)
1706 wchar_t* __thiscall basic_streambuf_wchar__Gnpreinc(basic_streambuf_wchar *this)
1707 {
1708     TRACE("(%p)\n", this);
1709     (*this->prsize)--;
1710     (*this->prpos)++;
1711     return *this->prpos;
1712 }
1713
1714 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPAPA_W0PAH001@Z */
1715 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAPEA_W0PEAH001@Z */
1716 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAPAG0PAH001@Z */
1717 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAPEAG0PEAH001@Z */
1718 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init, 28)
1719 void __thiscall basic_streambuf_wchar__Init(basic_streambuf_wchar *this, wchar_t **gf, wchar_t **gn, int *gc, wchar_t **pf, wchar_t **pn, int *pc)
1720 {
1721     TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
1722
1723     this->prbuf = gf;
1724     this->pwbuf = pf;
1725     this->prpos = gn;
1726     this->pwpos = pn;
1727     this->prsize = gc;
1728     this->pwsize = pc;
1729 }
1730
1731 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1732 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1733 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1734 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1735 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Lock, 4)
1736 void __thiscall basic_streambuf_wchar__Lock(basic_streambuf_wchar *this)
1737 {
1738     TRACE("(%p)\n", this);
1739     mutex_lock(&this->lock);
1740 }
1741
1742 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1743 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1744 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1745 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1746 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pnavail, 4)
1747 streamsize __thiscall basic_streambuf_wchar__Pnavail(const basic_streambuf_wchar *this)
1748 {
1749     TRACE("(%p)\n", this);
1750     return *this->pwpos ? *this->pwsize : 0;
1751 }
1752
1753 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1754 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1755 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1756 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1757 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pninc, 4)
1758 wchar_t* __thiscall basic_streambuf_wchar__Pninc(basic_streambuf_wchar *this)
1759 {
1760     TRACE("(%p)\n", this);
1761     (*this->pwsize)--;
1762     return (*this->pwpos)++;
1763 }
1764
1765 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1766 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1767 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1768 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1769 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_underflow, 4)
1770 #define call_basic_streambuf_wchar_underflow(this) CALL_VTBL_FUNC(this, 16, \
1771         unsigned short, (basic_streambuf_wchar*), (this))
1772 unsigned short __thiscall basic_streambuf_wchar_underflow(basic_streambuf_wchar *this)
1773 {
1774     TRACE("(%p)\n", this);
1775     return WEOF;
1776 }
1777
1778 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1779 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1780 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1781 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1782 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_uflow, 4)
1783 #define call_basic_streambuf_wchar_uflow(this) CALL_VTBL_FUNC(this, 20, \
1784         unsigned short, (basic_streambuf_wchar*), (this))
1785 unsigned short __thiscall basic_streambuf_wchar_uflow(basic_streambuf_wchar *this)
1786 {
1787     int ret;
1788
1789     TRACE("(%p)\n", this);
1790
1791     if(call_basic_streambuf_wchar_underflow(this)==WEOF)
1792         return WEOF;
1793
1794     ret = **this->prpos;
1795     (*this->prsize)--;
1796     (*this->prpos)++;
1797     return ret;
1798 }
1799
1800 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WIH@Z */
1801 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_K_J@Z */
1802 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGIH@Z */
1803 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_K_J@Z */
1804 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Xsgetn_s, 16)
1805 #define call_basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count) CALL_VTBL_FUNC(this, 28, \
1806         streamsize, (basic_streambuf_wchar*, wchar_t*, MSVCP_size_t, streamsize), (this, ptr, size, count))
1807 streamsize __thiscall basic_streambuf_wchar__Xsgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1808 {
1809     streamsize copied, chunk;
1810     unsigned short c;
1811
1812     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1813
1814     for(copied=0; copied<count && size;) {
1815         chunk = basic_streambuf_wchar__Gnavail(this);
1816         if(chunk > count-copied)
1817             chunk = count-copied;
1818
1819         if(chunk > 0) {
1820             memcpy_s(ptr+copied, size, *this->prpos, chunk*sizeof(wchar_t));
1821             *this->prpos += chunk;
1822             *this->prsize -= chunk;
1823             copied += chunk;
1824             size -= chunk*sizeof(wchar_t);
1825         }else if((c = call_basic_streambuf_wchar_uflow(this)) != WEOF) {
1826             ptr[copied] = c;
1827             copied++;
1828             size--;
1829         }else {
1830             break;
1831         }
1832     }
1833
1834     return copied;
1835 }
1836
1837 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
1838 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
1839 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
1840 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
1841 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Sgetn_s, 16)
1842 streamsize __thiscall basic_streambuf_wchar__Sgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1843 {
1844     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1845     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count);
1846 }
1847
1848 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1849 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1850 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1851 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1852 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Unlock, 4)
1853 void __thiscall basic_streambuf_wchar__Unlock(basic_streambuf_wchar *this)
1854 {
1855     TRACE("(%p)\n", this);
1856     mutex_unlock(&this->lock);
1857 }
1858
1859 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1860 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1861 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1862 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1863 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_eback, 4)
1864 wchar_t* __thiscall basic_streambuf_wchar_eback(const basic_streambuf_wchar *this)
1865 {
1866     TRACE("(%p)\n", this);
1867     return *this->prbuf;
1868 }
1869
1870 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1871 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1872 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1873 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1874 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gptr, 4)
1875 wchar_t* __thiscall basic_streambuf_wchar_gptr(const basic_streambuf_wchar *this)
1876 {
1877     TRACE("(%p)\n", this);
1878     return *this->prpos;
1879 }
1880
1881 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1882 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1883 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1884 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1885 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_egptr, 4)
1886 wchar_t* __thiscall basic_streambuf_wchar_egptr(const basic_streambuf_wchar *this)
1887 {
1888     TRACE("(%p)\n", this);
1889     return *this->prpos+*this->prsize;
1890 }
1891
1892 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1893 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1894 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1895 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1896 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_epptr, 4)
1897 wchar_t* __thiscall basic_streambuf_wchar_epptr(const basic_streambuf_wchar *this)
1898 {
1899     TRACE("(%p)\n", this);
1900     return *this->pwpos+*this->pwsize;
1901 }
1902
1903 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1904 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1905 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1906 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1907 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gbump, 8)
1908 void __thiscall basic_streambuf_wchar_gbump(basic_streambuf_wchar *this, int off)
1909 {
1910     TRACE("(%p %d)\n", this, off);
1911     *this->prpos += off;
1912     *this->prsize -= off;
1913 }
1914
1915 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QBE?AVlocale@2@XZ */
1916 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEBA?AVlocale@2@XZ */
1917 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QBE?AVlocale@2@XZ */
1918 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEBA?AVlocale@2@XZ */
1919 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_getloc, 8)
1920 locale* __thiscall basic_streambuf_wchar_getloc(const basic_streambuf_wchar *this, locale *ret)
1921 {
1922     TRACE("(%p)\n", this);
1923     return locale_copy_ctor(ret, this->loc);
1924 }
1925
1926 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
1927 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
1928 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
1929 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
1930 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_imbue, 8)
1931 #define call_basic_streambuf_wchar_imbue(this, loc) CALL_VTBL_FUNC(this, 52, \
1932         void, (basic_streambuf_wchar*, const locale*), (this, loc))
1933 void __thiscall basic_streambuf_wchar_imbue(basic_streambuf_wchar *this, const locale *loc)
1934 {
1935     TRACE("(%p %p)\n", this, loc);
1936 }
1937
1938 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1939 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1940 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1941 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1942 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_overflow, 8)
1943 #define call_basic_streambuf_wchar_overflow(this, ch) CALL_VTBL_FUNC(this, 4, \
1944         unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1945 unsigned short __thiscall basic_streambuf_wchar_overflow(basic_streambuf_wchar *this, unsigned short ch)
1946 {
1947     TRACE("(%p %d)\n", this, ch);
1948     return WEOF;
1949 }
1950
1951 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1952 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1953 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1954 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1955 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbackfail, 8)
1956 #define call_basic_streambuf_wchar_pbackfail(this, ch) CALL_VTBL_FUNC(this, 8, \
1957         unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1958 unsigned short __thiscall basic_streambuf_wchar_pbackfail(basic_streambuf_wchar *this, unsigned short ch)
1959 {
1960     TRACE("(%p %d)\n", this, ch);
1961     return WEOF;
1962 }
1963
1964 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1965 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1966 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1967 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1968 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbase, 4)
1969 wchar_t* __thiscall basic_streambuf_wchar_pbase(const basic_streambuf_wchar *this)
1970 {
1971     TRACE("(%p)\n", this);
1972     return *this->pwbuf;
1973 }
1974
1975 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1976 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1977 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1978 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1979 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbump, 8)
1980 void __thiscall basic_streambuf_wchar_pbump(basic_streambuf_wchar *this, int off)
1981 {
1982     TRACE("(%p %d)\n", this, off);
1983     *this->pwpos += off;
1984     *this->pwsize -= off;
1985 }
1986
1987 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1988 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1989 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1990 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1991 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pptr, 4)
1992 wchar_t* __thiscall basic_streambuf_wchar_pptr(const basic_streambuf_wchar *this)
1993 {
1994     TRACE("(%p)\n", this);
1995     return *this->pwpos;
1996 }
1997
1998 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1999 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
2000 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
2001 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
2002 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubimbue, 12)
2003 locale* __thiscall basic_streambuf_wchar_pubimbue(basic_streambuf_wchar *this, locale *ret, const locale *loc)
2004 {
2005     TRACE("(%p %p)\n", this, loc);
2006     memcpy(ret, this->loc, sizeof(locale));
2007     call_basic_streambuf_wchar_imbue(this, loc);
2008     locale_copy_ctor(this->loc, loc);
2009     return ret;
2010 }
2011
2012 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2013 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2014 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2015 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2016 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekoff, 20)
2017 #define call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 36, \
2018         fpos_int*, (basic_streambuf_wchar*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
2019 fpos_int* __thiscall basic_streambuf_wchar_seekoff(basic_streambuf_wchar *this,
2020         fpos_int *ret, streamoff off, int way, int mode)
2021 {
2022     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2023     ret->off = -1;
2024     ret->pos = 0;
2025     ret->state = 0;
2026     return ret;
2027 }
2028
2029 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
2030 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
2031 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
2032 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
2033 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff, 20)
2034 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff(basic_streambuf_wchar *this,
2035         fpos_int *ret, streamoff off, int way, int mode)
2036 {
2037     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2038     return call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode);
2039 }
2040
2041 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
2042 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
2043 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
2044 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
2045 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff_old, 20)
2046 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff_old(basic_streambuf_wchar *this,
2047         fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
2048 {
2049     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2050     return basic_streambuf_wchar_pubseekoff(this, ret, off, way, mode);
2051 }
2052
2053 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2054 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2055 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2056 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2057 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekpos, 36)
2058 #define call_basic_streambuf_wchar_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 40, \
2059         fpos_int*, (basic_streambuf_wchar*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
2060 fpos_int* __thiscall basic_streambuf_wchar_seekpos(basic_streambuf_wchar *this,
2061         fpos_int *ret, fpos_int pos, int mode)
2062 {
2063     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2064     ret->off = -1;
2065     ret->pos = 0;
2066     ret->state = 0;
2067     return ret;
2068 }
2069
2070 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
2071 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
2072 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
2073 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
2074 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos, 36)
2075 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos(basic_streambuf_wchar *this,
2076         fpos_int *ret, fpos_int pos, int mode)
2077 {
2078     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2079     return call_basic_streambuf_wchar_seekpos(this, ret, pos, mode);
2080 }
2081
2082 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
2083 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
2084 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
2085 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
2086 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos_old, 36)
2087 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos_old(basic_streambuf_wchar *this,
2088         fpos_int *ret, fpos_int pos, unsigned int mode)
2089 {
2090     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2091     return basic_streambuf_wchar_pubseekpos(this, ret, pos, mode);
2092 }
2093
2094 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEPAV12@PA_WH@Z */
2095 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV12@PEA_W_J@Z */
2096 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEPAV12@PAGH@Z */
2097 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAPEAV12@PEAG_J@Z */
2098 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setbuf, 12)
2099 #define call_basic_streambuf_wchar_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 44, \
2100         basic_streambuf_wchar*, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, buf, count))
2101 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_setbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
2102 {
2103     TRACE("(%p %p %ld)\n", this, buf, count);
2104     return this;
2105 }
2106
2107 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PA_WH@Z */
2108 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEA_W_J@Z */
2109 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PAGH@Z */
2110 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEAG_J@Z */
2111 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsetbuf, 12)
2112 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_pubsetbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
2113 {
2114     TRACE("(%p %p %ld)\n", this, buf, count);
2115     return call_basic_streambuf_wchar_setbuf(this, buf, count);
2116 }
2117
2118 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2119 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
2120 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2121 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
2122 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sync, 4)
2123 #define call_basic_streambuf_wchar_sync(this) CALL_VTBL_FUNC(this, 48, \
2124         int, (basic_streambuf_wchar*), (this))
2125 int __thiscall basic_streambuf_wchar_sync(basic_streambuf_wchar *this)
2126 {
2127     TRACE("(%p)\n", this);
2128     return 0;
2129 }
2130
2131 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
2132 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
2133 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
2134 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHXZ */
2135 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsync, 4)
2136 int __thiscall basic_streambuf_wchar_pubsync(basic_streambuf_wchar *this)
2137 {
2138     TRACE("(%p)\n", this);
2139     return call_basic_streambuf_wchar_sync(this);
2140 }
2141
2142 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
2143 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
2144 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
2145 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
2146 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetn, 12)
2147 streamsize __thiscall basic_streambuf_wchar_sgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
2148 {
2149     TRACE("(%p %p %ld)\n", this, ptr, count);
2150     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
2151 }
2152
2153 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2154 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JXZ */
2155 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2156 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JXZ */
2157 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_showmanyc, 4)
2158 #define call_basic_streambuf_wchar_showmanyc(this) CALL_VTBL_FUNC(this, 12, \
2159         streamsize, (basic_streambuf_wchar*), (this))
2160 streamsize __thiscall basic_streambuf_wchar_showmanyc(basic_streambuf_wchar *this)
2161 {
2162     TRACE("(%p)\n", this);
2163     return 0;
2164 }
2165
2166 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
2167 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JXZ */
2168 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
2169 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JXZ */
2170 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_in_avail, 4)
2171 streamsize __thiscall basic_streambuf_wchar_in_avail(basic_streambuf_wchar *this)
2172 {
2173     streamsize ret;
2174
2175     TRACE("(%p)\n", this);
2176
2177     ret = basic_streambuf_wchar__Gnavail(this);
2178     return ret ? ret : call_basic_streambuf_wchar_showmanyc(this);
2179 }
2180
2181 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
2182 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
2183 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
2184 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
2185 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputbackc, 8)
2186 unsigned short __thiscall basic_streambuf_wchar_sputbackc(basic_streambuf_wchar *this, wchar_t ch)
2187 {
2188     TRACE("(%p %d)\n", this, ch);
2189     if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
2190         (*this->prsize)++;
2191         (*this->prpos)--;
2192         return ch;
2193     }
2194
2195     return call_basic_streambuf_wchar_pbackfail(this, ch);
2196 }
2197
2198 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
2199 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
2200 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
2201 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHG@Z */
2202 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputc, 8)
2203 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar *this, wchar_t ch)
2204 {
2205     TRACE("(%p %d)\n", this, ch);
2206     return basic_streambuf_wchar__Pnavail(this) ?
2207         (*basic_streambuf_wchar__Pninc(this) = ch) :
2208         call_basic_streambuf_wchar_overflow(this, ch);
2209 }
2210
2211 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2212 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2213 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2214 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2215 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sungetc, 4)
2216 unsigned short __thiscall basic_streambuf_wchar_sungetc(basic_streambuf_wchar *this)
2217 {
2218     TRACE("(%p)\n", this);
2219     if(*this->prpos && *this->prpos>*this->prbuf) {
2220         (*this->prsize)++;
2221         (*this->prpos)--;
2222         return **this->prpos;
2223     }
2224
2225     return call_basic_streambuf_wchar_pbackfail(this, WEOF);
2226 }
2227
2228 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
2229 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
2230 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
2231 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
2232 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_stossc, 4)
2233 void __thiscall basic_streambuf_wchar_stossc(basic_streambuf_wchar *this)
2234 {
2235     TRACE("(%p)\n", this);
2236     if(basic_streambuf_wchar__Gnavail(this))
2237         basic_streambuf_wchar__Gninc(this);
2238     else
2239         call_basic_streambuf_wchar_uflow(this);
2240 }
2241
2242 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2243 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2244 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2245 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2246 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sbumpc, 4)
2247 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar *this)
2248 {
2249     TRACE("(%p)\n", this);
2250     return basic_streambuf_wchar__Gnavail(this) ?
2251         *basic_streambuf_wchar__Gninc(this) : call_basic_streambuf_wchar_uflow(this);
2252 }
2253
2254 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2255 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2256 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2257 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2258 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetc, 4)
2259 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar *this)
2260 {
2261     TRACE("(%p)\n", this);
2262     return basic_streambuf_wchar__Gnavail(this) ?
2263         *basic_streambuf_wchar_gptr(this) : call_basic_streambuf_wchar_underflow(this);
2264 }
2265
2266 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2267 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2268 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2269 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2270 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_snextc, 4)
2271 unsigned short __thiscall basic_streambuf_wchar_snextc(basic_streambuf_wchar *this)
2272 {
2273     TRACE("(%p)\n", this);
2274
2275     if(basic_streambuf_wchar__Gnavail(this) > 1)
2276         return *basic_streambuf_wchar__Gnpreinc(this);
2277     return basic_streambuf_wchar_sbumpc(this)==WEOF ?
2278         WEOF : basic_streambuf_wchar_sgetc(this);
2279 }
2280
2281 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WH@Z */
2282 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_J@Z */
2283 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGH@Z */
2284 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_J@Z */
2285 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsgetn, 12)
2286 #define call_basic_streambuf_wchar_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 24, \
2287         streamsize, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, ptr, count))
2288 streamsize __thiscall basic_streambuf_wchar_xsgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
2289 {
2290     TRACE("(%p %p %ld)\n", this, ptr, count);
2291     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
2292 }
2293
2294 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPB_WH@Z */
2295 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEB_W_J@Z */
2296 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPBGH@Z */
2297 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEBG_J@Z */
2298 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsputn, 12)
2299 #define call_basic_streambuf_wchar_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
2300         streamsize, (basic_streambuf_wchar*, const wchar_t*, streamsize), (this, ptr, count))
2301 streamsize __thiscall basic_streambuf_wchar_xsputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
2302 {
2303     streamsize copied, chunk;
2304
2305     TRACE("(%p %p %ld)\n", this, ptr, count);
2306
2307     for(copied=0; copied<count;) {
2308         chunk = basic_streambuf_wchar__Pnavail(this);
2309         if(chunk > count-copied)
2310             chunk = count-copied;
2311
2312         if(chunk > 0) {
2313             memcpy(*this->pwpos, ptr+copied, chunk*sizeof(wchar_t));
2314             *this->pwpos += chunk;
2315             *this->pwsize -= chunk;
2316             copied += chunk;
2317         }else if(call_basic_streambuf_wchar_overflow(this, ptr[copied]) != WEOF) {
2318             copied++;
2319         }else {
2320             break;
2321         }
2322     }
2323
2324     return copied;
2325 }
2326
2327 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPB_WH@Z */
2328 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEB_W_J@Z */
2329 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPBGH@Z */
2330 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEBG_J@Z */
2331 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputn, 12)
2332 streamsize __thiscall basic_streambuf_wchar_sputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
2333 {
2334     TRACE("(%p %p %ld)\n", this, ptr, count);
2335     return call_basic_streambuf_wchar_xsputn(this, ptr, count);
2336 }
2337
2338 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2339 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2340 int basic_filebuf_char__Init__Stinit = 0;
2341
2342 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2343 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2344 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Init, 12)
2345 void __thiscall basic_filebuf_char__Init(basic_filebuf_char *this, FILE *file, basic_filebuf__Initfl which)
2346 {
2347     TRACE("(%p %p %d)\n", this, file, which);
2348
2349     this->cvt = NULL;
2350     this->wrotesome = FALSE;
2351     this->state = basic_filebuf_char__Init__Stinit;
2352     this->close = (which == INITFL_open);
2353     this->file = file;
2354
2355     basic_streambuf_char__Init_empty(&this->base);
2356     if(file)
2357         basic_streambuf_char__Init(&this->base, &file->_base, &file->_ptr,
2358                 &file->_cnt, &file->_base, &file->_ptr, &file->_cnt);
2359 }
2360
2361 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAV?$codecvt@DDH@2@@Z */
2362 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$codecvt@DDH@2@@Z */
2363 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Initcvt, 8)
2364 void __thiscall basic_filebuf_char__Initcvt(basic_filebuf_char *this, codecvt_char *cvt)
2365 {
2366     TRACE("(%p %p)\n", this, cvt);
2367
2368     if(codecvt_base_always_noconv(&cvt->base)) {
2369         this->cvt = NULL;
2370     }else {
2371         basic_streambuf_char__Init_empty(&this->base);
2372         this->cvt = cvt;
2373     }
2374 }
2375
2376 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAE_NXZ */
2377 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAA_NXZ */
2378 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Endwrite, 4)
2379 MSVCP_bool __thiscall basic_filebuf_char__Endwrite(basic_filebuf_char *this)
2380 {
2381     TRACE("(%p)\n", this);
2382
2383     if(!this->wrotesome || !this->cvt)
2384         return TRUE;
2385
2386
2387     if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2388         return FALSE;
2389
2390     while(1) {
2391         /* TODO: check if we need a dynamic buffer here */
2392         char buf[128];
2393         char *next;
2394         int ret;
2395
2396         ret = codecvt_char_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2397         switch(ret) {
2398         case CODECVT_ok:
2399             this->wrotesome = FALSE;
2400             /* fall through */
2401         case CODECVT_partial:
2402             if(!fwrite(buf, next-buf, 1, this->file))
2403                 return FALSE;
2404             if(this->wrotesome)
2405                 break;
2406             /* fall through */
2407         case CODECVT_noconv:
2408             if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2409                 return FALSE;
2410             return TRUE;
2411         default:
2412             return FALSE;
2413         }
2414     }
2415 }
2416
2417 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@XZ */
2418 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@XZ */
2419 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_close, 4)
2420 basic_filebuf_char* __thiscall basic_filebuf_char_close(basic_filebuf_char *this)
2421 {
2422     basic_filebuf_char *ret = this;
2423
2424     TRACE("(%p)\n", this);
2425
2426     if(!this->file)
2427         return NULL;
2428
2429     /* TODO: handle exceptions */
2430     if(!basic_filebuf_char__Endwrite(this))
2431         ret = NULL;
2432     if(fclose(this->file))
2433         ret  = NULL;
2434
2435     basic_filebuf_char__Init(this, NULL, INITFL_close);
2436     return ret;
2437 }
2438
2439 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
2440 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
2441 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor_file, 8)
2442 basic_filebuf_char* __thiscall basic_filebuf_char_ctor_file(basic_filebuf_char *this, FILE *file)
2443 {
2444     TRACE("(%p %p)\n", this, file);
2445
2446     basic_streambuf_char_ctor(&this->base);
2447     this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2448
2449     basic_filebuf_char__Init(this, file, INITFL_new);
2450     return this;
2451 }
2452
2453 /* ??_F?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
2454 /* ??_F?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
2455 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor, 4)
2456 basic_filebuf_char* __thiscall basic_filebuf_char_ctor(basic_filebuf_char *this)
2457 {
2458     return basic_filebuf_char_ctor_file(this, NULL);
2459 }
2460
2461 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
2462 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
2463 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor_uninitialized, 8)
2464 basic_filebuf_char* __thiscall basic_filebuf_char_ctor_uninitialized(basic_filebuf_char *this, int uninitialized)
2465 {
2466     TRACE("(%p %d)\n", this, uninitialized);
2467
2468     basic_streambuf_char_ctor(&this->base);
2469     this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2470     return this;
2471 }
2472
2473 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
2474 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
2475 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_dtor, 4)
2476 void __thiscall basic_filebuf_char_dtor(basic_filebuf_char *this)
2477 {
2478     TRACE("(%p)\n", this);
2479
2480     if(this->close)
2481         basic_filebuf_char_close(this);
2482     basic_streambuf_char_dtor(&this->base);
2483 }
2484
2485 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_vector_dtor, 8)
2486 basic_filebuf_char* __thiscall basic_filebuf_char_vector_dtor(basic_filebuf_char *this, unsigned int flags)
2487 {
2488     TRACE("(%p %x)\n", this, flags);
2489     if(flags & 2) {
2490         /* we have an array, with the number of elements stored before the first object */
2491         INT_PTR i, *ptr = (INT_PTR *)this-1;
2492
2493         for(i=*ptr-1; i>=0; i--)
2494             basic_filebuf_char_dtor(this+i);
2495         MSVCRT_operator_delete(ptr);
2496     } else {
2497         basic_filebuf_char_dtor(this);
2498         if(flags & 1)
2499             MSVCRT_operator_delete(this);
2500     }
2501
2502     return this;
2503 }
2504
2505 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QBE_NXZ */
2506 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
2507 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_is_open, 4)
2508 MSVCP_bool __thiscall basic_filebuf_char_is_open(const basic_filebuf_char *this)
2509 {
2510     TRACE("(%p)\n", this);
2511     return this->file != NULL;
2512 }
2513
2514 /* ?_Fiopen@std@@YAPAU_iobuf@@PB_WHH@Z */
2515 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEB_WHH@Z */
2516 FILE* __cdecl _Fiopen_wchar(const wchar_t *name, int mode, int prot)
2517 {
2518     static const wchar_t rW[] = {'r',0};
2519     static const struct {
2520         int mode;
2521         const wchar_t str[4];
2522         const wchar_t str_bin[4];
2523     } str_mode[] = {
2524         {OPENMODE_out,                            {'w',0},     {'w','b',0}},
2525         {OPENMODE_out|OPENMODE_app,               {'a',0},     {'a','b',0}},
2526         {OPENMODE_app,                            {'a',0},     {'a','b',0}},
2527         {OPENMODE_out|OPENMODE_trunc,             {'w',0},     {'w','b',0}},
2528         {OPENMODE_in,                             {'r',0},     {'r','b',0}},
2529         {OPENMODE_in|OPENMODE_out,                {'r','+',0}, {'r','+','b',0}},
2530         {OPENMODE_in|OPENMODE_out|OPENMODE_trunc, {'w','+',0}, {'w','+','b',0}},
2531         {OPENMODE_in|OPENMODE_out|OPENMODE_app,   {'a','+',0}, {'a','+','b',0}},
2532         {OPENMODE_in|OPENMODE_app,                {'a','+',0}, {'a','+','b',0}}
2533     };
2534
2535     int real_mode = mode & ~(OPENMODE_ate|OPENMODE__Nocreate|OPENMODE__Noreplace|OPENMODE_binary);
2536     int mode_idx;
2537     FILE *f = NULL;
2538
2539     TRACE("(%s %d %d)\n", debugstr_w(name), mode, prot);
2540
2541     for(mode_idx=0; mode_idx<sizeof(str_mode)/sizeof(str_mode[0]); mode_idx++)
2542         if(str_mode[mode_idx].mode == real_mode)
2543             break;
2544     if(mode_idx == sizeof(str_mode)/sizeof(str_mode[0]))
2545         return NULL;
2546
2547     if((mode & OPENMODE__Nocreate) && !(f = _wfopen(name, rW)))
2548         return NULL;
2549     else if(f)
2550         fclose(f);
2551
2552     if((mode & OPENMODE__Noreplace) && (mode & (OPENMODE_out|OPENMODE_app))
2553             && (f = _wfopen(name, rW))) {
2554         fclose(f);
2555         return NULL;
2556     }
2557
2558     f = _wfsopen(name, (mode & OPENMODE_binary) ? str_mode[mode_idx].str_bin
2559             : str_mode[mode_idx].str, prot);
2560     if(!f)
2561         return NULL;
2562
2563     if((mode & OPENMODE_ate) && fseek(f, 0, SEEK_END)) {
2564         fclose(f);
2565         return NULL;
2566     }
2567
2568     return f;
2569 }
2570
2571 /* ?_Fiopen@std@@YAPAU_iobuf@@PBDHH@Z */
2572 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEBDHH@Z */
2573 FILE* __cdecl _Fiopen(const char *name, int mode, int prot)
2574 {
2575     wchar_t nameW[FILENAME_MAX];
2576
2577     TRACE("(%s %d %d)\n", name, mode, prot);
2578
2579     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2580         return NULL;
2581     return _Fiopen_wchar(nameW, mode, prot);
2582 }
2583
2584 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WHH@Z */
2585 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
2586 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGHH@Z */
2587 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGHH@Z */
2588 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_wchar, 16)
2589 basic_filebuf_char* __thiscall basic_filebuf_char_open_wchar(basic_filebuf_char *this, const wchar_t *name, int mode, int prot)
2590 {
2591     FILE *f = NULL;
2592
2593     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
2594
2595     if(basic_filebuf_char_is_open(this))
2596         return NULL;
2597
2598     if(!(f = _Fiopen_wchar(name, mode, prot)))
2599         return NULL;
2600
2601     basic_filebuf_char__Init(this, f, INITFL_open);
2602     basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(this->base.loc));
2603     return this;
2604 }
2605
2606 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WI@Z */
2607 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WI@Z */
2608 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGI@Z */
2609 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGI@Z */
2610 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_wchar_mode, 12)
2611 basic_filebuf_char* __thiscall basic_filebuf_char_open_wchar_mode(basic_filebuf_char *this, const wchar_t *name, unsigned int mode)
2612 {
2613     return basic_filebuf_char_open_wchar(this, name, mode, SH_DENYNO);
2614 }
2615
2616 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDHH@Z */
2617 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDHH@Z */
2618 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open, 16)
2619 basic_filebuf_char* __thiscall basic_filebuf_char_open(basic_filebuf_char *this, const char *name, int mode, int prot)
2620 {
2621     wchar_t nameW[FILENAME_MAX];
2622
2623     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
2624
2625     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2626         return NULL;
2627     return basic_filebuf_char_open_wchar(this, nameW, mode, prot);
2628 }
2629
2630 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDI@Z */
2631 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDI@Z */
2632 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_mode, 12)
2633 basic_filebuf_char* __thiscall basic_filebuf_char_open_mode(basic_filebuf_char *this, const char *name, unsigned int mode)
2634 {
2635     return basic_filebuf_char_open(this, name, mode, SH_DENYNO);
2636 }
2637
2638 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2639 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2640 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_overflow, 8)
2641 int __thiscall basic_filebuf_char_overflow(basic_filebuf_char *this, int c)
2642 {
2643     char buf[8], *dyn_buf;
2644     char ch = c, *to_next;
2645     const char *from_next;
2646     int ret, max_size;
2647
2648
2649     TRACE("(%p %d)\n", this, c);
2650
2651     if(!basic_filebuf_char_is_open(this))
2652         return EOF;
2653     if(c == EOF)
2654         return !c;
2655
2656     if(!this->cvt)
2657         return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2658
2659     from_next = &ch;
2660     do {
2661         ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2662                 &from_next, buf, buf+sizeof(buf), &to_next);
2663
2664         switch(ret) {
2665         case CODECVT_partial:
2666             if(to_next == buf)
2667                 break;
2668             /* fall through */
2669         case CODECVT_ok:
2670             if(!fwrite(buf, to_next-buf, 1, this->file))
2671                 return EOF;
2672             if(ret == CODECVT_partial)
2673                 continue;
2674             return c;
2675         case CODECVT_noconv:
2676             return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2677         default:
2678             return EOF;
2679         }
2680
2681         break;
2682     } while(1);
2683
2684     max_size = codecvt_base_max_length(&this->cvt->base);
2685     dyn_buf = malloc(max_size);
2686     if(!dyn_buf)
2687         return EOF;
2688
2689     ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2690             &from_next, dyn_buf, dyn_buf+max_size, &to_next);
2691
2692     switch(ret) {
2693     case CODECVT_ok:
2694         ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
2695         free(dyn_buf);
2696         return ret ? c : EOF;
2697     case CODECVT_partial:
2698         ERR("buffer should be big enough to store all output\n");
2699         /* fall through */
2700     default:
2701         free(dyn_buf);
2702         return EOF;
2703     }
2704 }
2705
2706 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2707 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2708 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_pbackfail, 8)
2709 int __thiscall basic_filebuf_char_pbackfail(basic_filebuf_char *this, int c)
2710 {
2711     TRACE("(%p %d)\n", this, c);
2712
2713     if(!basic_filebuf_char_is_open(this))
2714         return EOF;
2715
2716     if(basic_streambuf_char_gptr(&this->base)>basic_streambuf_char_eback(&this->base)
2717             && (c==EOF || (int)(unsigned char)basic_streambuf_char_gptr(&this->base)[-1]==c)) {
2718         basic_streambuf_char__Gndec(&this->base);
2719         return c==EOF ? !c : c;
2720     }else if(c!=EOF && !this->cvt) {
2721         return ungetc(c, this->file);
2722     }
2723
2724     return EOF;
2725 }
2726
2727 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2728 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2729 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_uflow, 4)
2730 int __thiscall basic_filebuf_char_uflow(basic_filebuf_char *this)
2731 {
2732     char ch, buf[128], *to_next;
2733     const char *buf_next;
2734     int c, i;
2735
2736     TRACE("(%p)\n", this);
2737
2738     if(!basic_filebuf_char_is_open(this))
2739         return EOF;
2740
2741     if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2742         return (unsigned char)*basic_streambuf_char__Gninc(&this->base);
2743
2744     c = fgetc(this->file);
2745     if(!this->cvt || c==EOF)
2746         return c;
2747
2748     buf_next = buf;
2749     for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
2750         buf[i] = c;
2751
2752         switch(codecvt_char_in(this->cvt, &this->state, buf_next,
2753                     buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
2754         case CODECVT_partial:
2755         case CODECVT_ok:
2756             if(to_next == &ch) {
2757                 c = fgetc(this->file);
2758                 if(c == EOF)
2759                     return EOF;
2760                 continue;
2761             }
2762
2763             for(i--; i>=buf_next-buf; i--)
2764                 ungetc(buf[i], this->file);
2765             return ch;
2766         case CODECVT_noconv:
2767             return (unsigned char)buf[0];
2768         default:
2769             return EOF;
2770         }
2771     }
2772
2773     FIXME("buffer is too small\n");
2774     return EOF;
2775 }
2776
2777 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2778 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2779 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_underflow, 4)
2780 int __thiscall basic_filebuf_char_underflow(basic_filebuf_char *this)
2781 {
2782     int ret;
2783
2784     TRACE("(%p)\n", this);
2785
2786     if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2787         return (unsigned char)*basic_streambuf_char_gptr(&this->base);
2788
2789     ret = call_basic_streambuf_char_uflow(&this->base);
2790     if(ret != EOF)
2791         ret = call_basic_streambuf_char_pbackfail(&this->base, ret);
2792     return ret;
2793 }
2794
2795 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2796 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2797 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekoff, 20)
2798 fpos_int* __thiscall basic_filebuf_char_seekoff(basic_filebuf_char *this,
2799         fpos_int *ret, streamoff off, int way, int mode)
2800 {
2801     fpos_t pos;
2802
2803     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
2804
2805     if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2806             || fseek(this->file, off, way)) {
2807         ret->off = -1;
2808         ret->pos = 0;
2809         ret->state = 0;
2810         return ret;
2811     }
2812
2813     fgetpos(this->file, &pos);
2814     ret->off = 0;
2815     ret->pos = pos;
2816     ret->state = this->state;
2817     return ret;
2818 }
2819
2820 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2821 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2822 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekpos, 36)
2823 fpos_int* __thiscall basic_filebuf_char_seekpos(basic_filebuf_char *this,
2824         fpos_int *ret, fpos_int pos, int mode)
2825 {
2826     fpos_t fpos;
2827
2828     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
2829
2830     if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2831             || fseek(this->file, (LONG)pos.pos, SEEK_SET)
2832             || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
2833         ret->off = -1;
2834         ret->pos = 0;
2835         ret->state = 0;
2836         return ret;
2837     }
2838
2839     fgetpos(this->file, &fpos);
2840     ret->off = 0;
2841     ret->pos = fpos;
2842     ret->state = this->state;
2843     return ret;
2844 }
2845
2846 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PADH@Z */
2847 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAD_J@Z */
2848 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_setbuf, 12)
2849 basic_streambuf_char* __thiscall basic_filebuf_char_setbuf(basic_filebuf_char *this, char *buf, streamsize count)
2850 {
2851     TRACE("(%p %p %ld)\n", this, buf, count);
2852
2853     if(!basic_filebuf_char_is_open(this))
2854         return NULL;
2855
2856     if(setvbuf(this->file, buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count))
2857         return NULL;
2858
2859     basic_filebuf_char__Init(this, this->file, INITFL_open);
2860     return &this->base;
2861 }
2862
2863 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2864 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2865 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_sync, 4)
2866 int __thiscall basic_filebuf_char_sync(basic_filebuf_char *this)
2867 {
2868     TRACE("(%p)\n", this);
2869
2870     if(!basic_filebuf_char_is_open(this))
2871         return 0;
2872
2873     if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2874         return 0;
2875     return fflush(this->file);
2876 }
2877
2878 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
2879 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
2880 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_imbue, 8)
2881 void __thiscall basic_filebuf_char_imbue(basic_filebuf_char *this, const locale *loc)
2882 {
2883     TRACE("(%p %p)\n", this, loc);
2884     basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(loc));
2885 }
2886
2887 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2888 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2889 int basic_filebuf_wchar__Init__Stinit = 0;
2890
2891 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2892 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2893 int basic_filebuf_short__Init__Stinit = 0;
2894
2895 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2896 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2897 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Init, 12)
2898 void __thiscall basic_filebuf_wchar__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2899 {
2900     TRACE("(%p %p %d)\n", this, file, which);
2901
2902     this->cvt = NULL;
2903     this->wrotesome = FALSE;
2904     this->state = basic_filebuf_wchar__Init__Stinit;
2905     this->close = (which == INITFL_open);
2906     this->file = file;
2907
2908     basic_streambuf_wchar__Init_empty(&this->base);
2909 }
2910
2911 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2912 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2913 DEFINE_THISCALL_WRAPPER(basic_filebuf_short__Init, 12)
2914 void __thiscall basic_filebuf_short__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2915 {
2916     TRACE("(%p %p %d)\n", this, file, which);
2917
2918     this->cvt = NULL;
2919     this->wrotesome = FALSE;
2920     this->state = basic_filebuf_short__Init__Stinit;
2921     this->close = (which == INITFL_open);
2922     this->file = file;
2923
2924     basic_streambuf_wchar__Init_empty(&this->base);
2925 }
2926
2927 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$codecvt@_WDH@2@@Z */
2928 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$codecvt@_WDH@2@@Z */
2929 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAV?$codecvt@GDH@2@@Z */
2930 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$codecvt@GDH@2@@Z */
2931 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Initcvt, 8)
2932 void __thiscall basic_filebuf_wchar__Initcvt(basic_filebuf_wchar *this, codecvt_wchar *cvt)
2933 {
2934     TRACE("(%p %p)\n", this, cvt);
2935
2936     if(codecvt_base_always_noconv(&cvt->base)) {
2937         this->cvt = NULL;
2938     }else {
2939         basic_streambuf_wchar__Init_empty(&this->base);
2940         this->cvt = cvt;
2941     }
2942 }
2943
2944 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAE_NXZ */
2945 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAA_NXZ */
2946 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAE_NXZ */
2947 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAA_NXZ */
2948 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Endwrite, 4)
2949 MSVCP_bool __thiscall basic_filebuf_wchar__Endwrite(basic_filebuf_wchar *this)
2950 {
2951     TRACE("(%p)\n", this);
2952
2953     if(!this->wrotesome || !this->cvt)
2954         return TRUE;
2955
2956     if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2957         return FALSE;
2958
2959     while(1) {
2960         /* TODO: check if we need a dynamic buffer here */
2961         char buf[128];
2962         char *next;
2963         int ret;
2964
2965         ret = codecvt_wchar_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2966         switch(ret) {
2967         case CODECVT_ok:
2968             this->wrotesome = FALSE;
2969             /* fall through */
2970         case CODECVT_partial:
2971             if(!fwrite(buf, next-buf, 1, this->file))
2972                 return FALSE;
2973             if(this->wrotesome)
2974                 break;
2975             /* fall through */
2976         case CODECVT_noconv:
2977             if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2978                 return FALSE;
2979             return TRUE;
2980         default:
2981             return FALSE;
2982         }
2983     }
2984 }
2985
2986 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@XZ */
2987 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@XZ */
2988 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@XZ */
2989 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@XZ */
2990 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_close, 4)
2991 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_close(basic_filebuf_wchar *this)
2992 {
2993     basic_filebuf_wchar *ret = this;
2994
2995     TRACE("(%p)\n", this);
2996
2997     if(!this->file)
2998         return NULL;
2999
3000     /* TODO: handle exceptions */
3001     if(!basic_filebuf_wchar__Endwrite(this))
3002         ret = NULL;
3003     if(fclose(this->file))
3004         ret  = NULL;
3005
3006     basic_filebuf_wchar__Init(this, NULL, INITFL_close);
3007     return ret;
3008 }
3009
3010 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
3011 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
3012 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor_file, 8)
3013 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor_file(basic_filebuf_wchar *this, FILE *file)
3014 {
3015     TRACE("(%p %p)\n", this, file);
3016
3017     basic_streambuf_wchar_ctor(&this->base);
3018     this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
3019
3020     basic_filebuf_wchar__Init(this, file, INITFL_new);
3021     return this;
3022 }
3023
3024 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
3025 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
3026 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor_file, 8)
3027 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor_file(basic_filebuf_wchar *this, FILE *file)
3028 {
3029     TRACE("(%p %p)\n", this, file);
3030
3031     basic_streambuf_short_ctor(&this->base);
3032     this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
3033
3034     basic_filebuf_short__Init(this, file, INITFL_new);
3035     return this;
3036 }
3037
3038 /* ??_F?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
3039 /* ??_F?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
3040 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor, 4)
3041 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor(basic_filebuf_wchar *this)
3042 {
3043     return basic_filebuf_wchar_ctor_file(this, NULL);
3044 }
3045
3046 /* ??_F?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
3047 /* ??_F?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
3048 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor, 4)
3049 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor(basic_filebuf_wchar *this)
3050 {
3051     return basic_filebuf_short_ctor_file(this, NULL);
3052 }
3053
3054 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
3055 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
3056 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor_uninitialized, 8)
3057 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor_uninitialized(basic_filebuf_wchar *this, int uninitialized)
3058 {
3059     TRACE("(%p %d)\n", this, uninitialized);
3060
3061     basic_streambuf_wchar_ctor(&this->base);
3062     this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
3063     return this;
3064 }
3065
3066 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
3067 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
3068 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor_uninitialized, 8)
3069 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor_uninitialized(basic_filebuf_wchar *this, int uninitialized)
3070 {
3071     TRACE("(%p %d)\n", this, uninitialized);
3072
3073     basic_streambuf_short_ctor(&this->base);
3074     this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
3075     return this;
3076 }
3077
3078 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
3079 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
3080 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
3081 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
3082 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_dtor, 4)
3083 void __thiscall basic_filebuf_wchar_dtor(basic_filebuf_wchar *this)
3084 {
3085     TRACE("(%p)\n", this);
3086
3087     if(this->close)
3088         basic_filebuf_wchar_close(this);
3089     basic_streambuf_wchar_dtor(&this->base);
3090 }
3091
3092 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_vector_dtor, 8)
3093 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_vector_dtor(basic_filebuf_wchar *this, unsigned int flags)
3094 {
3095     TRACE("(%p %x)\n", this, flags);
3096     if(flags & 2) {
3097         /* we have an array, with the number of elements stored before the first object */
3098         INT_PTR i, *ptr = (INT_PTR *)this-1;
3099
3100         for(i=*ptr-1; i>=0; i--)
3101             basic_filebuf_wchar_dtor(this+i);
3102         MSVCRT_operator_delete(ptr);
3103     } else {
3104         basic_filebuf_wchar_dtor(this);
3105         if(flags & 1)
3106             MSVCRT_operator_delete(this);
3107     }
3108
3109     return this;
3110 }
3111
3112 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
3113 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
3114 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QBE_NXZ */
3115 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
3116 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_is_open, 4)
3117 MSVCP_bool __thiscall basic_filebuf_wchar_is_open(const basic_filebuf_wchar *this)
3118 {
3119     TRACE("(%p)\n", this);
3120     return this->file != NULL;
3121 }
3122
3123 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WHH@Z */
3124 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
3125 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGHH@Z */
3126 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGHH@Z */
3127 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_wchar, 16)
3128 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot)
3129 {
3130     FILE *f = NULL;
3131
3132     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
3133
3134     if(basic_filebuf_wchar_is_open(this))
3135         return NULL;
3136
3137     if(!(f = _Fiopen_wchar(name, mode, prot)))
3138         return NULL;
3139
3140     basic_filebuf_wchar__Init(this, f, INITFL_open);
3141     basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(this->base.loc));
3142     return this;
3143 }
3144
3145 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PB_WHH@Z */
3146 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
3147 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBGHH@Z */
3148 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBGHH@Z */
3149 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_wchar, 16)
3150 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot)
3151 {
3152     FILE *f = NULL;
3153
3154     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
3155
3156     if(basic_filebuf_wchar_is_open(this))
3157         return NULL;
3158
3159     if(!(f = _Fiopen_wchar(name, mode, prot)))
3160         return NULL;
3161
3162     basic_filebuf_short__Init(this, f, INITFL_open);
3163     basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(this->base.loc));
3164     return this;
3165 }
3166
3167 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WI@Z */
3168 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WI@Z */
3169 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGI@Z */
3170 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGI@Z */
3171 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_wchar_mode, 12)
3172 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_wchar_mode(basic_filebuf_wchar *this, const wchar_t *name, unsigned int mode)
3173 {
3174     return basic_filebuf_wchar_open_wchar(this, name, mode, SH_DENYNO);
3175 }
3176
3177 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PB_WI@Z */
3178 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEB_WI@Z */
3179 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBGI@Z */
3180 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBGI@Z */
3181 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_wchar_mode, 12)
3182 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_wchar_mode(basic_filebuf_wchar *this, const wchar_t *name, unsigned int mode)
3183 {
3184     return basic_filebuf_short_open_wchar(this, name, mode, SH_DENYNO);
3185 }
3186
3187 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDHH@Z */
3188 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDHH@Z */
3189 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open, 16)
3190 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open(basic_filebuf_wchar *this, const char *name, int mode, int prot)
3191 {
3192     wchar_t nameW[FILENAME_MAX];
3193
3194     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
3195
3196     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
3197         return NULL;
3198     return basic_filebuf_wchar_open_wchar(this, nameW, mode, prot);
3199 }
3200
3201 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDHH@Z */
3202 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDHH@Z */
3203 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open, 16)
3204 basic_filebuf_wchar* __thiscall basic_filebuf_short_open(basic_filebuf_wchar *this, const char *name, int mode, int prot)
3205 {
3206     wchar_t nameW[FILENAME_MAX];
3207
3208     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
3209
3210     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
3211         return NULL;
3212     return basic_filebuf_short_open_wchar(this, nameW, mode, prot);
3213 }
3214
3215 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDI@Z */
3216 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDI@Z */
3217 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_mode, 12)
3218 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_mode(basic_filebuf_wchar *this, const char *name, unsigned int mode)
3219 {
3220     return basic_filebuf_wchar_open(this, name, mode, SH_DENYNO);
3221 }
3222
3223 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDI@Z */
3224 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDI@Z */
3225 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_mode, 12)
3226 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_mode(basic_filebuf_wchar *this, const char *name, unsigned int mode)
3227 {
3228     return basic_filebuf_short_open(this, name, mode, SH_DENYNO);
3229 }
3230
3231 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
3232 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
3233 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
3234 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
3235 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_overflow, 8)
3236 unsigned short __thiscall basic_filebuf_wchar_overflow(basic_filebuf_wchar *this, unsigned short c)
3237 {
3238     char buf[8], *dyn_buf, *to_next;
3239     wchar_t ch = c;
3240     const wchar_t *from_next;
3241     int max_size;
3242     unsigned short ret;
3243
3244
3245     TRACE("(%p %d)\n", this, c);
3246
3247     if(!basic_filebuf_wchar_is_open(this))
3248         return WEOF;
3249     if(c == WEOF)
3250         return !c;
3251
3252     if(!this->cvt)
3253         return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
3254
3255     from_next = &ch;
3256     do {
3257         ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
3258                 &from_next, buf, buf+sizeof(buf), &to_next);
3259
3260         switch(ret) {
3261         case CODECVT_partial:
3262             if(to_next == buf)
3263                 break;
3264             /* fall through */
3265         case CODECVT_ok:
3266             if(!fwrite(buf, to_next-buf, 1, this->file))
3267                 return WEOF;
3268             if(ret == CODECVT_partial)
3269                 continue;
3270             return c;
3271         case CODECVT_noconv:
3272             return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
3273         default:
3274             return WEOF;
3275         }
3276
3277         break;
3278     } while(1);
3279
3280     max_size = codecvt_base_max_length(&this->cvt->base);
3281     dyn_buf = malloc(max_size);
3282     if(!dyn_buf)
3283         return WEOF;
3284
3285     ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
3286             &from_next, dyn_buf, dyn_buf+max_size, &to_next);
3287
3288     switch(ret) {
3289     case CODECVT_ok:
3290         ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
3291         free(dyn_buf);
3292         return ret ? c : WEOF;
3293     case CODECVT_partial:
3294         ERR("buffer should be big enough to store all output\n");
3295         /* fall through */
3296     default:
3297         free(dyn_buf);
3298         return WEOF;
3299     }
3300 }
3301
3302 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
3303 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
3304 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
3305 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
3306 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_pbackfail, 8)
3307 unsigned short __thiscall basic_filebuf_wchar_pbackfail(basic_filebuf_wchar *this, unsigned short c)
3308 {
3309     TRACE("(%p %d)\n", this, c);
3310
3311     if(!basic_filebuf_wchar_is_open(this))
3312         return WEOF;
3313
3314     if(basic_streambuf_wchar_gptr(&this->base)>basic_streambuf_wchar_eback(&this->base)
3315             && (c==WEOF || basic_streambuf_wchar_gptr(&this->base)[-1]==c)) {
3316         basic_streambuf_wchar__Gndec(&this->base);
3317         return c==WEOF ? !c : c;
3318     }else if(c!=WEOF && !this->cvt) {
3319         return ungetwc(c, this->file);
3320     }else if(c!=WEOF && basic_streambuf_wchar_gptr(&this->base)!=&this->putback) {
3321         this->putback = c;
3322         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback, &this->putback+1);
3323         return c;
3324     }
3325
3326     return WEOF;
3327 }
3328
3329 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
3330 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
3331 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
3332 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
3333 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_uflow, 4)
3334 unsigned short __thiscall basic_filebuf_wchar_uflow(basic_filebuf_wchar *this)
3335 {
3336     wchar_t ch, *to_next;
3337     char buf[128];
3338     const char *buf_next;
3339     int c, i;
3340
3341     TRACE("(%p)\n", this);
3342
3343     if(!basic_filebuf_wchar_is_open(this))
3344         return WEOF;
3345
3346     if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
3347         return *basic_streambuf_wchar__Gninc(&this->base);
3348
3349     if(!this->cvt)
3350         return fgetwc(this->file);
3351
3352     buf_next = buf;
3353     for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
3354         if((c = fgetc(this->file)) == EOF)
3355             return WEOF;
3356         buf[i] = c;
3357
3358         switch(codecvt_wchar_in(this->cvt, &this->state, buf_next,
3359                     buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
3360         case CODECVT_partial:
3361         case CODECVT_ok:
3362             if(to_next == &ch)
3363                 continue;
3364
3365             for(i--; i>=buf_next-buf; i--)
3366                 ungetc(buf[i], this->file);
3367             return ch;
3368         case CODECVT_noconv:
3369             if(i+1 < sizeof(wchar_t))
3370                 continue;
3371
3372             memcpy(&ch, buf, sizeof(wchar_t));
3373             return ch;
3374         default:
3375             return WEOF;
3376         }
3377     }
3378
3379     FIXME("buffer is too small\n");
3380     return WEOF;
3381 }
3382
3383 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
3384 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
3385 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
3386 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
3387 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_underflow, 4)
3388 unsigned short __thiscall basic_filebuf_wchar_underflow(basic_filebuf_wchar *this)
3389 {
3390     unsigned short ret;
3391
3392     TRACE("(%p)\n", this);
3393
3394     if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
3395         return *basic_streambuf_wchar_gptr(&this->base);
3396
3397     ret = call_basic_streambuf_wchar_uflow(&this->base);
3398     if(ret != WEOF)
3399         ret = call_basic_streambuf_wchar_pbackfail(&this->base, ret);
3400     return ret;
3401 }
3402
3403 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3404 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3405 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3406 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3407 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekoff, 20)
3408 fpos_int* __thiscall basic_filebuf_wchar_seekoff(basic_filebuf_wchar *this,
3409         fpos_int *ret, streamoff off, int way, int mode)
3410 {
3411     fpos_t pos;
3412
3413     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
3414
3415     if(basic_streambuf_wchar_gptr(&this->base) == &this->putback) {
3416         if(way == SEEKDIR_cur)
3417             off -= sizeof(wchar_t);
3418
3419         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
3420     }
3421
3422     if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
3423             || fseek(this->file, off, way)) {
3424         ret->off = -1;
3425         ret->pos = 0;
3426         ret->state = 0;
3427         return ret;
3428     }
3429
3430     fgetpos(this->file, &pos);
3431     ret->off = 0;
3432     ret->pos = pos;
3433     ret->state = this->state;
3434     return ret;
3435 }
3436
3437 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3438 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3439 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3440 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3441 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekpos, 36)
3442 fpos_int* __thiscall basic_filebuf_wchar_seekpos(basic_filebuf_wchar *this,
3443         fpos_int *ret, fpos_int pos, int mode)
3444 {
3445     fpos_t fpos;
3446
3447     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
3448
3449     if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
3450             || fseek(this->file, (LONG)pos.pos, SEEK_SET)
3451             || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
3452         ret->off = -1;
3453         ret->pos = 0;
3454         ret->state = 0;
3455         return ret;
3456     }
3457
3458     if(basic_streambuf_wchar_gptr(&this->base) == &this->putback)
3459         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
3460
3461     fgetpos(this->file, &fpos);
3462     ret->off = 0;
3463     ret->pos = fpos;
3464     ret->state = this->state;
3465     return ret;
3466 }
3467
3468 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PA_WH@Z */
3469 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEA_W_J@Z */
3470 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_setbuf, 12)
3471 basic_streambuf_wchar* __thiscall basic_filebuf_wchar_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
3472 {
3473     TRACE("(%p %p %ld)\n", this, buf, count);
3474
3475     if(!basic_filebuf_wchar_is_open(this))
3476         return NULL;
3477
3478     if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
3479         return NULL;
3480
3481     basic_filebuf_wchar__Init(this, this->file, INITFL_open);
3482     return &this->base;
3483 }
3484
3485 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAGH@Z */
3486 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAG_J@Z */
3487 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_setbuf, 12)
3488 basic_streambuf_wchar* __thiscall basic_filebuf_short_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
3489 {
3490     TRACE("(%p %p %ld)\n", this, buf, count);
3491
3492     if(!basic_filebuf_wchar_is_open(this))
3493         return NULL;
3494
3495     if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
3496         return NULL;
3497
3498     basic_filebuf_short__Init(this, this->file, INITFL_open);
3499     return &this->base;
3500 }
3501
3502 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
3503 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
3504 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
3505 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
3506 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_sync, 4)
3507 int __thiscall basic_filebuf_wchar_sync(basic_filebuf_wchar *this)
3508 {
3509     TRACE("(%p)\n", this);
3510
3511     if(!basic_filebuf_wchar_is_open(this))
3512         return 0;
3513
3514     if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
3515         return 0;
3516     return fflush(this->file);
3517 }
3518
3519 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
3520 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
3521 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_imbue, 8)
3522 void __thiscall basic_filebuf_wchar_imbue(basic_filebuf_wchar *this, const locale *loc)
3523 {
3524     TRACE("(%p %p)\n", this, loc);
3525     basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(loc));
3526 }
3527
3528 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
3529 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
3530 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_imbue, 8)
3531 void __thiscall basic_filebuf_short_imbue(basic_filebuf_wchar *this, const locale *loc)
3532 {
3533     TRACE("(%p %p)\n", this, loc);
3534     basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(loc));
3535 }
3536
3537 /* ?_Getstate@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEHH@Z */
3538 /* ?_Getstate@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAHH@Z */
3539 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Getstate, 8)
3540 int __thiscall basic_stringbuf_char__Getstate(basic_stringbuf_char *this, IOSB_openmode mode)
3541 {
3542     int state = 0;
3543
3544     if(!(mode & OPENMODE_in))
3545         state |= STRINGBUF_no_read;
3546
3547     if(!(mode & OPENMODE_out))
3548         state |= STRINGBUF_no_write;
3549
3550     if(mode & OPENMODE_ate)
3551         state |= STRINGBUF_at_end;
3552
3553     if(mode & OPENMODE_app)
3554         state |= STRINGBUF_append;
3555
3556     return state;
3557 }
3558
3559 /* ?_Init@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXPBDIH@Z */
3560 /* ?_Init@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAXPEBD_KH@Z */
3561 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Init, 16)
3562 void __thiscall basic_stringbuf_char__Init(basic_stringbuf_char *this, const char *str, MSVCP_size_t count, int state)
3563 {
3564     TRACE("(%p, %p, %ld, %d)\n", this, str, count, state);
3565
3566     basic_streambuf_char__Init_empty(&this->base);
3567
3568     this->state = state;
3569     this->seekhigh = NULL;
3570
3571     if(count && str) {
3572         char *buf = MSVCRT_operator_new(count);
3573         if(!buf) {
3574             ERR("Out of memory\n");
3575             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3576         }
3577
3578         memcpy(buf, str, count);
3579         this->seekhigh = buf + count;
3580
3581         this->state |= STRINGBUF_allocated;
3582
3583         if(!(state & STRINGBUF_no_read))
3584             basic_streambuf_char_setg(&this->base, buf, buf, buf + count);
3585
3586         if(!(state & STRINGBUF_no_write)) {
3587             basic_streambuf_char_setp_next(&this->base, buf, (state & STRINGBUF_at_end) ? buf + count : buf, buf + count);
3588
3589             if(!basic_streambuf_char_gptr(&this->base))
3590                 basic_streambuf_char_setg(&this->base, buf, 0, buf);
3591         }
3592     }
3593 }
3594
3595 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
3596 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
3597 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor_str, 12)
3598 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor_str(basic_stringbuf_char *this,
3599         const basic_string_char *str, IOSB_openmode mode)
3600 {
3601     TRACE("(%p %p %d)\n", this, str, mode);
3602
3603     basic_streambuf_char_ctor(&this->base);
3604     this->base.vtable = &MSVCP_basic_stringbuf_char_vtable;
3605
3606     basic_stringbuf_char__Init(this, MSVCP_basic_string_char_c_str(str),
3607             str->size, basic_stringbuf_char__Getstate(this, mode));
3608     return this;
3609 }
3610
3611 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
3612 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
3613 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor_mode, 8)
3614 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor_mode(
3615         basic_stringbuf_char *this, IOSB_openmode mode)
3616 {
3617     TRACE("(%p %d)\n", this, mode);
3618
3619     basic_streambuf_char_ctor(&this->base);
3620     this->base.vtable = &MSVCP_basic_stringbuf_char_vtable;
3621
3622     basic_stringbuf_char__Init(this, NULL, 0, basic_stringbuf_char__Getstate(this, mode));
3623     return this;
3624 }
3625
3626 /* ??_F?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
3627 /* ??_F?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
3628 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor, 4)
3629 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor(basic_stringbuf_char *this)
3630 {
3631     return basic_stringbuf_char_ctor_mode(this, OPENMODE_in|OPENMODE_out);
3632 }
3633
3634 /* ?_Tidy@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXXZ */
3635 /* ?_Tidy@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAXXZ */
3636 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Tidy, 4)
3637 void __thiscall basic_stringbuf_char__Tidy(basic_stringbuf_char *this)
3638 {
3639     TRACE("(%p)\n", this);
3640
3641     if(this->state & STRINGBUF_allocated) {
3642         MSVCRT_operator_delete(basic_streambuf_char_eback(&this->base));
3643         this->seekhigh = NULL;
3644         this->state &= ~STRINGBUF_allocated;
3645     }
3646
3647     basic_streambuf_char__Init_empty(&this->base);
3648 }
3649
3650 /* ??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
3651 /* ??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
3652 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_dtor, 4)
3653 void __thiscall basic_stringbuf_char_dtor(basic_stringbuf_char *this)
3654 {
3655     TRACE("(%p)\n", this);
3656
3657     basic_stringbuf_char__Tidy(this);
3658     basic_streambuf_char_dtor(&this->base);
3659 }
3660
3661 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_vector_dtor, 8)
3662 basic_stringbuf_char* __thiscall basic_stringbuf_char_vector_dtor(basic_stringbuf_char *this, unsigned int flags)
3663 {
3664     TRACE("(%p %x)\n", this, flags);
3665
3666     if(flags & 2) {
3667         /* we have an array, with the number of elements stored before the first object */
3668         INT_PTR i, *ptr = (INT_PTR *) this - 1;
3669
3670         for (i = *ptr - 1; i >= 0; i--)
3671             basic_stringbuf_char_dtor(this+i);
3672
3673         MSVCRT_operator_delete(ptr);
3674     }else {
3675         basic_stringbuf_char_dtor(this);
3676
3677         if(flags & 1)
3678             MSVCRT_operator_delete(this);
3679     }
3680
3681     return this;
3682 }
3683
3684 /* ?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z */
3685 /* ?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHH@Z */
3686 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_overflow, 8)
3687 int __thiscall basic_stringbuf_char_overflow(basic_stringbuf_char *this, int meta)
3688 {
3689     MSVCP_size_t oldsize, size;
3690     char *ptr, *buf;
3691
3692     TRACE("(%p %x)\n", this, meta);
3693
3694     if(meta == EOF)
3695         return !EOF;
3696     if(this->state & STRINGBUF_no_write)
3697         return EOF;
3698
3699     ptr = basic_streambuf_char_pptr(&this->base);
3700     if((this->state&STRINGBUF_append) && ptr<this->seekhigh)
3701         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
3702                 this->seekhigh, basic_streambuf_char_epptr(&this->base));
3703
3704     if(ptr && ptr<basic_streambuf_char_epptr(&this->base))
3705         return (*basic_streambuf_char__Pninc(&this->base) = meta);
3706
3707     oldsize = (ptr ? basic_streambuf_char_epptr(&this->base)-basic_streambuf_char_eback(&this->base): 0);
3708     size = oldsize|0xf;
3709     size += size/2;
3710     buf = MSVCRT_operator_new(size);
3711     if(!buf) {
3712         ERR("Out of memory\n");
3713         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3714     }
3715
3716     if(!oldsize) {
3717         this->seekhigh = buf;
3718         basic_streambuf_char_setp(&this->base, buf, buf+size);
3719         if(this->state & STRINGBUF_no_read)
3720             basic_streambuf_char_setg(&this->base, buf, NULL, buf);
3721         else
3722             basic_streambuf_char_setg(&this->base, buf, buf, buf+1);
3723
3724         this->state |= STRINGBUF_allocated;
3725     }else {
3726         ptr = basic_streambuf_char_eback(&this->base);
3727         memcpy(buf, ptr, oldsize);
3728
3729         this->seekhigh = buf+(this->seekhigh-ptr);
3730         basic_streambuf_char_setp_next(&this->base, buf,
3731                 buf+(basic_streambuf_char_pptr(&this->base)-ptr), buf+size);
3732         if(this->state & STRINGBUF_no_read)
3733             basic_streambuf_char_setg(&this->base, buf, NULL, buf);
3734         else
3735             basic_streambuf_char_setg(&this->base, buf,
3736                     buf+(basic_streambuf_char_gptr(&this->base)-ptr),
3737                     basic_streambuf_char_pptr(&this->base)+1);
3738
3739         MSVCRT_operator_delete(ptr);
3740     }
3741
3742     return (*basic_streambuf_char__Pninc(&this->base) = meta);
3743 }
3744
3745 /* ?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z */
3746 /* ?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHH@Z */
3747 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_pbackfail, 8)
3748 int __thiscall basic_stringbuf_char_pbackfail(basic_stringbuf_char *this, int c)
3749 {
3750     char *cur;
3751
3752     TRACE("(%p %x)\n", this, c);
3753
3754     cur = basic_streambuf_char_gptr(&this->base);
3755     if(!cur || cur==basic_streambuf_char_eback(&this->base)
3756             || (c!=EOF && c!=cur[-1] && this->state&STRINGBUF_no_write))
3757         return EOF;
3758
3759     if(c != EOF)
3760         cur[-1] = c;
3761     basic_streambuf_char_gbump(&this->base, -1);
3762     return c==EOF ? !EOF : c;
3763 }
3764
3765 /* ?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHXZ */
3766 /* ?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHXZ */
3767 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_underflow, 4)
3768 int __thiscall basic_stringbuf_char_underflow(basic_stringbuf_char *this)
3769 {
3770     char *ptr, *cur;
3771
3772     TRACE("(%p)\n", this);
3773
3774     cur = basic_streambuf_char_gptr(&this->base);
3775     if(!cur || this->state&STRINGBUF_no_read)
3776         return EOF;
3777
3778     ptr  = basic_streambuf_char_pptr(&this->base);
3779     if(this->seekhigh < ptr)
3780         this->seekhigh = ptr;
3781
3782     ptr = basic_streambuf_char_egptr(&this->base);
3783     if(this->seekhigh > ptr)
3784         basic_streambuf_char_setg(&this->base, basic_streambuf_char_eback(&this->base), cur, this->seekhigh);
3785
3786     if(cur < this->seekhigh)
3787         return (unsigned char)*cur;
3788     return EOF;
3789 }
3790
3791 /* ?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3792 /* ?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3793 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_seekoff, 20)
3794 fpos_int* __thiscall basic_stringbuf_char_seekoff(basic_stringbuf_char *this,
3795         fpos_int *ret, streamoff off, int way, int mode)
3796 {
3797     char *beg, *cur_r, *cur_w;
3798
3799     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
3800
3801     cur_w = basic_streambuf_char_pptr(&this->base);
3802     if(cur_w > this->seekhigh)
3803         this->seekhigh = cur_w;
3804
3805     ret->off = 0;
3806     ret->pos = 0;
3807     ret->state = 0;
3808
3809     beg = basic_streambuf_char_eback(&this->base);
3810     cur_r = basic_streambuf_char_gptr(&this->base);
3811     if((mode & OPENMODE_in) && cur_r) {
3812         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
3813             off += cur_r-beg;
3814         else if(way == SEEKDIR_end)
3815             off += this->seekhigh-beg;
3816         else if(way != SEEKDIR_beg)
3817             off = -1;
3818
3819         if(off<0 || off>this->seekhigh-beg) {
3820             off = -1;
3821         }else {
3822             basic_streambuf_char_gbump(&this->base, beg-cur_r+off);
3823             if((mode & OPENMODE_out) && cur_w) {
3824                 basic_streambuf_char_setp_next(&this->base, beg,
3825                         basic_streambuf_char_gptr(&this->base),
3826                         basic_streambuf_char_epptr(&this->base));
3827             }
3828         }
3829     }else if((mode & OPENMODE_out) && cur_w) {
3830         if(way == SEEKDIR_cur)
3831             off += cur_w-beg;
3832         else if(way == SEEKDIR_end)
3833             off += this->seekhigh-beg;
3834         else if(way != SEEKDIR_beg)
3835             off = -1;
3836
3837         if(off<0 || off>this->seekhigh-beg)
3838             off = -1;
3839         else
3840             basic_streambuf_char_pbump(&this->base, beg-cur_w+off);
3841     }else {
3842         off = -1;
3843     }
3844
3845     ret->off = off;
3846     return ret;
3847 }
3848
3849 /* ?seekpos@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3850 /* ?seekpos@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3851 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_seekpos, 36)
3852 fpos_int* __thiscall basic_stringbuf_char_seekpos(basic_stringbuf_char *this,
3853         fpos_int *ret, fpos_int pos, int mode)
3854 {
3855     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
3856
3857     if(pos.off==-1 && pos.pos==0 && pos.state==0) {
3858         *ret = pos;
3859         return ret;
3860     }
3861
3862     return basic_stringbuf_char_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
3863 }
3864
3865 /* ?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
3866 /* ?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
3867 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_str_set, 8)
3868 void __thiscall basic_stringbuf_char_str_set(basic_stringbuf_char *this, const basic_string_char *str)
3869 {
3870     TRACE("(%p %p)\n", this, str);
3871
3872     basic_stringbuf_char__Tidy(this);
3873     basic_stringbuf_char__Init(this, MSVCP_basic_string_char_c_str(str), str->size, this->state);
3874 }
3875
3876 /* ?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3877 /* ?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3878 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_str_get, 8)
3879 basic_string_char* __thiscall basic_stringbuf_char_str_get(const basic_stringbuf_char *this, basic_string_char *ret)
3880 {
3881     char *ptr;
3882
3883     TRACE("(%p)\n", this);
3884
3885     if(!(this->state & STRINGBUF_no_write) && basic_streambuf_char_pptr(&this->base)) {
3886         char *pptr;
3887
3888         ptr = basic_streambuf_char_pbase(&this->base);
3889         pptr = basic_streambuf_char_pptr(&this->base);
3890
3891         return MSVCP_basic_string_char_ctor_cstr_len(ret, ptr, (this->seekhigh < pptr ? pptr : this->seekhigh) - ptr);
3892     }
3893
3894     if(!(this->state & STRINGBUF_no_read) && basic_streambuf_char_gptr(&this->base)) {
3895         ptr = basic_streambuf_char_eback(&this->base);
3896         return MSVCP_basic_string_char_ctor_cstr_len(ret, ptr, basic_streambuf_char_egptr(&this->base) - ptr);
3897     }
3898
3899     return MSVCP_basic_string_char_ctor(ret);
3900 }
3901
3902 /* ?_Getstate@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AAEHH@Z */
3903 /* ?_Getstate@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEAAHH@Z */
3904 /* ?_Getstate@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEHH@Z */
3905 /* ?_Getstate@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAHH@Z */
3906 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Getstate, 8)
3907 int __thiscall basic_stringbuf_wchar__Getstate(basic_stringbuf_wchar *this, IOSB_openmode mode)
3908 {
3909     int state = 0;
3910
3911     if(!(mode & OPENMODE_in))
3912         state |= STRINGBUF_no_read;
3913
3914     if(!(mode & OPENMODE_out))
3915         state |= STRINGBUF_no_write;
3916
3917     if(mode & OPENMODE_ate)
3918         state |= STRINGBUF_at_end;
3919
3920     if(mode & OPENMODE_app)
3921         state |= STRINGBUF_append;
3922
3923     return state;
3924 }
3925
3926 /* ?_Init@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXPB_WIH@Z */
3927 /* ?_Init@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAXPEB_W_KH@Z */
3928 /* ?_Init@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXPBGIH@Z */
3929 /* ?_Init@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAXPEBG_KH@Z */
3930 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Init, 16)
3931 void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const wchar_t *str, MSVCP_size_t count, int state)
3932 {
3933     TRACE("(%p, %p, %lu, %d)\n", this, str, count, state);
3934
3935     basic_streambuf_wchar__Init_empty(&this->base);
3936
3937     this->state = state;
3938     this->seekhigh = NULL;
3939
3940     if(count && str) {
3941         wchar_t *buf = MSVCRT_operator_new(count*sizeof(wchar_t));
3942         if(!buf) {
3943             ERR("Out of memory\n");
3944             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3945         }
3946
3947         memcpy(buf, str, count*sizeof(wchar_t));
3948         this->seekhigh = buf + count;
3949
3950         this->state |= STRINGBUF_allocated;
3951
3952         if(!(state & STRINGBUF_no_read))
3953             basic_streambuf_wchar_setg(&this->base, buf, buf, buf + count);
3954
3955         if(!(state & STRINGBUF_no_write)) {
3956             basic_streambuf_wchar_setp_next(&this->base, buf, (state & STRINGBUF_at_end) ? buf + count : buf, buf + count);
3957
3958             if(!basic_streambuf_wchar_gptr(&this->base))
3959                 basic_streambuf_wchar_setg(&this->base, buf, 0, buf);
3960         }
3961     }
3962 }
3963
3964 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
3965 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
3966 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor_str, 12)
3967 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor_str(basic_stringbuf_wchar *this,
3968         const basic_string_wchar *str, IOSB_openmode mode)
3969 {
3970     TRACE("(%p %p %d)\n", this, str, mode);
3971
3972     basic_streambuf_wchar_ctor(&this->base);
3973     this->base.vtable = &MSVCP_basic_stringbuf_wchar_vtable;
3974
3975     basic_stringbuf_wchar__Init(this, MSVCP_basic_string_wchar_c_str(str),
3976             str->size, basic_stringbuf_wchar__Getstate(this, mode));
3977     return this;
3978 }
3979
3980 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
3981 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
3982 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor_str, 12)
3983 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor_str(basic_stringbuf_wchar *this,
3984         const basic_string_wchar *str, IOSB_openmode mode)
3985 {
3986     basic_stringbuf_wchar_ctor_str(this, str, mode);
3987     this->base.vtable = &MSVCP_basic_stringbuf_short_vtable;
3988     return this;
3989 }
3990
3991 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
3992 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
3993 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor_mode, 8)
3994 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor_mode(
3995         basic_stringbuf_wchar *this, IOSB_openmode mode)
3996 {
3997     TRACE("(%p %d)\n", this, mode);
3998
3999     basic_streambuf_wchar_ctor(&this->base);
4000     this->base.vtable = &MSVCP_basic_stringbuf_wchar_vtable;
4001
4002     basic_stringbuf_wchar__Init(this, NULL, 0, basic_stringbuf_wchar__Getstate(this, mode));
4003     return this;
4004 }
4005
4006 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
4007 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
4008 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor_mode, 8)
4009 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor_mode(
4010         basic_stringbuf_wchar *this, IOSB_openmode mode)
4011 {
4012     basic_stringbuf_wchar_ctor_mode(this, mode);
4013     this->base.vtable = &MSVCP_basic_stringbuf_short_vtable;
4014     return this;
4015 }
4016
4017 /* ??_F?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
4018 /* ??_F?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
4019 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor, 4)
4020 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor(basic_stringbuf_wchar *this)
4021 {
4022     return basic_stringbuf_wchar_ctor_mode(this, OPENMODE_in|OPENMODE_out);
4023 }
4024
4025 /* ??_F?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
4026 /* ??_F?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
4027 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor, 4)
4028 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor(basic_stringbuf_wchar *this)
4029 {
4030     return basic_stringbuf_short_ctor_mode(this, OPENMODE_in|OPENMODE_out);
4031 }
4032
4033 /* ?_Tidy@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXXZ */
4034 /* ?_Tidy@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAXXZ */
4035 /* ?_Tidy@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXXZ */
4036 /* ?_Tidy@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAXXZ */
4037 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Tidy, 4)
4038 void __thiscall basic_stringbuf_wchar__Tidy(basic_stringbuf_wchar *this)
4039 {
4040     TRACE("(%p)\n", this);
4041
4042     if(this->state & STRINGBUF_allocated) {
4043         MSVCRT_operator_delete(basic_streambuf_wchar_eback(&this->base));
4044         this->seekhigh = NULL;
4045         this->state &= ~STRINGBUF_allocated;
4046     }
4047
4048     basic_streambuf_wchar__Init_empty(&this->base);
4049 }
4050
4051 /* ??1?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
4052 /* ??1?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
4053 /* ??1?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
4054 /* ??1?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
4055 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_dtor, 4)
4056 void __thiscall basic_stringbuf_wchar_dtor(basic_stringbuf_wchar *this)
4057 {
4058     TRACE("(%p)\n", this);
4059
4060     basic_stringbuf_wchar__Tidy(this);
4061     basic_streambuf_wchar_dtor(&this->base);
4062 }
4063
4064 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_vector_dtor, 8)
4065 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_vector_dtor(basic_stringbuf_wchar *this, unsigned int flags)
4066 {
4067     TRACE("(%p %x)\n", this, flags);
4068
4069     if(flags & 2) {
4070         /* we have an array, with the number of elements stored before the first object */
4071         INT_PTR i, *ptr = (INT_PTR *) this - 1;
4072
4073         for (i = *ptr - 1; i >= 0; i--)
4074             basic_stringbuf_wchar_dtor(this+i);
4075
4076         MSVCRT_operator_delete(ptr);
4077     }else {
4078         basic_stringbuf_wchar_dtor(this);
4079
4080         if(flags & 1)
4081             MSVCRT_operator_delete(this);
4082     }
4083
4084     return this;
4085 }
4086
4087 /* ?overflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGG@Z */
4088 /* ?overflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGG@Z */
4089 /* ?overflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGG@Z */
4090 /* ?overflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGG@Z */
4091 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_overflow, 8)
4092 unsigned short __thiscall basic_stringbuf_wchar_overflow(basic_stringbuf_wchar *this, unsigned short meta)
4093 {
4094     MSVCP_size_t oldsize, size;
4095     wchar_t *ptr, *buf;
4096
4097     TRACE("(%p %x)\n", this, meta);
4098
4099     if(meta == WEOF)
4100         return !WEOF;
4101     if(this->state & STRINGBUF_no_write)
4102         return WEOF;
4103
4104     ptr = basic_streambuf_wchar_pptr(&this->base);
4105     if((this->state&STRINGBUF_append) && ptr<this->seekhigh)
4106         basic_streambuf_wchar_setp_next(&this->base, basic_streambuf_wchar_pbase(&this->base),
4107                 this->seekhigh, basic_streambuf_wchar_epptr(&this->base));
4108
4109     if(ptr && ptr<basic_streambuf_wchar_epptr(&this->base))
4110         return (*basic_streambuf_wchar__Pninc(&this->base) = meta);
4111
4112     oldsize = (ptr ? basic_streambuf_wchar_epptr(&this->base)-basic_streambuf_wchar_eback(&this->base): 0);
4113     size = oldsize|0xf;
4114     size += size/2;
4115     buf = MSVCRT_operator_new(size*sizeof(wchar_t));
4116     if(!buf) {
4117         ERR("Out of memory\n");
4118         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4119     }
4120
4121     if(!oldsize) {
4122         this->seekhigh = buf;
4123         basic_streambuf_wchar_setp(&this->base, buf, buf+size);
4124         if(this->state & STRINGBUF_no_read)
4125             basic_streambuf_wchar_setg(&this->base, buf, NULL, buf);
4126         else
4127             basic_streambuf_wchar_setg(&this->base, buf, buf, buf+1);
4128
4129         this->state |= STRINGBUF_allocated;
4130     }else {
4131         ptr = basic_streambuf_wchar_eback(&this->base);
4132         memcpy(buf, ptr, oldsize*sizeof(wchar_t));
4133
4134         this->seekhigh = buf+(this->seekhigh-ptr);
4135         basic_streambuf_wchar_setp_next(&this->base, buf,
4136                 buf+(basic_streambuf_wchar_pptr(&this->base)-ptr), buf+size);
4137         if(this->state & STRINGBUF_no_read)
4138             basic_streambuf_wchar_setg(&this->base, buf, NULL, buf);
4139         else
4140             basic_streambuf_wchar_setg(&this->base, buf,
4141                     buf+(basic_streambuf_wchar_gptr(&this->base)-ptr),
4142                     basic_streambuf_wchar_pptr(&this->base)+1);
4143
4144         MSVCRT_operator_delete(ptr);
4145     }
4146
4147     return (*basic_streambuf_wchar__Pninc(&this->base) = meta);
4148 }
4149
4150 /* ?pbackfail@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGG@Z */
4151 /* ?pbackfail@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGG@Z */
4152 /* ?pbackfail@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGG@Z */
4153 /* ?pbackfail@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGG@Z */
4154 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_pbackfail, 8)
4155 unsigned short __thiscall basic_stringbuf_wchar_pbackfail(basic_stringbuf_wchar *this, unsigned short c)
4156 {
4157     wchar_t *cur;
4158
4159     TRACE("(%p %x)\n", this, c);
4160
4161     cur = basic_streambuf_wchar_gptr(&this->base);
4162     if(!cur || cur==basic_streambuf_wchar_eback(&this->base)
4163             || (c!=WEOF && c!=cur[-1] && this->state&STRINGBUF_no_write))
4164         return WEOF;
4165
4166     if(c != WEOF)
4167         cur[-1] = c;
4168     basic_streambuf_wchar_gbump(&this->base, -1);
4169     return c==WEOF ? !WEOF : c;
4170 }
4171
4172 /* ?underflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGXZ */
4173 /* ?underflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGXZ */
4174 /* ?underflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGXZ */
4175 /* ?underflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGXZ */
4176 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_underflow, 4)
4177 unsigned short __thiscall basic_stringbuf_wchar_underflow(basic_stringbuf_wchar *this)
4178 {
4179     wchar_t *ptr, *cur;
4180
4181     TRACE("(%p)\n", this);
4182
4183     cur = basic_streambuf_wchar_gptr(&this->base);
4184     if(!cur || this->state&STRINGBUF_no_read)
4185         return WEOF;
4186
4187     ptr  = basic_streambuf_wchar_pptr(&this->base);
4188     if(this->seekhigh < ptr)
4189         this->seekhigh = ptr;
4190
4191     ptr = basic_streambuf_wchar_egptr(&this->base);
4192     if(this->seekhigh > ptr)
4193         basic_streambuf_wchar_setg(&this->base, basic_streambuf_wchar_eback(&this->base), cur, this->seekhigh);
4194
4195     if(cur < this->seekhigh)
4196         return *cur;
4197     return WEOF;
4198 }
4199
4200 /* ?seekoff@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
4201 /* ?seekoff@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
4202 /* ?seekoff@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
4203 /* ?seekoff@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
4204 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_seekoff, 20)
4205 fpos_int* __thiscall basic_stringbuf_wchar_seekoff(basic_stringbuf_wchar *this,
4206         fpos_int *ret, streamoff off, int way, int mode)
4207 {
4208     wchar_t *beg, *cur_r, *cur_w;
4209
4210     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
4211
4212     cur_w = basic_streambuf_wchar_pptr(&this->base);
4213     if(cur_w > this->seekhigh)
4214         this->seekhigh = cur_w;
4215
4216     ret->off = 0;
4217     ret->pos = 0;
4218     ret->state = 0;
4219
4220     beg = basic_streambuf_wchar_eback(&this->base);
4221     cur_r = basic_streambuf_wchar_gptr(&this->base);
4222     if((mode & OPENMODE_in) && cur_r) {
4223         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
4224             off += cur_r-beg;
4225         else if(way == SEEKDIR_end)
4226             off += this->seekhigh-beg;
4227         else if(way != SEEKDIR_beg)
4228             off = -1;
4229
4230         if(off<0 || off>this->seekhigh-beg) {
4231             off = -1;
4232         }else {
4233             basic_streambuf_wchar_gbump(&this->base, beg-cur_r+off);
4234             if((mode & OPENMODE_out) && cur_w) {
4235                 basic_streambuf_wchar_setp_next(&this->base, beg,
4236                         basic_streambuf_wchar_gptr(&this->base),
4237                         basic_streambuf_wchar_epptr(&this->base));
4238             }
4239         }
4240     }else if((mode & OPENMODE_out) && cur_w) {
4241         if(way == SEEKDIR_cur)
4242             off += cur_w-beg;
4243         else if(way == SEEKDIR_end)
4244             off += this->seekhigh-beg;
4245         else if(way != SEEKDIR_beg)
4246             off = -1;
4247
4248         if(off<0 || off>this->seekhigh-beg)
4249             off = -1;
4250         else
4251             basic_streambuf_wchar_pbump(&this->base, beg-cur_w+off);
4252     }else {
4253         off = -1;
4254     }
4255
4256     ret->off = off;
4257     return ret;
4258 }
4259
4260 /* ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
4261 /* ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
4262 /* ?seekpos@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
4263 /* ?seekpos@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
4264 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_seekpos, 36)
4265 fpos_int* __thiscall basic_stringbuf_wchar_seekpos(basic_stringbuf_wchar *this,
4266         fpos_int *ret, fpos_int pos, int mode)
4267 {
4268     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
4269
4270     if(pos.off==-1 && pos.pos==0 && pos.state==0) {
4271         *ret = pos;
4272         return ret;
4273     }
4274
4275     return basic_stringbuf_wchar_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
4276 }
4277
4278 /* ?str@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
4279 /* ?str@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
4280 /* ?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
4281 /* ?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
4282 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_str_set, 8)
4283 void __thiscall basic_stringbuf_wchar_str_set(basic_stringbuf_wchar *this, const basic_string_wchar *str)
4284 {
4285     TRACE("(%p %p)\n", this, str);
4286
4287     basic_stringbuf_wchar__Tidy(this);
4288     basic_stringbuf_wchar__Init(this, MSVCP_basic_string_wchar_c_str(str), str->size, this->state);
4289 }
4290
4291 /* ?str@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4292 /* ?str@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4293 /* ?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4294 /* ?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4295 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_str_get, 8)
4296 basic_string_wchar* __thiscall basic_stringbuf_wchar_str_get(const basic_stringbuf_wchar *this, basic_string_wchar *ret)
4297 {
4298     wchar_t *ptr;
4299
4300     TRACE("(%p)\n", this);
4301
4302     if(!(this->state & STRINGBUF_no_write) && basic_streambuf_wchar_pptr(&this->base)) {
4303         wchar_t *pptr;
4304
4305         ptr = basic_streambuf_wchar_pbase(&this->base);
4306         pptr = basic_streambuf_wchar_pptr(&this->base);
4307
4308         return MSVCP_basic_string_wchar_ctor_cstr_len(ret, ptr, (this->seekhigh < pptr ? pptr : this->seekhigh) - ptr);
4309     }
4310
4311     if(!(this->state & STRINGBUF_no_read) && basic_streambuf_wchar_gptr(&this->base)) {
4312         ptr = basic_streambuf_wchar_eback(&this->base);
4313         return MSVCP_basic_string_wchar_ctor_cstr_len(ret, ptr, basic_streambuf_wchar_egptr(&this->base) - ptr);
4314     }
4315
4316     return MSVCP_basic_string_wchar_ctor(ret);
4317 }
4318
4319 /* ??0ios_base@std@@IAE@XZ */
4320 /* ??0ios_base@std@@IEAA@XZ */
4321 DEFINE_THISCALL_WRAPPER(ios_base_ctor, 4)
4322 ios_base* __thiscall ios_base_ctor(ios_base *this)
4323 {
4324     TRACE("(%p)\n", this);
4325     this->vtable = &MSVCP_ios_base_vtable;
4326     return this;
4327 }
4328
4329 /* ??0ios_base@std@@QAE@ABV01@@Z */
4330 /* ??0ios_base@std@@QEAA@AEBV01@@Z */
4331 DEFINE_THISCALL_WRAPPER(ios_base_copy_ctor, 8)
4332 ios_base* __thiscall ios_base_copy_ctor(ios_base *this, const ios_base *copy)
4333 {
4334     TRACE("(%p %p)\n", this, copy);
4335     *this = *copy;
4336     this->vtable = &MSVCP_ios_base_vtable;
4337     return this;
4338 }
4339
4340 /* ?_Callfns@ios_base@std@@AAEXW4event@12@@Z */
4341 /* ?_Callfns@ios_base@std@@AEAAXW4event@12@@Z */
4342 DEFINE_THISCALL_WRAPPER(ios_base_Callfns, 8)
4343 void __thiscall ios_base_Callfns(ios_base *this, IOS_BASE_event event)
4344 {
4345     IOS_BASE_fnarray *cur;
4346
4347     TRACE("(%p %x)\n", this, event);
4348
4349     for(cur=this->calls; cur; cur=cur->next)
4350         cur->event_handler(event, this, cur->index);
4351 }
4352
4353 /* ?_Tidy@ios_base@std@@AAAXXZ */
4354 /* ?_Tidy@ios_base@std@@AEAAXXZ */
4355 void CDECL ios_base_Tidy(ios_base *this)
4356 {
4357     IOS_BASE_iosarray *arr_cur, *arr_next;
4358     IOS_BASE_fnarray *event_cur, *event_next;
4359
4360     TRACE("(%p)\n", this);
4361
4362     ios_base_Callfns(this, EVENT_erase_event);
4363
4364     for(arr_cur=this->arr; arr_cur; arr_cur=arr_next) {
4365         arr_next = arr_cur->next;
4366         MSVCRT_operator_delete(arr_cur);
4367     }
4368     this->arr = NULL;
4369
4370     for(event_cur=this->calls; event_cur; event_cur=event_next) {
4371         event_next = event_cur->next;
4372         MSVCRT_operator_delete(event_cur);
4373     }
4374     this->calls = NULL;
4375 }
4376
4377 /* ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z */
4378 /* ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z */
4379 void CDECL ios_base_Ios_base_dtor(ios_base *obj)
4380 {
4381     TRACE("(%p)\n", obj);
4382     if(obj->loc) {
4383         locale_dtor(obj->loc);
4384         MSVCRT_operator_delete(obj->loc);
4385     }
4386     ios_base_Tidy(obj);
4387 }
4388
4389 /* ??1ios_base@std@@UAE@XZ */
4390 /* ??1ios_base@std@@UEAA@XZ */
4391 DEFINE_THISCALL_WRAPPER(ios_base_dtor, 4)
4392 void __thiscall ios_base_dtor(ios_base *this)
4393 {
4394     ios_base_Ios_base_dtor(this);
4395 }
4396
4397 DEFINE_THISCALL_WRAPPER(ios_base_vector_dtor, 8)
4398 ios_base* __thiscall ios_base_vector_dtor(ios_base *this, unsigned int flags)
4399 {
4400     TRACE("(%p %x)\n", this, flags);
4401     if(flags & 2) {
4402         /* we have an array, with the number of elements stored before the first object */
4403         INT_PTR i, *ptr = (INT_PTR *)this-1;
4404
4405         for(i=*ptr-1; i>=0; i--)
4406             ios_base_dtor(this+i);
4407         MSVCRT_operator_delete(ptr);
4408     } else {
4409         ios_base_dtor(this);
4410         if(flags & 1)
4411             MSVCRT_operator_delete(this);
4412     }
4413
4414     return this;
4415 }
4416
4417 DEFINE_THISCALL_WRAPPER(iosb_vector_dtor, 8)
4418 void* __thiscall iosb_vector_dtor(void *this, unsigned int flags)
4419 {
4420     TRACE("(%p %x)\n", this, flags);
4421     if(flags & 2) {
4422         INT_PTR *ptr = (INT_PTR *)this-1;
4423         MSVCRT_operator_delete(ptr);
4424     } else {
4425         if(flags & 1)
4426             MSVCRT_operator_delete(this);
4427     }
4428
4429     return this;
4430 }
4431
4432 /* ?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z */
4433 /* ?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z */
4434 DEFINE_THISCALL_WRAPPER(ios_base_Findarr, 8)
4435 IOS_BASE_iosarray* __thiscall ios_base_Findarr(ios_base *this, int index)
4436 {
4437     IOS_BASE_iosarray *p;
4438
4439     TRACE("(%p %d)\n", this, index);
4440
4441     for(p=this->arr; p; p=p->next) {
4442         if(p->index == index)
4443             return p;
4444     }
4445
4446     for(p=this->arr; p; p=p->next) {
4447         if(!p->long_val && !p->ptr_val) {
4448             p->index = index;
4449             return p;
4450         }
4451     }
4452
4453     p = MSVCRT_operator_new(sizeof(IOS_BASE_iosarray));
4454     p->next = this->arr;
4455     p->index = index;
4456     p->long_val = 0;
4457     p->ptr_val = NULL;
4458     this->arr = p;
4459     return p;
4460 }
4461
4462 /* ?iword@ios_base@std@@QAEAAJH@Z */
4463 /* ?iword@ios_base@std@@QEAAAEAJH@Z */
4464 DEFINE_THISCALL_WRAPPER(ios_base_iword, 8)
4465 LONG* __thiscall ios_base_iword(ios_base *this, int index)
4466 {
4467     TRACE("(%p %d)\n", this, index);
4468     return &ios_base_Findarr(this, index)->long_val;
4469 }
4470
4471 /* ?pword@ios_base@std@@QAEAAPAXH@Z */
4472 /* ?pword@ios_base@std@@QEAAAEAPEAXH@Z */
4473 DEFINE_THISCALL_WRAPPER(ios_base_pword, 8)
4474 void** __thiscall ios_base_pword(ios_base *this, int index)
4475 {
4476     TRACE("(%p %d)\n", this, index);
4477     return &ios_base_Findarr(this, index)->ptr_val;
4478 }
4479
4480 /* ?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z */
4481 /* ?register_callback@ios_base@std@@QEAAXP6AXW4event@12@AEAV12@H@ZH@Z */
4482 DEFINE_THISCALL_WRAPPER(ios_base_register_callback, 12)
4483 void __thiscall ios_base_register_callback(ios_base *this, IOS_BASE_event_callback callback, int index)
4484 {
4485     IOS_BASE_fnarray *event;
4486
4487     TRACE("(%p %p %d)\n", this, callback, index);
4488
4489     event = MSVCRT_operator_new(sizeof(IOS_BASE_fnarray));
4490     event->next = this->calls;
4491     event->index = index;
4492     event->event_handler = callback;
4493     this->calls = event;
4494 }
4495
4496 /* ?clear@ios_base@std@@QAEXH_N@Z */
4497 /* ?clear@ios_base@std@@QEAAXH_N@Z */
4498 DEFINE_THISCALL_WRAPPER(ios_base_clear_reraise, 12)
4499 void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
4500 {
4501     TRACE("(%p %x %x)\n", this, state, reraise);
4502
4503     this->state = state & IOSTATE_mask;
4504     if(!(this->state & this->except))
4505         return;
4506
4507     if(reraise)
4508         throw_exception(EXCEPTION_RERAISE, NULL);
4509     else if(this->state & this->except & IOSTATE_eofbit)
4510         throw_exception(EXCEPTION_FAILURE, "eofbit is set");
4511     else if(this->state & this->except & IOSTATE_failbit)
4512         throw_exception(EXCEPTION_FAILURE, "failbit is set");
4513     else if(this->state & this->except & IOSTATE_badbit)
4514         throw_exception(EXCEPTION_FAILURE, "badbit is set");
4515     else if(this->state & this->except & IOSTATE__Hardfail)
4516         throw_exception(EXCEPTION_FAILURE, "_Hardfail is set");
4517 }
4518
4519 /* ?clear@ios_base@std@@QAEXH@Z */
4520 /* ?clear@ios_base@std@@QEAAXH@Z */
4521 DEFINE_THISCALL_WRAPPER(ios_base_clear, 8)
4522 void __thiscall ios_base_clear(ios_base *this, IOSB_iostate state)
4523 {
4524     ios_base_clear_reraise(this, state, FALSE);
4525 }
4526
4527 /* ?clear@ios_base@std@@QAEXI@Z */
4528 /* ?clear@ios_base@std@@QEAAXI@Z */
4529 DEFINE_THISCALL_WRAPPER(ios_base_clear_unsigned, 8)
4530 void __thiscall ios_base_clear_unsigned(ios_base *this, unsigned int state)
4531 {
4532     ios_base_clear_reraise(this, (IOSB_iostate)state, FALSE);
4533 }
4534
4535 /* ?exceptions@ios_base@std@@QAEXH@Z */
4536 /* ?exceptions@ios_base@std@@QEAAXH@Z */
4537 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set, 8)
4538 void __thiscall ios_base_exceptions_set(ios_base *this, IOSB_iostate state)
4539 {
4540     TRACE("(%p %x)\n", this, state);
4541     this->except = state & IOSTATE_mask;
4542     ios_base_clear(this, this->state);
4543 }
4544
4545 /* ?exceptions@ios_base@std@@QAEXI@Z */
4546 /* ?exceptions@ios_base@std@@QEAAXI@Z */
4547 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set_unsigned, 8)
4548 void __thiscall ios_base_exceptions_set_unsigned(ios_base *this, unsigned int state)
4549 {
4550     TRACE("(%p %x)\n", this, state);
4551     ios_base_exceptions_set(this, state);
4552 }
4553
4554 /* ?exceptions@ios_base@std@@QBEHXZ */
4555 /* ?exceptions@ios_base@std@@QEBAHXZ */
4556 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_get, 4)
4557 IOSB_iostate __thiscall ios_base_exceptions_get(ios_base *this)
4558 {
4559     TRACE("(%p)\n", this);
4560     return this->except;
4561 }
4562
4563 /* ?copyfmt@ios_base@std@@QAEAAV12@ABV12@@Z */
4564 /* ?copyfmt@ios_base@std@@QEAAAEAV12@AEBV12@@Z */
4565 DEFINE_THISCALL_WRAPPER(ios_base_copyfmt, 8)
4566 ios_base* __thiscall ios_base_copyfmt(ios_base *this, const ios_base *rhs)
4567 {
4568     TRACE("(%p %p)\n", this, rhs);
4569
4570     if(this != rhs) {
4571         IOS_BASE_iosarray *arr_cur;
4572         IOS_BASE_fnarray *event_cur;
4573
4574         ios_base_Tidy(this);
4575
4576         for(arr_cur=rhs->arr; arr_cur; arr_cur=arr_cur->next) {
4577             if(arr_cur->long_val)
4578                 *ios_base_iword(this, arr_cur->index) = arr_cur->long_val;
4579             if(arr_cur->ptr_val)
4580                 *ios_base_pword(this, arr_cur->index) = arr_cur->ptr_val;
4581         }
4582         this->stdstr = rhs->stdstr;
4583         this->fmtfl = rhs->fmtfl;
4584         this->prec = rhs->prec;
4585         this->wide = rhs->wide;
4586         locale_operator_assign(this->loc, rhs->loc);
4587
4588         for(event_cur=rhs->calls; event_cur; event_cur=event_cur->next)
4589             ios_base_register_callback(this, event_cur->event_handler, event_cur->index);
4590
4591         ios_base_Callfns(this, EVENT_copyfmt_event);
4592         ios_base_exceptions_set(this, rhs->except);
4593     }
4594
4595     return this;
4596 }
4597
4598 /* ??4ios_base@std@@QAEAAV01@ABV01@@Z */
4599 /* ??4ios_base@std@@QEAAAEAV01@AEBV01@@Z */
4600 DEFINE_THISCALL_WRAPPER(ios_base_assign, 8)
4601 ios_base* __thiscall ios_base_assign(ios_base *this, const ios_base *right)
4602 {
4603     TRACE("(%p %p)\n", this, right);
4604
4605     if(this != right) {
4606         this->state = right->state;
4607         ios_base_copyfmt(this, right);
4608     }
4609
4610     return this;
4611 }
4612
4613 /* ?fail@ios_base@std@@QBE_NXZ */
4614 /* ?fail@ios_base@std@@QEBA_NXZ */
4615 DEFINE_THISCALL_WRAPPER(ios_base_fail, 4)
4616 MSVCP_bool __thiscall ios_base_fail(const ios_base *this)
4617 {
4618     TRACE("(%p)\n", this);
4619     return (this->state & (IOSTATE_failbit|IOSTATE_badbit)) != 0;
4620 }
4621
4622 /* ??7ios_base@std@@QBE_NXZ */
4623 /* ??7ios_base@std@@QEBA_NXZ */
4624 DEFINE_THISCALL_WRAPPER(ios_base_op_succ, 4)
4625 MSVCP_bool __thiscall ios_base_op_succ(const ios_base *this)
4626 {
4627     TRACE("(%p)\n", this);
4628     return ios_base_fail(this);
4629 }
4630
4631 /* ??Bios_base@std@@QBEPAXXZ */
4632 /* ??Bios_base@std@@QEBAPEAXXZ */
4633 DEFINE_THISCALL_WRAPPER(ios_base_op_fail, 4)
4634 void* __thiscall ios_base_op_fail(const ios_base *this)
4635 {
4636     TRACE("(%p)\n", this);
4637     return ios_base_fail(this) ? NULL : (void*)this;
4638 }
4639
4640 /* ?_Addstd@ios_base@std@@SAXPAV12@@Z */
4641 /* ?_Addstd@ios_base@std@@SAXPEAV12@@Z */
4642 void CDECL ios_base_Addstd(ios_base *add)
4643 {
4644     FIXME("(%p) stub\n", add);
4645 }
4646
4647 /* ?_Index_func@ios_base@std@@CAAAHXZ */
4648 /* ?_Index_func@ios_base@std@@CAAEAHXZ */
4649 int* CDECL ios_base_Index_func(void)
4650 {
4651     TRACE("\n");
4652     return &ios_base_Index;
4653 }
4654
4655 /* ?_Init@ios_base@std@@IAEXXZ */
4656 /* ?_Init@ios_base@std@@IEAAXXZ */
4657 DEFINE_THISCALL_WRAPPER(ios_base__Init, 4)
4658 void __thiscall ios_base__Init(ios_base *this)
4659 {
4660     TRACE("(%p)\n", this);
4661
4662     this->stdstr = 0;
4663     this->state = this->except = IOSTATE_goodbit;
4664     this->fmtfl = FMTFLAG_skipws | FMTFLAG_dec;
4665     this->prec = 6;
4666     this->wide = 0;
4667     this->arr = NULL;
4668     this->calls = NULL;
4669     this->loc = MSVCRT_operator_new(sizeof(locale));
4670     locale_ctor(this->loc);
4671 }
4672
4673 /* ?_Sync_func@ios_base@std@@CAAA_NXZ */
4674 /* ?_Sync_func@ios_base@std@@CAAEA_NXZ */
4675 MSVCP_bool* CDECL ios_base_Sync_func(void)
4676 {
4677     TRACE("\n");
4678     return &ios_base_Sync;
4679 }
4680
4681 /* ?bad@ios_base@std@@QBE_NXZ */
4682 /* ?bad@ios_base@std@@QEBA_NXZ */
4683 DEFINE_THISCALL_WRAPPER(ios_base_bad, 4)
4684 MSVCP_bool __thiscall ios_base_bad(const ios_base *this)
4685 {
4686     TRACE("(%p)\n", this);
4687     return (this->state & IOSTATE_badbit) != 0;
4688 }
4689
4690 /* ?eof@ios_base@std@@QBE_NXZ */
4691 /* ?eof@ios_base@std@@QEBA_NXZ */
4692 DEFINE_THISCALL_WRAPPER(ios_base_eof, 4)
4693 MSVCP_bool __thiscall ios_base_eof(const ios_base *this)
4694 {
4695     TRACE("(%p)\n", this);
4696     return (this->state & IOSTATE_eofbit) != 0;
4697 }
4698
4699 /* ?flags@ios_base@std@@QAEHH@Z */
4700 /* ?flags@ios_base@std@@QEAAHH@Z */
4701 DEFINE_THISCALL_WRAPPER(ios_base_flags_set, 8)
4702 IOSB_fmtflags __thiscall ios_base_flags_set(ios_base *this, IOSB_fmtflags flags)
4703 {
4704     IOSB_fmtflags ret = this->fmtfl;
4705
4706     TRACE("(%p %x)\n", this, flags);
4707
4708     this->fmtfl = flags & FMTFLAG_mask;
4709     return ret;
4710 }
4711
4712 /* ?flags@ios_base@std@@QBEHXZ */
4713 /* ?flags@ios_base@std@@QEBAHXZ */
4714 DEFINE_THISCALL_WRAPPER(ios_base_flags_get, 4)
4715 IOSB_fmtflags __thiscall ios_base_flags_get(const ios_base *this)
4716 {
4717     TRACE("(%p)\n", this);
4718     return this->fmtfl;
4719 }
4720
4721 /* ?getloc@ios_base@std@@QBE?AVlocale@2@XZ */
4722 /* ?getloc@ios_base@std@@QEBA?AVlocale@2@XZ */
4723 DEFINE_THISCALL_WRAPPER(ios_base_getloc, 8)
4724 locale* __thiscall ios_base_getloc(const ios_base *this, locale *ret)
4725 {
4726     TRACE("(%p)\n", this);
4727     return locale_copy_ctor(ret, this->loc);
4728 }
4729
4730 /* ?good@ios_base@std@@QBE_NXZ */
4731 /* ?good@ios_base@std@@QEBA_NXZ */
4732 DEFINE_THISCALL_WRAPPER(ios_base_good, 4)
4733 MSVCP_bool __thiscall ios_base_good(const ios_base *this)
4734 {
4735     TRACE("(%p)\n", this);
4736     return this->state == IOSTATE_goodbit;
4737 }
4738
4739 /* ?imbue@ios_base@std@@QAE?AVlocale@2@ABV32@@Z */
4740 /* ?imbue@ios_base@std@@QEAA?AVlocale@2@AEBV32@@Z */
4741 DEFINE_THISCALL_WRAPPER(ios_base_imbue, 12)
4742 locale* __thiscall ios_base_imbue(ios_base *this, locale *ret, const locale *loc)
4743 {
4744     TRACE("(%p %p)\n", this, loc);
4745     *ret = *this->loc;
4746     locale_copy_ctor(this->loc, loc);
4747     return ret;
4748 }
4749
4750 /* ?precision@ios_base@std@@QAEHH@Z */
4751 /* ?precision@ios_base@std@@QEAA_J_J@Z */
4752 DEFINE_THISCALL_WRAPPER(ios_base_precision_set, 8)
4753 streamsize __thiscall ios_base_precision_set(ios_base *this, streamsize precision)
4754 {
4755     streamsize ret = this->prec;
4756
4757     TRACE("(%p %ld)\n", this, precision);
4758
4759     this->prec = precision;
4760     return ret;
4761 }
4762
4763 /* ?precision@ios_base@std@@QBEHXZ */
4764 /* ?precision@ios_base@std@@QEBA_JXZ */
4765 DEFINE_THISCALL_WRAPPER(ios_base_precision_get, 4)
4766 streamsize __thiscall ios_base_precision_get(const ios_base *this)
4767 {
4768     TRACE("(%p)\n", this);
4769     return this->prec;
4770 }
4771
4772 /* ?rdstate@ios_base@std@@QBEHXZ */
4773 /* ?rdstate@ios_base@std@@QEBAHXZ */
4774 DEFINE_THISCALL_WRAPPER(ios_base_rdstate, 4)
4775 IOSB_iostate __thiscall ios_base_rdstate(const ios_base *this)
4776 {
4777     TRACE("(%p)\n", this);
4778     return this->state;
4779 }
4780
4781 /* ?setf@ios_base@std@@QAEHHH@Z */
4782 /* ?setf@ios_base@std@@QEAAHHH@Z */
4783 DEFINE_THISCALL_WRAPPER(ios_base_setf_mask, 12)
4784 IOSB_fmtflags __thiscall ios_base_setf_mask(ios_base *this, IOSB_fmtflags flags, IOSB_fmtflags mask)
4785 {
4786     IOSB_fmtflags ret = this->fmtfl;
4787
4788     TRACE("(%p %x %x)\n", this, flags, mask);
4789
4790     this->fmtfl = (this->fmtfl & (~mask)) | (flags & mask & FMTFLAG_mask);
4791     return ret;
4792 }
4793
4794 /* ?setf@ios_base@std@@QAEHH@Z */
4795 /* ?setf@ios_base@std@@QEAAHH@Z */
4796 DEFINE_THISCALL_WRAPPER(ios_base_setf, 8)
4797 IOSB_fmtflags __thiscall ios_base_setf(ios_base *this, IOSB_fmtflags flags)
4798 {
4799     return ios_base_setf_mask(this, flags, ~0);
4800 }
4801
4802 /* ?setstate@ios_base@std@@QAEXH_N@Z */
4803 /* ?setstate@ios_base@std@@QEAAXH_N@Z */
4804 DEFINE_THISCALL_WRAPPER(ios_base_setstate_reraise, 12)
4805 void __thiscall ios_base_setstate_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
4806 {
4807     TRACE("(%p %x %x)\n", this, state, reraise);
4808
4809     if(state != IOSTATE_goodbit)
4810         ios_base_clear_reraise(this, this->state | state, reraise);
4811 }
4812
4813 /* ?setstate@ios_base@std@@QAEXH@Z */
4814 /* ?setstate@ios_base@std@@QEAAXH@Z */
4815 DEFINE_THISCALL_WRAPPER(ios_base_setstate, 8)
4816 void __thiscall ios_base_setstate(ios_base *this, IOSB_iostate state)
4817 {
4818     ios_base_setstate_reraise(this, state, FALSE);
4819 }
4820
4821 /* ?setstate@ios_base@std@@QAEXI@Z */
4822 /* ?setstate@ios_base@std@@QEAAXI@Z */
4823 DEFINE_THISCALL_WRAPPER(ios_base_setstate_unsigned, 8)
4824 void __thiscall ios_base_setstate_unsigned(ios_base *this, unsigned int state)
4825 {
4826     ios_base_setstate_reraise(this, (IOSB_iostate)state, FALSE);
4827 }
4828
4829 /* ?sync_with_stdio@ios_base@std@@SA_N_N@Z */
4830 MSVCP_bool CDECL ios_base_sync_with_stdio(MSVCP_bool sync)
4831 {
4832     _Lockit lock;
4833     MSVCP_bool ret;
4834
4835     TRACE("(%x)\n", sync);
4836
4837     _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
4838     ret = ios_base_Sync;
4839     ios_base_Sync = sync;
4840     _Lockit_dtor(&lock);
4841     return ret;
4842 }
4843
4844 /* ?unsetf@ios_base@std@@QAEXH@Z */
4845 /* ?unsetf@ios_base@std@@QEAAXH@Z */
4846 DEFINE_THISCALL_WRAPPER(ios_base_unsetf, 8)
4847 void __thiscall ios_base_unsetf(ios_base *this, IOSB_fmtflags flags)
4848 {
4849     TRACE("(%p %x)\n", this, flags);
4850     this->fmtfl &= ~flags;
4851 }
4852
4853 /* ?width@ios_base@std@@QAEHH@Z */
4854 /* ?width@ios_base@std@@QEAA_J_J@Z */
4855 DEFINE_THISCALL_WRAPPER(ios_base_width_set, 8)
4856 streamsize __thiscall ios_base_width_set(ios_base *this, streamsize width)
4857 {
4858     streamsize ret = this->wide;
4859
4860     TRACE("(%p %ld)\n", this, width);
4861
4862     this->wide = width;
4863     return ret;
4864 }
4865
4866 /* ?width@ios_base@std@@QBEHXZ */
4867 /* ?width@ios_base@std@@QEBA_JXZ */
4868 DEFINE_THISCALL_WRAPPER(ios_base_width_get, 4)
4869 streamsize __thiscall ios_base_width_get(ios_base *this)
4870 {
4871     TRACE("(%p)\n", this);
4872     return this->wide;
4873 }
4874
4875 /* ?xalloc@ios_base@std@@SAHXZ */
4876 int CDECL ios_base_xalloc(void)
4877 {
4878     _Lockit lock;
4879     int ret;
4880
4881     TRACE("\n");
4882
4883     _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
4884     ret = ios_base_Index++;
4885     _Lockit_dtor(&lock);
4886     return ret;
4887 }
4888
4889 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ */
4890 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IEAA@XZ */
4891 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor, 4)
4892 basic_ios_char* __thiscall basic_ios_char_ctor(basic_ios_char *this)
4893 {
4894     TRACE("(%p)\n", this);
4895
4896     ios_base_ctor(&this->base);
4897     this->base.vtable = &MSVCP_basic_ios_char_vtable;
4898     return this;
4899 }
4900
4901 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IAEXPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
4902 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
4903 DEFINE_THISCALL_WRAPPER(basic_ios_char_init, 12)
4904 void __thiscall basic_ios_char_init(basic_ios_char *this, basic_streambuf_char *streambuf, MSVCP_bool isstd)
4905 {
4906     TRACE("(%p %p %x)\n", this, streambuf, isstd);
4907     ios_base__Init(&this->base);
4908     this->strbuf = streambuf;
4909     this->stream = NULL;
4910     this->fillch = ' ';
4911
4912     if(!streambuf)
4913         ios_base_setstate(&this->base, IOSTATE_badbit);
4914
4915     if(isstd)
4916         FIXME("standard streams not handled yet\n");
4917 }
4918
4919 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4920 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4921 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor_streambuf, 8)
4922 basic_ios_char* __thiscall basic_ios_char_ctor_streambuf(basic_ios_char *this, basic_streambuf_char *strbuf)
4923 {
4924     TRACE("(%p %p)\n", this, strbuf);
4925
4926     basic_ios_char_ctor(this);
4927     basic_ios_char_init(this, strbuf, FALSE);
4928     return this;
4929 }
4930
4931 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ */
4932 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ */
4933 DEFINE_THISCALL_WRAPPER(basic_ios_char_dtor, 4)
4934 void __thiscall basic_ios_char_dtor(basic_ios_char *this)
4935 {
4936     TRACE("(%p)\n", this);
4937     ios_base_dtor(&this->base);
4938 }
4939
4940 DEFINE_THISCALL_WRAPPER(basic_ios_char_vector_dtor, 8)
4941 basic_ios_char* __thiscall basic_ios_char_vector_dtor(basic_ios_char *this, unsigned int flags)
4942 {
4943     TRACE("(%p %x)\n", this, flags);
4944     if(flags & 2) {
4945         /* we have an array, with the number of elements stored before the first object */
4946         INT_PTR i, *ptr = (INT_PTR *)this-1;
4947
4948         for(i=*ptr-1; i>=0; i--)
4949             basic_ios_char_dtor(this+i);
4950         MSVCRT_operator_delete(ptr);
4951     } else {
4952         basic_ios_char_dtor(this);
4953         if(flags & 1)
4954             MSVCRT_operator_delete(this);
4955     }
4956
4957     return this;
4958 }
4959
4960 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
4961 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
4962 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear_reraise, 12)
4963 void __thiscall basic_ios_char_clear_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
4964 {
4965     TRACE("(%p %x %x)\n", this, state, reraise);
4966     ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
4967 }
4968
4969 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
4970 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
4971 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear, 8)
4972 void __thiscall basic_ios_char_clear(basic_ios_char *this, unsigned int state)
4973 {
4974     basic_ios_char_clear_reraise(this, (IOSB_iostate)state, FALSE);
4975 }
4976
4977 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEAAV12@ABV12@@Z */
4978 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEBV12@@Z */
4979 DEFINE_THISCALL_WRAPPER(basic_ios_char_copyfmt, 8)
4980 basic_ios_char* __thiscall basic_ios_char_copyfmt(basic_ios_char *this, basic_ios_char *copy)
4981 {
4982     TRACE("(%p %p)\n", this, copy);
4983     if(this == copy)
4984         return this;
4985
4986     this->stream = copy->stream;
4987     this->fillch = copy->fillch;
4988     ios_base_copyfmt(&this->base, &copy->base);
4989     return this;
4990 }
4991
4992 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEDD@Z */
4993 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAADD@Z */
4994 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_set, 8)
4995 char __thiscall basic_ios_char_fill_set(basic_ios_char *this, char fill)
4996 {
4997     char ret = this->fillch;
4998
4999     TRACE("(%p %c)\n", this, fill);
5000
5001     this->fillch = fill;
5002     return ret;
5003 }
5004
5005 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ */
5006 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADXZ */
5007 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_get, 4)
5008 char __thiscall basic_ios_char_fill_get(basic_ios_char *this)
5009 {
5010     TRACE("(%p)\n", this);
5011     return this->fillch;
5012 }
5013
5014 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5015 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5016 DEFINE_THISCALL_WRAPPER(basic_ios_char_imbue, 12)
5017 locale *__thiscall basic_ios_char_imbue(basic_ios_char *this, locale *ret, const locale *loc)
5018 {
5019     TRACE("(%p %p %p)\n", this, ret, loc);
5020
5021     if(this->strbuf) {
5022         basic_streambuf_char_pubimbue(this->strbuf, ret, loc);
5023         locale_dtor(ret);
5024     }
5025
5026     return ios_base_imbue(&this->base, ret, loc);
5027 }
5028
5029 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDDD@Z */
5030 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADDD@Z */
5031 DEFINE_THISCALL_WRAPPER(basic_ios_char_narrow, 12)
5032 char __thiscall basic_ios_char_narrow(basic_ios_char *this, char ch, char def)
5033 {
5034     TRACE("(%p %c %c)\n", this, ch, def);
5035     return ctype_char_narrow_ch(ctype_char_use_facet(this->strbuf->loc), ch, def);
5036 }
5037
5038 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PAV32@@Z */
5039 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAV32@@Z */
5040 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_set, 8)
5041 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_set(basic_ios_char *this, basic_streambuf_char *streambuf)
5042 {
5043     basic_streambuf_char *ret = this->strbuf;
5044
5045     TRACE("(%p %p)\n", this, streambuf);
5046
5047     this->strbuf = streambuf;
5048     basic_ios_char_clear(this, IOSTATE_goodbit);
5049     return ret;
5050 }
5051
5052 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
5053 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
5054 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_get, 4)
5055 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_get(const basic_ios_char *this)
5056 {
5057     TRACE("(%p)\n", this);
5058     return this->strbuf;
5059 }
5060
5061 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
5062 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
5063 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate_reraise, 12)
5064 void __thiscall basic_ios_char_setstate_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
5065 {
5066     TRACE("(%p %x %x)\n", this, state, reraise);
5067
5068     if(state != IOSTATE_goodbit)
5069         basic_ios_char_clear_reraise(this, this->base.state | state, reraise);
5070 }
5071
5072 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
5073 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
5074 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate, 8)
5075 void __thiscall basic_ios_char_setstate(basic_ios_char *this, unsigned int state)
5076 {
5077     basic_ios_char_setstate_reraise(this, (IOSB_iostate)state, FALSE);
5078 }
5079
5080 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@PAV32@@Z */
5081 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@PEAV32@@Z */
5082 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_set, 8)
5083 basic_ostream_char* __thiscall basic_ios_char_tie_set(basic_ios_char *this, basic_ostream_char *ostream)
5084 {
5085     basic_ostream_char *ret = this->stream;
5086
5087     TRACE("(%p %p)\n", this, ostream);
5088
5089     this->stream = ostream;
5090     return ret;
5091 }
5092
5093 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
5094 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
5095 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_get, 4)
5096 basic_ostream_char* __thiscall basic_ios_char_tie_get(const basic_ios_char *this)
5097 {
5098     TRACE("(%p)\n", this);
5099     return this->stream;
5100 }
5101
5102 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDD@Z */
5103 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADD@Z */
5104 DEFINE_THISCALL_WRAPPER(basic_ios_char_widen, 8)
5105 char __thiscall basic_ios_char_widen(basic_ios_char *this, char ch)
5106 {
5107     TRACE("(%p %c)\n", this, ch);
5108     return ctype_char_widen_ch(ctype_char_use_facet(this->strbuf->loc), ch);
5109 }
5110
5111
5112 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
5113 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
5114 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor, 4)
5115 basic_ios_wchar* __thiscall basic_ios_wchar_ctor(basic_ios_wchar *this)
5116 {
5117     TRACE("(%p)\n", this);
5118
5119     ios_base_ctor(&this->base);
5120     this->base.vtable = &MSVCP_basic_ios_wchar_vtable;
5121     return this;
5122 }
5123
5124 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IAE@XZ */
5125 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IEAA@XZ */
5126 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor, 4)
5127 basic_ios_wchar* __thiscall basic_ios_short_ctor(basic_ios_wchar *this)
5128 {
5129     basic_ios_wchar_ctor(this);
5130     this->base.vtable = &MSVCP_basic_ios_short_vtable;
5131     return this;
5132 }
5133
5134 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
5135 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
5136 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IAEXPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
5137 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
5138 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_init, 12)
5139 void __thiscall basic_ios_wchar_init(basic_ios_wchar *this, basic_streambuf_wchar *streambuf, MSVCP_bool isstd)
5140 {
5141     TRACE("(%p %p %x)\n", this, streambuf, isstd);
5142     ios_base__Init(&this->base);
5143     this->strbuf = streambuf;
5144     this->stream = NULL;
5145     this->fillch = ' ';
5146
5147     if(!streambuf)
5148         ios_base_setstate(&this->base, IOSTATE_badbit);
5149
5150     if(isstd)
5151         FIXME("standard streams not handled yet\n");
5152 }
5153
5154 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5155 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5156 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor_streambuf, 8)
5157 basic_ios_wchar* __thiscall basic_ios_wchar_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
5158 {
5159     TRACE("(%p %p)\n", this, strbuf);
5160
5161     basic_ios_wchar_ctor(this);
5162     basic_ios_wchar_init(this, strbuf, FALSE);
5163     return this;
5164 }
5165
5166 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5167 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5168 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor_streambuf, 8)
5169 basic_ios_wchar* __thiscall basic_ios_short_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
5170 {
5171     basic_ios_wchar_ctor_streambuf(this, strbuf);
5172     this->base.vtable = &MSVCP_basic_ios_short_vtable;
5173     return this;
5174 }
5175
5176 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
5177 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
5178 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UAE@XZ */
5179 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UEAA@XZ */
5180 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_dtor, 4)
5181 void __thiscall basic_ios_wchar_dtor(basic_ios_wchar *this)
5182 {
5183     TRACE("(%p)\n", this);
5184     ios_base_dtor(&this->base);
5185 }
5186
5187 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_vector_dtor, 8)
5188 basic_ios_wchar* __thiscall basic_ios_wchar_vector_dtor(basic_ios_wchar *this, unsigned int flags)
5189 {
5190     TRACE("(%p %x)\n", this, flags);
5191     if(flags & 2) {
5192         /* we have an array, with the number of elements stored before the first object */
5193         INT_PTR i, *ptr = (INT_PTR *)this-1;
5194
5195         for(i=*ptr-1; i>=0; i--)
5196             basic_ios_wchar_dtor(this+i);
5197         MSVCRT_operator_delete(ptr);
5198     } else {
5199         basic_ios_wchar_dtor(this);
5200         if(flags & 1)
5201             MSVCRT_operator_delete(this);
5202     }
5203
5204     return this;
5205 }
5206
5207 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
5208 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
5209 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
5210 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
5211 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear_reraise, 12)
5212 void __thiscall basic_ios_wchar_clear_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
5213 {
5214     TRACE("(%p %x %x)\n", this, state, reraise);
5215     ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
5216 }
5217
5218 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
5219 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
5220 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
5221 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
5222 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear, 8)
5223 void __thiscall basic_ios_wchar_clear(basic_ios_wchar *this, unsigned int state)
5224 {
5225     basic_ios_wchar_clear_reraise(this, (IOSB_iostate)state, FALSE);
5226 }
5227
5228 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEAAV12@ABV12@@Z */
5229 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEBV12@@Z */
5230 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEAAV12@ABV12@@Z */
5231 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEBV12@@Z */
5232 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_copyfmt, 8)
5233 basic_ios_wchar* __thiscall basic_ios_wchar_copyfmt(basic_ios_wchar *this, basic_ios_wchar *copy)
5234 {
5235     TRACE("(%p %p)\n", this, copy);
5236     if(this == copy)
5237         return this;
5238
5239     this->stream = copy->stream;
5240     this->fillch = copy->fillch;
5241     ios_base_copyfmt(&this->base, &copy->base);
5242     return this;
5243 }
5244
5245 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE_W_W@Z */
5246 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA_W_W@Z */
5247 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEGG@Z */
5248 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
5249 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_set, 8)
5250 wchar_t __thiscall basic_ios_wchar_fill_set(basic_ios_wchar *this, wchar_t fill)
5251 {
5252     wchar_t ret = this->fillch;
5253
5254     TRACE("(%p %c)\n", this, fill);
5255
5256     this->fillch = fill;
5257     return ret;
5258 }
5259
5260 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WXZ */
5261 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WXZ */
5262 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGXZ */
5263 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGXZ */
5264 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_get, 4)
5265 wchar_t __thiscall basic_ios_wchar_fill_get(basic_ios_wchar *this)
5266 {
5267     TRACE("(%p)\n", this);
5268     return this->fillch;
5269 }
5270
5271 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5272 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5273 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5274 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5275 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_imbue, 12)
5276 locale *__thiscall basic_ios_wchar_imbue(basic_ios_wchar *this, locale *ret, const locale *loc)
5277 {
5278     TRACE("(%p %p %p)\n", this, ret, loc);
5279
5280     if(this->strbuf) {
5281         basic_streambuf_wchar_pubimbue(this->strbuf, ret, loc);
5282         locale_dtor(ret);
5283     }
5284
5285     return ios_base_imbue(&this->base, ret, loc);
5286 }
5287
5288 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBED_WD@Z */
5289 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAD_WD@Z */
5290 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEDGD@Z */
5291 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBADGD@Z */
5292 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_narrow, 12)
5293 char __thiscall basic_ios_wchar_narrow(basic_ios_wchar *this, wchar_t ch, char def)
5294 {
5295     TRACE("(%p %c %c)\n", this, ch, def);
5296     return ctype_wchar_narrow_ch(ctype_wchar_use_facet(this->strbuf->loc), ch, def);
5297 }
5298
5299 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
5300 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
5301 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAV32@@Z */
5302 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAV32@@Z */
5303 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_set, 8)
5304 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_set(basic_ios_wchar *this, basic_streambuf_wchar *streambuf)
5305 {
5306     basic_streambuf_wchar *ret = this->strbuf;
5307
5308     TRACE("(%p %p)\n", this, streambuf);
5309
5310     this->strbuf = streambuf;
5311     basic_ios_wchar_clear(this, IOSTATE_goodbit);
5312     return ret;
5313 }
5314
5315 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
5316 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
5317 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
5318 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
5319 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_get, 4)
5320 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_get(const basic_ios_wchar *this)
5321 {
5322     TRACE("(%p)\n", this);
5323     return this->strbuf;
5324 }
5325
5326 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
5327 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
5328 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
5329 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
5330 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate_reraise, 12)
5331 void __thiscall basic_ios_wchar_setstate_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
5332 {
5333     TRACE("(%p %x %x)\n", this, state, reraise);
5334
5335     if(state != IOSTATE_goodbit)
5336         basic_ios_wchar_clear_reraise(this, this->base.state | state, reraise);
5337 }
5338
5339 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
5340 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
5341 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
5342 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
5343 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate, 8)
5344 void __thiscall basic_ios_wchar_setstate(basic_ios_wchar *this, IOSB_iostate state)
5345 {
5346     basic_ios_wchar_setstate_reraise(this, state, FALSE);
5347 }
5348
5349 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
5350 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
5351 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@PAV32@@Z */
5352 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@PEAV32@@Z */
5353 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_set, 8)
5354 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_set(basic_ios_wchar *this, basic_ostream_wchar *ostream)
5355 {
5356     basic_ostream_wchar *ret = this->stream;
5357
5358     TRACE("(%p %p)\n", this, ostream);
5359
5360     this->stream = ostream;
5361     return ret;
5362 }
5363
5364 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
5365 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
5366 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
5367 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
5368 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_get, 4)
5369 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_get(const basic_ios_wchar *this)
5370 {
5371     TRACE("(%p)\n", this);
5372     return this->stream;
5373 }
5374
5375 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WD@Z */
5376 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WD@Z */
5377 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGD@Z */
5378 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGD@Z */
5379 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_widen, 8)
5380 wchar_t __thiscall basic_ios_wchar_widen(basic_ios_wchar *this, char ch)
5381 {
5382     TRACE("(%p %c)\n", this, ch);
5383     return ctype_wchar_widen_ch(ctype_wchar_use_facet(this->strbuf->loc), ch);
5384 }
5385
5386 /* Caution: basic_ostream uses virtual inheritance.
5387  * All constructors have additional parameter that says if base class should be initialized.
5388  * Base class needs to be accessed using vbtable.
5389  */
5390 static inline basic_ios_char* basic_ostream_char_get_basic_ios(basic_ostream_char *this)
5391 {
5392     return (basic_ios_char*)((char*)this+this->vbtable[1]);
5393 }
5394
5395 static inline basic_ios_char* basic_ostream_char_to_basic_ios(basic_ostream_char *ptr)
5396 {
5397     return (basic_ios_char*)((char*)ptr+basic_ostream_char_vbtable[1]);
5398 }
5399
5400 static inline basic_ostream_char* basic_ostream_char_from_basic_ios(basic_ios_char *ptr)
5401 {
5402     return (basic_ostream_char*)((char*)ptr-basic_ostream_char_vbtable[1]);
5403 }
5404
5405 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5406 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5407 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor, 16)
5408 basic_ostream_char* __thiscall basic_ostream_char_ctor(basic_ostream_char *this,
5409         basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
5410 {
5411     basic_ios_char *base;
5412
5413     TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
5414
5415     if(virt_init) {
5416         this->vbtable = basic_ostream_char_vbtable;
5417         base = basic_ostream_char_get_basic_ios(this);
5418         basic_ios_char_ctor(base);
5419     }else {
5420         base = basic_ostream_char_get_basic_ios(this);
5421     }
5422
5423     base->base.vtable = &MSVCP_basic_ostream_char_vtable;
5424     basic_ios_char_init(base, strbuf, isstd);
5425     return this;
5426 }
5427
5428 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
5429 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
5430 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor_uninitialized, 16)
5431 basic_ostream_char* __thiscall basic_ostream_char_ctor_uninitialized(basic_ostream_char *this,
5432         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
5433 {
5434     basic_ios_char *base;
5435
5436     TRACE("(%p %d %x)\n", this, uninitialized, addstd);
5437
5438     if(virt_init) {
5439         this->vbtable = basic_ostream_char_vbtable;
5440         base = basic_ostream_char_get_basic_ios(this);
5441         basic_ios_char_ctor(base);
5442     }else {
5443         base = basic_ostream_char_get_basic_ios(this);
5444     }
5445
5446     base->base.vtable = &MSVCP_basic_ostream_char_vtable;
5447     if(addstd)
5448         ios_base_Addstd(&base->base);
5449     return this;
5450 }
5451
5452 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
5453 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
5454 DEFINE_THISCALL_WRAPPER(basic_ostream_char_dtor, 4)
5455 void __thiscall basic_ostream_char_dtor(basic_ios_char *base)
5456 {
5457     basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
5458
5459     /* don't destroy virtual base here */
5460     TRACE("(%p)\n", this);
5461 }
5462
5463 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5464 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5465 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vbase_dtor, 4)
5466 void __thiscall basic_ostream_char_vbase_dtor(basic_ostream_char *this)
5467 {
5468     TRACE("(%p)\n", this);
5469     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(this));
5470     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(this));
5471 }
5472
5473 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vector_dtor, 8)
5474 basic_ostream_char* __thiscall basic_ostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
5475 {
5476     basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
5477
5478     TRACE("(%p %x)\n", this, flags);
5479
5480     if(flags & 2) {
5481         /* we have an array, with the number of elements stored before the first object */
5482         INT_PTR i, *ptr = (INT_PTR *)this-1;
5483
5484         for(i=*ptr-1; i>=0; i--)
5485             basic_ostream_char_vbase_dtor(this+i);
5486         MSVCRT_operator_delete(ptr);
5487     } else {
5488         basic_ostream_char_vbase_dtor(this);
5489         if(flags & 1)
5490             MSVCRT_operator_delete(this);
5491     }
5492
5493     return this;
5494 }
5495
5496 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
5497 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
5498 DEFINE_THISCALL_WRAPPER(basic_ostream_char_flush, 4)
5499 basic_ostream_char* __thiscall basic_ostream_char_flush(basic_ostream_char *this)
5500 {
5501     /* this function is not matching C++ specification */
5502     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5503
5504     TRACE("(%p)\n", this);
5505
5506     if(basic_ios_char_rdbuf_get(base) && ios_base_good(&base->base)
5507             && basic_streambuf_char_pubsync(basic_ios_char_rdbuf_get(base))==-1)
5508         basic_ios_char_setstate(base, IOSTATE_badbit);
5509     return this;
5510 }
5511
5512 /* ?flush@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5513 /* ?flush@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5514 basic_ostream_char* __cdecl flush_ostream_char(basic_ostream_char *ostream)
5515 {
5516     return basic_ostream_char_flush(ostream);
5517 }
5518
5519 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5520 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5521 DEFINE_THISCALL_WRAPPER(basic_ostream_char__Osfx, 4)
5522 void __thiscall basic_ostream_char__Osfx(basic_ostream_char *this)
5523 {
5524     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5525
5526     TRACE("(%p)\n", this);
5527
5528     if(base->base.fmtfl & FMTFLAG_unitbuf)
5529         basic_ostream_char_flush(this);
5530 }
5531
5532 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5533 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5534 DEFINE_THISCALL_WRAPPER(basic_ostream_char_osfx, 4)
5535 void __thiscall basic_ostream_char_osfx(basic_ostream_char *this)
5536 {
5537     TRACE("(%p)\n", this);
5538     basic_ostream_char__Osfx(this);
5539 }
5540
5541 static BOOL basic_ostream_char_sentry_create(basic_ostream_char *ostr)
5542 {
5543     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5544
5545     if(basic_ios_char_rdbuf_get(base))
5546         basic_streambuf_char__Lock(base->strbuf);
5547
5548     if(ios_base_good(&base->base) && base->stream)
5549         basic_ostream_char_flush(base->stream);
5550
5551     return ios_base_good(&base->base);
5552 }
5553
5554 static void basic_ostream_char_sentry_destroy(basic_ostream_char *ostr)
5555 {
5556     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5557
5558     if(ios_base_good(&base->base) && !__uncaught_exception())
5559         basic_ostream_char_osfx(ostr);
5560
5561     if(basic_ios_char_rdbuf_get(base))
5562         basic_streambuf_char__Unlock(base->strbuf);
5563 }
5564
5565 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE_NXZ */
5566 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA_NXZ */
5567 DEFINE_THISCALL_WRAPPER(basic_ostream_char_opfx, 4)
5568 MSVCP_bool __thiscall basic_ostream_char_opfx(basic_ostream_char *this)
5569 {
5570     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5571
5572     TRACE("(%p)\n", this);
5573
5574     if(ios_base_good(&base->base) && base->stream)
5575         basic_ostream_char_flush(base->stream);
5576     return ios_base_good(&base->base);
5577 }
5578
5579 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
5580 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
5581 DEFINE_THISCALL_WRAPPER(basic_ostream_char_put, 8)
5582 basic_ostream_char* __thiscall basic_ostream_char_put(basic_ostream_char *this, char ch)
5583 {
5584     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5585
5586     TRACE("(%p %c)\n", this, ch);
5587
5588     if(!basic_ostream_char_sentry_create(this)
5589             || basic_streambuf_char_sputc(base->strbuf, ch)==EOF) {
5590         basic_ostream_char_sentry_destroy(this);
5591         basic_ios_char_setstate(base, IOSTATE_badbit);
5592         return this;
5593     }
5594
5595     basic_ostream_char_sentry_destroy(this);
5596     return this;
5597 }
5598
5599 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
5600 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
5601 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp, 12)
5602 basic_ostream_char* __thiscall basic_ostream_char_seekp(basic_ostream_char *this, streamoff off, int way)
5603 {
5604     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5605
5606     TRACE("(%p %ld %d)\n", this, off, way);
5607
5608     if(!ios_base_fail(&base->base)) {
5609         fpos_int seek;
5610
5611         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
5612                 &seek, off, way, OPENMODE_out);
5613         if(seek.off==-1 && seek.pos==0 && seek.state==0)
5614             basic_ios_char_setstate(base, IOSTATE_failbit);
5615     }
5616     return this;
5617 }
5618
5619 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
5620 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
5621 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp_fpos, 28)
5622 basic_ostream_char* __thiscall basic_ostream_char_seekp_fpos(basic_ostream_char *this, fpos_int pos)
5623 {
5624     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5625
5626     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
5627
5628     if(!ios_base_fail(&base->base)) {
5629         fpos_int seek;
5630
5631         basic_streambuf_char_pubseekpos(basic_ios_char_rdbuf_get(base),
5632                 &seek, pos, OPENMODE_out);
5633         if(seek.off==-1 && seek.pos==0 && seek.state==0)
5634             basic_ios_char_setstate(base, IOSTATE_failbit);
5635     }
5636     return this;
5637 }
5638
5639 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
5640 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
5641 DEFINE_THISCALL_WRAPPER(basic_ostream_char_tellp, 8)
5642 fpos_int* __thiscall basic_ostream_char_tellp(basic_ostream_char *this, fpos_int *ret)
5643 {
5644     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5645
5646     TRACE("(%p)\n", this);
5647
5648     if(!ios_base_fail(&base->base)) {
5649         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
5650                 ret, 0, SEEKDIR_cur, OPENMODE_out);
5651     }else {
5652         ret->off = -1;
5653         ret->pos = 0;
5654         ret->state = 0;
5655     }
5656     return ret;
5657 }
5658
5659 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@PBDH@Z */
5660 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEBD_J@Z */
5661 DEFINE_THISCALL_WRAPPER(basic_ostream_char_write, 12)
5662 basic_ostream_char* __thiscall basic_ostream_char_write(basic_ostream_char *this, const char *str, streamsize count)
5663 {
5664     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5665
5666     TRACE("(%p %s %ld)\n", this, debugstr_a(str), count);
5667
5668     if(!basic_ostream_char_sentry_create(this)
5669             || basic_streambuf_char_sputn(base->strbuf, str, count)!=count) {
5670         basic_ostream_char_sentry_destroy(this);
5671         basic_ios_char_setstate(base, IOSTATE_badbit);
5672         return this;
5673     }
5674
5675     basic_ostream_char_sentry_destroy(this);
5676     return this;
5677 }
5678
5679 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@F@Z */
5680 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@F@Z */
5681 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_short, 8)
5682 basic_ostream_char* __thiscall basic_ostream_char_print_short(basic_ostream_char *this, short val)
5683 {
5684     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5685     int state = IOSTATE_goodbit;
5686
5687     TRACE("(%p %d)\n", this, val);
5688
5689     if(basic_ostream_char_sentry_create(this)) {
5690         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5691         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5692         ostreambuf_iterator_char dest = {0, strbuf};
5693
5694         num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base),
5695                 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
5696                 ? (LONG)((unsigned short)val) : (LONG)val);
5697     }
5698     basic_ostream_char_sentry_destroy(this);
5699
5700     basic_ios_char_setstate(base, state);
5701     return this;
5702 }
5703
5704 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@G@Z */
5705 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@G@Z */
5706 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ushort, 8)
5707 basic_ostream_char* __thiscall basic_ostream_char_print_ushort(basic_ostream_char *this, unsigned short val)
5708 {
5709     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5710     int state = IOSTATE_goodbit;
5711
5712     TRACE("(%p %u)\n", this, val);
5713
5714     if(basic_ostream_char_sentry_create(this)) {
5715         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5716         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5717         ostreambuf_iterator_char dest = {0, strbuf};
5718
5719         num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5720     }
5721     basic_ostream_char_sentry_destroy(this);
5722
5723     basic_ios_char_setstate(base, state);
5724     return this;
5725 }
5726
5727 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z */
5728 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@H@Z */
5729 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@J@Z */
5730 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@J@Z */
5731 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int, 8)
5732 basic_ostream_char* __thiscall basic_ostream_char_print_int(basic_ostream_char *this, int val)
5733 {
5734     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5735     int state = IOSTATE_goodbit;
5736
5737     TRACE("(%p %d)\n", this, val);
5738
5739     if(basic_ostream_char_sentry_create(this)) {
5740         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5741         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5742         ostreambuf_iterator_char dest = {0, strbuf};
5743
5744         num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5745     }
5746     basic_ostream_char_sentry_destroy(this);
5747
5748     basic_ios_char_setstate(base, state);
5749     return this;
5750 }
5751
5752 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@I@Z */
5753 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@I@Z */
5754 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@K@Z */
5755 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@K@Z */
5756 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint, 8)
5757 basic_ostream_char* __thiscall basic_ostream_char_print_uint(basic_ostream_char *this, unsigned int val)
5758 {
5759     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5760     int state = IOSTATE_goodbit;
5761
5762     TRACE("(%p %u)\n", this, val);
5763
5764     if(basic_ostream_char_sentry_create(this)) {
5765         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5766         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5767         ostreambuf_iterator_char dest = {0, strbuf};
5768
5769         num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5770     }
5771     basic_ostream_char_sentry_destroy(this);
5772
5773     basic_ios_char_setstate(base, state);
5774     return this;
5775 }
5776
5777 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@M@Z */
5778 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@M@Z */
5779 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_float, 8)
5780 basic_ostream_char* __thiscall basic_ostream_char_print_float(basic_ostream_char *this, float val)
5781 {
5782     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5783     int state = IOSTATE_goodbit;
5784
5785     TRACE("(%p %f)\n", this, val);
5786
5787     if(basic_ostream_char_sentry_create(this)) {
5788         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5789         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5790         ostreambuf_iterator_char dest = {0, strbuf};
5791
5792         num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5793     }
5794     basic_ostream_char_sentry_destroy(this);
5795
5796     basic_ios_char_setstate(base, state);
5797     return this;
5798 }
5799
5800 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@N@Z */
5801 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@N@Z */
5802 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_double, 12)
5803 basic_ostream_char* __thiscall basic_ostream_char_print_double(basic_ostream_char *this, double val)
5804 {
5805     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5806     int state = IOSTATE_goodbit;
5807
5808     TRACE("(%p %lf)\n", this, val);
5809
5810     if(basic_ostream_char_sentry_create(this)) {
5811         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5812         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5813         ostreambuf_iterator_char dest = {0, strbuf};
5814
5815         num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5816     }
5817     basic_ostream_char_sentry_destroy(this);
5818
5819     basic_ios_char_setstate(base, state);
5820     return this;
5821 }
5822
5823 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@O@Z */
5824 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@O@Z */
5825 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ldouble, 12)
5826 basic_ostream_char* __thiscall basic_ostream_char_print_ldouble(basic_ostream_char *this, double val)
5827 {
5828     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5829     int state = IOSTATE_goodbit;
5830
5831     TRACE("(%p %lf)\n", this, val);
5832
5833     if(basic_ostream_char_sentry_create(this)) {
5834         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5835         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5836         ostreambuf_iterator_char dest = {0, strbuf};
5837
5838         num_put_char_put_ldouble(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5839     }
5840     basic_ostream_char_sentry_destroy(this);
5841
5842     basic_ios_char_setstate(base, state);
5843     return this;
5844 }
5845
5846 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
5847 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
5848 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_streambuf, 8)
5849 basic_ostream_char* __thiscall basic_ostream_char_print_streambuf(basic_ostream_char *this, basic_streambuf_char *val)
5850 {
5851     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5852     IOSB_iostate state = IOSTATE_badbit;
5853     int c = '\n';
5854
5855     TRACE("(%p %p)\n", this, val);
5856
5857     if(basic_ostream_char_sentry_create(this)) {
5858         for(c = basic_streambuf_char_sgetc(val); c!=EOF;
5859                 c = basic_streambuf_char_snextc(val)) {
5860             state = IOSTATE_goodbit;
5861
5862             if(basic_streambuf_char_sputc(base->strbuf, c) == EOF) {
5863                 state = IOSTATE_badbit;
5864                 break;
5865             }
5866         }
5867     }else {
5868         state = IOSTATE_badbit;
5869     }
5870     basic_ostream_char_sentry_destroy(this);
5871
5872     ios_base_width_set(&base->base, 0);
5873     basic_ios_char_setstate(base, state);
5874     return this;
5875 }
5876
5877 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PBX@Z */
5878 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z */
5879 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ptr, 8)
5880 basic_ostream_char* __thiscall basic_ostream_char_print_ptr(basic_ostream_char *this, const void *val)
5881 {
5882     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5883     int state = IOSTATE_goodbit;
5884
5885     TRACE("(%p %p)\n", this, val);
5886
5887     if(basic_ostream_char_sentry_create(this)) {
5888         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5889         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5890         ostreambuf_iterator_char dest = {0, strbuf};
5891
5892         num_put_char_put_ptr(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5893     }
5894     basic_ostream_char_sentry_destroy(this);
5895
5896     basic_ios_char_setstate(base, state);
5897     return this;
5898 }
5899
5900 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_J@Z */
5901 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_J@Z */
5902 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int64, 12)
5903 basic_ostream_char* __thiscall basic_ostream_char_print_int64(basic_ostream_char *this, __int64 val)
5904 {
5905     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5906     int state = IOSTATE_goodbit;
5907
5908     TRACE("(%p)\n", this);
5909
5910     if(basic_ostream_char_sentry_create(this)) {
5911         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5912         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5913         ostreambuf_iterator_char dest = {0, strbuf};
5914
5915         num_put_char_put_int64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5916     }
5917     basic_ostream_char_sentry_destroy(this);
5918
5919     basic_ios_char_setstate(base, state);
5920     return this;
5921 }
5922
5923 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_K@Z */
5924 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_K@Z */
5925 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint64, 12)
5926 basic_ostream_char* __thiscall basic_ostream_char_print_uint64(basic_ostream_char *this, unsigned __int64 val)
5927 {
5928     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5929     int state = IOSTATE_goodbit;
5930
5931     TRACE("(%p)\n", this);
5932
5933     if(basic_ostream_char_sentry_create(this)) {
5934         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5935         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5936         ostreambuf_iterator_char dest = {0, strbuf};
5937
5938         num_put_char_put_uint64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5939     }
5940     basic_ostream_char_sentry_destroy(this);
5941
5942     basic_ios_char_setstate(base, state);
5943     return this;
5944 }
5945
5946 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_N@Z */
5947 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_N@Z */
5948 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_bool, 8)
5949 basic_ostream_char* __thiscall basic_ostream_char_print_bool(basic_ostream_char *this, MSVCP_bool val)
5950 {
5951     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5952     int state = IOSTATE_goodbit;
5953
5954     TRACE("(%p %x)\n", this, val);
5955
5956     if(basic_ostream_char_sentry_create(this)) {
5957         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5958         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5959         ostreambuf_iterator_char dest = {0, strbuf};
5960
5961         num_put_char_put_bool(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5962     }
5963     basic_ostream_char_sentry_destroy(this);
5964
5965     basic_ios_char_setstate(base, state);
5966     return this;
5967 }
5968
5969 /* ?ends@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5970 /* ?ends@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5971 basic_ostream_char* __cdecl basic_ostream_char_ends(basic_ostream_char *ostr)
5972 {
5973     TRACE("(%p)\n", ostr);
5974
5975     basic_ostream_char_put(ostr, 0);
5976     return ostr;
5977 }
5978
5979 /* ?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5980 /* ?endl@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5981 basic_ostream_char* __cdecl basic_ostream_char_endl(basic_ostream_char *ostr)
5982 {
5983     TRACE("(%p)\n", ostr);
5984
5985     basic_ostream_char_put(ostr, '\n');
5986     basic_ostream_char_flush(ostr);
5987     return ostr;
5988 }
5989
5990 /* $?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
5991 /* ??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
5992 basic_ostream_char* __cdecl basic_ostream_char_print_bstr(basic_ostream_char *ostr, const basic_string_char *str)
5993 {
5994     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5995     IOSB_iostate state = IOSTATE_goodbit;
5996
5997     TRACE("(%p %p)\n", ostr, str);
5998
5999     if(basic_ostream_char_sentry_create(ostr)) {
6000         MSVCP_size_t len = MSVCP_basic_string_char_length(str);
6001         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6002
6003         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6004             for(; pad!=0; pad--) {
6005                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6006                     state = IOSTATE_badbit;
6007                     break;
6008                 }
6009             }
6010         }
6011
6012         if(state == IOSTATE_goodbit) {
6013             if(basic_streambuf_char_sputn(base->strbuf, MSVCP_basic_string_char_c_str(str), len) != len)
6014                     state = IOSTATE_badbit;
6015         }
6016
6017         if(state == IOSTATE_goodbit) {
6018             for(; pad!=0; pad--) {
6019                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6020                     state = IOSTATE_badbit;
6021                     break;
6022                 }
6023             }
6024         }
6025
6026         base->base.wide = 0;
6027     }else {
6028         state = IOSTATE_badbit;
6029     }
6030     basic_ostream_char_sentry_destroy(ostr);
6031
6032     basic_ios_char_setstate(base, state);
6033     return ostr;
6034 }
6035
6036 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@C@Z */
6037 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@C@Z */
6038 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@D@Z */
6039 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z */
6040 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@E@Z */
6041 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@E@Z */
6042 basic_ostream_char* __cdecl basic_ostream_char_print_ch(basic_ostream_char *ostr, char ch)
6043 {
6044     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
6045     IOSB_iostate state = IOSTATE_goodbit;
6046
6047     TRACE("(%p %d)\n", ostr, ch);
6048
6049     if(basic_ostream_char_sentry_create(ostr)) {
6050         streamsize pad = (base->base.wide>1 ? base->base.wide-1 : 0);
6051
6052         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6053             for(; pad!=0; pad--) {
6054                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6055                     state = IOSTATE_badbit;
6056                     break;
6057                 }
6058             }
6059         }
6060
6061         if(state == IOSTATE_goodbit) {
6062             if(basic_streambuf_char_sputc(base->strbuf, ch) == EOF)
6063                 state = IOSTATE_badbit;
6064         }
6065
6066         if(state == IOSTATE_goodbit) {
6067             for(; pad!=0; pad--) {
6068                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6069                     state = IOSTATE_badbit;
6070                     break;
6071                 }
6072             }
6073         }
6074
6075         base->base.wide = 0;
6076     }else {
6077         state = IOSTATE_badbit;
6078     }
6079     basic_ostream_char_sentry_destroy(ostr);
6080
6081     basic_ios_char_setstate(base, state);
6082     return ostr;
6083 }
6084
6085 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBC@Z */
6086 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBC@Z */
6087 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z */
6088 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z */
6089 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBE@Z */
6090 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBE@Z */
6091 basic_ostream_char* __cdecl basic_ostream_char_print_str(basic_ostream_char *ostr, const char *str)
6092 {
6093     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
6094     IOSB_iostate state = IOSTATE_goodbit;
6095
6096     TRACE("(%p %s)\n", ostr, str);
6097
6098     if(basic_ostream_char_sentry_create(ostr)) {
6099         MSVCP_size_t len = strlen(str);
6100         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6101
6102         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6103             for(; pad!=0; pad--) {
6104                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6105                     state = IOSTATE_badbit;
6106                     break;
6107                 }
6108             }
6109         }
6110
6111         if(state == IOSTATE_goodbit) {
6112             if(basic_streambuf_char_sputn(base->strbuf, str, len) != len)
6113                 state = IOSTATE_badbit;
6114         }
6115
6116         if(state == IOSTATE_goodbit) {
6117             for(; pad!=0; pad--) {
6118                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6119                     state = IOSTATE_badbit;
6120                     break;
6121                 }
6122             }
6123         }
6124
6125         base->base.wide = 0;
6126     }else {
6127         state = IOSTATE_badbit;
6128     }
6129     basic_ostream_char_sentry_destroy(ostr);
6130
6131     basic_ios_char_setstate(base, state);
6132     return ostr;
6133 }
6134
6135 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
6136 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
6137 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func, 8)
6138 basic_ostream_char* __thiscall basic_ostream_char_print_func(basic_ostream_char *this,
6139         basic_ostream_char* (__cdecl *pfunc)(basic_ostream_char*))
6140 {
6141     TRACE("(%p %p)\n", this, pfunc);
6142     pfunc(this);
6143     return this;
6144 }
6145
6146 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
6147 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
6148 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_basic_ios, 8)
6149 basic_ostream_char* __thiscall basic_ostream_char_print_func_basic_ios(basic_ostream_char *this,
6150         basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
6151 {
6152     TRACE("(%p %p)\n", this, pfunc);
6153     pfunc(basic_ostream_char_get_basic_ios(this));
6154     return this;
6155 }
6156
6157 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
6158 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
6159 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_ios_base, 8)
6160 basic_ostream_char* __thiscall basic_ostream_char_print_func_ios_base(
6161         basic_ostream_char *this, ios_base* (__cdecl *pfunc)(ios_base*))
6162 {
6163     TRACE("(%p %p)\n", this, pfunc);
6164     pfunc(&basic_ostream_char_get_basic_ios(this)->base);
6165     return this;
6166 }
6167
6168 /* Caution: basic_ostream uses virtual inheritance. */
6169 static inline basic_ios_wchar* basic_ostream_wchar_get_basic_ios(basic_ostream_wchar *this)
6170 {
6171     return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
6172 }
6173
6174 static inline basic_ios_wchar* basic_ostream_wchar_to_basic_ios(basic_ostream_wchar *ptr)
6175 {
6176     return (basic_ios_wchar*)((char*)ptr+basic_ostream_wchar_vbtable[1]);
6177 }
6178
6179 static inline basic_ostream_wchar* basic_ostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
6180 {
6181     return (basic_ostream_wchar*)((char*)ptr-basic_ostream_wchar_vbtable[1]);
6182 }
6183
6184 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6185 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6186 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor, 16)
6187 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor(basic_ostream_wchar *this,
6188         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6189 {
6190     basic_ios_wchar *base;
6191
6192     TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
6193
6194     if(virt_init) {
6195         this->vbtable = basic_ostream_wchar_vbtable;
6196         base = basic_ostream_wchar_get_basic_ios(this);
6197         basic_ios_wchar_ctor(base);
6198     }else {
6199         base = basic_ostream_wchar_get_basic_ios(this);
6200     }
6201
6202     base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
6203     basic_ios_wchar_init(base, strbuf, isstd);
6204     return this;
6205 }
6206
6207 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6208 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6209 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor, 16)
6210 basic_ostream_wchar* __thiscall basic_ostream_short_ctor(basic_ostream_wchar *this,
6211         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6212 {
6213     basic_ostream_wchar_ctor(this, strbuf, isstd, virt_init);
6214     basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
6215     return this;
6216 }
6217
6218 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
6219 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
6220 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor_uninitialized, 16)
6221 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor_uninitialized(basic_ostream_wchar *this,
6222         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
6223 {
6224     basic_ios_wchar *base;
6225
6226     TRACE("(%p %d %x)\n", this, uninitialized, addstd);
6227
6228     if(virt_init) {
6229         this->vbtable = basic_ostream_wchar_vbtable;
6230         base = basic_ostream_wchar_get_basic_ios(this);
6231         basic_ios_wchar_ctor(base);
6232     }else {
6233         base = basic_ostream_wchar_get_basic_ios(this);
6234     }
6235
6236     base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
6237     if(addstd)
6238         ios_base_Addstd(&base->base);
6239     return this;
6240 }
6241
6242 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
6243 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
6244 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor_uninitialized, 16)
6245 basic_ostream_wchar* __thiscall basic_ostream_short_ctor_uninitialized(basic_ostream_wchar *this,
6246         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
6247 {
6248     basic_ostream_wchar_ctor_uninitialized(this, uninitialized, addstd, virt_init);
6249     basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
6250     return this;
6251 }
6252
6253 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
6254 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
6255 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
6256 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
6257 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_dtor, 4)
6258 void __thiscall basic_ostream_wchar_dtor(basic_ios_wchar *base)
6259 {
6260     basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
6261
6262     /* don't destroy virtual base here */
6263     TRACE("(%p)\n", this);
6264 }
6265
6266 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6267 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6268 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6269 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6270 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vbase_dtor, 4)
6271 void __thiscall basic_ostream_wchar_vbase_dtor(basic_ostream_wchar *this)
6272 {
6273     TRACE("(%p)\n", this);
6274     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(this));
6275     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(this));
6276 }
6277
6278 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vector_dtor, 8)
6279 basic_ostream_wchar* __thiscall basic_ostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
6280 {
6281     basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
6282
6283     TRACE("(%p %x)\n", this, flags);
6284
6285     if(flags & 2) {
6286         /* we have an array, with the number of elements stored before the first object */
6287         INT_PTR i, *ptr = (INT_PTR *)this-1;
6288
6289         for(i=*ptr-1; i>=0; i--)
6290             basic_ostream_wchar_vbase_dtor(this+i);
6291         MSVCRT_operator_delete(ptr);
6292     } else {
6293         basic_ostream_wchar_vbase_dtor(this);
6294         if(flags & 1)
6295             MSVCRT_operator_delete(this);
6296     }
6297
6298     return this;
6299 }
6300
6301 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
6302 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
6303 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
6304 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
6305 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_flush, 4)
6306 basic_ostream_wchar* __thiscall basic_ostream_wchar_flush(basic_ostream_wchar *this)
6307 {
6308     /* this function is not matching C++ specification */
6309     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6310
6311     TRACE("(%p)\n", this);
6312
6313     if(basic_ios_wchar_rdbuf_get(base) && ios_base_good(&base->base)
6314             && basic_streambuf_wchar_pubsync(basic_ios_wchar_rdbuf_get(base))==-1)
6315         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6316     return this;
6317 }
6318
6319 /* ?flush@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6320 /* ?flush@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6321 /* ?flush@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6322 /* ?flush@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6323 basic_ostream_wchar* __cdecl flush_ostream_wchar(basic_ostream_wchar *ostream)
6324 {
6325     return basic_ostream_wchar_flush(ostream);
6326 }
6327
6328 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6329 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6330 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6331 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6332 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar__Osfx, 4)
6333 void __thiscall basic_ostream_wchar__Osfx(basic_ostream_wchar *this)
6334 {
6335     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6336
6337     TRACE("(%p)\n", this);
6338
6339     if(base->base.fmtfl & FMTFLAG_unitbuf)
6340         basic_ostream_wchar_flush(this);
6341 }
6342
6343 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6344 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6345 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6346 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6347 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_osfx, 4)
6348 void __thiscall basic_ostream_wchar_osfx(basic_ostream_wchar *this)
6349 {
6350     TRACE("(%p)\n", this);
6351     basic_ostream_wchar__Osfx(this);
6352 }
6353
6354 static BOOL basic_ostream_wchar_sentry_create(basic_ostream_wchar *ostr)
6355 {
6356     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6357
6358     if(basic_ios_wchar_rdbuf_get(base))
6359         basic_streambuf_wchar__Lock(base->strbuf);
6360
6361     if(ios_base_good(&base->base) && base->stream)
6362         basic_ostream_wchar_flush(base->stream);
6363
6364     return ios_base_good(&base->base);
6365 }
6366
6367 static void basic_ostream_wchar_sentry_destroy(basic_ostream_wchar *ostr)
6368 {
6369     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6370
6371     if(ios_base_good(&base->base) && !__uncaught_exception())
6372         basic_ostream_wchar_osfx(ostr);
6373
6374     if(basic_ios_wchar_rdbuf_get(base))
6375         basic_streambuf_wchar__Unlock(base->strbuf);
6376 }
6377
6378 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE_NXZ */
6379 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA_NXZ */
6380 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE_NXZ */
6381 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA_NXZ */
6382 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_opfx, 4)
6383 MSVCP_bool __thiscall basic_ostream_wchar_opfx(basic_ostream_wchar *this)
6384 {
6385     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6386
6387     TRACE("(%p)\n", this);
6388
6389     if(ios_base_good(&base->base) && base->stream)
6390         basic_ostream_wchar_flush(base->stream);
6391     return ios_base_good(&base->base);
6392 }
6393
6394 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
6395 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
6396 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
6397 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
6398 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_put, 8)
6399 basic_ostream_wchar* __thiscall basic_ostream_wchar_put(basic_ostream_wchar *this, wchar_t ch)
6400 {
6401     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6402
6403     TRACE("(%p %c)\n", this, ch);
6404
6405     if(!basic_ostream_wchar_sentry_create(this)
6406             || basic_streambuf_wchar_sputc(base->strbuf, ch)==WEOF) {
6407         basic_ostream_wchar_sentry_destroy(this);
6408         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6409         return this;
6410     }
6411
6412     basic_ostream_wchar_sentry_destroy(this);
6413     return this;
6414 }
6415
6416 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
6417 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
6418 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
6419 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
6420 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp, 12)
6421 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp(basic_ostream_wchar *this, streamoff off, int way)
6422 {
6423     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6424
6425     TRACE("(%p %ld %d)\n", this, off, way);
6426
6427     if(!ios_base_fail(&base->base)) {
6428         fpos_int seek;
6429
6430         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
6431                 &seek, off, way, OPENMODE_out);
6432         if(seek.off==-1 && seek.pos==0 && seek.state==0)
6433             basic_ios_wchar_setstate(base, IOSTATE_failbit);
6434     }
6435     return this;
6436 }
6437
6438 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6439 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6440 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6441 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6442 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp_fpos, 28)
6443 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp_fpos(basic_ostream_wchar *this, fpos_int pos)
6444 {
6445     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6446
6447     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
6448
6449     if(!ios_base_fail(&base->base)) {
6450         fpos_int seek;
6451
6452         basic_streambuf_wchar_pubseekpos(basic_ios_wchar_rdbuf_get(base),
6453                 &seek, pos, OPENMODE_out);
6454         if(seek.off==-1 && seek.pos==0 && seek.state==0)
6455             basic_ios_wchar_setstate(base, IOSTATE_failbit);
6456     }
6457     return this;
6458 }
6459
6460 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6461 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6462 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6463 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6464 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_tellp, 8)
6465 fpos_int* __thiscall basic_ostream_wchar_tellp(basic_ostream_wchar *this, fpos_int *ret)
6466 {
6467     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6468
6469     TRACE("(%p)\n", this);
6470
6471     if(!ios_base_fail(&base->base)) {
6472         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
6473                 ret, 0, SEEKDIR_cur, OPENMODE_out);
6474     }else {
6475         ret->off = -1;
6476         ret->pos = 0;
6477         ret->state = 0;
6478     }
6479     return ret;
6480 }
6481
6482 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PB_WH@Z */
6483 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEB_W_J@Z */
6484 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@PBGH@Z */
6485 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEBG_J@Z */
6486 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_write, 12)
6487 basic_ostream_wchar* __thiscall basic_ostream_wchar_write(basic_ostream_wchar *this, const wchar_t *str, streamsize count)
6488 {
6489     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6490
6491     TRACE("(%p %s %ld)\n", this, debugstr_w(str), count);
6492
6493     if(!basic_ostream_wchar_sentry_create(this)
6494             || basic_streambuf_wchar_sputn(base->strbuf, str, count)!=count) {
6495         basic_ostream_wchar_sentry_destroy(this);
6496         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6497         return this;
6498     }
6499
6500     basic_ostream_wchar_sentry_destroy(this);
6501     return this;
6502 }
6503
6504 static basic_ostream_wchar* basic_ostream_print_short(basic_ostream_wchar *this, short val, const num_put *numput)
6505 {
6506     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6507     int state = IOSTATE_goodbit;
6508
6509     TRACE("(%p %d)\n", this, val);
6510
6511     if(basic_ostream_wchar_sentry_create(this)) {
6512         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6513         ostreambuf_iterator_wchar dest = {0, strbuf};
6514
6515         num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base),
6516                 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
6517                 ? (LONG)((unsigned short)val) : (LONG)val);
6518     }
6519     basic_ostream_wchar_sentry_destroy(this);
6520
6521     basic_ios_wchar_setstate(base, state);
6522     return this;
6523 }
6524
6525 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@F@Z */
6526 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@F@Z */
6527 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_short, 8)
6528 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_short(basic_ostream_wchar *this, short val)
6529 {
6530     return basic_ostream_print_short(this, val, num_put_wchar_use_facet(
6531                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6532 }
6533
6534 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@F@Z */
6535 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@F@Z */
6536 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_short, 8)
6537 basic_ostream_wchar* __thiscall basic_ostream_short_print_short(basic_ostream_wchar *this, short val)
6538 {
6539     return basic_ostream_print_short(this, val, num_put_short_use_facet(
6540                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6541 }
6542
6543 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@G@Z */
6544 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@G@Z */
6545 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ushort, 8)
6546 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ushort(basic_ostream_wchar *this, unsigned short val)
6547 {
6548     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6549     int state = IOSTATE_goodbit;
6550
6551     TRACE("(%p %u)\n", this, val);
6552
6553     if(basic_ostream_wchar_sentry_create(this)) {
6554         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6555         const num_put *numput = num_put_wchar_use_facet(strbuf->loc);
6556         ostreambuf_iterator_wchar dest = {0, strbuf};
6557
6558         num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6559     }
6560     basic_ostream_wchar_sentry_destroy(this);
6561
6562     basic_ios_wchar_setstate(base, state);
6563     return this;
6564 }
6565
6566 static basic_ostream_wchar* basic_ostream_print_int(basic_ostream_wchar *this, int val, const num_put *numput)
6567 {
6568     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6569     int state = IOSTATE_goodbit;
6570
6571     TRACE("(%p %d)\n", this, val);
6572
6573     if(basic_ostream_wchar_sentry_create(this)) {
6574         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6575         ostreambuf_iterator_wchar dest = {0, strbuf};
6576
6577         num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6578     }
6579     basic_ostream_wchar_sentry_destroy(this);
6580
6581     basic_ios_wchar_setstate(base, state);
6582     return this;
6583 }
6584
6585 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@H@Z */
6586 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@H@Z */
6587 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@J@Z */
6588 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@J@Z */
6589 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int, 8)
6590 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int(basic_ostream_wchar *this, int val)
6591 {
6592     return basic_ostream_print_int(this, val, num_put_wchar_use_facet(
6593                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6594 }
6595
6596 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@H@Z */
6597 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@H@Z */
6598 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@J@Z */
6599 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@J@Z */
6600 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int, 8)
6601 basic_ostream_wchar* __thiscall basic_ostream_short_print_int(basic_ostream_wchar *this, int val)
6602 {
6603     return basic_ostream_print_int(this, val, num_put_short_use_facet(
6604                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6605 }
6606
6607 static basic_ostream_wchar* basic_ostream_print_uint(basic_ostream_wchar *this, unsigned int val, const num_put *numput)
6608 {
6609     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6610     int state = IOSTATE_goodbit;
6611
6612     TRACE("(%p %u)\n", this, val);
6613
6614     if(basic_ostream_wchar_sentry_create(this)) {
6615         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6616         ostreambuf_iterator_wchar dest = {0, strbuf};
6617
6618         num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6619     }
6620     basic_ostream_wchar_sentry_destroy(this);
6621
6622     basic_ios_wchar_setstate(base, state);
6623     return this;
6624 }
6625
6626 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@I@Z */
6627 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@I@Z */
6628 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@K@Z */
6629 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@K@Z */
6630 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint, 8)
6631 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint(basic_ostream_wchar *this, unsigned int val)
6632 {
6633     return basic_ostream_print_uint(this, val, num_put_wchar_use_facet(
6634                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6635 }
6636
6637 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@I@Z */
6638 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@I@Z */
6639 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@K@Z */
6640 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@K@Z */
6641 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint, 8)
6642 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint(basic_ostream_wchar *this, unsigned int val)
6643 {
6644     return basic_ostream_print_uint(this, val, num_put_short_use_facet(
6645                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6646 }
6647
6648 static basic_ostream_wchar* basic_ostream_print_float(basic_ostream_wchar *this, float val, const num_put *numput)
6649 {
6650     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6651     int state = IOSTATE_goodbit;
6652
6653     TRACE("(%p %f)\n", this, val);
6654
6655     if(basic_ostream_wchar_sentry_create(this)) {
6656         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6657         ostreambuf_iterator_wchar dest = {0, strbuf};
6658
6659         num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6660     }
6661     basic_ostream_wchar_sentry_destroy(this);
6662
6663     basic_ios_wchar_setstate(base, state);
6664     return this;
6665 }
6666
6667 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@M@Z */
6668 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@M@Z */
6669 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_float, 8)
6670 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_float(basic_ostream_wchar *this, float val)
6671 {
6672     return basic_ostream_print_float(this, val, num_put_wchar_use_facet(
6673                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6674 }
6675
6676 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@M@Z */
6677 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@M@Z */
6678 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_float, 8)
6679 basic_ostream_wchar* __thiscall basic_ostream_short_print_float(basic_ostream_wchar *this, float val)
6680 {
6681     return basic_ostream_print_float(this, val, num_put_short_use_facet(
6682                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6683 }
6684
6685 static basic_ostream_wchar* basic_ostream_print_double(basic_ostream_wchar *this, double val, const num_put *numput)
6686 {
6687     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6688     int state = IOSTATE_goodbit;
6689
6690     TRACE("(%p %lf)\n", this, val);
6691
6692     if(basic_ostream_wchar_sentry_create(this)) {
6693         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6694         ostreambuf_iterator_wchar dest = {0, strbuf};
6695
6696         num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6697     }
6698     basic_ostream_wchar_sentry_destroy(this);
6699
6700     basic_ios_wchar_setstate(base, state);
6701     return this;
6702 }
6703
6704 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@N@Z */
6705 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@N@Z */
6706 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_double, 12)
6707 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_double(basic_ostream_wchar *this, double val)
6708 {
6709     return basic_ostream_print_double(this, val, num_put_wchar_use_facet(
6710                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6711 }
6712
6713 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@N@Z */
6714 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@N@Z */
6715 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_double, 12)
6716 basic_ostream_wchar* __thiscall basic_ostream_short_print_double(basic_ostream_wchar *this, double val)
6717 {
6718     return basic_ostream_print_double(this, val, num_put_short_use_facet(
6719                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6720 }
6721
6722 static basic_ostream_wchar* basic_ostream_print_ldouble(basic_ostream_wchar *this, double val, const num_put *numput)
6723 {
6724     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6725     int state = IOSTATE_goodbit;
6726
6727     TRACE("(%p %lf)\n", this, val);
6728
6729     if(basic_ostream_wchar_sentry_create(this)) {
6730         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6731         ostreambuf_iterator_wchar dest = {0, strbuf};
6732
6733         num_put_wchar_put_ldouble(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6734     }
6735     basic_ostream_wchar_sentry_destroy(this);
6736
6737     basic_ios_wchar_setstate(base, state);
6738     return this;
6739 }
6740
6741 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@O@Z */
6742 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@O@Z */
6743 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ldouble, 12)
6744 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ldouble(basic_ostream_wchar *this, double val)
6745 {
6746     return basic_ostream_print_ldouble(this, val, num_put_wchar_use_facet(
6747                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6748 }
6749
6750 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@O@Z */
6751 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@O@Z */
6752 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ldouble, 12)
6753 basic_ostream_wchar* __thiscall basic_ostream_short_print_ldouble(basic_ostream_wchar *this, double val)
6754 {
6755     return basic_ostream_print_ldouble(this, val, num_put_short_use_facet(
6756                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6757 }
6758
6759 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
6760 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
6761 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
6762 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
6763 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_streambuf, 8)
6764 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_streambuf(basic_ostream_wchar *this, basic_streambuf_wchar *val)
6765 {
6766     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6767     IOSB_iostate state = IOSTATE_badbit;
6768     unsigned short c = '\n';
6769
6770     TRACE("(%p %p)\n", this, val);
6771
6772     if(basic_ostream_wchar_sentry_create(this)) {
6773         for(c = basic_streambuf_wchar_sgetc(val); c!=WEOF;
6774                 c = basic_streambuf_wchar_snextc(val)) {
6775             state = IOSTATE_goodbit;
6776
6777             if(basic_streambuf_wchar_sputc(base->strbuf, c) == WEOF) {
6778                 state = IOSTATE_badbit;
6779                 break;
6780             }
6781         }
6782     }else {
6783         state = IOSTATE_badbit;
6784     }
6785     basic_ostream_wchar_sentry_destroy(this);
6786
6787     ios_base_width_set(&base->base, 0);
6788     basic_ios_wchar_setstate(base, state);
6789     return this;
6790 }
6791
6792 static basic_ostream_wchar* basic_ostream_print_ptr(basic_ostream_wchar *this, const void *val, const num_put *numput)
6793 {
6794     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6795     int state = IOSTATE_goodbit;
6796
6797     TRACE("(%p %p)\n", this, val);
6798
6799     if(basic_ostream_wchar_sentry_create(this)) {
6800         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6801         ostreambuf_iterator_wchar dest = {0, strbuf};
6802
6803         num_put_wchar_put_ptr(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6804     }
6805     basic_ostream_wchar_sentry_destroy(this);
6806
6807     basic_ios_wchar_setstate(base, state);
6808     return this;
6809 }
6810
6811 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PBX@Z */
6812 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEBX@Z */
6813 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ptr, 8)
6814 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ptr(basic_ostream_wchar *this, const void *val)
6815 {
6816     return basic_ostream_print_ptr(this, val, num_put_wchar_use_facet(
6817                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6818 }
6819
6820 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z */
6821 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEBX@Z */
6822 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ptr, 8)
6823 basic_ostream_wchar* __thiscall basic_ostream_short_print_ptr(basic_ostream_wchar *this, const void *val)
6824 {
6825     return basic_ostream_print_ptr(this, val, num_put_short_use_facet(
6826                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6827 }
6828
6829 static basic_ostream_wchar* basic_ostream_print_int64(basic_ostream_wchar *this, __int64 val, const num_put *numput)
6830 {
6831     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6832     int state = IOSTATE_goodbit;
6833
6834     TRACE("(%p)\n", this);
6835
6836     if(basic_ostream_wchar_sentry_create(this)) {
6837         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6838         ostreambuf_iterator_wchar dest = {0, strbuf};
6839
6840         num_put_wchar_put_int64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6841     }
6842     basic_ostream_wchar_sentry_destroy(this);
6843
6844     basic_ios_wchar_setstate(base, state);
6845     return this;
6846 }
6847
6848 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_J@Z */
6849 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_J@Z */
6850 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int64, 12)
6851 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int64(basic_ostream_wchar *this, __int64 val)
6852 {
6853     return basic_ostream_print_int64(this, val, num_put_wchar_use_facet(
6854                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6855 }
6856
6857 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_J@Z */
6858 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_J@Z */
6859 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int64, 12)
6860 basic_ostream_wchar* __thiscall basic_ostream_short_print_int64(basic_ostream_wchar *this, __int64 val)
6861 {
6862     return basic_ostream_print_int64(this, val, num_put_short_use_facet(
6863                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6864 }
6865
6866 static basic_ostream_wchar* basic_ostream_print_uint64(basic_ostream_wchar *this, unsigned __int64 val, const num_put *numput)
6867 {
6868     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6869     int state = IOSTATE_goodbit;
6870
6871     TRACE("(%p)\n", this);
6872
6873     if(basic_ostream_wchar_sentry_create(this)) {
6874         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6875         ostreambuf_iterator_wchar dest = {0, strbuf};
6876
6877         num_put_wchar_put_uint64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6878     }
6879     basic_ostream_wchar_sentry_destroy(this);
6880
6881     basic_ios_wchar_setstate(base, state);
6882     return this;
6883 }
6884
6885 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_K@Z */
6886 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_K@Z */
6887 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint64, 12)
6888 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
6889 {
6890     return basic_ostream_print_uint64(this, val, num_put_wchar_use_facet(
6891                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6892 }
6893
6894 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_K@Z */
6895 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_K@Z */
6896 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint64, 12)
6897 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
6898 {
6899     return basic_ostream_print_uint64(this, val, num_put_short_use_facet(
6900                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6901 }
6902
6903 static basic_ostream_wchar* basic_ostream_print_bool(basic_ostream_wchar *this, MSVCP_bool val, const num_put *numput)
6904 {
6905     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6906     int state = IOSTATE_goodbit;
6907
6908     TRACE("(%p %x)\n", this, val);
6909
6910     if(basic_ostream_wchar_sentry_create(this)) {
6911         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6912         ostreambuf_iterator_wchar dest = {0, strbuf};
6913
6914         num_put_wchar_put_bool(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6915     }
6916     basic_ostream_wchar_sentry_destroy(this);
6917
6918     basic_ios_wchar_setstate(base, state);
6919     return this;
6920 }
6921
6922 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_N@Z */
6923 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_N@Z */
6924 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_bool, 8)
6925 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
6926 {
6927     return basic_ostream_print_bool(this, val, num_put_wchar_use_facet(
6928                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6929 }
6930
6931 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_N@Z */
6932 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_N@Z */
6933 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_bool, 8)
6934 basic_ostream_wchar* __thiscall basic_ostream_short_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
6935 {
6936     return basic_ostream_print_bool(this, val, num_put_short_use_facet(
6937                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6938 }
6939
6940 /* ?ends@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6941 /* ?ends@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6942 /* ?ends@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6943 /* ?ends@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6944 basic_ostream_wchar* __cdecl basic_ostream_wchar_ends(basic_ostream_wchar *ostr)
6945 {
6946     TRACE("(%p)\n", ostr);
6947
6948     basic_ostream_wchar_put(ostr, 0);
6949     return ostr;
6950 }
6951
6952 /* ?endl@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6953 /* ?endl@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6954 /* ?endl@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6955 /* ?endl@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6956 basic_ostream_wchar* __cdecl basic_ostream_wchar_endl(basic_ostream_wchar *ostr)
6957 {
6958     TRACE("(%p)\n", ostr);
6959
6960     basic_ostream_wchar_put(ostr, '\n');
6961     basic_ostream_wchar_flush(ostr);
6962     return ostr;
6963 }
6964
6965 /* ??$?6_WU?$char_traits@_W@std@@V?$allocator@_W@1@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
6966 /* ??$?6_WU?$char_traits@_W@std@@V?$allocator@_W@1@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
6967 /* ??$?6GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
6968 /* ??$?6GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
6969 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_bstr(basic_ostream_wchar *ostr, const basic_string_wchar *str)
6970 {
6971     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6972     IOSB_iostate state = IOSTATE_goodbit;
6973
6974     TRACE("(%p %p)\n", ostr, str);
6975
6976     if(basic_ostream_wchar_sentry_create(ostr)) {
6977         MSVCP_size_t len = MSVCP_basic_string_wchar_length(str);
6978         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6979
6980         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6981             for(; pad!=0; pad--) {
6982                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6983                     state = IOSTATE_badbit;
6984                     break;
6985                 }
6986             }
6987         }
6988
6989         if(state == IOSTATE_goodbit) {
6990             if(basic_streambuf_wchar_sputn(base->strbuf, MSVCP_basic_string_wchar_c_str(str), len) != len)
6991                 state = IOSTATE_badbit;
6992         }
6993
6994         if(state == IOSTATE_goodbit) {
6995             for(; pad!=0; pad--) {
6996                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6997                     state = IOSTATE_badbit;
6998                     break;
6999                 }
7000             }
7001         }
7002
7003         base->base.wide = 0;
7004     }else {
7005         state = IOSTATE_badbit;
7006     }
7007     basic_ostream_wchar_sentry_destroy(ostr);
7008
7009     basic_ios_wchar_setstate(base, state);
7010     return ostr;
7011 }
7012
7013 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@_W@Z */
7014 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@_W@Z */
7015 /* ??$?6GU?$char_traits@G@std@@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@G@Z */
7016 /* ??$?6GU?$char_traits@G@std@@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@G@Z */
7017 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_ch(basic_ostream_wchar *ostr, wchar_t ch)
7018 {
7019     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
7020     IOSB_iostate state = IOSTATE_goodbit;
7021
7022     TRACE("(%p %d)\n", ostr, ch);
7023
7024     if(basic_ostream_wchar_sentry_create(ostr)) {
7025         streamsize pad = (base->base.wide>1 ? base->base.wide-1 : 0);
7026
7027         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7028             for(; pad!=0; pad--) {
7029                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7030                     state = IOSTATE_badbit;
7031                     break;
7032                 }
7033             }
7034         }
7035
7036         if(state == IOSTATE_goodbit) {
7037             if(basic_streambuf_wchar_sputc(base->strbuf, ch) == WEOF)
7038                 state = IOSTATE_badbit;
7039         }
7040
7041         if(state == IOSTATE_goodbit) {
7042             for(; pad!=0; pad--) {
7043                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7044                     state = IOSTATE_badbit;
7045                     break;
7046                 }
7047             }
7048         }
7049
7050         base->base.wide = 0;
7051     }else {
7052         state = IOSTATE_badbit;
7053     }
7054     basic_ostream_wchar_sentry_destroy(ostr);
7055
7056     basic_ios_wchar_setstate(base, state);
7057     return ostr;
7058 }
7059
7060 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@PB_W@Z */
7061 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@PEB_W@Z */
7062 /* ??$?6GU?$char_traits@G@std@@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@PBG@Z */
7063 /* ??$?6GU?$char_traits@G@std@@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@PEBG@Z */
7064 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_str(basic_ostream_wchar *ostr, const wchar_t *str)
7065 {
7066     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
7067     IOSB_iostate state = IOSTATE_goodbit;
7068
7069     TRACE("(%p %s)\n", ostr, debugstr_w(str));
7070
7071     if(basic_ostream_wchar_sentry_create(ostr)) {
7072         MSVCP_size_t len = wcslen(str);
7073         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
7074
7075         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7076             for(; pad!=0; pad--) {
7077                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7078                     state = IOSTATE_badbit;
7079                     break;
7080                 }
7081             }
7082         }
7083
7084         if(state == IOSTATE_goodbit) {
7085             if(basic_streambuf_wchar_sputn(base->strbuf, str, len) != len)
7086                                         state = IOSTATE_badbit;
7087         }
7088
7089         if(state == IOSTATE_goodbit) {
7090             for(; pad!=0; pad--) {
7091                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7092                     state = IOSTATE_badbit;
7093                     break;
7094                 }
7095             }
7096         }
7097
7098         base->base.wide = 0;
7099     }else {
7100         state = IOSTATE_badbit;
7101     }
7102     basic_ostream_wchar_sentry_destroy(ostr);
7103
7104     basic_ios_wchar_setstate(base, state);
7105     return ostr;
7106 }
7107
7108 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7109 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7110 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7111 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7112 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func, 8)
7113 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func(basic_ostream_wchar *this,
7114         basic_ostream_wchar* (__cdecl *pfunc)(basic_ostream_wchar*))
7115 {
7116     TRACE("(%p %p)\n", this, pfunc);
7117     pfunc(this);
7118     return this;
7119 }
7120
7121 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
7122 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
7123 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
7124 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
7125 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_basic_ios, 8)
7126 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_basic_ios(basic_ostream_wchar *this,
7127         basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
7128 {
7129     TRACE("(%p %p)\n", this, pfunc);
7130     pfunc(basic_ostream_wchar_get_basic_ios(this));
7131     return this;
7132 }
7133
7134 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7135 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7136 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7137 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7138 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_ios_base, 8)
7139 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_ios_base(
7140         basic_ostream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
7141 {
7142     TRACE("(%p %p)\n", this, pfunc);
7143     pfunc(&basic_ostream_wchar_get_basic_ios(this)->base);
7144     return this;
7145 }
7146
7147 /* Caution: basic_istream uses virtual inheritance. */
7148 static inline basic_ios_char* basic_istream_char_get_basic_ios(basic_istream_char *this)
7149 {
7150     return (basic_ios_char*)((char*)this+this->vbtable[1]);
7151 }
7152
7153 static inline basic_ios_char* basic_istream_char_to_basic_ios(basic_istream_char *ptr)
7154 {
7155     return (basic_ios_char*)((char*)ptr+basic_istream_char_vbtable[1]);
7156 }
7157
7158 static inline basic_istream_char* basic_istream_char_from_basic_ios(basic_ios_char *ptr)
7159 {
7160     return (basic_istream_char*)((char*)ptr-basic_istream_char_vbtable[1]);
7161 }
7162
7163 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
7164 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
7165 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_init, 20)
7166 basic_istream_char* __thiscall basic_istream_char_ctor_init(basic_istream_char *this, basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
7167 {
7168     basic_ios_char *base;
7169
7170     TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
7171
7172     if(virt_init) {
7173         this->vbtable = basic_istream_char_vbtable;
7174         base = basic_istream_char_get_basic_ios(this);
7175         basic_ios_char_ctor(base);
7176     }else {
7177         base = basic_istream_char_get_basic_ios(this);
7178     }
7179
7180     base->base.vtable = &MSVCP_basic_istream_char_vtable;
7181     this->count = 0;
7182     if(!noinit)
7183         basic_ios_char_init(base, strbuf, isstd);
7184     return this;
7185 }
7186
7187 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
7188 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
7189 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor, 16)
7190 basic_istream_char* __thiscall basic_istream_char_ctor(basic_istream_char *this, basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
7191 {
7192     return basic_istream_char_ctor_init(this, strbuf, isstd, FALSE, virt_init);
7193 }
7194
7195 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
7196 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
7197 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_uninitialized, 12)
7198 basic_istream_char* __thiscall basic_istream_char_ctor_uninitialized(basic_istream_char *this, int uninitialized, MSVCP_bool virt_init)
7199 {
7200     basic_ios_char *base;
7201
7202     TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
7203
7204     if(virt_init) {
7205         this->vbtable = basic_istream_char_vbtable;
7206         base = basic_istream_char_get_basic_ios(this);
7207         basic_ios_char_ctor(base);
7208     }else {
7209         base = basic_istream_char_get_basic_ios(this);
7210     }
7211
7212     base->base.vtable = &MSVCP_basic_istream_char_vtable;
7213     ios_base_Addstd(&base->base);
7214     return this;
7215 }
7216
7217 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UAE@XZ */
7218 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
7219 DEFINE_THISCALL_WRAPPER(basic_istream_char_dtor, 4)
7220 void __thiscall basic_istream_char_dtor(basic_ios_char *base)
7221 {
7222     basic_istream_char *this = basic_istream_char_from_basic_ios(base);
7223
7224     /* don't destroy virtual base here */
7225     TRACE("(%p)\n", this);
7226 }
7227
7228 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7229 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7230 DEFINE_THISCALL_WRAPPER(basic_istream_char_vbase_dtor, 4)
7231 void __thiscall basic_istream_char_vbase_dtor(basic_istream_char *this)
7232 {
7233     TRACE("(%p)\n", this);
7234     basic_istream_char_dtor(basic_istream_char_to_basic_ios(this));
7235     basic_ios_char_dtor(basic_istream_char_get_basic_ios(this));
7236 }
7237
7238 DEFINE_THISCALL_WRAPPER(basic_istream_char_vector_dtor, 8)
7239 basic_istream_char* __thiscall basic_istream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
7240 {
7241     basic_istream_char *this = basic_istream_char_from_basic_ios(base);
7242
7243     TRACE("(%p %x)\n", this, flags);
7244
7245     if(flags & 2) {
7246         /* we have an array, with the number of elements stored before the first object */
7247         INT_PTR i, *ptr = (INT_PTR *)this-1;
7248
7249         for(i=*ptr-1; i>=0; i--)
7250             basic_istream_char_vbase_dtor(this+i);
7251         MSVCRT_operator_delete(ptr);
7252     } else {
7253         basic_istream_char_vbase_dtor(this);
7254         if(flags & 1)
7255             MSVCRT_operator_delete(this);
7256     }
7257
7258     return this;
7259 }
7260
7261 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
7262 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
7263 DEFINE_THISCALL_WRAPPER(basic_istream_char__Ipfx, 8)
7264 MSVCP_bool __thiscall basic_istream_char__Ipfx(basic_istream_char *this, MSVCP_bool noskip)
7265 {
7266     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7267
7268     TRACE("(%p %d)\n", this, noskip);
7269
7270     if(ios_base_good(&base->base)) {
7271         if(basic_ios_char_tie_get(base))
7272             basic_ostream_char_flush(basic_ios_char_tie_get(base));
7273
7274         if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
7275             basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7276             const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
7277             int ch;
7278
7279             for(ch = basic_streambuf_char_sgetc(strbuf); ;
7280                     ch = basic_streambuf_char_snextc(strbuf)) {
7281                 if(ch == EOF) {
7282                     basic_ios_char_setstate(base, IOSTATE_eofbit);
7283                     break;
7284                 }
7285
7286                 if(!ctype_char_is_ch(ctype, _SPACE|_BLANK, ch))
7287                     break;
7288             }
7289         }
7290     }
7291
7292     if(!ios_base_good(&base->base)) {
7293         basic_ios_char_setstate(base, IOSTATE_failbit);
7294         return FALSE;
7295     }
7296
7297     return TRUE;
7298 }
7299
7300 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
7301 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
7302 DEFINE_THISCALL_WRAPPER(basic_istream_char_ipfx, 8)
7303 MSVCP_bool __thiscall basic_istream_char_ipfx(basic_istream_char *this, MSVCP_bool noskip)
7304 {
7305     return basic_istream_char__Ipfx(this, noskip);
7306 }
7307
7308 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7309 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7310 DEFINE_THISCALL_WRAPPER(basic_istream_char_isfx, 4)
7311 void __thiscall basic_istream_char_isfx(basic_istream_char *this)
7312 {
7313     TRACE("(%p)\n", this);
7314 }
7315
7316 static BOOL basic_istream_char_sentry_create(basic_istream_char *istr, MSVCP_bool noskip)
7317 {
7318     basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
7319
7320     if(basic_ios_char_rdbuf_get(base))
7321         basic_streambuf_char__Lock(base->strbuf);
7322
7323     return basic_istream_char_ipfx(istr, noskip);
7324 }
7325
7326 static void basic_istream_char_sentry_destroy(basic_istream_char *istr)
7327 {
7328     basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
7329
7330     if(basic_ios_char_rdbuf_get(base))
7331         basic_streambuf_char__Unlock(base->strbuf);
7332 }
7333
7334 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QBEHXZ */
7335 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QEBA_JXZ */
7336 DEFINE_THISCALL_WRAPPER(basic_istream_char_gcount, 4)
7337 int __thiscall basic_istream_char_gcount(const basic_istream_char *this)
7338 {
7339     TRACE("(%p)\n", this);
7340     return this->count;
7341 }
7342
7343 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7344 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7345 DEFINE_THISCALL_WRAPPER(basic_istream_char_get, 4)
7346 int __thiscall basic_istream_char_get(basic_istream_char *this)
7347 {
7348     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7349     int ret;
7350
7351     TRACE("(%p)\n", this);
7352
7353     this->count = 0;
7354
7355     if(!basic_istream_char_sentry_create(this, TRUE)) {
7356         basic_istream_char_sentry_destroy(this);
7357         return EOF;
7358     }
7359
7360     ret = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(base));
7361     basic_istream_char_sentry_destroy(this);
7362     if(ret == EOF)
7363         basic_ios_char_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
7364     else
7365         this->count++;
7366
7367     return ret;
7368 }
7369
7370 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAD@Z */
7371 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAD@Z */
7372 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_ch, 8)
7373 basic_istream_char* __thiscall basic_istream_char_get_ch(basic_istream_char *this, char *ch)
7374 {
7375     int ret;
7376
7377     TRACE("(%p %p)\n", this, ch);
7378
7379     ret = basic_istream_char_get(this);
7380     if(ret != EOF)
7381         *ch = (char)ret;
7382     return this;
7383 }
7384
7385 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
7386 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
7387 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str_delim, 16)
7388 basic_istream_char* __thiscall basic_istream_char_get_str_delim(basic_istream_char *this, char *str, streamsize count, char delim)
7389 {
7390     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7391     int ch = delim;
7392
7393     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
7394
7395     this->count = 0;
7396
7397     if(basic_istream_char_sentry_create(this, TRUE)) {
7398         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7399
7400         for(ch = basic_streambuf_char_sgetc(strbuf); count>1;
7401                 ch = basic_streambuf_char_snextc(strbuf)) {
7402             if(ch==EOF || ch==delim)
7403                 break;
7404
7405             *str++ = ch;
7406             this->count++;
7407             count--;
7408         }
7409     }
7410     basic_istream_char_sentry_destroy(this);
7411
7412     basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
7413             (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7414     if(count > 0)
7415         *str = 0;
7416     return this;
7417 }
7418
7419 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7420 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7421 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str, 12)
7422 basic_istream_char* __thiscall basic_istream_char_get_str(basic_istream_char *this, char *str, streamsize count)
7423 {
7424     return basic_istream_char_get_str_delim(this, str, count, '\n');
7425 }
7426
7427 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
7428 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
7429 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf_delim, 12)
7430 basic_istream_char* __thiscall basic_istream_char_get_streambuf_delim(basic_istream_char *this, basic_streambuf_char *strbuf, char delim)
7431 {
7432     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7433     int ch = delim;
7434
7435     TRACE("(%p %p %c)\n", this, strbuf, delim);
7436
7437     this->count = 0;
7438
7439     if(basic_istream_char_sentry_create(this, TRUE)) {
7440         basic_streambuf_char *strbuf_read = basic_ios_char_rdbuf_get(base);
7441
7442         for(ch = basic_streambuf_char_sgetc(strbuf_read); ;
7443                 ch = basic_streambuf_char_snextc(strbuf_read)) {
7444             if(ch==EOF || ch==delim)
7445                 break;
7446
7447             if(basic_streambuf_char_sputc(strbuf, ch) == EOF)
7448                 break;
7449             this->count++;
7450         }
7451     }
7452     basic_istream_char_sentry_destroy(this);
7453
7454     basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
7455             (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7456     return this;
7457 }
7458
7459 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
7460 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
7461 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf, 8)
7462 basic_istream_char* __thiscall basic_istream_char_get_streambuf(basic_istream_char *this, basic_streambuf_char *strbuf)
7463 {
7464     return basic_istream_char_get_streambuf_delim(this, strbuf, '\n');
7465 }
7466
7467 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
7468 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
7469 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline_delim, 16)
7470 basic_istream_char* __thiscall basic_istream_char_getline_delim(basic_istream_char *this, char *str, streamsize count, char delim)
7471 {
7472     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7473     int ch = (unsigned char)delim;
7474
7475     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
7476
7477     this->count = 0;
7478
7479     if(basic_istream_char_sentry_create(this, TRUE) && count>0) {
7480         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7481
7482         while(count > 1) {
7483             ch = basic_streambuf_char_sbumpc(strbuf);
7484
7485             if(ch==EOF || ch==(unsigned char)delim)
7486                 break;
7487
7488             *str++ = ch;
7489             this->count++;
7490             count--;
7491         }
7492
7493         if(ch == (unsigned char)delim)
7494             this->count++;
7495         else if(ch != EOF) {
7496             ch = basic_streambuf_char_sgetc(strbuf);
7497
7498             if(ch == (unsigned char)delim) {
7499                 basic_streambuf_char__Gninc(strbuf);
7500                 this->count++;
7501             }
7502         }
7503     }
7504     basic_istream_char_sentry_destroy(this);
7505
7506     basic_ios_char_setstate(base, (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
7507             (!this->count || (ch!=(unsigned char)delim && ch!=EOF) ? IOSTATE_failbit : IOSTATE_goodbit));
7508     if(count > 0)
7509         *str = 0;
7510     return this;
7511 }
7512
7513 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7514 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7515 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline, 12)
7516 basic_istream_char* __thiscall basic_istream_char_getline(basic_istream_char *this, char *str, streamsize count)
7517 {
7518     return basic_istream_char_getline_delim(this, str, count, '\n');
7519 }
7520
7521 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@HH@Z */
7522 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
7523 DEFINE_THISCALL_WRAPPER(basic_istream_char_ignore, 12)
7524 basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *this, streamsize count, int delim)
7525 {
7526     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7527     int ch = (unsigned char)delim;
7528     unsigned int state;
7529
7530     TRACE("(%p %ld %d)\n", this, count, delim);
7531
7532     this->count = 0;
7533
7534     if(basic_istream_char_sentry_create(this, TRUE)) {
7535         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7536         state = IOSTATE_goodbit;
7537
7538         while(count > 0) {
7539             ch = basic_streambuf_char_sbumpc(strbuf);
7540
7541             if(ch==EOF) {
7542                 state = IOSTATE_eofbit;
7543                 break;
7544             }
7545
7546             if(ch==(unsigned char)delim)
7547                 break;
7548
7549             this->count++;
7550             if(count != INT_MAX)
7551                 count--;
7552         }
7553     }else
7554         state = IOSTATE_failbit;
7555     basic_istream_char_sentry_destroy(this);
7556
7557     basic_ios_char_setstate(base, state);
7558     return this;
7559 }
7560
7561 /* ?ws@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@1@AAV21@@Z */
7562 /* ?ws@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
7563 basic_istream_char* __cdecl ws_basic_istream_char(basic_istream_char *istream)
7564 {
7565     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
7566     int ch = '\n';
7567
7568     TRACE("(%p)\n", istream);
7569
7570     if(basic_istream_char_sentry_create(istream, TRUE)) {
7571         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7572         const ctype_char *ctype = ctype_char_use_facet(strbuf->loc);
7573
7574         for(ch = basic_streambuf_char_sgetc(strbuf); ctype_char_is_ch(ctype, _SPACE, ch);
7575                 ch = basic_streambuf_char_snextc(strbuf)) {
7576             if(ch == EOF)
7577                 break;
7578         }
7579     }
7580     basic_istream_char_sentry_destroy(istream);
7581
7582     if(ch == EOF)
7583         basic_ios_char_setstate(base, IOSTATE_eofbit);
7584     return istream;
7585 }
7586
7587 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7588 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7589 DEFINE_THISCALL_WRAPPER(basic_istream_char_peek, 4)
7590 int __thiscall basic_istream_char_peek(basic_istream_char *this)
7591 {
7592     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7593     int ret = EOF;
7594
7595     TRACE("(%p)\n", this);
7596
7597     this->count = 0;
7598
7599     if(basic_istream_char_sentry_create(this, TRUE))
7600         ret = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
7601     basic_istream_char_sentry_destroy(this);
7602
7603     if (ret == EOF)
7604         basic_ios_char_setstate(base, IOSTATE_eofbit);
7605
7606     return ret;
7607 }
7608
7609 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADIH@Z */
7610 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_K_J@Z */
7611 DEFINE_THISCALL_WRAPPER(basic_istream_char__Read_s, 16)
7612 basic_istream_char* __thiscall basic_istream_char__Read_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
7613 {
7614     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7615     IOSB_iostate state = IOSTATE_goodbit;
7616
7617     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
7618
7619     if(basic_istream_char_sentry_create(this, TRUE)) {
7620         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7621
7622         this->count = basic_streambuf_char__Sgetn_s(strbuf, str, size, count);
7623         if(this->count != count)
7624             state |= IOSTATE_failbit | IOSTATE_eofbit;
7625     }else {
7626         this->count = 0;
7627     }
7628     basic_istream_char_sentry_destroy(this);
7629
7630     basic_ios_char_setstate(base, state);
7631     return this;
7632 }
7633
7634 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7635 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7636 DEFINE_THISCALL_WRAPPER(basic_istream_char_read, 12)
7637 basic_istream_char* __thiscall basic_istream_char_read(basic_istream_char *this, char *str, streamsize count)
7638 {
7639     return basic_istream_char__Read_s(this, str, count, count);
7640 }
7641
7642 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
7643 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
7644 DEFINE_THISCALL_WRAPPER(basic_istream_char__Readsome_s, 16)
7645 streamsize __thiscall basic_istream_char__Readsome_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
7646 {
7647     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7648     IOSB_iostate state = IOSTATE_goodbit;
7649
7650     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
7651
7652     this->count = 0;
7653
7654     if(basic_istream_char_sentry_create(this, TRUE)) {
7655         streamsize avail = basic_streambuf_char_in_avail(basic_ios_char_rdbuf_get(base));
7656         if(avail > count)
7657             avail = count;
7658
7659         if(avail == -1)
7660             state |= IOSTATE_eofbit;
7661         else if(avail > 0)
7662             basic_istream_char__Read_s(this, str, size, avail);
7663     }else {
7664         state |= IOSTATE_failbit;
7665     }
7666     basic_istream_char_sentry_destroy(this);
7667
7668     basic_ios_char_setstate(base, state);
7669     return this->count;
7670 }
7671
7672 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
7673 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
7674 DEFINE_THISCALL_WRAPPER(basic_istream_char_readsome, 12)
7675 streamsize __thiscall basic_istream_char_readsome(basic_istream_char *this, char *str, streamsize count)
7676 {
7677     return basic_istream_char__Readsome_s(this, str, count, count);
7678 }
7679
7680 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
7681 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
7682 DEFINE_THISCALL_WRAPPER(basic_istream_char_putback, 8)
7683 basic_istream_char* __thiscall basic_istream_char_putback(basic_istream_char *this, char ch)
7684 {
7685     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7686     IOSB_iostate state = IOSTATE_goodbit;
7687
7688     TRACE("(%p %c)\n", this, ch);
7689
7690     this->count = 0;
7691
7692     if(basic_istream_char_sentry_create(this, TRUE)) {
7693         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7694
7695         if(!ios_base_good(&base->base))
7696             state |= IOSTATE_failbit;
7697         else if(!strbuf || basic_streambuf_char_sputbackc(strbuf, ch)==EOF)
7698             state |= IOSTATE_badbit;
7699     }
7700     basic_istream_char_sentry_destroy(this);
7701
7702     basic_ios_char_setstate(base, state);
7703     return this;
7704 }
7705
7706 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
7707 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
7708 DEFINE_THISCALL_WRAPPER(basic_istream_char_unget, 4)
7709 basic_istream_char* __thiscall basic_istream_char_unget(basic_istream_char *this)
7710 {
7711     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7712     IOSB_iostate state = IOSTATE_goodbit;
7713
7714     TRACE("(%p)\n", this);
7715
7716     this->count = 0;
7717
7718     if(basic_istream_char_sentry_create(this, TRUE)) {
7719         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7720
7721         if(!ios_base_good(&base->base))
7722             state |= IOSTATE_failbit;
7723         else if(!strbuf || basic_streambuf_char_sungetc(strbuf)==EOF)
7724             state |= IOSTATE_badbit;
7725     }
7726     basic_istream_char_sentry_destroy(this);
7727
7728     basic_ios_char_setstate(base, state);
7729     return this;
7730 }
7731
7732 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7733 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7734 DEFINE_THISCALL_WRAPPER(basic_istream_char_sync, 4)
7735 int __thiscall basic_istream_char_sync(basic_istream_char *this)
7736 {
7737     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7738     basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7739
7740     TRACE("(%p)\n", this);
7741
7742     if(!strbuf)
7743         return -1;
7744
7745     if(basic_istream_char_sentry_create(this, TRUE)) {
7746         if(basic_streambuf_char_pubsync(strbuf) != -1) {
7747             basic_istream_char_sentry_destroy(this);
7748             return 0;
7749         }
7750     }
7751     basic_istream_char_sentry_destroy(this);
7752
7753     basic_ios_char_setstate(base, IOSTATE_badbit);
7754     return -1;
7755 }
7756
7757 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
7758 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
7759 DEFINE_THISCALL_WRAPPER(basic_istream_char_tellg, 8)
7760 fpos_int* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpos_int *ret)
7761 {
7762     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7763
7764     TRACE("(%p %p)\n", this, ret);
7765
7766     if(ios_base_fail(&base->base)) {
7767         ret->off = -1;
7768         ret->pos = 0;
7769         ret->state = 0;
7770         return ret;
7771     }
7772
7773     basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
7774             ret, 0, SEEKDIR_cur, OPENMODE_in);
7775
7776     if(ret->off==-1 && ret->pos==0 && ret->state==0)
7777         basic_ios_char_setstate(base, IOSTATE_failbit);
7778
7779     return ret;
7780 }
7781
7782 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
7783 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
7784 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg, 12)
7785 basic_istream_char* __thiscall basic_istream_char_seekg(basic_istream_char *this, streamoff off, int dir)
7786 {
7787     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7788
7789     TRACE("(%p %ld %d)\n", this, off, dir);
7790
7791     if(!ios_base_fail(&base->base)) {
7792         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7793         fpos_int ret;
7794
7795         basic_streambuf_char_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
7796
7797         if(ret.off==-1 && ret.pos==0 && ret.state==0)
7798             basic_ios_char_setstate(base, IOSTATE_failbit);
7799         else
7800             basic_ios_char_clear(base, IOSTATE_goodbit);
7801         return this;
7802     }else
7803         basic_ios_char_clear(base, IOSTATE_goodbit);
7804
7805     return this;
7806 }
7807
7808 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
7809 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
7810 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg_fpos, 28)
7811 basic_istream_char* __thiscall basic_istream_char_seekg_fpos(basic_istream_char *this, fpos_int pos)
7812 {
7813     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7814
7815     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
7816
7817     if(!ios_base_fail(&base->base)) {
7818         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7819         fpos_int ret;
7820
7821         basic_streambuf_char_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
7822
7823         if(ret.off==-1 && ret.pos==0 && ret.state==0)
7824             basic_ios_char_setstate(base, IOSTATE_failbit);
7825         else
7826             basic_ios_char_clear(base, IOSTATE_goodbit);
7827         return this;
7828     }else
7829         basic_ios_char_clear(base, IOSTATE_goodbit);
7830
7831     return this;
7832 }
7833
7834 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAF@Z */
7835 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAF@Z */
7836 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_short, 8)
7837 basic_istream_char* __thiscall basic_istream_char_read_short(basic_istream_char *this, short *v)
7838 {
7839     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7840     int state = IOSTATE_goodbit;
7841
7842     TRACE("(%p %p)\n", this, v);
7843
7844     if(basic_istream_char_sentry_create(this, FALSE)) {
7845         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7846         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7847         istreambuf_iterator_char first={0}, last={0};
7848         LONG tmp;
7849
7850         first.strbuf = strbuf;
7851         num_get_char_get_long(numget, &last, first, last, &base->base, &state, &tmp);
7852
7853         if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
7854             *v = tmp;
7855         else
7856             state |= IOSTATE_failbit;
7857     }
7858     basic_istream_char_sentry_destroy(this);
7859
7860     basic_ios_char_setstate(base, state);
7861     return this;
7862 }
7863
7864 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAG@Z */
7865 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAG@Z */
7866 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ushort, 8)
7867 basic_istream_char* __thiscall basic_istream_char_read_ushort(basic_istream_char *this, unsigned short *v)
7868 {
7869     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7870     int state = IOSTATE_goodbit;
7871
7872     TRACE("(%p %p)\n", this, v);
7873
7874     if(basic_istream_char_sentry_create(this, FALSE)) {
7875         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7876         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7877         istreambuf_iterator_char first={0}, last={0};
7878
7879         first.strbuf = strbuf;
7880         num_get_char_get_ushort(numget, &last, first, last, &base->base, &state, v);
7881     }
7882     basic_istream_char_sentry_destroy(this);
7883
7884     basic_ios_char_setstate(base, state);
7885     return this;
7886 }
7887
7888 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z */
7889 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAH@Z */
7890 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int, 8)
7891 basic_istream_char* __thiscall basic_istream_char_read_int(basic_istream_char *this, int *v)
7892 {
7893     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7894     int state = IOSTATE_goodbit;
7895
7896     TRACE("(%p %p)\n", this, v);
7897
7898     if(basic_istream_char_sentry_create(this, FALSE)) {
7899         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7900         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7901         istreambuf_iterator_char first={0}, last={0};
7902
7903         first.strbuf = strbuf;
7904         num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
7905     }
7906     basic_istream_char_sentry_destroy(this);
7907
7908     basic_ios_char_setstate(base, state);
7909     return this;
7910 }
7911
7912 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAI@Z */
7913 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAI@Z */
7914 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint, 8)
7915 basic_istream_char* __thiscall basic_istream_char_read_uint(basic_istream_char *this, unsigned int *v)
7916 {
7917     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7918     int state = IOSTATE_goodbit;
7919
7920     TRACE("(%p %p)\n", this, v);
7921
7922     if(basic_istream_char_sentry_create(this, FALSE)) {
7923         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7924         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7925         istreambuf_iterator_char first={0}, last={0};
7926
7927         first.strbuf = strbuf;
7928         num_get_char_get_uint(numget, &last, first, last, &base->base, &state, v);
7929     }
7930     basic_istream_char_sentry_destroy(this);
7931
7932     basic_ios_char_setstate(base, state);
7933     return this;
7934 }
7935
7936 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAJ@Z */
7937 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAJ@Z */
7938 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_long, 8)
7939 basic_istream_char* __thiscall basic_istream_char_read_long(basic_istream_char *this, LONG *v)
7940 {
7941     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7942     int state = IOSTATE_goodbit;
7943
7944     TRACE("(%p %p)\n", this, v);
7945
7946     if(basic_istream_char_sentry_create(this, FALSE)) {
7947         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7948         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7949         istreambuf_iterator_char first={0}, last={0};
7950
7951         first.strbuf = strbuf;
7952         num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
7953     }
7954     basic_istream_char_sentry_destroy(this);
7955
7956     basic_ios_char_setstate(base, state);
7957     return this;
7958 }
7959
7960 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAK@Z */
7961 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAK@Z */
7962 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ulong, 8)
7963 basic_istream_char* __thiscall basic_istream_char_read_ulong(basic_istream_char *this, ULONG *v)
7964 {
7965     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7966     int state = IOSTATE_goodbit;
7967
7968     TRACE("(%p %p)\n", this, v);
7969
7970     if(basic_istream_char_sentry_create(this, FALSE)) {
7971         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7972         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7973         istreambuf_iterator_char first={0}, last={0};
7974
7975         first.strbuf = strbuf;
7976         num_get_char_get_ulong(numget, &last, first, last, &base->base, &state, v);
7977     }
7978     basic_istream_char_sentry_destroy(this);
7979
7980     basic_ios_char_setstate(base, state);
7981     return this;
7982 }
7983
7984 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAM@Z */
7985 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAM@Z */
7986 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_float, 8)
7987 basic_istream_char* __thiscall basic_istream_char_read_float(basic_istream_char *this, float *v)
7988 {
7989     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7990     int state = IOSTATE_goodbit;
7991
7992     TRACE("(%p %p)\n", this, v);
7993
7994     if(basic_istream_char_sentry_create(this, FALSE)) {
7995         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7996         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7997         istreambuf_iterator_char first={0}, last={0};
7998
7999         first.strbuf = strbuf;
8000         num_get_char_get_float(numget, &last, first, last, &base->base, &state, v);
8001     }
8002     basic_istream_char_sentry_destroy(this);
8003
8004     basic_ios_char_setstate(base, state);
8005     return this;
8006 }
8007
8008 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAN@Z */
8009 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAN@Z */
8010 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_double, 8)
8011 basic_istream_char* __thiscall basic_istream_char_read_double(basic_istream_char *this, double *v)
8012 {
8013     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8014     int state = IOSTATE_goodbit;
8015
8016     TRACE("(%p %p)\n", this, v);
8017
8018     if(basic_istream_char_sentry_create(this, FALSE)) {
8019         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8020         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8021         istreambuf_iterator_char first={0}, last={0};
8022
8023         first.strbuf = strbuf;
8024         num_get_char_get_double(numget, &last, first, last, &base->base, &state, v);
8025     }
8026     basic_istream_char_sentry_destroy(this);
8027
8028     basic_ios_char_setstate(base, state);
8029     return this;
8030 }
8031
8032 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAO@Z */
8033 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAO@Z */
8034 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ldouble, 8)
8035 basic_istream_char* __thiscall basic_istream_char_read_ldouble(basic_istream_char *this, double *v)
8036 {
8037     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8038     int state = IOSTATE_goodbit;
8039
8040     TRACE("(%p %p)\n", this, v);
8041
8042     if(basic_istream_char_sentry_create(this, FALSE)) {
8043         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8044         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8045         istreambuf_iterator_char first={0}, last={0};
8046
8047         first.strbuf = strbuf;
8048         num_get_char_get_ldouble(numget, &last, first, last, &base->base, &state, v);
8049     }
8050     basic_istream_char_sentry_destroy(this);
8051
8052     basic_ios_char_setstate(base, state);
8053     return this;
8054 }
8055
8056 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAPAX@Z */
8057 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
8058 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ptr, 8)
8059 basic_istream_char* __thiscall basic_istream_char_read_ptr(basic_istream_char *this, void **v)
8060 {
8061     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8062     int state = IOSTATE_goodbit;
8063
8064     TRACE("(%p %p)\n", this, v);
8065
8066     if(basic_istream_char_sentry_create(this, FALSE)) {
8067         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8068         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8069         istreambuf_iterator_char first={0}, last={0};
8070
8071         first.strbuf = strbuf;
8072         num_get_char_get_void(numget, &last, first, last, &base->base, &state, v);
8073     }
8074     basic_istream_char_sentry_destroy(this);
8075
8076     basic_ios_char_setstate(base, state);
8077     return this;
8078 }
8079
8080 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_J@Z */
8081 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_J@Z */
8082 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int64, 8)
8083 basic_istream_char* __thiscall basic_istream_char_read_int64(basic_istream_char *this, __int64 *v)
8084 {
8085     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8086     int state = IOSTATE_goodbit;
8087
8088     TRACE("(%p %p)\n", this, v);
8089
8090     if(basic_istream_char_sentry_create(this, FALSE)) {
8091         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8092         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8093         istreambuf_iterator_char first={0}, last={0};
8094
8095         first.strbuf = strbuf;
8096         num_get_char_get_int64(numget, &last, first, last, &base->base, &state, v);
8097     }
8098     basic_istream_char_sentry_destroy(this);
8099
8100     basic_ios_char_setstate(base, state);
8101     return this;
8102 }
8103
8104 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_K@Z */
8105 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_K@Z */
8106 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint64, 8)
8107 basic_istream_char* __thiscall basic_istream_char_read_uint64(basic_istream_char *this, unsigned __int64 *v)
8108 {
8109     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8110     int state = IOSTATE_goodbit;
8111
8112     TRACE("(%p %p)\n", this, v);
8113
8114     if(basic_istream_char_sentry_create(this, FALSE)) {
8115         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8116         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8117         istreambuf_iterator_char first={0}, last={0};
8118
8119         first.strbuf = strbuf;
8120         num_get_char_get_uint64(numget, &last, first, last, &base->base, &state, v);
8121     }
8122     basic_istream_char_sentry_destroy(this);
8123
8124     basic_ios_char_setstate(base, state);
8125     return this;
8126 }
8127
8128 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_N@Z */
8129 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_N@Z */
8130 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_bool, 8)
8131 basic_istream_char* __thiscall basic_istream_char_read_bool(basic_istream_char *this, MSVCP_bool *v)
8132 {
8133     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8134     int state = IOSTATE_goodbit;
8135
8136     TRACE("(%p %p)\n", this, v);
8137
8138     if(basic_istream_char_sentry_create(this, FALSE)) {
8139         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8140         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8141         istreambuf_iterator_char first={0}, last={0};
8142
8143         first.strbuf = strbuf;
8144         num_get_char_get_bool(numget, &last, first, last, &base->base, &state, v);
8145     }
8146     basic_istream_char_sentry_destroy(this);
8147
8148     basic_ios_char_setstate(base, state);
8149     return this;
8150 }
8151
8152 /* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z */
8153 /* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z */
8154 basic_istream_char* __cdecl basic_istream_char_getline_bstr_delim(
8155         basic_istream_char *istream, basic_string_char *str, char delim)
8156 {
8157     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8158     IOSB_iostate state = IOSTATE_goodbit;
8159     int c = (unsigned char)delim;
8160
8161     TRACE("(%p %p %c)\n", istream, str, delim);
8162
8163     if(basic_istream_char_sentry_create(istream, TRUE)) {
8164         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8165         MSVCP_basic_string_char_clear(str);
8166
8167         c = basic_streambuf_char_sgetc(strbuf);
8168         for(; c!=(unsigned char)delim && c!=EOF; c = basic_streambuf_char_snextc(strbuf))
8169             MSVCP_basic_string_char_append_ch(str, c);
8170         if(c==EOF) state |= IOSTATE_eofbit;
8171         else if(c==(unsigned char)delim) basic_streambuf_char_sbumpc(strbuf);
8172
8173         if(!MSVCP_basic_string_char_length(str) && c!=(unsigned char)delim) state |= IOSTATE_failbit;
8174     }
8175     basic_istream_char_sentry_destroy(istream);
8176
8177     basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream), state);
8178     return istream;
8179 }
8180
8181 /* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
8182 /* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
8183 basic_istream_char* __cdecl basic_istream_char_getline_bstr(
8184         basic_istream_char *istream, basic_string_char *str)
8185 {
8186     return basic_istream_char_getline_bstr_delim(istream, str, '\n');
8187 }
8188
8189 /* ??$?5DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
8190 /* ??$?5DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
8191 basic_istream_char* __cdecl basic_istream_char_read_bstr(
8192         basic_istream_char *istream, basic_string_char *str)
8193 {
8194     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8195     IOSB_iostate state = IOSTATE_failbit;
8196     int c = '\n';
8197
8198     TRACE("(%p %p)\n", istream, str);
8199
8200     if(basic_istream_char_sentry_create(istream, FALSE)) {
8201         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
8202         MSVCP_size_t count = ios_base_width_get(&base->base);
8203
8204         if(!count)
8205             count = -1;
8206
8207         MSVCP_basic_string_char_clear(str);
8208
8209         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
8210                 c!=EOF && !ctype_char_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
8211                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base)), count--) {
8212             state = IOSTATE_goodbit;
8213             MSVCP_basic_string_char_append_ch(str, c);
8214         }
8215     }
8216     basic_istream_char_sentry_destroy(istream);
8217
8218     ios_base_width_set(&base->base, 0);
8219     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8220     return istream;
8221 }
8222
8223 /* ??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAD@Z */
8224 /* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAD@Z */
8225 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAC@Z */
8226 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAC@Z */
8227 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAE@Z */
8228 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAE@Z */
8229 basic_istream_char* __cdecl basic_istream_char_read_str(basic_istream_char *istream, char *str)
8230 {
8231     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8232     IOSB_iostate state = IOSTATE_failbit;
8233     int c = '\n';
8234
8235     TRACE("(%p %p)\n", istream, str);
8236
8237     if(basic_istream_char_sentry_create(istream, FALSE)) {
8238         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
8239         MSVCP_size_t count = ios_base_width_get(&base->base)-1;
8240
8241         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
8242                 c!=EOF && !ctype_char_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
8243                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base)), count--) {
8244             state = IOSTATE_goodbit;
8245             *str++ = c;
8246         }
8247     }
8248     basic_istream_char_sentry_destroy(istream);
8249
8250     *str = 0;
8251     ios_base_width_set(&base->base, 0);
8252     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8253     return istream;
8254 }
8255
8256 /* ??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAD@Z */
8257 /* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAD@Z */
8258 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z */
8259 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAC@Z */
8260 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z */
8261 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAE@Z */
8262 basic_istream_char* __cdecl basic_istream_char_read_ch(basic_istream_char *istream, char *ch)
8263 {
8264     IOSB_iostate state = IOSTATE_failbit;
8265     int c = 0;
8266
8267     TRACE("(%p %p)\n", istream, ch);
8268
8269     if(basic_istream_char_sentry_create(istream, FALSE)) {
8270         c = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(
8271                     basic_istream_char_get_basic_ios(istream)));
8272         if(c != EOF) {
8273             state = IOSTATE_goodbit;
8274             *ch = c;
8275         }
8276     }
8277     basic_istream_char_sentry_destroy(istream);
8278
8279     basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream),
8280             state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8281     return istream;
8282 }
8283
8284 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
8285 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
8286 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_streambuf, 8)
8287 basic_istream_char* __thiscall basic_istream_char_read_streambuf(
8288         basic_istream_char *this, basic_streambuf_char *streambuf)
8289 {
8290     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8291     IOSB_iostate state = IOSTATE_failbit;
8292     int c = '\n';
8293
8294     TRACE("(%p %p)\n", this, streambuf);
8295
8296     if(basic_istream_char_sentry_create(this, FALSE)) {
8297         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base)); c!=EOF;
8298                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base))) {
8299             state = IOSTATE_goodbit;
8300             if(basic_streambuf_char_sputc(streambuf, c) == EOF)
8301                 break;
8302         }
8303     }
8304     basic_istream_char_sentry_destroy(this);
8305
8306     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8307     return this;
8308 }
8309
8310 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
8311 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
8312 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func, 8)
8313 basic_istream_char* __thiscall basic_istream_char_read_func(basic_istream_char *this,
8314         basic_istream_char* (__cdecl *pfunc)(basic_istream_char*))
8315 {
8316     TRACE("(%p %p)\n", this, pfunc);
8317     pfunc(this);
8318     return this;
8319 }
8320
8321 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
8322 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
8323 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_basic_ios, 8)
8324 basic_istream_char* __thiscall basic_istream_char_read_func_basic_ios(basic_istream_char *this,
8325         basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
8326 {
8327     TRACE("(%p %p)\n", this, pfunc);
8328     pfunc(basic_istream_char_get_basic_ios(this));
8329     return this;
8330 }
8331
8332 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
8333 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
8334 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_ios_base, 8)
8335 basic_istream_char* __thiscall basic_istream_char_read_func_ios_base(basic_istream_char *this,
8336         ios_base* (__cdecl *pfunc)(ios_base*))
8337 {
8338     TRACE("(%p %p)\n", this, pfunc);
8339     pfunc(&basic_istream_char_get_basic_ios(this)->base);
8340     return this;
8341 }
8342
8343 /* Caution: basic_istream uses virtual inheritance. */
8344 static inline basic_ios_wchar* basic_istream_wchar_get_basic_ios(basic_istream_wchar *this)
8345 {
8346     return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
8347 }
8348
8349 static inline basic_ios_wchar* basic_istream_wchar_to_basic_ios(basic_istream_wchar *ptr)
8350 {
8351     return (basic_ios_wchar*)((char*)ptr+basic_istream_wchar_vbtable[1]);
8352 }
8353
8354 static inline basic_istream_wchar* basic_istream_wchar_from_basic_ios(basic_ios_wchar *ptr)
8355 {
8356     return (basic_istream_wchar*)((char*)ptr-basic_istream_wchar_vbtable[1]);
8357 }
8358
8359 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
8360 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
8361 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_init, 20)
8362 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_init(basic_istream_wchar *this,
8363         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
8364 {
8365     basic_ios_wchar *base;
8366
8367     TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
8368
8369     if(virt_init) {
8370         this->vbtable = basic_istream_wchar_vbtable;
8371         base = basic_istream_wchar_get_basic_ios(this);
8372         basic_ios_wchar_ctor(base);
8373     }else {
8374         base = basic_istream_wchar_get_basic_ios(this);
8375     }
8376
8377     base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
8378     this->count = 0;
8379     if(!noinit)
8380         basic_ios_wchar_init(base, strbuf, isstd);
8381     return this;
8382 }
8383
8384 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
8385 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
8386 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_init, 20)
8387 basic_istream_wchar* __thiscall basic_istream_short_ctor_init(basic_istream_wchar *this,
8388         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
8389 {
8390     basic_istream_wchar_ctor_init(this, strbuf, isstd, noinit, virt_init);
8391     basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
8392     return this;
8393 }
8394
8395 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
8396 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
8397 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor, 16)
8398 basic_istream_wchar* __thiscall basic_istream_wchar_ctor(basic_istream_wchar *this,
8399         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
8400 {
8401     return basic_istream_wchar_ctor_init(this, strbuf, isstd, FALSE, virt_init);
8402 }
8403
8404 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
8405 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
8406 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor, 16)
8407 basic_istream_wchar* __thiscall basic_istream_short_ctor(basic_istream_wchar *this,
8408         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
8409 {
8410     return basic_istream_short_ctor_init(this, strbuf, isstd, FALSE, virt_init);
8411 }
8412
8413 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
8414 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
8415 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_uninitialized, 12)
8416 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_uninitialized(
8417         basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
8418 {
8419     basic_ios_wchar *base;
8420
8421     TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
8422
8423     if(virt_init) {
8424         this->vbtable = basic_istream_wchar_vbtable;
8425         base = basic_istream_wchar_get_basic_ios(this);
8426         basic_ios_wchar_ctor(base);
8427     }else {
8428         base = basic_istream_wchar_get_basic_ios(this);
8429     }
8430
8431     base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
8432     ios_base_Addstd(&base->base);
8433     return this;
8434 }
8435
8436 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
8437 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
8438 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_uninitialized, 12)
8439 basic_istream_wchar* __thiscall basic_istream_short_ctor_uninitialized(
8440         basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
8441 {
8442     basic_istream_wchar_ctor_uninitialized(this, uninitialized, virt_init);
8443     basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
8444     return this;
8445 }
8446
8447 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
8448 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
8449 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UAE@XZ */
8450 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
8451 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_dtor, 4)
8452 void __thiscall basic_istream_wchar_dtor(basic_ios_wchar *base)
8453 {
8454     basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
8455
8456     /* don't destroy virtual base here */
8457     TRACE("(%p)\n", this);
8458 }
8459
8460 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
8461 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
8462 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
8463 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
8464 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vbase_dtor, 4)
8465 void __thiscall basic_istream_wchar_vbase_dtor(basic_istream_wchar *this)
8466 {
8467     TRACE("(%p)\n", this);
8468     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(this));
8469     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(this));
8470 }
8471
8472 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vector_dtor, 8)
8473 basic_istream_wchar* __thiscall basic_istream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
8474 {
8475     basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
8476
8477     TRACE("(%p %x)\n", this, flags);
8478
8479     if(flags & 2) {
8480         /* we have an array, with the number of elements stored before the first object */
8481         INT_PTR i, *ptr = (INT_PTR *)this-1;
8482
8483         for(i=*ptr-1; i>=0; i--)
8484             basic_istream_wchar_vbase_dtor(this+i);
8485         MSVCRT_operator_delete(ptr);
8486     } else {
8487         basic_istream_wchar_vbase_dtor(this);
8488         if(flags & 1)
8489             MSVCRT_operator_delete(this);
8490     }
8491
8492     return this;
8493 }
8494
8495 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
8496 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
8497 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
8498 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
8499 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Ipfx, 8)
8500 MSVCP_bool __thiscall basic_istream_wchar__Ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
8501 {
8502     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8503
8504     TRACE("(%p %d)\n", this, noskip);
8505
8506     if(ios_base_good(&base->base)) {
8507         if(basic_ios_wchar_tie_get(base))
8508             basic_ostream_wchar_flush(basic_ios_wchar_tie_get(base));
8509
8510         if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
8511             basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8512             const ctype_wchar *ctype = ctype_wchar_use_facet(base->strbuf->loc);
8513             int ch;
8514
8515             for(ch = basic_streambuf_wchar_sgetc(strbuf); ;
8516                     ch = basic_streambuf_wchar_snextc(strbuf)) {
8517                 if(ch == WEOF) {
8518                     basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8519                     break;
8520                 }
8521
8522                 if(!ctype_wchar_is_ch(ctype, _SPACE|_BLANK, ch))
8523                     break;
8524             }
8525         }
8526     }
8527
8528     if(!ios_base_good(&base->base)) {
8529         basic_ios_wchar_setstate(base, IOSTATE_failbit);
8530         return FALSE;
8531     }
8532     return TRUE;
8533 }
8534
8535 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
8536 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
8537 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
8538 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
8539 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ipfx, 8)
8540 MSVCP_bool __thiscall basic_istream_wchar_ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
8541 {
8542     return basic_istream_wchar__Ipfx(this, noskip);
8543 }
8544
8545 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
8546 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
8547 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
8548 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
8549 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_isfx, 4)
8550 void __thiscall basic_istream_wchar_isfx(basic_istream_wchar *this)
8551 {
8552     TRACE("(%p)\n", this);
8553 }
8554
8555 static BOOL basic_istream_wchar_sentry_create(basic_istream_wchar *istr, MSVCP_bool noskip)
8556 {
8557     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
8558
8559     if(basic_ios_wchar_rdbuf_get(base))
8560         basic_streambuf_wchar__Lock(base->strbuf);
8561
8562     return basic_istream_wchar_ipfx(istr, noskip);
8563 }
8564
8565 static void basic_istream_wchar_sentry_destroy(basic_istream_wchar *istr)
8566 {
8567     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
8568
8569     if(basic_ios_wchar_rdbuf_get(base))
8570         basic_streambuf_wchar__Unlock(base->strbuf);
8571 }
8572
8573 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QBEHXZ */
8574 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEBA_JXZ */
8575 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QBEHXZ */
8576 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QEBA_JXZ */
8577 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_gcount, 4)
8578 int __thiscall basic_istream_wchar_gcount(const basic_istream_wchar *this)
8579 {
8580     TRACE("(%p)\n", this);
8581     return this->count;
8582 }
8583
8584 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
8585 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
8586 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
8587 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
8588 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get, 4)
8589 unsigned short __thiscall basic_istream_wchar_get(basic_istream_wchar *this)
8590 {
8591     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8592     int ret;
8593
8594     TRACE("(%p)\n", this);
8595
8596     this->count = 0;
8597
8598     if(!basic_istream_wchar_sentry_create(this, TRUE)) {
8599         basic_istream_wchar_sentry_destroy(this);
8600         return WEOF;
8601     }
8602
8603     ret = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(base));
8604     basic_istream_wchar_sentry_destroy(this);
8605     if(ret == WEOF)
8606         basic_ios_wchar_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
8607     else
8608         this->count++;
8609
8610     return ret;
8611 }
8612
8613 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AA_W@Z */
8614 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEA_W@Z */
8615 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAG@Z */
8616 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAG@Z */
8617 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_ch, 8)
8618 basic_istream_wchar* __thiscall basic_istream_wchar_get_ch(basic_istream_wchar *this, wchar_t *ch)
8619 {
8620     unsigned short ret;
8621
8622     TRACE("(%p %p)\n", this, ch);
8623
8624     ret = basic_istream_wchar_get(this);
8625     if(ret != WEOF)
8626         *ch = (wchar_t)ret;
8627     return this;
8628 }
8629
8630 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
8631 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
8632 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
8633 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
8634 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str_delim, 16)
8635 basic_istream_wchar* __thiscall basic_istream_wchar_get_str_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
8636 {
8637     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8638     unsigned short ch = delim;
8639
8640     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
8641
8642     this->count = 0;
8643
8644     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8645         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8646
8647         for(ch = basic_streambuf_wchar_sgetc(strbuf); count>1;
8648                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8649             if(ch==WEOF || ch==delim)
8650                 break;
8651
8652             *str++ = ch;
8653             this->count++;
8654             count--;
8655         }
8656     }
8657     basic_istream_wchar_sentry_destroy(this);
8658
8659     basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
8660             (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8661     if(count > 0)
8662         *str = 0;
8663     return this;
8664 }
8665
8666 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8667 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8668 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8669 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8670 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str, 12)
8671 basic_istream_wchar* __thiscall basic_istream_wchar_get_str(basic_istream_wchar *this, wchar_t *str, streamsize count)
8672 {
8673     return basic_istream_wchar_get_str_delim(this, str, count, '\n');
8674 }
8675
8676 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
8677 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
8678 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
8679 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
8680 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf_delim, 12)
8681 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf_delim(basic_istream_wchar *this, basic_streambuf_wchar *strbuf, wchar_t delim)
8682 {
8683     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8684     unsigned short ch = delim;
8685
8686     TRACE("(%p %p %c)\n", this, strbuf, delim);
8687
8688     this->count = 0;
8689
8690     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8691         basic_streambuf_wchar *strbuf_read = basic_ios_wchar_rdbuf_get(base);
8692
8693         for(ch = basic_streambuf_wchar_sgetc(strbuf_read); ;
8694                 ch = basic_streambuf_wchar_snextc(strbuf_read)) {
8695             if(ch==WEOF || ch==delim)
8696                 break;
8697
8698             if(basic_streambuf_wchar_sputc(strbuf, ch) == WEOF)
8699                 break;
8700             this->count++;
8701         }
8702     }
8703     basic_istream_wchar_sentry_destroy(this);
8704
8705     basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
8706             (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8707     return this;
8708 }
8709
8710 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
8711 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
8712 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
8713 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
8714 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf, 8)
8715 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf(basic_istream_wchar *this, basic_streambuf_wchar *strbuf)
8716 {
8717     return basic_istream_wchar_get_streambuf_delim(this, strbuf, '\n');
8718 }
8719
8720 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
8721 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
8722 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
8723 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
8724 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline_delim, 16)
8725 basic_istream_wchar* __thiscall basic_istream_wchar_getline_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
8726 {
8727     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8728     unsigned short ch = delim;
8729
8730     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
8731
8732     this->count = 0;
8733
8734     if(basic_istream_wchar_sentry_create(this, TRUE) && count>0) {
8735         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8736
8737         while(count > 1) {
8738             ch = basic_streambuf_wchar_sbumpc(strbuf);
8739
8740             if(ch==WEOF || ch==delim)
8741                 break;
8742
8743             *str++ = ch;
8744             this->count++;
8745             count--;
8746         }
8747
8748         if(ch == delim)
8749             this->count++;
8750         else if(ch != WEOF) {
8751             ch = basic_streambuf_wchar_sgetc(strbuf);
8752
8753             if(ch == delim) {
8754                 basic_streambuf_wchar__Gninc(strbuf);
8755                 this->count++;
8756             }
8757         }
8758     }
8759     basic_istream_wchar_sentry_destroy(this);
8760
8761     basic_ios_wchar_setstate(base, (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
8762             (!this->count || (ch!=delim && ch!=WEOF) ? IOSTATE_failbit : IOSTATE_goodbit));
8763     if(count > 0)
8764         *str = 0;
8765     return this;
8766 }
8767
8768 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8769 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8770 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8771 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8772 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline, 12)
8773 basic_istream_wchar* __thiscall basic_istream_wchar_getline(basic_istream_wchar *this, wchar_t *str, streamsize count)
8774 {
8775     return basic_istream_wchar_getline_delim(this, str, count, '\n');
8776 }
8777
8778 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@HG@Z */
8779 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JG@Z */
8780 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@HG@Z */
8781 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JG@Z */
8782 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ignore, 12)
8783 basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar *this, streamsize count, unsigned short delim)
8784 {
8785     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8786     unsigned short ch = delim;
8787     unsigned int state;
8788
8789     TRACE("(%p %ld %d)\n", this, count, delim);
8790
8791     this->count = 0;
8792
8793     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8794         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8795         state = IOSTATE_goodbit;
8796
8797         while(count > 0) {
8798             ch = basic_streambuf_wchar_sbumpc(strbuf);
8799
8800             if(ch==WEOF) {
8801                 state = IOSTATE_eofbit;
8802                 break;
8803             }
8804
8805             if(ch==delim)
8806                 break;
8807
8808             this->count++;
8809             if(count != INT_MAX)
8810                 count--;
8811         }
8812     }else
8813         state = IOSTATE_failbit;
8814     basic_istream_wchar_sentry_destroy(this);
8815
8816     basic_ios_wchar_setstate(base, state);
8817     return this;
8818 }
8819
8820 /* ?ws@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
8821 /* ?ws@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
8822 /* ?ws@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@1@AAV21@@Z */
8823 /* ?ws@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
8824 basic_istream_wchar* __cdecl ws_basic_istream_wchar(basic_istream_wchar *istream)
8825 {
8826     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
8827     unsigned short ch = '\n';
8828
8829     TRACE("(%p)\n", istream);
8830
8831     if(basic_istream_wchar_sentry_create(istream, TRUE)) {
8832         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8833         const ctype_wchar *ctype = ctype_wchar_use_facet(strbuf->loc);
8834
8835         for(ch = basic_streambuf_wchar_sgetc(strbuf); ctype_wchar_is_ch(ctype, _SPACE, ch);
8836                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8837             if(ch == WEOF)
8838                 break;
8839         }
8840     }
8841     basic_istream_wchar_sentry_destroy(istream);
8842
8843     if(ch == WEOF)
8844         basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8845     return istream;
8846 }
8847
8848 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
8849 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
8850 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
8851 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
8852 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_peek, 4)
8853 unsigned short __thiscall basic_istream_wchar_peek(basic_istream_wchar *this)
8854 {
8855     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8856     unsigned short ret = WEOF;
8857
8858     TRACE("(%p)\n", this);
8859
8860     this->count = 0;
8861
8862     if(basic_istream_wchar_sentry_create(this, TRUE))
8863         ret = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
8864     basic_istream_wchar_sentry_destroy(this);
8865
8866     if (ret == WEOF)
8867         basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8868
8869     return ret;
8870 }
8871
8872 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WIH@Z */
8873 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_K_J@Z */
8874 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGIH@Z */
8875 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_K_J@Z */
8876 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Read_s, 16)
8877 basic_istream_wchar* __thiscall basic_istream_wchar__Read_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
8878 {
8879     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8880     IOSB_iostate state = IOSTATE_goodbit;
8881
8882     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
8883
8884     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8885         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8886
8887         this->count = basic_streambuf_wchar__Sgetn_s(strbuf, str, size, count);
8888         if(this->count != count)
8889             state |= IOSTATE_failbit | IOSTATE_eofbit;
8890     }else {
8891         this->count = 0;
8892     }
8893     basic_istream_wchar_sentry_destroy(this);
8894
8895     basic_ios_wchar_setstate(base, state);
8896     return this;
8897 }
8898
8899 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8900 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8901 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8902 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8903 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read, 12)
8904 basic_istream_wchar* __thiscall basic_istream_wchar_read(basic_istream_wchar *this, wchar_t *str, streamsize count)
8905 {
8906     return basic_istream_wchar__Read_s(this, str, count, count);
8907 }
8908
8909 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
8910 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
8911 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
8912 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
8913 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Readsome_s, 16)
8914 streamsize __thiscall basic_istream_wchar__Readsome_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
8915 {
8916     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8917     IOSB_iostate state = IOSTATE_goodbit;
8918
8919     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
8920
8921     this->count = 0;
8922
8923     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8924         streamsize avail = basic_streambuf_wchar_in_avail(basic_ios_wchar_rdbuf_get(base));
8925         if(avail > count)
8926             avail = count;
8927
8928         if(avail == -1)
8929             state |= IOSTATE_eofbit;
8930         else if(avail > 0)
8931             basic_istream_wchar__Read_s(this, str, size, avail);
8932     }else {
8933         state |= IOSTATE_failbit;
8934     }
8935     basic_istream_wchar_sentry_destroy(this);
8936
8937     basic_ios_wchar_setstate(base, state);
8938     return this->count;
8939 }
8940
8941 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
8942 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
8943 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
8944 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
8945 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_readsome, 12)
8946 streamsize __thiscall basic_istream_wchar_readsome(basic_istream_wchar *this, wchar_t *str, streamsize count)
8947 {
8948     return basic_istream_wchar__Readsome_s(this, str, count, count);
8949 }
8950
8951 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
8952 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
8953 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
8954 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
8955 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_putback, 8)
8956 basic_istream_wchar* __thiscall basic_istream_wchar_putback(basic_istream_wchar *this, wchar_t ch)
8957 {
8958     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8959     IOSB_iostate state = IOSTATE_goodbit;
8960
8961     TRACE("(%p %c)\n", this, ch);
8962
8963     this->count = 0;
8964
8965     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8966         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8967
8968         if(!ios_base_good(&base->base))
8969             state |= IOSTATE_failbit;
8970         else if(!strbuf || basic_streambuf_wchar_sputbackc(strbuf, ch)==WEOF)
8971             state |= IOSTATE_badbit;
8972     }
8973     basic_istream_wchar_sentry_destroy(this);
8974
8975     basic_ios_wchar_setstate(base, state);
8976     return this;
8977 }
8978
8979 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
8980 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
8981 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
8982 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
8983 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_unget, 4)
8984 basic_istream_wchar* __thiscall basic_istream_wchar_unget(basic_istream_wchar *this)
8985 {
8986     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8987     IOSB_iostate state = IOSTATE_goodbit;
8988
8989     TRACE("(%p)\n", this);
8990
8991     this->count = 0;
8992
8993     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8994         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8995
8996         if(!ios_base_good(&base->base))
8997             state |= IOSTATE_failbit;
8998         else if(!strbuf || basic_streambuf_wchar_sungetc(strbuf)==WEOF)
8999             state |= IOSTATE_badbit;
9000     }
9001     basic_istream_wchar_sentry_destroy(this);
9002
9003     basic_ios_wchar_setstate(base, state);
9004     return this;
9005 }
9006
9007 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
9008 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
9009 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHXZ */
9010 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAHXZ */
9011 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_sync, 4)
9012 int __thiscall basic_istream_wchar_sync(basic_istream_wchar *this)
9013 {
9014     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9015     basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9016
9017     TRACE("(%p)\n", this);
9018
9019     if(!strbuf)
9020         return -1;
9021
9022     if(basic_istream_wchar_sentry_create(this, TRUE)) {
9023         if(basic_streambuf_wchar_pubsync(strbuf) != -1) {
9024             basic_istream_wchar_sentry_destroy(this);
9025             return 0;
9026         }
9027     }
9028     basic_istream_wchar_sentry_destroy(this);
9029
9030     basic_ios_wchar_setstate(base, IOSTATE_badbit);
9031     return -1;
9032 }
9033
9034 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
9035 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
9036 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
9037 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
9038 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_tellg, 8)
9039 fpos_int* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, fpos_int *ret)
9040 {
9041     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9042
9043     TRACE("(%p %p)\n", this, ret);
9044
9045     if(ios_base_fail(&base->base)) {
9046         ret->off = -1;
9047         ret->pos = 0;
9048         ret->state = 0;
9049         return ret;
9050     }
9051
9052     basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
9053             ret, 0, SEEKDIR_cur, OPENMODE_in);
9054     if(ret->off==-1 && ret->pos==0 && ret->state==0)
9055         basic_ios_wchar_setstate(base, IOSTATE_failbit);
9056
9057     return ret;
9058 }
9059
9060 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
9061 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
9062 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
9063 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
9064 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg, 12)
9065 basic_istream_wchar* __thiscall basic_istream_wchar_seekg(basic_istream_wchar *this, streamoff off, int dir)
9066 {
9067     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9068
9069     TRACE("(%p %ld %d)\n", this, off, dir);
9070
9071     if(!ios_base_fail(&base->base)) {
9072         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9073         fpos_int ret;
9074
9075         basic_streambuf_wchar_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
9076
9077         if(ret.off==-1 && ret.pos==0 && ret.state==0)
9078             basic_ios_wchar_setstate(base, IOSTATE_failbit);
9079         else
9080             basic_ios_wchar_clear(base, IOSTATE_goodbit);
9081         return this;
9082     }else
9083         basic_ios_wchar_clear(base, IOSTATE_goodbit);
9084
9085     return this;
9086 }
9087
9088 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
9089 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
9090 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
9091 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
9092 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg_fpos, 28)
9093 basic_istream_wchar* __thiscall basic_istream_wchar_seekg_fpos(basic_istream_wchar *this, fpos_int pos)
9094 {
9095     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9096
9097     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
9098
9099     if(!ios_base_fail(&base->base)) {
9100         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9101         fpos_int ret;
9102
9103         basic_streambuf_wchar_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
9104
9105         if(ret.off==-1 && ret.pos==0 && ret.state==0)
9106             basic_ios_wchar_setstate(base, IOSTATE_failbit);
9107         else
9108             basic_ios_wchar_clear(base, IOSTATE_goodbit);
9109         return this;
9110     }else
9111         basic_ios_wchar_clear(base, IOSTATE_goodbit);
9112
9113     return this;
9114 }
9115
9116 static basic_istream_wchar* basic_istream_read_short(basic_istream_wchar *this, short *v, const num_get *numget)
9117 {
9118     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9119     int state = IOSTATE_goodbit;
9120
9121     TRACE("(%p %p)\n", this, v);
9122
9123     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9124         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9125         istreambuf_iterator_wchar first={0}, last={0};
9126         LONG tmp;
9127
9128         first.strbuf = strbuf;
9129         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, &tmp);
9130
9131         if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
9132             *v = tmp;
9133         else
9134             state |= IOSTATE_failbit;
9135     }
9136     basic_istream_wchar_sentry_destroy(this);
9137
9138     basic_ios_wchar_setstate(base, state);
9139     return this;
9140 }
9141
9142 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAF@Z */
9143 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAF@Z */
9144 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_short, 8)
9145 basic_istream_wchar* __thiscall basic_istream_wchar_read_short(basic_istream_wchar *this, short *v)
9146 {
9147     return basic_istream_read_short(this, v, num_get_wchar_use_facet(
9148                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9149 }
9150
9151 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAF@Z */
9152 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAF@Z */
9153 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_short, 8)
9154 basic_istream_wchar* __thiscall basic_istream_short_read_short(basic_istream_wchar *this, short *v)
9155 {
9156     return basic_istream_read_short(this, v, num_get_short_use_facet(
9157                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9158 }
9159
9160 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAG@Z */
9161 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAG@Z */
9162 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ushort, 8)
9163 basic_istream_wchar* __thiscall basic_istream_wchar_read_ushort(basic_istream_wchar *this, unsigned short *v)
9164 {
9165     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9166     int state = IOSTATE_goodbit;
9167
9168     TRACE("(%p %p)\n", this, v);
9169
9170     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9171         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9172         const num_get *numget = num_get_wchar_use_facet(strbuf->loc);
9173         istreambuf_iterator_wchar first={0}, last={0};
9174
9175         first.strbuf = strbuf;
9176         num_get_wchar_get_ushort(numget, &last, first, last, &base->base, &state, v);
9177     }
9178     basic_istream_wchar_sentry_destroy(this);
9179
9180     basic_ios_wchar_setstate(base, state);
9181     return this;
9182 }
9183
9184 static basic_istream_wchar* basic_istream_read_int(basic_istream_wchar *this, int *v, const num_get *numget)
9185 {
9186     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9187     int state = IOSTATE_goodbit;
9188
9189     TRACE("(%p %p)\n", this, v);
9190
9191     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9192         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9193         istreambuf_iterator_wchar first={0}, last={0};
9194
9195         first.strbuf = strbuf;
9196         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
9197     }
9198     basic_istream_wchar_sentry_destroy(this);
9199
9200     basic_ios_wchar_setstate(base, state);
9201     return this;
9202 }
9203
9204 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAH@Z */
9205 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAH@Z */
9206 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int, 8)
9207 basic_istream_wchar* __thiscall basic_istream_wchar_read_int(basic_istream_wchar *this, int *v)
9208 {
9209     return basic_istream_read_int(this, v, num_get_wchar_use_facet(
9210                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9211 }
9212
9213 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAH@Z */
9214 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAH@Z */
9215 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int, 8)
9216 basic_istream_wchar* __thiscall basic_istream_short_read_int(basic_istream_wchar *this, int *v)
9217 {
9218     return basic_istream_read_int(this, v, num_get_short_use_facet(
9219                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9220 }
9221
9222 static basic_istream_wchar* basic_istream_read_uint(basic_istream_wchar *this, unsigned int *v, const num_get *numget)
9223 {
9224     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9225     int state = IOSTATE_goodbit;
9226
9227     TRACE("(%p %p)\n", this, v);
9228
9229     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9230         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9231         istreambuf_iterator_wchar first={0}, last={0};
9232
9233         first.strbuf = strbuf;
9234         num_get_wchar_get_uint(numget, &last, first, last, &base->base, &state, v);
9235     }
9236     basic_istream_wchar_sentry_destroy(this);
9237
9238     basic_ios_wchar_setstate(base, state);
9239     return this;
9240 }
9241
9242 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAI@Z */
9243 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAI@Z */
9244 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint, 8)
9245 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint(basic_istream_wchar *this, unsigned int *v)
9246 {
9247     return basic_istream_read_uint(this, v, num_get_wchar_use_facet(
9248                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9249 }
9250
9251 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAI@Z */
9252 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAI@Z */
9253 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint, 8)
9254 basic_istream_wchar* __thiscall basic_istream_short_read_uint(basic_istream_wchar *this, unsigned int *v)
9255 {
9256     return basic_istream_read_uint(this, v, num_get_short_use_facet(
9257                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9258 }
9259
9260 static basic_istream_wchar* basic_istream_read_long(basic_istream_wchar *this, LONG *v, const num_get *numget)
9261 {
9262     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9263     int state = IOSTATE_goodbit;
9264
9265     TRACE("(%p %p)\n", this, v);
9266
9267     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9268         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9269         istreambuf_iterator_wchar first={0}, last={0};
9270
9271         first.strbuf = strbuf;
9272         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
9273     }
9274     basic_istream_wchar_sentry_destroy(this);
9275
9276     basic_ios_wchar_setstate(base, state);
9277     return this;
9278 }
9279
9280 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
9281 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
9282 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_long, 8)
9283 basic_istream_wchar* __thiscall basic_istream_wchar_read_long(basic_istream_wchar *this, LONG *v)
9284 {
9285     return basic_istream_read_long(this, v, num_get_wchar_use_facet(
9286                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9287 }
9288
9289 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
9290 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
9291 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_long, 8)
9292 basic_istream_wchar* __thiscall basic_istream_short_read_long(basic_istream_wchar *this, LONG *v)
9293 {
9294     return basic_istream_read_long(this, v, num_get_short_use_facet(
9295                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9296 }
9297
9298 static basic_istream_wchar* basic_istream_read_ulong(basic_istream_wchar *this, ULONG *v, const num_get *numget)
9299 {
9300     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9301     int state = IOSTATE_goodbit;
9302
9303     TRACE("(%p %p)\n", this, v);
9304
9305     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9306         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9307         istreambuf_iterator_wchar first={0}, last={0};
9308
9309         first.strbuf = strbuf;
9310         num_get_wchar_get_ulong(numget, &last, first, last, &base->base, &state, v);
9311     }
9312     basic_istream_wchar_sentry_destroy(this);
9313
9314     basic_ios_wchar_setstate(base, state);
9315     return this;
9316 }
9317
9318 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAK@Z */
9319 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAK@Z */
9320 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ulong, 8)
9321 basic_istream_wchar* __thiscall basic_istream_wchar_read_ulong(basic_istream_wchar *this, ULONG *v)
9322 {
9323     return basic_istream_read_ulong(this, v, num_get_wchar_use_facet(
9324                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9325 }
9326
9327 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAK@Z */
9328 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAK@Z */
9329 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ulong, 8)
9330 basic_istream_wchar* __thiscall basic_istream_short_read_ulong(basic_istream_wchar *this, ULONG *v)
9331 {
9332     return basic_istream_read_ulong(this, v, num_get_short_use_facet(
9333                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9334 }
9335
9336 static basic_istream_wchar* basic_istream_read_float(basic_istream_wchar *this, float *v, const num_get *numget)
9337 {
9338     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9339     int state = IOSTATE_goodbit;
9340
9341     TRACE("(%p %p)\n", this, v);
9342
9343     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9344         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9345         istreambuf_iterator_wchar first={0}, last={0};
9346
9347         first.strbuf = strbuf;
9348         num_get_wchar_get_float(numget, &last, first, last, &base->base, &state, v);
9349     }
9350     basic_istream_wchar_sentry_destroy(this);
9351
9352     basic_ios_wchar_setstate(base, state);
9353     return this;
9354 }
9355
9356 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAM@Z */
9357 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAM@Z */
9358 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_float, 8)
9359 basic_istream_wchar* __thiscall basic_istream_wchar_read_float(basic_istream_wchar *this, float *v)
9360 {
9361     return basic_istream_read_float(this, v, num_get_wchar_use_facet(
9362                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9363 }
9364
9365 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAM@Z */
9366 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAM@Z */
9367 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_float, 8)
9368 basic_istream_wchar* __thiscall basic_istream_short_read_float(basic_istream_wchar *this, float *v)
9369 {
9370     return basic_istream_read_float(this, v, num_get_short_use_facet(
9371                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9372 }
9373
9374 static basic_istream_wchar* basic_istream_read_double(basic_istream_wchar *this, double *v, const num_get *numget)
9375 {
9376     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9377     int state = IOSTATE_goodbit;
9378
9379     TRACE("(%p %p)\n", this, v);
9380
9381     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9382         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9383         istreambuf_iterator_wchar first={0}, last={0};
9384
9385         first.strbuf = strbuf;
9386         num_get_wchar_get_double(numget, &last, first, last, &base->base, &state, v);
9387     }
9388     basic_istream_wchar_sentry_destroy(this);
9389
9390     basic_ios_wchar_setstate(base, state);
9391     return this;
9392 }
9393
9394 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAN@Z */
9395 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAN@Z */
9396 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_double, 8)
9397 basic_istream_wchar* __thiscall basic_istream_wchar_read_double(basic_istream_wchar *this, double *v)
9398 {
9399     return basic_istream_read_double(this, v, num_get_wchar_use_facet(
9400                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9401 }
9402
9403 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAN@Z */
9404 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAN@Z */
9405 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_double, 8)
9406 basic_istream_wchar* __thiscall basic_istream_short_read_double(basic_istream_wchar *this, double *v)
9407 {
9408     return basic_istream_read_double(this, v, num_get_short_use_facet(
9409                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9410 }
9411
9412 static basic_istream_wchar* basic_istream_read_ldouble(basic_istream_wchar *this, double *v, const num_get *numget)
9413 {
9414     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9415     int state = IOSTATE_goodbit;
9416
9417     TRACE("(%p %p)\n", this, v);
9418
9419     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9420         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9421         istreambuf_iterator_wchar first={0}, last={0};
9422
9423         first.strbuf = strbuf;
9424         num_get_wchar_get_ldouble(numget, &last, first, last, &base->base, &state, v);
9425     }
9426     basic_istream_wchar_sentry_destroy(this);
9427
9428     basic_ios_wchar_setstate(base, state);
9429     return this;
9430 }
9431
9432 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAO@Z */
9433 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAO@Z */
9434 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ldouble, 8)
9435 basic_istream_wchar* __thiscall basic_istream_wchar_read_ldouble(basic_istream_wchar *this, double *v)
9436 {
9437     return basic_istream_read_ldouble(this, v, num_get_wchar_use_facet(
9438                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9439 }
9440
9441 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAO@Z */
9442 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAO@Z */
9443 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ldouble, 8)
9444 basic_istream_wchar* __thiscall basic_istream_short_read_ldouble(basic_istream_wchar *this, double *v)
9445 {
9446     return basic_istream_read_ldouble(this, v, num_get_short_use_facet(
9447                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9448 }
9449
9450 static basic_istream_wchar* basic_istream_read_ptr(basic_istream_wchar *this, void **v, const num_get *numget)
9451 {
9452     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9453     int state = IOSTATE_goodbit;
9454
9455     TRACE("(%p %p)\n", this, v);
9456
9457     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9458         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9459         istreambuf_iterator_wchar first={0}, last={0};
9460
9461         first.strbuf = strbuf;
9462         num_get_wchar_get_void(numget, &last, first, last, &base->base, &state, v);
9463     }
9464     basic_istream_wchar_sentry_destroy(this);
9465
9466     basic_ios_wchar_setstate(base, state);
9467     return this;
9468 }
9469
9470 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAPAX@Z */
9471 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
9472 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ptr, 8)
9473 basic_istream_wchar* __thiscall basic_istream_wchar_read_ptr(basic_istream_wchar *this, void **v)
9474 {
9475     return basic_istream_read_ptr(this, v, num_get_wchar_use_facet(
9476                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9477 }
9478
9479 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAPAX@Z */
9480 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
9481 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ptr, 8)
9482 basic_istream_wchar* __thiscall basic_istream_short_read_ptr(basic_istream_wchar *this, void **v)
9483 {
9484     return basic_istream_read_ptr(this, v, num_get_short_use_facet(
9485                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9486 }
9487
9488 static basic_istream_wchar* basic_istream_read_int64(basic_istream_wchar *this, __int64 *v, const num_get *numget)
9489 {
9490     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9491     int state = IOSTATE_goodbit;
9492
9493     TRACE("(%p %p)\n", this, v);
9494
9495     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9496         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9497         istreambuf_iterator_wchar first={0}, last={0};
9498
9499         first.strbuf = strbuf;
9500         num_get_wchar_get_int64(numget, &last, first, last, &base->base, &state, v);
9501     }
9502     basic_istream_wchar_sentry_destroy(this);
9503
9504     basic_ios_wchar_setstate(base, state);
9505     return this;
9506 }
9507
9508 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_J@Z */
9509 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_J@Z */
9510 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int64, 8)
9511 basic_istream_wchar* __thiscall basic_istream_wchar_read_int64(basic_istream_wchar *this, __int64 *v)
9512 {
9513     return basic_istream_read_int64(this, v, num_get_wchar_use_facet(
9514                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9515 }
9516
9517 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_J@Z */
9518 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_J@Z */
9519 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int64, 8)
9520 basic_istream_wchar* __thiscall basic_istream_short_read_int64(basic_istream_wchar *this, __int64 *v)
9521 {
9522     return basic_istream_read_int64(this, v, num_get_short_use_facet(
9523                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9524 }
9525
9526 static basic_istream_wchar* basic_istream_read_uint64(basic_istream_wchar *this, unsigned __int64 *v, const num_get *numget)
9527 {
9528     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9529     int state = IOSTATE_goodbit;
9530
9531     TRACE("(%p %p)\n", this, v);
9532
9533     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9534         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9535         istreambuf_iterator_wchar first={0}, last={0};
9536
9537         first.strbuf = strbuf;
9538         num_get_wchar_get_uint64(numget, &last, first, last, &base->base, &state, v);
9539     }
9540     basic_istream_wchar_sentry_destroy(this);
9541
9542     basic_ios_wchar_setstate(base, state);
9543     return this;
9544 }
9545
9546 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_K@Z */
9547 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_K@Z */
9548 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint64, 8)
9549 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
9550 {
9551     return basic_istream_read_uint64(this, v, num_get_wchar_use_facet(
9552                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9553 }
9554
9555 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_K@Z */
9556 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_K@Z */
9557 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint64, 8)
9558 basic_istream_wchar* __thiscall basic_istream_short_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
9559 {
9560     return basic_istream_read_uint64(this, v, num_get_short_use_facet(
9561                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9562 }
9563
9564 static basic_istream_wchar* basic_istream_read_bool(basic_istream_wchar *this, MSVCP_bool *v, const num_get *numget)
9565 {
9566     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9567     int state = IOSTATE_goodbit;
9568
9569     TRACE("(%p %p)\n", this, v);
9570
9571     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9572         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9573         istreambuf_iterator_wchar first={0}, last={0};
9574
9575         first.strbuf = strbuf;
9576         num_get_wchar_get_bool(numget, &last, first, last, &base->base, &state, v);
9577     }
9578     basic_istream_wchar_sentry_destroy(this);
9579
9580     basic_ios_wchar_setstate(base, state);
9581     return this;
9582 }
9583
9584 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_N@Z */
9585 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_N@Z */
9586 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_bool, 8)
9587 basic_istream_wchar* __thiscall basic_istream_wchar_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
9588 {
9589     return basic_istream_read_bool(this, v, num_get_wchar_use_facet(
9590                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9591 }
9592
9593 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_N@Z */
9594 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_N@Z */
9595 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_bool, 8)
9596 basic_istream_wchar* __thiscall basic_istream_short_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
9597 {
9598     return basic_istream_read_bool(this, v, num_get_short_use_facet(
9599                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9600 }
9601
9602 /* ??$getline@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@_W@Z */
9603 /* ??$getline@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@_W@Z */
9604 /* ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@G@Z */
9605 /* ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@G@Z */
9606 basic_istream_wchar* __cdecl basic_istream_wchar_getline_bstr_delim(
9607         basic_istream_wchar *istream, basic_string_wchar *str, wchar_t delim)
9608 {
9609     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9610     IOSB_iostate state = IOSTATE_goodbit;
9611     int c = delim;
9612
9613     TRACE("(%p %p %c)\n", istream, str, delim);
9614
9615     if(basic_istream_wchar_sentry_create(istream, TRUE)) {
9616         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9617         MSVCP_basic_string_wchar_clear(str);
9618
9619         c = basic_streambuf_wchar_sgetc(strbuf);
9620         for(; c!=delim && c!=WEOF; c = basic_streambuf_wchar_snextc(strbuf))
9621             MSVCP_basic_string_wchar_append_ch(str, c);
9622         if(c==delim) basic_streambuf_wchar_sbumpc(strbuf);
9623         else if(c==WEOF) state |= IOSTATE_eofbit;
9624
9625         if(!MSVCP_basic_string_wchar_length(str) && c!=delim) state |= IOSTATE_failbit;
9626     }
9627     basic_istream_wchar_sentry_destroy(istream);
9628
9629     basic_ios_wchar_setstate(basic_istream_wchar_get_basic_ios(istream), state);
9630     return istream;
9631 }
9632
9633 /* ??$getline@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
9634 /* ??$getline@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
9635 /* ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
9636 /* ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
9637 basic_istream_wchar* __cdecl basic_istream_wchar_getline_bstr(
9638         basic_istream_wchar *istream, basic_string_wchar *str)
9639 {
9640     return basic_istream_wchar_getline_bstr_delim(istream, str, '\n');
9641 }
9642
9643 static basic_istream_wchar* basic_istream_read_bstr(basic_istream_wchar *istream,
9644         basic_string_wchar *str, const ctype_wchar *ctype)
9645 {
9646     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9647     IOSB_iostate state = IOSTATE_failbit;
9648     int c = '\n';
9649
9650     TRACE("(%p %p)\n", istream, str);
9651
9652     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9653         MSVCP_size_t count = ios_base_width_get(&base->base);
9654
9655         if(!count)
9656             count = -1;
9657
9658         MSVCP_basic_string_wchar_clear(str);
9659
9660         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
9661                 c!=WEOF && !ctype_wchar_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
9662                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base)), count--) {
9663             state = IOSTATE_goodbit;
9664             MSVCP_basic_string_wchar_append_ch(str, c);
9665         }
9666     }
9667     basic_istream_wchar_sentry_destroy(istream);
9668
9669     ios_base_width_set(&base->base, 0);
9670     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9671     return istream;
9672 }
9673
9674 /* ??$?5_WU?$char_traits@_W@std@@V?$allocator@_W@1@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
9675 /* ??$?5_WU?$char_traits@_W@std@@V?$allocator@_W@1@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
9676 basic_istream_wchar* __cdecl basic_istream_wchar_read_bstr(
9677         basic_istream_wchar *istream, basic_string_wchar *str)
9678 {
9679     return basic_istream_read_bstr(istream, str, ctype_wchar_use_facet(
9680                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9681 }
9682
9683 /* ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
9684 /* ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
9685 basic_istream_wchar* __cdecl basic_istream_short_read_bstr(
9686         basic_istream_wchar *istream, basic_string_wchar *str)
9687 {
9688     return basic_istream_read_bstr(istream, str, ctype_short_use_facet(
9689                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9690 }
9691
9692 static basic_istream_wchar* basic_istream_read_str(basic_istream_wchar *istream, wchar_t *str, const ctype_wchar *ctype)
9693 {
9694     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9695     IOSB_iostate state = IOSTATE_failbit;
9696     unsigned short c = '\n';
9697
9698     TRACE("(%p %p)\n", istream, str);
9699
9700     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9701         MSVCP_size_t count = ios_base_width_get(&base->base)-1;
9702
9703         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
9704                 c!=WEOF && !ctype_wchar_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
9705                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base)), count--) {
9706             state = IOSTATE_goodbit;
9707             *str++ = c;
9708         }
9709     }
9710     basic_istream_wchar_sentry_destroy(istream);
9711
9712     *str = 0;
9713     ios_base_width_set(&base->base, 0);
9714     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9715     return istream;
9716 }
9717
9718 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@PA_W@Z */
9719 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@PEA_W@Z */
9720 basic_istream_wchar* __cdecl basic_istream_wchar_read_str(basic_istream_wchar *istream, wchar_t *str)
9721 {
9722     return basic_istream_read_str(istream, str, ctype_wchar_use_facet(
9723                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9724 }
9725
9726 /* ??$?5GU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@PAG@Z */
9727 /* ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@PEAG@Z */
9728 basic_istream_wchar* __cdecl basic_istream_short_read_str(basic_istream_wchar *istream, wchar_t *str)
9729 {
9730     return basic_istream_read_str(istream, str, ctype_short_use_facet(
9731                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9732 }
9733
9734 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AA_W@Z */
9735 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEA_W@Z */
9736 /* ??$?5GU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAG@Z */
9737 /* ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAG@Z */
9738 basic_istream_wchar* __cdecl basic_istream_wchar_read_ch(basic_istream_wchar *istream, wchar_t *ch)
9739 {
9740     IOSB_iostate state = IOSTATE_failbit;
9741     unsigned short c = 0;
9742
9743     TRACE("(%p %p)\n", istream, ch);
9744
9745     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9746         c = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(
9747                     basic_istream_wchar_get_basic_ios(istream)));
9748         if(c != WEOF) {
9749             state = IOSTATE_goodbit;
9750             *ch = c;
9751         }
9752     }
9753     basic_istream_wchar_sentry_destroy(istream);
9754
9755     basic_ios_wchar_setstate(basic_istream_wchar_get_basic_ios(istream),
9756             state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9757     return istream;
9758 }
9759
9760 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9761 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9762 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9763 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9764 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_streambuf, 8)
9765 basic_istream_wchar* __thiscall basic_istream_wchar_read_streambuf(
9766         basic_istream_wchar *this, basic_streambuf_wchar *streambuf)
9767 {
9768     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9769     IOSB_iostate state = IOSTATE_failbit;
9770     unsigned short c = '\n';
9771
9772     TRACE("(%p %p)\n", this, streambuf);
9773
9774     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9775         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base)); c!=WEOF;
9776                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base))) {
9777             state = IOSTATE_goodbit;
9778             if(basic_streambuf_wchar_sputc(streambuf, c) == WEOF)
9779                 break;
9780         }
9781     }
9782     basic_istream_wchar_sentry_destroy(this);
9783
9784     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9785     return this;
9786 }
9787
9788 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
9789 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
9790 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
9791 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
9792 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func, 8)
9793 basic_istream_wchar* __thiscall basic_istream_wchar_read_func(basic_istream_wchar *this,
9794         basic_istream_wchar* (__cdecl *pfunc)(basic_istream_wchar*))
9795 {
9796     TRACE("(%p %p)\n", this, pfunc);
9797     pfunc(this);
9798     return this;
9799 }
9800
9801 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
9802 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
9803 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
9804 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
9805 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_basic_ios, 8)
9806 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_basic_ios(basic_istream_wchar *this,
9807         basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
9808 {
9809     TRACE("(%p %p)\n", this, pfunc);
9810     pfunc(basic_istream_wchar_get_basic_ios(this));
9811     return this;
9812 }
9813
9814 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
9815 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
9816 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
9817 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
9818 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_ios_base, 8)
9819 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_ios_base(
9820         basic_istream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
9821 {
9822     TRACE("(%p %p)\n", this, pfunc);
9823     pfunc(&basic_istream_wchar_get_basic_ios(this)->base);
9824     return this;
9825 }
9826
9827 static inline basic_ios_char* basic_iostream_char_to_basic_ios(basic_iostream_char *ptr)
9828 {
9829     return (basic_ios_char*)((char*)ptr+basic_iostream_char_vbtable1[1]);
9830 }
9831
9832 static inline basic_iostream_char* basic_iostream_char_from_basic_ios(basic_ios_char *ptr)
9833 {
9834     return (basic_iostream_char*)((char*)ptr-basic_iostream_char_vbtable1[1]);
9835 }
9836
9837 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
9838 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
9839 DEFINE_THISCALL_WRAPPER(basic_iostream_char_ctor, 12)
9840 basic_iostream_char* __thiscall basic_iostream_char_ctor(basic_iostream_char *this, basic_streambuf_char *strbuf, MSVCP_bool virt_init)
9841 {
9842     basic_ios_char *basic_ios;
9843
9844     TRACE("(%p %p %d)\n", this, strbuf, virt_init);
9845
9846     if(virt_init) {
9847         this->base1.vbtable = basic_iostream_char_vbtable1;
9848         this->base2.vbtable = basic_iostream_char_vbtable2;
9849         basic_ios = basic_istream_char_get_basic_ios(&this->base1);
9850         basic_ios_char_ctor(basic_ios);
9851     }else {
9852         basic_ios = basic_istream_char_get_basic_ios(&this->base1);
9853     }
9854
9855     basic_ios->base.vtable = &MSVCP_basic_iostream_char_vtable;
9856
9857     basic_istream_char_ctor(&this->base1, strbuf, FALSE, FALSE);
9858     basic_ostream_char_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
9859     return this;
9860 }
9861
9862 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
9863 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
9864 DEFINE_THISCALL_WRAPPER(basic_iostream_char_dtor, 4)
9865 void __thiscall basic_iostream_char_dtor(basic_ios_char *base)
9866 {
9867     basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
9868
9869     TRACE("(%p)\n", this);
9870     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base2));
9871     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base1));
9872 }
9873
9874 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
9875 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
9876 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vbase_dtor, 4)
9877 void __thiscall basic_iostream_char_vbase_dtor(basic_iostream_char *this)
9878 {
9879     TRACE("(%p)\n", this);
9880     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(this));
9881     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base1));
9882 }
9883
9884 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vector_dtor, 8)
9885 basic_iostream_char* __thiscall basic_iostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
9886 {
9887     basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
9888
9889     TRACE("(%p %x)\n", this, flags);
9890
9891     if(flags & 2) {
9892         /* we have an array, with the number of elements stored before the first object */
9893         INT_PTR i, *ptr = (INT_PTR *)this-1;
9894
9895         for(i=*ptr-1; i>=0; i--)
9896             basic_iostream_char_vbase_dtor(this+i);
9897         MSVCRT_operator_delete(ptr);
9898     } else {
9899         basic_iostream_char_vbase_dtor(this);
9900         if(flags & 1)
9901             MSVCRT_operator_delete(this);
9902     }
9903
9904     return this;
9905 }
9906
9907 static inline basic_ios_wchar* basic_iostream_wchar_to_basic_ios(basic_iostream_wchar *ptr)
9908 {
9909     return (basic_ios_wchar*)((char*)ptr+basic_iostream_wchar_vbtable1[1]);
9910 }
9911
9912 static inline basic_iostream_wchar* basic_iostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
9913 {
9914     return (basic_iostream_wchar*)((char*)ptr-basic_iostream_wchar_vbtable1[1]);
9915 }
9916
9917 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9918 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9919 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_ctor, 12)
9920 basic_iostream_wchar* __thiscall basic_iostream_wchar_ctor(basic_iostream_wchar *this,
9921         basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
9922 {
9923     basic_ios_wchar *basic_ios;
9924
9925     TRACE("(%p %p %d)\n", this, strbuf, virt_init);
9926
9927     if(virt_init) {
9928         this->base1.vbtable = basic_iostream_wchar_vbtable1;
9929         this->base2.vbtable = basic_iostream_wchar_vbtable2;
9930         basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
9931         basic_ios_wchar_ctor(basic_ios);
9932     }else {
9933         basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
9934     }
9935
9936     basic_istream_wchar_ctor(&this->base1, strbuf, FALSE, FALSE);
9937     basic_ostream_wchar_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
9938
9939     basic_ios->base.vtable = &MSVCP_basic_iostream_wchar_vtable;
9940     return this;
9941 }
9942
9943 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9944 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9945 DEFINE_THISCALL_WRAPPER(basic_iostream_short_ctor, 12)
9946 basic_iostream_wchar* __thiscall basic_iostream_short_ctor(basic_iostream_wchar *this,
9947         basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
9948 {
9949     basic_iostream_wchar_ctor(this, strbuf, virt_init);
9950     basic_istream_wchar_get_basic_ios(&this->base1)->base.vtable = &MSVCP_basic_iostream_short_vtable;
9951     return this;
9952 }
9953
9954 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
9955 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
9956 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
9957 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
9958 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_dtor, 4)
9959 void __thiscall basic_iostream_wchar_dtor(basic_ios_wchar *base)
9960 {
9961     basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
9962
9963     TRACE("(%p)\n", this);
9964     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base2));
9965     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base1));
9966 }
9967
9968 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
9969 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
9970 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
9971 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
9972 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vbase_dtor, 4)
9973 void __thiscall basic_iostream_wchar_vbase_dtor(basic_iostream_wchar *this)
9974 {
9975     TRACE("(%p)\n", this);
9976     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(this));
9977     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base1));
9978 }
9979
9980 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vector_dtor, 8)
9981 basic_iostream_wchar* __thiscall basic_iostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
9982 {
9983     basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
9984
9985     TRACE("(%p %x)\n", this, flags);
9986
9987     if(flags & 2) {
9988         /* we have an array, with the number of elements stored before the first object */
9989         INT_PTR i, *ptr = (INT_PTR *)this-1;
9990
9991         for(i=*ptr-1; i>=0; i--)
9992             basic_iostream_wchar_vbase_dtor(this+i);
9993         MSVCRT_operator_delete(ptr);
9994     } else {
9995         basic_iostream_wchar_vbase_dtor(this);
9996         if(flags & 1)
9997             MSVCRT_operator_delete(this);
9998     }
9999
10000     return this;
10001 }
10002
10003 static inline basic_ios_char* basic_ofstream_char_to_basic_ios(basic_ofstream_char *ptr)
10004 {
10005     return (basic_ios_char*)((char*)ptr+basic_ofstream_char_vbtable[1]);
10006 }
10007
10008 static inline basic_ofstream_char* basic_ofstream_char_from_basic_ios(basic_ios_char *ptr)
10009 {
10010     return (basic_ofstream_char*)((char*)ptr-basic_ofstream_char_vbtable[1]);
10011 }
10012
10013 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
10014 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
10015 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor, 8)
10016 basic_ofstream_char* __thiscall basic_ofstream_char_ctor(basic_ofstream_char *this, MSVCP_bool virt_init)
10017 {
10018     basic_ios_char *basic_ios;
10019
10020     TRACE("(%p %d)\n", this, virt_init);
10021
10022     if(virt_init) {
10023         this->base.vbtable = basic_ofstream_char_vbtable;
10024         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10025         basic_ios_char_ctor(basic_ios);
10026     }else {
10027         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10028     }
10029
10030     basic_filebuf_char_ctor(&this->filebuf);
10031     basic_ostream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10032     basic_ios->base.vtable = &MSVCP_basic_ofstream_char_vtable;
10033     return this;
10034 }
10035
10036 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
10037 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10038 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_file, 12)
10039 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_file(
10040         basic_ofstream_char *this, FILE *file, MSVCP_bool virt_init)
10041 {
10042     basic_ios_char *basic_ios;
10043
10044     TRACE("(%p %p %d)\n", this, file, virt_init);
10045
10046     if(virt_init) {
10047         this->base.vbtable = basic_ofstream_char_vbtable;
10048         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10049         basic_ios_char_ctor(basic_ios);
10050     }else {
10051         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10052     }
10053
10054     basic_filebuf_char_ctor_file(&this->filebuf, file);
10055     basic_ostream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10056     basic_ios->base.vtable = &MSVCP_basic_ofstream_char_vtable;
10057     return this;
10058 }
10059
10060 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
10061 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
10062 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_name, 20)
10063 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_name(basic_ofstream_char *this,
10064         const char *name, int mode, int prot, MSVCP_bool virt_init)
10065 {
10066     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10067
10068     basic_ofstream_char_ctor(this, virt_init);
10069
10070     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10071         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10072         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10073     }
10074     return this;
10075 }
10076
10077 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
10078 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
10079 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
10080 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
10081 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_name_wchar, 20)
10082 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_name_wchar(basic_ofstream_char *this,
10083         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10084 {
10085     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10086
10087     basic_ofstream_char_ctor(this, virt_init);
10088
10089     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10090         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10091         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10092     }
10093     return this;
10094 }
10095
10096 /* ??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
10097 /* ??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
10098 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_dtor, 4)
10099 void __thiscall basic_ofstream_char_dtor(basic_ios_char *base)
10100 {
10101     basic_ofstream_char *this = basic_ofstream_char_from_basic_ios(base);
10102
10103     TRACE("(%p)\n", this);
10104
10105     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
10106     basic_filebuf_char_dtor(&this->filebuf);
10107 }
10108
10109 /* ??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10110 /* ??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10111 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_vbase_dtor, 4)
10112 void __thiscall basic_ofstream_char_vbase_dtor(basic_ofstream_char *this)
10113 {
10114     TRACE("(%p)\n", this);
10115
10116     basic_ofstream_char_dtor(basic_ofstream_char_to_basic_ios(this));
10117     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
10118 }
10119
10120 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_vector_dtor, 8)
10121 basic_ofstream_char* __thiscall basic_ofstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
10122 {
10123     basic_ofstream_char *this = basic_ofstream_char_from_basic_ios(base);
10124
10125     TRACE("(%p %x)\n", this, flags);
10126
10127     if(flags & 2) {
10128         /* we have an array, with the number of elements stored before the first object */
10129         INT_PTR i, *ptr = (INT_PTR *)this-1;
10130
10131         for(i=*ptr-1; i>=0; i--)
10132             basic_ofstream_char_vbase_dtor(this+i);
10133         MSVCRT_operator_delete(ptr);
10134     } else {
10135         basic_ofstream_char_vbase_dtor(this);
10136         if(flags & 1)
10137             MSVCRT_operator_delete(this);
10138     }
10139
10140     return this;
10141 }
10142
10143 /* ?close@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10144 /* ?close@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10145 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_close, 4)
10146 void __thiscall basic_ofstream_char_close(basic_ofstream_char *this)
10147 {
10148     TRACE("(%p)\n", this);
10149
10150     if(!basic_filebuf_char_close(&this->filebuf)) {
10151         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10152         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10153     }
10154 }
10155
10156 /* ?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
10157 /* ?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
10158 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_is_open, 4)
10159 MSVCP_bool __thiscall basic_ofstream_char_is_open(const basic_ofstream_char *this)
10160 {
10161     TRACE("(%p)\n", this);
10162     return basic_filebuf_char_is_open(&this->filebuf);
10163 }
10164
10165 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
10166 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
10167 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open, 16)
10168 void __thiscall basic_ofstream_char_open(basic_ofstream_char *this,
10169         const char *name, int mode, int prot)
10170 {
10171     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10172
10173     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10174         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10175         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10176     }
10177 }
10178
10179 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
10180 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
10181 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_old, 12)
10182 void __thiscall basic_ofstream_char_open_old(basic_ofstream_char *this,
10183         const char *name, unsigned int mode)
10184 {
10185     basic_ofstream_char_open(this, name, mode, _SH_DENYNO);
10186 }
10187
10188 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
10189 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
10190 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
10191 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
10192 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_wchar, 16)
10193 void __thiscall basic_ofstream_char_open_wchar(basic_ofstream_char *this,
10194         const wchar_t *name, int mode, int prot)
10195 {
10196     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10197
10198     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10199         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10200         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10201     }
10202 }
10203
10204 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
10205 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
10206 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
10207 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
10208 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_wchar_old, 12)
10209 void __thiscall basic_ofstream_char_open_wchar_old(basic_ofstream_char *this,
10210         const wchar_t *name, unsigned int mode)
10211 {
10212     basic_ofstream_char_open_wchar(this, name, mode, _SH_DENYNO);
10213 }
10214
10215 /* ?rdbuf@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10216 /* ?rdbuf@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10217 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_rdbuf, 4)
10218 basic_filebuf_char* __thiscall basic_ofstream_char_rdbuf(const basic_ofstream_char *this)
10219 {
10220     TRACE("(%p)\n", this);
10221     return (basic_filebuf_char*)&this->filebuf;
10222 }
10223
10224 static inline basic_ios_wchar* basic_ofstream_wchar_to_basic_ios(basic_ofstream_wchar *ptr)
10225 {
10226     return (basic_ios_wchar*)((char*)ptr+basic_ofstream_wchar_vbtable[1]);
10227 }
10228
10229 static inline basic_ofstream_wchar* basic_ofstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
10230 {
10231     return (basic_ofstream_wchar*)((char*)ptr-basic_ofstream_wchar_vbtable[1]);
10232 }
10233
10234 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
10235 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
10236 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor, 8)
10237 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor(basic_ofstream_wchar *this, MSVCP_bool virt_init)
10238 {
10239     basic_ios_wchar *basic_ios;
10240
10241     TRACE("(%p %d)\n", this, virt_init);
10242
10243     if(virt_init) {
10244         this->base.vbtable = basic_ofstream_wchar_vbtable;
10245         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10246         basic_ios_wchar_ctor(basic_ios);
10247     }else {
10248         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10249     }
10250
10251     basic_filebuf_wchar_ctor(&this->filebuf);
10252     basic_ostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10253     basic_ios->base.vtable = &MSVCP_basic_ofstream_wchar_vtable;
10254     return this;
10255 }
10256
10257 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
10258 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
10259 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor, 8)
10260 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor(basic_ofstream_wchar *this, MSVCP_bool virt_init)
10261 {
10262     basic_ofstream_wchar_ctor(this, virt_init);
10263     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10264     return this;
10265 }
10266
10267 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
10268 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10269 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_file, 12)
10270 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_file(
10271         basic_ofstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10272 {
10273     basic_ios_wchar *basic_ios;
10274
10275     TRACE("(%p %p %d)\n", this, file, virt_init);
10276
10277     if(virt_init) {
10278         this->base.vbtable = basic_ofstream_wchar_vbtable;
10279         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10280         basic_ios_wchar_ctor(basic_ios);
10281     }else {
10282         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10283     }
10284
10285     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
10286     basic_ostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10287     basic_ios->base.vtable = &MSVCP_basic_ofstream_wchar_vtable;
10288     return this;
10289 }
10290
10291 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
10292 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10293 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_file, 12)
10294 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_file(
10295         basic_ofstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10296 {
10297     basic_ofstream_wchar_ctor_file(this, file, virt_init);
10298     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10299     return this;
10300 }
10301
10302 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PBDHH@Z */
10303 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBDHH@Z */
10304 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_name, 20)
10305 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_name(basic_ofstream_wchar *this,
10306         const char *name, int mode, int prot, MSVCP_bool virt_init)
10307 {
10308     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10309
10310     basic_ofstream_wchar_ctor(this, virt_init);
10311
10312     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10313         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10314         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10315     }
10316     return this;
10317 }
10318
10319 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PBDHH@Z */
10320 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEBDHH@Z */
10321 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_name, 20)
10322 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_name(basic_ofstream_wchar *this,
10323         const char *name, int mode, int prot, MSVCP_bool virt_init)
10324 {
10325     basic_ofstream_wchar_ctor_name(this, name, mode, prot, virt_init);
10326     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10327     return this;
10328 }
10329
10330 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
10331 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
10332 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
10333 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
10334 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_name_wchar, 20)
10335 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_name_wchar(basic_ofstream_wchar *this,
10336         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10337 {
10338     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10339
10340     basic_ofstream_wchar_ctor(this, virt_init);
10341
10342     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10343         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10344         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10345     }
10346     return this;
10347 }
10348
10349 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
10350 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
10351 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
10352 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
10353 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_name_wchar, 20)
10354 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_name_wchar(basic_ofstream_wchar *this,
10355         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10356 {
10357     basic_ofstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
10358     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10359     return this;
10360 }
10361
10362 /* ??1?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
10363 /* ??1?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
10364 /* ??1?$basic_ofstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
10365 /* ??1?$basic_ofstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
10366 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_dtor, 4)
10367 void __thiscall basic_ofstream_wchar_dtor(basic_ios_wchar *base)
10368 {
10369     basic_ofstream_wchar *this = basic_ofstream_wchar_from_basic_ios(base);
10370
10371     TRACE("(%p)\n", this);
10372
10373     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base));
10374     basic_filebuf_wchar_dtor(&this->filebuf);
10375 }
10376
10377 /* ??_D?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10378 /* ??_D?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10379 /* ??_D?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10380 /* ??_D?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10381 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_vbase_dtor, 4)
10382 void __thiscall basic_ofstream_wchar_vbase_dtor(basic_ofstream_wchar *this)
10383 {
10384     TRACE("(%p)\n", this);
10385
10386     basic_ofstream_wchar_dtor(basic_ofstream_wchar_to_basic_ios(this));
10387     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(&this->base));
10388 }
10389
10390 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_vector_dtor, 8)
10391 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
10392 {
10393     basic_ofstream_wchar *this = basic_ofstream_wchar_from_basic_ios(base);
10394
10395     TRACE("(%p %x)\n", this, flags);
10396
10397     if(flags & 2) {
10398         /* we have an array, with the number of elements stored before the first object */
10399         INT_PTR i, *ptr = (INT_PTR *)this-1;
10400
10401         for(i=*ptr-1; i>=0; i--)
10402             basic_ofstream_wchar_vbase_dtor(this+i);
10403         MSVCRT_operator_delete(ptr);
10404     } else {
10405         basic_ofstream_wchar_vbase_dtor(this);
10406         if(flags & 1)
10407             MSVCRT_operator_delete(this);
10408     }
10409
10410     return this;
10411 }
10412
10413 /* ?close@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10414 /* ?close@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10415 /* ?close@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10416 /* ?close@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10417 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_close, 4)
10418 void __thiscall basic_ofstream_wchar_close(basic_ofstream_wchar *this)
10419 {
10420     TRACE("(%p)\n", this);
10421
10422     if(!basic_filebuf_wchar_close(&this->filebuf)) {
10423         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10424         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10425     }
10426 }
10427
10428 /* ?is_open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
10429 /* ?is_open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
10430 /* ?is_open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
10431 /* ?is_open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
10432 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_is_open, 4)
10433 MSVCP_bool __thiscall basic_ofstream_wchar_is_open(const basic_ofstream_wchar *this)
10434 {
10435     TRACE("(%p)\n", this);
10436     return basic_filebuf_wchar_is_open(&this->filebuf);
10437 }
10438
10439 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
10440 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
10441 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
10442 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
10443 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open, 16)
10444 void __thiscall basic_ofstream_wchar_open(basic_ofstream_wchar *this,
10445         const char *name, int mode, int prot)
10446 {
10447     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10448
10449     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10450         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10451         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10452     }
10453 }
10454
10455 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
10456 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
10457 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
10458 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
10459 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_old, 12)
10460 void __thiscall basic_ofstream_wchar_open_old(basic_ofstream_wchar *this,
10461         const char *name, unsigned int mode)
10462 {
10463     basic_ofstream_wchar_open(this, name, mode, _SH_DENYNO);
10464 }
10465
10466 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
10467 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
10468 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
10469 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
10470 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
10471 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
10472 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
10473 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
10474 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_wchar, 16)
10475 void __thiscall basic_ofstream_wchar_open_wchar(basic_ofstream_wchar *this,
10476         const wchar_t *name, int mode, int prot)
10477 {
10478     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10479
10480     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10481         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10482         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10483     }
10484 }
10485
10486 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
10487 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
10488 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
10489 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
10490 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
10491 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
10492 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
10493 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
10494 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_wchar_old, 12)
10495 void __thiscall basic_ofstream_wchar_open_wchar_old(basic_ofstream_wchar *this,
10496         const wchar_t *name, unsigned int mode)
10497 {
10498     basic_ofstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
10499 }
10500
10501 /* ?rdbuf@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10502 /* ?rdbuf@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10503 /* ?rdbuf@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10504 /* ?rdbuf@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10505 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_rdbuf, 4)
10506 basic_filebuf_wchar* __thiscall basic_ofstream_wchar_rdbuf(const basic_ofstream_wchar *this)
10507 {
10508     TRACE("(%p)\n", this);
10509     return (basic_filebuf_wchar*)&this->filebuf;
10510 }
10511
10512 static inline basic_ios_char* basic_ifstream_char_to_basic_ios(basic_ifstream_char *ptr)
10513 {
10514     return (basic_ios_char*)((char*)ptr+basic_ifstream_char_vbtable[1]);
10515 }
10516
10517 static inline basic_ifstream_char* basic_ifstream_char_from_basic_ios(basic_ios_char *ptr)
10518 {
10519     return (basic_ifstream_char*)((char*)ptr-basic_ifstream_char_vbtable[1]);
10520 }
10521
10522 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
10523 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
10524 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor, 8)
10525 basic_ifstream_char* __thiscall basic_ifstream_char_ctor(basic_ifstream_char *this, MSVCP_bool virt_init)
10526 {
10527     basic_ios_char *basic_ios;
10528
10529     TRACE("(%p %d)\n", this, virt_init);
10530
10531     if(virt_init) {
10532         this->base.vbtable = basic_ifstream_char_vbtable;
10533         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10534         basic_ios_char_ctor(basic_ios);
10535     }else {
10536         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10537     }
10538
10539     basic_filebuf_char_ctor(&this->filebuf);
10540     basic_istream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10541     basic_ios->base.vtable = &MSVCP_basic_ifstream_char_vtable;
10542     return this;
10543 }
10544
10545 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
10546 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10547 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_file, 12)
10548 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_file(
10549         basic_ifstream_char *this, FILE *file, MSVCP_bool virt_init)
10550 {
10551     basic_ios_char *basic_ios;
10552
10553     TRACE("(%p %p %d)\n", this, file, virt_init);
10554
10555     if(virt_init) {
10556         this->base.vbtable = basic_ifstream_char_vbtable;
10557         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10558         basic_ios_char_ctor(basic_ios);
10559     }else {
10560         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10561     }
10562
10563     basic_filebuf_char_ctor_file(&this->filebuf, file);
10564     basic_istream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10565     basic_ios->base.vtable = &MSVCP_basic_ifstream_char_vtable;
10566     return this;
10567 }
10568
10569 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
10570 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
10571 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_name, 20)
10572 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_name(basic_ifstream_char *this,
10573         const char *name, int mode, int prot, MSVCP_bool virt_init)
10574 {
10575     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10576
10577     basic_ifstream_char_ctor(this, virt_init);
10578
10579     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10580         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10581         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10582     }
10583     return this;
10584 }
10585
10586 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
10587 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
10588 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
10589 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
10590 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_name_wchar, 20)
10591 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_name_wchar(basic_ifstream_char *this,
10592         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10593 {
10594     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10595
10596     basic_ifstream_char_ctor(this, virt_init);
10597
10598     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10599         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10600         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10601     }
10602     return this;
10603 }
10604
10605 /* ??1?$basic_ifstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
10606 /* ??1?$basic_ifstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
10607 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_dtor, 4)
10608 void __thiscall basic_ifstream_char_dtor(basic_ios_char *base)
10609 {
10610     basic_ifstream_char *this = basic_ifstream_char_from_basic_ios(base);
10611
10612     TRACE("(%p)\n", this);
10613
10614     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
10615     basic_filebuf_char_dtor(&this->filebuf);
10616 }
10617
10618 /* ??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10619 /* ??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10620 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vbase_dtor, 4)
10621 void __thiscall basic_ifstream_char_vbase_dtor(basic_ifstream_char *this)
10622 {
10623     TRACE("(%p)\n", this);
10624
10625     basic_ifstream_char_dtor(basic_ifstream_char_to_basic_ios(this));
10626     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base));
10627 }
10628
10629 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vector_dtor, 8)
10630 basic_ifstream_char* __thiscall basic_ifstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
10631 {
10632     basic_ifstream_char *this = basic_ifstream_char_from_basic_ios(base);
10633
10634     TRACE("(%p %x)\n", this, flags);
10635
10636     if(flags & 2) {
10637         /* we have an array, with the number of elements stored before the first object */
10638         INT_PTR i, *ptr = (INT_PTR *)this-1;
10639
10640         for(i=*ptr-1; i>=0; i--)
10641             basic_ifstream_char_vbase_dtor(this+i);
10642         MSVCRT_operator_delete(ptr);
10643     } else {
10644         basic_ifstream_char_vbase_dtor(this);
10645         if(flags & 1)
10646             MSVCRT_operator_delete(this);
10647     }
10648
10649     return this;
10650 }
10651
10652 /* ?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10653 /* ?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10654 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_close, 4)
10655 void __thiscall basic_ifstream_char_close(basic_ifstream_char *this)
10656 {
10657     TRACE("(%p)\n", this);
10658
10659     if(!basic_filebuf_char_close(&this->filebuf)) {
10660         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10661         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10662     }
10663 }
10664
10665 /* ?is_open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
10666 /* ?is_open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
10667 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_is_open, 4)
10668 MSVCP_bool __thiscall basic_ifstream_char_is_open(const basic_ifstream_char *this)
10669 {
10670     TRACE("(%p)\n", this);
10671     return basic_filebuf_char_is_open(&this->filebuf);
10672 }
10673
10674 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
10675 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
10676 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open, 16)
10677 void __thiscall basic_ifstream_char_open(basic_ifstream_char *this,
10678         const char *name, int mode, int prot)
10679 {
10680     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10681
10682     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10683         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10684         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10685     }
10686 }
10687
10688 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
10689 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
10690 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_old, 12)
10691 void __thiscall basic_ifstream_char_open_old(basic_ifstream_char *this,
10692         const char *name, unsigned int mode)
10693 {
10694     basic_ifstream_char_open(this, name, mode, _SH_DENYNO);
10695 }
10696
10697 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
10698 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
10699 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
10700 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
10701 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_wchar, 16)
10702 void __thiscall basic_ifstream_char_open_wchar(basic_ifstream_char *this,
10703         const wchar_t *name, int mode, int prot)
10704 {
10705     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10706
10707     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10708         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10709         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10710     }
10711 }
10712
10713 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
10714 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
10715 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
10716 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
10717 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_wchar_old, 12)
10718 void __thiscall basic_ifstream_char_open_wchar_old(basic_ifstream_char *this,
10719         const wchar_t *name, unsigned int mode)
10720 {
10721     basic_ifstream_char_open_wchar(this, name, mode, _SH_DENYNO);
10722 }
10723
10724 /* ?rdbuf@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10725 /* ?rdbuf@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10726 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_rdbuf, 4)
10727 basic_filebuf_char* __thiscall basic_ifstream_char_rdbuf(const basic_ifstream_char *this)
10728 {
10729     TRACE("(%p)\n", this);
10730     return (basic_filebuf_char*)&this->filebuf;
10731 }
10732
10733 static inline basic_ios_wchar* basic_ifstream_wchar_to_basic_ios(basic_ifstream_wchar *ptr)
10734 {
10735     return (basic_ios_wchar*)((char*)ptr+basic_ifstream_wchar_vbtable[1]);
10736 }
10737
10738 static inline basic_ifstream_wchar* basic_ifstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
10739 {
10740     return (basic_ifstream_wchar*)((char*)ptr-basic_ifstream_wchar_vbtable[1]);
10741 }
10742
10743 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
10744 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
10745 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor, 8)
10746 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor(basic_ifstream_wchar *this, MSVCP_bool virt_init)
10747 {
10748     basic_ios_wchar *basic_ios;
10749
10750     TRACE("(%p %d)\n", this, virt_init);
10751
10752     if(virt_init) {
10753         this->base.vbtable = basic_ifstream_wchar_vbtable;
10754         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10755         basic_ios_wchar_ctor(basic_ios);
10756     }else {
10757         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10758     }
10759
10760     basic_filebuf_wchar_ctor(&this->filebuf);
10761     basic_istream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10762     basic_ios->base.vtable = &MSVCP_basic_ifstream_wchar_vtable;
10763     return this;
10764 }
10765
10766 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
10767 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
10768 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor, 8)
10769 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor(basic_ifstream_wchar *this, MSVCP_bool virt_init)
10770 {
10771     basic_ifstream_wchar_ctor(this, virt_init);
10772     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10773     return this;
10774 }
10775
10776 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
10777 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10778 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_file, 12)
10779 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_file(
10780         basic_ifstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10781 {
10782     basic_ios_wchar *basic_ios;
10783
10784     TRACE("(%p %p %d)\n", this, file, virt_init);
10785
10786     if(virt_init) {
10787         this->base.vbtable = basic_ifstream_wchar_vbtable;
10788         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10789         basic_ios_wchar_ctor(basic_ios);
10790     }else {
10791         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10792     }
10793
10794     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
10795     basic_istream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10796     basic_ios->base.vtable = &MSVCP_basic_ifstream_wchar_vtable;
10797     return this;
10798 }
10799
10800 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
10801 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10802 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_file, 12)
10803 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_file(
10804         basic_ifstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10805 {
10806     basic_ifstream_wchar_ctor_file(this, file, virt_init);
10807     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10808     return this;
10809 }
10810
10811 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PBDHH@Z */
10812 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBDHH@Z */
10813 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_name, 20)
10814 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_name(basic_ifstream_wchar *this,
10815         const char *name, int mode, int prot, MSVCP_bool virt_init)
10816 {
10817     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10818
10819     basic_ifstream_wchar_ctor(this, virt_init);
10820
10821     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10822         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10823         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10824     }
10825     return this;
10826 }
10827
10828 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PBDHH@Z */
10829 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEBDHH@Z */
10830 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_name, 20)
10831 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_name(basic_ifstream_wchar *this,
10832         const char *name, int mode, int prot, MSVCP_bool virt_init)
10833 {
10834     basic_ifstream_wchar_ctor_name(this, name, mode, prot, virt_init);
10835     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10836     return this;
10837 }
10838
10839 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
10840 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
10841 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
10842 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
10843 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_name_wchar, 20)
10844 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_name_wchar(basic_ifstream_wchar *this,
10845         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10846 {
10847     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10848
10849     basic_ifstream_wchar_ctor(this, virt_init);
10850
10851     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10852         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10853         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10854     }
10855     return this;
10856 }
10857
10858 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
10859 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
10860 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
10861 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
10862 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_name_wchar, 20)
10863 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_name_wchar(basic_ifstream_wchar *this,
10864         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10865 {
10866     basic_ifstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
10867     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10868     return this;
10869 }
10870
10871 /* ??1?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
10872 /* ??1?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
10873 /* ??1?$basic_ifstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
10874 /* ??1?$basic_ifstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
10875 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_dtor, 4)
10876 void __thiscall basic_ifstream_wchar_dtor(basic_ios_wchar *base)
10877 {
10878     basic_ifstream_wchar *this = basic_ifstream_wchar_from_basic_ios(base);
10879
10880     TRACE("(%p)\n", this);
10881
10882     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base));
10883     basic_filebuf_wchar_dtor(&this->filebuf);
10884 }
10885
10886 /* ??_D?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10887 /* ??_D?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10888 /* ??_D?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10889 /* ??_D?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10890 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_vbase_dtor, 4)
10891 void __thiscall basic_ifstream_wchar_vbase_dtor(basic_ifstream_wchar *this)
10892 {
10893     TRACE("(%p)\n", this);
10894
10895     basic_ifstream_wchar_dtor(basic_ifstream_wchar_to_basic_ios(this));
10896     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base));
10897 }
10898
10899 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_vector_dtor, 8)
10900 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
10901 {
10902     basic_ifstream_wchar *this = basic_ifstream_wchar_from_basic_ios(base);
10903
10904     TRACE("(%p %x)\n", this, flags);
10905
10906     if(flags & 2) {
10907         /* we have an array, with the number of elements stored before the first object */
10908         INT_PTR i, *ptr = (INT_PTR *)this-1;
10909
10910         for(i=*ptr-1; i>=0; i--)
10911             basic_ifstream_wchar_vbase_dtor(this+i);
10912         MSVCRT_operator_delete(ptr);
10913     } else {
10914         basic_ifstream_wchar_vbase_dtor(this);
10915         if(flags & 1)
10916             MSVCRT_operator_delete(this);
10917     }
10918
10919     return this;
10920 }
10921
10922 /* ?close@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10923 /* ?close@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10924 /* ?close@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10925 /* ?close@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10926 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_close, 4)
10927 void __thiscall basic_ifstream_wchar_close(basic_ifstream_wchar *this)
10928 {
10929     TRACE("(%p)\n", this);
10930
10931     if(!basic_filebuf_wchar_close(&this->filebuf)) {
10932         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10933         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10934     }
10935 }
10936
10937 /* ?is_open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
10938 /* ?is_open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
10939 /* ?is_open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
10940 /* ?is_open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
10941 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_is_open, 4)
10942 MSVCP_bool __thiscall basic_ifstream_wchar_is_open(const basic_ifstream_wchar *this)
10943 {
10944     TRACE("(%p)\n", this);
10945     return basic_filebuf_wchar_is_open(&this->filebuf);
10946 }
10947
10948 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
10949 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
10950 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
10951 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
10952 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open, 16)
10953 void __thiscall basic_ifstream_wchar_open(basic_ifstream_wchar *this,
10954         const char *name, int mode, int prot)
10955 {
10956     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10957
10958     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10959         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10960         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10961     }
10962 }
10963
10964 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
10965 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
10966 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
10967 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
10968 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_old, 12)
10969 void __thiscall basic_ifstream_wchar_open_old(basic_ifstream_wchar *this,
10970         const char *name, unsigned int mode)
10971 {
10972     basic_ifstream_wchar_open(this, name, mode, _SH_DENYNO);
10973 }
10974
10975 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
10976 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
10977 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
10978 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
10979 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
10980 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
10981 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
10982 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
10983 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_wchar, 16)
10984 void __thiscall basic_ifstream_wchar_open_wchar(basic_ifstream_wchar *this,
10985         const wchar_t *name, int mode, int prot)
10986 {
10987     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10988
10989     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10990         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10991         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10992     }
10993 }
10994
10995 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
10996 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
10997 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
10998 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
10999 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
11000 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
11001 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
11002 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
11003 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_wchar_old, 12)
11004 void __thiscall basic_ifstream_wchar_open_wchar_old(basic_ifstream_wchar *this,
11005         const wchar_t *name, unsigned int mode)
11006 {
11007     basic_ifstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
11008 }
11009
11010 /* ?rdbuf@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11011 /* ?rdbuf@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11012 /* ?rdbuf@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11013 /* ?rdbuf@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11014 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_rdbuf, 4)
11015 basic_filebuf_wchar* __thiscall basic_ifstream_wchar_rdbuf(const basic_ifstream_wchar *this)
11016 {
11017     TRACE("(%p)\n", this);
11018     return (basic_filebuf_wchar*)&this->filebuf;
11019 }
11020
11021 static inline basic_ios_char* basic_fstream_char_to_basic_ios(basic_fstream_char *ptr)
11022 {
11023     return (basic_ios_char*)((char*)ptr+basic_fstream_char_vbtable1[1]);
11024 }
11025
11026 static inline basic_fstream_char* basic_fstream_char_from_basic_ios(basic_ios_char *ptr)
11027 {
11028     return (basic_fstream_char*)((char*)ptr-basic_fstream_char_vbtable1[1]);
11029 }
11030
11031 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
11032 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
11033 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor, 8)
11034 basic_fstream_char* __thiscall basic_fstream_char_ctor(basic_fstream_char *this, MSVCP_bool virt_init)
11035 {
11036     basic_ios_char *basic_ios;
11037
11038     TRACE("(%p %d)\n", this, virt_init);
11039
11040     if(virt_init) {
11041         this->base.base1.vbtable = basic_fstream_char_vbtable1;
11042         this->base.base2.vbtable = basic_fstream_char_vbtable2;
11043         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11044         basic_ios_char_ctor(basic_ios);
11045     }else {
11046         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11047     }
11048
11049     basic_filebuf_char_ctor(&this->filebuf);
11050     basic_iostream_char_ctor(&this->base, &this->filebuf.base, FALSE);
11051     basic_ios->base.vtable = &MSVCP_basic_fstream_char_vtable;
11052     return this;
11053 }
11054
11055 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
11056 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11057 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_file, 12)
11058 basic_fstream_char* __thiscall basic_fstream_char_ctor_file(basic_fstream_char *this,
11059         FILE *file, MSVCP_bool virt_init)
11060 {
11061     basic_ios_char *basic_ios;
11062
11063     TRACE("(%p %p %d)\n", this, file, virt_init);
11064
11065     if(virt_init) {
11066         this->base.base1.vbtable = basic_fstream_char_vbtable1;
11067         this->base.base2.vbtable = basic_fstream_char_vbtable2;
11068         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11069         basic_ios_char_ctor(basic_ios);
11070     }else {
11071         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11072     }
11073
11074     basic_filebuf_char_ctor_file(&this->filebuf, file);
11075     basic_iostream_char_ctor(&this->base, &this->filebuf.base, FALSE);
11076     basic_ios->base.vtable = &MSVCP_basic_fstream_char_vtable;
11077     return this;
11078 }
11079
11080 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
11081 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
11082 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_name, 20)
11083 basic_fstream_char* __thiscall basic_fstream_char_ctor_name(basic_fstream_char *this,
11084         const char *name, int mode, int prot, MSVCP_bool virt_init)
11085 {
11086     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
11087
11088     basic_fstream_char_ctor(this, virt_init);
11089
11090     if(!basic_filebuf_char_open(&this->filebuf, name, mode, prot)) {
11091         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11092         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11093     }
11094     return this;
11095 }
11096
11097 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
11098 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
11099 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
11100 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
11101 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_name_wchar, 20)
11102 basic_fstream_char* __thiscall basic_fstream_char_ctor_name_wchar(basic_fstream_char *this,
11103         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11104 {
11105     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
11106
11107     basic_fstream_char_ctor(this, virt_init);
11108
11109     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode, prot)) {
11110         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11111         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11112     }
11113     return this;
11114 }
11115
11116 /* ??1?$basic_fstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
11117 /* ??1?$basic_fstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
11118 DEFINE_THISCALL_WRAPPER(basic_fstream_char_dtor, 4)
11119 void __thiscall basic_fstream_char_dtor(basic_ios_char *base)
11120 {
11121     basic_fstream_char *this = basic_fstream_char_from_basic_ios(base);
11122
11123     TRACE("(%p)\n", this);
11124
11125     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
11126     basic_filebuf_char_dtor(&this->filebuf);
11127 }
11128
11129 /* ??_D?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
11130 /* ??_D?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
11131 DEFINE_THISCALL_WRAPPER(basic_fstream_char_vbase_dtor, 4)
11132 void __thiscall basic_fstream_char_vbase_dtor(basic_fstream_char *this)
11133 {
11134     TRACE("(%p)\n", this);
11135
11136     basic_fstream_char_dtor(basic_fstream_char_to_basic_ios(this));
11137     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
11138 }
11139
11140 DEFINE_THISCALL_WRAPPER(basic_fstream_char_vector_dtor, 8)
11141 basic_fstream_char* __thiscall basic_fstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11142 {
11143     basic_fstream_char *this = basic_fstream_char_from_basic_ios(base);
11144
11145     TRACE("(%p %x)\n", this, flags);
11146
11147     if(flags & 2) {
11148         /* we have an array, with the number of elements stored before the first object */
11149         INT_PTR i, *ptr = (INT_PTR *)this-1;
11150
11151         for(i=*ptr-1; i>=0; i--)
11152             basic_fstream_char_vbase_dtor(this+i);
11153         MSVCRT_operator_delete(ptr);
11154     } else {
11155         basic_fstream_char_vbase_dtor(this);
11156         if(flags & 1)
11157             MSVCRT_operator_delete(this);
11158     }
11159
11160     return this;
11161 }
11162
11163 /* ?close@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
11164 /* ?close@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
11165 DEFINE_THISCALL_WRAPPER(basic_fstream_char_close, 4)
11166 void __thiscall basic_fstream_char_close(basic_fstream_char *this)
11167 {
11168     TRACE("(%p)\n", this);
11169
11170     if(!basic_filebuf_char_close(&this->filebuf)) {
11171         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11172         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11173     }
11174 }
11175
11176 /* ?is_open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
11177 /* ?is_open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
11178 DEFINE_THISCALL_WRAPPER(basic_fstream_char_is_open, 4)
11179 MSVCP_bool __thiscall basic_fstream_char_is_open(const basic_fstream_char *this)
11180 {
11181     TRACE("(%p)\n", this);
11182     return basic_filebuf_char_is_open(&this->filebuf);
11183 }
11184
11185 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
11186 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
11187 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open, 16)
11188 void __thiscall basic_fstream_char_open(basic_fstream_char *this,
11189         const char *name, int mode, int prot)
11190 {
11191     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
11192
11193     if(!basic_filebuf_char_open(&this->filebuf, name, mode, prot)) {
11194         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11195         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11196     }
11197 }
11198
11199 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
11200 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
11201 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_old, 12)
11202 void __thiscall basic_fstream_char_open_old(basic_fstream_char *this,
11203         const char *name, unsigned int mode)
11204 {
11205     basic_fstream_char_open(this, name, mode, _SH_DENYNO);
11206 }
11207
11208 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
11209 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
11210 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
11211 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
11212 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_wchar, 16)
11213 void __thiscall basic_fstream_char_open_wchar(basic_fstream_char *this,
11214         const wchar_t *name, int mode, int prot)
11215 {
11216     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
11217
11218     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode, prot)) {
11219         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11220         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11221     }
11222 }
11223
11224 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
11225 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
11226 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
11227 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
11228 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_wchar_old, 12)
11229 void __thiscall basic_fstream_char_open_wchar_old(basic_fstream_char *this,
11230         const wchar_t *name, unsigned int mode)
11231 {
11232     basic_fstream_char_open_wchar(this, name, mode, _SH_DENYNO);
11233 }
11234
11235 /* ?rdbuf@?$basic_fstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
11236 /* ?rdbuf@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
11237 DEFINE_THISCALL_WRAPPER(basic_fstream_char_rdbuf, 4)
11238 basic_filebuf_char* __thiscall basic_fstream_char_rdbuf(const basic_fstream_char *this)
11239 {
11240     TRACE("(%p)\n", this);
11241     return (basic_filebuf_char*)&this->filebuf;
11242 }
11243
11244 static inline basic_ios_wchar* basic_fstream_wchar_to_basic_ios(basic_fstream_wchar *ptr)
11245 {
11246     return (basic_ios_wchar*)((char*)ptr+basic_fstream_wchar_vbtable1[1]);
11247 }
11248
11249 static inline basic_fstream_wchar* basic_fstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11250 {
11251     return (basic_fstream_wchar*)((char*)ptr-basic_fstream_wchar_vbtable1[1]);
11252 }
11253
11254 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
11255 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
11256 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor, 8)
11257 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor(basic_fstream_wchar *this, MSVCP_bool virt_init)
11258 {
11259     basic_ios_wchar *basic_ios;
11260
11261     TRACE("(%p %d)\n", this, virt_init);
11262
11263     if(virt_init) {
11264         this->base.base1.vbtable = basic_fstream_wchar_vbtable1;
11265         this->base.base2.vbtable = basic_fstream_wchar_vbtable2;
11266         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11267         basic_ios_wchar_ctor(basic_ios);
11268     }else {
11269         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11270     }
11271
11272     basic_filebuf_wchar_ctor(&this->filebuf);
11273     basic_iostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE);
11274     basic_ios->base.vtable = &MSVCP_basic_fstream_wchar_vtable;
11275     return this;
11276 }
11277
11278 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
11279 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
11280 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor, 8)
11281 basic_fstream_wchar* __thiscall basic_fstream_short_ctor(basic_fstream_wchar *this, MSVCP_bool virt_init)
11282 {
11283     basic_fstream_wchar_ctor(this, virt_init);
11284     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11285     return this;
11286 }
11287
11288 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
11289 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11290 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_file, 12)
11291 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_file(basic_fstream_wchar *this,
11292         FILE *file, MSVCP_bool virt_init)
11293 {
11294     basic_ios_wchar *basic_ios;
11295
11296     TRACE("(%p %p %d)\n", this, file, virt_init);
11297
11298     if(virt_init) {
11299         this->base.base1.vbtable = basic_fstream_wchar_vbtable1;
11300         this->base.base2.vbtable = basic_fstream_wchar_vbtable2;
11301         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11302         basic_ios_wchar_ctor(basic_ios);
11303     }else {
11304         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11305     }
11306
11307     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
11308     basic_iostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE);
11309     basic_ios->base.vtable = &MSVCP_basic_fstream_wchar_vtable;
11310     return this;
11311 }
11312
11313 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
11314 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11315 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_file, 12)
11316 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_file(basic_fstream_wchar *this,
11317         FILE *file, MSVCP_bool virt_init)
11318 {
11319     basic_fstream_wchar_ctor_file(this, file, virt_init);
11320     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11321     return this;
11322 }
11323
11324 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
11325 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
11326 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_name, 20)
11327 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_name(basic_fstream_wchar *this,
11328         const char *name, int mode, int prot, MSVCP_bool virt_init)
11329 {
11330     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
11331
11332     basic_fstream_wchar_ctor(this, virt_init);
11333
11334     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode, prot)) {
11335         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11336         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11337     }
11338     return this;
11339 }
11340
11341 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
11342 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
11343 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_name, 20)
11344 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_name(basic_fstream_wchar *this,
11345         const char *name, int mode, int prot, MSVCP_bool virt_init)
11346 {
11347     basic_fstream_wchar_ctor_name(this, name, mode, prot, virt_init);
11348     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11349     return this;
11350 }
11351
11352 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
11353 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
11354 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
11355 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
11356 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_name_wchar, 20)
11357 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_name_wchar(basic_fstream_wchar *this,
11358         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11359 {
11360     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
11361
11362     basic_fstream_wchar_ctor(this, virt_init);
11363
11364     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode, prot)) {
11365         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11366         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11367     }
11368     return this;
11369 }
11370
11371 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
11372 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
11373 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
11374 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
11375 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_name_wchar, 20)
11376 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_name_wchar(basic_fstream_wchar *this,
11377         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11378 {
11379     basic_fstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
11380     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11381     return this;
11382 }
11383
11384 /* ??1?$basic_fstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
11385 /* ??1?$basic_fstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
11386 /* ??1?$basic_fstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
11387 /* ??1?$basic_fstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
11388 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_dtor, 4)
11389 void __thiscall basic_fstream_wchar_dtor(basic_ios_wchar *base)
11390 {
11391     basic_fstream_wchar *this = basic_fstream_wchar_from_basic_ios(base);
11392
11393     TRACE("(%p)\n", this);
11394
11395     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(&this->base));
11396     basic_filebuf_wchar_dtor(&this->filebuf);
11397 }
11398
11399 /* ??_D?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
11400 /* ??_D?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
11401 /* ??_D?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
11402 /* ??_D?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
11403 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_vbase_dtor, 4)
11404 void __thiscall basic_fstream_wchar_vbase_dtor(basic_fstream_wchar *this)
11405 {
11406     TRACE("(%p)\n", this);
11407
11408     basic_fstream_wchar_dtor(basic_fstream_wchar_to_basic_ios(this));
11409     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base.base1));
11410 }
11411
11412 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_vector_dtor, 8)
11413 basic_fstream_wchar* __thiscall basic_fstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
11414 {
11415     basic_fstream_wchar *this = basic_fstream_wchar_from_basic_ios(base);
11416
11417     TRACE("(%p %x)\n", this, flags);
11418
11419     if(flags & 2) {
11420         /* we have an array, with the number of elements stored before the first object */
11421         INT_PTR i, *ptr = (INT_PTR *)this-1;
11422
11423         for(i=*ptr-1; i>=0; i--)
11424             basic_fstream_wchar_vbase_dtor(this+i);
11425         MSVCRT_operator_delete(ptr);
11426     } else {
11427         basic_fstream_wchar_vbase_dtor(this);
11428         if(flags & 1)
11429             MSVCRT_operator_delete(this);
11430     }
11431
11432     return this;
11433 }
11434
11435 /* ?close@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
11436 /* ?close@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
11437 /* ?close@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
11438 /* ?close@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
11439 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_close, 4)
11440 void __thiscall basic_fstream_wchar_close(basic_fstream_wchar *this)
11441 {
11442     TRACE("(%p)\n", this);
11443
11444     if(!basic_filebuf_wchar_close(&this->filebuf)) {
11445         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11446         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11447     }
11448 }
11449
11450 /* ?is_open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
11451 /* ?is_open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
11452 /* ?is_open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
11453 /* ?is_open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
11454 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_is_open, 4)
11455 MSVCP_bool __thiscall basic_fstream_wchar_is_open(const basic_fstream_wchar *this)
11456 {
11457     TRACE("(%p)\n", this);
11458     return basic_filebuf_wchar_is_open(&this->filebuf);
11459 }
11460
11461 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
11462 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
11463 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
11464 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
11465 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open, 16)
11466 void __thiscall basic_fstream_wchar_open(basic_fstream_wchar *this,
11467         const char *name, int mode, int prot)
11468 {
11469     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
11470
11471     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode, prot)) {
11472         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11473         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11474     }
11475 }
11476
11477 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
11478 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
11479 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
11480 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
11481 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_old, 12)
11482 void __thiscall basic_fstream_wchar_open_old(basic_fstream_wchar *this,
11483         const char *name, unsigned int mode)
11484 {
11485     basic_fstream_wchar_open(this, name, mode, _SH_DENYNO);
11486 }
11487
11488 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
11489 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
11490 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
11491 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
11492 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
11493 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
11494 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
11495 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
11496 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_wchar, 16)
11497 void __thiscall basic_fstream_wchar_open_wchar(basic_fstream_wchar *this,
11498         const wchar_t *name, int mode, int prot)
11499 {
11500     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
11501
11502     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode, prot)) {
11503         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11504         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11505     }
11506 }
11507
11508 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
11509 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
11510 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
11511 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
11512 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
11513 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
11514 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
11515 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
11516 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_wchar_old, 12)
11517 void __thiscall basic_fstream_wchar_open_wchar_old(basic_fstream_wchar *this,
11518         const wchar_t *name, unsigned int mode)
11519 {
11520     basic_fstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
11521 }
11522
11523 /* ?rdbuf@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11524 /* ?rdbuf@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11525 /* ?rdbuf@?$basic_fstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11526 /* ?rdbuf@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11527 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_rdbuf, 4)
11528 basic_filebuf_wchar* __thiscall basic_fstream_wchar_rdbuf(const basic_fstream_wchar *this)
11529 {
11530     TRACE("(%p)\n", this);
11531     return (basic_filebuf_wchar*)&this->filebuf;
11532 }
11533
11534 static inline basic_ios_char* basic_ostringstream_char_to_basic_ios(basic_ostringstream_char *ptr)
11535 {
11536     return (basic_ios_char*)((char*)ptr+basic_ostringstream_char_vbtable[1]);
11537 }
11538
11539 static inline basic_ostringstream_char* basic_ostringstream_char_from_basic_ios(basic_ios_char *ptr)
11540 {
11541     return (basic_ostringstream_char*)((char*)ptr-basic_ostringstream_char_vbtable[1]);
11542 }
11543
11544 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
11545 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
11546 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor_str, 16)
11547 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor_str(basic_ostringstream_char *this,
11548         const basic_string_char *str, int mode, MSVCP_bool virt_init)
11549 {
11550     basic_ios_char *basic_ios;
11551
11552     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11553
11554     if(virt_init) {
11555         this->base.vbtable = basic_ostringstream_char_vbtable;
11556         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11557         basic_ios_char_ctor(basic_ios);
11558     }else {
11559         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11560     }
11561
11562     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode|OPENMODE_out);
11563     basic_ostream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11564     basic_ios->base.vtable = &MSVCP_basic_ostringstream_char_vtable;
11565     return this;
11566 }
11567
11568 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
11569 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
11570 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor_mode, 12)
11571 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor_mode(
11572         basic_ostringstream_char *this, int mode, MSVCP_bool virt_init)
11573 {
11574     basic_ios_char *basic_ios;
11575
11576     TRACE("(%p %d %d)\n", this, mode, virt_init);
11577
11578     if(virt_init) {
11579         this->base.vbtable = basic_ostringstream_char_vbtable;
11580         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11581         basic_ios_char_ctor(basic_ios);
11582     }else {
11583         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11584     }
11585
11586     basic_stringbuf_char_ctor_mode(&this->strbuf, mode|OPENMODE_out);
11587     basic_ostream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11588     basic_ios->base.vtable = &MSVCP_basic_ostringstream_char_vtable;
11589     return this;
11590 }
11591
11592 /* ??_F?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11593 /* ??_F?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11594 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor, 8)
11595 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor(
11596         basic_ostringstream_char *this, MSVCP_bool virt_init)
11597 {
11598     return basic_ostringstream_char_ctor_mode(this, 0, virt_init);
11599 }
11600
11601 /* ??1?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
11602 /* ??1?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
11603 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_dtor, 4)
11604 void __thiscall basic_ostringstream_char_dtor(basic_ios_char *base)
11605 {
11606     basic_ostringstream_char *this = basic_ostringstream_char_from_basic_ios(base);
11607
11608     TRACE("(%p)\n", this);
11609
11610     basic_stringbuf_char_dtor(&this->strbuf);
11611     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
11612 }
11613
11614 /* ??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11615 /* ??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11616 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_vbase_dtor, 4)
11617 void __thiscall basic_ostringstream_char_vbase_dtor(basic_ostringstream_char *this)
11618 {
11619     TRACE("(%p)\n", this);
11620
11621     basic_ostringstream_char_dtor(basic_ostringstream_char_to_basic_ios(this));
11622     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
11623 }
11624
11625 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_vector_dtor, 8)
11626 basic_ostringstream_char* __thiscall basic_ostringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11627 {
11628     basic_ostringstream_char *this = basic_ostringstream_char_from_basic_ios(base);
11629
11630     TRACE("(%p %x)\n", this, flags);
11631
11632     if(flags & 2) {
11633         /* we have an array, with the number of elements stored before the first object */
11634         INT_PTR i, *ptr = (INT_PTR *)this-1;
11635
11636         for(i=*ptr-1; i>=0; i--)
11637             basic_ostringstream_char_vbase_dtor(this+i);
11638         MSVCRT_operator_delete(ptr);
11639     } else {
11640         basic_ostringstream_char_vbase_dtor(this);
11641         if(flags & 1)
11642             MSVCRT_operator_delete(this);
11643     }
11644
11645     return this;
11646 }
11647
11648 /* ?rdbuf@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11649 /* ?rdbuf@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11650 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_rdbuf, 4)
11651 basic_stringbuf_char* __thiscall basic_ostringstream_char_rdbuf(const basic_ostringstream_char *this)
11652 {
11653     TRACE("(%p)\n", this);
11654     return (basic_stringbuf_char*)&this->strbuf;
11655 }
11656
11657 /* ?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
11658 /* ?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
11659 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_str_set, 8)
11660 void __thiscall basic_ostringstream_char_str_set(basic_ostringstream_char *this, const basic_string_char *str)
11661 {
11662     TRACE("(%p %p)\n", this, str);
11663     basic_stringbuf_char_str_set(&this->strbuf, str);
11664 }
11665
11666 /* ?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11667 /* ?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11668 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_str_get, 8)
11669 basic_string_char* __thiscall basic_ostringstream_char_str_get(const basic_ostringstream_char *this, basic_string_char *ret)
11670 {
11671     TRACE("(%p %p)\n", this, ret);
11672     return basic_stringbuf_char_str_get(&this->strbuf, ret);
11673 }
11674
11675 static inline basic_ios_wchar* basic_ostringstream_wchar_to_basic_ios(basic_ostringstream_wchar *ptr)
11676 {
11677     return (basic_ios_wchar*)((char*)ptr+basic_ostringstream_wchar_vbtable[1]);
11678 }
11679
11680 static inline basic_ostringstream_wchar* basic_ostringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11681 {
11682     return (basic_ostringstream_wchar*)((char*)ptr-basic_ostringstream_wchar_vbtable[1]);
11683 }
11684
11685 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
11686 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
11687 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor_str, 16)
11688 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor_str(basic_ostringstream_wchar *this,
11689         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11690 {
11691     basic_ios_wchar *basic_ios;
11692
11693     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11694
11695     if(virt_init) {
11696         this->base.vbtable = basic_ostringstream_wchar_vbtable;
11697         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11698         basic_ios_wchar_ctor(basic_ios);
11699     }else {
11700         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11701     }
11702
11703     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode|OPENMODE_out);
11704     basic_ostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11705     basic_ios->base.vtable = &MSVCP_basic_ostringstream_wchar_vtable;
11706     return this;
11707 }
11708
11709 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
11710 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
11711 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor_str, 16)
11712 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor_str(basic_ostringstream_wchar *this,
11713         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11714 {
11715     basic_ostringstream_wchar_ctor_str(this, str, mode, virt_init);
11716     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ostringstream_short_vtable;
11717     return this;
11718 }
11719
11720 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
11721 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
11722 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor_mode, 12)
11723 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor_mode(
11724         basic_ostringstream_wchar *this, int mode, MSVCP_bool virt_init)
11725 {
11726     basic_ios_wchar *basic_ios;
11727
11728     TRACE("(%p %d %d)\n", this, mode, virt_init);
11729
11730     if(virt_init) {
11731         this->base.vbtable = basic_ostringstream_wchar_vbtable;
11732         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11733         basic_ios_wchar_ctor(basic_ios);
11734     }else {
11735         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11736     }
11737
11738     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode|OPENMODE_out);
11739     basic_ostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11740     basic_ios->base.vtable = &MSVCP_basic_ostringstream_wchar_vtable;
11741     return this;
11742 }
11743
11744 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
11745 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
11746 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor_mode, 12)
11747 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor_mode(
11748         basic_ostringstream_wchar *this, int mode, MSVCP_bool virt_init)
11749 {
11750     basic_ostringstream_wchar_ctor_mode(this, mode, virt_init);
11751     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ostringstream_short_vtable;
11752     return this;
11753 }
11754
11755 /* ??_F?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11756 /* ??_F?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11757 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor, 8)
11758 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor(
11759         basic_ostringstream_wchar *this, MSVCP_bool virt_init)
11760 {
11761     return basic_ostringstream_wchar_ctor_mode(this, 0, virt_init);
11762 }
11763
11764 /* ??_F?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11765 /* ??_F?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11766 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor, 8)
11767 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor(
11768         basic_ostringstream_wchar *this, MSVCP_bool virt_init)
11769 {
11770     return basic_ostringstream_short_ctor_mode(this, 0, virt_init);
11771 }
11772
11773 /* ??1?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
11774 /* ??1?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
11775 /* ??1?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
11776 /* ??1?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
11777 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_dtor, 4)
11778 void __thiscall basic_ostringstream_wchar_dtor(basic_ios_wchar *base)
11779 {
11780     basic_ostringstream_wchar *this = basic_ostringstream_wchar_from_basic_ios(base);
11781
11782     TRACE("(%p)\n", this);
11783
11784     basic_stringbuf_wchar_dtor(&this->strbuf);
11785     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base));
11786 }
11787
11788 /* ??_D?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11789 /* ??_D?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11790 /* ??_D?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11791 /* ??_D?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11792 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_vbase_dtor, 4)
11793 void __thiscall basic_ostringstream_wchar_vbase_dtor(basic_ostringstream_wchar *this)
11794 {
11795     TRACE("(%p)\n", this);
11796
11797     basic_ostringstream_wchar_dtor(basic_ostringstream_wchar_to_basic_ios(this));
11798     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(&this->base));
11799 }
11800
11801 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_vector_dtor, 8)
11802 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
11803 {
11804     basic_ostringstream_wchar *this = basic_ostringstream_wchar_from_basic_ios(base);
11805
11806     TRACE("(%p %x)\n", this, flags);
11807
11808     if(flags & 2) {
11809         /* we have an array, with the number of elements stored before the first object */
11810         INT_PTR i, *ptr = (INT_PTR *)this-1;
11811
11812         for(i=*ptr-1; i>=0; i--)
11813             basic_ostringstream_wchar_vbase_dtor(this+i);
11814         MSVCRT_operator_delete(ptr);
11815     } else {
11816         basic_ostringstream_wchar_vbase_dtor(this);
11817         if(flags & 1)
11818             MSVCRT_operator_delete(this);
11819     }
11820
11821     return this;
11822 }
11823
11824 /* ?rdbuf@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
11825 /* ?rdbuf@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
11826 /* ?rdbuf@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
11827 /* ?rdbuf@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
11828 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_rdbuf, 4)
11829 basic_stringbuf_wchar* __thiscall basic_ostringstream_wchar_rdbuf(const basic_ostringstream_wchar *this)
11830 {
11831     TRACE("(%p)\n", this);
11832     return (basic_stringbuf_wchar*)&this->strbuf;
11833 }
11834
11835 /* ?str@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
11836 /* ?str@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
11837 /* ?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
11838 /* ?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
11839 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_str_set, 8)
11840 void __thiscall basic_ostringstream_wchar_str_set(basic_ostringstream_wchar *this, const basic_string_wchar *str)
11841 {
11842     TRACE("(%p %p)\n", this, str);
11843     basic_stringbuf_wchar_str_set(&this->strbuf, str);
11844 }
11845
11846 /* ?str@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
11847 /* ?str@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
11848 /* ?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
11849 /* ?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
11850 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_str_get, 8)
11851 basic_string_wchar* __thiscall basic_ostringstream_wchar_str_get(const basic_ostringstream_wchar *this, basic_string_wchar *ret)
11852 {
11853     TRACE("(%p %p)\n", this, ret);
11854     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
11855 }
11856
11857 static inline basic_ios_char* basic_istringstream_char_to_basic_ios(basic_istringstream_char *ptr)
11858 {
11859     return (basic_ios_char*)((char*)ptr+basic_istringstream_char_vbtable[1]);
11860 }
11861
11862 static inline basic_istringstream_char* basic_istringstream_char_from_basic_ios(basic_ios_char *ptr)
11863 {
11864     return (basic_istringstream_char*)((char*)ptr-basic_istringstream_char_vbtable[1]);
11865 }
11866
11867 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
11868 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
11869 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor_str, 16)
11870 basic_istringstream_char* __thiscall basic_istringstream_char_ctor_str(basic_istringstream_char *this,
11871         const basic_string_char *str, int mode, MSVCP_bool virt_init)
11872 {
11873     basic_ios_char *basic_ios;
11874
11875     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11876
11877     if(virt_init) {
11878         this->base.vbtable = basic_istringstream_char_vbtable;
11879         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11880         basic_ios_char_ctor(basic_ios);
11881     }else {
11882         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11883     }
11884
11885     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode|OPENMODE_in);
11886     basic_istream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11887     basic_ios->base.vtable = &MSVCP_basic_istringstream_char_vtable;
11888     return this;
11889 }
11890
11891 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
11892 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
11893 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor_mode, 12)
11894 basic_istringstream_char* __thiscall basic_istringstream_char_ctor_mode(
11895         basic_istringstream_char *this, int mode, MSVCP_bool virt_init)
11896 {
11897     basic_ios_char *basic_ios;
11898
11899     TRACE("(%p %d %d)\n", this, mode, virt_init);
11900
11901     if(virt_init) {
11902         this->base.vbtable = basic_istringstream_char_vbtable;
11903         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11904         basic_ios_char_ctor(basic_ios);
11905     }else {
11906         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11907     }
11908
11909     basic_stringbuf_char_ctor_mode(&this->strbuf, mode|OPENMODE_in);
11910     basic_istream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11911     basic_ios->base.vtable = &MSVCP_basic_istringstream_char_vtable;
11912     return this;
11913 }
11914
11915 /* ??_F?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11916 /* ??_F?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11917 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor, 8)
11918 basic_istringstream_char* __thiscall basic_istringstream_char_ctor(
11919         basic_istringstream_char *this, MSVCP_bool virt_init)
11920 {
11921     return basic_istringstream_char_ctor_mode(this, 0, virt_init);
11922 }
11923
11924 /* ??1?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
11925 /* ??1?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
11926 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_dtor, 4)
11927 void __thiscall basic_istringstream_char_dtor(basic_ios_char *base)
11928 {
11929     basic_istringstream_char *this = basic_istringstream_char_from_basic_ios(base);
11930
11931     TRACE("(%p)\n", this);
11932
11933     basic_stringbuf_char_dtor(&this->strbuf);
11934     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
11935 }
11936
11937 /* ??_D?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11938 /* ??_D?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11939 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_vbase_dtor, 4)
11940 void __thiscall basic_istringstream_char_vbase_dtor(basic_istringstream_char *this)
11941 {
11942     TRACE("(%p)\n", this);
11943
11944     basic_istringstream_char_dtor(basic_istringstream_char_to_basic_ios(this));
11945     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base));
11946 }
11947
11948 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_vector_dtor, 8)
11949 basic_istringstream_char* __thiscall basic_istringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11950 {
11951     basic_istringstream_char *this = basic_istringstream_char_from_basic_ios(base);
11952
11953     TRACE("(%p %x)\n", this, flags);
11954
11955     if(flags & 2) {
11956         /* we have an array, with the number of elements stored before the first object */
11957         INT_PTR i, *ptr = (INT_PTR *)this-1;
11958
11959         for(i=*ptr-1; i>=0; i--)
11960             basic_istringstream_char_vbase_dtor(this+i);
11961         MSVCRT_operator_delete(ptr);
11962     } else {
11963         basic_istringstream_char_vbase_dtor(this);
11964         if(flags & 1)
11965             MSVCRT_operator_delete(this);
11966     }
11967
11968     return this;
11969 }
11970
11971 /* ?rdbuf@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11972 /* ?rdbuf@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11973 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_rdbuf, 4)
11974 basic_stringbuf_char* __thiscall basic_istringstream_char_rdbuf(const basic_istringstream_char *this)
11975 {
11976     TRACE("(%p)\n", this);
11977     return (basic_stringbuf_char*)&this->strbuf;
11978 }
11979
11980 /* ?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
11981 /* ?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
11982 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_str_set, 8)
11983 void __thiscall basic_istringstream_char_str_set(basic_istringstream_char *this, const basic_string_char *str)
11984 {
11985     TRACE("(%p %p)\n", this, str);
11986     basic_stringbuf_char_str_set(&this->strbuf, str);
11987 }
11988
11989 /* ?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11990 /* ?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11991 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_str_get, 8)
11992 basic_string_char* __thiscall basic_istringstream_char_str_get(const basic_istringstream_char *this, basic_string_char *ret)
11993 {
11994     TRACE("(%p %p)\n", this, ret);
11995     return basic_stringbuf_char_str_get(&this->strbuf, ret);
11996 }
11997
11998 static inline basic_ios_wchar* basic_istringstream_wchar_to_basic_ios(basic_istringstream_wchar *ptr)
11999 {
12000     return (basic_ios_wchar*)((char*)ptr+basic_istringstream_wchar_vbtable[1]);
12001 }
12002
12003 static inline basic_istringstream_wchar* basic_istringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
12004 {
12005     return (basic_istringstream_wchar*)((char*)ptr-basic_istringstream_wchar_vbtable[1]);
12006 }
12007
12008 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
12009 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
12010 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor_str, 16)
12011 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor_str(basic_istringstream_wchar *this,
12012         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12013 {
12014     basic_ios_wchar *basic_ios;
12015
12016     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12017
12018     if(virt_init) {
12019         this->base.vbtable = basic_istringstream_wchar_vbtable;
12020         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
12021         basic_ios_wchar_ctor(basic_ios);
12022     }else {
12023         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
12024     }
12025
12026     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode|OPENMODE_in);
12027     basic_istream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
12028     basic_ios->base.vtable = &MSVCP_basic_istringstream_wchar_vtable;
12029     return this;
12030 }
12031
12032 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
12033 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
12034 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor_str, 16)
12035 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor_str(basic_istringstream_wchar *this,
12036         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12037 {
12038     basic_istringstream_wchar_ctor_str(this, str, mode, virt_init);
12039     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_istringstream_short_vtable;
12040     return this;
12041 }
12042
12043 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
12044 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
12045 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor_mode, 12)
12046 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor_mode(
12047         basic_istringstream_wchar *this, int mode, MSVCP_bool virt_init)
12048 {
12049     basic_ios_wchar *basic_ios;
12050
12051     TRACE("(%p %d %d)\n", this, mode, virt_init);
12052
12053     if(virt_init) {
12054         this->base.vbtable = basic_istringstream_wchar_vbtable;
12055         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
12056         basic_ios_wchar_ctor(basic_ios);
12057     }else {
12058         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
12059     }
12060
12061     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode|OPENMODE_in);
12062     basic_istream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
12063     basic_ios->base.vtable = &MSVCP_basic_istringstream_wchar_vtable;
12064     return this;
12065 }
12066
12067 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
12068 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
12069 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor_mode, 12)
12070 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor_mode(
12071         basic_istringstream_wchar *this, int mode, MSVCP_bool virt_init)
12072 {
12073     basic_istringstream_wchar_ctor_mode(this, mode, virt_init);
12074     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_istringstream_short_vtable;
12075     return this;
12076 }
12077
12078 /* ??_F?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12079 /* ??_F?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12080 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor, 8)
12081 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor(
12082         basic_istringstream_wchar *this, MSVCP_bool virt_init)
12083 {
12084     return basic_istringstream_wchar_ctor_mode(this, 0, virt_init);
12085 }
12086
12087 /* ??_F?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12088 /* ??_F?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12089 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor, 8)
12090 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor(
12091         basic_istringstream_wchar *this, MSVCP_bool virt_init)
12092 {
12093     return basic_istringstream_short_ctor_mode(this, 0, virt_init);
12094 }
12095
12096 /* ??1?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
12097 /* ??1?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
12098 /* ??1?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
12099 /* ??1?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
12100 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_dtor, 4)
12101 void __thiscall basic_istringstream_wchar_dtor(basic_ios_wchar *base)
12102 {
12103     basic_istringstream_wchar *this = basic_istringstream_wchar_from_basic_ios(base);
12104
12105     TRACE("(%p)\n", this);
12106
12107     basic_stringbuf_wchar_dtor(&this->strbuf);
12108     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base));
12109 }
12110
12111 /* ??_D?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12112 /* ??_D?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12113 /* ??_D?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12114 /* ??_D?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12115 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_vbase_dtor, 4)
12116 void __thiscall basic_istringstream_wchar_vbase_dtor(basic_istringstream_wchar *this)
12117 {
12118     TRACE("(%p)\n", this);
12119
12120     basic_istringstream_wchar_dtor(basic_istringstream_wchar_to_basic_ios(this));
12121     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base));
12122 }
12123
12124 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_vector_dtor, 8)
12125 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
12126 {
12127     basic_istringstream_wchar *this = basic_istringstream_wchar_from_basic_ios(base);
12128
12129     TRACE("(%p %x)\n", this, flags);
12130
12131     if(flags & 2) {
12132         /* we have an array, with the number of elements stored before the first object */
12133         INT_PTR i, *ptr = (INT_PTR *)this-1;
12134
12135         for(i=*ptr-1; i>=0; i--)
12136             basic_istringstream_wchar_vbase_dtor(this+i);
12137         MSVCRT_operator_delete(ptr);
12138     } else {
12139         basic_istringstream_wchar_vbase_dtor(this);
12140         if(flags & 1)
12141             MSVCRT_operator_delete(this);
12142     }
12143
12144     return this;
12145 }
12146
12147 /* ?rdbuf@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12148 /* ?rdbuf@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12149 /* ?rdbuf@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12150 /* ?rdbuf@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12151 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_rdbuf, 4)
12152 basic_stringbuf_wchar* __thiscall basic_istringstream_wchar_rdbuf(const basic_istringstream_wchar *this)
12153 {
12154     TRACE("(%p)\n", this);
12155     return (basic_stringbuf_wchar*)&this->strbuf;
12156 }
12157
12158 /* ?str@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
12159 /* ?str@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
12160 /* ?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
12161 /* ?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
12162 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_str_set, 8)
12163 void __thiscall basic_istringstream_wchar_str_set(basic_istringstream_wchar *this, const basic_string_wchar *str)
12164 {
12165     TRACE("(%p %p)\n", this, str);
12166     basic_stringbuf_wchar_str_set(&this->strbuf, str);
12167 }
12168
12169 /* ?str@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12170 /* ?str@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12171 /* ?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12172 /* ?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12173 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_str_get, 8)
12174 basic_string_wchar* __thiscall basic_istringstream_wchar_str_get(const basic_istringstream_wchar *this, basic_string_wchar *ret)
12175 {
12176     TRACE("(%p %p)\n", this, ret);
12177     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
12178 }
12179
12180 static inline basic_ios_char* basic_stringstream_char_to_basic_ios(basic_stringstream_char *ptr)
12181 {
12182     return (basic_ios_char*)((char*)ptr+basic_stringstream_char_vbtable1[1]);
12183 }
12184
12185 static inline basic_stringstream_char* basic_stringstream_char_from_basic_ios(basic_ios_char *ptr)
12186 {
12187     return (basic_stringstream_char*)((char*)ptr-basic_stringstream_char_vbtable1[1]);
12188 }
12189
12190 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
12191 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
12192 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor_str, 16)
12193 basic_stringstream_char* __thiscall basic_stringstream_char_ctor_str(basic_stringstream_char *this,
12194         const basic_string_char *str, int mode, MSVCP_bool virt_init)
12195 {
12196     basic_ios_char *basic_ios;
12197
12198     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12199
12200     if(virt_init) {
12201         this->base.base1.vbtable = basic_stringstream_char_vbtable1;
12202         this->base.base2.vbtable = basic_stringstream_char_vbtable2;
12203         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12204         basic_ios_char_ctor(basic_ios);
12205     }else {
12206         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12207     }
12208
12209     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode);
12210     basic_iostream_char_ctor(&this->base, &this->strbuf.base, FALSE);
12211     basic_ios->base.vtable = &MSVCP_basic_stringstream_char_vtable;
12212     return this;
12213 }
12214
12215 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
12216 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
12217 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor_mode, 12)
12218 basic_stringstream_char* __thiscall basic_stringstream_char_ctor_mode(
12219         basic_stringstream_char *this, int mode, MSVCP_bool virt_init)
12220 {
12221     basic_ios_char *basic_ios;
12222
12223     TRACE("(%p %d %d)\n", this, mode, virt_init);
12224
12225     if(virt_init) {
12226         this->base.base1.vbtable = basic_stringstream_char_vbtable1;
12227         this->base.base2.vbtable = basic_stringstream_char_vbtable2;
12228         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12229         basic_ios_char_ctor(basic_ios);
12230     }else {
12231         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12232     }
12233
12234     basic_stringbuf_char_ctor_mode(&this->strbuf, mode);
12235     basic_iostream_char_ctor(&this->base, &this->strbuf.base, FALSE);
12236     basic_ios->base.vtable = &MSVCP_basic_stringstream_char_vtable;
12237     return this;
12238 }
12239
12240 /* ??_F?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
12241 /* ??_F?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
12242 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor, 8)
12243 basic_stringstream_char* __thiscall basic_stringstream_char_ctor(
12244         basic_stringstream_char *this, MSVCP_bool virt_init)
12245 {
12246     return basic_stringstream_char_ctor_mode(
12247             this, OPENMODE_out|OPENMODE_in, virt_init);
12248 }
12249
12250 /* ??1?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
12251 /* ??1?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
12252 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_dtor, 4)
12253 void __thiscall basic_stringstream_char_dtor(basic_ios_char *base)
12254 {
12255     basic_stringstream_char *this = basic_stringstream_char_from_basic_ios(base);
12256
12257     TRACE("(%p)\n", this);
12258
12259     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
12260     basic_stringbuf_char_dtor(&this->strbuf);
12261 }
12262
12263 /* ??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
12264 /* ??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
12265 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_vbase_dtor, 4)
12266 void __thiscall basic_stringstream_char_vbase_dtor(basic_stringstream_char *this)
12267 {
12268     TRACE("(%p)\n", this);
12269
12270     basic_stringstream_char_dtor(basic_stringstream_char_to_basic_ios(this));
12271     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
12272 }
12273
12274 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_vector_dtor, 8)
12275 basic_stringstream_char* __thiscall basic_stringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
12276 {
12277     basic_stringstream_char *this = basic_stringstream_char_from_basic_ios(base);
12278
12279     TRACE("(%p %x)\n", this, flags);
12280
12281     if(flags & 2) {
12282         /* we have an array, with the number of elements stored before the first object */
12283         INT_PTR i, *ptr = (INT_PTR *)this-1;
12284
12285         for(i=*ptr-1; i>=0; i--)
12286             basic_stringstream_char_vbase_dtor(this+i);
12287         MSVCRT_operator_delete(ptr);
12288     } else {
12289         basic_stringstream_char_vbase_dtor(this);
12290         if(flags & 1)
12291             MSVCRT_operator_delete(this);
12292     }
12293
12294     return this;
12295 }
12296
12297 /* ?rdbuf@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12298 /* ?rdbuf@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12299 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_rdbuf, 4)
12300 basic_stringbuf_char* __thiscall basic_stringstream_char_rdbuf(const basic_stringstream_char *this)
12301 {
12302     TRACE("(%p)\n", this);
12303     return (basic_stringbuf_char*)&this->strbuf;
12304 }
12305
12306 /* ?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
12307 /* ?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
12308 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_str_set, 8)
12309 void __thiscall basic_stringstream_char_str_set(basic_stringstream_char *this, const basic_string_char *str)
12310 {
12311     TRACE("(%p %p)\n", this, str);
12312     basic_stringbuf_char_str_set(&this->strbuf, str);
12313 }
12314
12315 /* ?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12316 /* ?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12317 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_str_get, 8)
12318 basic_string_char* __thiscall basic_stringstream_char_str_get(const basic_stringstream_char *this, basic_string_char *ret)
12319 {
12320     TRACE("(%p %p)\n", this, ret);
12321     return basic_stringbuf_char_str_get(&this->strbuf, ret);
12322 }
12323
12324 static inline basic_ios_wchar* basic_stringstream_wchar_to_basic_ios(basic_stringstream_wchar *ptr)
12325 {
12326     return (basic_ios_wchar*)((char*)ptr+basic_stringstream_wchar_vbtable1[1]);
12327 }
12328
12329 static inline basic_stringstream_wchar* basic_stringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
12330 {
12331     return (basic_stringstream_wchar*)((char*)ptr-basic_stringstream_wchar_vbtable1[1]);
12332 }
12333
12334 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
12335 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
12336 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor_str, 16)
12337 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor_str(basic_stringstream_wchar *this,
12338         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12339 {
12340     basic_ios_wchar *basic_ios;
12341
12342     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12343
12344     if(virt_init) {
12345         this->base.base1.vbtable = basic_stringstream_wchar_vbtable1;
12346         this->base.base2.vbtable = basic_stringstream_wchar_vbtable2;
12347         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12348         basic_ios_wchar_ctor(basic_ios);
12349     }else {
12350         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12351     }
12352
12353     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode);
12354     basic_iostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE);
12355     basic_ios->base.vtable = &MSVCP_basic_stringstream_wchar_vtable;
12356     return this;
12357 }
12358
12359 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
12360 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
12361 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor_str, 16)
12362 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor_str(basic_stringstream_wchar *this,
12363         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12364 {
12365     basic_stringstream_wchar_ctor_str(this, str, mode, virt_init);
12366     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_stringstream_short_vtable;
12367     return this;
12368 }
12369
12370 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
12371 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
12372 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor_mode, 12)
12373 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor_mode(
12374         basic_stringstream_wchar *this, int mode, MSVCP_bool virt_init)
12375 {
12376     basic_ios_wchar *basic_ios;
12377
12378     TRACE("(%p %d %d)\n", this, mode, virt_init);
12379
12380     if(virt_init) {
12381         this->base.base1.vbtable = basic_stringstream_wchar_vbtable1;
12382         this->base.base2.vbtable = basic_stringstream_wchar_vbtable2;
12383         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12384         basic_ios_wchar_ctor(basic_ios);
12385     }else {
12386         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12387     }
12388
12389     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode);
12390     basic_iostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE);
12391     basic_ios->base.vtable = &MSVCP_basic_stringstream_wchar_vtable;
12392     return this;
12393 }
12394
12395 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
12396 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
12397 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor_mode, 12)
12398 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor_mode(
12399         basic_stringstream_wchar *this, int mode, MSVCP_bool virt_init)
12400 {
12401     basic_stringstream_wchar_ctor_mode(this, mode, virt_init);
12402     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_stringstream_short_vtable;
12403     return this;
12404 }
12405
12406 /* ??_F?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12407 /* ??_F?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12408 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor, 8)
12409 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor(
12410         basic_stringstream_wchar *this, MSVCP_bool virt_init)
12411 {
12412     return basic_stringstream_wchar_ctor_mode(
12413             this, OPENMODE_out|OPENMODE_in, virt_init);
12414 }
12415
12416 /* ??_F?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12417 /* ??_F?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12418 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor, 8)
12419 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor(
12420         basic_stringstream_wchar *this, MSVCP_bool virt_init)
12421 {
12422     return basic_stringstream_short_ctor_mode(
12423             this, OPENMODE_out|OPENMODE_in, virt_init);
12424 }
12425
12426 /* ??1?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
12427 /* ??1?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
12428 /* ??1?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
12429 /* ??1?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
12430 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_dtor, 4)
12431 void __thiscall basic_stringstream_wchar_dtor(basic_ios_wchar *base)
12432 {
12433     basic_stringstream_wchar *this = basic_stringstream_wchar_from_basic_ios(base);
12434
12435     TRACE("(%p)\n", this);
12436
12437     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(&this->base));
12438     basic_stringbuf_wchar_dtor(&this->strbuf);
12439 }
12440
12441 /* ??_D?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12442 /* ??_D?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12443 /* ??_D?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12444 /* ??_D?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12445 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_vbase_dtor, 4)
12446 void __thiscall basic_stringstream_wchar_vbase_dtor(basic_stringstream_wchar *this)
12447 {
12448     TRACE("(%p)\n", this);
12449
12450     basic_stringstream_wchar_dtor(basic_stringstream_wchar_to_basic_ios(this));
12451     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base.base1));
12452 }
12453
12454 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_vector_dtor, 8)
12455 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
12456 {
12457     basic_stringstream_wchar *this = basic_stringstream_wchar_from_basic_ios(base);
12458
12459     TRACE("(%p %x)\n", this, flags);
12460
12461     if(flags & 2) {
12462         /* we have an array, with the number of elements stored before the first object */
12463         INT_PTR i, *ptr = (INT_PTR *)this-1;
12464
12465         for(i=*ptr-1; i>=0; i--)
12466             basic_stringstream_wchar_vbase_dtor(this+i);
12467         MSVCRT_operator_delete(ptr);
12468     } else {
12469         basic_stringstream_wchar_vbase_dtor(this);
12470         if(flags & 1)
12471             MSVCRT_operator_delete(this);
12472     }
12473
12474     return this;
12475 }
12476
12477 /* ?rdbuf@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12478 /* ?rdbuf@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12479 /* ?rdbuf@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12480 /* ?rdbuf@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12481 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_rdbuf, 4)
12482 basic_stringbuf_wchar* __thiscall basic_stringstream_wchar_rdbuf(const basic_stringstream_wchar *this)
12483 {
12484     TRACE("(%p)\n", this);
12485     return (basic_stringbuf_wchar*)&this->strbuf;
12486 }
12487
12488 /* ?str@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
12489 /* ?str@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
12490 /* ?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
12491 /* ?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
12492 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_str_set, 8)
12493 void __thiscall basic_stringstream_wchar_str_set(basic_stringstream_wchar *this, const basic_string_wchar *str)
12494 {
12495     TRACE("(%p %p)\n", this, str);
12496     basic_stringbuf_wchar_str_set(&this->strbuf, str);
12497 }
12498
12499 /* ?str@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12500 /* ?str@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12501 /* ?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12502 /* ?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12503 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_str_get, 8)
12504 basic_string_wchar* __thiscall basic_stringstream_wchar_str_get(const basic_stringstream_wchar *this, basic_string_wchar *ret)
12505 {
12506     TRACE("(%p %p)\n", this, ret);
12507     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
12508 }
12509
12510 /* ?_Init@strstreambuf@std@@IAEXHPAD0H@Z */
12511 /* ?_Init@strstreambuf@std@@IEAAX_JPEAD1H@Z */
12512 DEFINE_THISCALL_WRAPPER(strstreambuf__Init, 20)
12513 void __thiscall strstreambuf__Init(strstreambuf *this, streamsize len, char *g, char *p, int mode)
12514 {
12515     TRACE("(%p %ld %p %p %d)\n", this, len, g, p, mode);
12516
12517     this->minsize = 32;
12518     this->endsave = NULL;
12519     this->strmode = mode;
12520     this->palloc = NULL;
12521     this->pfree = NULL;
12522
12523     if(!g) {
12524         this->strmode |= STRSTATE_Dynamic;
12525         if(len > this->minsize)
12526             this->minsize = len;
12527         this->seekhigh = NULL;
12528         return;
12529     }
12530
12531     if(len < 0)
12532         len = INT_MAX;
12533     else if(!len)
12534         len = strlen(g);
12535
12536     this->seekhigh = g+len;
12537     basic_streambuf_char_setg(&this->base, g, g, p ? p : this->seekhigh);
12538     if(p)
12539         basic_streambuf_char_setp(&this->base, p, this->seekhigh);
12540 }
12541
12542 /* ??0strstreambuf@std@@QAE@PACH0@Z */
12543 /* ??0strstreambuf@std@@QEAA@PEAC_J0@Z */
12544 /* ??0strstreambuf@std@@QAE@PADH0@Z */
12545 /* ??0strstreambuf@std@@QEAA@PEAD_J0@Z */
12546 /* ??0strstreambuf@std@@QAE@PAEH0@Z */
12547 /* ??0strstreambuf@std@@QEAA@PEAE_J0@Z */
12548 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_get_put, 16)
12549 strstreambuf* __thiscall strstreambuf_ctor_get_put(strstreambuf *this, char *g, streamsize len, char *p)
12550 {
12551     TRACE("(%p %p %ld %p)\n", this, g, len, p);
12552
12553     basic_streambuf_char_ctor(&this->base);
12554     this->base.vtable = &MSVCP_strstreambuf_vtable;
12555
12556     strstreambuf__Init(this, len, g, p, 0);
12557     return this;
12558 }
12559
12560 /* ??0strstreambuf@std@@QAE@H@Z */
12561 /* ??0strstreambuf@std@@QEAA@_J@Z */
12562 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_len, 8)
12563 strstreambuf* __thiscall strstreambuf_ctor_len(strstreambuf *this, streamsize len)
12564 {
12565     return strstreambuf_ctor_get_put(this, NULL, len, NULL);
12566 }
12567
12568 /* ??0strstreambuf@std@@QAE@P6APAXI@ZP6AXPAX@Z@Z */
12569 /* ??0strstreambuf@std@@QEAA@P6APEAX_K@ZP6AXPEAX@Z@Z */
12570 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_alloc, 12)
12571 strstreambuf* __thiscall strstreambuf_ctor_alloc(strstreambuf *this, void* (__cdecl *palloc)(MSVCP_size_t), void (__cdecl *pfree)(void*))
12572 {
12573     TRACE("(%p %p %p)\n", this, palloc, pfree);
12574
12575     strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12576     this->palloc = palloc;
12577     this->pfree = pfree;
12578     return this;
12579 }
12580
12581 /* ??0strstreambuf@std@@QAE@PBCH@Z */
12582 /* ??0strstreambuf@std@@QEAA@PEBC_J@Z */
12583 /* ??0strstreambuf@std@@QAE@PBDH@Z */
12584 /* ??0strstreambuf@std@@QEAA@PEBD_J@Z */
12585 /* ??0strstreambuf@std@@QAE@PBEH@Z */
12586 /* ??0strstreambuf@std@@QEAA@PEBE_J@Z */
12587 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_get, 12)
12588 strstreambuf* __thiscall strstreambuf_ctor_get(strstreambuf *this, const char *g, streamsize len)
12589 {
12590     TRACE("(%p %p %ld)\n", this, g, len);
12591
12592     strstreambuf_ctor_get_put(this, (char*)g, len, NULL);
12593     this->strmode |= STRSTATE_Constant;
12594     return this;
12595 }
12596
12597 /* ??_Fstrstreambuf@std@@QAEXXZ */
12598 /* ??_Fstrstreambuf@std@@QEAAXXZ */
12599 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor, 4)
12600 strstreambuf* __thiscall strstreambuf_ctor(strstreambuf *this)
12601 {
12602     return strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12603 }
12604
12605 /* ?_Tidy@strstreambuf@std@@IAEXXZ */
12606 /* ?_Tidy@strstreambuf@std@@IEAAXXZ */
12607 DEFINE_THISCALL_WRAPPER(strstreambuf__Tidy, 4)
12608 void __thiscall strstreambuf__Tidy(strstreambuf *this)
12609 {
12610     TRACE("(%p)\n", this);
12611
12612     if((this->strmode & STRSTATE_Allocated) && !(this->strmode & STRSTATE_Frozen)) {
12613         if(this->pfree)
12614             this->pfree(basic_streambuf_char_eback(&this->base));
12615         else
12616             MSVCRT_operator_delete(basic_streambuf_char_eback(&this->base));
12617     }
12618
12619     this->endsave = NULL;
12620     this->seekhigh = NULL;
12621     this->strmode &= ~(STRSTATE_Allocated | STRSTATE_Frozen);
12622     basic_streambuf_char_setg(&this->base, NULL, NULL, NULL);
12623     basic_streambuf_char_setp(&this->base, NULL, NULL);
12624 }
12625
12626 /* ??1strstreambuf@std@@UAE@XZ */
12627 /* ??1strstreambuf@std@@UEAA@XZ */
12628 DEFINE_THISCALL_WRAPPER(strstreambuf_dtor, 4)
12629 void __thiscall strstreambuf_dtor(strstreambuf *this)
12630 {
12631     TRACE("(%p)\n", this);
12632
12633     strstreambuf__Tidy(this);
12634     basic_streambuf_char_dtor(&this->base);
12635 }
12636
12637 DEFINE_THISCALL_WRAPPER(strstreambuf_vector_dtor, 8)
12638 strstreambuf* __thiscall strstreambuf_vector_dtor(strstreambuf *this, unsigned int flags)
12639 {
12640     TRACE("(%p %x)\n", this, flags);
12641     if(flags & 2) {
12642         /* we have an array, with the number of elements stored before the first object */
12643         INT_PTR i, *ptr = (INT_PTR *)this-1;
12644
12645         for(i=*ptr-1; i>=0; i--)
12646             strstreambuf_dtor(this+i);
12647         MSVCRT_operator_delete(ptr);
12648     } else {
12649         strstreambuf_dtor(this);
12650         if(flags & 1)
12651             MSVCRT_operator_delete(this);
12652     }
12653
12654     return this;
12655 }
12656
12657 /* ?freeze@strstreambuf@std@@QAEX_N@Z */
12658 /* ?freeze@strstreambuf@std@@QEAAX_N@Z */
12659 DEFINE_THISCALL_WRAPPER(strstreambuf_freeze, 8)
12660 void __thiscall strstreambuf_freeze(strstreambuf *this, MSVCP_bool freeze)
12661 {
12662     TRACE("(%p %d)\n", this, freeze);
12663
12664     if(!freeze == !(this->strmode *STRSTATE_Frozen))
12665         return;
12666
12667     if(freeze) {
12668         this->strmode |= STRSTATE_Frozen;
12669         this->endsave = basic_streambuf_char_epptr(&this->base);
12670         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
12671                 basic_streambuf_char_pptr(&this->base), basic_streambuf_char_eback(&this->base));
12672     }else {
12673         this->strmode &= ~STRSTATE_Frozen;
12674         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
12675                 basic_streambuf_char_pptr(&this->base), this->endsave);
12676     }
12677 }
12678
12679 /* ?str@strstreambuf@std@@QAEPADXZ */
12680 /* ?str@strstreambuf@std@@QEAAPEADXZ */
12681 DEFINE_THISCALL_WRAPPER(strstreambuf_str, 4)
12682 char* __thiscall strstreambuf_str(strstreambuf *this)
12683 {
12684     TRACE("(%p)\n", this);
12685
12686     strstreambuf_freeze(this, TRUE);
12687     return basic_streambuf_char_gptr(&this->base);
12688 }
12689
12690 /* ?pcount@strstreambuf@std@@QBEHXZ */
12691 /* ?pcount@strstreambuf@std@@QEBA_JXZ */
12692 DEFINE_THISCALL_WRAPPER(strstreambuf_pcount, 4)
12693 streamsize __thiscall strstreambuf_pcount(const strstreambuf *this)
12694 {
12695     char *ppos = basic_streambuf_char_pptr(&this->base);
12696
12697     TRACE("(%p)\n", this);
12698
12699     return ppos ? ppos-basic_streambuf_char_pbase(&this->base) : 0;
12700 }
12701
12702 /* ?overflow@strstreambuf@std@@MAEHH@Z */
12703 /* ?overflow@strstreambuf@std@@MEAAHH@Z */
12704 DEFINE_THISCALL_WRAPPER(strstreambuf_overflow, 8)
12705 int __thiscall strstreambuf_overflow(strstreambuf *this, int c)
12706 {
12707     MSVCP_size_t old_size, size;
12708     char *ptr, *buf;
12709
12710     TRACE("(%p %d)\n", this, c);
12711
12712     if(c == EOF)
12713         return !EOF;
12714
12715     if(this->strmode & STRSTATE_Frozen)
12716         return EOF;
12717
12718     ptr = basic_streambuf_char_pptr(&this->base);
12719     if(ptr && ptr<basic_streambuf_char_epptr(&this->base))
12720         return (unsigned char)(*basic_streambuf_char__Pninc(&this->base) = c);
12721
12722     if(!(this->strmode & STRSTATE_Dynamic) || (this->strmode & STRSTATE_Constant))
12723         return EOF;
12724
12725     ptr = basic_streambuf_char_eback(&this->base);
12726     old_size = ptr ? basic_streambuf_char_epptr(&this->base) - ptr : 0;
12727
12728     size = old_size + old_size/2;
12729     if(size < this->minsize)
12730         size = this->minsize;
12731
12732     if(this->palloc)
12733         buf = this->palloc(size);
12734     else
12735         buf = MSVCRT_operator_new(size);
12736     if(!buf)
12737         return EOF;
12738
12739     memcpy(buf, ptr, old_size);
12740     if(this->strmode & STRSTATE_Allocated) {
12741         if(this->pfree)
12742             this->pfree(ptr);
12743         else
12744             MSVCRT_operator_delete(ptr);
12745     }
12746
12747     this->strmode |= STRSTATE_Allocated;
12748     if(!old_size) {
12749         this->seekhigh = buf;
12750         basic_streambuf_char_setp(&this->base, buf, buf+size);
12751         basic_streambuf_char_setg(&this->base, buf, buf, buf);
12752     }else {
12753         this->seekhigh = this->seekhigh-ptr+buf;
12754         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base)-ptr+buf,
12755                 basic_streambuf_char_pptr(&this->base)-ptr+buf, buf+size);
12756         basic_streambuf_char_setg(&this->base, buf, basic_streambuf_char_gptr(&this->base)-ptr+buf,
12757                 basic_streambuf_char_pptr(&this->base));
12758     }
12759
12760     return (unsigned char)(*basic_streambuf_char__Pninc(&this->base) = c);
12761 }
12762
12763 /* ?pbackfail@strstreambuf@std@@MAEHH@Z */
12764 /* ?pbackfail@strstreambuf@std@@MEAAHH@Z */
12765 DEFINE_THISCALL_WRAPPER(strstreambuf_pbackfail, 8)
12766 int __thiscall strstreambuf_pbackfail(strstreambuf *this, int c)
12767 {
12768     char *ptr = basic_streambuf_char_gptr(&this->base);
12769
12770     TRACE("(%p %d)\n", this, c);
12771
12772     if(ptr<=basic_streambuf_char_eback(&this->base)
12773             || ((this->strmode & STRSTATE_Constant) && c!=ptr[-1]))
12774         return EOF;
12775
12776     basic_streambuf_char_gbump(&this->base, -1);
12777     if(c == EOF)
12778         return !EOF;
12779     if(this->strmode & STRSTATE_Constant)
12780         return (unsigned char)c;
12781
12782     return (unsigned char)(ptr[0] = c);
12783 }
12784
12785 /* ?seekoff@strstreambuf@std@@MAE?AV?$fpos@H@2@JHH@Z */
12786 /* ?seekoff@strstreambuf@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
12787 DEFINE_THISCALL_WRAPPER(strstreambuf_seekoff, 20)
12788 fpos_int* __thiscall strstreambuf_seekoff(strstreambuf *this, fpos_int *ret, streamoff off, int way, int mode)
12789 {
12790     char *eback = basic_streambuf_char_eback(&this->base);
12791     char *pptr = basic_streambuf_char_pptr(&this->base);
12792     char *gptr = basic_streambuf_char_gptr(&this->base);
12793
12794     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
12795
12796     ret->off = 0;
12797     ret->state = 0;
12798
12799     if(pptr > this->seekhigh)
12800         this->seekhigh = pptr;
12801
12802     if((mode & OPENMODE_in) && gptr) {
12803         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
12804             off += gptr-eback;
12805         else if(way == SEEKDIR_end)
12806             off += this->seekhigh-eback;
12807         else if(way != SEEKDIR_beg)
12808             off = -1;
12809
12810         if(off<0 || off>this->seekhigh-eback) {
12811             off = -1;
12812         }else {
12813             basic_streambuf_char_gbump(&this->base, eback-gptr+off);
12814             if((mode & OPENMODE_out) && pptr) {
12815                 basic_streambuf_char_setp_next(&this->base, eback,
12816                         gptr, basic_streambuf_char_epptr(&this->base));
12817             }
12818         }
12819     }else if((mode & OPENMODE_out) && pptr) {
12820         if(way == SEEKDIR_cur)
12821             off += pptr-eback;
12822         else if(way == SEEKDIR_end)
12823             off += this->seekhigh-eback;
12824         else if(way != SEEKDIR_beg)
12825             off = -1;
12826
12827          if(off<0 || off>this->seekhigh-eback)
12828              off = -1;
12829          else
12830              basic_streambuf_char_pbump(&this->base, eback-pptr+off);
12831     }else {
12832         off = -1;
12833     }
12834
12835     ret->pos = off;
12836     return ret;
12837 }
12838
12839 /* ?seekpos@strstreambuf@std@@MAE?AV?$fpos@H@2@V32@H@Z */
12840 /* ?seekpos@strstreambuf@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
12841 DEFINE_THISCALL_WRAPPER(strstreambuf_seekpos, 36)
12842 fpos_int* __thiscall strstreambuf_seekpos(strstreambuf *this, fpos_int *ret, fpos_int pos, int mode)
12843 {
12844     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
12845
12846     if(pos.off==-1 && pos.pos==0 && pos.state==0) {
12847         *ret = pos;
12848         return ret;
12849     }
12850
12851     return strstreambuf_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
12852 }
12853
12854 /* ?underflow@strstreambuf@std@@MAEHXZ */
12855 /* ?underflow@strstreambuf@std@@MEAAHXZ */
12856 DEFINE_THISCALL_WRAPPER(strstreambuf_underflow, 4)
12857 int __thiscall strstreambuf_underflow(strstreambuf *this)
12858 {
12859     char *gptr = basic_streambuf_char_gptr(&this->base);
12860     char *pptr;
12861
12862     TRACE("(%p)\n", this);
12863
12864     if(!gptr)
12865         return EOF;
12866
12867     if(gptr < basic_streambuf_char_egptr(&this->base))
12868         return (unsigned char)(*gptr);
12869
12870     pptr = basic_streambuf_char_gptr(&this->base);
12871     if(pptr > this->seekhigh)
12872         this->seekhigh = pptr;
12873
12874     if(this->seekhigh <= gptr)
12875         return EOF;
12876
12877     basic_streambuf_char_setg(&this->base, basic_streambuf_char_eback(&this->base),
12878             gptr, this->seekhigh);
12879     return (unsigned char)(*gptr);
12880 }
12881
12882 static void __cdecl setprecision_func(ios_base *base, streamsize prec)
12883 {
12884     ios_base_precision_set(base, prec);
12885 }
12886
12887 /* ?setprecision@std@@YA?AU?$_Smanip@H@1@H@Z */
12888 /* ?setprecision@std@@YA?AU?$_Smanip@_J@1@_J@Z */
12889 manip_streamsize* __cdecl setprecision(manip_streamsize *ret, streamsize prec)
12890 {
12891     TRACE("(%p %ld)\n", ret, prec);
12892
12893     ret->pfunc = setprecision_func;
12894     ret->arg = prec;
12895     return ret;
12896 }
12897
12898 static void __cdecl setw_func(ios_base *base, streamsize width)
12899 {
12900     ios_base_width_set(base, width);
12901 }
12902
12903 /* ?setw@std@@YA?AU?$_Smanip@H@1@H@Z */
12904 /* ?setw@std@@YA?AU?$_Smanip@_J@1@_J@Z */
12905 manip_streamsize* __cdecl setw(manip_streamsize *ret, streamsize width)
12906 {
12907     TRACE("(%p %ld)\n", ret, width);
12908
12909     ret->pfunc = setw_func;
12910     ret->arg = width;
12911     return ret;
12912 }
12913
12914 static void __cdecl resetioflags_func(ios_base *base, int mask)
12915 {
12916     ios_base_setf_mask(base, 0, mask);
12917 }
12918
12919 /* ?resetiosflags@std@@YA?AU?$_Smanip@H@1@H@Z */
12920 manip_int* __cdecl resetiosflags(manip_int *ret, int mask)
12921 {
12922     TRACE("(%p %d)\n", ret, mask);
12923
12924     ret->pfunc = resetioflags_func;
12925     ret->arg = mask;
12926     return ret;
12927 }
12928
12929 static void __cdecl setiosflags_func(ios_base *base, int mask)
12930 {
12931     ios_base_setf_mask(base, FMTFLAG_mask, mask);
12932 }
12933
12934 /* ?setiosflags@std@@YA?AU?$_Smanip@H@1@H@Z */
12935 manip_int* __cdecl setiosflags(manip_int *ret, int mask)
12936 {
12937     TRACE("(%p %d)\n", ret, mask);
12938
12939     ret->pfunc = setiosflags_func;
12940     ret->arg = mask;
12941     return ret;
12942 }
12943
12944 static void __cdecl setbase_func(ios_base *base, int set_base)
12945 {
12946     if(set_base == 10)
12947         set_base = FMTFLAG_dec;
12948     else if(set_base == 8)
12949         set_base = FMTFLAG_oct;
12950     else if(set_base == 16)
12951         set_base = FMTFLAG_hex;
12952     else
12953         set_base = 0;
12954
12955     ios_base_setf_mask(base, set_base, FMTFLAG_basefield);
12956 }
12957
12958 /* ?setbase@std@@YA?AU?$_Smanip@H@1@H@Z */
12959 manip_int* __cdecl setbase(manip_int *ret, int base)
12960 {
12961     TRACE("(%p %d)\n", ret, base);
12962
12963     ret->pfunc = setbase_func;
12964     ret->arg = base;
12965     return ret;
12966 }
12967
12968 static basic_filebuf_char filebuf_char_stdin;
12969 /* ?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A */
12970 struct {
12971     basic_istream_char obj;
12972     basic_ios_char vbase;
12973 } cin = { { 0 } };
12974 /* ?_Ptr_cin@std@@3PAV?$basic_istream@DU?$char_traits@D@std@@@1@A */
12975 /* ?_Ptr_cin@std@@3PEAV?$basic_istream@DU?$char_traits@D@std@@@1@EA */
12976 basic_istream_char *_Ptr_cin = &cin.obj;
12977
12978 static basic_filebuf_wchar filebuf_short_stdin;
12979 /* ?wcin@std@@3V?$basic_istream@GU?$char_traits@G@std@@@1@A */
12980 struct {
12981     basic_istream_wchar obj;
12982     basic_ios_wchar vbase;
12983 } ucin = { { 0 } };
12984 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@GU?$char_traits@G@std@@@1@A */
12985 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@GU?$char_traits@G@std@@@1@EA */
12986 basic_istream_wchar *_Ptr_ucin = &ucin.obj;
12987
12988 static basic_filebuf_wchar filebuf_wchar_stdin;
12989 /* ?wcin@std@@3V?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
12990 struct {
12991     basic_istream_wchar obj;
12992     basic_ios_wchar vbase;
12993 } wcin = { { 0 } };
12994 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
12995 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@EA */
12996 basic_istream_wchar *_Ptr_wcin = &wcin.obj;
12997
12998 static basic_filebuf_char filebuf_char_stdout;
12999 /* ?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13000 struct {
13001     basic_ostream_char obj;
13002     basic_ios_char vbase;
13003 } cout = { { 0 } };
13004 /* ?_Ptr_cout@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13005 /* ?_Ptr_cout@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
13006 basic_ostream_char *_Ptr_cout = &cout.obj;
13007
13008 static basic_filebuf_wchar filebuf_short_stdout;
13009 /* ?wcout@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13010 struct {
13011     basic_ostream_wchar obj;
13012     basic_ios_wchar vbase;
13013 } ucout = { { 0 } };
13014 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13015 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
13016 basic_ostream_wchar *_Ptr_ucout = &ucout.obj;
13017
13018 static basic_filebuf_wchar filebuf_wchar_stdout;
13019 /* ?wcout@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13020 struct {
13021     basic_ostream_wchar obj;
13022     basic_ios_wchar vbase;
13023 } wcout = { { 0 } };
13024 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13025 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
13026 basic_ostream_wchar *_Ptr_wcout = &wcout.obj;
13027
13028 static basic_filebuf_char filebuf_char_stderr;
13029 /* ?cerr@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13030 struct {
13031     basic_ostream_char obj;
13032     basic_ios_char vbase;
13033 } cerr = { { 0 } };
13034 /* ?_Ptr_cerr@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13035 /* ?_Ptr_cerr@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
13036 basic_ostream_char *_Ptr_cerr = &cerr.obj;
13037
13038 static basic_filebuf_wchar filebuf_short_stderr;
13039 /* ?wcerr@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13040 struct {
13041     basic_ostream_wchar obj;
13042     basic_ios_wchar vbase;
13043 } ucerr = { { 0 } };
13044 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13045 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
13046 basic_ostream_wchar *_Ptr_ucerr = &ucerr.obj;
13047
13048 static basic_filebuf_wchar filebuf_wchar_stderr;
13049 /* ?wcerr@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13050 struct {
13051     basic_ostream_wchar obj;
13052     basic_ios_wchar vbase;
13053 } wcerr = { { 0 } };
13054 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13055 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
13056 basic_ostream_wchar *_Ptr_wcerr = &wcerr.obj;
13057
13058 static basic_filebuf_char filebuf_char_log;
13059 /* ?clog@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13060 struct {
13061     basic_ostream_char obj;
13062     basic_ios_char vbase;
13063 } clog = { { 0 } };
13064 /* ?_Ptr_clog@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13065 /* ?_Ptr_clog@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
13066 basic_ostream_char *_Ptr_clog = &clog.obj;
13067
13068 static basic_filebuf_wchar filebuf_short_log;
13069 /* ?wclog@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13070 struct {
13071     basic_ostream_wchar obj;
13072     basic_ios_wchar vbase;
13073 } uclog = { { 0 } };
13074 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13075 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
13076 basic_ostream_wchar *_Ptr_uclog = &uclog.obj;
13077
13078 static basic_filebuf_wchar filebuf_wchar_log;
13079 /* ?wclog@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13080 struct {
13081     basic_ostream_wchar obj;
13082     basic_ios_wchar vbase;
13083 } wclog = { { 0 } };
13084 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13085 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
13086 basic_ostream_wchar *_Ptr_wclog = &wclog.obj;
13087
13088 /* ?_Init_cnt@Init@ios_base@std@@0HA */
13089 int ios_base_Init__Init_cnt = -1;
13090
13091 /* ?_Init_cnt_func@Init@ios_base@std@@CAAAHXZ */
13092 /* ?_Init_cnt_func@Init@ios_base@std@@CAAEAHXZ */
13093 int* __cdecl ios_base_Init__Init_cnt_func(void)
13094 {
13095     return &ios_base_Init__Init_cnt;
13096 }
13097
13098 /* ?_Init_ctor@Init@ios_base@std@@CAXPAV123@@Z */
13099 /* ?_Init_ctor@Init@ios_base@std@@CAXPEAV123@@Z */
13100 void __cdecl ios_base_Init__Init_ctor(void *this)
13101 {
13102     TRACE("(%p)\n", this);
13103
13104     if(ios_base_Init__Init_cnt < 0)
13105         ios_base_Init__Init_cnt = 1;
13106     else
13107         ios_base_Init__Init_cnt++;
13108 }
13109
13110 /* ??0Init@ios_base@std@@QAE@XZ */
13111 /* ??0Init@ios_base@std@@QEAA@XZ */
13112 DEFINE_THISCALL_WRAPPER(ios_base_Init_ctor, 4)
13113 void* __thiscall ios_base_Init_ctor(void *this)
13114 {
13115     ios_base_Init__Init_ctor(this);
13116     return this;
13117 }
13118
13119 /* ?_Init_dtor@Init@ios_base@std@@CAXPAV123@@Z */
13120 /* ?_Init_dtor@Init@ios_base@std@@CAXPEAV123@@Z */
13121 void __cdecl ios_base_Init__Init_dtor(void *this)
13122 {
13123     TRACE("(%p)\n", this);
13124
13125     ios_base_Init__Init_cnt--;
13126     if(!ios_base_Init__Init_cnt) {
13127         basic_ostream_char_flush(&cout.obj);
13128         basic_ostream_char_flush(&cerr.obj);
13129         basic_ostream_char_flush(&clog.obj);
13130     }
13131 }
13132
13133 /* ??1Init@ios_base@std@@QAE@XZ */
13134 /* ??1Init@ios_base@std@@QEAA@XZ */
13135 DEFINE_THISCALL_WRAPPER(ios_base_Init_dtor, 4)
13136 void __thiscall ios_base_Init_dtor(void *this)
13137 {
13138     ios_base_Init__Init_dtor(this);
13139 }
13140
13141 /* ??4Init@ios_base@std@@QAEAAV012@ABV012@@Z */
13142 /* ??4Init@ios_base@std@@QEAAAEAV012@AEBV012@@Z */
13143 DEFINE_THISCALL_WRAPPER(ios_base_Init_op_assign, 8)
13144 void* __thiscall ios_base_Init_op_assign(void *this, void *rhs)
13145 {
13146     TRACE("(%p %p)\n", this, rhs);
13147     return this;
13148 }
13149
13150 /* ?_Init_cnt@_Winit@std@@0HA */
13151 int _Winit__Init_cnt = -1;
13152
13153 /* ??0_Winit@std@@QAE@XZ */
13154 /* ??0_Winit@std@@QEAA@XZ */
13155 DEFINE_THISCALL_WRAPPER(_Winit_ctor, 4)
13156 void* __thiscall _Winit_ctor(void *this)
13157 {
13158     TRACE("(%p)\n", this);
13159
13160     if(_Winit__Init_cnt < 0)
13161         _Winit__Init_cnt = 1;
13162     else
13163         _Winit__Init_cnt++;
13164
13165     return this;
13166 }
13167
13168 /* ??1_Winit@std@@QAE@XZ */
13169 /* ??1_Winit@std@@QAE@XZ */
13170 DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)
13171 void __thiscall _Winit_dtor(void *this)
13172 {
13173     TRACE("(%p)\n", this);
13174
13175     _Winit__Init_cnt--;
13176     if(!_Winit__Init_cnt) {
13177         basic_ostream_wchar_flush(&wcout.obj);
13178         basic_ostream_wchar_flush(&wcerr.obj);
13179         basic_ostream_wchar_flush(&wclog.obj);
13180     }
13181 }
13182
13183 /* ??4_Winit@std@@QAEAAV01@ABV01@@Z */
13184 /* ??4_Winit@std@@QEAAAEAV01@AEBV01@@Z */
13185 DEFINE_THISCALL_WRAPPER(_Winit_op_assign, 8)
13186 void* __thiscall _Winit_op_assign(void *this, void *rhs)
13187 {
13188     TRACE("(%p %p)\n", this, rhs);
13189     return this;
13190 }
13191
13192 void init_io(void *base)
13193 {
13194 #ifdef __x86_64__
13195     init_iosb_rtti(base);
13196     init_ios_base_rtti(base);
13197     init_basic_ios_char_rtti(base);
13198     init_basic_ios_wchar_rtti(base);
13199     init_basic_ios_short_rtti(base);
13200     init_basic_streambuf_char_rtti(base);
13201     init_basic_streambuf_wchar_rtti(base);
13202     init_basic_streambuf_short_rtti(base);
13203     init_basic_filebuf_char_rtti(base);
13204     init_basic_filebuf_wchar_rtti(base);
13205     init_basic_filebuf_short_rtti(base);
13206     init_basic_stringbuf_char_rtti(base);
13207     init_basic_stringbuf_wchar_rtti(base);
13208     init_basic_stringbuf_short_rtti(base);
13209     init_basic_ostream_char_rtti(base);
13210     init_basic_ostream_wchar_rtti(base);
13211     init_basic_ostream_short_rtti(base);
13212     init_basic_istream_char_rtti(base);
13213     init_basic_istream_wchar_rtti(base);
13214     init_basic_istream_short_rtti(base);
13215     init_basic_iostream_char_rtti(base);
13216     init_basic_iostream_wchar_rtti(base);
13217     init_basic_iostream_short_rtti(base);
13218     init_basic_ofstream_char_rtti(base);
13219     init_basic_ofstream_wchar_rtti(base);
13220     init_basic_ofstream_short_rtti(base);
13221     init_basic_ifstream_char_rtti(base);
13222     init_basic_ifstream_wchar_rtti(base);
13223     init_basic_ifstream_short_rtti(base);
13224     init_basic_fstream_char_rtti(base);
13225     init_basic_fstream_wchar_rtti(base);
13226     init_basic_fstream_short_rtti(base);
13227     init_basic_ostringstream_char_rtti(base);
13228     init_basic_ostringstream_wchar_rtti(base);
13229     init_basic_ostringstream_short_rtti(base);
13230     init_basic_istringstream_char_rtti(base);
13231     init_basic_istringstream_wchar_rtti(base);
13232     init_basic_istringstream_short_rtti(base);
13233     init_basic_stringstream_char_rtti(base);
13234     init_basic_stringstream_wchar_rtti(base);
13235     init_basic_stringstream_short_rtti(base);
13236     init_strstreambuf_rtti(base);
13237 #endif
13238
13239     basic_filebuf_char_ctor_file(&filebuf_char_stdin, stdin);
13240     basic_istream_char_ctor(&cin.obj, &filebuf_char_stdin.base, FALSE/*FIXME*/, TRUE);
13241
13242     basic_filebuf_short_ctor_file(&filebuf_short_stdin, stdin);
13243     basic_istream_short_ctor(&ucin.obj, &filebuf_short_stdin.base, FALSE/*FIXME*/, TRUE);
13244
13245     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdin, stdin);
13246     basic_istream_wchar_ctor(&wcin.obj, &filebuf_wchar_stdin.base, FALSE/*FIXME*/, TRUE);
13247
13248     basic_filebuf_char_ctor_file(&filebuf_char_stdout, stdout);
13249     basic_ostream_char_ctor(&cout.obj, &filebuf_char_stdout.base, FALSE/*FIXME*/, TRUE);
13250
13251     basic_filebuf_short_ctor_file(&filebuf_short_stdout, stdout);
13252     basic_ostream_short_ctor(&ucout.obj, &filebuf_short_stdout.base, FALSE/*FIXME*/, TRUE);
13253
13254     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdout, stdout);
13255     basic_ostream_wchar_ctor(&wcout.obj, &filebuf_wchar_stdout.base, FALSE/*FIXME*/, TRUE);
13256
13257     basic_filebuf_char_ctor_file(&filebuf_char_stderr, stderr);
13258     basic_ostream_char_ctor(&cerr.obj, &filebuf_char_stderr.base, FALSE/*FIXME*/, TRUE);
13259
13260     basic_filebuf_short_ctor_file(&filebuf_short_stderr, stderr);
13261     basic_ostream_short_ctor(&ucerr.obj, &filebuf_short_stderr.base, FALSE/*FIXME*/, TRUE);
13262
13263     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stderr, stderr);
13264     basic_ostream_wchar_ctor(&wcerr.obj, &filebuf_wchar_stderr.base, FALSE/*FIXME*/, TRUE);
13265
13266     basic_filebuf_char_ctor_file(&filebuf_char_log, stderr);
13267     basic_ostream_char_ctor(&clog.obj, &filebuf_char_log.base, FALSE/*FIXME*/, TRUE);
13268
13269     basic_filebuf_short_ctor_file(&filebuf_short_log, stderr);
13270     basic_ostream_short_ctor(&uclog.obj, &filebuf_short_log.base, FALSE/*FIXME*/, TRUE);
13271
13272     basic_filebuf_wchar_ctor_file(&filebuf_wchar_log, stderr);
13273     basic_ostream_wchar_ctor(&wclog.obj, &filebuf_wchar_log.base, FALSE/*FIXME*/, TRUE);
13274 }
13275
13276 void free_io(void)
13277 {
13278     basic_istream_char_vbase_dtor(&cin.obj);
13279     basic_filebuf_char_dtor(&filebuf_char_stdin);
13280
13281     basic_istream_wchar_vbase_dtor(&ucin.obj);
13282     basic_filebuf_wchar_dtor(&filebuf_short_stdin);
13283
13284     basic_istream_wchar_vbase_dtor(&wcin.obj);
13285     basic_filebuf_wchar_dtor(&filebuf_wchar_stdin);
13286
13287     basic_ostream_char_vbase_dtor(&cout.obj);
13288     basic_filebuf_char_dtor(&filebuf_char_stdout);
13289
13290     basic_ostream_wchar_vbase_dtor(&ucout.obj);
13291     basic_filebuf_wchar_dtor(&filebuf_short_stdout);
13292
13293     basic_ostream_wchar_vbase_dtor(&wcout.obj);
13294     basic_filebuf_wchar_dtor(&filebuf_wchar_stdout);
13295
13296     basic_ostream_char_vbase_dtor(&cerr.obj);
13297     basic_filebuf_char_dtor(&filebuf_char_stderr);
13298
13299     basic_ostream_wchar_vbase_dtor(&ucerr.obj);
13300     basic_filebuf_wchar_dtor(&filebuf_short_stderr);
13301
13302     basic_ostream_wchar_vbase_dtor(&wcerr.obj);
13303     basic_filebuf_wchar_dtor(&filebuf_wchar_stderr);
13304
13305     basic_ostream_char_vbase_dtor(&clog.obj);
13306     basic_filebuf_char_dtor(&filebuf_char_log);
13307
13308     basic_ostream_wchar_vbase_dtor(&uclog.obj);
13309     basic_filebuf_wchar_dtor(&filebuf_short_log);
13310
13311     basic_ostream_wchar_vbase_dtor(&wclog.obj);
13312     basic_filebuf_wchar_dtor(&filebuf_wchar_log);
13313 }