msvcp90: Added std::ws(basic_istream) implementation.
[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 enum {
54     INITFL_new   = 0,
55     INITFL_open  = 1,
56     INITFL_close = 2
57 } basic_filebuf__Initfl;
58
59 typedef struct {
60     basic_streambuf_char base;
61     codecvt_char *cvt;
62     char putback;
63     MSVCP_bool wrotesome;
64     int state;
65     MSVCP_bool close;
66     FILE *file;
67 } basic_filebuf_char;
68
69 typedef struct {
70     basic_streambuf_wchar base;
71     codecvt_wchar *cvt;
72     wchar_t putback;
73     MSVCP_bool wrotesome;
74     int state;
75     MSVCP_bool close;
76     FILE *file;
77 } basic_filebuf_wchar;
78
79 typedef enum {
80     STRINGBUF_allocated = 1,
81     STRINGBUF_no_write = 2,
82     STRINGBUF_no_read = 4,
83     STRINGBUF_append = 8,
84     STRINGBUF_at_end = 16
85 } basic_stringbuf_state;
86
87 typedef struct {
88     basic_streambuf_char base;
89     char *seekhigh;
90     int state;
91     char allocator; /* empty struct */
92 } basic_stringbuf_char;
93
94 typedef struct {
95     basic_streambuf_wchar base;
96     wchar_t *seekhigh;
97     int state;
98     char allocator; /* empty struct */
99 } basic_stringbuf_wchar;
100
101 typedef struct {
102     ios_base base;
103     basic_streambuf_char *strbuf;
104     struct _basic_ostream_char *stream;
105     char fillch;
106 } basic_ios_char;
107
108 typedef struct {
109     ios_base base;
110     basic_streambuf_wchar *strbuf;
111     struct _basic_ostream_wchar *stream;
112     wchar_t fillch;
113 } basic_ios_wchar;
114
115 typedef struct _basic_ostream_char {
116     const int *vbtable;
117     /* virtual inheritance
118      * basic_ios_char basic_ios;
119      */
120 } basic_ostream_char;
121
122 typedef struct _basic_ostream_wchar {
123     const int *vbtable;
124     /* virtual inheritance
125      * basic_ios_wchar basic_ios;
126      */
127 } basic_ostream_wchar;
128
129 typedef struct {
130     const int *vbtable;
131     streamsize count;
132     /* virtual inheritance
133      * basic_ios_char basic_ios;
134      */
135 } basic_istream_char;
136
137 typedef struct {
138     const int *vbtable;
139     streamsize count;
140     /* virtual inheritance
141      * basic_ios_wchar basic_ios;
142      */
143 } basic_istream_wchar;
144
145 typedef struct {
146     basic_istream_char base1;
147     basic_ostream_char base2;
148     /* virtual inheritance
149      * basic_ios_char basic_ios;
150      */
151 } basic_iostream_char;
152
153 typedef struct {
154     basic_istream_wchar base1;
155     basic_ostream_wchar base2;
156     /* virtual inheritance
157      * basic_ios_wchar basic_ios;
158      */
159 } basic_iostream_wchar;
160
161 typedef struct {
162     basic_ostream_char base;
163     basic_filebuf_char filebuf;
164     /* virtual inheritance
165      * basic_ios_char basic_ios;
166      */
167 } basic_ofstream_char;
168
169 typedef struct {
170     basic_ostream_wchar base;
171     basic_filebuf_wchar filebuf;
172     /* virtual inheritance
173      * basic_ios_wchar basic_ios;
174      */
175 } basic_ofstream_wchar;
176
177 typedef struct {
178     basic_istream_char base;
179     basic_filebuf_char filebuf;
180     /* virtual inheritance
181      * basic_ios_char basic_ios;
182      */
183 } basic_ifstream_char;
184
185 typedef struct {
186     basic_istream_wchar base;
187     basic_filebuf_wchar filebuf;
188     /* virtual inheritance
189      * basic_ios_wchar basic_ios;
190      */
191 } basic_ifstream_wchar;
192
193 typedef struct {
194     basic_iostream_char base;
195     basic_filebuf_char filebuf;
196     /* virtual inheritance
197      * basic_ios_char basic_ios;
198      */
199 } basic_fstream_char;
200
201 typedef struct {
202     basic_iostream_wchar base;
203     basic_filebuf_wchar filebuf;
204     /* virtual inheritance
205      * basic_ios_char basic_ios;
206      */
207 } basic_fstream_wchar;
208
209 typedef struct {
210     basic_ostream_char base;
211     basic_stringbuf_char strbuf;
212     /* virtual inheritance
213      * basic_ios_char basic_ios;
214      */
215 } basic_ostringstream_char;
216
217 typedef struct {
218     basic_ostream_wchar base;
219     basic_stringbuf_wchar strbuf;
220     /* virtual inheritance
221      * basic_ios_wchar basic_ios;
222      */
223 } basic_ostringstream_wchar;
224
225 typedef struct {
226     basic_istream_char base;
227     basic_stringbuf_char strbuf;
228     /* virtual inheritance
229      * basic_ios_char basic_ios;
230      */
231 } basic_istringstream_char;
232
233 typedef struct {
234     basic_istream_wchar base;
235     basic_stringbuf_wchar strbuf;
236     /* virtual inheritance
237      * basic_ios_wchar basic_ios;
238      */
239 } basic_istringstream_wchar;
240
241 typedef struct {
242     basic_iostream_char base;
243     basic_stringbuf_char strbuf;
244     /* virtual inheritance
245      * basic_ios_char basic_ios;
246      */
247 } basic_stringstream_char;
248
249 typedef struct {
250     basic_iostream_wchar base;
251     basic_stringbuf_wchar strbuf;
252     /* virtual inheritance
253      * basic_ios_wchar basic_ios;
254      */
255 } basic_stringstream_wchar;
256
257 typedef enum {
258     STRSTATE_Allocated = 1,
259     STRSTATE_Constant = 2,
260     STRSTATE_Dynamic = 4,
261     STRSTATE_Frozen = 8
262 } strstreambuf__Strstate;
263
264 typedef struct {
265     basic_streambuf_char base;
266     streamsize minsize;
267     char *endsave;
268     char *seekhigh;
269     int strmode;
270     void* (__cdecl *palloc)(MSVCP_size_t);
271     void (__cdecl *pfree)(void*);
272 } strstreambuf;
273
274 extern const vtable_ptr MSVCP_iosb_vtable;
275
276 /* ??_7ios_base@std@@6B@ */
277 extern const vtable_ptr MSVCP_ios_base_vtable;
278
279 /* ??_7?$basic_ios@DU?$char_traits@D@std@@@std@@6B@ */
280 extern const vtable_ptr MSVCP_basic_ios_char_vtable;
281
282 /* ??_7?$basic_ios@_WU?$char_traits@_W@std@@@std@@6B@ */
283 extern const vtable_ptr MSVCP_basic_ios_wchar_vtable;
284
285 /* ??_7?$basic_ios@GU?$char_traits@G@std@@@std@@6B@ */
286 extern const vtable_ptr MSVCP_basic_ios_short_vtable;
287
288 /* ??_7?$basic_streambuf@DU?$char_traits@D@std@@@std@@6B@ */
289 extern const vtable_ptr MSVCP_basic_streambuf_char_vtable;
290
291 /* ??_7?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@6B@ */
292 extern const vtable_ptr MSVCP_basic_streambuf_wchar_vtable;
293
294 /* ??_7?$basic_streambuf@GU?$char_traits@G@std@@@std@@6B@ */
295 extern const vtable_ptr MSVCP_basic_streambuf_short_vtable;
296
297 /* ??_7?$basic_filebuf@DU?$char_traits@D@std@@@std@@6B@ */
298 extern const vtable_ptr MSVCP_basic_filebuf_char_vtable;
299
300 /* ??_7?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@6B@ */
301 extern const vtable_ptr MSVCP_basic_filebuf_wchar_vtable;
302
303 /* ??_7?$basic_filebuf@GU?$char_traits@G@std@@@std@@6B@ */
304 extern const vtable_ptr MSVCP_basic_filebuf_short_vtable;
305
306 /* ??_7?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
307 extern const vtable_ptr MSVCP_basic_stringbuf_char_vtable;
308
309 /* ??_7?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
310 extern const vtable_ptr MSVCP_basic_stringbuf_wchar_vtable;
311
312 /* ??_7?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
313 extern const vtable_ptr MSVCP_basic_stringbuf_short_vtable;
314
315 /* ??_8?$basic_ostream@DU?$char_traits@D@std@@@std@@7B@ */
316 const int basic_ostream_char_vbtable[] = {0, sizeof(basic_ostream_char)};
317 /* ??_7?$basic_ostream@DU?$char_traits@D@std@@@std@@6B@ */
318 extern const vtable_ptr MSVCP_basic_ostream_char_vtable;
319
320 /* ??_8?$basic_ostream@_WU?$char_traits@_W@std@@@std@@7B@ */
321 const int basic_ostream_wchar_vbtable[] = {0, sizeof(basic_ostream_wchar)};
322 /* ??_7?$basic_ostream@_WU?$char_traits@_W@std@@@std@@6B@ */
323 extern const vtable_ptr MSVCP_basic_ostream_wchar_vtable;
324
325 /* ??_8?$basic_ostream@GU?$char_traits@G@std@@@std@@7B@ */
326 const int basic_ostream_short_vbtable[] = {0, sizeof(basic_ostream_wchar)};
327 /* ??_7?$basic_ostream@GU?$char_traits@G@std@@@std@@6B@ */
328 extern const vtable_ptr MSVCP_basic_ostream_short_vtable;
329
330 /* ??_8?$basic_istream@DU?$char_traits@D@std@@@std@@7B@ */
331 const int basic_istream_char_vbtable[] = {0, sizeof(basic_istream_char)};
332 /* ??_7?$basic_istream@DU?$char_traits@D@std@@@std@@6B@ */
333 extern const vtable_ptr MSVCP_basic_istream_char_vtable;
334
335 /* ??_8?$basic_istream@_WU?$char_traits@_W@std@@@std@@7B@ */
336 const int basic_istream_wchar_vbtable[] = {0, sizeof(basic_istream_wchar)};
337 /* ??_7?$basic_istream@_WU?$char_traits@_W@std@@@std@@6B@ */
338 extern const vtable_ptr MSVCP_basic_istream_wchar_vtable;
339
340 /* ??_8?$basic_istream@GU?$char_traits@G@std@@@std@@7B@ */
341 const int basic_istream_short_vbtable[] = {0, sizeof(basic_istream_wchar)};
342 /* ??_7?$basic_istream@GU?$char_traits@G@std@@@std@@6B@ */
343 extern const vtable_ptr MSVCP_basic_istream_short_vtable;
344
345 /* ??_8?$basic_iostream@DU?$char_traits@D@std@@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
346 const int basic_iostream_char_vbtable1[] = {0, sizeof(basic_iostream_char)};
347 /* ??_8?$basic_iostream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
348 const int basic_iostream_char_vbtable2[] = {0, sizeof(basic_iostream_char)-FIELD_OFFSET(basic_iostream_char, base2)};
349 /* ??_7?$basic_iostream@DU?$char_traits@D@std@@@std@@6B@ */
350 extern const vtable_ptr MSVCP_basic_iostream_char_vtable;
351
352 /* ??_8?$basic_iostream@_WU?$char_traits@_W@std@@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
353 /* ??_8?$basic_iostream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
354 const int basic_iostream_wchar_vbtable1[] = {0, sizeof(basic_iostream_wchar)};
355 /* ??_8?$basic_iostream@_WU?$char_traits@_W@std@@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
356 /* ??_8?$basic_iostream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
357 const int basic_iostream_wchar_vbtable2[] = {0, sizeof(basic_iostream_wchar)-FIELD_OFFSET(basic_iostream_wchar, base2)};
358 /* ??_7?$basic_iostream@_WU?$char_traits@_W@std@@@std@@6B@ */
359 extern const vtable_ptr MSVCP_basic_iostream_wchar_vtable;
360 /* ??_7?$basic_iostream@GU?$char_traits@G@std@@@std@@6B@ */
361 extern const vtable_ptr MSVCP_basic_iostream_short_vtable;
362
363 /* ??_8?$basic_ofstream@DU?$char_traits@D@std@@@std@@7B@ */
364 const int basic_ofstream_char_vbtable[] = {0, sizeof(basic_ofstream_char)};
365 /* ??_7?$basic_ofstream@DU?$char_traits@D@std@@@std@@6B@ */
366 extern const vtable_ptr MSVCP_basic_ofstream_char_vtable;
367
368 /* ??_8?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@7B@ */
369 const int basic_ofstream_wchar_vbtable[] = {0, sizeof(basic_ofstream_wchar)};
370 /* ??_7?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@6B@ */
371 extern const vtable_ptr MSVCP_basic_ofstream_wchar_vtable;
372
373 /* ??_8?$basic_ofstream@GU?$char_traits@G@std@@@std@@7B@ */
374 const int basic_ofstream_short_vbtable[] = {0, sizeof(basic_ofstream_wchar)};
375 /* ??_7?$basic_ofstream@GU?$char_traits@G@std@@@std@@6B@ */
376 extern const vtable_ptr MSVCP_basic_ofstream_short_vtable;
377
378 /* ??_8?$basic_ifstream@DU?$char_traits@D@std@@@std@@7B@ */
379 const int basic_ifstream_char_vbtable[] = {0, sizeof(basic_ifstream_char)};
380 /* ??_7?$basic_ifstream@DU?$char_traits@D@std@@@std@@6B@ */
381 extern const vtable_ptr MSVCP_basic_ifstream_char_vtable;
382
383 /* ??_8?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@7B@ */
384 const int basic_ifstream_wchar_vbtable[] = {0, sizeof(basic_ifstream_wchar)};
385 /* ??_7?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@6B@ */
386 extern const vtable_ptr MSVCP_basic_ifstream_wchar_vtable;
387
388 /* ??_8?$basic_ifstream@GU?$char_traits@G@std@@@std@@7B@ */
389 const int basic_ifstream_short_vbtable[] = {0, sizeof(basic_ifstream_wchar)};
390 /* ??_7?$basic_ifstream@GU?$char_traits@G@std@@@std@@6B@ */
391 extern const vtable_ptr MSVCP_basic_ifstream_short_vtable;
392
393 /* ??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
394 const int basic_fstream_char_vbtable1[] = {0, sizeof(basic_fstream_char)};
395 /* ??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
396 const int basic_fstream_char_vbtable2[] = {0, sizeof(basic_fstream_char)-FIELD_OFFSET(basic_fstream_char, base.base2)};
397 /* ??_7?$basic_fstream@DU?$char_traits@D@std@@@std@@6B@ */
398 extern const vtable_ptr MSVCP_basic_fstream_char_vtable;
399
400 /* ??_8?$basic_fstream@_WU?$char_traits@_W@std@@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
401 /* ??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
402 const int basic_fstream_wchar_vbtable1[] = {0, sizeof(basic_fstream_wchar)};
403 /* ??_8?$basic_fstream@_WU?$char_traits@_W@std@@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
404 /* ??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
405 const int basic_fstream_wchar_vbtable2[] = {0, sizeof(basic_fstream_wchar)-FIELD_OFFSET(basic_fstream_wchar, base.base2)};
406 /* ??_7?$basic_fstream@_WU?$char_traits@_W@std@@@std@@6B@ */
407 extern const vtable_ptr MSVCP_basic_fstream_wchar_vtable;
408 /* ??_7?$basic_fstream@GU?$char_traits@G@std@@@std@@6B@ */
409 extern const vtable_ptr MSVCP_basic_fstream_short_vtable;
410
411 /* ??_8?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B@ */
412 const int basic_ostringstream_char_vbtable[] = {0, sizeof(basic_ostringstream_char)};
413 /* ??_7?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
414 extern const vtable_ptr MSVCP_basic_ostringstream_char_vtable;
415
416 /* ??_8?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B@ */
417 const int basic_ostringstream_wchar_vbtable[] = {0, sizeof(basic_ostringstream_wchar)};
418 /* ??_7?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
419 extern const vtable_ptr MSVCP_basic_ostringstream_wchar_vtable;
420
421 /* ??_8?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B@ */
422 const int basic_ostringstream_short_vbtable[] = {0, sizeof(basic_ostringstream_wchar)};
423 /* ??_7?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
424 extern const vtable_ptr MSVCP_basic_ostringstream_short_vtable;
425
426 /* ??_8?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B@ */
427 const int basic_istringstream_char_vbtable[] = {0, sizeof(basic_istringstream_char)};
428 /* ??_7?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
429 extern const vtable_ptr MSVCP_basic_istringstream_char_vtable;
430
431 /* ??_8?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B@ */
432 const int basic_istringstream_wchar_vbtable[] = {0, sizeof(basic_istringstream_wchar)};
433 /* ??_7?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
434 extern const vtable_ptr MSVCP_basic_istringstream_wchar_vtable;
435
436 /* ??_8?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B@ */
437 const int basic_istringstream_short_vbtable[] = {0, sizeof(basic_istringstream_wchar)};
438 /* ??_7?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
439 extern const vtable_ptr MSVCP_basic_istringstream_short_vtable;
440
441 /* ??_8?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
442 const int basic_stringstream_char_vbtable1[] = {0, sizeof(basic_stringstream_char)};
443 /* ??_8?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
444 const int basic_stringstream_char_vbtable2[] = {0, sizeof(basic_stringstream_char)-FIELD_OFFSET(basic_stringstream_char, base.base2)};
445 /* ??_7?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
446 extern const vtable_ptr MSVCP_basic_stringstream_char_vtable;
447
448 /* ??_8?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
449 const int basic_stringstream_wchar_vbtable1[] = {0, sizeof(basic_stringstream_wchar)};
450 /* ??_8?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
451 const int basic_stringstream_wchar_vbtable2[] = {0, sizeof(basic_stringstream_wchar)-FIELD_OFFSET(basic_stringstream_wchar, base.base2)};
452 /* ??_7?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
453 extern const vtable_ptr MSVCP_basic_stringstream_wchar_vtable;
454
455 /* ??_8?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
456 const int basic_stringstream_short_vbtable1[] = {0, sizeof(basic_stringstream_wchar)};
457 /* ??_8?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
458 const int basic_stringstream_short_vbtable2[] = {0, sizeof(basic_stringstream_wchar)-FIELD_OFFSET(basic_stringstream_wchar, base.base2)};
459 /* ??_7?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
460 extern const vtable_ptr MSVCP_basic_stringstream_short_vtable;
461
462 /* ??_7strstreambuf@std@@6B */
463 extern const vtable_ptr MSVCP_strstreambuf_vtable;
464
465 DEFINE_RTTI_DATA0(iosb, 0, ".?AV?$_Iosb@H@std@@");
466 DEFINE_RTTI_DATA1(ios_base, 0, &iosb_rtti_base_descriptor, ".?AV?$_Iosb@H@std@@");
467 DEFINE_RTTI_DATA2(basic_ios_char, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
468         ".?AV?$basic_ios@DU?$char_traits@D@std@@@std@@");
469 DEFINE_RTTI_DATA2(basic_ios_wchar, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
470         ".?AV?$basic_ios@_WU?$char_traits@_W@std@@@std@@");
471 DEFINE_RTTI_DATA2(basic_ios_short, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
472         ".?AV?$basic_ios@GU?$char_traits@G@std@@@std@@");
473 DEFINE_RTTI_DATA0(basic_streambuf_char, 0,
474         ".?AV?$basic_streambuf@DU?$char_traits@D@std@@@std@@");
475 DEFINE_RTTI_DATA0(basic_streambuf_wchar, 0,
476         ".?AV?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@");
477 DEFINE_RTTI_DATA0(basic_streambuf_short, 0,
478         ".?AV?$basic_streambuf@GU?$char_traits@G@std@@@std@@");
479 DEFINE_RTTI_DATA1(basic_filebuf_char, 0, &basic_streambuf_char_rtti_base_descriptor,
480         ".?AV?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@");
481 DEFINE_RTTI_DATA1(basic_filebuf_wchar, 0, &basic_streambuf_wchar_rtti_base_descriptor,
482         ".?AV?$basic_filebuf@GU?$char_traits@G@std@@@std@@");
483 DEFINE_RTTI_DATA1(basic_filebuf_short, 0, &basic_streambuf_short_rtti_base_descriptor,
484         ".?AV?$basic_filebuf@DU?$char_traits@D@std@@@std@@");
485 DEFINE_RTTI_DATA1(basic_stringbuf_char, 0, &basic_streambuf_char_rtti_base_descriptor,
486         ".?AV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@");
487 DEFINE_RTTI_DATA1(basic_stringbuf_wchar, 0, &basic_streambuf_wchar_rtti_base_descriptor,
488         ".?AV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@");
489 DEFINE_RTTI_DATA1(basic_stringbuf_short, 0, &basic_streambuf_short_rtti_base_descriptor,
490         ".?AV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
491 DEFINE_RTTI_DATA3(basic_ostream_char, sizeof(basic_ostream_char), &basic_ios_char_rtti_base_descriptor,
492         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
493         ".?AV?$basic_ostream@DU?$char_traits@D@std@@@std@@");
494 DEFINE_RTTI_DATA3(basic_ostream_wchar, sizeof(basic_ostream_wchar), &basic_ios_wchar_rtti_base_descriptor,
495         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
496         ".?AV?$basic_ostream@_WU?$char_traits@_W@std@@@std@@");
497 DEFINE_RTTI_DATA3(basic_ostream_short, sizeof(basic_ostream_wchar), &basic_ios_short_rtti_base_descriptor,
498         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
499         ".?AV?$basic_ostream@GU?$char_traits@G@std@@@std@@");
500 DEFINE_RTTI_DATA3(basic_istream_char, sizeof(basic_istream_char), &basic_ios_char_rtti_base_descriptor,
501         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
502         ".?AV?$basic_istream@DU?$char_traits@D@std@@@std@@");
503 DEFINE_RTTI_DATA3(basic_istream_wchar, sizeof(basic_istream_wchar), &basic_ios_wchar_rtti_base_descriptor,
504         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
505         ".?AV?$basic_istream@_WU?$char_traits@_W@std@@@std@@");
506 DEFINE_RTTI_DATA3(basic_istream_short, sizeof(basic_istream_wchar), &basic_ios_short_rtti_base_descriptor,
507         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
508         ".?AV?$basic_istream@GU?$char_traits@G@std@@@std@@");
509 DEFINE_RTTI_DATA8(basic_iostream_char, sizeof(basic_iostream_char),
510         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
511         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
512         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
513         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
514         ".?AV?$basic_iostream@DU?$char_traits@D@std@@@std@@");
515 DEFINE_RTTI_DATA8(basic_iostream_wchar, sizeof(basic_iostream_wchar),
516         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
517         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
518         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
519         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
520         ".?AV?$basic_iostream@_WU?$char_traits@_W@std@@@std@@");
521 DEFINE_RTTI_DATA8(basic_iostream_short, sizeof(basic_iostream_wchar),
522         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
523         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
524         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
525         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
526         ".?AV?$basic_iostream@GU?$char_traits@G@std@@@std@@");
527 DEFINE_RTTI_DATA4(basic_ofstream_char, sizeof(basic_ofstream_char),
528         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
529         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
530         ".?AV?$basic_ofstream@DU?$char_traits@D@std@@@std@@");
531 DEFINE_RTTI_DATA4(basic_ofstream_wchar, sizeof(basic_ofstream_wchar),
532         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
533         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
534         ".?AV?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@");
535 DEFINE_RTTI_DATA4(basic_ofstream_short, sizeof(basic_ofstream_wchar),
536         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
537         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
538         ".?AV?$basic_ofstream@GU?$char_traits@G@std@@@std@@");
539 DEFINE_RTTI_DATA4(basic_ifstream_char, sizeof(basic_ifstream_char),
540         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
541         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
542         ".?AV?$basic_ifstream@DU?$char_traits@D@std@@@std@@");
543 DEFINE_RTTI_DATA4(basic_ifstream_wchar, sizeof(basic_ifstream_wchar),
544         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
545         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
546         ".?AV?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@");
547 DEFINE_RTTI_DATA4(basic_ifstream_short, sizeof(basic_ifstream_wchar),
548         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
549         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
550         ".?AV?$basic_ifstream@GU?$char_traits@G@std@@@std@@");
551 DEFINE_RTTI_DATA8(basic_fstream_char, sizeof(basic_fstream_char),
552         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
553         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
554         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
555         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
556         ".?AV?$basic_fstream@DU?$char_traits@D@std@@@std@@");
557 DEFINE_RTTI_DATA8(basic_fstream_wchar, sizeof(basic_fstream_wchar),
558         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
559         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
560         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
561         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
562         ".?AV?$basic_fstream@_WU?$char_traits@_W@std@@@std@@");
563 DEFINE_RTTI_DATA8(basic_fstream_short, sizeof(basic_fstream_wchar),
564         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
565         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
566         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
567         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
568         ".?AV?$basic_fstream@GU?$char_traits@G@std@@@std@@");
569 DEFINE_RTTI_DATA4(basic_ostringstream_char, sizeof(basic_ostringstream_char),
570         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
571         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
572         ".?AV?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@");
573 DEFINE_RTTI_DATA4(basic_ostringstream_wchar, sizeof(basic_ostringstream_wchar),
574         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
575         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
576         ".?AV?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@");
577 DEFINE_RTTI_DATA4(basic_ostringstream_short, sizeof(basic_ostringstream_wchar),
578         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
579         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
580         ".?AV?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
581 DEFINE_RTTI_DATA4(basic_istringstream_char, sizeof(basic_istringstream_char),
582         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
583         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
584         ".?AV?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@");
585 DEFINE_RTTI_DATA4(basic_istringstream_wchar, sizeof(basic_istringstream_wchar),
586         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
587         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
588         ".?AV?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@");
589 DEFINE_RTTI_DATA4(basic_istringstream_short, sizeof(basic_istringstream_wchar),
590         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
591         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
592         ".?AV?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
593 DEFINE_RTTI_DATA8(basic_stringstream_char, sizeof(basic_stringstream_char),
594         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
595         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
596         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
597         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
598         ".?AV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@");
599 DEFINE_RTTI_DATA8(basic_stringstream_wchar, sizeof(basic_stringstream_wchar),
600         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
601         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
602         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
603         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
604         ".?AV?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@");
605 DEFINE_RTTI_DATA8(basic_stringstream_short, sizeof(basic_stringstream_wchar),
606         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
607         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
608         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
609         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
610         ".?AV?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
611 DEFINE_RTTI_DATA1(strstreambuf, sizeof(strstreambuf),
612         &basic_streambuf_char_rtti_base_descriptor, ".?AVstrstreambuf@std@@");
613
614 #ifndef __GNUC__
615 void __asm_dummy_vtables(void) {
616 #endif
617     __ASM_VTABLE(iosb,
618             VTABLE_ADD_FUNC(iosb_vector_dtor));
619     __ASM_VTABLE(ios_base,
620             VTABLE_ADD_FUNC(ios_base_vector_dtor));
621     __ASM_VTABLE(basic_ios_char,
622             VTABLE_ADD_FUNC(basic_ios_char_vector_dtor));
623     __ASM_VTABLE(basic_ios_wchar,
624             VTABLE_ADD_FUNC(basic_ios_wchar_vector_dtor));
625     __ASM_VTABLE(basic_ios_short,
626             VTABLE_ADD_FUNC(basic_ios_wchar_vector_dtor));
627     __ASM_VTABLE(basic_streambuf_char,
628             VTABLE_ADD_FUNC(basic_streambuf_char_vector_dtor)
629             VTABLE_ADD_FUNC(basic_streambuf_char_overflow)
630             VTABLE_ADD_FUNC(basic_streambuf_char_pbackfail)
631             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
632             VTABLE_ADD_FUNC(basic_streambuf_char_underflow)
633             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
634             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
635             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
636             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
637             VTABLE_ADD_FUNC(basic_streambuf_char_seekoff)
638             VTABLE_ADD_FUNC(basic_streambuf_char_seekpos)
639             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
640             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
641             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
642     __ASM_VTABLE(basic_streambuf_wchar,
643             VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
644             VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
645             VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
646             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
647             VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
648             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
649             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
650             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
651             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
652             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
653             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
654             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
655             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
656             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
657     __ASM_VTABLE(basic_streambuf_short,
658             VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
659             VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
660             VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
661             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
662             VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
663             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
664             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
665             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
666             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
667             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
668             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
669             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
670             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
671             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
672     __ASM_VTABLE(basic_filebuf_char,
673             VTABLE_ADD_FUNC(basic_filebuf_char_vector_dtor)
674             VTABLE_ADD_FUNC(basic_filebuf_char_overflow)
675             VTABLE_ADD_FUNC(basic_filebuf_char_pbackfail)
676             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
677             VTABLE_ADD_FUNC(basic_filebuf_char_underflow)
678             VTABLE_ADD_FUNC(basic_filebuf_char_uflow)
679             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
680             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
681             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
682             VTABLE_ADD_FUNC(basic_filebuf_char_seekoff)
683             VTABLE_ADD_FUNC(basic_filebuf_char_seekpos)
684             VTABLE_ADD_FUNC(basic_filebuf_char_setbuf)
685             VTABLE_ADD_FUNC(basic_filebuf_char_sync)
686             VTABLE_ADD_FUNC(basic_filebuf_char_imbue));
687     __ASM_VTABLE(basic_filebuf_wchar,
688             VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
689             VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
690             VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
691             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
692             VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
693             VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
694             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
695             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
696             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
697             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
698             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
699             VTABLE_ADD_FUNC(basic_filebuf_wchar_setbuf)
700             VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
701             VTABLE_ADD_FUNC(basic_filebuf_wchar_imbue));
702     __ASM_VTABLE(basic_filebuf_short,
703             VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
704             VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
705             VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
706             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
707             VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
708             VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
709             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
710             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
711             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
712             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
713             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
714             VTABLE_ADD_FUNC(basic_filebuf_short_setbuf)
715             VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
716             VTABLE_ADD_FUNC(basic_filebuf_short_imbue));
717     __ASM_VTABLE(basic_stringbuf_char,
718             VTABLE_ADD_FUNC(basic_stringbuf_char_vector_dtor)
719             VTABLE_ADD_FUNC(basic_stringbuf_char_overflow)
720             VTABLE_ADD_FUNC(basic_stringbuf_char_pbackfail)
721             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
722             VTABLE_ADD_FUNC(basic_stringbuf_char_underflow)
723             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
724             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
725             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
726             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
727             VTABLE_ADD_FUNC(basic_stringbuf_char_seekoff)
728             VTABLE_ADD_FUNC(basic_stringbuf_char_seekpos)
729             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
730             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
731             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
732     __ASM_VTABLE(basic_stringbuf_wchar,
733             VTABLE_ADD_FUNC(basic_stringbuf_wchar_vector_dtor)
734             VTABLE_ADD_FUNC(basic_stringbuf_wchar_overflow)
735             VTABLE_ADD_FUNC(basic_stringbuf_wchar_pbackfail)
736             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
737             VTABLE_ADD_FUNC(basic_stringbuf_wchar_underflow)
738             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
739             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
740             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
741             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
742             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekoff)
743             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekpos)
744             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
745             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
746             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
747     __ASM_VTABLE(basic_stringbuf_short,
748             VTABLE_ADD_FUNC(basic_stringbuf_wchar_vector_dtor)
749             VTABLE_ADD_FUNC(basic_stringbuf_wchar_overflow)
750             VTABLE_ADD_FUNC(basic_stringbuf_wchar_pbackfail)
751             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
752             VTABLE_ADD_FUNC(basic_stringbuf_wchar_underflow)
753             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
754             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
755             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
756             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
757             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekoff)
758             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekpos)
759             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
760             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
761             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
762     __ASM_VTABLE(basic_ostream_char,
763             VTABLE_ADD_FUNC(basic_ostream_char_vector_dtor));
764     __ASM_VTABLE(basic_ostream_wchar,
765             VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
766     __ASM_VTABLE(basic_ostream_short,
767             VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
768     __ASM_VTABLE(basic_istream_char,
769             VTABLE_ADD_FUNC(basic_istream_char_vector_dtor));
770     __ASM_VTABLE(basic_istream_wchar,
771             VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
772     __ASM_VTABLE(basic_istream_short,
773             VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
774     __ASM_VTABLE(basic_iostream_char,
775             VTABLE_ADD_FUNC(basic_iostream_char_vector_dtor));
776     __ASM_VTABLE(basic_iostream_wchar,
777             VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
778     __ASM_VTABLE(basic_iostream_short,
779             VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
780     __ASM_VTABLE(basic_ofstream_char,
781             VTABLE_ADD_FUNC(basic_ofstream_char_vector_dtor));
782     __ASM_VTABLE(basic_ofstream_wchar,
783             VTABLE_ADD_FUNC(basic_ofstream_wchar_vector_dtor));
784     __ASM_VTABLE(basic_ofstream_short,
785             VTABLE_ADD_FUNC(basic_ofstream_wchar_vector_dtor));
786     __ASM_VTABLE(basic_ifstream_char,
787             VTABLE_ADD_FUNC(basic_ifstream_char_vector_dtor));
788     __ASM_VTABLE(basic_ifstream_wchar,
789             VTABLE_ADD_FUNC(basic_ifstream_wchar_vector_dtor));
790     __ASM_VTABLE(basic_ifstream_short,
791             VTABLE_ADD_FUNC(basic_ifstream_wchar_vector_dtor));
792     __ASM_VTABLE(basic_fstream_char,
793             VTABLE_ADD_FUNC(basic_fstream_char_vector_dtor));
794     __ASM_VTABLE(basic_fstream_wchar,
795             VTABLE_ADD_FUNC(basic_fstream_wchar_vector_dtor));
796     __ASM_VTABLE(basic_fstream_short,
797             VTABLE_ADD_FUNC(basic_fstream_wchar_vector_dtor));
798     __ASM_VTABLE(basic_ostringstream_char,
799             VTABLE_ADD_FUNC(basic_ostringstream_char_vector_dtor));
800     __ASM_VTABLE(basic_ostringstream_wchar,
801             VTABLE_ADD_FUNC(basic_ostringstream_wchar_vector_dtor));
802     __ASM_VTABLE(basic_ostringstream_short,
803             VTABLE_ADD_FUNC(basic_ostringstream_wchar_vector_dtor));
804     __ASM_VTABLE(basic_istringstream_char,
805             VTABLE_ADD_FUNC(basic_istringstream_char_vector_dtor));
806     __ASM_VTABLE(basic_istringstream_wchar,
807             VTABLE_ADD_FUNC(basic_istringstream_wchar_vector_dtor));
808     __ASM_VTABLE(basic_istringstream_short,
809             VTABLE_ADD_FUNC(basic_istringstream_wchar_vector_dtor));
810     __ASM_VTABLE(basic_stringstream_char,
811             VTABLE_ADD_FUNC(basic_stringstream_char_vector_dtor));
812     __ASM_VTABLE(basic_stringstream_wchar,
813             VTABLE_ADD_FUNC(basic_stringstream_wchar_vector_dtor));
814     __ASM_VTABLE(basic_stringstream_short,
815             VTABLE_ADD_FUNC(basic_stringstream_wchar_vector_dtor));
816     __ASM_VTABLE(strstreambuf,
817             VTABLE_ADD_FUNC(strstreambuf_vector_dtor)
818             VTABLE_ADD_FUNC(strstreambuf_overflow)
819             VTABLE_ADD_FUNC(strstreambuf_pbackfail)
820             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
821             VTABLE_ADD_FUNC(strstreambuf_underflow)
822             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
823             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
824             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
825             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
826             VTABLE_ADD_FUNC(strstreambuf_seekoff)
827             VTABLE_ADD_FUNC(strstreambuf_seekpos)
828             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
829             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
830             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
831 #ifndef __GNUC__
832 }
833 #endif
834
835 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
836 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
837 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp_next, 16)
838 void __thiscall basic_streambuf_char_setp_next(basic_streambuf_char *this, char *first, char *next, char *last)
839 {
840     TRACE("(%p %p %p %p)\n", this, first, next, last);
841
842     this->wbuf = first;
843     this->wpos = next;
844     this->wsize = last-next;
845 }
846
847 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z */
848 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD0@Z */
849 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp, 12)
850 void __thiscall basic_streambuf_char_setp(basic_streambuf_char *this, char *first, char *last)
851 {
852     basic_streambuf_char_setp_next(this, first, first, last);
853 }
854
855 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
856 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
857 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setg, 16)
858 void __thiscall basic_streambuf_char_setg(basic_streambuf_char *this, char *first, char *next, char *last)
859 {
860     TRACE("(%p %p %p %p)\n", this, first, next, last);
861
862     this->rbuf = first;
863     this->rpos = next;
864     this->rsize = last-next;
865 }
866
867 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXXZ */
868 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXXZ */
869 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init_empty, 4)
870 void __thiscall basic_streambuf_char__Init_empty(basic_streambuf_char *this)
871 {
872     TRACE("(%p)\n", this);
873
874     this->prbuf = &this->rbuf;
875     this->pwbuf = &this->wbuf;
876     this->prpos = &this->rpos;
877     this->pwpos = &this->wpos;
878     this->prsize = &this->rsize;
879     this->pwsize = &this->wsize;
880
881     basic_streambuf_char_setp(this, NULL, NULL);
882     basic_streambuf_char_setg(this, NULL, NULL, NULL);
883 }
884
885 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@W4_Uninitialized@1@@Z */
886 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
887 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor_uninitialized, 8)
888 basic_streambuf_char* __thiscall basic_streambuf_char_ctor_uninitialized(basic_streambuf_char *this, int uninitialized)
889 {
890     TRACE("(%p %d)\n", this, uninitialized);
891     this->vtable = &MSVCP_basic_streambuf_char_vtable;
892     mutex_ctor(&this->lock);
893     return this;
894 }
895
896 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ */
897 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ */
898 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor, 4)
899 basic_streambuf_char* __thiscall basic_streambuf_char_ctor(basic_streambuf_char *this)
900 {
901     TRACE("(%p)\n", this);
902
903     this->vtable = &MSVCP_basic_streambuf_char_vtable;
904     mutex_ctor(&this->lock);
905     this->loc = MSVCRT_operator_new(sizeof(locale));
906     locale_ctor(this->loc);
907     basic_streambuf_char__Init_empty(this);
908
909     return this;
910 }
911
912 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
913 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
914 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_dtor, 4)
915 void __thiscall basic_streambuf_char_dtor(basic_streambuf_char *this)
916 {
917     TRACE("(%p)\n", this);
918
919     mutex_dtor(&this->lock);
920     locale_dtor(this->loc);
921     MSVCRT_operator_delete(this->loc);
922 }
923
924 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_vector_dtor, 8)
925 basic_streambuf_char* __thiscall basic_streambuf_char_vector_dtor(basic_streambuf_char *this, unsigned int flags)
926 {
927     TRACE("(%p %x)\n", this, flags);
928     if(flags & 2) {
929         /* we have an array, with the number of elements stored before the first object */
930         INT_PTR i, *ptr = (INT_PTR *)this-1;
931
932         for(i=*ptr-1; i>=0; i--)
933             basic_streambuf_char_dtor(this+i);
934         MSVCRT_operator_delete(ptr);
935     } else {
936         basic_streambuf_char_dtor(this);
937         if(flags & 1)
938             MSVCRT_operator_delete(this);
939     }
940
941     return this;
942 }
943
944 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
945 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
946 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnavail, 4)
947 streamsize __thiscall basic_streambuf_char__Gnavail(const basic_streambuf_char *this)
948 {
949     TRACE("(%p)\n", this);
950     return *this->prpos ? *this->prsize : 0;
951 }
952
953 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
954 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
955 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gndec, 4)
956 char* __thiscall basic_streambuf_char__Gndec(basic_streambuf_char *this)
957 {
958     TRACE("(%p)\n", this);
959     (*this->prsize)++;
960     (*this->prpos)--;
961     return *this->prpos;
962 }
963
964 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
965 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
966 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gninc, 4)
967 char* __thiscall basic_streambuf_char__Gninc(basic_streambuf_char *this)
968 {
969     TRACE("(%p)\n", this);
970     (*this->prsize)--;
971     return (*this->prpos)++;
972 }
973
974 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
975 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
976 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnpreinc, 4)
977 char* __thiscall basic_streambuf_char__Gnpreinc(basic_streambuf_char *this)
978 {
979     TRACE("(%p)\n", this);
980     (*this->prsize)--;
981     (*this->prpos)++;
982     return *this->prpos;
983 }
984
985 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAPAD0PAH001@Z */
986 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAPEAD0PEAH001@Z */
987 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init, 28)
988 void __thiscall basic_streambuf_char__Init(basic_streambuf_char *this, char **gf, char **gn, int *gc, char **pf, char **pn, int *pc)
989 {
990     TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
991
992     this->prbuf = gf;
993     this->pwbuf = pf;
994     this->prpos = gn;
995     this->pwpos = pn;
996     this->prsize = gc;
997     this->pwsize = pc;
998 }
999
1000 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1001 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1002 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Lock, 4)
1003 void __thiscall basic_streambuf_char__Lock(basic_streambuf_char *this)
1004 {
1005     TRACE("(%p)\n", this);
1006     mutex_lock(&this->lock);
1007 }
1008
1009 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
1010 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
1011 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pnavail, 4)
1012 streamsize __thiscall basic_streambuf_char__Pnavail(const basic_streambuf_char *this)
1013 {
1014     TRACE("(%p)\n", this);
1015     return *this->pwpos ? *this->pwsize : 0;
1016 }
1017
1018 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
1019 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
1020 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pninc, 4)
1021 char* __thiscall basic_streambuf_char__Pninc(basic_streambuf_char *this)
1022 {
1023     TRACE("(%p)\n", this);
1024     (*this->pwsize)--;
1025     return (*this->pwpos)++;
1026 }
1027
1028 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1029 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1030 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_underflow, 4)
1031 #define call_basic_streambuf_char_underflow(this) CALL_VTBL_FUNC(this, 16, \
1032         int, (basic_streambuf_char*), (this))
1033 int __thiscall basic_streambuf_char_underflow(basic_streambuf_char *this)
1034 {
1035     TRACE("(%p)\n", this);
1036     return EOF;
1037 }
1038
1039 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1040 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1041 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_uflow, 4)
1042 #define call_basic_streambuf_char_uflow(this) CALL_VTBL_FUNC(this, 20, \
1043         int, (basic_streambuf_char*), (this))
1044 int __thiscall basic_streambuf_char_uflow(basic_streambuf_char *this)
1045 {
1046     int ret;
1047
1048     TRACE("(%p)\n", this);
1049
1050     if(call_basic_streambuf_char_underflow(this)==EOF)
1051         return EOF;
1052
1053     ret = **this->prpos;
1054     (*this->prsize)--;
1055     (*this->prpos)++;
1056     return ret;
1057 }
1058
1059 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADIH@Z */
1060 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_K_J@Z */
1061 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Xsgetn_s, 16)
1062 #define call_basic_streambuf_char__Xsgetn_s(this, ptr, size, count) CALL_VTBL_FUNC(this, 28, \
1063         streamsize, (basic_streambuf_char*, char*, MSVCP_size_t, streamsize), (this, ptr, size, count))
1064 streamsize __thiscall basic_streambuf_char__Xsgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
1065 {
1066     streamsize copied, chunk;
1067     int c;
1068
1069     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1070
1071     for(copied=0; copied<count && size;) {
1072         chunk = basic_streambuf_char__Gnavail(this);
1073         if(chunk > count-copied)
1074             chunk = count-copied;
1075
1076         if(chunk > 0) {
1077             memcpy_s(ptr+copied, size, *this->prpos, chunk);
1078             *this->prpos += chunk;
1079             *this->prsize -= chunk;
1080             copied += chunk;
1081             size -= chunk;
1082         }else if((c = call_basic_streambuf_char_uflow(this)) != EOF) {
1083             ptr[copied] = c;
1084             copied++;
1085             size--;
1086         }else {
1087             break;
1088         }
1089     }
1090
1091     return copied;
1092 }
1093
1094 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
1095 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
1096 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Sgetn_s, 16)
1097 streamsize __thiscall basic_streambuf_char__Sgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
1098 {
1099     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1100     return call_basic_streambuf_char__Xsgetn_s(this, ptr, size, count);
1101 }
1102
1103 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1104 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1105 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Unlock, 4)
1106 void __thiscall basic_streambuf_char__Unlock(basic_streambuf_char *this)
1107 {
1108     TRACE("(%p)\n", this);
1109     mutex_unlock(&this->lock);
1110 }
1111
1112 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1113 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1114 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_eback, 4)
1115 char* __thiscall basic_streambuf_char_eback(const basic_streambuf_char *this)
1116 {
1117     TRACE("(%p)\n", this);
1118     return *this->prbuf;
1119 }
1120
1121 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1122 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1123 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gptr, 4)
1124 char* __thiscall basic_streambuf_char_gptr(const basic_streambuf_char *this)
1125 {
1126     TRACE("(%p)\n", this);
1127     return *this->prpos;
1128 }
1129
1130 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1131 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1132 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_egptr, 4)
1133 char* __thiscall basic_streambuf_char_egptr(const basic_streambuf_char *this)
1134 {
1135     TRACE("(%p)\n", this);
1136     return *this->prpos+*this->prsize;
1137 }
1138
1139 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1140 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1141 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_epptr, 4)
1142 char* __thiscall basic_streambuf_char_epptr(const basic_streambuf_char *this)
1143 {
1144     TRACE("(%p)\n", this);
1145     return *this->pwpos+*this->pwsize;
1146 }
1147
1148 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
1149 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
1150 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gbump, 8)
1151 void __thiscall basic_streambuf_char_gbump(basic_streambuf_char *this, int off)
1152 {
1153     TRACE("(%p %d)\n", this, off);
1154     *this->prpos += off;
1155     *this->prsize -= off;
1156 }
1157
1158 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QBE?AVlocale@2@XZ */
1159 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEBA?AVlocale@2@XZ */
1160 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_getloc, 8)
1161 locale* __thiscall basic_streambuf_char_getloc(const basic_streambuf_char *this, locale *ret)
1162 {
1163     TRACE("(%p)\n", this);
1164     return locale_copy_ctor(ret, this->loc);
1165 }
1166
1167 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
1168 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
1169 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_imbue, 8)
1170 #define call_basic_streambuf_char_imbue(this, loc) CALL_VTBL_FUNC(this, 52, \
1171         void, (basic_streambuf_char*, const locale*), (this, loc))
1172 void __thiscall basic_streambuf_char_imbue(basic_streambuf_char *this, const locale *loc)
1173 {
1174     TRACE("(%p %p)\n", this, loc);
1175 }
1176
1177 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
1178 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
1179 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_overflow, 8)
1180 #define call_basic_streambuf_char_overflow(this, ch) CALL_VTBL_FUNC(this, 4, \
1181         int, (basic_streambuf_char*, int), (this, ch))
1182 int __thiscall basic_streambuf_char_overflow(basic_streambuf_char *this, int ch)
1183 {
1184     TRACE("(%p %d)\n", this, ch);
1185     return EOF;
1186 }
1187
1188 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
1189 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
1190 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbackfail, 8)
1191 #define call_basic_streambuf_char_pbackfail(this, ch) CALL_VTBL_FUNC(this, 8, \
1192         int, (basic_streambuf_char*, int), (this, ch))
1193 int __thiscall basic_streambuf_char_pbackfail(basic_streambuf_char *this, int ch)
1194 {
1195     TRACE("(%p %d)\n", this, ch);
1196     return EOF;
1197 }
1198
1199 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1200 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1201 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbase, 4)
1202 char* __thiscall basic_streambuf_char_pbase(const basic_streambuf_char *this)
1203 {
1204     TRACE("(%p)\n", this);
1205     return *this->pwbuf;
1206 }
1207
1208 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
1209 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
1210 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbump, 8)
1211 void __thiscall basic_streambuf_char_pbump(basic_streambuf_char *this, int off)
1212 {
1213     TRACE("(%p %d)\n", this, off);
1214     *this->pwpos += off;
1215     *this->pwsize -= off;
1216 }
1217
1218 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1219 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1220 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pptr, 4)
1221 char* __thiscall basic_streambuf_char_pptr(const basic_streambuf_char *this)
1222 {
1223     TRACE("(%p)\n", this);
1224     return *this->pwpos;
1225 }
1226
1227 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1228 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
1229 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubimbue, 12)
1230 locale* __thiscall basic_streambuf_char_pubimbue(basic_streambuf_char *this, locale *ret, const locale *loc)
1231 {
1232     TRACE("(%p %p)\n", this, loc);
1233     memcpy(ret, this->loc, sizeof(locale));
1234     call_basic_streambuf_char_imbue(this, loc);
1235     locale_copy_ctor(this->loc, loc);
1236     return ret;
1237 }
1238
1239 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
1240 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
1241 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekoff, 20)
1242 #define call_basic_streambuf_char_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 36, \
1243         fpos_int*, (basic_streambuf_char*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
1244 fpos_int* __thiscall basic_streambuf_char_seekoff(basic_streambuf_char *this,
1245         fpos_int *ret, streamoff off, int way, int mode)
1246 {
1247     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1248     ret->off = 0;
1249     ret->pos = -1;
1250     ret->state = 0;
1251     return ret;
1252 }
1253
1254 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
1255 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
1256 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff, 20)
1257 fpos_int* __thiscall basic_streambuf_char_pubseekoff(basic_streambuf_char *this,
1258         fpos_int *ret, streamoff off, int way, int mode)
1259 {
1260     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1261     return call_basic_streambuf_char_seekoff(this, ret, off, way, mode);
1262 }
1263
1264 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
1265 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
1266 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff_old, 20)
1267 fpos_int* __thiscall basic_streambuf_char_pubseekoff_old(basic_streambuf_char *this,
1268         fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
1269 {
1270     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1271     return basic_streambuf_char_pubseekoff(this, ret, off, way, mode);
1272 }
1273
1274 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
1275 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
1276 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekpos, 36)
1277 #define call_basic_streambuf_char_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 40, \
1278         fpos_int*, (basic_streambuf_char*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
1279 fpos_int* __thiscall basic_streambuf_char_seekpos(basic_streambuf_char *this,
1280         fpos_int *ret, fpos_int pos, int mode)
1281 {
1282     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1283     ret->off = 0;
1284     ret->pos = -1;
1285     ret->state = 0;
1286     return ret;
1287 }
1288
1289 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
1290 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
1291 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos, 36)
1292 fpos_int* __thiscall basic_streambuf_char_pubseekpos(basic_streambuf_char *this,
1293         fpos_int *ret, fpos_int pos, int mode)
1294 {
1295     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1296     return call_basic_streambuf_char_seekpos(this, ret, pos, mode);
1297 }
1298
1299 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
1300 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
1301 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos_old, 36)
1302 fpos_int* __thiscall basic_streambuf_char_pubseekpos_old(basic_streambuf_char *this,
1303         fpos_int *ret, fpos_int pos, unsigned int mode)
1304 {
1305     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1306     return basic_streambuf_char_pubseekpos(this, ret, pos, mode);
1307 }
1308
1309 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEPAV12@PADH@Z */
1310 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAPEAV12@PEAD_J@Z */
1311 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setbuf, 12)
1312 #define call_basic_streambuf_char_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 44, \
1313         basic_streambuf_char*, (basic_streambuf_char*, char*, streamsize), (this, buf, count))
1314 basic_streambuf_char* __thiscall basic_streambuf_char_setbuf(basic_streambuf_char *this, char *buf, streamsize count)
1315 {
1316     TRACE("(%p %p %ld)\n", this, buf, count);
1317     return this;
1318 }
1319
1320 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PADH@Z */
1321 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEAD_J@Z */
1322 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsetbuf, 12)
1323 basic_streambuf_char* __thiscall basic_streambuf_char_pubsetbuf(basic_streambuf_char *this, char *buf, streamsize count)
1324 {
1325     TRACE("(%p %p %ld)\n", this, buf, count);
1326     return call_basic_streambuf_char_setbuf(this, buf, count);
1327 }
1328
1329 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1330 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1331 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sync, 4)
1332 #define call_basic_streambuf_char_sync(this) CALL_VTBL_FUNC(this, 48, \
1333         int, (basic_streambuf_char*), (this))
1334 int __thiscall basic_streambuf_char_sync(basic_streambuf_char *this)
1335 {
1336     TRACE("(%p)\n", this);
1337     return 0;
1338 }
1339
1340 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1341 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1342 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsync, 4)
1343 int __thiscall basic_streambuf_char_pubsync(basic_streambuf_char *this)
1344 {
1345     TRACE("(%p)\n", this);
1346     return call_basic_streambuf_char_sync(this);
1347 }
1348
1349 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
1350 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
1351 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetn, 12)
1352 streamsize __thiscall basic_streambuf_char_sgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1353 {
1354     TRACE("(%p %p %ld)\n", this, ptr, count);
1355     return call_basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1356 }
1357
1358 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1359 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JXZ */
1360 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_showmanyc, 4)
1361 #define call_basic_streambuf_char_showmanyc(this) CALL_VTBL_FUNC(this, 12, \
1362         streamsize, (basic_streambuf_char*), (this))
1363 streamsize __thiscall basic_streambuf_char_showmanyc(basic_streambuf_char *this)
1364 {
1365     TRACE("(%p)\n", this);
1366     return 0;
1367 }
1368
1369 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1370 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JXZ */
1371 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_in_avail, 4)
1372 streamsize __thiscall basic_streambuf_char_in_avail(basic_streambuf_char *this)
1373 {
1374     streamsize ret;
1375
1376     TRACE("(%p)\n", this);
1377
1378     ret = basic_streambuf_char__Gnavail(this);
1379     return ret ? ret : call_basic_streambuf_char_showmanyc(this);
1380 }
1381
1382 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
1383 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
1384 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputbackc, 8)
1385 int __thiscall basic_streambuf_char_sputbackc(basic_streambuf_char *this, char ch)
1386 {
1387     TRACE("(%p %d)\n", this, ch);
1388     if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
1389         (*this->prsize)++;
1390         (*this->prpos)--;
1391         return ch;
1392     }
1393
1394     return call_basic_streambuf_char_pbackfail(this, ch);
1395 }
1396
1397 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
1398 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
1399 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputc, 8)
1400 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char *this, char ch)
1401 {
1402     TRACE("(%p %d)\n", this, ch);
1403     return basic_streambuf_char__Pnavail(this) ?
1404         (*basic_streambuf_char__Pninc(this) = ch) :
1405         call_basic_streambuf_char_overflow(this, ch);
1406 }
1407
1408 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1409 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1410 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sungetc, 4)
1411 int __thiscall basic_streambuf_char_sungetc(basic_streambuf_char *this)
1412 {
1413     TRACE("(%p)\n", this);
1414     if(*this->prpos && *this->prpos>*this->prbuf) {
1415         (*this->prsize)++;
1416         (*this->prpos)--;
1417         return **this->prpos;
1418     }
1419
1420     return call_basic_streambuf_char_pbackfail(this, EOF);
1421 }
1422
1423 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1424 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1425 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_stossc, 4)
1426 void __thiscall basic_streambuf_char_stossc(basic_streambuf_char *this)
1427 {
1428     TRACE("(%p)\n", this);
1429     if(basic_streambuf_char__Gnavail(this))
1430         basic_streambuf_char__Gninc(this);
1431     else
1432         call_basic_streambuf_char_uflow(this);
1433 }
1434
1435 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1436 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1437 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sbumpc, 4)
1438 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char *this)
1439 {
1440     TRACE("(%p)\n", this);
1441     return basic_streambuf_char__Gnavail(this) ?
1442         *basic_streambuf_char__Gninc(this) : call_basic_streambuf_char_uflow(this);
1443 }
1444
1445 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1446 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1447 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetc, 4)
1448 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char *this)
1449 {
1450     TRACE("(%p)\n", this);
1451     return basic_streambuf_char__Gnavail(this) ?
1452         *basic_streambuf_char_gptr(this) : call_basic_streambuf_char_underflow(this);
1453 }
1454
1455 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1456 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1457 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_snextc, 4)
1458 int __thiscall basic_streambuf_char_snextc(basic_streambuf_char *this)
1459 {
1460     TRACE("(%p)\n", this);
1461
1462     if(basic_streambuf_char__Gnavail(this) > 1)
1463         return *basic_streambuf_char__Gnpreinc(this);
1464     return basic_streambuf_char_sbumpc(this)==EOF ?
1465         EOF : basic_streambuf_char_sgetc(this);
1466 }
1467
1468 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADH@Z */
1469 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z */
1470 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsgetn, 12)
1471 #define call_basic_streambuf_char_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 24, \
1472         streamsize, (basic_streambuf_char*, char*, streamsize), (this, ptr, count))
1473 streamsize __thiscall basic_streambuf_char_xsgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1474 {
1475     TRACE("(%p %p %ld)\n", this, ptr, count);
1476     return call_basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1477 }
1478
1479 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPBDH@Z */
1480 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z */
1481 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsputn, 12)
1482 #define call_basic_streambuf_char_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
1483         streamsize, (basic_streambuf_char*, const char*, streamsize), (this, ptr, count))
1484 streamsize __thiscall basic_streambuf_char_xsputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1485 {
1486     streamsize copied, chunk;
1487
1488     TRACE("(%p %p %ld)\n", this, ptr, count);
1489
1490     for(copied=0; copied<count;) {
1491         chunk = basic_streambuf_char__Pnavail(this);
1492         if(chunk > count-copied)
1493             chunk = count-copied;
1494
1495         if(chunk > 0) {
1496             memcpy(*this->pwpos, ptr+copied, chunk);
1497             *this->pwpos += chunk;
1498             *this->pwsize -= chunk;
1499             copied += chunk;
1500         }else if(call_basic_streambuf_char_overflow(this, ptr[copied]) != EOF) {
1501             copied++;
1502         }else {
1503             break;
1504         }
1505     }
1506
1507     return copied;
1508 }
1509
1510 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z */
1511 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEBD_J@Z */
1512 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputn, 12)
1513 streamsize __thiscall basic_streambuf_char_sputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1514 {
1515     TRACE("(%p %p %ld)\n", this, ptr, count);
1516     return call_basic_streambuf_char_xsputn(this, ptr, count);
1517 }
1518
1519 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1520 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1521 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1522 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1523 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp_next, 16)
1524 void __thiscall basic_streambuf_wchar_setp_next(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1525 {
1526     TRACE("(%p %p %p %p)\n", this, first, next, last);
1527
1528     this->wbuf = first;
1529     this->wpos = next;
1530     this->wsize = last-next;
1531 }
1532
1533 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W0@Z */
1534 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W0@Z */
1535 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG0@Z */
1536 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG0@Z */
1537 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp, 12)
1538 void __thiscall basic_streambuf_wchar_setp(basic_streambuf_wchar *this, wchar_t *first, wchar_t *last)
1539 {
1540     basic_streambuf_wchar_setp_next(this, first, first, last);
1541 }
1542
1543 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1544 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1545 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1546 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1547 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setg, 16)
1548 void __thiscall basic_streambuf_wchar_setg(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1549 {
1550     TRACE("(%p %p %p %p)\n", this, first, next, last);
1551
1552     this->rbuf = first;
1553     this->rpos = next;
1554     this->rsize = last-next;
1555 }
1556
1557 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXXZ */
1558 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXXZ */
1559 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXXZ */
1560 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXXZ */
1561 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init_empty, 4)
1562 void __thiscall basic_streambuf_wchar__Init_empty(basic_streambuf_wchar *this)
1563 {
1564     TRACE("(%p)\n", this);
1565
1566     this->prbuf = &this->rbuf;
1567     this->pwbuf = &this->wbuf;
1568     this->prpos = &this->rpos;
1569     this->pwpos = &this->wpos;
1570     this->prsize = &this->rsize;
1571     this->pwsize = &this->wsize;
1572
1573     basic_streambuf_wchar_setp(this, NULL, NULL);
1574     basic_streambuf_wchar_setg(this, NULL, NULL, NULL);
1575 }
1576
1577 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1578 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1579 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor_uninitialized, 8)
1580 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1581 {
1582     TRACE("(%p %d)\n", this, uninitialized);
1583     this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1584     mutex_ctor(&this->lock);
1585     return this;
1586 }
1587
1588 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1589 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1590 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor_uninitialized, 8)
1591 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1592 {
1593     TRACE("(%p %d)\n", this, uninitialized);
1594     basic_streambuf_wchar_ctor_uninitialized(this, uninitialized);
1595     this->vtable = &MSVCP_basic_streambuf_short_vtable;
1596     return this;
1597 }
1598
1599 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
1600 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
1601 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor, 4)
1602 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor(basic_streambuf_wchar *this)
1603 {
1604     TRACE("(%p)\n", this);
1605
1606     this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1607     mutex_ctor(&this->lock);
1608     this->loc = MSVCRT_operator_new(sizeof(locale));
1609     locale_ctor(this->loc);
1610     basic_streambuf_wchar__Init_empty(this);
1611
1612     return this;
1613 }
1614
1615 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@XZ */
1616 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@XZ */
1617 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor, 4)
1618 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor(basic_streambuf_wchar *this)
1619 {
1620     TRACE("(%p)\n", this);
1621     basic_streambuf_wchar_ctor(this);
1622     this->vtable = &MSVCP_basic_streambuf_short_vtable;
1623     return this;
1624 }
1625
1626 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
1627 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
1628 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
1629 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
1630 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_dtor, 4)
1631 void __thiscall basic_streambuf_wchar_dtor(basic_streambuf_wchar *this)
1632 {
1633     TRACE("(%p)\n", this);
1634
1635     mutex_dtor(&this->lock);
1636     locale_dtor(this->loc);
1637     MSVCRT_operator_delete(this->loc);
1638 }
1639
1640 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_vector_dtor, 8)
1641 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_vector_dtor(basic_streambuf_wchar *this, unsigned int flags)
1642 {
1643     TRACE("(%p %x)\n", this, flags);
1644     if(flags & 2) {
1645         /* we have an array, with the number of elements stored before the first object */
1646         INT_PTR i, *ptr = (INT_PTR *)this-1;
1647
1648         for(i=*ptr-1; i>=0; i--)
1649             basic_streambuf_wchar_dtor(this+i);
1650         MSVCRT_operator_delete(ptr);
1651     } else {
1652         basic_streambuf_wchar_dtor(this);
1653         if(flags & 1)
1654             MSVCRT_operator_delete(this);
1655     }
1656
1657     return this;
1658 }
1659
1660 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1661 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1662 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1663 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1664 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnavail, 4)
1665 streamsize __thiscall basic_streambuf_wchar__Gnavail(const basic_streambuf_wchar *this)
1666 {
1667     TRACE("(%p)\n", this);
1668     return *this->prpos ? *this->prsize : 0;
1669 }
1670
1671 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1672 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1673 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1674 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1675 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gndec, 4)
1676 wchar_t* __thiscall basic_streambuf_wchar__Gndec(basic_streambuf_wchar *this)
1677 {
1678     TRACE("(%p)\n", this);
1679     (*this->prsize)++;
1680     (*this->prpos)--;
1681     return *this->prpos;
1682 }
1683
1684 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1685 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1686 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1687 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1688 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gninc, 4)
1689 wchar_t* __thiscall basic_streambuf_wchar__Gninc(basic_streambuf_wchar *this)
1690 {
1691     TRACE("(%p)\n", this);
1692     (*this->prsize)--;
1693     return (*this->prpos)++;
1694 }
1695
1696 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1697 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1698 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1699 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1700 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnpreinc, 4)
1701 wchar_t* __thiscall basic_streambuf_wchar__Gnpreinc(basic_streambuf_wchar *this)
1702 {
1703     TRACE("(%p)\n", this);
1704     (*this->prsize)--;
1705     (*this->prpos)++;
1706     return *this->prpos;
1707 }
1708
1709 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPAPA_W0PAH001@Z */
1710 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAPEA_W0PEAH001@Z */
1711 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAPAG0PAH001@Z */
1712 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAPEAG0PEAH001@Z */
1713 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init, 28)
1714 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)
1715 {
1716     TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
1717
1718     this->prbuf = gf;
1719     this->pwbuf = pf;
1720     this->prpos = gn;
1721     this->pwpos = pn;
1722     this->prsize = gc;
1723     this->pwsize = pc;
1724 }
1725
1726 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1727 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1728 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1729 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1730 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Lock, 4)
1731 void __thiscall basic_streambuf_wchar__Lock(basic_streambuf_wchar *this)
1732 {
1733     TRACE("(%p)\n", this);
1734     mutex_lock(&this->lock);
1735 }
1736
1737 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1738 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1739 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1740 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1741 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pnavail, 4)
1742 streamsize __thiscall basic_streambuf_wchar__Pnavail(const basic_streambuf_wchar *this)
1743 {
1744     TRACE("(%p)\n", this);
1745     return *this->pwpos ? *this->pwsize : 0;
1746 }
1747
1748 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1749 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1750 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1751 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1752 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pninc, 4)
1753 wchar_t* __thiscall basic_streambuf_wchar__Pninc(basic_streambuf_wchar *this)
1754 {
1755     TRACE("(%p)\n", this);
1756     (*this->pwsize)--;
1757     return (*this->pwpos)++;
1758 }
1759
1760 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1761 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1762 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1763 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1764 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_underflow, 4)
1765 #define call_basic_streambuf_wchar_underflow(this) CALL_VTBL_FUNC(this, 16, \
1766         unsigned short, (basic_streambuf_wchar*), (this))
1767 unsigned short __thiscall basic_streambuf_wchar_underflow(basic_streambuf_wchar *this)
1768 {
1769     TRACE("(%p)\n", this);
1770     return WEOF;
1771 }
1772
1773 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1774 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1775 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1776 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1777 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_uflow, 4)
1778 #define call_basic_streambuf_wchar_uflow(this) CALL_VTBL_FUNC(this, 20, \
1779         unsigned short, (basic_streambuf_wchar*), (this))
1780 unsigned short __thiscall basic_streambuf_wchar_uflow(basic_streambuf_wchar *this)
1781 {
1782     int ret;
1783
1784     TRACE("(%p)\n", this);
1785
1786     if(call_basic_streambuf_wchar_underflow(this)==WEOF)
1787         return WEOF;
1788
1789     ret = **this->prpos;
1790     (*this->prsize)--;
1791     (*this->prpos)++;
1792     return ret;
1793 }
1794
1795 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WIH@Z */
1796 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_K_J@Z */
1797 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGIH@Z */
1798 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_K_J@Z */
1799 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Xsgetn_s, 16)
1800 #define call_basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count) CALL_VTBL_FUNC(this, 28, \
1801         streamsize, (basic_streambuf_wchar*, wchar_t*, MSVCP_size_t, streamsize), (this, ptr, size, count))
1802 streamsize __thiscall basic_streambuf_wchar__Xsgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1803 {
1804     streamsize copied, chunk;
1805     unsigned short c;
1806
1807     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1808
1809     for(copied=0; copied<count && size;) {
1810         chunk = basic_streambuf_wchar__Gnavail(this);
1811         if(chunk > count-copied)
1812             chunk = count-copied;
1813
1814         if(chunk > 0) {
1815             memcpy_s(ptr+copied, size, *this->prpos, chunk*sizeof(wchar_t));
1816             *this->prpos += chunk;
1817             *this->prsize -= chunk;
1818             copied += chunk;
1819             size -= chunk*sizeof(wchar_t);
1820         }else if((c = call_basic_streambuf_wchar_uflow(this)) != WEOF) {
1821             ptr[copied] = c;
1822             copied++;
1823             size--;
1824         }else {
1825             break;
1826         }
1827     }
1828
1829     return copied;
1830 }
1831
1832 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
1833 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
1834 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
1835 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
1836 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Sgetn_s, 16)
1837 streamsize __thiscall basic_streambuf_wchar__Sgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1838 {
1839     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1840     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count);
1841 }
1842
1843 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1844 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1845 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1846 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1847 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Unlock, 4)
1848 void __thiscall basic_streambuf_wchar__Unlock(basic_streambuf_wchar *this)
1849 {
1850     TRACE("(%p)\n", this);
1851     mutex_unlock(&this->lock);
1852 }
1853
1854 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1855 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1856 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1857 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1858 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_eback, 4)
1859 wchar_t* __thiscall basic_streambuf_wchar_eback(const basic_streambuf_wchar *this)
1860 {
1861     TRACE("(%p)\n", this);
1862     return *this->prbuf;
1863 }
1864
1865 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1866 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1867 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1868 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1869 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gptr, 4)
1870 wchar_t* __thiscall basic_streambuf_wchar_gptr(const basic_streambuf_wchar *this)
1871 {
1872     TRACE("(%p)\n", this);
1873     return *this->prpos;
1874 }
1875
1876 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1877 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1878 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1879 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1880 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_egptr, 4)
1881 wchar_t* __thiscall basic_streambuf_wchar_egptr(const basic_streambuf_wchar *this)
1882 {
1883     TRACE("(%p)\n", this);
1884     return *this->prpos+*this->prsize;
1885 }
1886
1887 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1888 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1889 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1890 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1891 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_epptr, 4)
1892 wchar_t* __thiscall basic_streambuf_wchar_epptr(const basic_streambuf_wchar *this)
1893 {
1894     TRACE("(%p)\n", this);
1895     return *this->pwpos+*this->pwsize;
1896 }
1897
1898 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1899 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1900 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1901 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1902 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gbump, 8)
1903 void __thiscall basic_streambuf_wchar_gbump(basic_streambuf_wchar *this, int off)
1904 {
1905     TRACE("(%p %d)\n", this, off);
1906     *this->prpos += off;
1907     *this->prsize -= off;
1908 }
1909
1910 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QBE?AVlocale@2@XZ */
1911 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEBA?AVlocale@2@XZ */
1912 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QBE?AVlocale@2@XZ */
1913 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEBA?AVlocale@2@XZ */
1914 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_getloc, 8)
1915 locale* __thiscall basic_streambuf_wchar_getloc(const basic_streambuf_wchar *this, locale *ret)
1916 {
1917     TRACE("(%p)\n", this);
1918     return locale_copy_ctor(ret, this->loc);
1919 }
1920
1921 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
1922 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
1923 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
1924 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
1925 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_imbue, 8)
1926 #define call_basic_streambuf_wchar_imbue(this, loc) CALL_VTBL_FUNC(this, 52, \
1927         void, (basic_streambuf_wchar*, const locale*), (this, loc))
1928 void __thiscall basic_streambuf_wchar_imbue(basic_streambuf_wchar *this, const locale *loc)
1929 {
1930     TRACE("(%p %p)\n", this, loc);
1931 }
1932
1933 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1934 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1935 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1936 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1937 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_overflow, 8)
1938 #define call_basic_streambuf_wchar_overflow(this, ch) CALL_VTBL_FUNC(this, 4, \
1939         unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1940 unsigned short __thiscall basic_streambuf_wchar_overflow(basic_streambuf_wchar *this, unsigned short ch)
1941 {
1942     TRACE("(%p %d)\n", this, ch);
1943     return WEOF;
1944 }
1945
1946 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1947 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1948 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1949 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1950 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbackfail, 8)
1951 #define call_basic_streambuf_wchar_pbackfail(this, ch) CALL_VTBL_FUNC(this, 8, \
1952         unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1953 unsigned short __thiscall basic_streambuf_wchar_pbackfail(basic_streambuf_wchar *this, unsigned short ch)
1954 {
1955     TRACE("(%p %d)\n", this, ch);
1956     return WEOF;
1957 }
1958
1959 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1960 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1961 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1962 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1963 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbase, 4)
1964 wchar_t* __thiscall basic_streambuf_wchar_pbase(const basic_streambuf_wchar *this)
1965 {
1966     TRACE("(%p)\n", this);
1967     return *this->pwbuf;
1968 }
1969
1970 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1971 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1972 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1973 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1974 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbump, 8)
1975 void __thiscall basic_streambuf_wchar_pbump(basic_streambuf_wchar *this, int off)
1976 {
1977     TRACE("(%p %d)\n", this, off);
1978     *this->pwpos += off;
1979     *this->pwsize -= off;
1980 }
1981
1982 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1983 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1984 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1985 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1986 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pptr, 4)
1987 wchar_t* __thiscall basic_streambuf_wchar_pptr(const basic_streambuf_wchar *this)
1988 {
1989     TRACE("(%p)\n", this);
1990     return *this->pwpos;
1991 }
1992
1993 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1994 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
1995 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1996 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
1997 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubimbue, 12)
1998 locale* __thiscall basic_streambuf_wchar_pubimbue(basic_streambuf_wchar *this, locale *ret, const locale *loc)
1999 {
2000     TRACE("(%p %p)\n", this, loc);
2001     memcpy(ret, this->loc, sizeof(locale));
2002     call_basic_streambuf_wchar_imbue(this, loc);
2003     locale_copy_ctor(this->loc, loc);
2004     return ret;
2005 }
2006
2007 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2008 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2009 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2010 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2011 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekoff, 20)
2012 #define call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 36, \
2013         fpos_int*, (basic_streambuf_wchar*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
2014 fpos_int* __thiscall basic_streambuf_wchar_seekoff(basic_streambuf_wchar *this,
2015         fpos_int *ret, streamoff off, int way, int mode)
2016 {
2017     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2018     ret->off = 0;
2019     ret->pos = -1;
2020     ret->state = 0;
2021     return ret;
2022 }
2023
2024 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
2025 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
2026 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
2027 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
2028 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff, 20)
2029 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff(basic_streambuf_wchar *this,
2030         fpos_int *ret, streamoff off, int way, int mode)
2031 {
2032     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2033     return call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode);
2034 }
2035
2036 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
2037 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
2038 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
2039 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
2040 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff_old, 20)
2041 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff_old(basic_streambuf_wchar *this,
2042         fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
2043 {
2044     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2045     return basic_streambuf_wchar_pubseekoff(this, ret, off, way, mode);
2046 }
2047
2048 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2049 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2050 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2051 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2052 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekpos, 36)
2053 #define call_basic_streambuf_wchar_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 40, \
2054         fpos_int*, (basic_streambuf_wchar*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
2055 fpos_int* __thiscall basic_streambuf_wchar_seekpos(basic_streambuf_wchar *this,
2056         fpos_int *ret, fpos_int pos, int mode)
2057 {
2058     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2059     ret->off = 0;
2060     ret->pos = -1;
2061     ret->state = 0;
2062     return ret;
2063 }
2064
2065 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
2066 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
2067 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
2068 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
2069 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos, 36)
2070 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos(basic_streambuf_wchar *this,
2071         fpos_int *ret, fpos_int pos, int mode)
2072 {
2073     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2074     return call_basic_streambuf_wchar_seekpos(this, ret, pos, mode);
2075 }
2076
2077 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
2078 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
2079 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
2080 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
2081 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos_old, 36)
2082 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos_old(basic_streambuf_wchar *this,
2083         fpos_int *ret, fpos_int pos, unsigned int mode)
2084 {
2085     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2086     return basic_streambuf_wchar_pubseekpos(this, ret, pos, mode);
2087 }
2088
2089 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEPAV12@PA_WH@Z */
2090 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV12@PEA_W_J@Z */
2091 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEPAV12@PAGH@Z */
2092 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAPEAV12@PEAG_J@Z */
2093 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setbuf, 12)
2094 #define call_basic_streambuf_wchar_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 44, \
2095         basic_streambuf_wchar*, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, buf, count))
2096 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_setbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
2097 {
2098     TRACE("(%p %p %ld)\n", this, buf, count);
2099     return this;
2100 }
2101
2102 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PA_WH@Z */
2103 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEA_W_J@Z */
2104 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PAGH@Z */
2105 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEAG_J@Z */
2106 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsetbuf, 12)
2107 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_pubsetbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
2108 {
2109     TRACE("(%p %p %ld)\n", this, buf, count);
2110     return call_basic_streambuf_wchar_setbuf(this, buf, count);
2111 }
2112
2113 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2114 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
2115 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2116 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
2117 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sync, 4)
2118 #define call_basic_streambuf_wchar_sync(this) CALL_VTBL_FUNC(this, 48, \
2119         int, (basic_streambuf_wchar*), (this))
2120 int __thiscall basic_streambuf_wchar_sync(basic_streambuf_wchar *this)
2121 {
2122     TRACE("(%p)\n", this);
2123     return 0;
2124 }
2125
2126 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
2127 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
2128 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
2129 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHXZ */
2130 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsync, 4)
2131 int __thiscall basic_streambuf_wchar_pubsync(basic_streambuf_wchar *this)
2132 {
2133     TRACE("(%p)\n", this);
2134     return call_basic_streambuf_wchar_sync(this);
2135 }
2136
2137 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
2138 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
2139 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
2140 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
2141 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetn, 12)
2142 streamsize __thiscall basic_streambuf_wchar_sgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
2143 {
2144     TRACE("(%p %p %ld)\n", this, ptr, count);
2145     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
2146 }
2147
2148 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2149 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JXZ */
2150 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2151 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JXZ */
2152 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_showmanyc, 4)
2153 #define call_basic_streambuf_wchar_showmanyc(this) CALL_VTBL_FUNC(this, 12, \
2154         streamsize, (basic_streambuf_wchar*), (this))
2155 streamsize __thiscall basic_streambuf_wchar_showmanyc(basic_streambuf_wchar *this)
2156 {
2157     TRACE("(%p)\n", this);
2158     return 0;
2159 }
2160
2161 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
2162 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JXZ */
2163 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
2164 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JXZ */
2165 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_in_avail, 4)
2166 streamsize __thiscall basic_streambuf_wchar_in_avail(basic_streambuf_wchar *this)
2167 {
2168     streamsize ret;
2169
2170     TRACE("(%p)\n", this);
2171
2172     ret = basic_streambuf_wchar__Gnavail(this);
2173     return ret ? ret : call_basic_streambuf_wchar_showmanyc(this);
2174 }
2175
2176 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
2177 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
2178 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
2179 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
2180 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputbackc, 8)
2181 unsigned short __thiscall basic_streambuf_wchar_sputbackc(basic_streambuf_wchar *this, wchar_t ch)
2182 {
2183     TRACE("(%p %d)\n", this, ch);
2184     if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
2185         (*this->prsize)++;
2186         (*this->prpos)--;
2187         return ch;
2188     }
2189
2190     return call_basic_streambuf_wchar_pbackfail(this, ch);
2191 }
2192
2193 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
2194 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
2195 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
2196 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHG@Z */
2197 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputc, 8)
2198 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar *this, wchar_t ch)
2199 {
2200     TRACE("(%p %d)\n", this, ch);
2201     return basic_streambuf_wchar__Pnavail(this) ?
2202         (*basic_streambuf_wchar__Pninc(this) = ch) :
2203         call_basic_streambuf_wchar_overflow(this, ch);
2204 }
2205
2206 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2207 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2208 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2209 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2210 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sungetc, 4)
2211 unsigned short __thiscall basic_streambuf_wchar_sungetc(basic_streambuf_wchar *this)
2212 {
2213     TRACE("(%p)\n", this);
2214     if(*this->prpos && *this->prpos>*this->prbuf) {
2215         (*this->prsize)++;
2216         (*this->prpos)--;
2217         return **this->prpos;
2218     }
2219
2220     return call_basic_streambuf_wchar_pbackfail(this, WEOF);
2221 }
2222
2223 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
2224 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
2225 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
2226 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
2227 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_stossc, 4)
2228 void __thiscall basic_streambuf_wchar_stossc(basic_streambuf_wchar *this)
2229 {
2230     TRACE("(%p)\n", this);
2231     if(basic_streambuf_wchar__Gnavail(this))
2232         basic_streambuf_wchar__Gninc(this);
2233     else
2234         call_basic_streambuf_wchar_uflow(this);
2235 }
2236
2237 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2238 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2239 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2240 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2241 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sbumpc, 4)
2242 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar *this)
2243 {
2244     TRACE("(%p)\n", this);
2245     return basic_streambuf_wchar__Gnavail(this) ?
2246         *basic_streambuf_wchar__Gninc(this) : call_basic_streambuf_wchar_uflow(this);
2247 }
2248
2249 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2250 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2251 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2252 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2253 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetc, 4)
2254 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar *this)
2255 {
2256     TRACE("(%p)\n", this);
2257     return basic_streambuf_wchar__Gnavail(this) ?
2258         *basic_streambuf_wchar_gptr(this) : call_basic_streambuf_wchar_underflow(this);
2259 }
2260
2261 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2262 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2263 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2264 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2265 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_snextc, 4)
2266 unsigned short __thiscall basic_streambuf_wchar_snextc(basic_streambuf_wchar *this)
2267 {
2268     TRACE("(%p)\n", this);
2269
2270     if(basic_streambuf_wchar__Gnavail(this) > 1)
2271         return *basic_streambuf_wchar__Gnpreinc(this);
2272     return basic_streambuf_wchar_sbumpc(this)==WEOF ?
2273         WEOF : basic_streambuf_wchar_sgetc(this);
2274 }
2275
2276 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WH@Z */
2277 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_J@Z */
2278 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGH@Z */
2279 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_J@Z */
2280 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsgetn, 12)
2281 #define call_basic_streambuf_wchar_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 24, \
2282         streamsize, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, ptr, count))
2283 streamsize __thiscall basic_streambuf_wchar_xsgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
2284 {
2285     TRACE("(%p %p %ld)\n", this, ptr, count);
2286     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
2287 }
2288
2289 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPB_WH@Z */
2290 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEB_W_J@Z */
2291 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPBGH@Z */
2292 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEBG_J@Z */
2293 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsputn, 12)
2294 #define call_basic_streambuf_wchar_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
2295         streamsize, (basic_streambuf_wchar*, const wchar_t*, streamsize), (this, ptr, count))
2296 streamsize __thiscall basic_streambuf_wchar_xsputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
2297 {
2298     streamsize copied, chunk;
2299
2300     TRACE("(%p %p %ld)\n", this, ptr, count);
2301
2302     for(copied=0; copied<count;) {
2303         chunk = basic_streambuf_wchar__Pnavail(this);
2304         if(chunk > count-copied)
2305             chunk = count-copied;
2306
2307         if(chunk > 0) {
2308             memcpy(*this->pwpos, ptr+copied, chunk*sizeof(wchar_t));
2309             *this->pwpos += chunk;
2310             *this->pwsize -= chunk;
2311             copied += chunk;
2312         }else if(call_basic_streambuf_wchar_overflow(this, ptr[copied]) != WEOF) {
2313             copied++;
2314         }else {
2315             break;
2316         }
2317     }
2318
2319     return copied;
2320 }
2321
2322 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPB_WH@Z */
2323 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEB_W_J@Z */
2324 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPBGH@Z */
2325 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEBG_J@Z */
2326 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputn, 12)
2327 streamsize __thiscall basic_streambuf_wchar_sputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
2328 {
2329     TRACE("(%p %p %ld)\n", this, ptr, count);
2330     return call_basic_streambuf_wchar_xsputn(this, ptr, count);
2331 }
2332
2333 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2334 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2335 int basic_filebuf_char__Init__Stinit = 0;
2336
2337 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2338 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2339 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Init, 12)
2340 void __thiscall basic_filebuf_char__Init(basic_filebuf_char *this, FILE *file, basic_filebuf__Initfl which)
2341 {
2342     TRACE("(%p %p %d)\n", this, file, which);
2343
2344     this->cvt = NULL;
2345     this->wrotesome = FALSE;
2346     this->state = basic_filebuf_char__Init__Stinit;
2347     this->close = (which == INITFL_open);
2348     this->file = file;
2349
2350     basic_streambuf_char__Init_empty(&this->base);
2351     if(file)
2352         basic_streambuf_char__Init(&this->base, &file->_base, &file->_ptr,
2353                 &file->_cnt, &file->_base, &file->_ptr, &file->_cnt);
2354 }
2355
2356 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAV?$codecvt@DDH@2@@Z */
2357 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$codecvt@DDH@2@@Z */
2358 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Initcvt, 8)
2359 void __thiscall basic_filebuf_char__Initcvt(basic_filebuf_char *this, codecvt_char *cvt)
2360 {
2361     TRACE("(%p %p)\n", this, cvt);
2362
2363     if(codecvt_base_always_noconv(&cvt->base)) {
2364         this->cvt = NULL;
2365     }else {
2366         basic_streambuf_char__Init_empty(&this->base);
2367         this->cvt = cvt;
2368     }
2369 }
2370
2371 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAE_NXZ */
2372 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAA_NXZ */
2373 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Endwrite, 4)
2374 MSVCP_bool __thiscall basic_filebuf_char__Endwrite(basic_filebuf_char *this)
2375 {
2376     TRACE("(%p)\n", this);
2377
2378     if(!this->wrotesome || !this->cvt)
2379         return TRUE;
2380
2381
2382     if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2383         return FALSE;
2384
2385     while(1) {
2386         /* TODO: check if we need a dynamic buffer here */
2387         char buf[128];
2388         char *next;
2389         int ret;
2390
2391         ret = codecvt_char_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2392         switch(ret) {
2393         case CODECVT_ok:
2394             this->wrotesome = FALSE;
2395             /* fall through */
2396         case CODECVT_partial:
2397             if(!fwrite(buf, next-buf, 1, this->file))
2398                 return FALSE;
2399             if(this->wrotesome)
2400                 break;
2401             /* fall through */
2402         case CODECVT_noconv:
2403             if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2404                 return FALSE;
2405             return TRUE;
2406         default:
2407             return FALSE;
2408         }
2409     }
2410 }
2411
2412 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@XZ */
2413 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@XZ */
2414 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_close, 4)
2415 basic_filebuf_char* __thiscall basic_filebuf_char_close(basic_filebuf_char *this)
2416 {
2417     basic_filebuf_char *ret = this;
2418
2419     TRACE("(%p)\n", this);
2420
2421     if(!this->file)
2422         return NULL;
2423
2424     /* TODO: handle exceptions */
2425     if(!basic_filebuf_char__Endwrite(this))
2426         ret = NULL;
2427     if(!fclose(this->file))
2428         ret  = NULL;
2429
2430     basic_filebuf_char__Init(this, NULL, INITFL_close);
2431     return ret;
2432 }
2433
2434 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
2435 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
2436 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor_file, 8)
2437 basic_filebuf_char* __thiscall basic_filebuf_char_ctor_file(basic_filebuf_char *this, FILE *file)
2438 {
2439     TRACE("(%p %p)\n", this, file);
2440
2441     basic_streambuf_char_ctor(&this->base);
2442     this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2443
2444     basic_filebuf_char__Init(this, file, INITFL_new);
2445     return this;
2446 }
2447
2448 /* ??_F?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
2449 /* ??_F?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
2450 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor, 4)
2451 basic_filebuf_char* __thiscall basic_filebuf_char_ctor(basic_filebuf_char *this)
2452 {
2453     return basic_filebuf_char_ctor_file(this, NULL);
2454 }
2455
2456 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
2457 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
2458 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor_uninitialized, 8)
2459 basic_filebuf_char* __thiscall basic_filebuf_char_ctor_uninitialized(basic_filebuf_char *this, int uninitialized)
2460 {
2461     TRACE("(%p %d)\n", this, uninitialized);
2462
2463     basic_streambuf_char_ctor(&this->base);
2464     this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2465     return this;
2466 }
2467
2468 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
2469 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
2470 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_dtor, 4)
2471 void __thiscall basic_filebuf_char_dtor(basic_filebuf_char *this)
2472 {
2473     TRACE("(%p)\n", this);
2474
2475     if(this->close)
2476         basic_filebuf_char_close(this);
2477     basic_streambuf_char_dtor(&this->base);
2478 }
2479
2480 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_vector_dtor, 8)
2481 basic_filebuf_char* __thiscall basic_filebuf_char_vector_dtor(basic_filebuf_char *this, unsigned int flags)
2482 {
2483     TRACE("(%p %x)\n", this, flags);
2484     if(flags & 2) {
2485         /* we have an array, with the number of elements stored before the first object */
2486         INT_PTR i, *ptr = (INT_PTR *)this-1;
2487
2488         for(i=*ptr-1; i>=0; i--)
2489             basic_filebuf_char_dtor(this+i);
2490         MSVCRT_operator_delete(ptr);
2491     } else {
2492         basic_filebuf_char_dtor(this);
2493         if(flags & 1)
2494             MSVCRT_operator_delete(this);
2495     }
2496
2497     return this;
2498 }
2499
2500 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QBE_NXZ */
2501 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
2502 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_is_open, 4)
2503 MSVCP_bool __thiscall basic_filebuf_char_is_open(const basic_filebuf_char *this)
2504 {
2505     TRACE("(%p)\n", this);
2506     return this->file != NULL;
2507 }
2508
2509 /* ?_Fiopen@std@@YAPAU_iobuf@@PB_WHH@Z */
2510 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEB_WHH@Z */
2511 FILE* __cdecl _Fiopen_wchar(const wchar_t *name, int mode, int prot)
2512 {
2513     static const wchar_t rW[] = {'r',0};
2514     static const struct {
2515         int mode;
2516         const wchar_t str[4];
2517         const wchar_t str_bin[4];
2518     } str_mode[] = {
2519         {OPENMODE_out,                            {'w',0},     {'w','b',0}},
2520         {OPENMODE_out|OPENMODE_app,               {'a',0},     {'a','b',0}},
2521         {OPENMODE_app,                            {'a',0},     {'a','b',0}},
2522         {OPENMODE_out|OPENMODE_trunc,             {'w',0},     {'w','b',0}},
2523         {OPENMODE_in,                             {'r',0},     {'r','b',0}},
2524         {OPENMODE_in|OPENMODE_out,                {'r','+',0}, {'r','+','b',0}},
2525         {OPENMODE_in|OPENMODE_out|OPENMODE_trunc, {'w','+',0}, {'w','+','b',0}},
2526         {OPENMODE_in|OPENMODE_out|OPENMODE_app,   {'a','+',0}, {'a','+','b',0}},
2527         {OPENMODE_in|OPENMODE_app,                {'a','+',0}, {'a','+','b',0}}
2528     };
2529
2530     int real_mode = mode & ~(OPENMODE_ate|OPENMODE__Nocreate|OPENMODE__Noreplace|OPENMODE_binary);
2531     int mode_idx;
2532     FILE *f = NULL;
2533
2534     TRACE("(%s %d %d)\n", debugstr_w(name), mode, prot);
2535
2536     for(mode_idx=0; mode_idx<sizeof(str_mode)/sizeof(str_mode[0]); mode_idx++)
2537         if(str_mode[mode_idx].mode == real_mode)
2538             break;
2539     if(mode_idx == sizeof(str_mode)/sizeof(str_mode[0]))
2540         return NULL;
2541
2542     if((mode & OPENMODE__Nocreate) && !(f = _wfopen(name, rW)))
2543         return NULL;
2544     else if(f)
2545         fclose(f);
2546
2547     if((mode & OPENMODE__Noreplace) && (mode & (OPENMODE_out|OPENMODE_app))
2548             && (f = _wfopen(name, rW))) {
2549         fclose(f);
2550         return NULL;
2551     }
2552
2553     f = _wfsopen(name, (mode & OPENMODE_binary) ? str_mode[mode_idx].str_bin
2554             : str_mode[mode_idx].str, prot);
2555     if(!f)
2556         return NULL;
2557
2558     if((mode & OPENMODE_ate) && fseek(f, 0, SEEK_END)) {
2559         fclose(f);
2560         return NULL;
2561     }
2562
2563     return f;
2564 }
2565
2566 /* ?_Fiopen@std@@YAPAU_iobuf@@PBDHH@Z */
2567 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEBDHH@Z */
2568 FILE* __cdecl _Fiopen(const char *name, int mode, int prot)
2569 {
2570     wchar_t nameW[FILENAME_MAX];
2571
2572     TRACE("(%s %d %d)\n", name, mode, prot);
2573
2574     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2575         return NULL;
2576     return _Fiopen_wchar(nameW, mode, prot);
2577 }
2578
2579 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WHH@Z */
2580 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
2581 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGHH@Z */
2582 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGHH@Z */
2583 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_wchar, 16)
2584 basic_filebuf_char* __thiscall basic_filebuf_char_open_wchar(basic_filebuf_char *this, const wchar_t *name, int mode, int prot)
2585 {
2586     FILE *f = NULL;
2587
2588     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
2589
2590     if(basic_filebuf_char_is_open(this))
2591         return NULL;
2592
2593     if(!(f = _Fiopen_wchar(name, mode, prot)))
2594         return NULL;
2595
2596     basic_filebuf_char__Init(this, f, INITFL_open);
2597     basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(this->base.loc));
2598     return this;
2599 }
2600
2601 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WI@Z */
2602 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WI@Z */
2603 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGI@Z */
2604 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGI@Z */
2605 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_wchar_mode, 12)
2606 basic_filebuf_char* __thiscall basic_filebuf_char_open_wchar_mode(basic_filebuf_char *this, const wchar_t *name, unsigned int mode)
2607 {
2608     return basic_filebuf_char_open_wchar(this, name, mode, SH_DENYNO);
2609 }
2610
2611 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDHH@Z */
2612 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDHH@Z */
2613 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open, 16)
2614 basic_filebuf_char* __thiscall basic_filebuf_char_open(basic_filebuf_char *this, const char *name, int mode, int prot)
2615 {
2616     wchar_t nameW[FILENAME_MAX];
2617
2618     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
2619
2620     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2621         return NULL;
2622     return basic_filebuf_char_open_wchar(this, nameW, mode, prot);
2623 }
2624
2625 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDI@Z */
2626 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDI@Z */
2627 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_mode, 12)
2628 basic_filebuf_char* __thiscall basic_filebuf_char_open_mode(basic_filebuf_char *this, const char *name, unsigned int mode)
2629 {
2630     return basic_filebuf_char_open(this, name, mode, SH_DENYNO);
2631 }
2632
2633 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2634 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2635 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_overflow, 8)
2636 int __thiscall basic_filebuf_char_overflow(basic_filebuf_char *this, int c)
2637 {
2638     char buf[8], *dyn_buf;
2639     char ch = c, *to_next;
2640     const char *from_next;
2641     int ret, max_size;
2642
2643
2644     TRACE("(%p %d)\n", this, c);
2645
2646     if(!basic_filebuf_char_is_open(this))
2647         return EOF;
2648     if(c == EOF)
2649         return !c;
2650
2651     if(!this->cvt)
2652         return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2653
2654     from_next = &ch;
2655     do {
2656         ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2657                 &from_next, buf, buf+sizeof(buf), &to_next);
2658
2659         switch(ret) {
2660         case CODECVT_partial:
2661             if(to_next == buf)
2662                 break;
2663             /* fall through */
2664         case CODECVT_ok:
2665             if(!fwrite(buf, to_next-buf, 1, this->file))
2666                 return EOF;
2667             if(ret == CODECVT_partial)
2668                 continue;
2669             return c;
2670         case CODECVT_noconv:
2671             return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2672         default:
2673             return EOF;
2674         }
2675
2676         break;
2677     } while(1);
2678
2679     max_size = codecvt_base_max_length(&this->cvt->base);
2680     dyn_buf = malloc(max_size);
2681     if(!dyn_buf)
2682         return EOF;
2683
2684     ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2685             &from_next, dyn_buf, dyn_buf+max_size, &to_next);
2686
2687     switch(ret) {
2688     case CODECVT_ok:
2689         ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
2690         free(dyn_buf);
2691         return ret ? c : EOF;
2692     case CODECVT_partial:
2693         ERR("buffer should be big enough to store all output\n");
2694         /* fall through */
2695     default:
2696         free(dyn_buf);
2697         return EOF;
2698     }
2699 }
2700
2701 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2702 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2703 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_pbackfail, 8)
2704 int __thiscall basic_filebuf_char_pbackfail(basic_filebuf_char *this, int c)
2705 {
2706     TRACE("(%p %d)\n", this, c);
2707
2708     if(!basic_filebuf_char_is_open(this))
2709         return EOF;
2710
2711     if(basic_streambuf_char_gptr(&this->base)>basic_streambuf_char_eback(&this->base)
2712             && (c==EOF || basic_streambuf_char_gptr(&this->base)[-1]==(char)c)) {
2713         basic_streambuf_char__Gndec(&this->base);
2714         return c==EOF ? !c : c;
2715     }else if(c!=EOF && !this->cvt) {
2716         return ungetc(c, this->file);
2717     }
2718
2719     return EOF;
2720 }
2721
2722 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2723 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2724 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_uflow, 4)
2725 int __thiscall basic_filebuf_char_uflow(basic_filebuf_char *this)
2726 {
2727     char ch, buf[128], *to_next;
2728     const char *buf_next;
2729     int c, i;
2730
2731     TRACE("(%p)\n", this);
2732
2733     if(!basic_filebuf_char_is_open(this))
2734         return EOF;
2735
2736     if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2737         return *basic_streambuf_char__Gninc(&this->base);
2738
2739     c = fgetc(this->file);
2740     if(!this->cvt || c==EOF)
2741         return c;
2742
2743     buf_next = buf;
2744     for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
2745         buf[i] = c;
2746
2747         switch(codecvt_char_in(this->cvt, &this->state, buf_next,
2748                     buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
2749         case CODECVT_partial:
2750         case CODECVT_ok:
2751             if(to_next == &ch) {
2752                 c = fgetc(this->file);
2753                 if(c == EOF)
2754                     return EOF;
2755                 continue;
2756             }
2757
2758             for(i--; i>=buf_next-buf; i--)
2759                 ungetc(buf[i], this->file);
2760             return ch;
2761         case CODECVT_noconv:
2762             return buf[0];
2763         default:
2764             return EOF;
2765         }
2766     }
2767
2768     FIXME("buffer is too small\n");
2769     return EOF;
2770 }
2771
2772 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2773 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2774 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_underflow, 4)
2775 int __thiscall basic_filebuf_char_underflow(basic_filebuf_char *this)
2776 {
2777     int ret;
2778
2779     TRACE("(%p)\n", this);
2780
2781     if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2782         return *basic_streambuf_char_gptr(&this->base);
2783
2784     ret = call_basic_streambuf_char_uflow(&this->base);
2785     if(ret != EOF)
2786         ret = call_basic_streambuf_char_pbackfail(&this->base, ret);
2787     return ret;
2788 }
2789
2790 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2791 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2792 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekoff, 20)
2793 fpos_int* __thiscall basic_filebuf_char_seekoff(basic_filebuf_char *this,
2794         fpos_int *ret, streamoff off, int way, int mode)
2795 {
2796     fpos_t pos;
2797
2798     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
2799
2800     if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2801             || fseek(this->file, off, way)) {
2802         ret->off = 0;
2803         ret->pos = -1;
2804         ret->state = 0;
2805         return ret;
2806     }
2807
2808     fgetpos(this->file, &pos);
2809     ret->off = 0;
2810     ret->pos = pos;
2811     ret->state = this->state;
2812     return ret;
2813 }
2814
2815 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2816 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2817 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekpos, 36)
2818 fpos_int* __thiscall basic_filebuf_char_seekpos(basic_filebuf_char *this,
2819         fpos_int *ret, fpos_int pos, int mode)
2820 {
2821     fpos_t fpos;
2822
2823     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
2824
2825     if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2826             || fseek(this->file, (LONG)pos.pos, SEEK_SET)
2827             || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
2828         ret->off = 0;
2829         ret->pos = -1;
2830         ret->state = 0;
2831         return ret;
2832     }
2833
2834     fgetpos(this->file, &fpos);
2835     ret->off = 0;
2836     ret->pos = fpos;
2837     ret->state = this->state;
2838     return ret;
2839 }
2840
2841 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PADH@Z */
2842 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAD_J@Z */
2843 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_setbuf, 12)
2844 basic_streambuf_char* __thiscall basic_filebuf_char_setbuf(basic_filebuf_char *this, char *buf, streamsize count)
2845 {
2846     TRACE("(%p %p %ld)\n", this, buf, count);
2847
2848     if(!basic_filebuf_char_is_open(this))
2849         return NULL;
2850
2851     if(setvbuf(this->file, buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count))
2852         return NULL;
2853
2854     basic_filebuf_char__Init(this, this->file, INITFL_open);
2855     return &this->base;
2856 }
2857
2858 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2859 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2860 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_sync, 4)
2861 int __thiscall basic_filebuf_char_sync(basic_filebuf_char *this)
2862 {
2863     TRACE("(%p)\n", this);
2864
2865     if(!basic_filebuf_char_is_open(this))
2866         return 0;
2867
2868     if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2869         return 0;
2870     return fflush(this->file);
2871 }
2872
2873 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
2874 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
2875 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_imbue, 8)
2876 void __thiscall basic_filebuf_char_imbue(basic_filebuf_char *this, const locale *loc)
2877 {
2878     TRACE("(%p %p)\n", this, loc);
2879     basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(loc));
2880 }
2881
2882 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2883 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2884 int basic_filebuf_wchar__Init__Stinit = 0;
2885
2886 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2887 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2888 int basic_filebuf_short__Init__Stinit = 0;
2889
2890 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2891 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2892 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Init, 12)
2893 void __thiscall basic_filebuf_wchar__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2894 {
2895     TRACE("(%p %p %d)\n", this, file, which);
2896
2897     this->cvt = NULL;
2898     this->wrotesome = FALSE;
2899     this->state = basic_filebuf_wchar__Init__Stinit;
2900     this->close = (which == INITFL_open);
2901     this->file = file;
2902
2903     basic_streambuf_wchar__Init_empty(&this->base);
2904 }
2905
2906 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2907 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2908 DEFINE_THISCALL_WRAPPER(basic_filebuf_short__Init, 12)
2909 void __thiscall basic_filebuf_short__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2910 {
2911     TRACE("(%p %p %d)\n", this, file, which);
2912
2913     this->cvt = NULL;
2914     this->wrotesome = FALSE;
2915     this->state = basic_filebuf_short__Init__Stinit;
2916     this->close = (which == INITFL_open);
2917     this->file = file;
2918
2919     basic_streambuf_wchar__Init_empty(&this->base);
2920 }
2921
2922 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$codecvt@_WDH@2@@Z */
2923 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$codecvt@_WDH@2@@Z */
2924 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAV?$codecvt@GDH@2@@Z */
2925 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$codecvt@GDH@2@@Z */
2926 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Initcvt, 8)
2927 void __thiscall basic_filebuf_wchar__Initcvt(basic_filebuf_wchar *this, codecvt_wchar *cvt)
2928 {
2929     TRACE("(%p %p)\n", this, cvt);
2930
2931     if(codecvt_base_always_noconv(&cvt->base)) {
2932         this->cvt = NULL;
2933     }else {
2934         basic_streambuf_wchar__Init_empty(&this->base);
2935         this->cvt = cvt;
2936     }
2937 }
2938
2939 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAE_NXZ */
2940 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAA_NXZ */
2941 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAE_NXZ */
2942 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAA_NXZ */
2943 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Endwrite, 4)
2944 MSVCP_bool __thiscall basic_filebuf_wchar__Endwrite(basic_filebuf_wchar *this)
2945 {
2946     TRACE("(%p)\n", this);
2947
2948     if(!this->wrotesome || !this->cvt)
2949         return TRUE;
2950
2951     if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2952         return FALSE;
2953
2954     while(1) {
2955         /* TODO: check if we need a dynamic buffer here */
2956         char buf[128];
2957         char *next;
2958         int ret;
2959
2960         ret = codecvt_wchar_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2961         switch(ret) {
2962         case CODECVT_ok:
2963             this->wrotesome = FALSE;
2964             /* fall through */
2965         case CODECVT_partial:
2966             if(!fwrite(buf, next-buf, 1, this->file))
2967                 return FALSE;
2968             if(this->wrotesome)
2969                 break;
2970             /* fall through */
2971         case CODECVT_noconv:
2972             if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2973                 return FALSE;
2974             return TRUE;
2975         default:
2976             return FALSE;
2977         }
2978     }
2979 }
2980
2981 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@XZ */
2982 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@XZ */
2983 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@XZ */
2984 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@XZ */
2985 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_close, 4)
2986 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_close(basic_filebuf_wchar *this)
2987 {
2988     basic_filebuf_wchar *ret = this;
2989
2990     TRACE("(%p)\n", this);
2991
2992     if(!this->file)
2993         return NULL;
2994
2995     /* TODO: handle exceptions */
2996     if(!basic_filebuf_wchar__Endwrite(this))
2997         ret = NULL;
2998     if(!fclose(this->file))
2999         ret  = NULL;
3000
3001     basic_filebuf_wchar__Init(this, NULL, INITFL_close);
3002     return ret;
3003 }
3004
3005 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
3006 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
3007 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor_file, 8)
3008 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor_file(basic_filebuf_wchar *this, FILE *file)
3009 {
3010     TRACE("(%p %p)\n", this, file);
3011
3012     basic_streambuf_wchar_ctor(&this->base);
3013     this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
3014
3015     basic_filebuf_wchar__Init(this, file, INITFL_new);
3016     return this;
3017 }
3018
3019 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
3020 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
3021 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor_file, 8)
3022 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor_file(basic_filebuf_wchar *this, FILE *file)
3023 {
3024     TRACE("(%p %p)\n", this, file);
3025
3026     basic_streambuf_short_ctor(&this->base);
3027     this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
3028
3029     basic_filebuf_short__Init(this, file, INITFL_new);
3030     return this;
3031 }
3032
3033 /* ??_F?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
3034 /* ??_F?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
3035 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor, 4)
3036 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor(basic_filebuf_wchar *this)
3037 {
3038     return basic_filebuf_wchar_ctor_file(this, NULL);
3039 }
3040
3041 /* ??_F?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
3042 /* ??_F?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
3043 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor, 4)
3044 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor(basic_filebuf_wchar *this)
3045 {
3046     return basic_filebuf_short_ctor_file(this, NULL);
3047 }
3048
3049 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
3050 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
3051 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor_uninitialized, 8)
3052 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor_uninitialized(basic_filebuf_wchar *this, int uninitialized)
3053 {
3054     TRACE("(%p %d)\n", this, uninitialized);
3055
3056     basic_streambuf_wchar_ctor(&this->base);
3057     this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
3058     return this;
3059 }
3060
3061 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
3062 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
3063 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor_uninitialized, 8)
3064 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor_uninitialized(basic_filebuf_wchar *this, int uninitialized)
3065 {
3066     TRACE("(%p %d)\n", this, uninitialized);
3067
3068     basic_streambuf_short_ctor(&this->base);
3069     this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
3070     return this;
3071 }
3072
3073 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
3074 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
3075 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
3076 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
3077 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_dtor, 4)
3078 void __thiscall basic_filebuf_wchar_dtor(basic_filebuf_wchar *this)
3079 {
3080     TRACE("(%p)\n", this);
3081
3082     if(this->close)
3083         basic_filebuf_wchar_close(this);
3084     basic_streambuf_wchar_dtor(&this->base);
3085 }
3086
3087 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_vector_dtor, 8)
3088 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_vector_dtor(basic_filebuf_wchar *this, unsigned int flags)
3089 {
3090     TRACE("(%p %x)\n", this, flags);
3091     if(flags & 2) {
3092         /* we have an array, with the number of elements stored before the first object */
3093         INT_PTR i, *ptr = (INT_PTR *)this-1;
3094
3095         for(i=*ptr-1; i>=0; i--)
3096             basic_filebuf_wchar_dtor(this+i);
3097         MSVCRT_operator_delete(ptr);
3098     } else {
3099         basic_filebuf_wchar_dtor(this);
3100         if(flags & 1)
3101             MSVCRT_operator_delete(this);
3102     }
3103
3104     return this;
3105 }
3106
3107 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
3108 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
3109 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QBE_NXZ */
3110 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
3111 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_is_open, 4)
3112 MSVCP_bool __thiscall basic_filebuf_wchar_is_open(const basic_filebuf_wchar *this)
3113 {
3114     TRACE("(%p)\n", this);
3115     return this->file != NULL;
3116 }
3117
3118 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WHH@Z */
3119 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
3120 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGHH@Z */
3121 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGHH@Z */
3122 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_wchar, 16)
3123 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot)
3124 {
3125     FILE *f = NULL;
3126
3127     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
3128
3129     if(basic_filebuf_wchar_is_open(this))
3130         return NULL;
3131
3132     if(!(f = _Fiopen_wchar(name, mode, prot)))
3133         return NULL;
3134
3135     basic_filebuf_wchar__Init(this, f, INITFL_open);
3136     basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(this->base.loc));
3137     return this;
3138 }
3139
3140 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PB_WHH@Z */
3141 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
3142 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBGHH@Z */
3143 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBGHH@Z */
3144 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_wchar, 16)
3145 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot)
3146 {
3147     FILE *f = NULL;
3148
3149     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
3150
3151     if(basic_filebuf_wchar_is_open(this))
3152         return NULL;
3153
3154     if(!(f = _Fiopen_wchar(name, mode, prot)))
3155         return NULL;
3156
3157     basic_filebuf_short__Init(this, f, INITFL_open);
3158     basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(this->base.loc));
3159     return this;
3160 }
3161
3162 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WI@Z */
3163 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WI@Z */
3164 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGI@Z */
3165 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGI@Z */
3166 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_wchar_mode, 12)
3167 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_wchar_mode(basic_filebuf_wchar *this, const wchar_t *name, unsigned int mode)
3168 {
3169     return basic_filebuf_wchar_open_wchar(this, name, mode, SH_DENYNO);
3170 }
3171
3172 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PB_WI@Z */
3173 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEB_WI@Z */
3174 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBGI@Z */
3175 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBGI@Z */
3176 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_wchar_mode, 12)
3177 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_wchar_mode(basic_filebuf_wchar *this, const wchar_t *name, unsigned int mode)
3178 {
3179     return basic_filebuf_short_open_wchar(this, name, mode, SH_DENYNO);
3180 }
3181
3182 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDHH@Z */
3183 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDHH@Z */
3184 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open, 16)
3185 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open(basic_filebuf_wchar *this, const char *name, int mode, int prot)
3186 {
3187     wchar_t nameW[FILENAME_MAX];
3188
3189     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
3190
3191     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
3192         return NULL;
3193     return basic_filebuf_wchar_open_wchar(this, nameW, mode, prot);
3194 }
3195
3196 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDHH@Z */
3197 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDHH@Z */
3198 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open, 16)
3199 basic_filebuf_wchar* __thiscall basic_filebuf_short_open(basic_filebuf_wchar *this, const char *name, int mode, int prot)
3200 {
3201     wchar_t nameW[FILENAME_MAX];
3202
3203     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
3204
3205     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
3206         return NULL;
3207     return basic_filebuf_short_open_wchar(this, nameW, mode, prot);
3208 }
3209
3210 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDI@Z */
3211 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDI@Z */
3212 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_mode, 12)
3213 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_mode(basic_filebuf_wchar *this, const char *name, unsigned int mode)
3214 {
3215     return basic_filebuf_wchar_open(this, name, mode, SH_DENYNO);
3216 }
3217
3218 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDI@Z */
3219 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDI@Z */
3220 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_mode, 12)
3221 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_mode(basic_filebuf_wchar *this, const char *name, unsigned int mode)
3222 {
3223     return basic_filebuf_short_open(this, name, mode, SH_DENYNO);
3224 }
3225
3226 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
3227 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
3228 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
3229 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
3230 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_overflow, 8)
3231 unsigned short __thiscall basic_filebuf_wchar_overflow(basic_filebuf_wchar *this, unsigned short c)
3232 {
3233     char buf[8], *dyn_buf, *to_next;
3234     wchar_t ch = c;
3235     const wchar_t *from_next;
3236     int max_size;
3237     unsigned short ret;
3238
3239
3240     TRACE("(%p %d)\n", this, c);
3241
3242     if(!basic_filebuf_wchar_is_open(this))
3243         return WEOF;
3244     if(c == WEOF)
3245         return !c;
3246
3247     if(!this->cvt)
3248         return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
3249
3250     from_next = &ch;
3251     do {
3252         ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
3253                 &from_next, buf, buf+sizeof(buf), &to_next);
3254
3255         switch(ret) {
3256         case CODECVT_partial:
3257             if(to_next == buf)
3258                 break;
3259             /* fall through */
3260         case CODECVT_ok:
3261             if(!fwrite(buf, to_next-buf, 1, this->file))
3262                 return WEOF;
3263             if(ret == CODECVT_partial)
3264                 continue;
3265             return c;
3266         case CODECVT_noconv:
3267             return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
3268         default:
3269             return WEOF;
3270         }
3271
3272         break;
3273     } while(1);
3274
3275     max_size = codecvt_base_max_length(&this->cvt->base);
3276     dyn_buf = malloc(max_size);
3277     if(!dyn_buf)
3278         return WEOF;
3279
3280     ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
3281             &from_next, dyn_buf, dyn_buf+max_size, &to_next);
3282
3283     switch(ret) {
3284     case CODECVT_ok:
3285         ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
3286         free(dyn_buf);
3287         return ret ? c : WEOF;
3288     case CODECVT_partial:
3289         ERR("buffer should be big enough to store all output\n");
3290         /* fall through */
3291     default:
3292         free(dyn_buf);
3293         return WEOF;
3294     }
3295 }
3296
3297 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
3298 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
3299 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
3300 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
3301 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_pbackfail, 8)
3302 unsigned short __thiscall basic_filebuf_wchar_pbackfail(basic_filebuf_wchar *this, unsigned short c)
3303 {
3304     TRACE("(%p %d)\n", this, c);
3305
3306     if(!basic_filebuf_wchar_is_open(this))
3307         return WEOF;
3308
3309     if(basic_streambuf_wchar_gptr(&this->base)>basic_streambuf_wchar_eback(&this->base)
3310             && (c==WEOF || basic_streambuf_wchar_gptr(&this->base)[-1]==(wchar_t)c)) {
3311         basic_streambuf_wchar__Gndec(&this->base);
3312         return c==WEOF ? !c : c;
3313     }else if(c!=WEOF && !this->cvt) {
3314         return ungetwc(c, this->file);
3315     }else if(c!=WEOF && basic_streambuf_wchar_gptr(&this->base)!=&this->putback) {
3316         this->putback = c;
3317         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback, &this->putback+1);
3318         return c;
3319     }
3320
3321     return WEOF;
3322 }
3323
3324 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
3325 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
3326 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
3327 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
3328 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_uflow, 4)
3329 unsigned short __thiscall basic_filebuf_wchar_uflow(basic_filebuf_wchar *this)
3330 {
3331     wchar_t ch, *to_next;
3332     char buf[128];
3333     const char *buf_next;
3334     int c, i;
3335
3336     TRACE("(%p)\n", this);
3337
3338     if(!basic_filebuf_wchar_is_open(this))
3339         return WEOF;
3340
3341     if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
3342         return *basic_streambuf_wchar__Gninc(&this->base);
3343
3344     if(!this->cvt)
3345         return fgetwc(this->file);
3346
3347     buf_next = buf;
3348     for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
3349         if((c = fgetc(this->file)) == EOF)
3350             return WEOF;
3351         buf[i] = c;
3352
3353         switch(codecvt_wchar_in(this->cvt, &this->state, buf_next,
3354                     buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
3355         case CODECVT_partial:
3356         case CODECVT_ok:
3357             if(to_next == &ch)
3358                 continue;
3359
3360             for(i--; i>=buf_next-buf; i--)
3361                 ungetc(buf[i], this->file);
3362             return ch;
3363         case CODECVT_noconv:
3364             if(i+1 < sizeof(wchar_t))
3365                 continue;
3366
3367             memcpy(&ch, buf, sizeof(wchar_t));
3368             return ch;
3369         default:
3370             return WEOF;
3371         }
3372     }
3373
3374     FIXME("buffer is too small\n");
3375     return WEOF;
3376 }
3377
3378 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
3379 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
3380 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
3381 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
3382 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_underflow, 4)
3383 unsigned short __thiscall basic_filebuf_wchar_underflow(basic_filebuf_wchar *this)
3384 {
3385     unsigned short ret;
3386
3387     TRACE("(%p)\n", this);
3388
3389     if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
3390         return *basic_streambuf_wchar_gptr(&this->base);
3391
3392     ret = call_basic_streambuf_wchar_uflow(&this->base);
3393     if(ret != WEOF)
3394         ret = call_basic_streambuf_wchar_pbackfail(&this->base, ret);
3395     return ret;
3396 }
3397
3398 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3399 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3400 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3401 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3402 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekoff, 20)
3403 fpos_int* __thiscall basic_filebuf_wchar_seekoff(basic_filebuf_wchar *this,
3404         fpos_int *ret, streamoff off, int way, int mode)
3405 {
3406     fpos_t pos;
3407
3408     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
3409
3410     if(basic_streambuf_wchar_gptr(&this->base) == &this->putback) {
3411         if(way == SEEKDIR_cur)
3412             off -= sizeof(wchar_t);
3413
3414         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
3415     }
3416
3417     if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
3418             || fseek(this->file, off, way)) {
3419         ret->off = 0;
3420         ret->pos = -1;
3421         ret->state = 0;
3422         return ret;
3423     }
3424
3425     fgetpos(this->file, &pos);
3426     ret->off = 0;
3427     ret->pos = pos;
3428     ret->state = this->state;
3429     return ret;
3430 }
3431
3432 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3433 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3434 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3435 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3436 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekpos, 36)
3437 fpos_int* __thiscall basic_filebuf_wchar_seekpos(basic_filebuf_wchar *this,
3438         fpos_int *ret, fpos_int pos, int mode)
3439 {
3440     fpos_t fpos;
3441
3442     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
3443
3444     if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
3445             || fseek(this->file, (LONG)pos.pos, SEEK_SET)
3446             || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
3447         ret->off = 0;
3448         ret->pos = -1;
3449         ret->state = 0;
3450         return ret;
3451     }
3452
3453     if(basic_streambuf_wchar_gptr(&this->base) == &this->putback)
3454         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
3455
3456     fgetpos(this->file, &fpos);
3457     ret->off = 0;
3458     ret->pos = fpos;
3459     ret->state = this->state;
3460     return ret;
3461 }
3462
3463 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PA_WH@Z */
3464 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEA_W_J@Z */
3465 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_setbuf, 12)
3466 basic_streambuf_wchar* __thiscall basic_filebuf_wchar_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
3467 {
3468     TRACE("(%p %p %ld)\n", this, buf, count);
3469
3470     if(!basic_filebuf_wchar_is_open(this))
3471         return NULL;
3472
3473     if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
3474         return NULL;
3475
3476     basic_filebuf_wchar__Init(this, this->file, INITFL_open);
3477     return &this->base;
3478 }
3479
3480 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAGH@Z */
3481 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAG_J@Z */
3482 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_setbuf, 12)
3483 basic_streambuf_wchar* __thiscall basic_filebuf_short_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
3484 {
3485     TRACE("(%p %p %ld)\n", this, buf, count);
3486
3487     if(!basic_filebuf_wchar_is_open(this))
3488         return NULL;
3489
3490     if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
3491         return NULL;
3492
3493     basic_filebuf_short__Init(this, this->file, INITFL_open);
3494     return &this->base;
3495 }
3496
3497 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
3498 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
3499 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
3500 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
3501 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_sync, 4)
3502 int __thiscall basic_filebuf_wchar_sync(basic_filebuf_wchar *this)
3503 {
3504     TRACE("(%p)\n", this);
3505
3506     if(!basic_filebuf_wchar_is_open(this))
3507         return 0;
3508
3509     if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
3510         return 0;
3511     return fflush(this->file);
3512 }
3513
3514 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
3515 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
3516 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_imbue, 8)
3517 void __thiscall basic_filebuf_wchar_imbue(basic_filebuf_wchar *this, const locale *loc)
3518 {
3519     TRACE("(%p %p)\n", this, loc);
3520     basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(loc));
3521 }
3522
3523 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
3524 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
3525 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_imbue, 8)
3526 void __thiscall basic_filebuf_short_imbue(basic_filebuf_wchar *this, const locale *loc)
3527 {
3528     TRACE("(%p %p)\n", this, loc);
3529     basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(loc));
3530 }
3531
3532 /* ?_Getstate@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEHH@Z */
3533 /* ?_Getstate@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAHH@Z */
3534 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Getstate, 8)
3535 int __thiscall basic_stringbuf_char__Getstate(basic_stringbuf_char *this, IOSB_openmode mode)
3536 {
3537     int state = 0;
3538
3539     if(!(mode & OPENMODE_in))
3540         state |= STRINGBUF_no_read;
3541
3542     if(!(mode & OPENMODE_out))
3543         state |= STRINGBUF_no_write;
3544
3545     if(mode & OPENMODE_ate)
3546         state |= STRINGBUF_at_end;
3547
3548     if(mode & OPENMODE_app)
3549         state |= STRINGBUF_append;
3550
3551     return state;
3552 }
3553
3554 /* ?_Init@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXPBDIH@Z */
3555 /* ?_Init@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAXPEBD_KH@Z */
3556 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Init, 16)
3557 void __thiscall basic_stringbuf_char__Init(basic_stringbuf_char *this, const char *str, MSVCP_size_t count, int state)
3558 {
3559     TRACE("(%p, %p, %ld, %d)\n", this, str, count, state);
3560
3561     basic_streambuf_char__Init_empty(&this->base);
3562
3563     this->state = state;
3564     this->seekhigh = NULL;
3565
3566     if(count && str) {
3567         char *buf = MSVCRT_operator_new(count);
3568         if(!buf) {
3569             ERR("Out of memory\n");
3570             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3571         }
3572
3573         memcpy(buf, str, count);
3574         this->seekhigh = buf + count;
3575
3576         this->state |= STRINGBUF_allocated;
3577
3578         if(!(state & STRINGBUF_no_read))
3579             basic_streambuf_char_setg(&this->base, buf, buf, buf + count);
3580
3581         if(!(state & STRINGBUF_no_write)) {
3582             basic_streambuf_char_setp_next(&this->base, buf, (state & STRINGBUF_at_end) ? buf + count : buf, buf + count);
3583
3584             if(!basic_streambuf_char_gptr(&this->base))
3585                 basic_streambuf_char_setg(&this->base, buf, 0, buf);
3586         }
3587     }
3588 }
3589
3590 /* ??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 */
3591 /* ??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 */
3592 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor_str, 12)
3593 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor_str(basic_stringbuf_char *this,
3594         const basic_string_char *str, IOSB_openmode mode)
3595 {
3596     TRACE("(%p %p %d)\n", this, str, mode);
3597
3598     basic_streambuf_char_ctor(&this->base);
3599     this->base.vtable = &MSVCP_basic_stringbuf_char_vtable;
3600
3601     basic_stringbuf_char__Init(this, MSVCP_basic_string_char_c_str(str),
3602             str->size, basic_stringbuf_char__Getstate(this, mode));
3603     return this;
3604 }
3605
3606 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
3607 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
3608 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor_mode, 8)
3609 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor_mode(
3610         basic_stringbuf_char *this, IOSB_openmode mode)
3611 {
3612     TRACE("(%p %d)\n", this, mode);
3613
3614     basic_streambuf_char_ctor(&this->base);
3615     this->base.vtable = &MSVCP_basic_stringbuf_char_vtable;
3616
3617     basic_stringbuf_char__Init(this, NULL, 0, basic_stringbuf_char__Getstate(this, mode));
3618     return this;
3619 }
3620
3621 /* ??_F?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
3622 /* ??_F?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
3623 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor, 4)
3624 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor(basic_stringbuf_char *this)
3625 {
3626     return basic_stringbuf_char_ctor_mode(this, OPENMODE_in|OPENMODE_out);
3627 }
3628
3629 /* ?_Tidy@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXXZ */
3630 /* ?_Tidy@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAXXZ */
3631 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Tidy, 4)
3632 void __thiscall basic_stringbuf_char__Tidy(basic_stringbuf_char *this)
3633 {
3634     TRACE("(%p)\n", this);
3635
3636     if(this->state & STRINGBUF_allocated) {
3637         MSVCRT_operator_delete(basic_streambuf_char_eback(&this->base));
3638         this->seekhigh = NULL;
3639         this->state &= ~STRINGBUF_allocated;
3640     }
3641
3642     basic_streambuf_char__Init_empty(&this->base);
3643 }
3644
3645 /* ??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
3646 /* ??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
3647 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_dtor, 4)
3648 void __thiscall basic_stringbuf_char_dtor(basic_stringbuf_char *this)
3649 {
3650     TRACE("(%p)\n", this);
3651
3652     basic_stringbuf_char__Tidy(this);
3653     basic_streambuf_char_dtor(&this->base);
3654 }
3655
3656 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_vector_dtor, 8)
3657 basic_stringbuf_char* __thiscall basic_stringbuf_char_vector_dtor(basic_stringbuf_char *this, unsigned int flags)
3658 {
3659     TRACE("(%p %x)\n", this, flags);
3660
3661     if(flags & 2) {
3662         /* we have an array, with the number of elements stored before the first object */
3663         INT_PTR i, *ptr = (INT_PTR *) this - 1;
3664
3665         for (i = *ptr - 1; i >= 0; i--)
3666             basic_stringbuf_char_dtor(this+i);
3667
3668         MSVCRT_operator_delete(ptr);
3669     }else {
3670         basic_stringbuf_char_dtor(this);
3671
3672         if(flags & 1)
3673             MSVCRT_operator_delete(this);
3674     }
3675
3676     return this;
3677 }
3678
3679 /* ?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z */
3680 /* ?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHH@Z */
3681 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_overflow, 8)
3682 int __thiscall basic_stringbuf_char_overflow(basic_stringbuf_char *this, int meta)
3683 {
3684     MSVCP_size_t oldsize, size;
3685     char *ptr, *buf;
3686
3687     TRACE("(%p %x)\n", this, meta);
3688
3689     if(meta == EOF)
3690         return !EOF;
3691     if(this->state & STRINGBUF_no_write)
3692         return EOF;
3693
3694     ptr = basic_streambuf_char_pptr(&this->base);
3695     if((this->state&STRINGBUF_append) && ptr<this->seekhigh)
3696         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
3697                 this->seekhigh, basic_streambuf_char_epptr(&this->base));
3698
3699     if(ptr && ptr<basic_streambuf_char_epptr(&this->base))
3700         return (*basic_streambuf_char__Pninc(&this->base) = meta);
3701
3702     oldsize = (ptr ? basic_streambuf_char_epptr(&this->base)-basic_streambuf_char_eback(&this->base): 0);
3703     size = oldsize|0xf;
3704     size += size/2;
3705     buf = MSVCRT_operator_new(size);
3706     if(!buf) {
3707         ERR("Out of memory\n");
3708         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3709     }
3710
3711     if(!oldsize) {
3712         this->seekhigh = buf;
3713         basic_streambuf_char_setp(&this->base, buf, buf+size);
3714         if(this->state & STRINGBUF_no_read)
3715             basic_streambuf_char_setg(&this->base, buf, NULL, buf);
3716         else
3717             basic_streambuf_char_setg(&this->base, buf, buf, buf+1);
3718
3719         this->state |= STRINGBUF_allocated;
3720     }else {
3721         ptr = basic_streambuf_char_eback(&this->base);
3722         memcpy(buf, ptr, oldsize);
3723
3724         this->seekhigh = buf+(this->seekhigh-ptr);
3725         basic_streambuf_char_setp_next(&this->base, buf,
3726                 buf+(basic_streambuf_char_pptr(&this->base)-ptr), buf+size);
3727         if(this->state & STRINGBUF_no_read)
3728             basic_streambuf_char_setg(&this->base, buf, NULL, buf);
3729         else
3730             basic_streambuf_char_setg(&this->base, buf,
3731                     buf+(basic_streambuf_char_gptr(&this->base)-ptr),
3732                     basic_streambuf_char_pptr(&this->base)+1);
3733
3734         MSVCRT_operator_delete(ptr);
3735     }
3736
3737     return (*basic_streambuf_char__Pninc(&this->base) = meta);
3738 }
3739
3740 /* ?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z */
3741 /* ?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHH@Z */
3742 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_pbackfail, 8)
3743 int __thiscall basic_stringbuf_char_pbackfail(basic_stringbuf_char *this, int c)
3744 {
3745     char *cur;
3746
3747     TRACE("(%p %x)\n", this, c);
3748
3749     cur = basic_streambuf_char_gptr(&this->base);
3750     if(!cur || cur==basic_streambuf_char_eback(&this->base)
3751             || (c!=EOF && c!=cur[-1] && this->state&STRINGBUF_no_write))
3752         return EOF;
3753
3754     if(c != EOF)
3755         cur[-1] = c;
3756     basic_streambuf_char_gbump(&this->base, -1);
3757     return c==EOF ? !EOF : c;
3758 }
3759
3760 /* ?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHXZ */
3761 /* ?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHXZ */
3762 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_underflow, 4)
3763 int __thiscall basic_stringbuf_char_underflow(basic_stringbuf_char *this)
3764 {
3765     char *ptr, *cur;
3766
3767     TRACE("(%p)\n", this);
3768
3769     cur = basic_streambuf_char_gptr(&this->base);
3770     if(!cur || this->state&STRINGBUF_no_read)
3771         return EOF;
3772
3773     ptr  = basic_streambuf_char_pptr(&this->base);
3774     if(this->seekhigh < ptr)
3775         this->seekhigh = ptr;
3776
3777     ptr = basic_streambuf_char_egptr(&this->base);
3778     if(this->seekhigh > ptr)
3779         basic_streambuf_char_setg(&this->base, basic_streambuf_char_eback(&this->base), cur, this->seekhigh);
3780
3781     if(cur < this->seekhigh)
3782         return *cur;
3783     return EOF;
3784 }
3785
3786 /* ?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3787 /* ?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3788 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_seekoff, 20)
3789 fpos_int* __thiscall basic_stringbuf_char_seekoff(basic_stringbuf_char *this,
3790         fpos_int *ret, streamoff off, int way, int mode)
3791 {
3792     char *beg, *cur_r, *cur_w;
3793
3794     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
3795
3796     cur_w = basic_streambuf_char_pptr(&this->base);
3797     if(cur_w > this->seekhigh)
3798         this->seekhigh = cur_w;
3799
3800     ret->off = 0;
3801     ret->state = 0;
3802
3803     beg = basic_streambuf_char_eback(&this->base);
3804     cur_r = basic_streambuf_char_gptr(&this->base);
3805     if((mode & OPENMODE_in) && cur_r) {
3806         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
3807             off += cur_r-beg;
3808         else if(way == SEEKDIR_end)
3809             off += this->seekhigh-beg;
3810         else if(way != SEEKDIR_beg)
3811             off = -1;
3812
3813         if(off<0 || off>this->seekhigh-beg) {
3814             off = -1;
3815         }else {
3816             basic_streambuf_char_gbump(&this->base, beg-cur_r+off);
3817             if((mode & OPENMODE_out) && cur_w) {
3818                 basic_streambuf_char_setp_next(&this->base, beg,
3819                         basic_streambuf_char_gptr(&this->base),
3820                         basic_streambuf_char_epptr(&this->base));
3821             }
3822         }
3823     }else if((mode & OPENMODE_out) && cur_w) {
3824         if(way == SEEKDIR_cur)
3825             off += cur_w-beg;
3826         else if(way == SEEKDIR_end)
3827             off += this->seekhigh-beg;
3828         else if(way != SEEKDIR_beg)
3829             off = -1;
3830
3831         if(off<0 || off>this->seekhigh-beg)
3832             off = -1;
3833         else
3834             basic_streambuf_char_pbump(&this->base, beg-cur_w+off);
3835     }else {
3836         off = -1;
3837     }
3838
3839     ret->pos = off;
3840     return ret;
3841 }
3842
3843 /* ?seekpos@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3844 /* ?seekpos@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3845 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_seekpos, 36)
3846 fpos_int* __thiscall basic_stringbuf_char_seekpos(basic_stringbuf_char *this,
3847         fpos_int *ret, fpos_int pos, int mode)
3848 {
3849     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
3850
3851     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
3852         *ret = pos;
3853         return ret;
3854     }
3855
3856     return basic_stringbuf_char_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
3857 }
3858
3859 /* ?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 */
3860 /* ?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 */
3861 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_str_set, 8)
3862 void __thiscall basic_stringbuf_char_str_set(basic_stringbuf_char *this, const basic_string_char *str)
3863 {
3864     TRACE("(%p %p)\n", this, str);
3865
3866     basic_stringbuf_char__Tidy(this);
3867     basic_stringbuf_char__Init(this, MSVCP_basic_string_char_c_str(str), str->size, this->state);
3868 }
3869
3870 /* ?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 */
3871 /* ?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 */
3872 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_str_get, 8)
3873 basic_string_char* __thiscall basic_stringbuf_char_str_get(const basic_stringbuf_char *this, basic_string_char *ret)
3874 {
3875     char *ptr;
3876
3877     TRACE("(%p)\n", this);
3878
3879     if(!(this->state & STRINGBUF_no_write) && basic_streambuf_char_pptr(&this->base)) {
3880         char *pptr;
3881
3882         ptr = basic_streambuf_char_pbase(&this->base);
3883         pptr = basic_streambuf_char_pptr(&this->base);
3884
3885         return MSVCP_basic_string_char_ctor_cstr_len(ret, ptr, (this->seekhigh < pptr ? pptr : this->seekhigh) - ptr);
3886     }
3887
3888     if(!(this->state & STRINGBUF_no_read) && basic_streambuf_char_gptr(&this->base)) {
3889         ptr = basic_streambuf_char_eback(&this->base);
3890         return MSVCP_basic_string_char_ctor_cstr_len(ret, ptr, basic_streambuf_char_egptr(&this->base) - ptr);
3891     }
3892
3893     return MSVCP_basic_string_char_ctor(ret);
3894 }
3895
3896 /* ?_Getstate@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AAEHH@Z */
3897 /* ?_Getstate@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEAAHH@Z */
3898 /* ?_Getstate@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEHH@Z */
3899 /* ?_Getstate@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAHH@Z */
3900 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Getstate, 8)
3901 int __thiscall basic_stringbuf_wchar__Getstate(basic_stringbuf_wchar *this, IOSB_openmode mode)
3902 {
3903     int state = 0;
3904
3905     if(!(mode & OPENMODE_in))
3906         state |= STRINGBUF_no_read;
3907
3908     if(!(mode & OPENMODE_out))
3909         state |= STRINGBUF_no_write;
3910
3911     if(mode & OPENMODE_ate)
3912         state |= STRINGBUF_at_end;
3913
3914     if(mode & OPENMODE_app)
3915         state |= STRINGBUF_append;
3916
3917     return state;
3918 }
3919
3920 /* ?_Init@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXPB_WIH@Z */
3921 /* ?_Init@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAXPEB_W_KH@Z */
3922 /* ?_Init@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXPBGIH@Z */
3923 /* ?_Init@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAXPEBG_KH@Z */
3924 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Init, 16)
3925 void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const wchar_t *str, MSVCP_size_t count, int state)
3926 {
3927     TRACE("(%p, %p, %lu, %d)\n", this, str, count, state);
3928
3929     basic_streambuf_wchar__Init_empty(&this->base);
3930
3931     this->state = state;
3932     this->seekhigh = NULL;
3933
3934     if(count && str) {
3935         wchar_t *buf = MSVCRT_operator_new(count*sizeof(wchar_t));
3936         if(!buf) {
3937             ERR("Out of memory\n");
3938             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3939         }
3940
3941         memcpy(buf, str, count*sizeof(wchar_t));
3942         this->seekhigh = buf + count;
3943
3944         this->state |= STRINGBUF_allocated;
3945
3946         if(!(state & STRINGBUF_no_read))
3947             basic_streambuf_wchar_setg(&this->base, buf, buf, buf + count);
3948
3949         if(!(state & STRINGBUF_no_write)) {
3950             basic_streambuf_wchar_setp_next(&this->base, buf, (state & STRINGBUF_at_end) ? buf + count : buf, buf + count);
3951
3952             if(!basic_streambuf_wchar_gptr(&this->base))
3953                 basic_streambuf_wchar_setg(&this->base, buf, 0, buf);
3954         }
3955     }
3956 }
3957
3958 /* ??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 */
3959 /* ??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 */
3960 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor_str, 12)
3961 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor_str(basic_stringbuf_wchar *this,
3962         const basic_string_wchar *str, IOSB_openmode mode)
3963 {
3964     TRACE("(%p %p %d)\n", this, str, mode);
3965
3966     basic_streambuf_wchar_ctor(&this->base);
3967     this->base.vtable = &MSVCP_basic_stringbuf_wchar_vtable;
3968
3969     basic_stringbuf_wchar__Init(this, MSVCP_basic_string_wchar_c_str(str),
3970             str->size, basic_stringbuf_wchar__Getstate(this, mode));
3971     return this;
3972 }
3973
3974 /* ??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 */
3975 /* ??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 */
3976 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor_str, 12)
3977 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor_str(basic_stringbuf_wchar *this,
3978         const basic_string_wchar *str, IOSB_openmode mode)
3979 {
3980     basic_stringbuf_wchar_ctor_str(this, str, mode);
3981     this->base.vtable = &MSVCP_basic_stringbuf_short_vtable;
3982     return this;
3983 }
3984
3985 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
3986 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
3987 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor_mode, 8)
3988 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor_mode(
3989         basic_stringbuf_wchar *this, IOSB_openmode mode)
3990 {
3991     TRACE("(%p %d)\n", this, mode);
3992
3993     basic_streambuf_wchar_ctor(&this->base);
3994     this->base.vtable = &MSVCP_basic_stringbuf_wchar_vtable;
3995
3996     basic_stringbuf_wchar__Init(this, NULL, 0, basic_stringbuf_wchar__Getstate(this, mode));
3997     return this;
3998 }
3999
4000 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
4001 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
4002 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor_mode, 8)
4003 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor_mode(
4004         basic_stringbuf_wchar *this, IOSB_openmode mode)
4005 {
4006     basic_stringbuf_wchar_ctor_mode(this, mode);
4007     this->base.vtable = &MSVCP_basic_stringbuf_short_vtable;
4008     return this;
4009 }
4010
4011 /* ??_F?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
4012 /* ??_F?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
4013 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor, 4)
4014 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor(basic_stringbuf_wchar *this)
4015 {
4016     return basic_stringbuf_wchar_ctor_mode(this, OPENMODE_in|OPENMODE_out);
4017 }
4018
4019 /* ??_F?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
4020 /* ??_F?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
4021 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor, 4)
4022 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor(basic_stringbuf_wchar *this)
4023 {
4024     return basic_stringbuf_short_ctor_mode(this, OPENMODE_in|OPENMODE_out);
4025 }
4026
4027 /* ?_Tidy@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXXZ */
4028 /* ?_Tidy@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAXXZ */
4029 /* ?_Tidy@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXXZ */
4030 /* ?_Tidy@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAXXZ */
4031 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Tidy, 4)
4032 void __thiscall basic_stringbuf_wchar__Tidy(basic_stringbuf_wchar *this)
4033 {
4034     TRACE("(%p)\n", this);
4035
4036     if(this->state & STRINGBUF_allocated) {
4037         MSVCRT_operator_delete(basic_streambuf_wchar_eback(&this->base));
4038         this->seekhigh = NULL;
4039         this->state &= ~STRINGBUF_allocated;
4040     }
4041
4042     basic_streambuf_wchar__Init_empty(&this->base);
4043 }
4044
4045 /* ??1?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
4046 /* ??1?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
4047 /* ??1?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
4048 /* ??1?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
4049 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_dtor, 4)
4050 void __thiscall basic_stringbuf_wchar_dtor(basic_stringbuf_wchar *this)
4051 {
4052     TRACE("(%p)\n", this);
4053
4054     basic_stringbuf_wchar__Tidy(this);
4055     basic_streambuf_wchar_dtor(&this->base);
4056 }
4057
4058 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_vector_dtor, 8)
4059 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_vector_dtor(basic_stringbuf_wchar *this, unsigned int flags)
4060 {
4061     TRACE("(%p %x)\n", this, flags);
4062
4063     if(flags & 2) {
4064         /* we have an array, with the number of elements stored before the first object */
4065         INT_PTR i, *ptr = (INT_PTR *) this - 1;
4066
4067         for (i = *ptr - 1; i >= 0; i--)
4068             basic_stringbuf_wchar_dtor(this+i);
4069
4070         MSVCRT_operator_delete(ptr);
4071     }else {
4072         basic_stringbuf_wchar_dtor(this);
4073
4074         if(flags & 1)
4075             MSVCRT_operator_delete(this);
4076     }
4077
4078     return this;
4079 }
4080
4081 /* ?overflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGG@Z */
4082 /* ?overflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGG@Z */
4083 /* ?overflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGG@Z */
4084 /* ?overflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGG@Z */
4085 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_overflow, 8)
4086 unsigned short __thiscall basic_stringbuf_wchar_overflow(basic_stringbuf_wchar *this, unsigned short meta)
4087 {
4088     MSVCP_size_t oldsize, size;
4089     wchar_t *ptr, *buf;
4090
4091     TRACE("(%p %x)\n", this, meta);
4092
4093     if(meta == WEOF)
4094         return !WEOF;
4095     if(this->state & STRINGBUF_no_write)
4096         return WEOF;
4097
4098     ptr = basic_streambuf_wchar_pptr(&this->base);
4099     if((this->state&STRINGBUF_append) && ptr<this->seekhigh)
4100         basic_streambuf_wchar_setp_next(&this->base, basic_streambuf_wchar_pbase(&this->base),
4101                 this->seekhigh, basic_streambuf_wchar_epptr(&this->base));
4102
4103     if(ptr && ptr<basic_streambuf_wchar_epptr(&this->base))
4104         return (*basic_streambuf_wchar__Pninc(&this->base) = meta);
4105
4106     oldsize = (ptr ? basic_streambuf_wchar_epptr(&this->base)-basic_streambuf_wchar_eback(&this->base): 0);
4107     size = oldsize|0xf;
4108     size += size/2;
4109     buf = MSVCRT_operator_new(size*sizeof(wchar_t));
4110     if(!buf) {
4111         ERR("Out of memory\n");
4112         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4113     }
4114
4115     if(!oldsize) {
4116         this->seekhigh = buf;
4117         basic_streambuf_wchar_setp(&this->base, buf, buf+size);
4118         if(this->state & STRINGBUF_no_read)
4119             basic_streambuf_wchar_setg(&this->base, buf, NULL, buf);
4120         else
4121             basic_streambuf_wchar_setg(&this->base, buf, buf, buf+1);
4122
4123         this->state |= STRINGBUF_allocated;
4124     }else {
4125         ptr = basic_streambuf_wchar_eback(&this->base);
4126         memcpy(buf, ptr, oldsize*sizeof(wchar_t));
4127
4128         this->seekhigh = buf+(this->seekhigh-ptr);
4129         basic_streambuf_wchar_setp_next(&this->base, buf,
4130                 buf+(basic_streambuf_wchar_pptr(&this->base)-ptr), buf+size);
4131         if(this->state & STRINGBUF_no_read)
4132             basic_streambuf_wchar_setg(&this->base, buf, NULL, buf);
4133         else
4134             basic_streambuf_wchar_setg(&this->base, buf,
4135                     buf+(basic_streambuf_wchar_gptr(&this->base)-ptr),
4136                     basic_streambuf_wchar_pptr(&this->base)+1);
4137
4138         MSVCRT_operator_delete(ptr);
4139     }
4140
4141     return (*basic_streambuf_wchar__Pninc(&this->base) = meta);
4142 }
4143
4144 /* ?pbackfail@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGG@Z */
4145 /* ?pbackfail@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGG@Z */
4146 /* ?pbackfail@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGG@Z */
4147 /* ?pbackfail@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGG@Z */
4148 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_pbackfail, 8)
4149 unsigned short __thiscall basic_stringbuf_wchar_pbackfail(basic_stringbuf_wchar *this, unsigned short c)
4150 {
4151     wchar_t *cur;
4152
4153     TRACE("(%p %x)\n", this, c);
4154
4155     cur = basic_streambuf_wchar_gptr(&this->base);
4156     if(!cur || cur==basic_streambuf_wchar_eback(&this->base)
4157             || (c!=WEOF && c!=cur[-1] && this->state&STRINGBUF_no_write))
4158         return WEOF;
4159
4160     if(c != WEOF)
4161         cur[-1] = c;
4162     basic_streambuf_wchar_gbump(&this->base, -1);
4163     return c==WEOF ? !WEOF : c;
4164 }
4165
4166 /* ?underflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGXZ */
4167 /* ?underflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGXZ */
4168 /* ?underflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGXZ */
4169 /* ?underflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGXZ */
4170 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_underflow, 4)
4171 unsigned short __thiscall basic_stringbuf_wchar_underflow(basic_stringbuf_wchar *this)
4172 {
4173     wchar_t *ptr, *cur;
4174
4175     TRACE("(%p)\n", this);
4176
4177     cur = basic_streambuf_wchar_gptr(&this->base);
4178     if(!cur || this->state&STRINGBUF_no_read)
4179         return WEOF;
4180
4181     ptr  = basic_streambuf_wchar_pptr(&this->base);
4182     if(this->seekhigh < ptr)
4183         this->seekhigh = ptr;
4184
4185     ptr = basic_streambuf_wchar_egptr(&this->base);
4186     if(this->seekhigh > ptr)
4187         basic_streambuf_wchar_setg(&this->base, basic_streambuf_wchar_eback(&this->base), cur, this->seekhigh);
4188
4189     if(cur < this->seekhigh)
4190         return *cur;
4191     return WEOF;
4192 }
4193
4194 /* ?seekoff@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
4195 /* ?seekoff@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
4196 /* ?seekoff@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
4197 /* ?seekoff@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
4198 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_seekoff, 20)
4199 fpos_int* __thiscall basic_stringbuf_wchar_seekoff(basic_stringbuf_wchar *this,
4200         fpos_int *ret, streamoff off, int way, int mode)
4201 {
4202     wchar_t *beg, *cur_r, *cur_w;
4203
4204     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
4205
4206     cur_w = basic_streambuf_wchar_pptr(&this->base);
4207     if(cur_w > this->seekhigh)
4208         this->seekhigh = cur_w;
4209
4210     ret->off = 0;
4211     ret->state = 0;
4212
4213     beg = basic_streambuf_wchar_eback(&this->base);
4214     cur_r = basic_streambuf_wchar_gptr(&this->base);
4215     if((mode & OPENMODE_in) && cur_r) {
4216         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
4217             off += cur_r-beg;
4218         else if(way == SEEKDIR_end)
4219             off += this->seekhigh-beg;
4220         else if(way != SEEKDIR_beg)
4221             off = -1;
4222
4223         if(off<0 || off>this->seekhigh-beg) {
4224             off = -1;
4225         }else {
4226             basic_streambuf_wchar_gbump(&this->base, beg-cur_r+off);
4227             if((mode & OPENMODE_out) && cur_w) {
4228                 basic_streambuf_wchar_setp_next(&this->base, beg,
4229                         basic_streambuf_wchar_gptr(&this->base),
4230                         basic_streambuf_wchar_epptr(&this->base));
4231             }
4232         }
4233     }else if((mode & OPENMODE_out) && cur_w) {
4234         if(way == SEEKDIR_cur)
4235             off += cur_w-beg;
4236         else if(way == SEEKDIR_end)
4237             off += this->seekhigh-beg;
4238         else if(way != SEEKDIR_beg)
4239             off = -1;
4240
4241         if(off<0 || off>this->seekhigh-beg)
4242             off = -1;
4243         else
4244             basic_streambuf_wchar_pbump(&this->base, beg-cur_w+off);
4245     }else {
4246         off = -1;
4247     }
4248
4249     ret->pos = off;
4250     return ret;
4251 }
4252
4253 /* ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
4254 /* ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
4255 /* ?seekpos@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
4256 /* ?seekpos@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
4257 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_seekpos, 36)
4258 fpos_int* __thiscall basic_stringbuf_wchar_seekpos(basic_stringbuf_wchar *this,
4259         fpos_int *ret, fpos_int pos, int mode)
4260 {
4261     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
4262
4263     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
4264         *ret = pos;
4265         return ret;
4266     }
4267
4268     return basic_stringbuf_wchar_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
4269 }
4270
4271 /* ?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 */
4272 /* ?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 */
4273 /* ?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 */
4274 /* ?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 */
4275 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_str_set, 8)
4276 void __thiscall basic_stringbuf_wchar_str_set(basic_stringbuf_wchar *this, const basic_string_wchar *str)
4277 {
4278     TRACE("(%p %p)\n", this, str);
4279
4280     basic_stringbuf_wchar__Tidy(this);
4281     basic_stringbuf_wchar__Init(this, MSVCP_basic_string_wchar_c_str(str), str->size, this->state);
4282 }
4283
4284 /* ?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 */
4285 /* ?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 */
4286 /* ?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 */
4287 /* ?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 */
4288 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_str_get, 8)
4289 basic_string_wchar* __thiscall basic_stringbuf_wchar_str_get(const basic_stringbuf_wchar *this, basic_string_wchar *ret)
4290 {
4291     wchar_t *ptr;
4292
4293     TRACE("(%p)\n", this);
4294
4295     if(!(this->state & STRINGBUF_no_write) && basic_streambuf_wchar_pptr(&this->base)) {
4296         wchar_t *pptr;
4297
4298         ptr = basic_streambuf_wchar_pbase(&this->base);
4299         pptr = basic_streambuf_wchar_pptr(&this->base);
4300
4301         return MSVCP_basic_string_wchar_ctor_cstr_len(ret, ptr, (this->seekhigh < pptr ? pptr : this->seekhigh) - ptr);
4302     }
4303
4304     if(!(this->state & STRINGBUF_no_read) && basic_streambuf_wchar_gptr(&this->base)) {
4305         ptr = basic_streambuf_wchar_eback(&this->base);
4306         return MSVCP_basic_string_wchar_ctor_cstr_len(ret, ptr, basic_streambuf_wchar_egptr(&this->base) - ptr);
4307     }
4308
4309     return MSVCP_basic_string_wchar_ctor(ret);
4310 }
4311
4312 /* ??0ios_base@std@@IAE@XZ */
4313 /* ??0ios_base@std@@IEAA@XZ */
4314 DEFINE_THISCALL_WRAPPER(ios_base_ctor, 4)
4315 ios_base* __thiscall ios_base_ctor(ios_base *this)
4316 {
4317     TRACE("(%p)\n", this);
4318     this->vtable = &MSVCP_ios_base_vtable;
4319     return this;
4320 }
4321
4322 /* ??0ios_base@std@@QAE@ABV01@@Z */
4323 /* ??0ios_base@std@@QEAA@AEBV01@@Z */
4324 DEFINE_THISCALL_WRAPPER(ios_base_copy_ctor, 8)
4325 ios_base* __thiscall ios_base_copy_ctor(ios_base *this, const ios_base *copy)
4326 {
4327     TRACE("(%p %p)\n", this, copy);
4328     *this = *copy;
4329     this->vtable = &MSVCP_ios_base_vtable;
4330     return this;
4331 }
4332
4333 /* ?_Callfns@ios_base@std@@AAEXW4event@12@@Z */
4334 /* ?_Callfns@ios_base@std@@AEAAXW4event@12@@Z */
4335 DEFINE_THISCALL_WRAPPER(ios_base_Callfns, 8)
4336 void __thiscall ios_base_Callfns(ios_base *this, IOS_BASE_event event)
4337 {
4338     IOS_BASE_fnarray *cur;
4339
4340     TRACE("(%p %x)\n", this, event);
4341
4342     for(cur=this->calls; cur; cur=cur->next)
4343         cur->event_handler(event, this, cur->index);
4344 }
4345
4346 /* ?_Tidy@ios_base@std@@AAAXXZ */
4347 /* ?_Tidy@ios_base@std@@AEAAXXZ */
4348 void CDECL ios_base_Tidy(ios_base *this)
4349 {
4350     IOS_BASE_iosarray *arr_cur, *arr_next;
4351     IOS_BASE_fnarray *event_cur, *event_next;
4352
4353     TRACE("(%p)\n", this);
4354
4355     ios_base_Callfns(this, EVENT_erase_event);
4356
4357     for(arr_cur=this->arr; arr_cur; arr_cur=arr_next) {
4358         arr_next = arr_cur->next;
4359         MSVCRT_operator_delete(arr_cur);
4360     }
4361     this->arr = NULL;
4362
4363     for(event_cur=this->calls; event_cur; event_cur=event_next) {
4364         event_next = event_cur->next;
4365         MSVCRT_operator_delete(event_cur);
4366     }
4367     this->calls = NULL;
4368 }
4369
4370 /* ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z */
4371 /* ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z */
4372 void CDECL ios_base_Ios_base_dtor(ios_base *obj)
4373 {
4374     TRACE("(%p)\n", obj);
4375     if(obj->loc) {
4376         locale_dtor(obj->loc);
4377         MSVCRT_operator_delete(obj->loc);
4378     }
4379     ios_base_Tidy(obj);
4380 }
4381
4382 /* ??1ios_base@std@@UAE@XZ */
4383 /* ??1ios_base@std@@UEAA@XZ */
4384 DEFINE_THISCALL_WRAPPER(ios_base_dtor, 4)
4385 void __thiscall ios_base_dtor(ios_base *this)
4386 {
4387     ios_base_Ios_base_dtor(this);
4388 }
4389
4390 DEFINE_THISCALL_WRAPPER(ios_base_vector_dtor, 8)
4391 ios_base* __thiscall ios_base_vector_dtor(ios_base *this, unsigned int flags)
4392 {
4393     TRACE("(%p %x)\n", this, flags);
4394     if(flags & 2) {
4395         /* we have an array, with the number of elements stored before the first object */
4396         INT_PTR i, *ptr = (INT_PTR *)this-1;
4397
4398         for(i=*ptr-1; i>=0; i--)
4399             ios_base_dtor(this+i);
4400         MSVCRT_operator_delete(ptr);
4401     } else {
4402         ios_base_dtor(this);
4403         if(flags & 1)
4404             MSVCRT_operator_delete(this);
4405     }
4406
4407     return this;
4408 }
4409
4410 DEFINE_THISCALL_WRAPPER(iosb_vector_dtor, 8)
4411 void* __thiscall iosb_vector_dtor(void *this, unsigned int flags)
4412 {
4413     TRACE("(%p %x)\n", this, flags);
4414     if(flags & 2) {
4415         INT_PTR *ptr = (INT_PTR *)this-1;
4416         MSVCRT_operator_delete(ptr);
4417     } else {
4418         if(flags & 1)
4419             MSVCRT_operator_delete(this);
4420     }
4421
4422     return this;
4423 }
4424
4425 /* ?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z */
4426 /* ?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z */
4427 DEFINE_THISCALL_WRAPPER(ios_base_Findarr, 8)
4428 IOS_BASE_iosarray* __thiscall ios_base_Findarr(ios_base *this, int index)
4429 {
4430     IOS_BASE_iosarray *p;
4431
4432     TRACE("(%p %d)\n", this, index);
4433
4434     for(p=this->arr; p; p=p->next) {
4435         if(p->index == index)
4436             return p;
4437     }
4438
4439     for(p=this->arr; p; p=p->next) {
4440         if(!p->long_val && !p->ptr_val) {
4441             p->index = index;
4442             return p;
4443         }
4444     }
4445
4446     p = MSVCRT_operator_new(sizeof(IOS_BASE_iosarray));
4447     p->next = this->arr;
4448     p->index = index;
4449     p->long_val = 0;
4450     p->ptr_val = NULL;
4451     this->arr = p;
4452     return p;
4453 }
4454
4455 /* ?iword@ios_base@std@@QAEAAJH@Z */
4456 /* ?iword@ios_base@std@@QEAAAEAJH@Z */
4457 DEFINE_THISCALL_WRAPPER(ios_base_iword, 8)
4458 LONG* __thiscall ios_base_iword(ios_base *this, int index)
4459 {
4460     TRACE("(%p %d)\n", this, index);
4461     return &ios_base_Findarr(this, index)->long_val;
4462 }
4463
4464 /* ?pword@ios_base@std@@QAEAAPAXH@Z */
4465 /* ?pword@ios_base@std@@QEAAAEAPEAXH@Z */
4466 DEFINE_THISCALL_WRAPPER(ios_base_pword, 8)
4467 void** __thiscall ios_base_pword(ios_base *this, int index)
4468 {
4469     TRACE("(%p %d)\n", this, index);
4470     return &ios_base_Findarr(this, index)->ptr_val;
4471 }
4472
4473 /* ?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z */
4474 /* ?register_callback@ios_base@std@@QEAAXP6AXW4event@12@AEAV12@H@ZH@Z */
4475 DEFINE_THISCALL_WRAPPER(ios_base_register_callback, 12)
4476 void __thiscall ios_base_register_callback(ios_base *this, IOS_BASE_event_callback callback, int index)
4477 {
4478     IOS_BASE_fnarray *event;
4479
4480     TRACE("(%p %p %d)\n", this, callback, index);
4481
4482     event = MSVCRT_operator_new(sizeof(IOS_BASE_fnarray));
4483     event->next = this->calls;
4484     event->index = index;
4485     event->event_handler = callback;
4486     this->calls = event;
4487 }
4488
4489 /* ?clear@ios_base@std@@QAEXH_N@Z */
4490 /* ?clear@ios_base@std@@QEAAXH_N@Z */
4491 DEFINE_THISCALL_WRAPPER(ios_base_clear_reraise, 12)
4492 void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
4493 {
4494     TRACE("(%p %x %x)\n", this, state, reraise);
4495
4496     this->state = state & IOSTATE_mask;
4497     if(!(this->state & this->except))
4498         return;
4499
4500     if(reraise)
4501         throw_exception(EXCEPTION_RERAISE, NULL);
4502     else if(this->state & this->except & IOSTATE_eofbit)
4503         throw_exception(EXCEPTION_FAILURE, "eofbit is set");
4504     else if(this->state & this->except & IOSTATE_failbit)
4505         throw_exception(EXCEPTION_FAILURE, "failbit is set");
4506     else if(this->state & this->except & IOSTATE_badbit)
4507         throw_exception(EXCEPTION_FAILURE, "badbit is set");
4508     else if(this->state & this->except & IOSTATE__Hardfail)
4509         throw_exception(EXCEPTION_FAILURE, "_Hardfail is set");
4510 }
4511
4512 /* ?clear@ios_base@std@@QAEXH@Z */
4513 /* ?clear@ios_base@std@@QEAAXH@Z */
4514 DEFINE_THISCALL_WRAPPER(ios_base_clear, 8)
4515 void __thiscall ios_base_clear(ios_base *this, IOSB_iostate state)
4516 {
4517     ios_base_clear_reraise(this, state, FALSE);
4518 }
4519
4520 /* ?clear@ios_base@std@@QAEXI@Z */
4521 /* ?clear@ios_base@std@@QEAAXI@Z */
4522 DEFINE_THISCALL_WRAPPER(ios_base_clear_unsigned, 8)
4523 void __thiscall ios_base_clear_unsigned(ios_base *this, unsigned int state)
4524 {
4525     ios_base_clear_reraise(this, (IOSB_iostate)state, FALSE);
4526 }
4527
4528 /* ?exceptions@ios_base@std@@QAEXH@Z */
4529 /* ?exceptions@ios_base@std@@QEAAXH@Z */
4530 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set, 8)
4531 void __thiscall ios_base_exceptions_set(ios_base *this, IOSB_iostate state)
4532 {
4533     TRACE("(%p %x)\n", this, state);
4534     this->except = state & IOSTATE_mask;
4535     ios_base_clear(this, this->state);
4536 }
4537
4538 /* ?exceptions@ios_base@std@@QAEXI@Z */
4539 /* ?exceptions@ios_base@std@@QEAAXI@Z */
4540 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set_unsigned, 8)
4541 void __thiscall ios_base_exceptions_set_unsigned(ios_base *this, unsigned int state)
4542 {
4543     TRACE("(%p %x)\n", this, state);
4544     ios_base_exceptions_set(this, state);
4545 }
4546
4547 /* ?exceptions@ios_base@std@@QBEHXZ */
4548 /* ?exceptions@ios_base@std@@QEBAHXZ */
4549 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_get, 4)
4550 IOSB_iostate __thiscall ios_base_exceptions_get(ios_base *this)
4551 {
4552     TRACE("(%p)\n", this);
4553     return this->except;
4554 }
4555
4556 /* ?copyfmt@ios_base@std@@QAEAAV12@ABV12@@Z */
4557 /* ?copyfmt@ios_base@std@@QEAAAEAV12@AEBV12@@Z */
4558 DEFINE_THISCALL_WRAPPER(ios_base_copyfmt, 8)
4559 ios_base* __thiscall ios_base_copyfmt(ios_base *this, const ios_base *rhs)
4560 {
4561     TRACE("(%p %p)\n", this, rhs);
4562
4563     if(this != rhs) {
4564         IOS_BASE_iosarray *arr_cur;
4565         IOS_BASE_fnarray *event_cur;
4566
4567         ios_base_Tidy(this);
4568
4569         for(arr_cur=rhs->arr; arr_cur; arr_cur=arr_cur->next) {
4570             if(arr_cur->long_val)
4571                 *ios_base_iword(this, arr_cur->index) = arr_cur->long_val;
4572             if(arr_cur->ptr_val)
4573                 *ios_base_pword(this, arr_cur->index) = arr_cur->ptr_val;
4574         }
4575         this->stdstr = rhs->stdstr;
4576         this->fmtfl = rhs->fmtfl;
4577         this->prec = rhs->prec;
4578         this->wide = rhs->wide;
4579         locale_operator_assign(this->loc, rhs->loc);
4580
4581         for(event_cur=rhs->calls; event_cur; event_cur=event_cur->next)
4582             ios_base_register_callback(this, event_cur->event_handler, event_cur->index);
4583
4584         ios_base_Callfns(this, EVENT_copyfmt_event);
4585         ios_base_exceptions_set(this, rhs->except);
4586     }
4587
4588     return this;
4589 }
4590
4591 /* ??4ios_base@std@@QAEAAV01@ABV01@@Z */
4592 /* ??4ios_base@std@@QEAAAEAV01@AEBV01@@Z */
4593 DEFINE_THISCALL_WRAPPER(ios_base_assign, 8)
4594 ios_base* __thiscall ios_base_assign(ios_base *this, const ios_base *right)
4595 {
4596     TRACE("(%p %p)\n", this, right);
4597
4598     if(this != right) {
4599         this->state = right->state;
4600         ios_base_copyfmt(this, right);
4601     }
4602
4603     return this;
4604 }
4605
4606 /* ?fail@ios_base@std@@QBE_NXZ */
4607 /* ?fail@ios_base@std@@QEBA_NXZ */
4608 DEFINE_THISCALL_WRAPPER(ios_base_fail, 4)
4609 MSVCP_bool __thiscall ios_base_fail(const ios_base *this)
4610 {
4611     TRACE("(%p)\n", this);
4612     return (this->state & (IOSTATE_failbit|IOSTATE_badbit)) != 0;
4613 }
4614
4615 /* ??7ios_base@std@@QBE_NXZ */
4616 /* ??7ios_base@std@@QEBA_NXZ */
4617 DEFINE_THISCALL_WRAPPER(ios_base_op_succ, 4)
4618 MSVCP_bool __thiscall ios_base_op_succ(const ios_base *this)
4619 {
4620     TRACE("(%p)\n", this);
4621     return ios_base_fail(this);
4622 }
4623
4624 /* ??Bios_base@std@@QBEPAXXZ */
4625 /* ??Bios_base@std@@QEBAPEAXXZ */
4626 DEFINE_THISCALL_WRAPPER(ios_base_op_fail, 4)
4627 void* __thiscall ios_base_op_fail(const ios_base *this)
4628 {
4629     TRACE("(%p)\n", this);
4630     return ios_base_fail(this) ? NULL : (void*)this;
4631 }
4632
4633 /* ?_Addstd@ios_base@std@@SAXPAV12@@Z */
4634 /* ?_Addstd@ios_base@std@@SAXPEAV12@@Z */
4635 void CDECL ios_base_Addstd(ios_base *add)
4636 {
4637     FIXME("(%p) stub\n", add);
4638 }
4639
4640 /* ?_Index_func@ios_base@std@@CAAAHXZ */
4641 /* ?_Index_func@ios_base@std@@CAAEAHXZ */
4642 int* CDECL ios_base_Index_func(void)
4643 {
4644     TRACE("\n");
4645     return &ios_base_Index;
4646 }
4647
4648 /* ?_Init@ios_base@std@@IAEXXZ */
4649 /* ?_Init@ios_base@std@@IEAAXXZ */
4650 DEFINE_THISCALL_WRAPPER(ios_base_Init, 4)
4651 void __thiscall ios_base_Init(ios_base *this)
4652 {
4653     TRACE("(%p)\n", this);
4654
4655     this->stdstr = 0;
4656     this->state = this->except = IOSTATE_goodbit;
4657     this->fmtfl = FMTFLAG_skipws | FMTFLAG_dec;
4658     this->prec = 6;
4659     this->wide = 0;
4660     this->arr = NULL;
4661     this->calls = NULL;
4662     this->loc = MSVCRT_operator_new(sizeof(locale));
4663     locale_ctor(this->loc);
4664 }
4665
4666 /* ?_Sync_func@ios_base@std@@CAAA_NXZ */
4667 /* ?_Sync_func@ios_base@std@@CAAEA_NXZ */
4668 MSVCP_bool* CDECL ios_base_Sync_func(void)
4669 {
4670     TRACE("\n");
4671     return &ios_base_Sync;
4672 }
4673
4674 /* ?bad@ios_base@std@@QBE_NXZ */
4675 /* ?bad@ios_base@std@@QEBA_NXZ */
4676 DEFINE_THISCALL_WRAPPER(ios_base_bad, 4)
4677 MSVCP_bool __thiscall ios_base_bad(const ios_base *this)
4678 {
4679     TRACE("(%p)\n", this);
4680     return (this->state & IOSTATE_badbit) != 0;
4681 }
4682
4683 /* ?eof@ios_base@std@@QBE_NXZ */
4684 /* ?eof@ios_base@std@@QEBA_NXZ */
4685 DEFINE_THISCALL_WRAPPER(ios_base_eof, 4)
4686 MSVCP_bool __thiscall ios_base_eof(const ios_base *this)
4687 {
4688     TRACE("(%p)\n", this);
4689     return (this->state & IOSTATE_eofbit) != 0;
4690 }
4691
4692 /* ?flags@ios_base@std@@QAEHH@Z */
4693 /* ?flags@ios_base@std@@QEAAHH@Z */
4694 DEFINE_THISCALL_WRAPPER(ios_base_flags_set, 8)
4695 IOSB_fmtflags __thiscall ios_base_flags_set(ios_base *this, IOSB_fmtflags flags)
4696 {
4697     IOSB_fmtflags ret = this->fmtfl;
4698
4699     TRACE("(%p %x)\n", this, flags);
4700
4701     this->fmtfl = flags & FMTFLAG_mask;
4702     return ret;
4703 }
4704
4705 /* ?flags@ios_base@std@@QBEHXZ */
4706 /* ?flags@ios_base@std@@QEBAHXZ */
4707 DEFINE_THISCALL_WRAPPER(ios_base_flags_get, 4)
4708 IOSB_fmtflags __thiscall ios_base_flags_get(const ios_base *this)
4709 {
4710     TRACE("(%p)\n", this);
4711     return this->fmtfl;
4712 }
4713
4714 /* ?getloc@ios_base@std@@QBE?AVlocale@2@XZ */
4715 /* ?getloc@ios_base@std@@QEBA?AVlocale@2@XZ */
4716 DEFINE_THISCALL_WRAPPER(ios_base_getloc, 8)
4717 locale* __thiscall ios_base_getloc(const ios_base *this, locale *ret)
4718 {
4719     TRACE("(%p)\n", this);
4720     return locale_copy_ctor(ret, this->loc);
4721 }
4722
4723 /* ?good@ios_base@std@@QBE_NXZ */
4724 /* ?good@ios_base@std@@QEBA_NXZ */
4725 DEFINE_THISCALL_WRAPPER(ios_base_good, 4)
4726 MSVCP_bool __thiscall ios_base_good(const ios_base *this)
4727 {
4728     TRACE("(%p)\n", this);
4729     return this->state == IOSTATE_goodbit;
4730 }
4731
4732 /* ?imbue@ios_base@std@@QAE?AVlocale@2@ABV32@@Z */
4733 /* ?imbue@ios_base@std@@QEAA?AVlocale@2@AEBV32@@Z */
4734 DEFINE_THISCALL_WRAPPER(ios_base_imbue, 12)
4735 locale* __thiscall ios_base_imbue(ios_base *this, locale *ret, const locale *loc)
4736 {
4737     TRACE("(%p %p)\n", this, loc);
4738     *ret = *this->loc;
4739     locale_copy_ctor(this->loc, loc);
4740     return ret;
4741 }
4742
4743 /* ?precision@ios_base@std@@QAEHH@Z */
4744 /* ?precision@ios_base@std@@QEAA_J_J@Z */
4745 DEFINE_THISCALL_WRAPPER(ios_base_precision_set, 8)
4746 streamsize __thiscall ios_base_precision_set(ios_base *this, streamsize precision)
4747 {
4748     streamsize ret = this->prec;
4749
4750     TRACE("(%p %ld)\n", this, precision);
4751
4752     this->prec = precision;
4753     return ret;
4754 }
4755
4756 /* ?precision@ios_base@std@@QBEHXZ */
4757 /* ?precision@ios_base@std@@QEBA_JXZ */
4758 DEFINE_THISCALL_WRAPPER(ios_base_precision_get, 4)
4759 streamsize __thiscall ios_base_precision_get(const ios_base *this)
4760 {
4761     TRACE("(%p)\n", this);
4762     return this->prec;
4763 }
4764
4765 /* ?rdstate@ios_base@std@@QBEHXZ */
4766 /* ?rdstate@ios_base@std@@QEBAHXZ */
4767 DEFINE_THISCALL_WRAPPER(ios_base_rdstate, 4)
4768 IOSB_iostate __thiscall ios_base_rdstate(const ios_base *this)
4769 {
4770     TRACE("(%p)\n", this);
4771     return this->state;
4772 }
4773
4774 /* ?setf@ios_base@std@@QAEHHH@Z */
4775 /* ?setf@ios_base@std@@QEAAHHH@Z */
4776 DEFINE_THISCALL_WRAPPER(ios_base_setf_mask, 12)
4777 IOSB_fmtflags __thiscall ios_base_setf_mask(ios_base *this, IOSB_fmtflags flags, IOSB_fmtflags mask)
4778 {
4779     IOSB_fmtflags ret = this->fmtfl;
4780
4781     TRACE("(%p %x %x)\n", this, flags, mask);
4782
4783     this->fmtfl = (this->fmtfl & (~mask)) | (flags & mask & FMTFLAG_mask);
4784     return ret;
4785 }
4786
4787 /* ?setf@ios_base@std@@QAEHH@Z */
4788 /* ?setf@ios_base@std@@QEAAHH@Z */
4789 DEFINE_THISCALL_WRAPPER(ios_base_setf, 8)
4790 IOSB_fmtflags __thiscall ios_base_setf(ios_base *this, IOSB_fmtflags flags)
4791 {
4792     return ios_base_setf_mask(this, flags, ~0);
4793 }
4794
4795 /* ?setstate@ios_base@std@@QAEXH_N@Z */
4796 /* ?setstate@ios_base@std@@QEAAXH_N@Z */
4797 DEFINE_THISCALL_WRAPPER(ios_base_setstate_reraise, 12)
4798 void __thiscall ios_base_setstate_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
4799 {
4800     TRACE("(%p %x %x)\n", this, state, reraise);
4801
4802     if(state != IOSTATE_goodbit)
4803         ios_base_clear_reraise(this, this->state | state, reraise);
4804 }
4805
4806 /* ?setstate@ios_base@std@@QAEXH@Z */
4807 /* ?setstate@ios_base@std@@QEAAXH@Z */
4808 DEFINE_THISCALL_WRAPPER(ios_base_setstate, 8)
4809 void __thiscall ios_base_setstate(ios_base *this, IOSB_iostate state)
4810 {
4811     ios_base_setstate_reraise(this, state, FALSE);
4812 }
4813
4814 /* ?setstate@ios_base@std@@QAEXI@Z */
4815 /* ?setstate@ios_base@std@@QEAAXI@Z */
4816 DEFINE_THISCALL_WRAPPER(ios_base_setstate_unsigned, 8)
4817 void __thiscall ios_base_setstate_unsigned(ios_base *this, unsigned int state)
4818 {
4819     ios_base_setstate_reraise(this, (IOSB_iostate)state, FALSE);
4820 }
4821
4822 /* ?sync_with_stdio@ios_base@std@@SA_N_N@Z */
4823 MSVCP_bool CDECL ios_base_sync_with_stdio(MSVCP_bool sync)
4824 {
4825     _Lockit lock;
4826     MSVCP_bool ret;
4827
4828     TRACE("(%x)\n", sync);
4829
4830     _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
4831     ret = ios_base_Sync;
4832     ios_base_Sync = sync;
4833     _Lockit_dtor(&lock);
4834     return ret;
4835 }
4836
4837 /* ?unsetf@ios_base@std@@QAEXH@Z */
4838 /* ?unsetf@ios_base@std@@QEAAXH@Z */
4839 DEFINE_THISCALL_WRAPPER(ios_base_unsetf, 8)
4840 void __thiscall ios_base_unsetf(ios_base *this, IOSB_fmtflags flags)
4841 {
4842     TRACE("(%p %x)\n", this, flags);
4843     this->fmtfl &= ~flags;
4844 }
4845
4846 /* ?width@ios_base@std@@QAEHH@Z */
4847 /* ?width@ios_base@std@@QEAA_J_J@Z */
4848 DEFINE_THISCALL_WRAPPER(ios_base_width_set, 8)
4849 streamsize __thiscall ios_base_width_set(ios_base *this, streamsize width)
4850 {
4851     streamsize ret = this->wide;
4852
4853     TRACE("(%p %ld)\n", this, width);
4854
4855     this->wide = width;
4856     return ret;
4857 }
4858
4859 /* ?width@ios_base@std@@QBEHXZ */
4860 /* ?width@ios_base@std@@QEBA_JXZ */
4861 DEFINE_THISCALL_WRAPPER(ios_base_width_get, 4)
4862 streamsize __thiscall ios_base_width_get(ios_base *this)
4863 {
4864     TRACE("(%p)\n", this);
4865     return this->wide;
4866 }
4867
4868 /* ?xalloc@ios_base@std@@SAHXZ */
4869 int CDECL ios_base_xalloc(void)
4870 {
4871     _Lockit lock;
4872     int ret;
4873
4874     TRACE("\n");
4875
4876     _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
4877     ret = ios_base_Index++;
4878     _Lockit_dtor(&lock);
4879     return ret;
4880 }
4881
4882 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ */
4883 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IEAA@XZ */
4884 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor, 4)
4885 basic_ios_char* __thiscall basic_ios_char_ctor(basic_ios_char *this)
4886 {
4887     TRACE("(%p)\n", this);
4888
4889     ios_base_ctor(&this->base);
4890     this->base.vtable = &MSVCP_basic_ios_char_vtable;
4891     return this;
4892 }
4893
4894 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IAEXPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
4895 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
4896 DEFINE_THISCALL_WRAPPER(basic_ios_char_init, 12)
4897 void __thiscall basic_ios_char_init(basic_ios_char *this, basic_streambuf_char *streambuf, MSVCP_bool isstd)
4898 {
4899     TRACE("(%p %p %x)\n", this, streambuf, isstd);
4900     ios_base_Init(&this->base);
4901     this->strbuf = streambuf;
4902     this->stream = NULL;
4903     this->fillch = ' ';
4904
4905     if(!streambuf)
4906         ios_base_setstate(&this->base, IOSTATE_badbit);
4907
4908     if(isstd)
4909         FIXME("standard streams not handled yet\n");
4910 }
4911
4912 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4913 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4914 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor_streambuf, 8)
4915 basic_ios_char* __thiscall basic_ios_char_ctor_streambuf(basic_ios_char *this, basic_streambuf_char *strbuf)
4916 {
4917     TRACE("(%p %p)\n", this, strbuf);
4918
4919     basic_ios_char_ctor(this);
4920     basic_ios_char_init(this, strbuf, FALSE);
4921     return this;
4922 }
4923
4924 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ */
4925 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ */
4926 DEFINE_THISCALL_WRAPPER(basic_ios_char_dtor, 4)
4927 void __thiscall basic_ios_char_dtor(basic_ios_char *this)
4928 {
4929     TRACE("(%p)\n", this);
4930     ios_base_dtor(&this->base);
4931 }
4932
4933 DEFINE_THISCALL_WRAPPER(basic_ios_char_vector_dtor, 8)
4934 basic_ios_char* __thiscall basic_ios_char_vector_dtor(basic_ios_char *this, unsigned int flags)
4935 {
4936     TRACE("(%p %x)\n", this, flags);
4937     if(flags & 2) {
4938         /* we have an array, with the number of elements stored before the first object */
4939         INT_PTR i, *ptr = (INT_PTR *)this-1;
4940
4941         for(i=*ptr-1; i>=0; i--)
4942             basic_ios_char_dtor(this+i);
4943         MSVCRT_operator_delete(ptr);
4944     } else {
4945         basic_ios_char_dtor(this);
4946         if(flags & 1)
4947             MSVCRT_operator_delete(this);
4948     }
4949
4950     return this;
4951 }
4952
4953 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
4954 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
4955 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear_reraise, 12)
4956 void __thiscall basic_ios_char_clear_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
4957 {
4958     TRACE("(%p %x %x)\n", this, state, reraise);
4959     ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
4960 }
4961
4962 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
4963 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
4964 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear, 8)
4965 void __thiscall basic_ios_char_clear(basic_ios_char *this, unsigned int state)
4966 {
4967     basic_ios_char_clear_reraise(this, (IOSB_iostate)state, FALSE);
4968 }
4969
4970 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEAAV12@ABV12@@Z */
4971 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEBV12@@Z */
4972 DEFINE_THISCALL_WRAPPER(basic_ios_char_copyfmt, 8)
4973 basic_ios_char* __thiscall basic_ios_char_copyfmt(basic_ios_char *this, basic_ios_char *copy)
4974 {
4975     TRACE("(%p %p)\n", this, copy);
4976     if(this == copy)
4977         return this;
4978
4979     this->stream = copy->stream;
4980     this->fillch = copy->fillch;
4981     ios_base_copyfmt(&this->base, &copy->base);
4982     return this;
4983 }
4984
4985 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEDD@Z */
4986 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAADD@Z */
4987 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_set, 8)
4988 char __thiscall basic_ios_char_fill_set(basic_ios_char *this, char fill)
4989 {
4990     char ret = this->fillch;
4991
4992     TRACE("(%p %c)\n", this, fill);
4993
4994     this->fillch = fill;
4995     return ret;
4996 }
4997
4998 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ */
4999 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADXZ */
5000 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_get, 4)
5001 char __thiscall basic_ios_char_fill_get(basic_ios_char *this)
5002 {
5003     TRACE("(%p)\n", this);
5004     return this->fillch;
5005 }
5006
5007 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5008 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5009 DEFINE_THISCALL_WRAPPER(basic_ios_char_imbue, 12)
5010 locale *__thiscall basic_ios_char_imbue(basic_ios_char *this, locale *ret, const locale *loc)
5011 {
5012     TRACE("(%p %p %p)\n", this, ret, loc);
5013
5014     if(this->strbuf) {
5015         basic_streambuf_char_pubimbue(this->strbuf, ret, loc);
5016         locale_dtor(ret);
5017     }
5018
5019     return ios_base_imbue(&this->base, ret, loc);
5020 }
5021
5022 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDDD@Z */
5023 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADDD@Z */
5024 DEFINE_THISCALL_WRAPPER(basic_ios_char_narrow, 12)
5025 char __thiscall basic_ios_char_narrow(basic_ios_char *this, char ch, char def)
5026 {
5027     TRACE("(%p %c %c)\n", this, ch, def);
5028     return ctype_char_narrow_ch(ctype_char_use_facet(this->strbuf->loc), ch, def);
5029 }
5030
5031 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PAV32@@Z */
5032 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAV32@@Z */
5033 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_set, 8)
5034 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_set(basic_ios_char *this, basic_streambuf_char *streambuf)
5035 {
5036     basic_streambuf_char *ret = this->strbuf;
5037
5038     TRACE("(%p %p)\n", this, streambuf);
5039
5040     this->strbuf = streambuf;
5041     basic_ios_char_clear(this, IOSTATE_goodbit);
5042     return ret;
5043 }
5044
5045 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
5046 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
5047 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_get, 4)
5048 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_get(const basic_ios_char *this)
5049 {
5050     TRACE("(%p)\n", this);
5051     return this->strbuf;
5052 }
5053
5054 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
5055 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
5056 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate_reraise, 12)
5057 void __thiscall basic_ios_char_setstate_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
5058 {
5059     TRACE("(%p %x %x)\n", this, state, reraise);
5060
5061     if(state != IOSTATE_goodbit)
5062         basic_ios_char_clear_reraise(this, this->base.state | state, reraise);
5063 }
5064
5065 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
5066 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
5067 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate, 8)
5068 void __thiscall basic_ios_char_setstate(basic_ios_char *this, unsigned int state)
5069 {
5070     basic_ios_char_setstate_reraise(this, (IOSB_iostate)state, FALSE);
5071 }
5072
5073 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@PAV32@@Z */
5074 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@PEAV32@@Z */
5075 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_set, 8)
5076 basic_ostream_char* __thiscall basic_ios_char_tie_set(basic_ios_char *this, basic_ostream_char *ostream)
5077 {
5078     basic_ostream_char *ret = this->stream;
5079
5080     TRACE("(%p %p)\n", this, ostream);
5081
5082     this->stream = ostream;
5083     return ret;
5084 }
5085
5086 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
5087 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
5088 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_get, 4)
5089 basic_ostream_char* __thiscall basic_ios_char_tie_get(const basic_ios_char *this)
5090 {
5091     TRACE("(%p)\n", this);
5092     return this->stream;
5093 }
5094
5095 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDD@Z */
5096 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADD@Z */
5097 DEFINE_THISCALL_WRAPPER(basic_ios_char_widen, 8)
5098 char __thiscall basic_ios_char_widen(basic_ios_char *this, char ch)
5099 {
5100     TRACE("(%p %c)\n", this, ch);
5101     return ctype_char_widen_ch(ctype_char_use_facet(this->strbuf->loc), ch);
5102 }
5103
5104
5105 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
5106 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
5107 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor, 4)
5108 basic_ios_wchar* __thiscall basic_ios_wchar_ctor(basic_ios_wchar *this)
5109 {
5110     TRACE("(%p)\n", this);
5111
5112     ios_base_ctor(&this->base);
5113     this->base.vtable = &MSVCP_basic_ios_wchar_vtable;
5114     return this;
5115 }
5116
5117 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IAE@XZ */
5118 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IEAA@XZ */
5119 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor, 4)
5120 basic_ios_wchar* __thiscall basic_ios_short_ctor(basic_ios_wchar *this)
5121 {
5122     basic_ios_wchar_ctor(this);
5123     this->base.vtable = &MSVCP_basic_ios_short_vtable;
5124     return this;
5125 }
5126
5127 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
5128 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
5129 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IAEXPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
5130 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
5131 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_init, 12)
5132 void __thiscall basic_ios_wchar_init(basic_ios_wchar *this, basic_streambuf_wchar *streambuf, MSVCP_bool isstd)
5133 {
5134     TRACE("(%p %p %x)\n", this, streambuf, isstd);
5135     ios_base_Init(&this->base);
5136     this->strbuf = streambuf;
5137     this->stream = NULL;
5138     this->fillch = ' ';
5139
5140     if(!streambuf)
5141         ios_base_setstate(&this->base, IOSTATE_badbit);
5142
5143     if(isstd)
5144         FIXME("standard streams not handled yet\n");
5145 }
5146
5147 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5148 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5149 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor_streambuf, 8)
5150 basic_ios_wchar* __thiscall basic_ios_wchar_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
5151 {
5152     TRACE("(%p %p)\n", this, strbuf);
5153
5154     basic_ios_wchar_ctor(this);
5155     basic_ios_wchar_init(this, strbuf, FALSE);
5156     return this;
5157 }
5158
5159 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5160 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5161 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor_streambuf, 8)
5162 basic_ios_wchar* __thiscall basic_ios_short_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
5163 {
5164     basic_ios_wchar_ctor_streambuf(this, strbuf);
5165     this->base.vtable = &MSVCP_basic_ios_short_vtable;
5166     return this;
5167 }
5168
5169 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
5170 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
5171 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UAE@XZ */
5172 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UEAA@XZ */
5173 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_dtor, 4)
5174 void __thiscall basic_ios_wchar_dtor(basic_ios_wchar *this)
5175 {
5176     TRACE("(%p)\n", this);
5177     ios_base_dtor(&this->base);
5178 }
5179
5180 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_vector_dtor, 8)
5181 basic_ios_wchar* __thiscall basic_ios_wchar_vector_dtor(basic_ios_wchar *this, unsigned int flags)
5182 {
5183     TRACE("(%p %x)\n", this, flags);
5184     if(flags & 2) {
5185         /* we have an array, with the number of elements stored before the first object */
5186         INT_PTR i, *ptr = (INT_PTR *)this-1;
5187
5188         for(i=*ptr-1; i>=0; i--)
5189             basic_ios_wchar_dtor(this+i);
5190         MSVCRT_operator_delete(ptr);
5191     } else {
5192         basic_ios_wchar_dtor(this);
5193         if(flags & 1)
5194             MSVCRT_operator_delete(this);
5195     }
5196
5197     return this;
5198 }
5199
5200 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
5201 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
5202 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
5203 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
5204 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear_reraise, 12)
5205 void __thiscall basic_ios_wchar_clear_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
5206 {
5207     TRACE("(%p %x %x)\n", this, state, reraise);
5208     ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
5209 }
5210
5211 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
5212 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
5213 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
5214 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
5215 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear, 8)
5216 void __thiscall basic_ios_wchar_clear(basic_ios_wchar *this, unsigned int state)
5217 {
5218     basic_ios_wchar_clear_reraise(this, (IOSB_iostate)state, FALSE);
5219 }
5220
5221 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEAAV12@ABV12@@Z */
5222 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEBV12@@Z */
5223 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEAAV12@ABV12@@Z */
5224 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEBV12@@Z */
5225 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_copyfmt, 8)
5226 basic_ios_wchar* __thiscall basic_ios_wchar_copyfmt(basic_ios_wchar *this, basic_ios_wchar *copy)
5227 {
5228     TRACE("(%p %p)\n", this, copy);
5229     if(this == copy)
5230         return this;
5231
5232     this->stream = copy->stream;
5233     this->fillch = copy->fillch;
5234     ios_base_copyfmt(&this->base, &copy->base);
5235     return this;
5236 }
5237
5238 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE_W_W@Z */
5239 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA_W_W@Z */
5240 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEGG@Z */
5241 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
5242 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_set, 8)
5243 wchar_t __thiscall basic_ios_wchar_fill_set(basic_ios_wchar *this, wchar_t fill)
5244 {
5245     wchar_t ret = this->fillch;
5246
5247     TRACE("(%p %c)\n", this, fill);
5248
5249     this->fillch = fill;
5250     return ret;
5251 }
5252
5253 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WXZ */
5254 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WXZ */
5255 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGXZ */
5256 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGXZ */
5257 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_get, 4)
5258 wchar_t __thiscall basic_ios_wchar_fill_get(basic_ios_wchar *this)
5259 {
5260     TRACE("(%p)\n", this);
5261     return this->fillch;
5262 }
5263
5264 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5265 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5266 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5267 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5268 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_imbue, 12)
5269 locale *__thiscall basic_ios_wchar_imbue(basic_ios_wchar *this, locale *ret, const locale *loc)
5270 {
5271     TRACE("(%p %p %p)\n", this, ret, loc);
5272
5273     if(this->strbuf)
5274         return basic_streambuf_wchar_pubimbue(this->strbuf, ret, loc);
5275
5276     locale_copy_ctor(ret, loc);
5277     return ret;
5278 }
5279
5280 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBED_WD@Z */
5281 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAD_WD@Z */
5282 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEDGD@Z */
5283 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBADGD@Z */
5284 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_narrow, 12)
5285 char __thiscall basic_ios_wchar_narrow(basic_ios_wchar *this, wchar_t ch, char def)
5286 {
5287     TRACE("(%p %c %c)\n", this, ch, def);
5288     return ctype_wchar_narrow_ch(ctype_wchar_use_facet(this->strbuf->loc), ch, def);
5289 }
5290
5291 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
5292 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
5293 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAV32@@Z */
5294 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAV32@@Z */
5295 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_set, 8)
5296 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_set(basic_ios_wchar *this, basic_streambuf_wchar *streambuf)
5297 {
5298     basic_streambuf_wchar *ret = this->strbuf;
5299
5300     TRACE("(%p %p)\n", this, streambuf);
5301
5302     this->strbuf = streambuf;
5303     basic_ios_wchar_clear(this, IOSTATE_goodbit);
5304     return ret;
5305 }
5306
5307 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
5308 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
5309 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
5310 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
5311 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_get, 4)
5312 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_get(const basic_ios_wchar *this)
5313 {
5314     TRACE("(%p)\n", this);
5315     return this->strbuf;
5316 }
5317
5318 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
5319 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
5320 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
5321 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
5322 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate_reraise, 12)
5323 void __thiscall basic_ios_wchar_setstate_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
5324 {
5325     TRACE("(%p %x %x)\n", this, state, reraise);
5326
5327     if(state != IOSTATE_goodbit)
5328         basic_ios_wchar_clear_reraise(this, this->base.state | state, reraise);
5329 }
5330
5331 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
5332 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
5333 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
5334 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
5335 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate, 8)
5336 void __thiscall basic_ios_wchar_setstate(basic_ios_wchar *this, IOSB_iostate state)
5337 {
5338     basic_ios_wchar_setstate_reraise(this, state, FALSE);
5339 }
5340
5341 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
5342 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
5343 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@PAV32@@Z */
5344 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@PEAV32@@Z */
5345 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_set, 8)
5346 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_set(basic_ios_wchar *this, basic_ostream_wchar *ostream)
5347 {
5348     basic_ostream_wchar *ret = this->stream;
5349
5350     TRACE("(%p %p)\n", this, ostream);
5351
5352     this->stream = ostream;
5353     return ret;
5354 }
5355
5356 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
5357 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
5358 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
5359 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
5360 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_get, 4)
5361 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_get(const basic_ios_wchar *this)
5362 {
5363     TRACE("(%p)\n", this);
5364     return this->stream;
5365 }
5366
5367 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WD@Z */
5368 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WD@Z */
5369 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGD@Z */
5370 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGD@Z */
5371 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_widen, 8)
5372 wchar_t __thiscall basic_ios_wchar_widen(basic_ios_wchar *this, char ch)
5373 {
5374     TRACE("(%p %c)\n", this, ch);
5375     return ctype_wchar_widen_ch(ctype_wchar_use_facet(this->strbuf->loc), ch);
5376 }
5377
5378 /* Caution: basic_ostream uses virtual inheritance.
5379  * All constructors have additional parameter that says if base class should be initialized.
5380  * Base class needs to be accessed using vbtable.
5381  */
5382 static inline basic_ios_char* basic_ostream_char_get_basic_ios(basic_ostream_char *this)
5383 {
5384     return (basic_ios_char*)((char*)this+this->vbtable[1]);
5385 }
5386
5387 static inline basic_ios_char* basic_ostream_char_to_basic_ios(basic_ostream_char *ptr)
5388 {
5389     return (basic_ios_char*)((char*)ptr+basic_ostream_char_vbtable[1]);
5390 }
5391
5392 static inline basic_ostream_char* basic_ostream_char_from_basic_ios(basic_ios_char *ptr)
5393 {
5394     return (basic_ostream_char*)((char*)ptr-basic_ostream_char_vbtable[1]);
5395 }
5396
5397 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5398 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5399 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor, 16)
5400 basic_ostream_char* __thiscall basic_ostream_char_ctor(basic_ostream_char *this,
5401         basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
5402 {
5403     basic_ios_char *base;
5404
5405     TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
5406
5407     if(virt_init) {
5408         this->vbtable = basic_ostream_char_vbtable;
5409         base = basic_ostream_char_get_basic_ios(this);
5410         basic_ios_char_ctor(base);
5411     }else {
5412         base = basic_ostream_char_get_basic_ios(this);
5413     }
5414
5415     base->base.vtable = &MSVCP_basic_ostream_char_vtable;
5416     basic_ios_char_init(base, strbuf, isstd);
5417     return this;
5418 }
5419
5420 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
5421 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
5422 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor_uninitialized, 16)
5423 basic_ostream_char* __thiscall basic_ostream_char_ctor_uninitialized(basic_ostream_char *this,
5424         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
5425 {
5426     basic_ios_char *base;
5427
5428     TRACE("(%p %d %x)\n", this, uninitialized, addstd);
5429
5430     if(virt_init) {
5431         this->vbtable = basic_ostream_char_vbtable;
5432         base = basic_ostream_char_get_basic_ios(this);
5433         basic_ios_char_ctor(base);
5434     }else {
5435         base = basic_ostream_char_get_basic_ios(this);
5436     }
5437
5438     base->base.vtable = &MSVCP_basic_ostream_char_vtable;
5439     if(addstd)
5440         ios_base_Addstd(&base->base);
5441     return this;
5442 }
5443
5444 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
5445 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
5446 DEFINE_THISCALL_WRAPPER(basic_ostream_char_dtor, 4)
5447 void __thiscall basic_ostream_char_dtor(basic_ios_char *base)
5448 {
5449     basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
5450
5451     /* don't destroy virtual base here */
5452     TRACE("(%p)\n", this);
5453 }
5454
5455 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5456 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5457 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vbase_dtor, 4)
5458 void __thiscall basic_ostream_char_vbase_dtor(basic_ostream_char *this)
5459 {
5460     TRACE("(%p)\n", this);
5461     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(this));
5462     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(this));
5463 }
5464
5465 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vector_dtor, 8)
5466 basic_ostream_char* __thiscall basic_ostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
5467 {
5468     basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
5469
5470     TRACE("(%p %x)\n", this, flags);
5471
5472     if(flags & 2) {
5473         /* we have an array, with the number of elements stored before the first object */
5474         INT_PTR i, *ptr = (INT_PTR *)this-1;
5475
5476         for(i=*ptr-1; i>=0; i--)
5477             basic_ostream_char_vbase_dtor(this+i);
5478         MSVCRT_operator_delete(ptr);
5479     } else {
5480         basic_ostream_char_vbase_dtor(this);
5481         if(flags & 1)
5482             MSVCRT_operator_delete(this);
5483     }
5484
5485     return this;
5486 }
5487
5488 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
5489 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
5490 DEFINE_THISCALL_WRAPPER(basic_ostream_char_flush, 4)
5491 basic_ostream_char* __thiscall basic_ostream_char_flush(basic_ostream_char *this)
5492 {
5493     /* this function is not matching C++ specification */
5494     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5495
5496     TRACE("(%p)\n", this);
5497
5498     if(basic_ios_char_rdbuf_get(base) && ios_base_good(&base->base)
5499             && basic_streambuf_char_pubsync(basic_ios_char_rdbuf_get(base))==-1)
5500         basic_ios_char_setstate(base, IOSTATE_badbit);
5501     return this;
5502 }
5503
5504 /* ?flush@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5505 /* ?flush@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5506 basic_ostream_char* __cdecl flush_ostream_char(basic_ostream_char *ostream)
5507 {
5508     return basic_ostream_char_flush(ostream);
5509 }
5510
5511 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5512 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5513 DEFINE_THISCALL_WRAPPER(basic_ostream_char__Osfx, 4)
5514 void __thiscall basic_ostream_char__Osfx(basic_ostream_char *this)
5515 {
5516     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5517
5518     TRACE("(%p)\n", this);
5519
5520     if(base->base.fmtfl & FMTFLAG_unitbuf)
5521         basic_ostream_char_flush(this);
5522 }
5523
5524 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5525 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5526 DEFINE_THISCALL_WRAPPER(basic_ostream_char_osfx, 4)
5527 void __thiscall basic_ostream_char_osfx(basic_ostream_char *this)
5528 {
5529     TRACE("(%p)\n", this);
5530     basic_ostream_char__Osfx(this);
5531 }
5532
5533 static BOOL basic_ostream_char_sentry_create(basic_ostream_char *ostr)
5534 {
5535     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5536
5537     if(basic_ios_char_rdbuf_get(base))
5538         basic_streambuf_char__Lock(base->strbuf);
5539
5540     if(ios_base_good(&base->base) && base->stream)
5541         basic_ostream_char_flush(base->stream);
5542
5543     return ios_base_good(&base->base);
5544 }
5545
5546 static void basic_ostream_char_sentry_destroy(basic_ostream_char *ostr)
5547 {
5548     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5549
5550     if(ios_base_good(&base->base) && !__uncaught_exception())
5551         basic_ostream_char_osfx(ostr);
5552
5553     if(basic_ios_char_rdbuf_get(base))
5554         basic_streambuf_char__Unlock(base->strbuf);
5555 }
5556
5557 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE_NXZ */
5558 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA_NXZ */
5559 DEFINE_THISCALL_WRAPPER(basic_ostream_char_opfx, 4)
5560 MSVCP_bool __thiscall basic_ostream_char_opfx(basic_ostream_char *this)
5561 {
5562     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5563
5564     TRACE("(%p)\n", this);
5565
5566     if(ios_base_good(&base->base) && base->stream)
5567         basic_ostream_char_flush(base->stream);
5568     return ios_base_good(&base->base);
5569 }
5570
5571 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
5572 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
5573 DEFINE_THISCALL_WRAPPER(basic_ostream_char_put, 8)
5574 basic_ostream_char* __thiscall basic_ostream_char_put(basic_ostream_char *this, char ch)
5575 {
5576     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5577
5578     TRACE("(%p %c)\n", this, ch);
5579
5580     if(!basic_ostream_char_sentry_create(this)
5581             || basic_streambuf_char_sputc(base->strbuf, ch)==EOF) {
5582         basic_ostream_char_sentry_destroy(this);
5583         basic_ios_char_setstate(base, IOSTATE_badbit);
5584         return this;
5585     }
5586
5587     basic_ostream_char_sentry_destroy(this);
5588     return this;
5589 }
5590
5591 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
5592 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
5593 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp, 12)
5594 basic_ostream_char* __thiscall basic_ostream_char_seekp(basic_ostream_char *this, streamoff off, int way)
5595 {
5596     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5597
5598     TRACE("(%p %ld %d)\n", this, off, way);
5599
5600     if(!ios_base_fail(&base->base)) {
5601         fpos_int seek;
5602
5603         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
5604                 &seek, off, way, OPENMODE_out);
5605         if(seek.off==0 && seek.pos==-1 && seek.state==0)
5606             basic_ios_char_setstate(base, IOSTATE_failbit);
5607     }
5608     return this;
5609 }
5610
5611 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
5612 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
5613 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp_fpos, 28)
5614 basic_ostream_char* __thiscall basic_ostream_char_seekp_fpos(basic_ostream_char *this, fpos_int pos)
5615 {
5616     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5617
5618     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
5619
5620     if(!ios_base_fail(&base->base)) {
5621         fpos_int seek;
5622
5623         basic_streambuf_char_pubseekpos(basic_ios_char_rdbuf_get(base),
5624                 &seek, pos, OPENMODE_out);
5625         if(seek.off==0 && seek.pos==-1 && seek.state==0)
5626             basic_ios_char_setstate(base, IOSTATE_failbit);
5627     }
5628     return this;
5629 }
5630
5631 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
5632 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
5633 DEFINE_THISCALL_WRAPPER(basic_ostream_char_tellp, 8)
5634 fpos_int* __thiscall basic_ostream_char_tellp(basic_ostream_char *this, fpos_int *ret)
5635 {
5636     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5637
5638     TRACE("(%p)\n", this);
5639
5640     if(!ios_base_fail(&base->base)) {
5641         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
5642                 ret, 0, SEEKDIR_cur, OPENMODE_out);
5643     }else {
5644         ret->off = 0;
5645         ret->pos = -1;
5646         ret->state = 0;
5647     }
5648     return ret;
5649 }
5650
5651 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@PBDH@Z */
5652 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEBD_J@Z */
5653 DEFINE_THISCALL_WRAPPER(basic_ostream_char_write, 12)
5654 basic_ostream_char* __thiscall basic_ostream_char_write(basic_ostream_char *this, const char *str, streamsize count)
5655 {
5656     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5657
5658     TRACE("(%p %s %ld)\n", this, debugstr_a(str), count);
5659
5660     if(!basic_ostream_char_sentry_create(this)
5661             || basic_streambuf_char_sputn(base->strbuf, str, count)!=count) {
5662         basic_ostream_char_sentry_destroy(this);
5663         basic_ios_char_setstate(base, IOSTATE_badbit);
5664         return this;
5665     }
5666
5667     basic_ostream_char_sentry_destroy(this);
5668     return this;
5669 }
5670
5671 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@F@Z */
5672 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@F@Z */
5673 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_short, 8)
5674 basic_ostream_char* __thiscall basic_ostream_char_print_short(basic_ostream_char *this, short val)
5675 {
5676     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5677     int state = IOSTATE_goodbit;
5678
5679     TRACE("(%p %d)\n", this, val);
5680
5681     if(basic_ostream_char_sentry_create(this)) {
5682         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5683         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5684         ostreambuf_iterator_char dest = {0, strbuf};
5685
5686         num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base),
5687                 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
5688                 ? (LONG)((unsigned short)val) : (LONG)val);
5689     }
5690     basic_ostream_char_sentry_destroy(this);
5691
5692     basic_ios_char_setstate(base, state);
5693     return this;
5694 }
5695
5696 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@G@Z */
5697 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@G@Z */
5698 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ushort, 8)
5699 basic_ostream_char* __thiscall basic_ostream_char_print_ushort(basic_ostream_char *this, unsigned short val)
5700 {
5701     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5702     int state = IOSTATE_goodbit;
5703
5704     TRACE("(%p %u)\n", this, val);
5705
5706     if(basic_ostream_char_sentry_create(this)) {
5707         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5708         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5709         ostreambuf_iterator_char dest = {0, strbuf};
5710
5711         num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5712     }
5713     basic_ostream_char_sentry_destroy(this);
5714
5715     basic_ios_char_setstate(base, state);
5716     return this;
5717 }
5718
5719 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z */
5720 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@H@Z */
5721 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@J@Z */
5722 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@J@Z */
5723 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int, 8)
5724 basic_ostream_char* __thiscall basic_ostream_char_print_int(basic_ostream_char *this, int val)
5725 {
5726     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5727     int state = IOSTATE_goodbit;
5728
5729     TRACE("(%p %d)\n", this, val);
5730
5731     if(basic_ostream_char_sentry_create(this)) {
5732         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5733         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5734         ostreambuf_iterator_char dest = {0, strbuf};
5735
5736         num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5737     }
5738     basic_ostream_char_sentry_destroy(this);
5739
5740     basic_ios_char_setstate(base, state);
5741     return this;
5742 }
5743
5744 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@I@Z */
5745 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@I@Z */
5746 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@K@Z */
5747 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@K@Z */
5748 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint, 8)
5749 basic_ostream_char* __thiscall basic_ostream_char_print_uint(basic_ostream_char *this, unsigned int val)
5750 {
5751     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5752     int state = IOSTATE_goodbit;
5753
5754     TRACE("(%p %u)\n", this, val);
5755
5756     if(basic_ostream_char_sentry_create(this)) {
5757         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5758         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5759         ostreambuf_iterator_char dest = {0, strbuf};
5760
5761         num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5762     }
5763     basic_ostream_char_sentry_destroy(this);
5764
5765     basic_ios_char_setstate(base, state);
5766     return this;
5767 }
5768
5769 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@M@Z */
5770 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@M@Z */
5771 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_float, 8)
5772 basic_ostream_char* __thiscall basic_ostream_char_print_float(basic_ostream_char *this, float val)
5773 {
5774     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5775     int state = IOSTATE_goodbit;
5776
5777     TRACE("(%p %f)\n", this, val);
5778
5779     if(basic_ostream_char_sentry_create(this)) {
5780         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5781         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5782         ostreambuf_iterator_char dest = {0, strbuf};
5783
5784         num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5785     }
5786     basic_ostream_char_sentry_destroy(this);
5787
5788     basic_ios_char_setstate(base, state);
5789     return this;
5790 }
5791
5792 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@N@Z */
5793 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@N@Z */
5794 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_double, 12)
5795 basic_ostream_char* __thiscall basic_ostream_char_print_double(basic_ostream_char *this, double val)
5796 {
5797     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5798     int state = IOSTATE_goodbit;
5799
5800     TRACE("(%p %lf)\n", this, val);
5801
5802     if(basic_ostream_char_sentry_create(this)) {
5803         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5804         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5805         ostreambuf_iterator_char dest = {0, strbuf};
5806
5807         num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5808     }
5809     basic_ostream_char_sentry_destroy(this);
5810
5811     basic_ios_char_setstate(base, state);
5812     return this;
5813 }
5814
5815 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@O@Z */
5816 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@O@Z */
5817 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ldouble, 12)
5818 basic_ostream_char* __thiscall basic_ostream_char_print_ldouble(basic_ostream_char *this, double val)
5819 {
5820     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5821     int state = IOSTATE_goodbit;
5822
5823     TRACE("(%p %lf)\n", this, val);
5824
5825     if(basic_ostream_char_sentry_create(this)) {
5826         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5827         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5828         ostreambuf_iterator_char dest = {0, strbuf};
5829
5830         num_put_char_put_ldouble(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5831     }
5832     basic_ostream_char_sentry_destroy(this);
5833
5834     basic_ios_char_setstate(base, state);
5835     return this;
5836 }
5837
5838 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
5839 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
5840 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_streambuf, 8)
5841 basic_ostream_char* __thiscall basic_ostream_char_print_streambuf(basic_ostream_char *this, basic_streambuf_char *val)
5842 {
5843     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5844     IOSB_iostate state = IOSTATE_badbit;
5845     int c = '\n';
5846
5847     TRACE("(%p %p)\n", this, val);
5848
5849     if(basic_ostream_char_sentry_create(this)) {
5850         for(c = basic_streambuf_char_sgetc(val); c!=EOF;
5851                 c = basic_streambuf_char_snextc(val)) {
5852             state = IOSTATE_goodbit;
5853
5854             if(basic_streambuf_char_sputc(base->strbuf, c) == EOF) {
5855                 state = IOSTATE_badbit;
5856                 break;
5857             }
5858         }
5859     }else {
5860         state = IOSTATE_badbit;
5861     }
5862     basic_ostream_char_sentry_destroy(this);
5863
5864     ios_base_width_set(&base->base, 0);
5865     basic_ios_char_setstate(base, state);
5866     return this;
5867 }
5868
5869 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PBX@Z */
5870 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z */
5871 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ptr, 8)
5872 basic_ostream_char* __thiscall basic_ostream_char_print_ptr(basic_ostream_char *this, const void *val)
5873 {
5874     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5875     int state = IOSTATE_goodbit;
5876
5877     TRACE("(%p %p)\n", this, val);
5878
5879     if(basic_ostream_char_sentry_create(this)) {
5880         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5881         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5882         ostreambuf_iterator_char dest = {0, strbuf};
5883
5884         num_put_char_put_ptr(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5885     }
5886     basic_ostream_char_sentry_destroy(this);
5887
5888     basic_ios_char_setstate(base, state);
5889     return this;
5890 }
5891
5892 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_J@Z */
5893 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_J@Z */
5894 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int64, 12)
5895 basic_ostream_char* __thiscall basic_ostream_char_print_int64(basic_ostream_char *this, __int64 val)
5896 {
5897     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5898     int state = IOSTATE_goodbit;
5899
5900     TRACE("(%p)\n", this);
5901
5902     if(basic_ostream_char_sentry_create(this)) {
5903         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5904         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5905         ostreambuf_iterator_char dest = {0, strbuf};
5906
5907         num_put_char_put_int64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5908     }
5909     basic_ostream_char_sentry_destroy(this);
5910
5911     basic_ios_char_setstate(base, state);
5912     return this;
5913 }
5914
5915 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_K@Z */
5916 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_K@Z */
5917 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint64, 12)
5918 basic_ostream_char* __thiscall basic_ostream_char_print_uint64(basic_ostream_char *this, unsigned __int64 val)
5919 {
5920     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5921     int state = IOSTATE_goodbit;
5922
5923     TRACE("(%p)\n", this);
5924
5925     if(basic_ostream_char_sentry_create(this)) {
5926         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5927         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5928         ostreambuf_iterator_char dest = {0, strbuf};
5929
5930         num_put_char_put_uint64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5931     }
5932     basic_ostream_char_sentry_destroy(this);
5933
5934     basic_ios_char_setstate(base, state);
5935     return this;
5936 }
5937
5938 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_N@Z */
5939 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_N@Z */
5940 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_bool, 8)
5941 basic_ostream_char* __thiscall basic_ostream_char_print_bool(basic_ostream_char *this, MSVCP_bool val)
5942 {
5943     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5944     int state = IOSTATE_goodbit;
5945
5946     TRACE("(%p %x)\n", this, val);
5947
5948     if(basic_ostream_char_sentry_create(this)) {
5949         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5950         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5951         ostreambuf_iterator_char dest = {0, strbuf};
5952
5953         num_put_char_put_bool(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5954     }
5955     basic_ostream_char_sentry_destroy(this);
5956
5957     basic_ios_char_setstate(base, state);
5958     return this;
5959 }
5960
5961 /* ?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5962 /* ?endl@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5963 basic_ostream_char* __cdecl basic_ostream_char_endl(basic_ostream_char *ostr)
5964 {
5965     TRACE("(%p)\n", ostr);
5966
5967     basic_ostream_char_put(ostr, '\n');
5968     basic_ostream_char_flush(ostr);
5969     return ostr;
5970 }
5971
5972 /* $?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 */
5973 /* ??$?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 */
5974 basic_ostream_char* __cdecl basic_ostream_char_print_bstr(basic_ostream_char *ostr, const basic_string_char *str)
5975 {
5976     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5977     IOSB_iostate state = IOSTATE_goodbit;
5978
5979     TRACE("(%p %p)\n", ostr, str);
5980
5981     if(basic_ostream_char_sentry_create(ostr)) {
5982         MSVCP_size_t len = MSVCP_basic_string_char_length(str);
5983         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
5984
5985         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
5986             for(; pad!=0; pad--) {
5987                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
5988                     state = IOSTATE_badbit;
5989                     break;
5990                 }
5991             }
5992         }
5993
5994         if(state == IOSTATE_goodbit) {
5995             if(basic_streambuf_char_sputn(base->strbuf, MSVCP_basic_string_char_c_str(str), len) != len)
5996                     state = IOSTATE_badbit;
5997         }
5998
5999         if(state == IOSTATE_goodbit) {
6000             for(; pad!=0; pad--) {
6001                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6002                     state = IOSTATE_badbit;
6003                     break;
6004                 }
6005             }
6006         }
6007
6008         base->base.wide = 0;
6009     }else {
6010         state = IOSTATE_badbit;
6011     }
6012     basic_ostream_char_sentry_destroy(ostr);
6013
6014     basic_ios_char_setstate(base, state);
6015     return ostr;
6016 }
6017
6018 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@C@Z */
6019 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@C@Z */
6020 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@D@Z */
6021 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z */
6022 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@E@Z */
6023 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@E@Z */
6024 basic_ostream_char* __cdecl basic_ostream_char_print_ch(basic_ostream_char *ostr, char ch)
6025 {
6026     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
6027     IOSB_iostate state = IOSTATE_goodbit;
6028
6029     TRACE("(%p %d)\n", ostr, ch);
6030
6031     if(basic_ostream_char_sentry_create(ostr)) {
6032         streamsize pad = (base->base.wide>1 ? base->base.wide-1 : 0);
6033
6034         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6035             for(; pad!=0; pad--) {
6036                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6037                     state = IOSTATE_badbit;
6038                     break;
6039                 }
6040             }
6041         }
6042
6043         if(state == IOSTATE_goodbit) {
6044             if(basic_streambuf_char_sputc(base->strbuf, ch) == EOF)
6045                 state = IOSTATE_badbit;
6046         }
6047
6048         if(state == IOSTATE_goodbit) {
6049             for(; pad!=0; pad--) {
6050                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6051                     state = IOSTATE_badbit;
6052                     break;
6053                 }
6054             }
6055         }
6056
6057         base->base.wide = 0;
6058     }else {
6059         state = IOSTATE_badbit;
6060     }
6061     basic_ostream_char_sentry_destroy(ostr);
6062
6063     basic_ios_char_setstate(base, state);
6064     return ostr;
6065 }
6066
6067 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBC@Z */
6068 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBC@Z */
6069 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z */
6070 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z */
6071 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBE@Z */
6072 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBE@Z */
6073 basic_ostream_char* __cdecl basic_ostream_char_print_str(basic_ostream_char *ostr, const char *str)
6074 {
6075     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
6076     IOSB_iostate state = IOSTATE_goodbit;
6077
6078     TRACE("(%p %s)\n", ostr, str);
6079
6080     if(basic_ostream_char_sentry_create(ostr)) {
6081         MSVCP_size_t len = strlen(str);
6082         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6083
6084         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6085             for(; pad!=0; pad--) {
6086                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6087                     state = IOSTATE_badbit;
6088                     break;
6089                 }
6090             }
6091         }
6092
6093         if(state == IOSTATE_goodbit) {
6094             if(basic_streambuf_char_sputn(base->strbuf, str, len) != len)
6095                 state = IOSTATE_badbit;
6096         }
6097
6098         if(state == IOSTATE_goodbit) {
6099             for(; pad!=0; pad--) {
6100                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6101                     state = IOSTATE_badbit;
6102                     break;
6103                 }
6104             }
6105         }
6106
6107         base->base.wide = 0;
6108     }else {
6109         state = IOSTATE_badbit;
6110     }
6111     basic_ostream_char_sentry_destroy(ostr);
6112
6113     basic_ios_char_setstate(base, state);
6114     return ostr;
6115 }
6116
6117 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
6118 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
6119 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func, 8)
6120 basic_ostream_char* __thiscall basic_ostream_char_print_func(basic_ostream_char *this,
6121         basic_ostream_char* (__cdecl *pfunc)(basic_ostream_char*))
6122 {
6123     TRACE("(%p %p)\n", this, pfunc);
6124     pfunc(this);
6125     return this;
6126 }
6127
6128 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
6129 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
6130 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_basic_ios, 8)
6131 basic_ostream_char* __thiscall basic_ostream_char_print_func_basic_ios(basic_ostream_char *this,
6132         basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
6133 {
6134     TRACE("(%p %p)\n", this, pfunc);
6135     pfunc(basic_ostream_char_get_basic_ios(this));
6136     return this;
6137 }
6138
6139 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
6140 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
6141 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_ios_base, 8)
6142 basic_ostream_char* __thiscall basic_ostream_char_print_func_ios_base(
6143         basic_ostream_char *this, ios_base* (__cdecl *pfunc)(ios_base*))
6144 {
6145     TRACE("(%p %p)\n", this, pfunc);
6146     pfunc(&basic_ostream_char_get_basic_ios(this)->base);
6147     return this;
6148 }
6149
6150 /* Caution: basic_ostream uses virtual inheritance. */
6151 static inline basic_ios_wchar* basic_ostream_wchar_get_basic_ios(basic_ostream_wchar *this)
6152 {
6153     return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
6154 }
6155
6156 static inline basic_ios_wchar* basic_ostream_wchar_to_basic_ios(basic_ostream_wchar *ptr)
6157 {
6158     return (basic_ios_wchar*)((char*)ptr+basic_ostream_wchar_vbtable[1]);
6159 }
6160
6161 static inline basic_ostream_wchar* basic_ostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
6162 {
6163     return (basic_ostream_wchar*)((char*)ptr-basic_ostream_wchar_vbtable[1]);
6164 }
6165
6166 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6167 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6168 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor, 16)
6169 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor(basic_ostream_wchar *this,
6170         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6171 {
6172     basic_ios_wchar *base;
6173
6174     TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
6175
6176     if(virt_init) {
6177         this->vbtable = basic_ostream_wchar_vbtable;
6178         base = basic_ostream_wchar_get_basic_ios(this);
6179         basic_ios_wchar_ctor(base);
6180     }else {
6181         base = basic_ostream_wchar_get_basic_ios(this);
6182     }
6183
6184     base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
6185     basic_ios_wchar_init(base, strbuf, isstd);
6186     return this;
6187 }
6188
6189 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6190 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6191 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor, 16)
6192 basic_ostream_wchar* __thiscall basic_ostream_short_ctor(basic_ostream_wchar *this,
6193         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6194 {
6195     basic_ostream_wchar_ctor(this, strbuf, isstd, virt_init);
6196     basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
6197     return this;
6198 }
6199
6200 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
6201 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
6202 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor_uninitialized, 16)
6203 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor_uninitialized(basic_ostream_wchar *this,
6204         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
6205 {
6206     basic_ios_wchar *base;
6207
6208     TRACE("(%p %d %x)\n", this, uninitialized, addstd);
6209
6210     if(virt_init) {
6211         this->vbtable = basic_ostream_wchar_vbtable;
6212         base = basic_ostream_wchar_get_basic_ios(this);
6213         basic_ios_wchar_ctor(base);
6214     }else {
6215         base = basic_ostream_wchar_get_basic_ios(this);
6216     }
6217
6218     base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
6219     if(addstd)
6220         ios_base_Addstd(&base->base);
6221     return this;
6222 }
6223
6224 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
6225 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
6226 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor_uninitialized, 16)
6227 basic_ostream_wchar* __thiscall basic_ostream_short_ctor_uninitialized(basic_ostream_wchar *this,
6228         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
6229 {
6230     basic_ostream_wchar_ctor_uninitialized(this, uninitialized, addstd, virt_init);
6231     basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
6232     return this;
6233 }
6234
6235 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
6236 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
6237 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
6238 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
6239 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_dtor, 4)
6240 void __thiscall basic_ostream_wchar_dtor(basic_ios_wchar *base)
6241 {
6242     basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
6243
6244     /* don't destroy virtual base here */
6245     TRACE("(%p)\n", this);
6246 }
6247
6248 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6249 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6250 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6251 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6252 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vbase_dtor, 4)
6253 void __thiscall basic_ostream_wchar_vbase_dtor(basic_ostream_wchar *this)
6254 {
6255     TRACE("(%p)\n", this);
6256     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(this));
6257     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(this));
6258 }
6259
6260 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vector_dtor, 8)
6261 basic_ostream_wchar* __thiscall basic_ostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
6262 {
6263     basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
6264
6265     TRACE("(%p %x)\n", this, flags);
6266
6267     if(flags & 2) {
6268         /* we have an array, with the number of elements stored before the first object */
6269         INT_PTR i, *ptr = (INT_PTR *)this-1;
6270
6271         for(i=*ptr-1; i>=0; i--)
6272             basic_ostream_wchar_vbase_dtor(this+i);
6273         MSVCRT_operator_delete(ptr);
6274     } else {
6275         basic_ostream_wchar_vbase_dtor(this);
6276         if(flags & 1)
6277             MSVCRT_operator_delete(this);
6278     }
6279
6280     return this;
6281 }
6282
6283 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
6284 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
6285 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
6286 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
6287 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_flush, 4)
6288 basic_ostream_wchar* __thiscall basic_ostream_wchar_flush(basic_ostream_wchar *this)
6289 {
6290     /* this function is not matching C++ specification */
6291     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6292
6293     TRACE("(%p)\n", this);
6294
6295     if(basic_ios_wchar_rdbuf_get(base) && ios_base_good(&base->base)
6296             && basic_streambuf_wchar_pubsync(basic_ios_wchar_rdbuf_get(base))==-1)
6297         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6298     return this;
6299 }
6300
6301 /* ?flush@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6302 /* ?flush@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6303 /* ?flush@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6304 /* ?flush@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6305 basic_ostream_wchar* __cdecl flush_ostream_wchar(basic_ostream_wchar *ostream)
6306 {
6307     return basic_ostream_wchar_flush(ostream);
6308 }
6309
6310 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6311 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6312 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6313 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6314 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar__Osfx, 4)
6315 void __thiscall basic_ostream_wchar__Osfx(basic_ostream_wchar *this)
6316 {
6317     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6318
6319     TRACE("(%p)\n", this);
6320
6321     if(base->base.fmtfl & FMTFLAG_unitbuf)
6322         basic_ostream_wchar_flush(this);
6323 }
6324
6325 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6326 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6327 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6328 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6329 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_osfx, 4)
6330 void __thiscall basic_ostream_wchar_osfx(basic_ostream_wchar *this)
6331 {
6332     TRACE("(%p)\n", this);
6333     basic_ostream_wchar__Osfx(this);
6334 }
6335
6336 static BOOL basic_ostream_wchar_sentry_create(basic_ostream_wchar *ostr)
6337 {
6338     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6339
6340     if(basic_ios_wchar_rdbuf_get(base))
6341         basic_streambuf_wchar__Lock(base->strbuf);
6342
6343     if(ios_base_good(&base->base) && base->stream)
6344         basic_ostream_wchar_flush(base->stream);
6345
6346     return ios_base_good(&base->base);
6347 }
6348
6349 static void basic_ostream_wchar_sentry_destroy(basic_ostream_wchar *ostr)
6350 {
6351     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6352
6353     if(ios_base_good(&base->base) && !__uncaught_exception())
6354         basic_ostream_wchar_osfx(ostr);
6355
6356     if(basic_ios_wchar_rdbuf_get(base))
6357         basic_streambuf_wchar__Unlock(base->strbuf);
6358 }
6359
6360 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE_NXZ */
6361 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA_NXZ */
6362 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE_NXZ */
6363 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA_NXZ */
6364 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_opfx, 4)
6365 MSVCP_bool __thiscall basic_ostream_wchar_opfx(basic_ostream_wchar *this)
6366 {
6367     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6368
6369     TRACE("(%p)\n", this);
6370
6371     if(ios_base_good(&base->base) && base->stream)
6372         basic_ostream_wchar_flush(base->stream);
6373     return ios_base_good(&base->base);
6374 }
6375
6376 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
6377 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
6378 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
6379 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
6380 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_put, 8)
6381 basic_ostream_wchar* __thiscall basic_ostream_wchar_put(basic_ostream_wchar *this, wchar_t ch)
6382 {
6383     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6384
6385     TRACE("(%p %c)\n", this, ch);
6386
6387     if(!basic_ostream_wchar_sentry_create(this)
6388             || basic_streambuf_wchar_sputc(base->strbuf, ch)==WEOF) {
6389         basic_ostream_wchar_sentry_destroy(this);
6390         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6391         return this;
6392     }
6393
6394     basic_ostream_wchar_sentry_destroy(this);
6395     return this;
6396 }
6397
6398 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
6399 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
6400 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
6401 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
6402 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp, 12)
6403 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp(basic_ostream_wchar *this, streamoff off, int way)
6404 {
6405     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6406
6407     TRACE("(%p %ld %d)\n", this, off, way);
6408
6409     if(!ios_base_fail(&base->base)) {
6410         fpos_int seek;
6411
6412         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
6413                 &seek, off, way, OPENMODE_out);
6414         if(seek.off==0 && seek.pos==-1 && seek.state==0)
6415             basic_ios_wchar_setstate(base, IOSTATE_failbit);
6416     }
6417     return this;
6418 }
6419
6420 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6421 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6422 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6423 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6424 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp_fpos, 28)
6425 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp_fpos(basic_ostream_wchar *this, fpos_int pos)
6426 {
6427     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6428
6429     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
6430
6431     if(!ios_base_fail(&base->base)) {
6432         fpos_int seek;
6433
6434         basic_streambuf_wchar_pubseekpos(basic_ios_wchar_rdbuf_get(base),
6435                 &seek, pos, OPENMODE_out);
6436         if(seek.off==0 && seek.pos==-1 && seek.state==0)
6437             basic_ios_wchar_setstate(base, IOSTATE_failbit);
6438     }
6439     return this;
6440 }
6441
6442 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6443 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6444 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6445 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6446 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_tellp, 8)
6447 fpos_int* __thiscall basic_ostream_wchar_tellp(basic_ostream_wchar *this, fpos_int *ret)
6448 {
6449     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6450
6451     TRACE("(%p)\n", this);
6452
6453     if(!ios_base_fail(&base->base)) {
6454         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
6455                 ret, 0, SEEKDIR_cur, OPENMODE_out);
6456     }else {
6457         ret->off = 0;
6458         ret->pos = -1;
6459         ret->state = 0;
6460     }
6461     return ret;
6462 }
6463
6464 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PB_WH@Z */
6465 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEB_W_J@Z */
6466 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@PBGH@Z */
6467 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEBG_J@Z */
6468 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_write, 12)
6469 basic_ostream_wchar* __thiscall basic_ostream_wchar_write(basic_ostream_wchar *this, const wchar_t *str, streamsize count)
6470 {
6471     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6472
6473     TRACE("(%p %s %ld)\n", this, debugstr_w(str), count);
6474
6475     if(!basic_ostream_wchar_sentry_create(this)
6476             || basic_streambuf_wchar_sputn(base->strbuf, str, count)!=count) {
6477         basic_ostream_wchar_sentry_destroy(this);
6478         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6479         return this;
6480     }
6481
6482     basic_ostream_wchar_sentry_destroy(this);
6483     return this;
6484 }
6485
6486 static basic_ostream_wchar* basic_ostream_print_short(basic_ostream_wchar *this, short val, const num_put *numput)
6487 {
6488     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6489     int state = IOSTATE_goodbit;
6490
6491     TRACE("(%p %d)\n", this, val);
6492
6493     if(basic_ostream_wchar_sentry_create(this)) {
6494         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6495         ostreambuf_iterator_wchar dest = {0, strbuf};
6496
6497         num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base),
6498                 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
6499                 ? (LONG)((unsigned short)val) : (LONG)val);
6500     }
6501     basic_ostream_wchar_sentry_destroy(this);
6502
6503     basic_ios_wchar_setstate(base, state);
6504     return this;
6505 }
6506
6507 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@F@Z */
6508 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@F@Z */
6509 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_short, 8)
6510 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_short(basic_ostream_wchar *this, short val)
6511 {
6512     return basic_ostream_print_short(this, val, num_put_wchar_use_facet(
6513                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6514 }
6515
6516 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@F@Z */
6517 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@F@Z */
6518 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_short, 8)
6519 basic_ostream_wchar* __thiscall basic_ostream_short_print_short(basic_ostream_wchar *this, short val)
6520 {
6521     return basic_ostream_print_short(this, val, num_put_short_use_facet(
6522                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6523 }
6524
6525 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@G@Z */
6526 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@G@Z */
6527 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ushort, 8)
6528 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ushort(basic_ostream_wchar *this, unsigned short val)
6529 {
6530     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6531     int state = IOSTATE_goodbit;
6532
6533     TRACE("(%p %u)\n", this, val);
6534
6535     if(basic_ostream_wchar_sentry_create(this)) {
6536         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6537         const num_put *numput = num_put_wchar_use_facet(strbuf->loc);
6538         ostreambuf_iterator_wchar dest = {0, strbuf};
6539
6540         num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6541     }
6542     basic_ostream_wchar_sentry_destroy(this);
6543
6544     basic_ios_wchar_setstate(base, state);
6545     return this;
6546 }
6547
6548 static basic_ostream_wchar* basic_ostream_print_int(basic_ostream_wchar *this, int val, const num_put *numput)
6549 {
6550     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6551     int state = IOSTATE_goodbit;
6552
6553     TRACE("(%p %d)\n", this, val);
6554
6555     if(basic_ostream_wchar_sentry_create(this)) {
6556         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6557         ostreambuf_iterator_wchar dest = {0, strbuf};
6558
6559         num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6560     }
6561     basic_ostream_wchar_sentry_destroy(this);
6562
6563     basic_ios_wchar_setstate(base, state);
6564     return this;
6565 }
6566
6567 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@H@Z */
6568 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@H@Z */
6569 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@J@Z */
6570 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@J@Z */
6571 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int, 8)
6572 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int(basic_ostream_wchar *this, int val)
6573 {
6574     return basic_ostream_print_int(this, val, num_put_wchar_use_facet(
6575                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6576 }
6577
6578 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@H@Z */
6579 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@H@Z */
6580 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@J@Z */
6581 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@J@Z */
6582 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int, 8)
6583 basic_ostream_wchar* __thiscall basic_ostream_short_print_int(basic_ostream_wchar *this, int val)
6584 {
6585     return basic_ostream_print_int(this, val, num_put_short_use_facet(
6586                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6587 }
6588
6589 static basic_ostream_wchar* basic_ostream_print_uint(basic_ostream_wchar *this, unsigned int val, const num_put *numput)
6590 {
6591     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6592     int state = IOSTATE_goodbit;
6593
6594     TRACE("(%p %u)\n", this, val);
6595
6596     if(basic_ostream_wchar_sentry_create(this)) {
6597         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6598         ostreambuf_iterator_wchar dest = {0, strbuf};
6599
6600         num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6601     }
6602     basic_ostream_wchar_sentry_destroy(this);
6603
6604     basic_ios_wchar_setstate(base, state);
6605     return this;
6606 }
6607
6608 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@I@Z */
6609 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@I@Z */
6610 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@K@Z */
6611 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@K@Z */
6612 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint, 8)
6613 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint(basic_ostream_wchar *this, unsigned int val)
6614 {
6615     return basic_ostream_print_uint(this, val, num_put_wchar_use_facet(
6616                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6617 }
6618
6619 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@I@Z */
6620 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@I@Z */
6621 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@K@Z */
6622 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@K@Z */
6623 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint, 8)
6624 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint(basic_ostream_wchar *this, unsigned int val)
6625 {
6626     return basic_ostream_print_uint(this, val, num_put_short_use_facet(
6627                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6628 }
6629
6630 static basic_ostream_wchar* basic_ostream_print_float(basic_ostream_wchar *this, float val, const num_put *numput)
6631 {
6632     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6633     int state = IOSTATE_goodbit;
6634
6635     TRACE("(%p %f)\n", this, val);
6636
6637     if(basic_ostream_wchar_sentry_create(this)) {
6638         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6639         ostreambuf_iterator_wchar dest = {0, strbuf};
6640
6641         num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6642     }
6643     basic_ostream_wchar_sentry_destroy(this);
6644
6645     basic_ios_wchar_setstate(base, state);
6646     return this;
6647 }
6648
6649 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@M@Z */
6650 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@M@Z */
6651 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_float, 8)
6652 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_float(basic_ostream_wchar *this, float val)
6653 {
6654     return basic_ostream_print_float(this, val, num_put_wchar_use_facet(
6655                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6656 }
6657
6658 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@M@Z */
6659 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@M@Z */
6660 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_float, 8)
6661 basic_ostream_wchar* __thiscall basic_ostream_short_print_float(basic_ostream_wchar *this, float val)
6662 {
6663     return basic_ostream_print_float(this, val, num_put_short_use_facet(
6664                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6665 }
6666
6667 static basic_ostream_wchar* basic_ostream_print_double(basic_ostream_wchar *this, double val, const num_put *numput)
6668 {
6669     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6670     int state = IOSTATE_goodbit;
6671
6672     TRACE("(%p %lf)\n", this, val);
6673
6674     if(basic_ostream_wchar_sentry_create(this)) {
6675         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6676         ostreambuf_iterator_wchar dest = {0, strbuf};
6677
6678         num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6679     }
6680     basic_ostream_wchar_sentry_destroy(this);
6681
6682     basic_ios_wchar_setstate(base, state);
6683     return this;
6684 }
6685
6686 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@N@Z */
6687 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@N@Z */
6688 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_double, 12)
6689 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_double(basic_ostream_wchar *this, double val)
6690 {
6691     return basic_ostream_print_double(this, val, num_put_wchar_use_facet(
6692                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6693 }
6694
6695 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@N@Z */
6696 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@N@Z */
6697 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_double, 12)
6698 basic_ostream_wchar* __thiscall basic_ostream_short_print_double(basic_ostream_wchar *this, double val)
6699 {
6700     return basic_ostream_print_double(this, val, num_put_short_use_facet(
6701                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6702 }
6703
6704 static basic_ostream_wchar* basic_ostream_print_ldouble(basic_ostream_wchar *this, double val, const num_put *numput)
6705 {
6706     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6707     int state = IOSTATE_goodbit;
6708
6709     TRACE("(%p %lf)\n", this, val);
6710
6711     if(basic_ostream_wchar_sentry_create(this)) {
6712         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6713         ostreambuf_iterator_wchar dest = {0, strbuf};
6714
6715         num_put_wchar_put_ldouble(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6716     }
6717     basic_ostream_wchar_sentry_destroy(this);
6718
6719     basic_ios_wchar_setstate(base, state);
6720     return this;
6721 }
6722
6723 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@O@Z */
6724 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@O@Z */
6725 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ldouble, 12)
6726 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ldouble(basic_ostream_wchar *this, double val)
6727 {
6728     return basic_ostream_print_ldouble(this, val, num_put_wchar_use_facet(
6729                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6730 }
6731
6732 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@O@Z */
6733 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@O@Z */
6734 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ldouble, 12)
6735 basic_ostream_wchar* __thiscall basic_ostream_short_print_ldouble(basic_ostream_wchar *this, double val)
6736 {
6737     return basic_ostream_print_ldouble(this, val, num_put_short_use_facet(
6738                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6739 }
6740
6741 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
6742 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
6743 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
6744 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
6745 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_streambuf, 8)
6746 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_streambuf(basic_ostream_wchar *this, basic_streambuf_wchar *val)
6747 {
6748     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6749     IOSB_iostate state = IOSTATE_badbit;
6750     unsigned short c = '\n';
6751
6752     TRACE("(%p %p)\n", this, val);
6753
6754     if(basic_ostream_wchar_sentry_create(this)) {
6755         for(c = basic_streambuf_wchar_sgetc(val); c!=WEOF;
6756                 c = basic_streambuf_wchar_snextc(val)) {
6757             state = IOSTATE_goodbit;
6758
6759             if(basic_streambuf_wchar_sputc(base->strbuf, c) == WEOF) {
6760                 state = IOSTATE_badbit;
6761                 break;
6762             }
6763         }
6764     }else {
6765         state = IOSTATE_badbit;
6766     }
6767     basic_ostream_wchar_sentry_destroy(this);
6768
6769     ios_base_width_set(&base->base, 0);
6770     basic_ios_wchar_setstate(base, state);
6771     return this;
6772 }
6773
6774 static basic_ostream_wchar* basic_ostream_print_ptr(basic_ostream_wchar *this, const void *val, const num_put *numput)
6775 {
6776     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6777     int state = IOSTATE_goodbit;
6778
6779     TRACE("(%p %p)\n", this, val);
6780
6781     if(basic_ostream_wchar_sentry_create(this)) {
6782         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6783         ostreambuf_iterator_wchar dest = {0, strbuf};
6784
6785         num_put_wchar_put_ptr(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6786     }
6787     basic_ostream_wchar_sentry_destroy(this);
6788
6789     basic_ios_wchar_setstate(base, state);
6790     return this;
6791 }
6792
6793 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PBX@Z */
6794 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEBX@Z */
6795 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ptr, 8)
6796 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ptr(basic_ostream_wchar *this, const void *val)
6797 {
6798     return basic_ostream_print_ptr(this, val, num_put_wchar_use_facet(
6799                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6800 }
6801
6802 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z */
6803 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEBX@Z */
6804 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ptr, 8)
6805 basic_ostream_wchar* __thiscall basic_ostream_short_print_ptr(basic_ostream_wchar *this, const void *val)
6806 {
6807     return basic_ostream_print_ptr(this, val, num_put_short_use_facet(
6808                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6809 }
6810
6811 static basic_ostream_wchar* basic_ostream_print_int64(basic_ostream_wchar *this, __int64 val, const num_put *numput)
6812 {
6813     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6814     int state = IOSTATE_goodbit;
6815
6816     TRACE("(%p)\n", this);
6817
6818     if(basic_ostream_wchar_sentry_create(this)) {
6819         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6820         ostreambuf_iterator_wchar dest = {0, strbuf};
6821
6822         num_put_wchar_put_int64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6823     }
6824     basic_ostream_wchar_sentry_destroy(this);
6825
6826     basic_ios_wchar_setstate(base, state);
6827     return this;
6828 }
6829
6830 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_J@Z */
6831 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_J@Z */
6832 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int64, 12)
6833 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int64(basic_ostream_wchar *this, __int64 val)
6834 {
6835     return basic_ostream_print_int64(this, val, num_put_wchar_use_facet(
6836                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6837 }
6838
6839 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_J@Z */
6840 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_J@Z */
6841 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int64, 12)
6842 basic_ostream_wchar* __thiscall basic_ostream_short_print_int64(basic_ostream_wchar *this, __int64 val)
6843 {
6844     return basic_ostream_print_int64(this, val, num_put_short_use_facet(
6845                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6846 }
6847
6848 static basic_ostream_wchar* basic_ostream_print_uint64(basic_ostream_wchar *this, unsigned __int64 val, const num_put *numput)
6849 {
6850     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6851     int state = IOSTATE_goodbit;
6852
6853     TRACE("(%p)\n", this);
6854
6855     if(basic_ostream_wchar_sentry_create(this)) {
6856         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6857         ostreambuf_iterator_wchar dest = {0, strbuf};
6858
6859         num_put_wchar_put_uint64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6860     }
6861     basic_ostream_wchar_sentry_destroy(this);
6862
6863     basic_ios_wchar_setstate(base, state);
6864     return this;
6865 }
6866
6867 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_K@Z */
6868 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_K@Z */
6869 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint64, 12)
6870 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
6871 {
6872     return basic_ostream_print_uint64(this, val, num_put_wchar_use_facet(
6873                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6874 }
6875
6876 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_K@Z */
6877 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_K@Z */
6878 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint64, 12)
6879 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
6880 {
6881     return basic_ostream_print_uint64(this, val, num_put_short_use_facet(
6882                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6883 }
6884
6885 static basic_ostream_wchar* basic_ostream_print_bool(basic_ostream_wchar *this, MSVCP_bool val, const num_put *numput)
6886 {
6887     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6888     int state = IOSTATE_goodbit;
6889
6890     TRACE("(%p %x)\n", this, val);
6891
6892     if(basic_ostream_wchar_sentry_create(this)) {
6893         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6894         ostreambuf_iterator_wchar dest = {0, strbuf};
6895
6896         num_put_wchar_put_bool(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6897     }
6898     basic_ostream_wchar_sentry_destroy(this);
6899
6900     basic_ios_wchar_setstate(base, state);
6901     return this;
6902 }
6903
6904 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_N@Z */
6905 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_N@Z */
6906 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_bool, 8)
6907 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
6908 {
6909     return basic_ostream_print_bool(this, val, num_put_wchar_use_facet(
6910                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6911 }
6912
6913 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_N@Z */
6914 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_N@Z */
6915 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_bool, 8)
6916 basic_ostream_wchar* __thiscall basic_ostream_short_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
6917 {
6918     return basic_ostream_print_bool(this, val, num_put_short_use_facet(
6919                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6920 }
6921
6922 /* ?endl@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6923 /* ?endl@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6924 /* ?endl@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6925 /* ?endl@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6926 basic_ostream_wchar* __cdecl basic_ostream_wchar_endl(basic_ostream_wchar *ostr)
6927 {
6928     TRACE("(%p)\n", ostr);
6929
6930     basic_ostream_wchar_put(ostr, '\n');
6931     basic_ostream_wchar_flush(ostr);
6932     return ostr;
6933 }
6934
6935 /* ??$?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 */
6936 /* ??$?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 */
6937 /* ??$?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 */
6938 /* ??$?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 */
6939 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_bstr(basic_ostream_wchar *ostr, const basic_string_wchar *str)
6940 {
6941     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6942     IOSB_iostate state = IOSTATE_goodbit;
6943
6944     TRACE("(%p %p)\n", ostr, str);
6945
6946     if(basic_ostream_wchar_sentry_create(ostr)) {
6947         MSVCP_size_t len = MSVCP_basic_string_wchar_length(str);
6948         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6949
6950         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6951             for(; pad!=0; pad--) {
6952                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6953                     state = IOSTATE_badbit;
6954                     break;
6955                 }
6956             }
6957         }
6958
6959         if(state == IOSTATE_goodbit) {
6960             if(basic_streambuf_wchar_sputn(base->strbuf, MSVCP_basic_string_wchar_c_str(str), len) != len)
6961                 state = IOSTATE_badbit;
6962         }
6963
6964         if(state == IOSTATE_goodbit) {
6965             for(; pad!=0; pad--) {
6966                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6967                     state = IOSTATE_badbit;
6968                     break;
6969                 }
6970             }
6971         }
6972
6973         base->base.wide = 0;
6974     }else {
6975         state = IOSTATE_badbit;
6976     }
6977     basic_ostream_wchar_sentry_destroy(ostr);
6978
6979     basic_ios_wchar_setstate(base, state);
6980     return ostr;
6981 }
6982
6983 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@_W@Z */
6984 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@_W@Z */
6985 /* ??$?6GU?$char_traits@G@std@@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@G@Z */
6986 /* ??$?6GU?$char_traits@G@std@@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@G@Z */
6987 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_ch(basic_ostream_wchar *ostr, wchar_t ch)
6988 {
6989     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6990     IOSB_iostate state = IOSTATE_goodbit;
6991
6992     TRACE("(%p %d)\n", ostr, ch);
6993
6994     if(basic_ostream_wchar_sentry_create(ostr)) {
6995         streamsize pad = (base->base.wide>1 ? base->base.wide-1 : 0);
6996
6997         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6998             for(; pad!=0; pad--) {
6999                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7000                     state = IOSTATE_badbit;
7001                     break;
7002                 }
7003             }
7004         }
7005
7006         if(state == IOSTATE_goodbit) {
7007             if(basic_streambuf_wchar_sputc(base->strbuf, ch) == WEOF)
7008                 state = IOSTATE_badbit;
7009         }
7010
7011         if(state == IOSTATE_goodbit) {
7012             for(; pad!=0; pad--) {
7013                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7014                     state = IOSTATE_badbit;
7015                     break;
7016                 }
7017             }
7018         }
7019
7020         base->base.wide = 0;
7021     }else {
7022         state = IOSTATE_badbit;
7023     }
7024     basic_ostream_wchar_sentry_destroy(ostr);
7025
7026     basic_ios_wchar_setstate(base, state);
7027     return ostr;
7028 }
7029
7030 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@PB_W@Z */
7031 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@PEB_W@Z */
7032 /* ??$?6GU?$char_traits@G@std@@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@PBG@Z */
7033 /* ??$?6GU?$char_traits@G@std@@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@PEBG@Z */
7034 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_str(basic_ostream_wchar *ostr, const wchar_t *str)
7035 {
7036     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
7037     IOSB_iostate state = IOSTATE_goodbit;
7038
7039     TRACE("(%p %s)\n", ostr, debugstr_w(str));
7040
7041     if(basic_ostream_wchar_sentry_create(ostr)) {
7042         MSVCP_size_t len = wcslen(str);
7043         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
7044
7045         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7046             for(; pad!=0; pad--) {
7047                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7048                     state = IOSTATE_badbit;
7049                     break;
7050                 }
7051             }
7052         }
7053
7054         if(state == IOSTATE_goodbit) {
7055             if(basic_streambuf_wchar_sputn(base->strbuf, str, len) != len)
7056                                         state = IOSTATE_badbit;
7057         }
7058
7059         if(state == IOSTATE_goodbit) {
7060             for(; pad!=0; pad--) {
7061                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7062                     state = IOSTATE_badbit;
7063                     break;
7064                 }
7065             }
7066         }
7067
7068         base->base.wide = 0;
7069     }else {
7070         state = IOSTATE_badbit;
7071     }
7072     basic_ostream_wchar_sentry_destroy(ostr);
7073
7074     basic_ios_wchar_setstate(base, state);
7075     return ostr;
7076 }
7077
7078 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7079 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7080 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7081 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7082 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func, 8)
7083 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func(basic_ostream_wchar *this,
7084         basic_ostream_wchar* (__cdecl *pfunc)(basic_ostream_wchar*))
7085 {
7086     TRACE("(%p %p)\n", this, pfunc);
7087     pfunc(this);
7088     return this;
7089 }
7090
7091 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
7092 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
7093 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
7094 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
7095 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_basic_ios, 8)
7096 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_basic_ios(basic_ostream_wchar *this,
7097         basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
7098 {
7099     TRACE("(%p %p)\n", this, pfunc);
7100     pfunc(basic_ostream_wchar_get_basic_ios(this));
7101     return this;
7102 }
7103
7104 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7105 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7106 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7107 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7108 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_ios_base, 8)
7109 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_ios_base(
7110         basic_ostream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
7111 {
7112     TRACE("(%p %p)\n", this, pfunc);
7113     pfunc(&basic_ostream_wchar_get_basic_ios(this)->base);
7114     return this;
7115 }
7116
7117 /* Caution: basic_istream uses virtual inheritance. */
7118 static inline basic_ios_char* basic_istream_char_get_basic_ios(basic_istream_char *this)
7119 {
7120     return (basic_ios_char*)((char*)this+this->vbtable[1]);
7121 }
7122
7123 static inline basic_ios_char* basic_istream_char_to_basic_ios(basic_istream_char *ptr)
7124 {
7125     return (basic_ios_char*)((char*)ptr+basic_istream_char_vbtable[1]);
7126 }
7127
7128 static inline basic_istream_char* basic_istream_char_from_basic_ios(basic_ios_char *ptr)
7129 {
7130     return (basic_istream_char*)((char*)ptr-basic_istream_char_vbtable[1]);
7131 }
7132
7133 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
7134 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
7135 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_init, 20)
7136 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)
7137 {
7138     basic_ios_char *base;
7139
7140     TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
7141
7142     if(virt_init) {
7143         this->vbtable = basic_istream_char_vbtable;
7144         base = basic_istream_char_get_basic_ios(this);
7145         basic_ios_char_ctor(base);
7146     }else {
7147         base = basic_istream_char_get_basic_ios(this);
7148     }
7149
7150     base->base.vtable = &MSVCP_basic_istream_char_vtable;
7151     this->count = 0;
7152     if(!noinit)
7153         basic_ios_char_init(base, strbuf, isstd);
7154     return this;
7155 }
7156
7157 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
7158 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
7159 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor, 16)
7160 basic_istream_char* __thiscall basic_istream_char_ctor(basic_istream_char *this, basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
7161 {
7162     return basic_istream_char_ctor_init(this, strbuf, isstd, FALSE, virt_init);
7163 }
7164
7165 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
7166 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
7167 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_uninitialized, 12)
7168 basic_istream_char* __thiscall basic_istream_char_ctor_uninitialized(basic_istream_char *this, int uninitialized, MSVCP_bool virt_init)
7169 {
7170     basic_ios_char *base;
7171
7172     TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
7173
7174     if(virt_init) {
7175         this->vbtable = basic_istream_char_vbtable;
7176         base = basic_istream_char_get_basic_ios(this);
7177         basic_ios_char_ctor(base);
7178     }else {
7179         base = basic_istream_char_get_basic_ios(this);
7180     }
7181
7182     base->base.vtable = &MSVCP_basic_istream_char_vtable;
7183     ios_base_Addstd(&base->base);
7184     return this;
7185 }
7186
7187 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UAE@XZ */
7188 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
7189 DEFINE_THISCALL_WRAPPER(basic_istream_char_dtor, 4)
7190 void __thiscall basic_istream_char_dtor(basic_ios_char *base)
7191 {
7192     basic_istream_char *this = basic_istream_char_from_basic_ios(base);
7193
7194     /* don't destroy virtual base here */
7195     TRACE("(%p)\n", this);
7196 }
7197
7198 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7199 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7200 DEFINE_THISCALL_WRAPPER(basic_istream_char_vbase_dtor, 4)
7201 void __thiscall basic_istream_char_vbase_dtor(basic_istream_char *this)
7202 {
7203     TRACE("(%p)\n", this);
7204     basic_istream_char_dtor(basic_istream_char_to_basic_ios(this));
7205     basic_ios_char_dtor(basic_istream_char_get_basic_ios(this));
7206 }
7207
7208 DEFINE_THISCALL_WRAPPER(basic_istream_char_vector_dtor, 8)
7209 basic_istream_char* __thiscall basic_istream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
7210 {
7211     basic_istream_char *this = basic_istream_char_from_basic_ios(base);
7212
7213     TRACE("(%p %x)\n", this, flags);
7214
7215     if(flags & 2) {
7216         /* we have an array, with the number of elements stored before the first object */
7217         INT_PTR i, *ptr = (INT_PTR *)this-1;
7218
7219         for(i=*ptr-1; i>=0; i--)
7220             basic_istream_char_vbase_dtor(this+i);
7221         MSVCRT_operator_delete(ptr);
7222     } else {
7223         basic_istream_char_vbase_dtor(this);
7224         if(flags & 1)
7225             MSVCRT_operator_delete(this);
7226     }
7227
7228     return this;
7229 }
7230
7231 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
7232 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
7233 DEFINE_THISCALL_WRAPPER(basic_istream_char__Ipfx, 8)
7234 MSVCP_bool __thiscall basic_istream_char__Ipfx(basic_istream_char *this, MSVCP_bool noskip)
7235 {
7236     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7237
7238     TRACE("(%p %d)\n", this, noskip);
7239
7240     if(!ios_base_good(&base->base)) {
7241         basic_ios_char_setstate(base, IOSTATE_failbit);
7242         return FALSE;
7243     }
7244
7245     if(basic_ios_char_tie_get(base))
7246         basic_ostream_char_flush(basic_ios_char_tie_get(base));
7247
7248     if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
7249         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7250         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
7251         int ch;
7252
7253         for(ch = basic_streambuf_char_sgetc(strbuf); ;
7254                 ch = basic_streambuf_char_snextc(strbuf)) {
7255             if(ch == EOF) {
7256                 basic_ios_char_setstate(base, IOSTATE_eofbit);
7257                 return FALSE;
7258             }
7259
7260             if(!ctype_char_is_ch(ctype, _SPACE|_BLANK, ch))
7261                 break;
7262         }
7263     }
7264
7265     return TRUE;
7266 }
7267
7268 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
7269 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
7270 DEFINE_THISCALL_WRAPPER(basic_istream_char_ipfx, 8)
7271 MSVCP_bool __thiscall basic_istream_char_ipfx(basic_istream_char *this, MSVCP_bool noskip)
7272 {
7273     return basic_istream_char__Ipfx(this, noskip);
7274 }
7275
7276 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7277 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7278 DEFINE_THISCALL_WRAPPER(basic_istream_char_isfx, 4)
7279 void __thiscall basic_istream_char_isfx(basic_istream_char *this)
7280 {
7281     TRACE("(%p)\n", this);
7282 }
7283
7284 static BOOL basic_istream_char_sentry_create(basic_istream_char *istr, MSVCP_bool noskip)
7285 {
7286     basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
7287
7288     if(basic_ios_char_rdbuf_get(base))
7289         basic_streambuf_char__Lock(base->strbuf);
7290
7291     return basic_istream_char_ipfx(istr, noskip);
7292 }
7293
7294 static void basic_istream_char_sentry_destroy(basic_istream_char *istr)
7295 {
7296     basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
7297
7298     if(basic_ios_char_rdbuf_get(base))
7299         basic_streambuf_char__Unlock(base->strbuf);
7300 }
7301
7302 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QBEHXZ */
7303 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QEBA_JXZ */
7304 DEFINE_THISCALL_WRAPPER(basic_istream_char_gcount, 4)
7305 int __thiscall basic_istream_char_gcount(const basic_istream_char *this)
7306 {
7307     TRACE("(%p)\n", this);
7308     return this->count;
7309 }
7310
7311 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7312 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7313 DEFINE_THISCALL_WRAPPER(basic_istream_char_get, 4)
7314 int __thiscall basic_istream_char_get(basic_istream_char *this)
7315 {
7316     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7317     int ret;
7318
7319     TRACE("(%p)\n", this);
7320
7321     this->count = 0;
7322
7323     if(!basic_istream_char_sentry_create(this, TRUE)) {
7324         basic_istream_char_sentry_destroy(this);
7325         return EOF;
7326     }
7327
7328     ret = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(base));
7329     basic_istream_char_sentry_destroy(this);
7330     if(ret == EOF)
7331         basic_ios_char_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
7332     else
7333         this->count++;
7334
7335     return ret;
7336 }
7337
7338 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAD@Z */
7339 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAD@Z */
7340 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_ch, 8)
7341 basic_istream_char* __thiscall basic_istream_char_get_ch(basic_istream_char *this, char *ch)
7342 {
7343     int ret;
7344
7345     TRACE("(%p %p)\n", this, ch);
7346
7347     ret = basic_istream_char_get(this);
7348     if(ret != EOF)
7349         *ch = (char)ret;
7350     return this;
7351 }
7352
7353 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
7354 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
7355 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str_delim, 16)
7356 basic_istream_char* __thiscall basic_istream_char_get_str_delim(basic_istream_char *this, char *str, streamsize count, char delim)
7357 {
7358     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7359     int ch = delim;
7360
7361     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
7362
7363     this->count = 0;
7364
7365     if(basic_istream_char_sentry_create(this, TRUE)) {
7366         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7367
7368         for(ch = basic_streambuf_char_sgetc(strbuf); count>1;
7369                 ch = basic_streambuf_char_snextc(strbuf)) {
7370             if(ch==EOF || ch==delim)
7371                 break;
7372
7373             *str++ = ch;
7374             this->count++;
7375             count--;
7376         }
7377     }
7378     basic_istream_char_sentry_destroy(this);
7379
7380     basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
7381             (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7382     if(count > 0)
7383         *str = 0;
7384     return this;
7385 }
7386
7387 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7388 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7389 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str, 12)
7390 basic_istream_char* __thiscall basic_istream_char_get_str(basic_istream_char *this, char *str, streamsize count)
7391 {
7392     return basic_istream_char_get_str_delim(this, str, count, '\n');
7393 }
7394
7395 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
7396 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
7397 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf_delim, 12)
7398 basic_istream_char* __thiscall basic_istream_char_get_streambuf_delim(basic_istream_char *this, basic_streambuf_char *strbuf, char delim)
7399 {
7400     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7401     int ch = delim;
7402
7403     TRACE("(%p %p %c)\n", this, strbuf, delim);
7404
7405     this->count = 0;
7406
7407     if(basic_istream_char_sentry_create(this, TRUE)) {
7408         basic_streambuf_char *strbuf_read = basic_ios_char_rdbuf_get(base);
7409
7410         for(ch = basic_streambuf_char_sgetc(strbuf_read); ;
7411                 ch = basic_streambuf_char_snextc(strbuf_read)) {
7412             if(ch==EOF || ch==delim)
7413                 break;
7414
7415             if(basic_streambuf_char_sputc(strbuf, ch) == EOF)
7416                 break;
7417             this->count++;
7418         }
7419     }
7420     basic_istream_char_sentry_destroy(this);
7421
7422     basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
7423             (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7424     return this;
7425 }
7426
7427 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
7428 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
7429 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf, 8)
7430 basic_istream_char* __thiscall basic_istream_char_get_streambuf(basic_istream_char *this, basic_streambuf_char *strbuf)
7431 {
7432     return basic_istream_char_get_streambuf_delim(this, strbuf, '\n');
7433 }
7434
7435 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
7436 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
7437 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline_delim, 16)
7438 basic_istream_char* __thiscall basic_istream_char_getline_delim(basic_istream_char *this, char *str, streamsize count, char delim)
7439 {
7440     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7441     int ch = delim;
7442
7443     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
7444
7445     this->count = 0;
7446
7447     if(basic_istream_char_sentry_create(this, TRUE) && count>0) {
7448         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7449
7450         while(count > 1) {
7451             ch = basic_streambuf_char_sbumpc(strbuf);
7452
7453             if(ch==EOF || ch==delim)
7454                 break;
7455
7456             *str++ = ch;
7457             this->count++;
7458             count--;
7459         }
7460
7461         if(ch == delim)
7462             this->count++;
7463         else if(ch != EOF) {
7464             ch = basic_streambuf_char_sgetc(strbuf);
7465
7466             if(ch == delim) {
7467                 basic_streambuf_char__Gninc(strbuf);
7468                 this->count++;
7469             }
7470         }
7471     }
7472     basic_istream_char_sentry_destroy(this);
7473
7474     basic_ios_char_setstate(base, (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
7475             (!this->count || (ch!=delim && ch!=EOF) ? IOSTATE_failbit : IOSTATE_goodbit));
7476     if(count > 0)
7477         *str = 0;
7478     return this;
7479 }
7480
7481 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7482 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7483 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline, 12)
7484 basic_istream_char* __thiscall basic_istream_char_getline(basic_istream_char *this, char *str, streamsize count)
7485 {
7486     return basic_istream_char_getline_delim(this, str, count, '\n');
7487 }
7488
7489 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@HH@Z */
7490 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
7491 DEFINE_THISCALL_WRAPPER(basic_istream_char_ignore, 12)
7492 basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *this, streamsize count, int delim)
7493 {
7494     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7495     int ch = delim;
7496
7497     TRACE("(%p %ld %d)\n", this, count, delim);
7498
7499     this->count = 0;
7500
7501     if(basic_istream_char_sentry_create(this, TRUE)) {
7502         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7503
7504         while(count > 0) {
7505             ch = basic_streambuf_char_sbumpc(strbuf);
7506
7507             if(ch==EOF || ch==delim)
7508                 break;
7509
7510             this->count++;
7511             if(count != INT_MAX)
7512                 count--;
7513         }
7514     }
7515     basic_istream_char_sentry_destroy(this);
7516
7517     if(ch == EOF)
7518         basic_ios_char_setstate(base, IOSTATE_eofbit);
7519     return this;
7520 }
7521
7522 /* ?ws@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@1@AAV21@@Z */
7523 /* ?ws@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
7524 basic_istream_char* __cdecl ws_basic_istream_char(basic_istream_char *istream)
7525 {
7526     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
7527     int ch = '\n';
7528
7529     TRACE("(%p)\n", istream);
7530
7531     if(basic_istream_char_sentry_create(istream, TRUE)) {
7532         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7533         const ctype_char *ctype = ctype_char_use_facet(strbuf->loc);
7534
7535         for(ch = basic_streambuf_char_sgetc(strbuf); ctype_char_is_ch(ctype, _SPACE, ch);
7536                 ch = basic_streambuf_char_snextc(strbuf)) {
7537             if(ch == EOF)
7538                 break;
7539         }
7540     }
7541     basic_istream_char_sentry_destroy(istream);
7542
7543     if(ch == EOF)
7544         basic_ios_char_setstate(base, IOSTATE_eofbit);
7545     return istream;
7546 }
7547
7548 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7549 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7550 DEFINE_THISCALL_WRAPPER(basic_istream_char_peek, 4)
7551 int __thiscall basic_istream_char_peek(basic_istream_char *this)
7552 {
7553     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7554     int ret = EOF;
7555
7556     TRACE("(%p)\n", this);
7557
7558     this->count = 0;
7559
7560     if(basic_istream_char_sentry_create(this, TRUE))
7561         ret = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
7562     basic_istream_char_sentry_destroy(this);
7563     return ret;
7564 }
7565
7566 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADIH@Z */
7567 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_K_J@Z */
7568 DEFINE_THISCALL_WRAPPER(basic_istream_char__Read_s, 16)
7569 basic_istream_char* __thiscall basic_istream_char__Read_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
7570 {
7571     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7572     IOSB_iostate state = IOSTATE_goodbit;
7573
7574     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
7575
7576     if(basic_istream_char_sentry_create(this, TRUE)) {
7577         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7578
7579         this->count = basic_streambuf_char__Sgetn_s(strbuf, str, size, count);
7580         if(this->count != count)
7581             state |= IOSTATE_failbit | IOSTATE_eofbit;
7582     }else {
7583         this->count = 0;
7584     }
7585     basic_istream_char_sentry_destroy(this);
7586
7587     basic_ios_char_setstate(base, state);
7588     return this;
7589 }
7590
7591 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7592 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7593 DEFINE_THISCALL_WRAPPER(basic_istream_char_read, 12)
7594 basic_istream_char* __thiscall basic_istream_char_read(basic_istream_char *this, char *str, streamsize count)
7595 {
7596     return basic_istream_char__Read_s(this, str, count, count);
7597 }
7598
7599 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
7600 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
7601 DEFINE_THISCALL_WRAPPER(basic_istream_char__Readsome_s, 16)
7602 streamsize __thiscall basic_istream_char__Readsome_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
7603 {
7604     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7605     IOSB_iostate state = IOSTATE_goodbit;
7606
7607     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
7608
7609     this->count = 0;
7610
7611     if(basic_istream_char_sentry_create(this, TRUE)) {
7612         streamsize avail = basic_streambuf_char_in_avail(basic_ios_char_rdbuf_get(base));
7613         if(avail > count)
7614             avail = count;
7615
7616         if(avail == -1)
7617             state |= IOSTATE_eofbit;
7618         else if(avail > 0)
7619             basic_istream_char__Read_s(this, str, size, avail);
7620     }else {
7621         state |= IOSTATE_failbit;
7622     }
7623     basic_istream_char_sentry_destroy(this);
7624
7625     basic_ios_char_setstate(base, state);
7626     return this->count;
7627 }
7628
7629 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
7630 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
7631 DEFINE_THISCALL_WRAPPER(basic_istream_char_readsome, 12)
7632 streamsize __thiscall basic_istream_char_readsome(basic_istream_char *this, char *str, streamsize count)
7633 {
7634     return basic_istream_char__Readsome_s(this, str, count, count);
7635 }
7636
7637 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
7638 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
7639 DEFINE_THISCALL_WRAPPER(basic_istream_char_putback, 8)
7640 basic_istream_char* __thiscall basic_istream_char_putback(basic_istream_char *this, char ch)
7641 {
7642     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7643     IOSB_iostate state = IOSTATE_goodbit;
7644
7645     TRACE("(%p %c)\n", this, ch);
7646
7647     this->count = 0;
7648
7649     if(basic_istream_char_sentry_create(this, TRUE)) {
7650         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7651
7652         if(!ios_base_good(&base->base))
7653             state |= IOSTATE_failbit;
7654         else if(!strbuf || basic_streambuf_char_sputbackc(strbuf, ch)==EOF)
7655             state |= IOSTATE_badbit;
7656     }
7657     basic_istream_char_sentry_destroy(this);
7658
7659     basic_ios_char_setstate(base, state);
7660     return this;
7661 }
7662
7663 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
7664 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
7665 DEFINE_THISCALL_WRAPPER(basic_istream_char_unget, 4)
7666 basic_istream_char* __thiscall basic_istream_char_unget(basic_istream_char *this)
7667 {
7668     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7669     IOSB_iostate state = IOSTATE_goodbit;
7670
7671     TRACE("(%p)\n", this);
7672
7673     this->count = 0;
7674
7675     if(basic_istream_char_sentry_create(this, TRUE)) {
7676         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7677
7678         if(!ios_base_good(&base->base))
7679             state |= IOSTATE_failbit;
7680         else if(!strbuf || basic_streambuf_char_sungetc(strbuf)==EOF)
7681             state |= IOSTATE_badbit;
7682     }
7683     basic_istream_char_sentry_destroy(this);
7684
7685     basic_ios_char_setstate(base, state);
7686     return this;
7687 }
7688
7689 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7690 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7691 DEFINE_THISCALL_WRAPPER(basic_istream_char_sync, 4)
7692 int __thiscall basic_istream_char_sync(basic_istream_char *this)
7693 {
7694     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7695     basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7696
7697     TRACE("(%p)\n", this);
7698
7699     if(!strbuf)
7700         return -1;
7701
7702     if(basic_istream_char_sentry_create(this, TRUE)) {
7703         if(basic_streambuf_char_pubsync(strbuf) != -1) {
7704             basic_istream_char_sentry_destroy(this);
7705             return 0;
7706         }
7707     }
7708     basic_istream_char_sentry_destroy(this);
7709
7710     basic_ios_char_setstate(base, IOSTATE_badbit);
7711     return -1;
7712 }
7713
7714 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
7715 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
7716 DEFINE_THISCALL_WRAPPER(basic_istream_char_tellg, 8)
7717 fpos_int* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpos_int *ret)
7718 {
7719     TRACE("(%p %p)\n", this, ret);
7720
7721     if(basic_istream_char_sentry_create(this, TRUE)) {
7722         basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7723         if(!ios_base_fail(&base->base)) {
7724             basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
7725                     ret, 0, SEEKDIR_cur, OPENMODE_in);
7726             basic_istream_char_sentry_destroy(this);
7727
7728             if(ret->off==0 && ret->pos==-1 && ret->state==0)
7729                 basic_ios_char_setstate(base, IOSTATE_failbit);
7730             return ret;
7731         }
7732     }
7733     basic_istream_char_sentry_destroy(this);
7734
7735     ret->off = 0;
7736     ret->pos = -1;
7737     ret->state = 0;
7738     return ret;
7739 }
7740
7741 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
7742 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
7743 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg, 12)
7744 basic_istream_char* __thiscall basic_istream_char_seekg(basic_istream_char *this, streamoff off, int dir)
7745 {
7746     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7747
7748     TRACE("(%p %ld %d)\n", this, off, dir);
7749
7750     if(basic_istream_char_sentry_create(this, TRUE)) {
7751         if(!ios_base_fail(&base->base)) {
7752             basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7753             fpos_int ret;
7754
7755             basic_streambuf_char_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
7756             basic_istream_char_sentry_destroy(this);
7757
7758             if(ret.off==0 && ret.pos==-1 && ret.state==0)
7759                 basic_ios_char_setstate(base, IOSTATE_failbit);
7760             else
7761                 basic_ios_char_clear(base, IOSTATE_goodbit);
7762             return this;
7763         }
7764     }
7765     basic_istream_char_sentry_destroy(this);
7766
7767     basic_ios_char_setstate(base, IOSTATE_failbit);
7768     return this;
7769 }
7770
7771 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
7772 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
7773 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg_fpos, 28)
7774 basic_istream_char* __thiscall basic_istream_char_seekg_fpos(basic_istream_char *this, fpos_int pos)
7775 {
7776     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7777
7778     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
7779
7780     if(basic_istream_char_sentry_create(this, TRUE)) {
7781         if(!ios_base_fail(&base->base)) {
7782             basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7783             fpos_int ret;
7784
7785             basic_streambuf_char_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
7786             basic_istream_char_sentry_destroy(this);
7787
7788             if(ret.off==0 && ret.pos==-1 && ret.state==0)
7789                 basic_ios_char_setstate(base, IOSTATE_failbit);
7790             else
7791                 basic_ios_char_clear(base, IOSTATE_goodbit);
7792             return this;
7793         }
7794     }
7795     basic_istream_char_sentry_destroy(this);
7796
7797     basic_ios_char_setstate(base, IOSTATE_failbit);
7798     return this;
7799 }
7800
7801 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAF@Z */
7802 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAF@Z */
7803 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_short, 8)
7804 basic_istream_char* __thiscall basic_istream_char_read_short(basic_istream_char *this, short *v)
7805 {
7806     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7807     int state = IOSTATE_goodbit;
7808
7809     TRACE("(%p %p)\n", this, v);
7810
7811     if(basic_istream_char_sentry_create(this, FALSE)) {
7812         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7813         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7814         istreambuf_iterator_char first={0}, last={0};
7815         LONG tmp;
7816
7817         first.strbuf = strbuf;
7818         num_get_char_get_long(numget, &last, first, last, &base->base, &state, &tmp);
7819
7820         if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
7821             *v = tmp;
7822         else
7823             state |= IOSTATE_failbit;
7824     }
7825     basic_istream_char_sentry_destroy(this);
7826
7827     basic_ios_char_setstate(base, state);
7828     return this;
7829 }
7830
7831 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAG@Z */
7832 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAG@Z */
7833 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ushort, 8)
7834 basic_istream_char* __thiscall basic_istream_char_read_ushort(basic_istream_char *this, unsigned short *v)
7835 {
7836     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7837     int state = IOSTATE_goodbit;
7838
7839     TRACE("(%p %p)\n", this, v);
7840
7841     if(basic_istream_char_sentry_create(this, FALSE)) {
7842         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7843         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7844         istreambuf_iterator_char first={0}, last={0};
7845
7846         first.strbuf = strbuf;
7847         num_get_char_get_ushort(numget, &last, first, last, &base->base, &state, v);
7848     }
7849     basic_istream_char_sentry_destroy(this);
7850
7851     basic_ios_char_setstate(base, state);
7852     return this;
7853 }
7854
7855 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z */
7856 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAH@Z */
7857 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int, 8)
7858 basic_istream_char* __thiscall basic_istream_char_read_int(basic_istream_char *this, int *v)
7859 {
7860     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7861     int state = IOSTATE_goodbit;
7862
7863     TRACE("(%p %p)\n", this, v);
7864
7865     if(basic_istream_char_sentry_create(this, FALSE)) {
7866         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7867         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7868         istreambuf_iterator_char first={0}, last={0};
7869
7870         first.strbuf = strbuf;
7871         num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
7872     }
7873     basic_istream_char_sentry_destroy(this);
7874
7875     basic_ios_char_setstate(base, state);
7876     return this;
7877 }
7878
7879 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAI@Z */
7880 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAI@Z */
7881 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint, 8)
7882 basic_istream_char* __thiscall basic_istream_char_read_uint(basic_istream_char *this, unsigned int *v)
7883 {
7884     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7885     int state = IOSTATE_goodbit;
7886
7887     TRACE("(%p %p)\n", this, v);
7888
7889     if(basic_istream_char_sentry_create(this, FALSE)) {
7890         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7891         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7892         istreambuf_iterator_char first={0}, last={0};
7893
7894         first.strbuf = strbuf;
7895         num_get_char_get_uint(numget, &last, first, last, &base->base, &state, v);
7896     }
7897     basic_istream_char_sentry_destroy(this);
7898
7899     basic_ios_char_setstate(base, state);
7900     return this;
7901 }
7902
7903 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAJ@Z */
7904 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAJ@Z */
7905 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_long, 8)
7906 basic_istream_char* __thiscall basic_istream_char_read_long(basic_istream_char *this, LONG *v)
7907 {
7908     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7909     int state = IOSTATE_goodbit;
7910
7911     TRACE("(%p %p)\n", this, v);
7912
7913     if(basic_istream_char_sentry_create(this, FALSE)) {
7914         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7915         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7916         istreambuf_iterator_char first={0}, last={0};
7917
7918         first.strbuf = strbuf;
7919         num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
7920     }
7921     basic_istream_char_sentry_destroy(this);
7922
7923     basic_ios_char_setstate(base, state);
7924     return this;
7925 }
7926
7927 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAK@Z */
7928 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAK@Z */
7929 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ulong, 8)
7930 basic_istream_char* __thiscall basic_istream_char_read_ulong(basic_istream_char *this, ULONG *v)
7931 {
7932     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7933     int state = IOSTATE_goodbit;
7934
7935     TRACE("(%p %p)\n", this, v);
7936
7937     if(basic_istream_char_sentry_create(this, FALSE)) {
7938         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7939         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7940         istreambuf_iterator_char first={0}, last={0};
7941
7942         first.strbuf = strbuf;
7943         num_get_char_get_ulong(numget, &last, first, last, &base->base, &state, v);
7944     }
7945     basic_istream_char_sentry_destroy(this);
7946
7947     basic_ios_char_setstate(base, state);
7948     return this;
7949 }
7950
7951 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAM@Z */
7952 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAM@Z */
7953 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_float, 8)
7954 basic_istream_char* __thiscall basic_istream_char_read_float(basic_istream_char *this, float *v)
7955 {
7956     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7957     int state = IOSTATE_goodbit;
7958
7959     TRACE("(%p %p)\n", this, v);
7960
7961     if(basic_istream_char_sentry_create(this, FALSE)) {
7962         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7963         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7964         istreambuf_iterator_char first={0}, last={0};
7965
7966         first.strbuf = strbuf;
7967         num_get_char_get_float(numget, &last, first, last, &base->base, &state, v);
7968     }
7969     basic_istream_char_sentry_destroy(this);
7970
7971     basic_ios_char_setstate(base, state);
7972     return this;
7973 }
7974
7975 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAN@Z */
7976 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAN@Z */
7977 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_double, 8)
7978 basic_istream_char* __thiscall basic_istream_char_read_double(basic_istream_char *this, double *v)
7979 {
7980     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7981     int state = IOSTATE_goodbit;
7982
7983     TRACE("(%p %p)\n", this, v);
7984
7985     if(basic_istream_char_sentry_create(this, FALSE)) {
7986         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7987         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7988         istreambuf_iterator_char first={0}, last={0};
7989
7990         first.strbuf = strbuf;
7991         num_get_char_get_double(numget, &last, first, last, &base->base, &state, v);
7992     }
7993     basic_istream_char_sentry_destroy(this);
7994
7995     basic_ios_char_setstate(base, state);
7996     return this;
7997 }
7998
7999 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAO@Z */
8000 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAO@Z */
8001 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ldouble, 8)
8002 basic_istream_char* __thiscall basic_istream_char_read_ldouble(basic_istream_char *this, double *v)
8003 {
8004     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8005     int state = IOSTATE_goodbit;
8006
8007     TRACE("(%p %p)\n", this, v);
8008
8009     if(basic_istream_char_sentry_create(this, FALSE)) {
8010         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8011         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8012         istreambuf_iterator_char first={0}, last={0};
8013
8014         first.strbuf = strbuf;
8015         num_get_char_get_ldouble(numget, &last, first, last, &base->base, &state, v);
8016     }
8017     basic_istream_char_sentry_destroy(this);
8018
8019     basic_ios_char_setstate(base, state);
8020     return this;
8021 }
8022
8023 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAPAX@Z */
8024 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
8025 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ptr, 8)
8026 basic_istream_char* __thiscall basic_istream_char_read_ptr(basic_istream_char *this, void **v)
8027 {
8028     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8029     int state = IOSTATE_goodbit;
8030
8031     TRACE("(%p %p)\n", this, v);
8032
8033     if(basic_istream_char_sentry_create(this, FALSE)) {
8034         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8035         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8036         istreambuf_iterator_char first={0}, last={0};
8037
8038         first.strbuf = strbuf;
8039         num_get_char_get_void(numget, &last, first, last, &base->base, &state, v);
8040     }
8041     basic_istream_char_sentry_destroy(this);
8042
8043     basic_ios_char_setstate(base, state);
8044     return this;
8045 }
8046
8047 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_J@Z */
8048 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_J@Z */
8049 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int64, 8)
8050 basic_istream_char* __thiscall basic_istream_char_read_int64(basic_istream_char *this, __int64 *v)
8051 {
8052     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8053     int state = IOSTATE_goodbit;
8054
8055     TRACE("(%p %p)\n", this, v);
8056
8057     if(basic_istream_char_sentry_create(this, FALSE)) {
8058         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8059         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8060         istreambuf_iterator_char first={0}, last={0};
8061
8062         first.strbuf = strbuf;
8063         num_get_char_get_int64(numget, &last, first, last, &base->base, &state, v);
8064     }
8065     basic_istream_char_sentry_destroy(this);
8066
8067     basic_ios_char_setstate(base, state);
8068     return this;
8069 }
8070
8071 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_K@Z */
8072 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_K@Z */
8073 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint64, 8)
8074 basic_istream_char* __thiscall basic_istream_char_read_uint64(basic_istream_char *this, unsigned __int64 *v)
8075 {
8076     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8077     int state = IOSTATE_goodbit;
8078
8079     TRACE("(%p %p)\n", this, v);
8080
8081     if(basic_istream_char_sentry_create(this, FALSE)) {
8082         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8083         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8084         istreambuf_iterator_char first={0}, last={0};
8085
8086         first.strbuf = strbuf;
8087         num_get_char_get_uint64(numget, &last, first, last, &base->base, &state, v);
8088     }
8089     basic_istream_char_sentry_destroy(this);
8090
8091     basic_ios_char_setstate(base, state);
8092     return this;
8093 }
8094
8095 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_N@Z */
8096 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_N@Z */
8097 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_bool, 8)
8098 basic_istream_char* __thiscall basic_istream_char_read_bool(basic_istream_char *this, MSVCP_bool *v)
8099 {
8100     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8101     int state = IOSTATE_goodbit;
8102
8103     TRACE("(%p %p)\n", this, v);
8104
8105     if(basic_istream_char_sentry_create(this, FALSE)) {
8106         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8107         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8108         istreambuf_iterator_char first={0}, last={0};
8109
8110         first.strbuf = strbuf;
8111         num_get_char_get_bool(numget, &last, first, last, &base->base, &state, v);
8112     }
8113     basic_istream_char_sentry_destroy(this);
8114
8115     basic_ios_char_setstate(base, state);
8116     return this;
8117 }
8118
8119 /* ??$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 */
8120 /* ??$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 */
8121 basic_istream_char* __cdecl basic_istream_char_getline_bstr_delim(
8122         basic_istream_char *istream, basic_string_char *str, char delim)
8123 {
8124     IOSB_iostate state = IOSTATE_failbit;
8125     int c = delim;
8126
8127     TRACE("(%p %p %c)\n", istream, str, delim);
8128
8129     if(basic_istream_char_sentry_create(istream, TRUE)) {
8130         MSVCP_basic_string_char_clear(str);
8131
8132         c = basic_istream_char_get(istream);
8133         if(c != EOF)
8134             state = IOSTATE_goodbit;
8135
8136         for(; c!=delim && c!=EOF; c = basic_istream_char_get(istream)) {
8137             state = IOSTATE_goodbit;
8138             MSVCP_basic_string_char_append_ch(str, c);
8139         }
8140     }
8141     basic_istream_char_sentry_destroy(istream);
8142
8143     basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream),
8144         state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8145     return istream;
8146 }
8147
8148 /* ??$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 */
8149 /* ??$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 */
8150 basic_istream_char* __cdecl basic_istream_char_getline_bstr(
8151         basic_istream_char *istream, basic_string_char *str)
8152 {
8153     return basic_istream_char_getline_bstr_delim(istream, str, '\n');
8154 }
8155
8156 /* ??$?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 */
8157 /* ??$?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 */
8158 basic_istream_char* __cdecl basic_istream_char_read_bstr(
8159         basic_istream_char *istream, basic_string_char *str)
8160 {
8161     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8162     IOSB_iostate state = IOSTATE_failbit;
8163     int c = '\n';
8164
8165     TRACE("(%p %p)\n", istream, str);
8166
8167     if(basic_istream_char_sentry_create(istream, FALSE)) {
8168         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
8169         MSVCP_size_t count = ios_base_width_get(&base->base);
8170
8171         if(!count)
8172             count = -1;
8173
8174         MSVCP_basic_string_char_clear(str);
8175
8176         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
8177                 c!=EOF && !ctype_char_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
8178                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base)), count--) {
8179             state = IOSTATE_goodbit;
8180             MSVCP_basic_string_char_append_ch(str, c);
8181         }
8182     }
8183     basic_istream_char_sentry_destroy(istream);
8184
8185     ios_base_width_set(&base->base, 0);
8186     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8187     return istream;
8188 }
8189
8190 /* ??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAD@Z */
8191 /* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAD@Z */
8192 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAC@Z */
8193 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAC@Z */
8194 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAE@Z */
8195 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAE@Z */
8196 basic_istream_char* __cdecl basic_istream_char_read_str(basic_istream_char *istream, char *str)
8197 {
8198     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8199     IOSB_iostate state = IOSTATE_failbit;
8200     int c = '\n';
8201
8202     TRACE("(%p %p)\n", istream, str);
8203
8204     if(basic_istream_char_sentry_create(istream, FALSE)) {
8205         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
8206         MSVCP_size_t count = ios_base_width_get(&base->base)-1;
8207
8208         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
8209                 c!=EOF && !ctype_char_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
8210                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base)), count--) {
8211             state = IOSTATE_goodbit;
8212             *str++ = c;
8213         }
8214     }
8215     basic_istream_char_sentry_destroy(istream);
8216
8217     *str = 0;
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@AAD@Z */
8224 /* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAD@Z */
8225 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z */
8226 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAC@Z */
8227 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z */
8228 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAE@Z */
8229 basic_istream_char* __cdecl basic_istream_char_read_ch(basic_istream_char *istream, char *ch)
8230 {
8231     IOSB_iostate state = IOSTATE_failbit;
8232     int c = 0;
8233
8234     TRACE("(%p %p)\n", istream, ch);
8235
8236     if(basic_istream_char_sentry_create(istream, FALSE)) {
8237         c = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(
8238                     basic_istream_char_get_basic_ios(istream)));
8239         if(c != EOF) {
8240             state = IOSTATE_goodbit;
8241             *ch = c;
8242         }
8243     }
8244     basic_istream_char_sentry_destroy(istream);
8245
8246     basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream),
8247             state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8248     return istream;
8249 }
8250
8251 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
8252 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
8253 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_streambuf, 8)
8254 basic_istream_char* __thiscall basic_istream_char_read_streambuf(
8255         basic_istream_char *this, basic_streambuf_char *streambuf)
8256 {
8257     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8258     IOSB_iostate state = IOSTATE_failbit;
8259     int c = '\n';
8260
8261     TRACE("(%p %p)\n", this, streambuf);
8262
8263     if(basic_istream_char_sentry_create(this, FALSE)) {
8264         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base)); c!=EOF;
8265                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base))) {
8266             state = IOSTATE_goodbit;
8267             if(basic_streambuf_char_sputc(streambuf, c) == EOF)
8268                 break;
8269         }
8270     }
8271     basic_istream_char_sentry_destroy(this);
8272
8273     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8274     return this;
8275 }
8276
8277 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
8278 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
8279 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func, 8)
8280 basic_istream_char* __thiscall basic_istream_char_read_func(basic_istream_char *this,
8281         basic_istream_char* (__cdecl *pfunc)(basic_istream_char*))
8282 {
8283     TRACE("(%p %p)\n", this, pfunc);
8284     pfunc(this);
8285     return this;
8286 }
8287
8288 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
8289 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
8290 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_basic_ios, 8)
8291 basic_istream_char* __thiscall basic_istream_char_read_func_basic_ios(basic_istream_char *this,
8292         basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
8293 {
8294     TRACE("(%p %p)\n", this, pfunc);
8295     pfunc(basic_istream_char_get_basic_ios(this));
8296     return this;
8297 }
8298
8299 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
8300 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
8301 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_ios_base, 8)
8302 basic_istream_char* __thiscall basic_istream_char_read_func_ios_base(basic_istream_char *this,
8303         ios_base* (__cdecl *pfunc)(ios_base*))
8304 {
8305     TRACE("(%p %p)\n", this, pfunc);
8306     pfunc(&basic_istream_char_get_basic_ios(this)->base);
8307     return this;
8308 }
8309
8310 /* Caution: basic_istream uses virtual inheritance. */
8311 static inline basic_ios_wchar* basic_istream_wchar_get_basic_ios(basic_istream_wchar *this)
8312 {
8313     return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
8314 }
8315
8316 static inline basic_ios_wchar* basic_istream_wchar_to_basic_ios(basic_istream_wchar *ptr)
8317 {
8318     return (basic_ios_wchar*)((char*)ptr+basic_istream_wchar_vbtable[1]);
8319 }
8320
8321 static inline basic_istream_wchar* basic_istream_wchar_from_basic_ios(basic_ios_wchar *ptr)
8322 {
8323     return (basic_istream_wchar*)((char*)ptr-basic_istream_wchar_vbtable[1]);
8324 }
8325
8326 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
8327 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
8328 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_init, 20)
8329 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_init(basic_istream_wchar *this,
8330         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
8331 {
8332     basic_ios_wchar *base;
8333
8334     TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
8335
8336     if(virt_init) {
8337         this->vbtable = basic_istream_wchar_vbtable;
8338         base = basic_istream_wchar_get_basic_ios(this);
8339         basic_ios_wchar_ctor(base);
8340     }else {
8341         base = basic_istream_wchar_get_basic_ios(this);
8342     }
8343
8344     base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
8345     this->count = 0;
8346     if(!noinit)
8347         basic_ios_wchar_init(base, strbuf, isstd);
8348     return this;
8349 }
8350
8351 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
8352 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
8353 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_init, 20)
8354 basic_istream_wchar* __thiscall basic_istream_short_ctor_init(basic_istream_wchar *this,
8355         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
8356 {
8357     basic_istream_wchar_ctor_init(this, strbuf, isstd, noinit, virt_init);
8358     basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
8359     return this;
8360 }
8361
8362 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
8363 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
8364 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor, 16)
8365 basic_istream_wchar* __thiscall basic_istream_wchar_ctor(basic_istream_wchar *this,
8366         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
8367 {
8368     return basic_istream_wchar_ctor_init(this, strbuf, isstd, FALSE, virt_init);
8369 }
8370
8371 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
8372 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
8373 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor, 16)
8374 basic_istream_wchar* __thiscall basic_istream_short_ctor(basic_istream_wchar *this,
8375         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
8376 {
8377     return basic_istream_short_ctor_init(this, strbuf, isstd, FALSE, virt_init);
8378 }
8379
8380 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
8381 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
8382 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_uninitialized, 12)
8383 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_uninitialized(
8384         basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
8385 {
8386     basic_ios_wchar *base;
8387
8388     TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
8389
8390     if(virt_init) {
8391         this->vbtable = basic_istream_wchar_vbtable;
8392         base = basic_istream_wchar_get_basic_ios(this);
8393         basic_ios_wchar_ctor(base);
8394     }else {
8395         base = basic_istream_wchar_get_basic_ios(this);
8396     }
8397
8398     base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
8399     ios_base_Addstd(&base->base);
8400     return this;
8401 }
8402
8403 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
8404 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
8405 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_uninitialized, 12)
8406 basic_istream_wchar* __thiscall basic_istream_short_ctor_uninitialized(
8407         basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
8408 {
8409     basic_istream_wchar_ctor_uninitialized(this, uninitialized, virt_init);
8410     basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
8411     return this;
8412 }
8413
8414 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
8415 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
8416 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UAE@XZ */
8417 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
8418 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_dtor, 4)
8419 void __thiscall basic_istream_wchar_dtor(basic_ios_wchar *base)
8420 {
8421     basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
8422
8423     /* don't destroy virtual base here */
8424     TRACE("(%p)\n", this);
8425 }
8426
8427 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
8428 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
8429 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
8430 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
8431 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vbase_dtor, 4)
8432 void __thiscall basic_istream_wchar_vbase_dtor(basic_istream_wchar *this)
8433 {
8434     TRACE("(%p)\n", this);
8435     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(this));
8436     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(this));
8437 }
8438
8439 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vector_dtor, 8)
8440 basic_istream_wchar* __thiscall basic_istream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
8441 {
8442     basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
8443
8444     TRACE("(%p %x)\n", this, flags);
8445
8446     if(flags & 2) {
8447         /* we have an array, with the number of elements stored before the first object */
8448         INT_PTR i, *ptr = (INT_PTR *)this-1;
8449
8450         for(i=*ptr-1; i>=0; i--)
8451             basic_istream_wchar_vbase_dtor(this+i);
8452         MSVCRT_operator_delete(ptr);
8453     } else {
8454         basic_istream_wchar_vbase_dtor(this);
8455         if(flags & 1)
8456             MSVCRT_operator_delete(this);
8457     }
8458
8459     return this;
8460 }
8461
8462 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
8463 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
8464 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
8465 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
8466 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Ipfx, 8)
8467 MSVCP_bool __thiscall basic_istream_wchar__Ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
8468 {
8469     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8470
8471     TRACE("(%p %d)\n", this, noskip);
8472
8473     if(!ios_base_good(&base->base)) {
8474         basic_ios_wchar_setstate(base, IOSTATE_failbit);
8475         return FALSE;
8476     }
8477
8478     if(basic_ios_wchar_tie_get(base))
8479         basic_ostream_wchar_flush(basic_ios_wchar_tie_get(base));
8480
8481     if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
8482         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8483         const ctype_wchar *ctype = ctype_wchar_use_facet(base->strbuf->loc);
8484         int ch;
8485
8486         for(ch = basic_streambuf_wchar_sgetc(strbuf); ;
8487                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8488             if(ch == WEOF) {
8489                 basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8490                 return FALSE;
8491             }
8492
8493             if(!ctype_wchar_is_ch(ctype, _SPACE|_BLANK, ch))
8494                 break;
8495         }
8496     }
8497
8498     return TRUE;
8499 }
8500
8501 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
8502 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
8503 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
8504 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
8505 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ipfx, 8)
8506 MSVCP_bool __thiscall basic_istream_wchar_ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
8507 {
8508     return basic_istream_wchar__Ipfx(this, noskip);
8509 }
8510
8511 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
8512 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
8513 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
8514 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
8515 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_isfx, 4)
8516 void __thiscall basic_istream_wchar_isfx(basic_istream_wchar *this)
8517 {
8518     TRACE("(%p)\n", this);
8519 }
8520
8521 static BOOL basic_istream_wchar_sentry_create(basic_istream_wchar *istr, MSVCP_bool noskip)
8522 {
8523     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
8524
8525     if(basic_ios_wchar_rdbuf_get(base))
8526         basic_streambuf_wchar__Lock(base->strbuf);
8527
8528     return basic_istream_wchar_ipfx(istr, noskip);
8529 }
8530
8531 static void basic_istream_wchar_sentry_destroy(basic_istream_wchar *istr)
8532 {
8533     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
8534
8535     if(basic_ios_wchar_rdbuf_get(base))
8536         basic_streambuf_wchar__Unlock(base->strbuf);
8537 }
8538
8539 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QBEHXZ */
8540 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEBA_JXZ */
8541 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QBEHXZ */
8542 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QEBA_JXZ */
8543 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_gcount, 4)
8544 int __thiscall basic_istream_wchar_gcount(const basic_istream_wchar *this)
8545 {
8546     TRACE("(%p)\n", this);
8547     return this->count;
8548 }
8549
8550 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
8551 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
8552 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
8553 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
8554 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get, 4)
8555 unsigned short __thiscall basic_istream_wchar_get(basic_istream_wchar *this)
8556 {
8557     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8558     int ret;
8559
8560     TRACE("(%p)\n", this);
8561
8562     this->count = 0;
8563
8564     if(!basic_istream_wchar_sentry_create(this, TRUE)) {
8565         basic_istream_wchar_sentry_destroy(this);
8566         return WEOF;
8567     }
8568
8569     ret = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(base));
8570     basic_istream_wchar_sentry_destroy(this);
8571     if(ret == WEOF)
8572         basic_ios_wchar_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
8573     else
8574         this->count++;
8575
8576     return ret;
8577 }
8578
8579 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AA_W@Z */
8580 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEA_W@Z */
8581 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAG@Z */
8582 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAG@Z */
8583 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_ch, 8)
8584 basic_istream_wchar* __thiscall basic_istream_wchar_get_ch(basic_istream_wchar *this, wchar_t *ch)
8585 {
8586     unsigned short ret;
8587
8588     TRACE("(%p %p)\n", this, ch);
8589
8590     ret = basic_istream_wchar_get(this);
8591     if(ret != WEOF)
8592         *ch = (wchar_t)ret;
8593     return this;
8594 }
8595
8596 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
8597 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
8598 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
8599 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
8600 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str_delim, 16)
8601 basic_istream_wchar* __thiscall basic_istream_wchar_get_str_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
8602 {
8603     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8604     unsigned short ch = delim;
8605
8606     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
8607
8608     this->count = 0;
8609
8610     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8611         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8612
8613         for(ch = basic_streambuf_wchar_sgetc(strbuf); count>1;
8614                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8615             if(ch==WEOF || ch==delim)
8616                 break;
8617
8618             *str++ = ch;
8619             this->count++;
8620             count--;
8621         }
8622     }
8623     basic_istream_wchar_sentry_destroy(this);
8624
8625     basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
8626             (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8627     if(count > 0)
8628         *str = 0;
8629     return this;
8630 }
8631
8632 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8633 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8634 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8635 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8636 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str, 12)
8637 basic_istream_wchar* __thiscall basic_istream_wchar_get_str(basic_istream_wchar *this, wchar_t *str, streamsize count)
8638 {
8639     return basic_istream_wchar_get_str_delim(this, str, count, '\n');
8640 }
8641
8642 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
8643 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
8644 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
8645 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
8646 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf_delim, 12)
8647 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf_delim(basic_istream_wchar *this, basic_streambuf_wchar *strbuf, wchar_t delim)
8648 {
8649     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8650     unsigned short ch = delim;
8651
8652     TRACE("(%p %p %c)\n", this, strbuf, delim);
8653
8654     this->count = 0;
8655
8656     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8657         basic_streambuf_wchar *strbuf_read = basic_ios_wchar_rdbuf_get(base);
8658
8659         for(ch = basic_streambuf_wchar_sgetc(strbuf_read); ;
8660                 ch = basic_streambuf_wchar_snextc(strbuf_read)) {
8661             if(ch==WEOF || ch==delim)
8662                 break;
8663
8664             if(basic_streambuf_wchar_sputc(strbuf, ch) == WEOF)
8665                 break;
8666             this->count++;
8667         }
8668     }
8669     basic_istream_wchar_sentry_destroy(this);
8670
8671     basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
8672             (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8673     return this;
8674 }
8675
8676 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
8677 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
8678 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
8679 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
8680 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf, 8)
8681 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf(basic_istream_wchar *this, basic_streambuf_wchar *strbuf)
8682 {
8683     return basic_istream_wchar_get_streambuf_delim(this, strbuf, '\n');
8684 }
8685
8686 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
8687 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
8688 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
8689 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
8690 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline_delim, 16)
8691 basic_istream_wchar* __thiscall basic_istream_wchar_getline_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
8692 {
8693     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8694     unsigned short ch = delim;
8695
8696     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
8697
8698     this->count = 0;
8699
8700     if(basic_istream_wchar_sentry_create(this, TRUE) && count>0) {
8701         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8702
8703         while(count > 1) {
8704             ch = basic_streambuf_wchar_sbumpc(strbuf);
8705
8706             if(ch==WEOF || ch==delim)
8707                 break;
8708
8709             *str++ = ch;
8710             this->count++;
8711             count--;
8712         }
8713
8714         if(ch == delim)
8715             this->count++;
8716         else if(ch != WEOF) {
8717             ch = basic_streambuf_wchar_sgetc(strbuf);
8718
8719             if(ch == delim) {
8720                 basic_streambuf_wchar__Gninc(strbuf);
8721                 this->count++;
8722             }
8723         }
8724     }
8725     basic_istream_wchar_sentry_destroy(this);
8726
8727     basic_ios_wchar_setstate(base, (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
8728             (!this->count || (ch!=delim && ch!=WEOF) ? IOSTATE_failbit : IOSTATE_goodbit));
8729     if(count > 0)
8730         *str = 0;
8731     return this;
8732 }
8733
8734 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8735 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8736 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8737 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8738 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline, 12)
8739 basic_istream_wchar* __thiscall basic_istream_wchar_getline(basic_istream_wchar *this, wchar_t *str, streamsize count)
8740 {
8741     return basic_istream_wchar_getline_delim(this, str, count, '\n');
8742 }
8743
8744 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@HG@Z */
8745 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JG@Z */
8746 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@HG@Z */
8747 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JG@Z */
8748 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ignore, 12)
8749 basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar *this, streamsize count, unsigned short delim)
8750 {
8751     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8752     unsigned short ch = delim;
8753
8754     TRACE("(%p %ld %d)\n", this, count, delim);
8755
8756     this->count = 0;
8757
8758     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8759         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8760
8761         while(count > 0) {
8762             ch = basic_streambuf_wchar_sbumpc(strbuf);
8763
8764             if(ch==WEOF || ch==delim)
8765                 break;
8766
8767             this->count++;
8768             if(count != INT_MAX)
8769                 count--;
8770         }
8771     }
8772     basic_istream_wchar_sentry_destroy(this);
8773
8774     if(ch == WEOF)
8775         basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8776     return this;
8777 }
8778
8779 /* ?ws@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
8780 /* ?ws@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
8781 /* ?ws@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@1@AAV21@@Z */
8782 /* ?ws@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
8783 basic_istream_wchar* __cdecl ws_basic_istream_wchar(basic_istream_wchar *istream)
8784 {
8785     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
8786     unsigned short ch = '\n';
8787
8788     TRACE("(%p)\n", istream);
8789
8790     if(basic_istream_wchar_sentry_create(istream, TRUE)) {
8791         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8792         const ctype_wchar *ctype = ctype_wchar_use_facet(strbuf->loc);
8793
8794         for(ch = basic_streambuf_wchar_sgetc(strbuf); ctype_wchar_is_ch(ctype, _SPACE, ch);
8795                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8796             if(ch == WEOF)
8797                 break;
8798         }
8799     }
8800     basic_istream_wchar_sentry_destroy(istream);
8801
8802     if(ch == WEOF)
8803         basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8804     return istream;
8805 }
8806
8807 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
8808 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
8809 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
8810 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
8811 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_peek, 4)
8812 unsigned short __thiscall basic_istream_wchar_peek(basic_istream_wchar *this)
8813 {
8814     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8815     unsigned short ret = WEOF;
8816
8817     TRACE("(%p)\n", this);
8818
8819     this->count = 0;
8820
8821     if(basic_istream_wchar_sentry_create(this, TRUE))
8822         ret = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
8823     basic_istream_wchar_sentry_destroy(this);
8824     return ret;
8825 }
8826
8827 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WIH@Z */
8828 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_K_J@Z */
8829 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGIH@Z */
8830 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_K_J@Z */
8831 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Read_s, 16)
8832 basic_istream_wchar* __thiscall basic_istream_wchar__Read_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
8833 {
8834     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8835     IOSB_iostate state = IOSTATE_goodbit;
8836
8837     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
8838
8839     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8840         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8841
8842         this->count = basic_streambuf_wchar__Sgetn_s(strbuf, str, size, count);
8843         if(this->count != count)
8844             state |= IOSTATE_failbit | IOSTATE_eofbit;
8845     }else {
8846         this->count = 0;
8847     }
8848     basic_istream_wchar_sentry_destroy(this);
8849
8850     basic_ios_wchar_setstate(base, state);
8851     return this;
8852 }
8853
8854 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8855 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8856 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8857 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8858 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read, 12)
8859 basic_istream_wchar* __thiscall basic_istream_wchar_read(basic_istream_wchar *this, wchar_t *str, streamsize count)
8860 {
8861     return basic_istream_wchar__Read_s(this, str, count, count);
8862 }
8863
8864 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
8865 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
8866 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
8867 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
8868 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Readsome_s, 16)
8869 streamsize __thiscall basic_istream_wchar__Readsome_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
8870 {
8871     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8872     IOSB_iostate state = IOSTATE_goodbit;
8873
8874     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
8875
8876     this->count = 0;
8877
8878     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8879         streamsize avail = basic_streambuf_wchar_in_avail(basic_ios_wchar_rdbuf_get(base));
8880         if(avail > count)
8881             avail = count;
8882
8883         if(avail == -1)
8884             state |= IOSTATE_eofbit;
8885         else if(avail > 0)
8886             basic_istream_wchar__Read_s(this, str, size, avail);
8887     }else {
8888         state |= IOSTATE_failbit;
8889     }
8890     basic_istream_wchar_sentry_destroy(this);
8891
8892     basic_ios_wchar_setstate(base, state);
8893     return this->count;
8894 }
8895
8896 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
8897 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
8898 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
8899 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
8900 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_readsome, 12)
8901 streamsize __thiscall basic_istream_wchar_readsome(basic_istream_wchar *this, wchar_t *str, streamsize count)
8902 {
8903     return basic_istream_wchar__Readsome_s(this, str, count, count);
8904 }
8905
8906 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
8907 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
8908 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
8909 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
8910 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_putback, 8)
8911 basic_istream_wchar* __thiscall basic_istream_wchar_putback(basic_istream_wchar *this, wchar_t ch)
8912 {
8913     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8914     IOSB_iostate state = IOSTATE_goodbit;
8915
8916     TRACE("(%p %c)\n", this, ch);
8917
8918     this->count = 0;
8919
8920     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8921         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8922
8923         if(!ios_base_good(&base->base))
8924             state |= IOSTATE_failbit;
8925         else if(!strbuf || basic_streambuf_wchar_sputbackc(strbuf, ch)==WEOF)
8926             state |= IOSTATE_badbit;
8927     }
8928     basic_istream_wchar_sentry_destroy(this);
8929
8930     basic_ios_wchar_setstate(base, state);
8931     return this;
8932 }
8933
8934 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
8935 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
8936 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
8937 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
8938 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_unget, 4)
8939 basic_istream_wchar* __thiscall basic_istream_wchar_unget(basic_istream_wchar *this)
8940 {
8941     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8942     IOSB_iostate state = IOSTATE_goodbit;
8943
8944     TRACE("(%p)\n", this);
8945
8946     this->count = 0;
8947
8948     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8949         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8950
8951         if(!ios_base_good(&base->base))
8952             state |= IOSTATE_failbit;
8953         else if(!strbuf || basic_streambuf_wchar_sungetc(strbuf)==WEOF)
8954             state |= IOSTATE_badbit;
8955     }
8956     basic_istream_wchar_sentry_destroy(this);
8957
8958     basic_ios_wchar_setstate(base, state);
8959     return this;
8960 }
8961
8962 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
8963 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
8964 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHXZ */
8965 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAHXZ */
8966 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_sync, 4)
8967 int __thiscall basic_istream_wchar_sync(basic_istream_wchar *this)
8968 {
8969     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8970     basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8971
8972     TRACE("(%p)\n", this);
8973
8974     if(!strbuf)
8975         return -1;
8976
8977     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8978         if(basic_streambuf_wchar_pubsync(strbuf) != -1) {
8979             basic_istream_wchar_sentry_destroy(this);
8980             return 0;
8981         }
8982     }
8983     basic_istream_wchar_sentry_destroy(this);
8984
8985     basic_ios_wchar_setstate(base, IOSTATE_badbit);
8986     return -1;
8987 }
8988
8989 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
8990 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
8991 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
8992 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
8993 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_tellg, 8)
8994 fpos_int* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, fpos_int *ret)
8995 {
8996     TRACE("(%p %p)\n", this, ret);
8997
8998     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8999         basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9000         if(!ios_base_fail(&base->base)) {
9001             basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
9002                     ret, 0, SEEKDIR_cur, OPENMODE_in);
9003             basic_istream_wchar_sentry_destroy(this);
9004
9005             if(ret->off==0 && ret->pos==-1 && ret->state==0)
9006                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
9007             return ret;
9008         }
9009     }
9010     basic_istream_wchar_sentry_destroy(this);
9011
9012     ret->off = 0;
9013     ret->pos = -1;
9014     ret->state = 0;
9015     return ret;
9016 }
9017
9018 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
9019 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
9020 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
9021 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
9022 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg, 12)
9023 basic_istream_wchar* __thiscall basic_istream_wchar_seekg(basic_istream_wchar *this, streamoff off, int dir)
9024 {
9025     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9026
9027     TRACE("(%p %ld %d)\n", this, off, dir);
9028
9029     if(basic_istream_wchar_sentry_create(this, TRUE)) {
9030         if(!ios_base_fail(&base->base)) {
9031             basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9032             fpos_int ret;
9033
9034             basic_streambuf_wchar_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
9035             basic_istream_wchar_sentry_destroy(this);
9036
9037             if(ret.off==0 && ret.pos==-1 && ret.state==0)
9038                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
9039             else
9040                 basic_ios_wchar_clear(base, IOSTATE_goodbit);
9041             return this;
9042         }
9043     }
9044     basic_istream_wchar_sentry_destroy(this);
9045
9046     basic_ios_wchar_setstate(base, IOSTATE_failbit);
9047     return this;
9048 }
9049
9050 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
9051 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
9052 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
9053 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
9054 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg_fpos, 28)
9055 basic_istream_wchar* __thiscall basic_istream_wchar_seekg_fpos(basic_istream_wchar *this, fpos_int pos)
9056 {
9057     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9058
9059     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
9060
9061     if(basic_istream_wchar_sentry_create(this, TRUE)) {
9062         if(!ios_base_fail(&base->base)) {
9063             basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9064             fpos_int ret;
9065
9066             basic_streambuf_wchar_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
9067             basic_istream_wchar_sentry_destroy(this);
9068
9069             if(ret.off==0 && ret.pos==-1 && ret.state==0)
9070                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
9071             else
9072                 basic_ios_wchar_clear(base, IOSTATE_goodbit);
9073             return this;
9074         }
9075     }
9076     basic_istream_wchar_sentry_destroy(this);
9077
9078     basic_ios_wchar_setstate(base, IOSTATE_failbit);
9079     return this;
9080 }
9081
9082 static basic_istream_wchar* basic_istream_read_short(basic_istream_wchar *this, short *v, const num_get *numget)
9083 {
9084     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9085     int state = IOSTATE_goodbit;
9086
9087     TRACE("(%p %p)\n", this, v);
9088
9089     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9090         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9091         istreambuf_iterator_wchar first={0}, last={0};
9092         LONG tmp;
9093
9094         first.strbuf = strbuf;
9095         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, &tmp);
9096
9097         if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
9098             *v = tmp;
9099         else
9100             state |= IOSTATE_failbit;
9101     }
9102     basic_istream_wchar_sentry_destroy(this);
9103
9104     basic_ios_wchar_setstate(base, state);
9105     return this;
9106 }
9107
9108 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAF@Z */
9109 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAF@Z */
9110 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_short, 8)
9111 basic_istream_wchar* __thiscall basic_istream_wchar_read_short(basic_istream_wchar *this, short *v)
9112 {
9113     return basic_istream_read_short(this, v, num_get_wchar_use_facet(
9114                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9115 }
9116
9117 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAF@Z */
9118 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAF@Z */
9119 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_short, 8)
9120 basic_istream_wchar* __thiscall basic_istream_short_read_short(basic_istream_wchar *this, short *v)
9121 {
9122     return basic_istream_read_short(this, v, num_get_short_use_facet(
9123                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9124 }
9125
9126 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAG@Z */
9127 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAG@Z */
9128 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ushort, 8)
9129 basic_istream_wchar* __thiscall basic_istream_wchar_read_ushort(basic_istream_wchar *this, unsigned short *v)
9130 {
9131     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9132     int state = IOSTATE_goodbit;
9133
9134     TRACE("(%p %p)\n", this, v);
9135
9136     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9137         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9138         const num_get *numget = num_get_wchar_use_facet(strbuf->loc);
9139         istreambuf_iterator_wchar first={0}, last={0};
9140
9141         first.strbuf = strbuf;
9142         num_get_wchar_get_ushort(numget, &last, first, last, &base->base, &state, v);
9143     }
9144     basic_istream_wchar_sentry_destroy(this);
9145
9146     basic_ios_wchar_setstate(base, state);
9147     return this;
9148 }
9149
9150 static basic_istream_wchar* basic_istream_read_int(basic_istream_wchar *this, int *v, const num_get *numget)
9151 {
9152     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9153     int state = IOSTATE_goodbit;
9154
9155     TRACE("(%p %p)\n", this, v);
9156
9157     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9158         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9159         istreambuf_iterator_wchar first={0}, last={0};
9160
9161         first.strbuf = strbuf;
9162         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
9163     }
9164     basic_istream_wchar_sentry_destroy(this);
9165
9166     basic_ios_wchar_setstate(base, state);
9167     return this;
9168 }
9169
9170 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAH@Z */
9171 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAH@Z */
9172 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int, 8)
9173 basic_istream_wchar* __thiscall basic_istream_wchar_read_int(basic_istream_wchar *this, int *v)
9174 {
9175     return basic_istream_read_int(this, v, num_get_wchar_use_facet(
9176                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9177 }
9178
9179 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAH@Z */
9180 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAH@Z */
9181 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int, 8)
9182 basic_istream_wchar* __thiscall basic_istream_short_read_int(basic_istream_wchar *this, int *v)
9183 {
9184     return basic_istream_read_int(this, v, num_get_short_use_facet(
9185                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9186 }
9187
9188 static basic_istream_wchar* basic_istream_read_uint(basic_istream_wchar *this, unsigned int *v, const num_get *numget)
9189 {
9190     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9191     int state = IOSTATE_goodbit;
9192
9193     TRACE("(%p %p)\n", this, v);
9194
9195     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9196         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9197         istreambuf_iterator_wchar first={0}, last={0};
9198
9199         first.strbuf = strbuf;
9200         num_get_wchar_get_uint(numget, &last, first, last, &base->base, &state, v);
9201     }
9202     basic_istream_wchar_sentry_destroy(this);
9203
9204     basic_ios_wchar_setstate(base, state);
9205     return this;
9206 }
9207
9208 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAI@Z */
9209 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAI@Z */
9210 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint, 8)
9211 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint(basic_istream_wchar *this, unsigned int *v)
9212 {
9213     return basic_istream_read_uint(this, v, num_get_wchar_use_facet(
9214                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9215 }
9216
9217 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAI@Z */
9218 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAI@Z */
9219 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint, 8)
9220 basic_istream_wchar* __thiscall basic_istream_short_read_uint(basic_istream_wchar *this, unsigned int *v)
9221 {
9222     return basic_istream_read_uint(this, v, num_get_short_use_facet(
9223                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9224 }
9225
9226 static basic_istream_wchar* basic_istream_read_long(basic_istream_wchar *this, LONG *v, const num_get *numget)
9227 {
9228     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9229     int state = IOSTATE_goodbit;
9230
9231     TRACE("(%p %p)\n", this, v);
9232
9233     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9234         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9235         istreambuf_iterator_wchar first={0}, last={0};
9236
9237         first.strbuf = strbuf;
9238         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
9239     }
9240     basic_istream_wchar_sentry_destroy(this);
9241
9242     basic_ios_wchar_setstate(base, state);
9243     return this;
9244 }
9245
9246 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
9247 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
9248 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_long, 8)
9249 basic_istream_wchar* __thiscall basic_istream_wchar_read_long(basic_istream_wchar *this, LONG *v)
9250 {
9251     return basic_istream_read_long(this, v, num_get_wchar_use_facet(
9252                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9253 }
9254
9255 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
9256 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
9257 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_long, 8)
9258 basic_istream_wchar* __thiscall basic_istream_short_read_long(basic_istream_wchar *this, LONG *v)
9259 {
9260     return basic_istream_read_long(this, v, num_get_short_use_facet(
9261                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9262 }
9263
9264 static basic_istream_wchar* basic_istream_read_ulong(basic_istream_wchar *this, ULONG *v, const num_get *numget)
9265 {
9266     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9267     int state = IOSTATE_goodbit;
9268
9269     TRACE("(%p %p)\n", this, v);
9270
9271     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9272         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9273         istreambuf_iterator_wchar first={0}, last={0};
9274
9275         first.strbuf = strbuf;
9276         num_get_wchar_get_ulong(numget, &last, first, last, &base->base, &state, v);
9277     }
9278     basic_istream_wchar_sentry_destroy(this);
9279
9280     basic_ios_wchar_setstate(base, state);
9281     return this;
9282 }
9283
9284 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAK@Z */
9285 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAK@Z */
9286 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ulong, 8)
9287 basic_istream_wchar* __thiscall basic_istream_wchar_read_ulong(basic_istream_wchar *this, ULONG *v)
9288 {
9289     return basic_istream_read_ulong(this, v, num_get_wchar_use_facet(
9290                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9291 }
9292
9293 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAK@Z */
9294 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAK@Z */
9295 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ulong, 8)
9296 basic_istream_wchar* __thiscall basic_istream_short_read_ulong(basic_istream_wchar *this, ULONG *v)
9297 {
9298     return basic_istream_read_ulong(this, v, num_get_short_use_facet(
9299                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9300 }
9301
9302 static basic_istream_wchar* basic_istream_read_float(basic_istream_wchar *this, float *v, const num_get *numget)
9303 {
9304     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9305     int state = IOSTATE_goodbit;
9306
9307     TRACE("(%p %p)\n", this, v);
9308
9309     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9310         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9311         istreambuf_iterator_wchar first={0}, last={0};
9312
9313         first.strbuf = strbuf;
9314         num_get_wchar_get_float(numget, &last, first, last, &base->base, &state, v);
9315     }
9316     basic_istream_wchar_sentry_destroy(this);
9317
9318     basic_ios_wchar_setstate(base, state);
9319     return this;
9320 }
9321
9322 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAM@Z */
9323 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAM@Z */
9324 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_float, 8)
9325 basic_istream_wchar* __thiscall basic_istream_wchar_read_float(basic_istream_wchar *this, float *v)
9326 {
9327     return basic_istream_read_float(this, v, num_get_wchar_use_facet(
9328                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9329 }
9330
9331 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAM@Z */
9332 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAM@Z */
9333 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_float, 8)
9334 basic_istream_wchar* __thiscall basic_istream_short_read_float(basic_istream_wchar *this, float *v)
9335 {
9336     return basic_istream_read_float(this, v, num_get_short_use_facet(
9337                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9338 }
9339
9340 static basic_istream_wchar* basic_istream_read_double(basic_istream_wchar *this, double *v, const num_get *numget)
9341 {
9342     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9343     int state = IOSTATE_goodbit;
9344
9345     TRACE("(%p %p)\n", this, v);
9346
9347     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9348         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9349         istreambuf_iterator_wchar first={0}, last={0};
9350
9351         first.strbuf = strbuf;
9352         num_get_wchar_get_double(numget, &last, first, last, &base->base, &state, v);
9353     }
9354     basic_istream_wchar_sentry_destroy(this);
9355
9356     basic_ios_wchar_setstate(base, state);
9357     return this;
9358 }
9359
9360 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAN@Z */
9361 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAN@Z */
9362 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_double, 8)
9363 basic_istream_wchar* __thiscall basic_istream_wchar_read_double(basic_istream_wchar *this, double *v)
9364 {
9365     return basic_istream_read_double(this, v, num_get_wchar_use_facet(
9366                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9367 }
9368
9369 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAN@Z */
9370 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAN@Z */
9371 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_double, 8)
9372 basic_istream_wchar* __thiscall basic_istream_short_read_double(basic_istream_wchar *this, double *v)
9373 {
9374     return basic_istream_read_double(this, v, num_get_short_use_facet(
9375                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9376 }
9377
9378 static basic_istream_wchar* basic_istream_read_ldouble(basic_istream_wchar *this, double *v, const num_get *numget)
9379 {
9380     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9381     int state = IOSTATE_goodbit;
9382
9383     TRACE("(%p %p)\n", this, v);
9384
9385     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9386         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9387         istreambuf_iterator_wchar first={0}, last={0};
9388
9389         first.strbuf = strbuf;
9390         num_get_wchar_get_ldouble(numget, &last, first, last, &base->base, &state, v);
9391     }
9392     basic_istream_wchar_sentry_destroy(this);
9393
9394     basic_ios_wchar_setstate(base, state);
9395     return this;
9396 }
9397
9398 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAO@Z */
9399 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAO@Z */
9400 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ldouble, 8)
9401 basic_istream_wchar* __thiscall basic_istream_wchar_read_ldouble(basic_istream_wchar *this, double *v)
9402 {
9403     return basic_istream_read_ldouble(this, v, num_get_wchar_use_facet(
9404                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9405 }
9406
9407 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAO@Z */
9408 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAO@Z */
9409 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ldouble, 8)
9410 basic_istream_wchar* __thiscall basic_istream_short_read_ldouble(basic_istream_wchar *this, double *v)
9411 {
9412     return basic_istream_read_ldouble(this, v, num_get_short_use_facet(
9413                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9414 }
9415
9416 static basic_istream_wchar* basic_istream_read_ptr(basic_istream_wchar *this, void **v, const num_get *numget)
9417 {
9418     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9419     int state = IOSTATE_goodbit;
9420
9421     TRACE("(%p %p)\n", this, v);
9422
9423     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9424         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9425         istreambuf_iterator_wchar first={0}, last={0};
9426
9427         first.strbuf = strbuf;
9428         num_get_wchar_get_void(numget, &last, first, last, &base->base, &state, v);
9429     }
9430     basic_istream_wchar_sentry_destroy(this);
9431
9432     basic_ios_wchar_setstate(base, state);
9433     return this;
9434 }
9435
9436 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAPAX@Z */
9437 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
9438 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ptr, 8)
9439 basic_istream_wchar* __thiscall basic_istream_wchar_read_ptr(basic_istream_wchar *this, void **v)
9440 {
9441     return basic_istream_read_ptr(this, v, num_get_wchar_use_facet(
9442                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9443 }
9444
9445 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAPAX@Z */
9446 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
9447 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ptr, 8)
9448 basic_istream_wchar* __thiscall basic_istream_short_read_ptr(basic_istream_wchar *this, void **v)
9449 {
9450     return basic_istream_read_ptr(this, v, num_get_short_use_facet(
9451                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9452 }
9453
9454 static basic_istream_wchar* basic_istream_read_int64(basic_istream_wchar *this, __int64 *v, const num_get *numget)
9455 {
9456     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9457     int state = IOSTATE_goodbit;
9458
9459     TRACE("(%p %p)\n", this, v);
9460
9461     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9462         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9463         istreambuf_iterator_wchar first={0}, last={0};
9464
9465         first.strbuf = strbuf;
9466         num_get_wchar_get_int64(numget, &last, first, last, &base->base, &state, v);
9467     }
9468     basic_istream_wchar_sentry_destroy(this);
9469
9470     basic_ios_wchar_setstate(base, state);
9471     return this;
9472 }
9473
9474 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_J@Z */
9475 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_J@Z */
9476 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int64, 8)
9477 basic_istream_wchar* __thiscall basic_istream_wchar_read_int64(basic_istream_wchar *this, __int64 *v)
9478 {
9479     return basic_istream_read_int64(this, v, num_get_wchar_use_facet(
9480                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9481 }
9482
9483 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_J@Z */
9484 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_J@Z */
9485 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int64, 8)
9486 basic_istream_wchar* __thiscall basic_istream_short_read_int64(basic_istream_wchar *this, __int64 *v)
9487 {
9488     return basic_istream_read_int64(this, v, num_get_short_use_facet(
9489                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9490 }
9491
9492 static basic_istream_wchar* basic_istream_read_uint64(basic_istream_wchar *this, unsigned __int64 *v, const num_get *numget)
9493 {
9494     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9495     int state = IOSTATE_goodbit;
9496
9497     TRACE("(%p %p)\n", this, v);
9498
9499     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9500         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9501         istreambuf_iterator_wchar first={0}, last={0};
9502
9503         first.strbuf = strbuf;
9504         num_get_wchar_get_uint64(numget, &last, first, last, &base->base, &state, v);
9505     }
9506     basic_istream_wchar_sentry_destroy(this);
9507
9508     basic_ios_wchar_setstate(base, state);
9509     return this;
9510 }
9511
9512 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_K@Z */
9513 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_K@Z */
9514 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint64, 8)
9515 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
9516 {
9517     return basic_istream_read_uint64(this, v, num_get_wchar_use_facet(
9518                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9519 }
9520
9521 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_K@Z */
9522 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_K@Z */
9523 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint64, 8)
9524 basic_istream_wchar* __thiscall basic_istream_short_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
9525 {
9526     return basic_istream_read_uint64(this, v, num_get_short_use_facet(
9527                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9528 }
9529
9530 static basic_istream_wchar* basic_istream_read_bool(basic_istream_wchar *this, MSVCP_bool *v, const num_get *numget)
9531 {
9532     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9533     int state = IOSTATE_goodbit;
9534
9535     TRACE("(%p %p)\n", this, v);
9536
9537     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9538         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9539         istreambuf_iterator_wchar first={0}, last={0};
9540
9541         first.strbuf = strbuf;
9542         num_get_wchar_get_bool(numget, &last, first, last, &base->base, &state, v);
9543     }
9544     basic_istream_wchar_sentry_destroy(this);
9545
9546     basic_ios_wchar_setstate(base, state);
9547     return this;
9548 }
9549
9550 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_N@Z */
9551 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_N@Z */
9552 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_bool, 8)
9553 basic_istream_wchar* __thiscall basic_istream_wchar_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
9554 {
9555     return basic_istream_read_bool(this, v, num_get_wchar_use_facet(
9556                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9557 }
9558
9559 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_N@Z */
9560 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_N@Z */
9561 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_bool, 8)
9562 basic_istream_wchar* __thiscall basic_istream_short_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
9563 {
9564     return basic_istream_read_bool(this, v, num_get_short_use_facet(
9565                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9566 }
9567
9568 /* ??$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 */
9569 /* ??$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 */
9570 /* ??$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 */
9571 /* ??$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 */
9572 basic_istream_wchar* __cdecl basic_istream_wchar_getline_bstr_delim(
9573         basic_istream_wchar *istream, basic_string_wchar *str, wchar_t delim)
9574 {
9575     IOSB_iostate state = IOSTATE_failbit;
9576     int c = delim;
9577
9578     TRACE("(%p %p %c)\n", istream, str, delim);
9579
9580     if(basic_istream_wchar_sentry_create(istream, TRUE)) {
9581         MSVCP_basic_string_wchar_clear(str);
9582
9583         c = basic_istream_wchar_get(istream);
9584         if(c != WEOF)
9585             state = IOSTATE_goodbit;
9586
9587         for(; c!=delim && c!=WEOF; c = basic_istream_wchar_get(istream)) {
9588             state = IOSTATE_goodbit;
9589             MSVCP_basic_string_wchar_append_ch(str, c);
9590         }
9591     }
9592     basic_istream_wchar_sentry_destroy(istream);
9593
9594     basic_ios_wchar_setstate(basic_istream_wchar_get_basic_ios(istream),
9595             state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9596     return istream;
9597 }
9598
9599 /* ??$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 */
9600 /* ??$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 */
9601 /* ??$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 */
9602 /* ??$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 */
9603 basic_istream_wchar* __cdecl basic_istream_wchar_getline_bstr(
9604         basic_istream_wchar *istream, basic_string_wchar *str)
9605 {
9606     return basic_istream_wchar_getline_bstr_delim(istream, str, '\n');
9607 }
9608
9609 static basic_istream_wchar* basic_istream_read_bstr(basic_istream_wchar *istream,
9610         basic_string_wchar *str, const ctype_wchar *ctype)
9611 {
9612     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9613     IOSB_iostate state = IOSTATE_failbit;
9614     int c = '\n';
9615
9616     TRACE("(%p %p)\n", istream, str);
9617
9618     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9619         MSVCP_size_t count = ios_base_width_get(&base->base);
9620
9621         if(!count)
9622             count = -1;
9623
9624         MSVCP_basic_string_wchar_clear(str);
9625
9626         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
9627                 c!=WEOF && !ctype_wchar_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
9628                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base)), count--) {
9629             state = IOSTATE_goodbit;
9630             MSVCP_basic_string_wchar_append_ch(str, c);
9631         }
9632     }
9633     basic_istream_wchar_sentry_destroy(istream);
9634
9635     ios_base_width_set(&base->base, 0);
9636     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9637     return istream;
9638 }
9639
9640 /* ??$?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 */
9641 /* ??$?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 */
9642 basic_istream_wchar* __cdecl basic_istream_wchar_read_bstr(
9643         basic_istream_wchar *istream, basic_string_wchar *str)
9644 {
9645     return basic_istream_read_bstr(istream, str, ctype_wchar_use_facet(
9646                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9647 }
9648
9649 /* ??$?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 */
9650 /* ??$?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 */
9651 basic_istream_wchar* __cdecl basic_istream_short_read_bstr(
9652         basic_istream_wchar *istream, basic_string_wchar *str)
9653 {
9654     return basic_istream_read_bstr(istream, str, ctype_short_use_facet(
9655                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9656 }
9657
9658 static basic_istream_wchar* basic_istream_read_str(basic_istream_wchar *istream, wchar_t *str, const ctype_wchar *ctype)
9659 {
9660     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9661     IOSB_iostate state = IOSTATE_failbit;
9662     unsigned short c = '\n';
9663
9664     TRACE("(%p %p)\n", istream, str);
9665
9666     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9667         MSVCP_size_t count = ios_base_width_get(&base->base)-1;
9668
9669         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
9670                 c!=WEOF && !ctype_wchar_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
9671                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base)), count--) {
9672             state = IOSTATE_goodbit;
9673             *str++ = c;
9674         }
9675     }
9676     basic_istream_wchar_sentry_destroy(istream);
9677
9678     *str = 0;
9679     ios_base_width_set(&base->base, 0);
9680     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9681     return istream;
9682 }
9683
9684 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@PA_W@Z */
9685 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@PEA_W@Z */
9686 basic_istream_wchar* __cdecl basic_istream_wchar_read_str(basic_istream_wchar *istream, wchar_t *str)
9687 {
9688     return basic_istream_read_str(istream, str, ctype_wchar_use_facet(
9689                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9690 }
9691
9692 /* ??$?5GU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@PAG@Z */
9693 /* ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@PEAG@Z */
9694 basic_istream_wchar* __cdecl basic_istream_short_read_str(basic_istream_wchar *istream, wchar_t *str)
9695 {
9696     return basic_istream_read_str(istream, str, ctype_short_use_facet(
9697                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9698 }
9699
9700 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AA_W@Z */
9701 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEA_W@Z */
9702 /* ??$?5GU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAG@Z */
9703 /* ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAG@Z */
9704 basic_istream_wchar* __cdecl basic_istream_wchar_read_ch(basic_istream_wchar *istream, wchar_t *ch)
9705 {
9706     IOSB_iostate state = IOSTATE_failbit;
9707     unsigned short c = 0;
9708
9709     TRACE("(%p %p)\n", istream, ch);
9710
9711     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9712         c = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(
9713                     basic_istream_wchar_get_basic_ios(istream)));
9714         if(c != WEOF) {
9715             state = IOSTATE_goodbit;
9716             *ch = c;
9717         }
9718     }
9719     basic_istream_wchar_sentry_destroy(istream);
9720
9721     basic_ios_wchar_setstate(basic_istream_wchar_get_basic_ios(istream),
9722             state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9723     return istream;
9724 }
9725
9726 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9727 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9728 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9729 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9730 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_streambuf, 8)
9731 basic_istream_wchar* __thiscall basic_istream_wchar_read_streambuf(
9732         basic_istream_wchar *this, basic_streambuf_wchar *streambuf)
9733 {
9734     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9735     IOSB_iostate state = IOSTATE_failbit;
9736     unsigned short c = '\n';
9737
9738     TRACE("(%p %p)\n", this, streambuf);
9739
9740     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9741         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base)); c!=WEOF;
9742                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base))) {
9743             state = IOSTATE_goodbit;
9744             if(basic_streambuf_wchar_sputc(streambuf, c) == WEOF)
9745                 break;
9746         }
9747     }
9748     basic_istream_wchar_sentry_destroy(this);
9749
9750     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9751     return this;
9752 }
9753
9754 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
9755 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
9756 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
9757 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
9758 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func, 8)
9759 basic_istream_wchar* __thiscall basic_istream_wchar_read_func(basic_istream_wchar *this,
9760         basic_istream_wchar* (__cdecl *pfunc)(basic_istream_wchar*))
9761 {
9762     TRACE("(%p %p)\n", this, pfunc);
9763     pfunc(this);
9764     return this;
9765 }
9766
9767 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
9768 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
9769 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
9770 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
9771 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_basic_ios, 8)
9772 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_basic_ios(basic_istream_wchar *this,
9773         basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
9774 {
9775     TRACE("(%p %p)\n", this, pfunc);
9776     pfunc(basic_istream_wchar_get_basic_ios(this));
9777     return this;
9778 }
9779
9780 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
9781 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
9782 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
9783 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
9784 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_ios_base, 8)
9785 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_ios_base(
9786         basic_istream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
9787 {
9788     TRACE("(%p %p)\n", this, pfunc);
9789     pfunc(&basic_istream_wchar_get_basic_ios(this)->base);
9790     return this;
9791 }
9792
9793 static inline basic_ios_char* basic_iostream_char_to_basic_ios(basic_iostream_char *ptr)
9794 {
9795     return (basic_ios_char*)((char*)ptr+basic_iostream_char_vbtable1[1]);
9796 }
9797
9798 static inline basic_iostream_char* basic_iostream_char_from_basic_ios(basic_ios_char *ptr)
9799 {
9800     return (basic_iostream_char*)((char*)ptr-basic_iostream_char_vbtable1[1]);
9801 }
9802
9803 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
9804 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
9805 DEFINE_THISCALL_WRAPPER(basic_iostream_char_ctor, 12)
9806 basic_iostream_char* __thiscall basic_iostream_char_ctor(basic_iostream_char *this, basic_streambuf_char *strbuf, MSVCP_bool virt_init)
9807 {
9808     basic_ios_char *basic_ios;
9809
9810     TRACE("(%p %p %d)\n", this, strbuf, virt_init);
9811
9812     if(virt_init) {
9813         this->base1.vbtable = basic_iostream_char_vbtable1;
9814         this->base2.vbtable = basic_iostream_char_vbtable2;
9815         basic_ios = basic_istream_char_get_basic_ios(&this->base1);
9816         basic_ios_char_ctor(basic_ios);
9817     }else {
9818         basic_ios = basic_istream_char_get_basic_ios(&this->base1);
9819     }
9820
9821     basic_ios->base.vtable = &MSVCP_basic_iostream_char_vtable;
9822
9823     basic_istream_char_ctor(&this->base1, strbuf, FALSE, FALSE);
9824     basic_ostream_char_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
9825     return this;
9826 }
9827
9828 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
9829 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
9830 DEFINE_THISCALL_WRAPPER(basic_iostream_char_dtor, 4)
9831 void __thiscall basic_iostream_char_dtor(basic_ios_char *base)
9832 {
9833     basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
9834
9835     TRACE("(%p)\n", this);
9836     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base2));
9837     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base1));
9838 }
9839
9840 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
9841 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
9842 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vbase_dtor, 4)
9843 void __thiscall basic_iostream_char_vbase_dtor(basic_iostream_char *this)
9844 {
9845     TRACE("(%p)\n", this);
9846     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(this));
9847     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base1));
9848 }
9849
9850 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vector_dtor, 8)
9851 basic_iostream_char* __thiscall basic_iostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
9852 {
9853     basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
9854
9855     TRACE("(%p %x)\n", this, flags);
9856
9857     if(flags & 2) {
9858         /* we have an array, with the number of elements stored before the first object */
9859         INT_PTR i, *ptr = (INT_PTR *)this-1;
9860
9861         for(i=*ptr-1; i>=0; i--)
9862             basic_iostream_char_vbase_dtor(this+i);
9863         MSVCRT_operator_delete(ptr);
9864     } else {
9865         basic_iostream_char_vbase_dtor(this);
9866         if(flags & 1)
9867             MSVCRT_operator_delete(this);
9868     }
9869
9870     return this;
9871 }
9872
9873 static inline basic_ios_wchar* basic_iostream_wchar_to_basic_ios(basic_iostream_wchar *ptr)
9874 {
9875     return (basic_ios_wchar*)((char*)ptr+basic_iostream_wchar_vbtable1[1]);
9876 }
9877
9878 static inline basic_iostream_wchar* basic_iostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
9879 {
9880     return (basic_iostream_wchar*)((char*)ptr-basic_iostream_wchar_vbtable1[1]);
9881 }
9882
9883 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9884 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9885 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_ctor, 12)
9886 basic_iostream_wchar* __thiscall basic_iostream_wchar_ctor(basic_iostream_wchar *this,
9887         basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
9888 {
9889     basic_ios_wchar *basic_ios;
9890
9891     TRACE("(%p %p %d)\n", this, strbuf, virt_init);
9892
9893     if(virt_init) {
9894         this->base1.vbtable = basic_iostream_wchar_vbtable1;
9895         this->base2.vbtable = basic_iostream_wchar_vbtable2;
9896         basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
9897         basic_ios_wchar_ctor(basic_ios);
9898     }else {
9899         basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
9900     }
9901
9902     basic_istream_wchar_ctor(&this->base1, strbuf, FALSE, FALSE);
9903     basic_ostream_wchar_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
9904
9905     basic_ios->base.vtable = &MSVCP_basic_iostream_wchar_vtable;
9906     return this;
9907 }
9908
9909 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9910 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9911 DEFINE_THISCALL_WRAPPER(basic_iostream_short_ctor, 12)
9912 basic_iostream_wchar* __thiscall basic_iostream_short_ctor(basic_iostream_wchar *this,
9913         basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
9914 {
9915     basic_iostream_wchar_ctor(this, strbuf, virt_init);
9916     basic_istream_wchar_get_basic_ios(&this->base1)->base.vtable = &MSVCP_basic_iostream_short_vtable;
9917     return this;
9918 }
9919
9920 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
9921 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
9922 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
9923 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
9924 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_dtor, 4)
9925 void __thiscall basic_iostream_wchar_dtor(basic_ios_wchar *base)
9926 {
9927     basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
9928
9929     TRACE("(%p)\n", this);
9930     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base2));
9931     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base1));
9932 }
9933
9934 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
9935 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
9936 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
9937 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
9938 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vbase_dtor, 4)
9939 void __thiscall basic_iostream_wchar_vbase_dtor(basic_iostream_wchar *this)
9940 {
9941     TRACE("(%p)\n", this);
9942     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(this));
9943     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base1));
9944 }
9945
9946 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vector_dtor, 8)
9947 basic_iostream_wchar* __thiscall basic_iostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
9948 {
9949     basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
9950
9951     TRACE("(%p %x)\n", this, flags);
9952
9953     if(flags & 2) {
9954         /* we have an array, with the number of elements stored before the first object */
9955         INT_PTR i, *ptr = (INT_PTR *)this-1;
9956
9957         for(i=*ptr-1; i>=0; i--)
9958             basic_iostream_wchar_vbase_dtor(this+i);
9959         MSVCRT_operator_delete(ptr);
9960     } else {
9961         basic_iostream_wchar_vbase_dtor(this);
9962         if(flags & 1)
9963             MSVCRT_operator_delete(this);
9964     }
9965
9966     return this;
9967 }
9968
9969 static inline basic_ios_char* basic_ofstream_char_to_basic_ios(basic_ofstream_char *ptr)
9970 {
9971     return (basic_ios_char*)((char*)ptr+basic_ofstream_char_vbtable[1]);
9972 }
9973
9974 static inline basic_ofstream_char* basic_ofstream_char_from_basic_ios(basic_ios_char *ptr)
9975 {
9976     return (basic_ofstream_char*)((char*)ptr-basic_ofstream_char_vbtable[1]);
9977 }
9978
9979 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
9980 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
9981 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor, 8)
9982 basic_ofstream_char* __thiscall basic_ofstream_char_ctor(basic_ofstream_char *this, MSVCP_bool virt_init)
9983 {
9984     basic_ios_char *basic_ios;
9985
9986     TRACE("(%p %d)\n", this, virt_init);
9987
9988     if(virt_init) {
9989         this->base.vbtable = basic_ofstream_char_vbtable;
9990         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9991         basic_ios_char_ctor(basic_ios);
9992     }else {
9993         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9994     }
9995
9996     basic_filebuf_char_ctor(&this->filebuf);
9997     basic_ostream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
9998     basic_ios->base.vtable = &MSVCP_basic_ofstream_char_vtable;
9999     return this;
10000 }
10001
10002 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
10003 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10004 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_file, 12)
10005 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_file(
10006         basic_ofstream_char *this, FILE *file, MSVCP_bool virt_init)
10007 {
10008     basic_ios_char *basic_ios;
10009
10010     TRACE("(%p %p %d)\n", this, file, virt_init);
10011
10012     if(virt_init) {
10013         this->base.vbtable = basic_ofstream_char_vbtable;
10014         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10015         basic_ios_char_ctor(basic_ios);
10016     }else {
10017         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10018     }
10019
10020     basic_filebuf_char_ctor_file(&this->filebuf, file);
10021     basic_ostream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10022     basic_ios->base.vtable = &MSVCP_basic_ofstream_char_vtable;
10023     return this;
10024 }
10025
10026 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
10027 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
10028 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_name, 20)
10029 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_name(basic_ofstream_char *this,
10030         const char *name, int mode, int prot, MSVCP_bool virt_init)
10031 {
10032     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10033
10034     basic_ofstream_char_ctor(this, virt_init);
10035
10036     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10037         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10038         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10039     }
10040     return this;
10041 }
10042
10043 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
10044 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
10045 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
10046 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
10047 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_name_wchar, 20)
10048 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_name_wchar(basic_ofstream_char *this,
10049         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10050 {
10051     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10052
10053     basic_ofstream_char_ctor(this, virt_init);
10054
10055     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10056         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10057         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10058     }
10059     return this;
10060 }
10061
10062 /* ??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
10063 /* ??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
10064 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_dtor, 4)
10065 void __thiscall basic_ofstream_char_dtor(basic_ios_char *base)
10066 {
10067     basic_ofstream_char *this = basic_ofstream_char_from_basic_ios(base);
10068
10069     TRACE("(%p)\n", this);
10070
10071     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
10072     basic_filebuf_char_dtor(&this->filebuf);
10073 }
10074
10075 /* ??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10076 /* ??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10077 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_vbase_dtor, 4)
10078 void __thiscall basic_ofstream_char_vbase_dtor(basic_ofstream_char *this)
10079 {
10080     TRACE("(%p)\n", this);
10081
10082     basic_ofstream_char_dtor(basic_ofstream_char_to_basic_ios(this));
10083     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
10084 }
10085
10086 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_vector_dtor, 8)
10087 basic_ofstream_char* __thiscall basic_ofstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
10088 {
10089     basic_ofstream_char *this = basic_ofstream_char_from_basic_ios(base);
10090
10091     TRACE("(%p %x)\n", this, flags);
10092
10093     if(flags & 2) {
10094         /* we have an array, with the number of elements stored before the first object */
10095         INT_PTR i, *ptr = (INT_PTR *)this-1;
10096
10097         for(i=*ptr-1; i>=0; i--)
10098             basic_ofstream_char_vbase_dtor(this+i);
10099         MSVCRT_operator_delete(ptr);
10100     } else {
10101         basic_ofstream_char_vbase_dtor(this);
10102         if(flags & 1)
10103             MSVCRT_operator_delete(this);
10104     }
10105
10106     return this;
10107 }
10108
10109 /* ?close@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10110 /* ?close@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10111 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_close, 4)
10112 void __thiscall basic_ofstream_char_close(basic_ofstream_char *this)
10113 {
10114     TRACE("(%p)\n", this);
10115
10116     if(!basic_filebuf_char_close(&this->filebuf)) {
10117         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10118         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10119     }
10120 }
10121
10122 /* ?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
10123 /* ?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
10124 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_is_open, 4)
10125 MSVCP_bool __thiscall basic_ofstream_char_is_open(const basic_ofstream_char *this)
10126 {
10127     TRACE("(%p)\n", this);
10128     return basic_filebuf_char_is_open(&this->filebuf);
10129 }
10130
10131 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
10132 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
10133 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open, 16)
10134 void __thiscall basic_ofstream_char_open(basic_ofstream_char *this,
10135         const char *name, int mode, int prot)
10136 {
10137     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10138
10139     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10140         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10141         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10142     }
10143 }
10144
10145 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
10146 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
10147 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_old, 12)
10148 void __thiscall basic_ofstream_char_open_old(basic_ofstream_char *this,
10149         const char *name, unsigned int mode)
10150 {
10151     basic_ofstream_char_open(this, name, mode, _SH_DENYNO);
10152 }
10153
10154 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
10155 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
10156 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
10157 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
10158 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_wchar, 16)
10159 void __thiscall basic_ofstream_char_open_wchar(basic_ofstream_char *this,
10160         const wchar_t *name, int mode, int prot)
10161 {
10162     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10163
10164     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10165         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10166         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10167     }
10168 }
10169
10170 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
10171 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
10172 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
10173 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
10174 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_wchar_old, 12)
10175 void __thiscall basic_ofstream_char_open_wchar_old(basic_ofstream_char *this,
10176         const wchar_t *name, unsigned int mode)
10177 {
10178     basic_ofstream_char_open_wchar(this, name, mode, _SH_DENYNO);
10179 }
10180
10181 /* ?rdbuf@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10182 /* ?rdbuf@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10183 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_rdbuf, 4)
10184 basic_filebuf_char* __thiscall basic_ofstream_char_rdbuf(const basic_ofstream_char *this)
10185 {
10186     TRACE("(%p)\n", this);
10187     return (basic_filebuf_char*)&this->filebuf;
10188 }
10189
10190 static inline basic_ios_wchar* basic_ofstream_wchar_to_basic_ios(basic_ofstream_wchar *ptr)
10191 {
10192     return (basic_ios_wchar*)((char*)ptr+basic_ofstream_wchar_vbtable[1]);
10193 }
10194
10195 static inline basic_ofstream_wchar* basic_ofstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
10196 {
10197     return (basic_ofstream_wchar*)((char*)ptr-basic_ofstream_wchar_vbtable[1]);
10198 }
10199
10200 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
10201 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
10202 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor, 8)
10203 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor(basic_ofstream_wchar *this, MSVCP_bool virt_init)
10204 {
10205     basic_ios_wchar *basic_ios;
10206
10207     TRACE("(%p %d)\n", this, virt_init);
10208
10209     if(virt_init) {
10210         this->base.vbtable = basic_ofstream_wchar_vbtable;
10211         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10212         basic_ios_wchar_ctor(basic_ios);
10213     }else {
10214         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10215     }
10216
10217     basic_filebuf_wchar_ctor(&this->filebuf);
10218     basic_ostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10219     basic_ios->base.vtable = &MSVCP_basic_ofstream_wchar_vtable;
10220     return this;
10221 }
10222
10223 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
10224 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
10225 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor, 8)
10226 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor(basic_ofstream_wchar *this, MSVCP_bool virt_init)
10227 {
10228     basic_ofstream_wchar_ctor(this, virt_init);
10229     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10230     return this;
10231 }
10232
10233 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
10234 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10235 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_file, 12)
10236 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_file(
10237         basic_ofstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10238 {
10239     basic_ios_wchar *basic_ios;
10240
10241     TRACE("(%p %p %d)\n", this, file, 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_file(&this->filebuf, file);
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@PAU_iobuf@@@Z */
10258 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10259 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_file, 12)
10260 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_file(
10261         basic_ofstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10262 {
10263     basic_ofstream_wchar_ctor_file(this, file, virt_init);
10264     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10265     return this;
10266 }
10267
10268 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PBDHH@Z */
10269 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBDHH@Z */
10270 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_name, 20)
10271 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_name(basic_ofstream_wchar *this,
10272         const char *name, int mode, int prot, MSVCP_bool virt_init)
10273 {
10274     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10275
10276     basic_ofstream_wchar_ctor(this, virt_init);
10277
10278     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10279         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10280         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10281     }
10282     return this;
10283 }
10284
10285 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PBDHH@Z */
10286 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEBDHH@Z */
10287 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_name, 20)
10288 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_name(basic_ofstream_wchar *this,
10289         const char *name, int mode, int prot, MSVCP_bool virt_init)
10290 {
10291     basic_ofstream_wchar_ctor_name(this, name, mode, prot, virt_init);
10292     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10293     return this;
10294 }
10295
10296 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
10297 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
10298 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
10299 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
10300 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_name_wchar, 20)
10301 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_name_wchar(basic_ofstream_wchar *this,
10302         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10303 {
10304     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10305
10306     basic_ofstream_wchar_ctor(this, virt_init);
10307
10308     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10309         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10310         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10311     }
10312     return this;
10313 }
10314
10315 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
10316 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
10317 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
10318 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
10319 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_name_wchar, 20)
10320 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_name_wchar(basic_ofstream_wchar *this,
10321         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10322 {
10323     basic_ofstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
10324     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10325     return this;
10326 }
10327
10328 /* ??1?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
10329 /* ??1?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
10330 /* ??1?$basic_ofstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
10331 /* ??1?$basic_ofstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
10332 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_dtor, 4)
10333 void __thiscall basic_ofstream_wchar_dtor(basic_ios_wchar *base)
10334 {
10335     basic_ofstream_wchar *this = basic_ofstream_wchar_from_basic_ios(base);
10336
10337     TRACE("(%p)\n", this);
10338
10339     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base));
10340     basic_filebuf_wchar_dtor(&this->filebuf);
10341 }
10342
10343 /* ??_D?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10344 /* ??_D?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10345 /* ??_D?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10346 /* ??_D?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10347 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_vbase_dtor, 4)
10348 void __thiscall basic_ofstream_wchar_vbase_dtor(basic_ofstream_wchar *this)
10349 {
10350     TRACE("(%p)\n", this);
10351
10352     basic_ofstream_wchar_dtor(basic_ofstream_wchar_to_basic_ios(this));
10353     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(&this->base));
10354 }
10355
10356 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_vector_dtor, 8)
10357 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
10358 {
10359     basic_ofstream_wchar *this = basic_ofstream_wchar_from_basic_ios(base);
10360
10361     TRACE("(%p %x)\n", this, flags);
10362
10363     if(flags & 2) {
10364         /* we have an array, with the number of elements stored before the first object */
10365         INT_PTR i, *ptr = (INT_PTR *)this-1;
10366
10367         for(i=*ptr-1; i>=0; i--)
10368             basic_ofstream_wchar_vbase_dtor(this+i);
10369         MSVCRT_operator_delete(ptr);
10370     } else {
10371         basic_ofstream_wchar_vbase_dtor(this);
10372         if(flags & 1)
10373             MSVCRT_operator_delete(this);
10374     }
10375
10376     return this;
10377 }
10378
10379 /* ?close@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10380 /* ?close@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10381 /* ?close@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10382 /* ?close@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10383 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_close, 4)
10384 void __thiscall basic_ofstream_wchar_close(basic_ofstream_wchar *this)
10385 {
10386     TRACE("(%p)\n", this);
10387
10388     if(!basic_filebuf_wchar_close(&this->filebuf)) {
10389         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10390         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10391     }
10392 }
10393
10394 /* ?is_open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
10395 /* ?is_open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
10396 /* ?is_open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
10397 /* ?is_open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
10398 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_is_open, 4)
10399 MSVCP_bool __thiscall basic_ofstream_wchar_is_open(const basic_ofstream_wchar *this)
10400 {
10401     TRACE("(%p)\n", this);
10402     return basic_filebuf_wchar_is_open(&this->filebuf);
10403 }
10404
10405 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
10406 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
10407 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
10408 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
10409 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open, 16)
10410 void __thiscall basic_ofstream_wchar_open(basic_ofstream_wchar *this,
10411         const char *name, int mode, int prot)
10412 {
10413     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10414
10415     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10416         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10417         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10418     }
10419 }
10420
10421 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
10422 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
10423 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
10424 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
10425 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_old, 12)
10426 void __thiscall basic_ofstream_wchar_open_old(basic_ofstream_wchar *this,
10427         const char *name, unsigned int mode)
10428 {
10429     basic_ofstream_wchar_open(this, name, mode, _SH_DENYNO);
10430 }
10431
10432 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
10433 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
10434 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
10435 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
10436 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
10437 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
10438 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
10439 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
10440 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_wchar, 16)
10441 void __thiscall basic_ofstream_wchar_open_wchar(basic_ofstream_wchar *this,
10442         const wchar_t *name, int mode, int prot)
10443 {
10444     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10445
10446     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10447         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10448         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10449     }
10450 }
10451
10452 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
10453 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
10454 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
10455 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
10456 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
10457 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
10458 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
10459 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
10460 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_wchar_old, 12)
10461 void __thiscall basic_ofstream_wchar_open_wchar_old(basic_ofstream_wchar *this,
10462         const wchar_t *name, unsigned int mode)
10463 {
10464     basic_ofstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
10465 }
10466
10467 /* ?rdbuf@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10468 /* ?rdbuf@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10469 /* ?rdbuf@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10470 /* ?rdbuf@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10471 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_rdbuf, 4)
10472 basic_filebuf_wchar* __thiscall basic_ofstream_wchar_rdbuf(const basic_ofstream_wchar *this)
10473 {
10474     TRACE("(%p)\n", this);
10475     return (basic_filebuf_wchar*)&this->filebuf;
10476 }
10477
10478 static inline basic_ios_char* basic_ifstream_char_to_basic_ios(basic_ifstream_char *ptr)
10479 {
10480     return (basic_ios_char*)((char*)ptr+basic_ifstream_char_vbtable[1]);
10481 }
10482
10483 static inline basic_ifstream_char* basic_ifstream_char_from_basic_ios(basic_ios_char *ptr)
10484 {
10485     return (basic_ifstream_char*)((char*)ptr-basic_ifstream_char_vbtable[1]);
10486 }
10487
10488 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
10489 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
10490 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor, 8)
10491 basic_ifstream_char* __thiscall basic_ifstream_char_ctor(basic_ifstream_char *this, MSVCP_bool virt_init)
10492 {
10493     basic_ios_char *basic_ios;
10494
10495     TRACE("(%p %d)\n", this, virt_init);
10496
10497     if(virt_init) {
10498         this->base.vbtable = basic_ifstream_char_vbtable;
10499         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10500         basic_ios_char_ctor(basic_ios);
10501     }else {
10502         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10503     }
10504
10505     basic_filebuf_char_ctor(&this->filebuf);
10506     basic_istream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10507     basic_ios->base.vtable = &MSVCP_basic_ifstream_char_vtable;
10508     return this;
10509 }
10510
10511 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
10512 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10513 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_file, 12)
10514 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_file(
10515         basic_ifstream_char *this, FILE *file, MSVCP_bool virt_init)
10516 {
10517     basic_ios_char *basic_ios;
10518
10519     TRACE("(%p %p %d)\n", this, file, virt_init);
10520
10521     if(virt_init) {
10522         this->base.vbtable = basic_ifstream_char_vbtable;
10523         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10524         basic_ios_char_ctor(basic_ios);
10525     }else {
10526         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10527     }
10528
10529     basic_filebuf_char_ctor_file(&this->filebuf, file);
10530     basic_istream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10531     basic_ios->base.vtable = &MSVCP_basic_ifstream_char_vtable;
10532     return this;
10533 }
10534
10535 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
10536 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
10537 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_name, 20)
10538 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_name(basic_ifstream_char *this,
10539         const char *name, int mode, int prot, MSVCP_bool virt_init)
10540 {
10541     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10542
10543     basic_ifstream_char_ctor(this, virt_init);
10544
10545     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10546         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10547         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10548     }
10549     return this;
10550 }
10551
10552 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
10553 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
10554 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
10555 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
10556 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_name_wchar, 20)
10557 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_name_wchar(basic_ifstream_char *this,
10558         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10559 {
10560     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10561
10562     basic_ifstream_char_ctor(this, virt_init);
10563
10564     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10565         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10566         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10567     }
10568     return this;
10569 }
10570
10571 /* ??1?$basic_ifstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
10572 /* ??1?$basic_ifstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
10573 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_dtor, 4)
10574 void __thiscall basic_ifstream_char_dtor(basic_ios_char *base)
10575 {
10576     basic_ifstream_char *this = basic_ifstream_char_from_basic_ios(base);
10577
10578     TRACE("(%p)\n", this);
10579
10580     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
10581     basic_filebuf_char_dtor(&this->filebuf);
10582 }
10583
10584 /* ??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10585 /* ??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10586 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vbase_dtor, 4)
10587 void __thiscall basic_ifstream_char_vbase_dtor(basic_ifstream_char *this)
10588 {
10589     TRACE("(%p)\n", this);
10590
10591     basic_ifstream_char_dtor(basic_ifstream_char_to_basic_ios(this));
10592     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base));
10593 }
10594
10595 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vector_dtor, 8)
10596 basic_ifstream_char* __thiscall basic_ifstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
10597 {
10598     basic_ifstream_char *this = basic_ifstream_char_from_basic_ios(base);
10599
10600     TRACE("(%p %x)\n", this, flags);
10601
10602     if(flags & 2) {
10603         /* we have an array, with the number of elements stored before the first object */
10604         INT_PTR i, *ptr = (INT_PTR *)this-1;
10605
10606         for(i=*ptr-1; i>=0; i--)
10607             basic_ifstream_char_vbase_dtor(this+i);
10608         MSVCRT_operator_delete(ptr);
10609     } else {
10610         basic_ifstream_char_vbase_dtor(this);
10611         if(flags & 1)
10612             MSVCRT_operator_delete(this);
10613     }
10614
10615     return this;
10616 }
10617
10618 /* ?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10619 /* ?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10620 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_close, 4)
10621 void __thiscall basic_ifstream_char_close(basic_ifstream_char *this)
10622 {
10623     TRACE("(%p)\n", this);
10624
10625     if(!basic_filebuf_char_close(&this->filebuf)) {
10626         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10627         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10628     }
10629 }
10630
10631 /* ?is_open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
10632 /* ?is_open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
10633 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_is_open, 4)
10634 MSVCP_bool __thiscall basic_ifstream_char_is_open(const basic_ifstream_char *this)
10635 {
10636     TRACE("(%p)\n", this);
10637     return basic_filebuf_char_is_open(&this->filebuf);
10638 }
10639
10640 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
10641 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
10642 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open, 16)
10643 void __thiscall basic_ifstream_char_open(basic_ifstream_char *this,
10644         const char *name, int mode, int prot)
10645 {
10646     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10647
10648     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10649         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10650         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10651     }
10652 }
10653
10654 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
10655 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
10656 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_old, 12)
10657 void __thiscall basic_ifstream_char_open_old(basic_ifstream_char *this,
10658         const char *name, unsigned int mode)
10659 {
10660     basic_ifstream_char_open(this, name, mode, _SH_DENYNO);
10661 }
10662
10663 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
10664 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
10665 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
10666 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
10667 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_wchar, 16)
10668 void __thiscall basic_ifstream_char_open_wchar(basic_ifstream_char *this,
10669         const wchar_t *name, int mode, int prot)
10670 {
10671     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10672
10673     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10674         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10675         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10676     }
10677 }
10678
10679 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
10680 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
10681 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
10682 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
10683 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_wchar_old, 12)
10684 void __thiscall basic_ifstream_char_open_wchar_old(basic_ifstream_char *this,
10685         const wchar_t *name, unsigned int mode)
10686 {
10687     basic_ifstream_char_open_wchar(this, name, mode, _SH_DENYNO);
10688 }
10689
10690 /* ?rdbuf@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10691 /* ?rdbuf@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10692 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_rdbuf, 4)
10693 basic_filebuf_char* __thiscall basic_ifstream_char_rdbuf(const basic_ifstream_char *this)
10694 {
10695     TRACE("(%p)\n", this);
10696     return (basic_filebuf_char*)&this->filebuf;
10697 }
10698
10699 static inline basic_ios_wchar* basic_ifstream_wchar_to_basic_ios(basic_ifstream_wchar *ptr)
10700 {
10701     return (basic_ios_wchar*)((char*)ptr+basic_ifstream_wchar_vbtable[1]);
10702 }
10703
10704 static inline basic_ifstream_wchar* basic_ifstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
10705 {
10706     return (basic_ifstream_wchar*)((char*)ptr-basic_ifstream_wchar_vbtable[1]);
10707 }
10708
10709 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
10710 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
10711 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor, 8)
10712 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor(basic_ifstream_wchar *this, MSVCP_bool virt_init)
10713 {
10714     basic_ios_wchar *basic_ios;
10715
10716     TRACE("(%p %d)\n", this, virt_init);
10717
10718     if(virt_init) {
10719         this->base.vbtable = basic_ifstream_wchar_vbtable;
10720         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10721         basic_ios_wchar_ctor(basic_ios);
10722     }else {
10723         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10724     }
10725
10726     basic_filebuf_wchar_ctor(&this->filebuf);
10727     basic_istream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10728     basic_ios->base.vtable = &MSVCP_basic_ifstream_wchar_vtable;
10729     return this;
10730 }
10731
10732 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
10733 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
10734 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor, 8)
10735 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor(basic_ifstream_wchar *this, MSVCP_bool virt_init)
10736 {
10737     basic_ifstream_wchar_ctor(this, virt_init);
10738     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10739     return this;
10740 }
10741
10742 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
10743 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10744 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_file, 12)
10745 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_file(
10746         basic_ifstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10747 {
10748     basic_ios_wchar *basic_ios;
10749
10750     TRACE("(%p %p %d)\n", this, file, 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_file(&this->filebuf, file);
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@PAU_iobuf@@@Z */
10767 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10768 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_file, 12)
10769 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_file(
10770         basic_ifstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10771 {
10772     basic_ifstream_wchar_ctor_file(this, file, virt_init);
10773     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10774     return this;
10775 }
10776
10777 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PBDHH@Z */
10778 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBDHH@Z */
10779 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_name, 20)
10780 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_name(basic_ifstream_wchar *this,
10781         const char *name, int mode, int prot, MSVCP_bool virt_init)
10782 {
10783     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10784
10785     basic_ifstream_wchar_ctor(this, virt_init);
10786
10787     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10788         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10789         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10790     }
10791     return this;
10792 }
10793
10794 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PBDHH@Z */
10795 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEBDHH@Z */
10796 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_name, 20)
10797 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_name(basic_ifstream_wchar *this,
10798         const char *name, int mode, int prot, MSVCP_bool virt_init)
10799 {
10800     basic_ifstream_wchar_ctor_name(this, name, mode, prot, virt_init);
10801     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10802     return this;
10803 }
10804
10805 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
10806 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
10807 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
10808 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
10809 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_name_wchar, 20)
10810 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_name_wchar(basic_ifstream_wchar *this,
10811         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10812 {
10813     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10814
10815     basic_ifstream_wchar_ctor(this, virt_init);
10816
10817     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10818         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10819         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10820     }
10821     return this;
10822 }
10823
10824 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
10825 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
10826 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
10827 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
10828 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_name_wchar, 20)
10829 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_name_wchar(basic_ifstream_wchar *this,
10830         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10831 {
10832     basic_ifstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
10833     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10834     return this;
10835 }
10836
10837 /* ??1?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
10838 /* ??1?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
10839 /* ??1?$basic_ifstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
10840 /* ??1?$basic_ifstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
10841 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_dtor, 4)
10842 void __thiscall basic_ifstream_wchar_dtor(basic_ios_wchar *base)
10843 {
10844     basic_ifstream_wchar *this = basic_ifstream_wchar_from_basic_ios(base);
10845
10846     TRACE("(%p)\n", this);
10847
10848     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base));
10849     basic_filebuf_wchar_dtor(&this->filebuf);
10850 }
10851
10852 /* ??_D?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10853 /* ??_D?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10854 /* ??_D?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10855 /* ??_D?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10856 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_vbase_dtor, 4)
10857 void __thiscall basic_ifstream_wchar_vbase_dtor(basic_ifstream_wchar *this)
10858 {
10859     TRACE("(%p)\n", this);
10860
10861     basic_ifstream_wchar_dtor(basic_ifstream_wchar_to_basic_ios(this));
10862     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base));
10863 }
10864
10865 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_vector_dtor, 8)
10866 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
10867 {
10868     basic_ifstream_wchar *this = basic_ifstream_wchar_from_basic_ios(base);
10869
10870     TRACE("(%p %x)\n", this, flags);
10871
10872     if(flags & 2) {
10873         /* we have an array, with the number of elements stored before the first object */
10874         INT_PTR i, *ptr = (INT_PTR *)this-1;
10875
10876         for(i=*ptr-1; i>=0; i--)
10877             basic_ifstream_wchar_vbase_dtor(this+i);
10878         MSVCRT_operator_delete(ptr);
10879     } else {
10880         basic_ifstream_wchar_vbase_dtor(this);
10881         if(flags & 1)
10882             MSVCRT_operator_delete(this);
10883     }
10884
10885     return this;
10886 }
10887
10888 /* ?close@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10889 /* ?close@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10890 /* ?close@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10891 /* ?close@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10892 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_close, 4)
10893 void __thiscall basic_ifstream_wchar_close(basic_ifstream_wchar *this)
10894 {
10895     TRACE("(%p)\n", this);
10896
10897     if(!basic_filebuf_wchar_close(&this->filebuf)) {
10898         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10899         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10900     }
10901 }
10902
10903 /* ?is_open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
10904 /* ?is_open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
10905 /* ?is_open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
10906 /* ?is_open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
10907 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_is_open, 4)
10908 MSVCP_bool __thiscall basic_ifstream_wchar_is_open(const basic_ifstream_wchar *this)
10909 {
10910     TRACE("(%p)\n", this);
10911     return basic_filebuf_wchar_is_open(&this->filebuf);
10912 }
10913
10914 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
10915 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
10916 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
10917 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
10918 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open, 16)
10919 void __thiscall basic_ifstream_wchar_open(basic_ifstream_wchar *this,
10920         const char *name, int mode, int prot)
10921 {
10922     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10923
10924     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10925         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10926         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10927     }
10928 }
10929
10930 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
10931 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
10932 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
10933 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
10934 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_old, 12)
10935 void __thiscall basic_ifstream_wchar_open_old(basic_ifstream_wchar *this,
10936         const char *name, unsigned int mode)
10937 {
10938     basic_ifstream_wchar_open(this, name, mode, _SH_DENYNO);
10939 }
10940
10941 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
10942 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
10943 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
10944 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
10945 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
10946 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
10947 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
10948 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
10949 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_wchar, 16)
10950 void __thiscall basic_ifstream_wchar_open_wchar(basic_ifstream_wchar *this,
10951         const wchar_t *name, int mode, int prot)
10952 {
10953     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10954
10955     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10956         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10957         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10958     }
10959 }
10960
10961 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
10962 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
10963 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
10964 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
10965 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
10966 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
10967 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
10968 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
10969 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_wchar_old, 12)
10970 void __thiscall basic_ifstream_wchar_open_wchar_old(basic_ifstream_wchar *this,
10971         const wchar_t *name, unsigned int mode)
10972 {
10973     basic_ifstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
10974 }
10975
10976 /* ?rdbuf@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10977 /* ?rdbuf@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10978 /* ?rdbuf@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10979 /* ?rdbuf@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10980 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_rdbuf, 4)
10981 basic_filebuf_wchar* __thiscall basic_ifstream_wchar_rdbuf(const basic_ifstream_wchar *this)
10982 {
10983     TRACE("(%p)\n", this);
10984     return (basic_filebuf_wchar*)&this->filebuf;
10985 }
10986
10987 static inline basic_ios_char* basic_fstream_char_to_basic_ios(basic_fstream_char *ptr)
10988 {
10989     return (basic_ios_char*)((char*)ptr+basic_fstream_char_vbtable1[1]);
10990 }
10991
10992 static inline basic_fstream_char* basic_fstream_char_from_basic_ios(basic_ios_char *ptr)
10993 {
10994     return (basic_fstream_char*)((char*)ptr-basic_fstream_char_vbtable1[1]);
10995 }
10996
10997 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
10998 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
10999 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor, 8)
11000 basic_fstream_char* __thiscall basic_fstream_char_ctor(basic_fstream_char *this, MSVCP_bool virt_init)
11001 {
11002     basic_ios_char *basic_ios;
11003
11004     TRACE("(%p %d)\n", this, virt_init);
11005
11006     if(virt_init) {
11007         this->base.base1.vbtable = basic_fstream_char_vbtable1;
11008         this->base.base2.vbtable = basic_fstream_char_vbtable2;
11009         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11010         basic_ios_char_ctor(basic_ios);
11011     }else {
11012         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11013     }
11014
11015     basic_filebuf_char_ctor(&this->filebuf);
11016     basic_iostream_char_ctor(&this->base, &this->filebuf.base, FALSE);
11017     basic_ios->base.vtable = &MSVCP_basic_fstream_char_vtable;
11018     return this;
11019 }
11020
11021 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
11022 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11023 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_file, 12)
11024 basic_fstream_char* __thiscall basic_fstream_char_ctor_file(basic_fstream_char *this,
11025         FILE *file, MSVCP_bool virt_init)
11026 {
11027     basic_ios_char *basic_ios;
11028
11029     TRACE("(%p %p %d)\n", this, file, virt_init);
11030
11031     if(virt_init) {
11032         this->base.base1.vbtable = basic_fstream_char_vbtable1;
11033         this->base.base2.vbtable = basic_fstream_char_vbtable2;
11034         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11035         basic_ios_char_ctor(basic_ios);
11036     }else {
11037         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11038     }
11039
11040     basic_filebuf_char_ctor_file(&this->filebuf, file);
11041     basic_iostream_char_ctor(&this->base, &this->filebuf.base, FALSE);
11042     basic_ios->base.vtable = &MSVCP_basic_fstream_char_vtable;
11043     return this;
11044 }
11045
11046 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
11047 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
11048 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_name, 20)
11049 basic_fstream_char* __thiscall basic_fstream_char_ctor_name(basic_fstream_char *this,
11050         const char *name, int mode, int prot, MSVCP_bool virt_init)
11051 {
11052     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
11053
11054     basic_fstream_char_ctor(this, virt_init);
11055
11056     if(!basic_filebuf_char_open(&this->filebuf, name, mode, prot)) {
11057         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11058         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11059     }
11060     return this;
11061 }
11062
11063 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
11064 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
11065 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
11066 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
11067 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_name_wchar, 20)
11068 basic_fstream_char* __thiscall basic_fstream_char_ctor_name_wchar(basic_fstream_char *this,
11069         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11070 {
11071     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
11072
11073     basic_fstream_char_ctor(this, virt_init);
11074
11075     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode, prot)) {
11076         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11077         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11078     }
11079     return this;
11080 }
11081
11082 /* ??1?$basic_fstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
11083 /* ??1?$basic_fstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
11084 DEFINE_THISCALL_WRAPPER(basic_fstream_char_dtor, 4)
11085 void __thiscall basic_fstream_char_dtor(basic_ios_char *base)
11086 {
11087     basic_fstream_char *this = basic_fstream_char_from_basic_ios(base);
11088
11089     TRACE("(%p)\n", this);
11090
11091     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
11092     basic_filebuf_char_dtor(&this->filebuf);
11093 }
11094
11095 /* ??_D?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
11096 /* ??_D?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
11097 DEFINE_THISCALL_WRAPPER(basic_fstream_char_vbase_dtor, 4)
11098 void __thiscall basic_fstream_char_vbase_dtor(basic_fstream_char *this)
11099 {
11100     TRACE("(%p)\n", this);
11101
11102     basic_fstream_char_dtor(basic_fstream_char_to_basic_ios(this));
11103     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
11104 }
11105
11106 DEFINE_THISCALL_WRAPPER(basic_fstream_char_vector_dtor, 8)
11107 basic_fstream_char* __thiscall basic_fstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11108 {
11109     basic_fstream_char *this = basic_fstream_char_from_basic_ios(base);
11110
11111     TRACE("(%p %x)\n", this, flags);
11112
11113     if(flags & 2) {
11114         /* we have an array, with the number of elements stored before the first object */
11115         INT_PTR i, *ptr = (INT_PTR *)this-1;
11116
11117         for(i=*ptr-1; i>=0; i--)
11118             basic_fstream_char_vbase_dtor(this+i);
11119         MSVCRT_operator_delete(ptr);
11120     } else {
11121         basic_fstream_char_vbase_dtor(this);
11122         if(flags & 1)
11123             MSVCRT_operator_delete(this);
11124     }
11125
11126     return this;
11127 }
11128
11129 /* ?close@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
11130 /* ?close@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
11131 DEFINE_THISCALL_WRAPPER(basic_fstream_char_close, 4)
11132 void __thiscall basic_fstream_char_close(basic_fstream_char *this)
11133 {
11134     TRACE("(%p)\n", this);
11135
11136     if(!basic_filebuf_char_close(&this->filebuf)) {
11137         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11138         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11139     }
11140 }
11141
11142 /* ?is_open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
11143 /* ?is_open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
11144 DEFINE_THISCALL_WRAPPER(basic_fstream_char_is_open, 4)
11145 MSVCP_bool __thiscall basic_fstream_char_is_open(const basic_fstream_char *this)
11146 {
11147     TRACE("(%p)\n", this);
11148     return basic_filebuf_char_is_open(&this->filebuf);
11149 }
11150
11151 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
11152 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
11153 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open, 16)
11154 void __thiscall basic_fstream_char_open(basic_fstream_char *this,
11155         const char *name, int mode, int prot)
11156 {
11157     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
11158
11159     if(!basic_filebuf_char_open(&this->filebuf, name, mode, prot)) {
11160         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11161         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11162     }
11163 }
11164
11165 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
11166 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
11167 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_old, 12)
11168 void __thiscall basic_fstream_char_open_old(basic_fstream_char *this,
11169         const char *name, unsigned int mode)
11170 {
11171     basic_fstream_char_open(this, name, mode, _SH_DENYNO);
11172 }
11173
11174 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
11175 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
11176 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
11177 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
11178 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_wchar, 16)
11179 void __thiscall basic_fstream_char_open_wchar(basic_fstream_char *this,
11180         const wchar_t *name, int mode, int prot)
11181 {
11182     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
11183
11184     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode, prot)) {
11185         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11186         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11187     }
11188 }
11189
11190 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
11191 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
11192 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
11193 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
11194 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_wchar_old, 12)
11195 void __thiscall basic_fstream_char_open_wchar_old(basic_fstream_char *this,
11196         const wchar_t *name, unsigned int mode)
11197 {
11198     basic_fstream_char_open_wchar(this, name, mode, _SH_DENYNO);
11199 }
11200
11201 /* ?rdbuf@?$basic_fstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
11202 /* ?rdbuf@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
11203 DEFINE_THISCALL_WRAPPER(basic_fstream_char_rdbuf, 4)
11204 basic_filebuf_char* __thiscall basic_fstream_char_rdbuf(const basic_fstream_char *this)
11205 {
11206     TRACE("(%p)\n", this);
11207     return (basic_filebuf_char*)&this->filebuf;
11208 }
11209
11210 static inline basic_ios_wchar* basic_fstream_wchar_to_basic_ios(basic_fstream_wchar *ptr)
11211 {
11212     return (basic_ios_wchar*)((char*)ptr+basic_fstream_wchar_vbtable1[1]);
11213 }
11214
11215 static inline basic_fstream_wchar* basic_fstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11216 {
11217     return (basic_fstream_wchar*)((char*)ptr-basic_fstream_wchar_vbtable1[1]);
11218 }
11219
11220 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
11221 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
11222 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor, 8)
11223 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor(basic_fstream_wchar *this, MSVCP_bool virt_init)
11224 {
11225     basic_ios_wchar *basic_ios;
11226
11227     TRACE("(%p %d)\n", this, virt_init);
11228
11229     if(virt_init) {
11230         this->base.base1.vbtable = basic_fstream_wchar_vbtable1;
11231         this->base.base2.vbtable = basic_fstream_wchar_vbtable2;
11232         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11233         basic_ios_wchar_ctor(basic_ios);
11234     }else {
11235         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11236     }
11237
11238     basic_filebuf_wchar_ctor(&this->filebuf);
11239     basic_iostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE);
11240     basic_ios->base.vtable = &MSVCP_basic_fstream_wchar_vtable;
11241     return this;
11242 }
11243
11244 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
11245 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
11246 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor, 8)
11247 basic_fstream_wchar* __thiscall basic_fstream_short_ctor(basic_fstream_wchar *this, MSVCP_bool virt_init)
11248 {
11249     basic_fstream_wchar_ctor(this, virt_init);
11250     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11251     return this;
11252 }
11253
11254 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
11255 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11256 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_file, 12)
11257 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_file(basic_fstream_wchar *this,
11258         FILE *file, MSVCP_bool virt_init)
11259 {
11260     basic_ios_wchar *basic_ios;
11261
11262     TRACE("(%p %p %d)\n", this, file, virt_init);
11263
11264     if(virt_init) {
11265         this->base.base1.vbtable = basic_fstream_wchar_vbtable1;
11266         this->base.base2.vbtable = basic_fstream_wchar_vbtable2;
11267         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11268         basic_ios_wchar_ctor(basic_ios);
11269     }else {
11270         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11271     }
11272
11273     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
11274     basic_iostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE);
11275     basic_ios->base.vtable = &MSVCP_basic_fstream_wchar_vtable;
11276     return this;
11277 }
11278
11279 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
11280 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11281 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_file, 12)
11282 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_file(basic_fstream_wchar *this,
11283         FILE *file, MSVCP_bool virt_init)
11284 {
11285     basic_fstream_wchar_ctor_file(this, file, virt_init);
11286     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11287     return this;
11288 }
11289
11290 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
11291 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
11292 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_name, 20)
11293 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_name(basic_fstream_wchar *this,
11294         const char *name, int mode, int prot, MSVCP_bool virt_init)
11295 {
11296     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
11297
11298     basic_fstream_wchar_ctor(this, virt_init);
11299
11300     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode, prot)) {
11301         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11302         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11303     }
11304     return this;
11305 }
11306
11307 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
11308 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
11309 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_name, 20)
11310 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_name(basic_fstream_wchar *this,
11311         const char *name, int mode, int prot, MSVCP_bool virt_init)
11312 {
11313     basic_fstream_wchar_ctor_name(this, name, mode, prot, virt_init);
11314     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11315     return this;
11316 }
11317
11318 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
11319 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
11320 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
11321 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
11322 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_name_wchar, 20)
11323 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_name_wchar(basic_fstream_wchar *this,
11324         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11325 {
11326     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
11327
11328     basic_fstream_wchar_ctor(this, virt_init);
11329
11330     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode, prot)) {
11331         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11332         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11333     }
11334     return this;
11335 }
11336
11337 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
11338 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
11339 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
11340 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
11341 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_name_wchar, 20)
11342 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_name_wchar(basic_fstream_wchar *this,
11343         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11344 {
11345     basic_fstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
11346     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11347     return this;
11348 }
11349
11350 /* ??1?$basic_fstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
11351 /* ??1?$basic_fstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
11352 /* ??1?$basic_fstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
11353 /* ??1?$basic_fstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
11354 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_dtor, 4)
11355 void __thiscall basic_fstream_wchar_dtor(basic_ios_wchar *base)
11356 {
11357     basic_fstream_wchar *this = basic_fstream_wchar_from_basic_ios(base);
11358
11359     TRACE("(%p)\n", this);
11360
11361     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(&this->base));
11362     basic_filebuf_wchar_dtor(&this->filebuf);
11363 }
11364
11365 /* ??_D?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
11366 /* ??_D?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
11367 /* ??_D?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
11368 /* ??_D?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
11369 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_vbase_dtor, 4)
11370 void __thiscall basic_fstream_wchar_vbase_dtor(basic_fstream_wchar *this)
11371 {
11372     TRACE("(%p)\n", this);
11373
11374     basic_fstream_wchar_dtor(basic_fstream_wchar_to_basic_ios(this));
11375     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base.base1));
11376 }
11377
11378 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_vector_dtor, 8)
11379 basic_fstream_wchar* __thiscall basic_fstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
11380 {
11381     basic_fstream_wchar *this = basic_fstream_wchar_from_basic_ios(base);
11382
11383     TRACE("(%p %x)\n", this, flags);
11384
11385     if(flags & 2) {
11386         /* we have an array, with the number of elements stored before the first object */
11387         INT_PTR i, *ptr = (INT_PTR *)this-1;
11388
11389         for(i=*ptr-1; i>=0; i--)
11390             basic_fstream_wchar_vbase_dtor(this+i);
11391         MSVCRT_operator_delete(ptr);
11392     } else {
11393         basic_fstream_wchar_vbase_dtor(this);
11394         if(flags & 1)
11395             MSVCRT_operator_delete(this);
11396     }
11397
11398     return this;
11399 }
11400
11401 /* ?close@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
11402 /* ?close@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
11403 /* ?close@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
11404 /* ?close@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
11405 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_close, 4)
11406 void __thiscall basic_fstream_wchar_close(basic_fstream_wchar *this)
11407 {
11408     TRACE("(%p)\n", this);
11409
11410     if(!basic_filebuf_wchar_close(&this->filebuf)) {
11411         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11412         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11413     }
11414 }
11415
11416 /* ?is_open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
11417 /* ?is_open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
11418 /* ?is_open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
11419 /* ?is_open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
11420 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_is_open, 4)
11421 MSVCP_bool __thiscall basic_fstream_wchar_is_open(const basic_fstream_wchar *this)
11422 {
11423     TRACE("(%p)\n", this);
11424     return basic_filebuf_wchar_is_open(&this->filebuf);
11425 }
11426
11427 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
11428 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
11429 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
11430 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
11431 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open, 16)
11432 void __thiscall basic_fstream_wchar_open(basic_fstream_wchar *this,
11433         const char *name, int mode, int prot)
11434 {
11435     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
11436
11437     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode, prot)) {
11438         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11439         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11440     }
11441 }
11442
11443 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
11444 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
11445 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
11446 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
11447 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_old, 12)
11448 void __thiscall basic_fstream_wchar_open_old(basic_fstream_wchar *this,
11449         const char *name, unsigned int mode)
11450 {
11451     basic_fstream_wchar_open(this, name, mode, _SH_DENYNO);
11452 }
11453
11454 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
11455 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
11456 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
11457 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
11458 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
11459 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
11460 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
11461 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
11462 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_wchar, 16)
11463 void __thiscall basic_fstream_wchar_open_wchar(basic_fstream_wchar *this,
11464         const wchar_t *name, int mode, int prot)
11465 {
11466     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
11467
11468     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode, prot)) {
11469         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11470         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11471     }
11472 }
11473
11474 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
11475 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
11476 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
11477 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
11478 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
11479 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
11480 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
11481 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
11482 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_wchar_old, 12)
11483 void __thiscall basic_fstream_wchar_open_wchar_old(basic_fstream_wchar *this,
11484         const wchar_t *name, unsigned int mode)
11485 {
11486     basic_fstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
11487 }
11488
11489 /* ?rdbuf@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11490 /* ?rdbuf@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11491 /* ?rdbuf@?$basic_fstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11492 /* ?rdbuf@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11493 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_rdbuf, 4)
11494 basic_filebuf_wchar* __thiscall basic_fstream_wchar_rdbuf(const basic_fstream_wchar *this)
11495 {
11496     TRACE("(%p)\n", this);
11497     return (basic_filebuf_wchar*)&this->filebuf;
11498 }
11499
11500 static inline basic_ios_char* basic_ostringstream_char_to_basic_ios(basic_ostringstream_char *ptr)
11501 {
11502     return (basic_ios_char*)((char*)ptr+basic_ostringstream_char_vbtable[1]);
11503 }
11504
11505 static inline basic_ostringstream_char* basic_ostringstream_char_from_basic_ios(basic_ios_char *ptr)
11506 {
11507     return (basic_ostringstream_char*)((char*)ptr-basic_ostringstream_char_vbtable[1]);
11508 }
11509
11510 /* ??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 */
11511 /* ??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 */
11512 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor_str, 16)
11513 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor_str(basic_ostringstream_char *this,
11514         const basic_string_char *str, int mode, MSVCP_bool virt_init)
11515 {
11516     basic_ios_char *basic_ios;
11517
11518     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11519
11520     if(virt_init) {
11521         this->base.vbtable = basic_ostringstream_char_vbtable;
11522         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11523         basic_ios_char_ctor(basic_ios);
11524     }else {
11525         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11526     }
11527
11528     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode|OPENMODE_out);
11529     basic_ostream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11530     basic_ios->base.vtable = &MSVCP_basic_ostringstream_char_vtable;
11531     return this;
11532 }
11533
11534 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
11535 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
11536 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor_mode, 12)
11537 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor_mode(
11538         basic_ostringstream_char *this, int mode, MSVCP_bool virt_init)
11539 {
11540     basic_ios_char *basic_ios;
11541
11542     TRACE("(%p %d %d)\n", this, mode, virt_init);
11543
11544     if(virt_init) {
11545         this->base.vbtable = basic_ostringstream_char_vbtable;
11546         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11547         basic_ios_char_ctor(basic_ios);
11548     }else {
11549         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11550     }
11551
11552     basic_stringbuf_char_ctor_mode(&this->strbuf, mode|OPENMODE_out);
11553     basic_ostream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11554     basic_ios->base.vtable = &MSVCP_basic_ostringstream_char_vtable;
11555     return this;
11556 }
11557
11558 /* ??_F?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11559 /* ??_F?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11560 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor, 8)
11561 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor(
11562         basic_ostringstream_char *this, MSVCP_bool virt_init)
11563 {
11564     return basic_ostringstream_char_ctor_mode(this, 0, virt_init);
11565 }
11566
11567 /* ??1?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
11568 /* ??1?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
11569 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_dtor, 4)
11570 void __thiscall basic_ostringstream_char_dtor(basic_ios_char *base)
11571 {
11572     basic_ostringstream_char *this = basic_ostringstream_char_from_basic_ios(base);
11573
11574     TRACE("(%p)\n", this);
11575
11576     basic_stringbuf_char_dtor(&this->strbuf);
11577     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
11578 }
11579
11580 /* ??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11581 /* ??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11582 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_vbase_dtor, 4)
11583 void __thiscall basic_ostringstream_char_vbase_dtor(basic_ostringstream_char *this)
11584 {
11585     TRACE("(%p)\n", this);
11586
11587     basic_ostringstream_char_dtor(basic_ostringstream_char_to_basic_ios(this));
11588     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
11589 }
11590
11591 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_vector_dtor, 8)
11592 basic_ostringstream_char* __thiscall basic_ostringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11593 {
11594     basic_ostringstream_char *this = basic_ostringstream_char_from_basic_ios(base);
11595
11596     TRACE("(%p %x)\n", this, flags);
11597
11598     if(flags & 2) {
11599         /* we have an array, with the number of elements stored before the first object */
11600         INT_PTR i, *ptr = (INT_PTR *)this-1;
11601
11602         for(i=*ptr-1; i>=0; i--)
11603             basic_ostringstream_char_vbase_dtor(this+i);
11604         MSVCRT_operator_delete(ptr);
11605     } else {
11606         basic_ostringstream_char_vbase_dtor(this);
11607         if(flags & 1)
11608             MSVCRT_operator_delete(this);
11609     }
11610
11611     return this;
11612 }
11613
11614 /* ?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 */
11615 /* ?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 */
11616 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_rdbuf, 4)
11617 basic_stringbuf_char* __thiscall basic_ostringstream_char_rdbuf(const basic_ostringstream_char *this)
11618 {
11619     TRACE("(%p)\n", this);
11620     return (basic_stringbuf_char*)&this->strbuf;
11621 }
11622
11623 /* ?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 */
11624 /* ?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 */
11625 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_str_set, 8)
11626 void __thiscall basic_ostringstream_char_str_set(basic_ostringstream_char *this, const basic_string_char *str)
11627 {
11628     TRACE("(%p %p)\n", this, str);
11629     basic_stringbuf_char_str_set(&this->strbuf, str);
11630 }
11631
11632 /* ?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 */
11633 /* ?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 */
11634 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_str_get, 8)
11635 basic_string_char* __thiscall basic_ostringstream_char_str_get(const basic_ostringstream_char *this, basic_string_char *ret)
11636 {
11637     TRACE("(%p %p)\n", this, ret);
11638     return basic_stringbuf_char_str_get(&this->strbuf, ret);
11639 }
11640
11641 static inline basic_ios_wchar* basic_ostringstream_wchar_to_basic_ios(basic_ostringstream_wchar *ptr)
11642 {
11643     return (basic_ios_wchar*)((char*)ptr+basic_ostringstream_wchar_vbtable[1]);
11644 }
11645
11646 static inline basic_ostringstream_wchar* basic_ostringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11647 {
11648     return (basic_ostringstream_wchar*)((char*)ptr-basic_ostringstream_wchar_vbtable[1]);
11649 }
11650
11651 /* ??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 */
11652 /* ??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 */
11653 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor_str, 16)
11654 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor_str(basic_ostringstream_wchar *this,
11655         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11656 {
11657     basic_ios_wchar *basic_ios;
11658
11659     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11660
11661     if(virt_init) {
11662         this->base.vbtable = basic_ostringstream_wchar_vbtable;
11663         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11664         basic_ios_wchar_ctor(basic_ios);
11665     }else {
11666         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11667     }
11668
11669     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode|OPENMODE_out);
11670     basic_ostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11671     basic_ios->base.vtable = &MSVCP_basic_ostringstream_wchar_vtable;
11672     return this;
11673 }
11674
11675 /* ??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 */
11676 /* ??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 */
11677 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor_str, 16)
11678 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor_str(basic_ostringstream_wchar *this,
11679         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11680 {
11681     basic_ostringstream_wchar_ctor_str(this, str, mode, virt_init);
11682     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ostringstream_short_vtable;
11683     return this;
11684 }
11685
11686 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
11687 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
11688 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor_mode, 12)
11689 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor_mode(
11690         basic_ostringstream_wchar *this, int mode, MSVCP_bool virt_init)
11691 {
11692     basic_ios_wchar *basic_ios;
11693
11694     TRACE("(%p %d %d)\n", this, mode, virt_init);
11695
11696     if(virt_init) {
11697         this->base.vbtable = basic_ostringstream_wchar_vbtable;
11698         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11699         basic_ios_wchar_ctor(basic_ios);
11700     }else {
11701         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11702     }
11703
11704     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode|OPENMODE_out);
11705     basic_ostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11706     basic_ios->base.vtable = &MSVCP_basic_ostringstream_wchar_vtable;
11707     return this;
11708 }
11709
11710 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
11711 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
11712 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor_mode, 12)
11713 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor_mode(
11714         basic_ostringstream_wchar *this, int mode, MSVCP_bool virt_init)
11715 {
11716     basic_ostringstream_wchar_ctor_mode(this, mode, virt_init);
11717     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ostringstream_short_vtable;
11718     return this;
11719 }
11720
11721 /* ??_F?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11722 /* ??_F?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11723 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor, 8)
11724 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor(
11725         basic_ostringstream_wchar *this, MSVCP_bool virt_init)
11726 {
11727     return basic_ostringstream_wchar_ctor_mode(this, 0, virt_init);
11728 }
11729
11730 /* ??_F?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11731 /* ??_F?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11732 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor, 8)
11733 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor(
11734         basic_ostringstream_wchar *this, MSVCP_bool virt_init)
11735 {
11736     return basic_ostringstream_short_ctor_mode(this, 0, virt_init);
11737 }
11738
11739 /* ??1?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
11740 /* ??1?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
11741 /* ??1?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
11742 /* ??1?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
11743 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_dtor, 4)
11744 void __thiscall basic_ostringstream_wchar_dtor(basic_ios_wchar *base)
11745 {
11746     basic_ostringstream_wchar *this = basic_ostringstream_wchar_from_basic_ios(base);
11747
11748     TRACE("(%p)\n", this);
11749
11750     basic_stringbuf_wchar_dtor(&this->strbuf);
11751     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base));
11752 }
11753
11754 /* ??_D?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11755 /* ??_D?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11756 /* ??_D?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11757 /* ??_D?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11758 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_vbase_dtor, 4)
11759 void __thiscall basic_ostringstream_wchar_vbase_dtor(basic_ostringstream_wchar *this)
11760 {
11761     TRACE("(%p)\n", this);
11762
11763     basic_ostringstream_wchar_dtor(basic_ostringstream_wchar_to_basic_ios(this));
11764     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(&this->base));
11765 }
11766
11767 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_vector_dtor, 8)
11768 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
11769 {
11770     basic_ostringstream_wchar *this = basic_ostringstream_wchar_from_basic_ios(base);
11771
11772     TRACE("(%p %x)\n", this, flags);
11773
11774     if(flags & 2) {
11775         /* we have an array, with the number of elements stored before the first object */
11776         INT_PTR i, *ptr = (INT_PTR *)this-1;
11777
11778         for(i=*ptr-1; i>=0; i--)
11779             basic_ostringstream_wchar_vbase_dtor(this+i);
11780         MSVCRT_operator_delete(ptr);
11781     } else {
11782         basic_ostringstream_wchar_vbase_dtor(this);
11783         if(flags & 1)
11784             MSVCRT_operator_delete(this);
11785     }
11786
11787     return this;
11788 }
11789
11790 /* ?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 */
11791 /* ?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 */
11792 /* ?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 */
11793 /* ?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 */
11794 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_rdbuf, 4)
11795 basic_stringbuf_wchar* __thiscall basic_ostringstream_wchar_rdbuf(const basic_ostringstream_wchar *this)
11796 {
11797     TRACE("(%p)\n", this);
11798     return (basic_stringbuf_wchar*)&this->strbuf;
11799 }
11800
11801 /* ?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 */
11802 /* ?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 */
11803 /* ?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 */
11804 /* ?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 */
11805 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_str_set, 8)
11806 void __thiscall basic_ostringstream_wchar_str_set(basic_ostringstream_wchar *this, const basic_string_wchar *str)
11807 {
11808     TRACE("(%p %p)\n", this, str);
11809     basic_stringbuf_wchar_str_set(&this->strbuf, str);
11810 }
11811
11812 /* ?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 */
11813 /* ?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 */
11814 /* ?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 */
11815 /* ?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 */
11816 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_str_get, 8)
11817 basic_string_wchar* __thiscall basic_ostringstream_wchar_str_get(const basic_ostringstream_wchar *this, basic_string_wchar *ret)
11818 {
11819     TRACE("(%p %p)\n", this, ret);
11820     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
11821 }
11822
11823 static inline basic_ios_char* basic_istringstream_char_to_basic_ios(basic_istringstream_char *ptr)
11824 {
11825     return (basic_ios_char*)((char*)ptr+basic_istringstream_char_vbtable[1]);
11826 }
11827
11828 static inline basic_istringstream_char* basic_istringstream_char_from_basic_ios(basic_ios_char *ptr)
11829 {
11830     return (basic_istringstream_char*)((char*)ptr-basic_istringstream_char_vbtable[1]);
11831 }
11832
11833 /* ??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 */
11834 /* ??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 */
11835 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor_str, 16)
11836 basic_istringstream_char* __thiscall basic_istringstream_char_ctor_str(basic_istringstream_char *this,
11837         const basic_string_char *str, int mode, MSVCP_bool virt_init)
11838 {
11839     basic_ios_char *basic_ios;
11840
11841     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11842
11843     if(virt_init) {
11844         this->base.vbtable = basic_istringstream_char_vbtable;
11845         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11846         basic_ios_char_ctor(basic_ios);
11847     }else {
11848         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11849     }
11850
11851     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode|OPENMODE_in);
11852     basic_istream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11853     basic_ios->base.vtable = &MSVCP_basic_istringstream_char_vtable;
11854     return this;
11855 }
11856
11857 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
11858 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
11859 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor_mode, 12)
11860 basic_istringstream_char* __thiscall basic_istringstream_char_ctor_mode(
11861         basic_istringstream_char *this, int mode, MSVCP_bool virt_init)
11862 {
11863     basic_ios_char *basic_ios;
11864
11865     TRACE("(%p %d %d)\n", this, mode, virt_init);
11866
11867     if(virt_init) {
11868         this->base.vbtable = basic_istringstream_char_vbtable;
11869         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11870         basic_ios_char_ctor(basic_ios);
11871     }else {
11872         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11873     }
11874
11875     basic_stringbuf_char_ctor_mode(&this->strbuf, mode|OPENMODE_in);
11876     basic_istream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11877     basic_ios->base.vtable = &MSVCP_basic_istringstream_char_vtable;
11878     return this;
11879 }
11880
11881 /* ??_F?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11882 /* ??_F?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11883 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor, 8)
11884 basic_istringstream_char* __thiscall basic_istringstream_char_ctor(
11885         basic_istringstream_char *this, MSVCP_bool virt_init)
11886 {
11887     return basic_istringstream_char_ctor_mode(this, 0, virt_init);
11888 }
11889
11890 /* ??1?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
11891 /* ??1?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
11892 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_dtor, 4)
11893 void __thiscall basic_istringstream_char_dtor(basic_ios_char *base)
11894 {
11895     basic_istringstream_char *this = basic_istringstream_char_from_basic_ios(base);
11896
11897     TRACE("(%p)\n", this);
11898
11899     basic_stringbuf_char_dtor(&this->strbuf);
11900     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
11901 }
11902
11903 /* ??_D?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11904 /* ??_D?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11905 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_vbase_dtor, 4)
11906 void __thiscall basic_istringstream_char_vbase_dtor(basic_istringstream_char *this)
11907 {
11908     TRACE("(%p)\n", this);
11909
11910     basic_istringstream_char_dtor(basic_istringstream_char_to_basic_ios(this));
11911     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base));
11912 }
11913
11914 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_vector_dtor, 8)
11915 basic_istringstream_char* __thiscall basic_istringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11916 {
11917     basic_istringstream_char *this = basic_istringstream_char_from_basic_ios(base);
11918
11919     TRACE("(%p %x)\n", this, flags);
11920
11921     if(flags & 2) {
11922         /* we have an array, with the number of elements stored before the first object */
11923         INT_PTR i, *ptr = (INT_PTR *)this-1;
11924
11925         for(i=*ptr-1; i>=0; i--)
11926             basic_istringstream_char_vbase_dtor(this+i);
11927         MSVCRT_operator_delete(ptr);
11928     } else {
11929         basic_istringstream_char_vbase_dtor(this);
11930         if(flags & 1)
11931             MSVCRT_operator_delete(this);
11932     }
11933
11934     return this;
11935 }
11936
11937 /* ?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 */
11938 /* ?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 */
11939 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_rdbuf, 4)
11940 basic_stringbuf_char* __thiscall basic_istringstream_char_rdbuf(const basic_istringstream_char *this)
11941 {
11942     TRACE("(%p)\n", this);
11943     return (basic_stringbuf_char*)&this->strbuf;
11944 }
11945
11946 /* ?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 */
11947 /* ?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 */
11948 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_str_set, 8)
11949 void __thiscall basic_istringstream_char_str_set(basic_istringstream_char *this, const basic_string_char *str)
11950 {
11951     TRACE("(%p %p)\n", this, str);
11952     basic_stringbuf_char_str_set(&this->strbuf, str);
11953 }
11954
11955 /* ?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 */
11956 /* ?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 */
11957 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_str_get, 8)
11958 basic_string_char* __thiscall basic_istringstream_char_str_get(const basic_istringstream_char *this, basic_string_char *ret)
11959 {
11960     TRACE("(%p %p)\n", this, ret);
11961     return basic_stringbuf_char_str_get(&this->strbuf, ret);
11962 }
11963
11964 static inline basic_ios_wchar* basic_istringstream_wchar_to_basic_ios(basic_istringstream_wchar *ptr)
11965 {
11966     return (basic_ios_wchar*)((char*)ptr+basic_istringstream_wchar_vbtable[1]);
11967 }
11968
11969 static inline basic_istringstream_wchar* basic_istringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11970 {
11971     return (basic_istringstream_wchar*)((char*)ptr-basic_istringstream_wchar_vbtable[1]);
11972 }
11973
11974 /* ??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 */
11975 /* ??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 */
11976 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor_str, 16)
11977 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor_str(basic_istringstream_wchar *this,
11978         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11979 {
11980     basic_ios_wchar *basic_ios;
11981
11982     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11983
11984     if(virt_init) {
11985         this->base.vbtable = basic_istringstream_wchar_vbtable;
11986         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
11987         basic_ios_wchar_ctor(basic_ios);
11988     }else {
11989         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
11990     }
11991
11992     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode|OPENMODE_in);
11993     basic_istream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11994     basic_ios->base.vtable = &MSVCP_basic_istringstream_wchar_vtable;
11995     return this;
11996 }
11997
11998 /* ??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 */
11999 /* ??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 */
12000 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor_str, 16)
12001 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor_str(basic_istringstream_wchar *this,
12002         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12003 {
12004     basic_istringstream_wchar_ctor_str(this, str, mode, virt_init);
12005     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_istringstream_short_vtable;
12006     return this;
12007 }
12008
12009 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
12010 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
12011 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor_mode, 12)
12012 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor_mode(
12013         basic_istringstream_wchar *this, int mode, MSVCP_bool virt_init)
12014 {
12015     basic_ios_wchar *basic_ios;
12016
12017     TRACE("(%p %d %d)\n", this, mode, virt_init);
12018
12019     if(virt_init) {
12020         this->base.vbtable = basic_istringstream_wchar_vbtable;
12021         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
12022         basic_ios_wchar_ctor(basic_ios);
12023     }else {
12024         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
12025     }
12026
12027     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode|OPENMODE_in);
12028     basic_istream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
12029     basic_ios->base.vtable = &MSVCP_basic_istringstream_wchar_vtable;
12030     return this;
12031 }
12032
12033 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
12034 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
12035 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor_mode, 12)
12036 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor_mode(
12037         basic_istringstream_wchar *this, int mode, MSVCP_bool virt_init)
12038 {
12039     basic_istringstream_wchar_ctor_mode(this, mode, virt_init);
12040     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_istringstream_short_vtable;
12041     return this;
12042 }
12043
12044 /* ??_F?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12045 /* ??_F?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12046 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor, 8)
12047 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor(
12048         basic_istringstream_wchar *this, MSVCP_bool virt_init)
12049 {
12050     return basic_istringstream_wchar_ctor_mode(this, 0, virt_init);
12051 }
12052
12053 /* ??_F?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12054 /* ??_F?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12055 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor, 8)
12056 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor(
12057         basic_istringstream_wchar *this, MSVCP_bool virt_init)
12058 {
12059     return basic_istringstream_short_ctor_mode(this, 0, virt_init);
12060 }
12061
12062 /* ??1?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
12063 /* ??1?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
12064 /* ??1?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
12065 /* ??1?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
12066 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_dtor, 4)
12067 void __thiscall basic_istringstream_wchar_dtor(basic_ios_wchar *base)
12068 {
12069     basic_istringstream_wchar *this = basic_istringstream_wchar_from_basic_ios(base);
12070
12071     TRACE("(%p)\n", this);
12072
12073     basic_stringbuf_wchar_dtor(&this->strbuf);
12074     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base));
12075 }
12076
12077 /* ??_D?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12078 /* ??_D?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12079 /* ??_D?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12080 /* ??_D?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12081 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_vbase_dtor, 4)
12082 void __thiscall basic_istringstream_wchar_vbase_dtor(basic_istringstream_wchar *this)
12083 {
12084     TRACE("(%p)\n", this);
12085
12086     basic_istringstream_wchar_dtor(basic_istringstream_wchar_to_basic_ios(this));
12087     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base));
12088 }
12089
12090 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_vector_dtor, 8)
12091 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
12092 {
12093     basic_istringstream_wchar *this = basic_istringstream_wchar_from_basic_ios(base);
12094
12095     TRACE("(%p %x)\n", this, flags);
12096
12097     if(flags & 2) {
12098         /* we have an array, with the number of elements stored before the first object */
12099         INT_PTR i, *ptr = (INT_PTR *)this-1;
12100
12101         for(i=*ptr-1; i>=0; i--)
12102             basic_istringstream_wchar_vbase_dtor(this+i);
12103         MSVCRT_operator_delete(ptr);
12104     } else {
12105         basic_istringstream_wchar_vbase_dtor(this);
12106         if(flags & 1)
12107             MSVCRT_operator_delete(this);
12108     }
12109
12110     return this;
12111 }
12112
12113 /* ?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 */
12114 /* ?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 */
12115 /* ?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 */
12116 /* ?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 */
12117 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_rdbuf, 4)
12118 basic_stringbuf_wchar* __thiscall basic_istringstream_wchar_rdbuf(const basic_istringstream_wchar *this)
12119 {
12120     TRACE("(%p)\n", this);
12121     return (basic_stringbuf_wchar*)&this->strbuf;
12122 }
12123
12124 /* ?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 */
12125 /* ?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 */
12126 /* ?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 */
12127 /* ?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 */
12128 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_str_set, 8)
12129 void __thiscall basic_istringstream_wchar_str_set(basic_istringstream_wchar *this, const basic_string_wchar *str)
12130 {
12131     TRACE("(%p %p)\n", this, str);
12132     basic_stringbuf_wchar_str_set(&this->strbuf, str);
12133 }
12134
12135 /* ?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 */
12136 /* ?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 */
12137 /* ?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 */
12138 /* ?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 */
12139 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_str_get, 8)
12140 basic_string_wchar* __thiscall basic_istringstream_wchar_str_get(const basic_istringstream_wchar *this, basic_string_wchar *ret)
12141 {
12142     TRACE("(%p %p)\n", this, ret);
12143     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
12144 }
12145
12146 static inline basic_ios_char* basic_stringstream_char_to_basic_ios(basic_stringstream_char *ptr)
12147 {
12148     return (basic_ios_char*)((char*)ptr+basic_stringstream_char_vbtable1[1]);
12149 }
12150
12151 static inline basic_stringstream_char* basic_stringstream_char_from_basic_ios(basic_ios_char *ptr)
12152 {
12153     return (basic_stringstream_char*)((char*)ptr-basic_stringstream_char_vbtable1[1]);
12154 }
12155
12156 /* ??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 */
12157 /* ??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 */
12158 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor_str, 16)
12159 basic_stringstream_char* __thiscall basic_stringstream_char_ctor_str(basic_stringstream_char *this,
12160         const basic_string_char *str, int mode, MSVCP_bool virt_init)
12161 {
12162     basic_ios_char *basic_ios;
12163
12164     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12165
12166     if(virt_init) {
12167         this->base.base1.vbtable = basic_stringstream_char_vbtable1;
12168         this->base.base2.vbtable = basic_stringstream_char_vbtable2;
12169         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12170         basic_ios_char_ctor(basic_ios);
12171     }else {
12172         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12173     }
12174
12175     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode);
12176     basic_iostream_char_ctor(&this->base, &this->strbuf.base, FALSE);
12177     basic_ios->base.vtable = &MSVCP_basic_stringstream_char_vtable;
12178     return this;
12179 }
12180
12181 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
12182 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
12183 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor_mode, 12)
12184 basic_stringstream_char* __thiscall basic_stringstream_char_ctor_mode(
12185         basic_stringstream_char *this, int mode, MSVCP_bool virt_init)
12186 {
12187     basic_ios_char *basic_ios;
12188
12189     TRACE("(%p %d %d)\n", this, mode, virt_init);
12190
12191     if(virt_init) {
12192         this->base.base1.vbtable = basic_stringstream_char_vbtable1;
12193         this->base.base2.vbtable = basic_stringstream_char_vbtable2;
12194         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12195         basic_ios_char_ctor(basic_ios);
12196     }else {
12197         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12198     }
12199
12200     basic_stringbuf_char_ctor_mode(&this->strbuf, mode);
12201     basic_iostream_char_ctor(&this->base, &this->strbuf.base, FALSE);
12202     basic_ios->base.vtable = &MSVCP_basic_stringstream_char_vtable;
12203     return this;
12204 }
12205
12206 /* ??_F?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
12207 /* ??_F?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
12208 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor, 8)
12209 basic_stringstream_char* __thiscall basic_stringstream_char_ctor(
12210         basic_stringstream_char *this, MSVCP_bool virt_init)
12211 {
12212     return basic_stringstream_char_ctor_mode(
12213             this, OPENMODE_out|OPENMODE_in, virt_init);
12214 }
12215
12216 /* ??1?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
12217 /* ??1?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
12218 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_dtor, 4)
12219 void __thiscall basic_stringstream_char_dtor(basic_ios_char *base)
12220 {
12221     basic_stringstream_char *this = basic_stringstream_char_from_basic_ios(base);
12222
12223     TRACE("(%p)\n", this);
12224
12225     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
12226     basic_stringbuf_char_dtor(&this->strbuf);
12227 }
12228
12229 /* ??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
12230 /* ??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
12231 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_vbase_dtor, 4)
12232 void __thiscall basic_stringstream_char_vbase_dtor(basic_stringstream_char *this)
12233 {
12234     TRACE("(%p)\n", this);
12235
12236     basic_stringstream_char_dtor(basic_stringstream_char_to_basic_ios(this));
12237     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
12238 }
12239
12240 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_vector_dtor, 8)
12241 basic_stringstream_char* __thiscall basic_stringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
12242 {
12243     basic_stringstream_char *this = basic_stringstream_char_from_basic_ios(base);
12244
12245     TRACE("(%p %x)\n", this, flags);
12246
12247     if(flags & 2) {
12248         /* we have an array, with the number of elements stored before the first object */
12249         INT_PTR i, *ptr = (INT_PTR *)this-1;
12250
12251         for(i=*ptr-1; i>=0; i--)
12252             basic_stringstream_char_vbase_dtor(this+i);
12253         MSVCRT_operator_delete(ptr);
12254     } else {
12255         basic_stringstream_char_vbase_dtor(this);
12256         if(flags & 1)
12257             MSVCRT_operator_delete(this);
12258     }
12259
12260     return this;
12261 }
12262
12263 /* ?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 */
12264 /* ?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 */
12265 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_rdbuf, 4)
12266 basic_stringbuf_char* __thiscall basic_stringstream_char_rdbuf(const basic_stringstream_char *this)
12267 {
12268     TRACE("(%p)\n", this);
12269     return (basic_stringbuf_char*)&this->strbuf;
12270 }
12271
12272 /* ?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 */
12273 /* ?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 */
12274 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_str_set, 8)
12275 void __thiscall basic_stringstream_char_str_set(basic_stringstream_char *this, const basic_string_char *str)
12276 {
12277     TRACE("(%p %p)\n", this, str);
12278     basic_stringbuf_char_str_set(&this->strbuf, str);
12279 }
12280
12281 /* ?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 */
12282 /* ?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 */
12283 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_str_get, 8)
12284 basic_string_char* __thiscall basic_stringstream_char_str_get(const basic_stringstream_char *this, basic_string_char *ret)
12285 {
12286     TRACE("(%p %p)\n", this, ret);
12287     return basic_stringbuf_char_str_get(&this->strbuf, ret);
12288 }
12289
12290 static inline basic_ios_wchar* basic_stringstream_wchar_to_basic_ios(basic_stringstream_wchar *ptr)
12291 {
12292     return (basic_ios_wchar*)((char*)ptr+basic_stringstream_wchar_vbtable1[1]);
12293 }
12294
12295 static inline basic_stringstream_wchar* basic_stringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
12296 {
12297     return (basic_stringstream_wchar*)((char*)ptr-basic_stringstream_wchar_vbtable1[1]);
12298 }
12299
12300 /* ??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 */
12301 /* ??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 */
12302 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor_str, 16)
12303 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor_str(basic_stringstream_wchar *this,
12304         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12305 {
12306     basic_ios_wchar *basic_ios;
12307
12308     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12309
12310     if(virt_init) {
12311         this->base.base1.vbtable = basic_stringstream_wchar_vbtable1;
12312         this->base.base2.vbtable = basic_stringstream_wchar_vbtable2;
12313         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12314         basic_ios_wchar_ctor(basic_ios);
12315     }else {
12316         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12317     }
12318
12319     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode);
12320     basic_iostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE);
12321     basic_ios->base.vtable = &MSVCP_basic_stringstream_wchar_vtable;
12322     return this;
12323 }
12324
12325 /* ??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 */
12326 /* ??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 */
12327 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor_str, 16)
12328 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor_str(basic_stringstream_wchar *this,
12329         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12330 {
12331     basic_stringstream_wchar_ctor_str(this, str, mode, virt_init);
12332     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_stringstream_short_vtable;
12333     return this;
12334 }
12335
12336 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
12337 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
12338 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor_mode, 12)
12339 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor_mode(
12340         basic_stringstream_wchar *this, int mode, MSVCP_bool virt_init)
12341 {
12342     basic_ios_wchar *basic_ios;
12343
12344     TRACE("(%p %d %d)\n", this, mode, virt_init);
12345
12346     if(virt_init) {
12347         this->base.base1.vbtable = basic_stringstream_wchar_vbtable1;
12348         this->base.base2.vbtable = basic_stringstream_wchar_vbtable2;
12349         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12350         basic_ios_wchar_ctor(basic_ios);
12351     }else {
12352         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12353     }
12354
12355     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode);
12356     basic_iostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE);
12357     basic_ios->base.vtable = &MSVCP_basic_stringstream_wchar_vtable;
12358     return this;
12359 }
12360
12361 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
12362 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
12363 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor_mode, 12)
12364 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor_mode(
12365         basic_stringstream_wchar *this, int mode, MSVCP_bool virt_init)
12366 {
12367     basic_stringstream_wchar_ctor_mode(this, mode, virt_init);
12368     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_stringstream_short_vtable;
12369     return this;
12370 }
12371
12372 /* ??_F?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12373 /* ??_F?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12374 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor, 8)
12375 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor(
12376         basic_stringstream_wchar *this, MSVCP_bool virt_init)
12377 {
12378     return basic_stringstream_wchar_ctor_mode(
12379             this, OPENMODE_out|OPENMODE_in, virt_init);
12380 }
12381
12382 /* ??_F?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12383 /* ??_F?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12384 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor, 8)
12385 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor(
12386         basic_stringstream_wchar *this, MSVCP_bool virt_init)
12387 {
12388     return basic_stringstream_short_ctor_mode(
12389             this, OPENMODE_out|OPENMODE_in, virt_init);
12390 }
12391
12392 /* ??1?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
12393 /* ??1?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
12394 /* ??1?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
12395 /* ??1?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
12396 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_dtor, 4)
12397 void __thiscall basic_stringstream_wchar_dtor(basic_ios_wchar *base)
12398 {
12399     basic_stringstream_wchar *this = basic_stringstream_wchar_from_basic_ios(base);
12400
12401     TRACE("(%p)\n", this);
12402
12403     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(&this->base));
12404     basic_stringbuf_wchar_dtor(&this->strbuf);
12405 }
12406
12407 /* ??_D?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12408 /* ??_D?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12409 /* ??_D?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12410 /* ??_D?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12411 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_vbase_dtor, 4)
12412 void __thiscall basic_stringstream_wchar_vbase_dtor(basic_stringstream_wchar *this)
12413 {
12414     TRACE("(%p)\n", this);
12415
12416     basic_stringstream_wchar_dtor(basic_stringstream_wchar_to_basic_ios(this));
12417     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base.base1));
12418 }
12419
12420 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_vector_dtor, 8)
12421 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
12422 {
12423     basic_stringstream_wchar *this = basic_stringstream_wchar_from_basic_ios(base);
12424
12425     TRACE("(%p %x)\n", this, flags);
12426
12427     if(flags & 2) {
12428         /* we have an array, with the number of elements stored before the first object */
12429         INT_PTR i, *ptr = (INT_PTR *)this-1;
12430
12431         for(i=*ptr-1; i>=0; i--)
12432             basic_stringstream_wchar_vbase_dtor(this+i);
12433         MSVCRT_operator_delete(ptr);
12434     } else {
12435         basic_stringstream_wchar_vbase_dtor(this);
12436         if(flags & 1)
12437             MSVCRT_operator_delete(this);
12438     }
12439
12440     return this;
12441 }
12442
12443 /* ?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 */
12444 /* ?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 */
12445 /* ?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 */
12446 /* ?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 */
12447 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_rdbuf, 4)
12448 basic_stringbuf_wchar* __thiscall basic_stringstream_wchar_rdbuf(const basic_stringstream_wchar *this)
12449 {
12450     TRACE("(%p)\n", this);
12451     return (basic_stringbuf_wchar*)&this->strbuf;
12452 }
12453
12454 /* ?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 */
12455 /* ?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 */
12456 /* ?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 */
12457 /* ?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 */
12458 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_str_set, 8)
12459 void __thiscall basic_stringstream_wchar_str_set(basic_stringstream_wchar *this, const basic_string_wchar *str)
12460 {
12461     TRACE("(%p %p)\n", this, str);
12462     basic_stringbuf_wchar_str_set(&this->strbuf, str);
12463 }
12464
12465 /* ?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 */
12466 /* ?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 */
12467 /* ?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 */
12468 /* ?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 */
12469 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_str_get, 8)
12470 basic_string_wchar* __thiscall basic_stringstream_wchar_str_get(const basic_stringstream_wchar *this, basic_string_wchar *ret)
12471 {
12472     TRACE("(%p %p)\n", this, ret);
12473     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
12474 }
12475
12476 /* ?_Init@strstreambuf@std@@IAEXHPAD0H@Z */
12477 /* ?_Init@strstreambuf@std@@IEAAX_JPEAD1H@Z */
12478 DEFINE_THISCALL_WRAPPER(strstreambuf__Init, 20)
12479 void __thiscall strstreambuf__Init(strstreambuf *this, streamsize len, char *g, char *p, int mode)
12480 {
12481     TRACE("(%p %ld %p %p %d)\n", this, len, g, p, mode);
12482
12483     this->minsize = 32;
12484     this->endsave = NULL;
12485     this->strmode = mode;
12486     this->palloc = NULL;
12487     this->pfree = NULL;
12488
12489     if(!g) {
12490         this->strmode |= STRSTATE_Dynamic;
12491         if(len > this->minsize)
12492             this->minsize = len;
12493         this->seekhigh = NULL;
12494         return;
12495     }
12496
12497     if(len < 0)
12498         len = INT_MAX;
12499     else if(!len)
12500         len = strlen(g);
12501
12502     this->seekhigh = g+len;
12503     basic_streambuf_char_setg(&this->base, g, g, p ? p : this->seekhigh);
12504     if(p)
12505         basic_streambuf_char_setp(&this->base, p, this->seekhigh);
12506 }
12507
12508 /* ??0strstreambuf@std@@QAE@PACH0@Z */
12509 /* ??0strstreambuf@std@@QEAA@PEAC_J0@Z */
12510 /* ??0strstreambuf@std@@QAE@PADH0@Z */
12511 /* ??0strstreambuf@std@@QEAA@PEAD_J0@Z */
12512 /* ??0strstreambuf@std@@QAE@PAEH0@Z */
12513 /* ??0strstreambuf@std@@QEAA@PEAE_J0@Z */
12514 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_get_put, 16)
12515 strstreambuf* __thiscall strstreambuf_ctor_get_put(strstreambuf *this, char *g, streamsize len, char *p)
12516 {
12517     TRACE("(%p %p %ld %p)\n", this, g, len, p);
12518
12519     basic_streambuf_char_ctor(&this->base);
12520     this->base.vtable = &MSVCP_strstreambuf_vtable;
12521
12522     strstreambuf__Init(this, len, g, p, 0);
12523     return this;
12524 }
12525
12526 /* ??0strstreambuf@std@@QAE@H@Z */
12527 /* ??0strstreambuf@std@@QEAA@_J@Z */
12528 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_len, 8)
12529 strstreambuf* __thiscall strstreambuf_ctor_len(strstreambuf *this, streamsize len)
12530 {
12531     return strstreambuf_ctor_get_put(this, NULL, len, NULL);
12532 }
12533
12534 /* ??0strstreambuf@std@@QAE@P6APAXI@ZP6AXPAX@Z@Z */
12535 /* ??0strstreambuf@std@@QEAA@P6APEAX_K@ZP6AXPEAX@Z@Z */
12536 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_alloc, 12)
12537 strstreambuf* __thiscall strstreambuf_ctor_alloc(strstreambuf *this, void* (__cdecl *palloc)(MSVCP_size_t), void (__cdecl *pfree)(void*))
12538 {
12539     TRACE("(%p %p %p)\n", this, palloc, pfree);
12540
12541     strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12542     this->palloc = palloc;
12543     this->pfree = pfree;
12544     return this;
12545 }
12546
12547 /* ??0strstreambuf@std@@QAE@PBCH@Z */
12548 /* ??0strstreambuf@std@@QEAA@PEBC_J@Z */
12549 /* ??0strstreambuf@std@@QAE@PBDH@Z */
12550 /* ??0strstreambuf@std@@QEAA@PEBD_J@Z */
12551 /* ??0strstreambuf@std@@QAE@PBEH@Z */
12552 /* ??0strstreambuf@std@@QEAA@PEBE_J@Z */
12553 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_get, 12)
12554 strstreambuf* __thiscall strstreambuf_ctor_get(strstreambuf *this, const char *g, streamsize len)
12555 {
12556     TRACE("(%p %p %ld)\n", this, g, len);
12557
12558     strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12559     this->strmode |= STRSTATE_Constant;
12560     return this;
12561 }
12562
12563 /* ??_Fstrstreambuf@std@@QAEXXZ */
12564 /* ??_Fstrstreambuf@std@@QEAAXXZ */
12565 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor, 4)
12566 strstreambuf* __thiscall strstreambuf_ctor(strstreambuf *this)
12567 {
12568     return strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12569 }
12570
12571 /* ?_Tidy@strstreambuf@std@@IAEXXZ */
12572 /* ?_Tidy@strstreambuf@std@@IEAAXXZ */
12573 DEFINE_THISCALL_WRAPPER(strstreambuf__Tidy, 4)
12574 void __thiscall strstreambuf__Tidy(strstreambuf *this)
12575 {
12576     TRACE("(%p)\n", this);
12577
12578     if((this->strmode & STRSTATE_Allocated) && !(this->strmode & STRSTATE_Frozen)) {
12579         if(this->pfree)
12580             this->pfree(basic_streambuf_char_eback(&this->base));
12581         else
12582             MSVCRT_operator_delete(basic_streambuf_char_eback(&this->base));
12583     }
12584
12585     this->endsave = NULL;
12586     this->seekhigh = NULL;
12587     this->strmode &= ~(STRSTATE_Allocated | STRSTATE_Frozen);
12588     basic_streambuf_char_setg(&this->base, NULL, NULL, NULL);
12589     basic_streambuf_char_setp(&this->base, NULL, NULL);
12590 }
12591
12592 /* ??1strstreambuf@std@@UAE@XZ */
12593 /* ??1strstreambuf@std@@UEAA@XZ */
12594 DEFINE_THISCALL_WRAPPER(strstreambuf_dtor, 4)
12595 void __thiscall strstreambuf_dtor(strstreambuf *this)
12596 {
12597     TRACE("(%p)\n", this);
12598
12599     strstreambuf__Tidy(this);
12600     basic_streambuf_char_dtor(&this->base);
12601 }
12602
12603 DEFINE_THISCALL_WRAPPER(strstreambuf_vector_dtor, 8)
12604 strstreambuf* __thiscall strstreambuf_vector_dtor(strstreambuf *this, unsigned int flags)
12605 {
12606     TRACE("(%p %x)\n", this, flags);
12607     if(flags & 2) {
12608         /* we have an array, with the number of elements stored before the first object */
12609         INT_PTR i, *ptr = (INT_PTR *)this-1;
12610
12611         for(i=*ptr-1; i>=0; i--)
12612             strstreambuf_dtor(this+i);
12613         MSVCRT_operator_delete(ptr);
12614     } else {
12615         strstreambuf_dtor(this);
12616         if(flags & 1)
12617             MSVCRT_operator_delete(this);
12618     }
12619
12620     return this;
12621 }
12622
12623 /* ?freeze@strstreambuf@std@@QAEX_N@Z */
12624 /* ?freeze@strstreambuf@std@@QEAAX_N@Z */
12625 DEFINE_THISCALL_WRAPPER(strstreambuf_freeze, 8)
12626 void __thiscall strstreambuf_freeze(strstreambuf *this, MSVCP_bool freeze)
12627 {
12628     TRACE("(%p %d)\n", this, freeze);
12629
12630     if(!freeze == !(this->strmode *STRSTATE_Frozen))
12631         return;
12632
12633     if(freeze) {
12634         this->strmode |= STRSTATE_Frozen;
12635         this->endsave = basic_streambuf_char_epptr(&this->base);
12636         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
12637                 basic_streambuf_char_pptr(&this->base), basic_streambuf_char_eback(&this->base));
12638     }else {
12639         this->strmode &= ~STRSTATE_Frozen;
12640         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
12641                 basic_streambuf_char_pptr(&this->base), this->endsave);
12642     }
12643 }
12644
12645 /* ?str@strstreambuf@std@@QAEPADXZ */
12646 /* ?str@strstreambuf@std@@QEAAPEADXZ */
12647 DEFINE_THISCALL_WRAPPER(strstreambuf_str, 4)
12648 char* __thiscall strstreambuf_str(strstreambuf *this)
12649 {
12650     TRACE("(%p)\n", this);
12651
12652     strstreambuf_freeze(this, TRUE);
12653     return basic_streambuf_char_gptr(&this->base);
12654 }
12655
12656 /* ?pcount@strstreambuf@std@@QBEHXZ */
12657 /* ?pcount@strstreambuf@std@@QEBA_JXZ */
12658 DEFINE_THISCALL_WRAPPER(strstreambuf_pcount, 4)
12659 streamsize __thiscall strstreambuf_pcount(const strstreambuf *this)
12660 {
12661     char *ppos = basic_streambuf_char_pptr(&this->base);
12662
12663     TRACE("(%p)\n", this);
12664
12665     return ppos ? ppos-basic_streambuf_char_pbase(&this->base) : 0;
12666 }
12667
12668 /* ?overflow@strstreambuf@std@@MAEHH@Z */
12669 /* ?overflow@strstreambuf@std@@MEAAHH@Z */
12670 DEFINE_THISCALL_WRAPPER(strstreambuf_overflow, 8)
12671 int __thiscall strstreambuf_overflow(strstreambuf *this, int c)
12672 {
12673     MSVCP_size_t old_size, size;
12674     char *ptr, *buf;
12675
12676     TRACE("(%p %d)\n", this, c);
12677
12678     if(c == EOF)
12679         return !EOF;
12680
12681     if(this->strmode & STRSTATE_Frozen)
12682         return EOF;
12683
12684     ptr = basic_streambuf_char_pptr(&this->base);
12685     if(ptr && ptr<basic_streambuf_char_epptr(&this->base))
12686         return (unsigned char)(*basic_streambuf_char__Pninc(&this->base) = c);
12687
12688     if(!(this->strmode & STRSTATE_Dynamic) || (this->strmode & STRSTATE_Constant))
12689         return EOF;
12690
12691     ptr = basic_streambuf_char_eback(&this->base);
12692     old_size = ptr ? basic_streambuf_char_epptr(&this->base) - ptr : 0;
12693
12694     size = old_size + old_size/2;
12695     if(size < this->minsize)
12696         size = this->minsize;
12697
12698     if(this->palloc)
12699         buf = this->palloc(size);
12700     else
12701         buf = MSVCRT_operator_new(size);
12702     if(!buf)
12703         return EOF;
12704
12705     memcpy(buf, ptr, old_size);
12706     if(this->strmode & STRSTATE_Allocated) {
12707         if(this->pfree)
12708             this->pfree(ptr);
12709         else
12710             MSVCRT_operator_delete(ptr);
12711     }
12712
12713     this->strmode |= STRSTATE_Allocated;
12714     if(!old_size) {
12715         this->seekhigh = buf;
12716         basic_streambuf_char_setp(&this->base, buf, buf+size);
12717         basic_streambuf_char_setg(&this->base, buf, buf, buf);
12718     }else {
12719         this->seekhigh = this->seekhigh-ptr+buf;
12720         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base)-ptr+buf,
12721                 basic_streambuf_char_pptr(&this->base)-ptr+buf, buf+size);
12722         basic_streambuf_char_setg(&this->base, buf, basic_streambuf_char_gptr(&this->base)-ptr+buf,
12723                 basic_streambuf_char_pptr(&this->base));
12724     }
12725
12726     return (unsigned char)(*basic_streambuf_char__Pninc(&this->base) = c);
12727 }
12728
12729 /* ?pbackfail@strstreambuf@std@@MAEHH@Z */
12730 /* ?pbackfail@strstreambuf@std@@MEAAHH@Z */
12731 DEFINE_THISCALL_WRAPPER(strstreambuf_pbackfail, 8)
12732 int __thiscall strstreambuf_pbackfail(strstreambuf *this, int c)
12733 {
12734     char *ptr = basic_streambuf_char_gptr(&this->base);
12735
12736     TRACE("(%p %d)\n", this, c);
12737
12738     if(ptr<=basic_streambuf_char_eback(&this->base)
12739             || ((this->strmode & STRSTATE_Constant) && c!=ptr[-1]))
12740         return EOF;
12741
12742     basic_streambuf_char_gbump(&this->base, -1);
12743     if(c == EOF)
12744         return !EOF;
12745     if(this->strmode & STRSTATE_Constant)
12746         return (unsigned char)c;
12747
12748     return (unsigned char)(ptr[0] = c);
12749 }
12750
12751 /* ?seekoff@strstreambuf@std@@MAE?AV?$fpos@H@2@JHH@Z */
12752 /* ?seekoff@strstreambuf@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
12753 DEFINE_THISCALL_WRAPPER(strstreambuf_seekoff, 20)
12754 fpos_int* __thiscall strstreambuf_seekoff(strstreambuf *this, fpos_int *ret, streamoff off, int way, int mode)
12755 {
12756     char *eback = basic_streambuf_char_eback(&this->base);
12757     char *pptr = basic_streambuf_char_pptr(&this->base);
12758     char *gptr = basic_streambuf_char_gptr(&this->base);
12759
12760     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
12761
12762     ret->off = 0;
12763     ret->state = 0;
12764
12765     if(pptr > this->seekhigh)
12766         this->seekhigh = pptr;
12767
12768     if((mode & OPENMODE_in) && gptr) {
12769         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
12770             off += gptr-eback;
12771         else if(way == SEEKDIR_end)
12772             off += this->seekhigh-eback;
12773         else if(way != SEEKDIR_beg)
12774             off = -1;
12775
12776         if(off<0 || off>this->seekhigh-eback) {
12777             off = -1;
12778         }else {
12779             basic_streambuf_char_gbump(&this->base, eback-gptr+off);
12780             if((mode & OPENMODE_out) && pptr) {
12781                 basic_streambuf_char_setp_next(&this->base, eback,
12782                         gptr, basic_streambuf_char_epptr(&this->base));
12783             }
12784         }
12785     }else if((mode & OPENMODE_out) && pptr) {
12786         if(way == SEEKDIR_cur)
12787             off += pptr-eback;
12788         else if(way == SEEKDIR_end)
12789             off += this->seekhigh-eback;
12790         else if(way != SEEKDIR_beg)
12791             off = -1;
12792
12793          if(off<0 || off>this->seekhigh-eback)
12794              off = -1;
12795          else
12796              basic_streambuf_char_pbump(&this->base, eback-pptr+off);
12797     }else {
12798         off = -1;
12799     }
12800
12801     ret->pos = off;
12802     return ret;
12803 }
12804
12805 /* ?seekpos@strstreambuf@std@@MAE?AV?$fpos@H@2@V32@H@Z */
12806 /* ?seekpos@strstreambuf@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
12807 DEFINE_THISCALL_WRAPPER(strstreambuf_seekpos, 36)
12808 fpos_int* __thiscall strstreambuf_seekpos(strstreambuf *this, fpos_int *ret, fpos_int pos, int mode)
12809 {
12810     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
12811
12812     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
12813         *ret = pos;
12814         return ret;
12815     }
12816
12817     return strstreambuf_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
12818 }
12819
12820 /* ?underflow@strstreambuf@std@@MAEHXZ */
12821 /* ?underflow@strstreambuf@std@@MEAAHXZ */
12822 DEFINE_THISCALL_WRAPPER(strstreambuf_underflow, 4)
12823 int __thiscall strstreambuf_underflow(strstreambuf *this)
12824 {
12825     char *gptr = basic_streambuf_char_gptr(&this->base);
12826     char *pptr;
12827
12828     TRACE("(%p)\n", this);
12829
12830     if(!gptr)
12831         return EOF;
12832
12833     if(gptr < basic_streambuf_char_egptr(&this->base))
12834         return (unsigned char)(*gptr);
12835
12836     pptr = basic_streambuf_char_gptr(&this->base);
12837     if(pptr > this->seekhigh)
12838         this->seekhigh = pptr;
12839
12840     if(this->seekhigh <= gptr)
12841         return EOF;
12842
12843     basic_streambuf_char_setg(&this->base, basic_streambuf_char_eback(&this->base),
12844             gptr, this->seekhigh);
12845     return (unsigned char)(*gptr);
12846 }
12847
12848 static void __cdecl setprecision_func(ios_base *base, streamsize prec)
12849 {
12850     ios_base_precision_set(base, prec);
12851 }
12852
12853 /* ?setprecision@std@@YA?AU?$_Smanip@H@1@H@Z */
12854 /* ?setprecision@std@@YA?AU?$_Smanip@_J@1@_J@Z */
12855 manip_streamsize* __cdecl setprecision(manip_streamsize *ret, streamsize prec)
12856 {
12857     TRACE("(%p %ld)\n", ret, prec);
12858
12859     ret->pfunc = setprecision_func;
12860     ret->arg = prec;
12861     return ret;
12862 }
12863
12864 static void __cdecl setw_func(ios_base *base, streamsize width)
12865 {
12866     ios_base_width_set(base, width);
12867 }
12868
12869 /* ?setw@std@@YA?AU?$_Smanip@H@1@H@Z */
12870 /* ?setw@std@@YA?AU?$_Smanip@_J@1@_J@Z */
12871 manip_streamsize* __cdecl setw(manip_streamsize *ret, streamsize width)
12872 {
12873     TRACE("(%p %ld)\n", ret, width);
12874
12875     ret->pfunc = setw_func;
12876     ret->arg = width;
12877     return ret;
12878 }
12879
12880 static basic_filebuf_char filebuf_char_stdin;
12881 /* ?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A */
12882 struct {
12883     basic_istream_char obj;
12884     basic_ios_char vbase;
12885 } cin = { { 0 } };
12886 /* ?_Ptr_cin@std@@3PAV?$basic_istream@DU?$char_traits@D@std@@@1@A */
12887 /* ?_Ptr_cin@std@@3PEAV?$basic_istream@DU?$char_traits@D@std@@@1@EA */
12888 basic_istream_char *_Ptr_cin = &cin.obj;
12889
12890 static basic_filebuf_wchar filebuf_short_stdin;
12891 /* ?wcin@std@@3V?$basic_istream@GU?$char_traits@G@std@@@1@A */
12892 struct {
12893     basic_istream_wchar obj;
12894     basic_ios_wchar vbase;
12895 } ucin = { { 0 } };
12896 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@GU?$char_traits@G@std@@@1@A */
12897 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@GU?$char_traits@G@std@@@1@EA */
12898 basic_istream_wchar *_Ptr_ucin = &ucin.obj;
12899
12900 static basic_filebuf_wchar filebuf_wchar_stdin;
12901 /* ?wcin@std@@3V?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
12902 struct {
12903     basic_istream_wchar obj;
12904     basic_ios_wchar vbase;
12905 } wcin = { { 0 } };
12906 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
12907 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@EA */
12908 basic_istream_wchar *_Ptr_wcin = &wcin.obj;
12909
12910 static basic_filebuf_char filebuf_char_stdout;
12911 /* ?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12912 struct {
12913     basic_ostream_char obj;
12914     basic_ios_char vbase;
12915 } cout = { { 0 } };
12916 /* ?_Ptr_cout@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12917 /* ?_Ptr_cout@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
12918 basic_ostream_char *_Ptr_cout = &cout.obj;
12919
12920 static basic_filebuf_wchar filebuf_short_stdout;
12921 /* ?wcout@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12922 struct {
12923     basic_ostream_wchar obj;
12924     basic_ios_wchar vbase;
12925 } ucout = { { 0 } };
12926 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12927 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
12928 basic_ostream_wchar *_Ptr_ucout = &ucout.obj;
12929
12930 static basic_filebuf_wchar filebuf_wchar_stdout;
12931 /* ?wcout@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12932 struct {
12933     basic_ostream_wchar obj;
12934     basic_ios_wchar vbase;
12935 } wcout = { { 0 } };
12936 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12937 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
12938 basic_ostream_wchar *_Ptr_wcout = &wcout.obj;
12939
12940 static basic_filebuf_char filebuf_char_stderr;
12941 /* ?cerr@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12942 struct {
12943     basic_ostream_char obj;
12944     basic_ios_char vbase;
12945 } cerr = { { 0 } };
12946 /* ?_Ptr_cerr@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12947 /* ?_Ptr_cerr@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
12948 basic_ostream_char *_Ptr_cerr = &cerr.obj;
12949
12950 static basic_filebuf_wchar filebuf_short_stderr;
12951 /* ?wcerr@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12952 struct {
12953     basic_ostream_wchar obj;
12954     basic_ios_wchar vbase;
12955 } ucerr = { { 0 } };
12956 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12957 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
12958 basic_ostream_wchar *_Ptr_ucerr = &ucerr.obj;
12959
12960 static basic_filebuf_wchar filebuf_wchar_stderr;
12961 /* ?wcerr@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12962 struct {
12963     basic_ostream_wchar obj;
12964     basic_ios_wchar vbase;
12965 } wcerr = { { 0 } };
12966 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12967 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
12968 basic_ostream_wchar *_Ptr_wcerr = &wcerr.obj;
12969
12970 static basic_filebuf_char filebuf_char_log;
12971 /* ?clog@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12972 struct {
12973     basic_ostream_char obj;
12974     basic_ios_char vbase;
12975 } clog = { { 0 } };
12976 /* ?_Ptr_clog@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12977 /* ?_Ptr_clog@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
12978 basic_ostream_char *_Ptr_clog = &clog.obj;
12979
12980 static basic_filebuf_wchar filebuf_short_log;
12981 /* ?wclog@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12982 struct {
12983     basic_ostream_wchar obj;
12984     basic_ios_wchar vbase;
12985 } uclog = { { 0 } };
12986 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12987 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
12988 basic_ostream_wchar *_Ptr_uclog = &uclog.obj;
12989
12990 static basic_filebuf_wchar filebuf_wchar_log;
12991 /* ?wclog@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12992 struct {
12993     basic_ostream_wchar obj;
12994     basic_ios_wchar vbase;
12995 } wclog = { { 0 } };
12996 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12997 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
12998 basic_ostream_wchar *_Ptr_wclog = &wclog.obj;
12999
13000 void init_io(void *base)
13001 {
13002 #ifdef __x86_64__
13003     init_iosb_rtti(base);
13004     init_ios_base_rtti(base);
13005     init_basic_ios_char_rtti(base);
13006     init_basic_ios_wchar_rtti(base);
13007     init_basic_ios_short_rtti(base);
13008     init_basic_streambuf_char_rtti(base);
13009     init_basic_streambuf_wchar_rtti(base);
13010     init_basic_streambuf_short_rtti(base);
13011     init_basic_filebuf_char_rtti(base);
13012     init_basic_filebuf_wchar_rtti(base);
13013     init_basic_filebuf_short_rtti(base);
13014     init_basic_stringbuf_char_rtti(base);
13015     init_basic_stringbuf_wchar_rtti(base);
13016     init_basic_stringbuf_short_rtti(base);
13017     init_basic_ostream_char_rtti(base);
13018     init_basic_ostream_wchar_rtti(base);
13019     init_basic_ostream_short_rtti(base);
13020     init_basic_istream_char_rtti(base);
13021     init_basic_istream_wchar_rtti(base);
13022     init_basic_istream_short_rtti(base);
13023     init_basic_iostream_char_rtti(base);
13024     init_basic_iostream_wchar_rtti(base);
13025     init_basic_iostream_short_rtti(base);
13026     init_basic_ofstream_char_rtti(base);
13027     init_basic_ofstream_wchar_rtti(base);
13028     init_basic_ofstream_short_rtti(base);
13029     init_basic_ifstream_char_rtti(base);
13030     init_basic_ifstream_wchar_rtti(base);
13031     init_basic_ifstream_short_rtti(base);
13032     init_basic_fstream_char_rtti(base);
13033     init_basic_fstream_wchar_rtti(base);
13034     init_basic_fstream_short_rtti(base);
13035     init_basic_ostringstream_char_rtti(base);
13036     init_basic_ostringstream_wchar_rtti(base);
13037     init_basic_ostringstream_short_rtti(base);
13038     init_basic_istringstream_char_rtti(base);
13039     init_basic_istringstream_wchar_rtti(base);
13040     init_basic_istringstream_short_rtti(base);
13041     init_basic_stringstream_char_rtti(base);
13042     init_basic_stringstream_wchar_rtti(base);
13043     init_basic_stringstream_short_rtti(base);
13044     init_strstreambuf_rtti(base);
13045 #endif
13046
13047     basic_filebuf_char_ctor_file(&filebuf_char_stdin, stdin);
13048     basic_istream_char_ctor(&cin.obj, &filebuf_char_stdin.base, FALSE/*FIXME*/, TRUE);
13049
13050     basic_filebuf_short_ctor_file(&filebuf_short_stdin, stdin);
13051     basic_istream_short_ctor(&ucin.obj, &filebuf_short_stdin.base, FALSE/*FIXME*/, TRUE);
13052
13053     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdin, stdin);
13054     basic_istream_wchar_ctor(&wcin.obj, &filebuf_wchar_stdin.base, FALSE/*FIXME*/, TRUE);
13055
13056     basic_filebuf_char_ctor_file(&filebuf_char_stdout, stdout);
13057     basic_ostream_char_ctor(&cout.obj, &filebuf_char_stdout.base, FALSE/*FIXME*/, TRUE);
13058
13059     basic_filebuf_short_ctor_file(&filebuf_short_stdout, stdout);
13060     basic_ostream_short_ctor(&ucout.obj, &filebuf_short_stdout.base, FALSE/*FIXME*/, TRUE);
13061
13062     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdout, stdout);
13063     basic_ostream_wchar_ctor(&wcout.obj, &filebuf_wchar_stdout.base, FALSE/*FIXME*/, TRUE);
13064
13065     basic_filebuf_char_ctor_file(&filebuf_char_stderr, stderr);
13066     basic_ostream_char_ctor(&cerr.obj, &filebuf_char_stderr.base, FALSE/*FIXME*/, TRUE);
13067
13068     basic_filebuf_short_ctor_file(&filebuf_short_stderr, stderr);
13069     basic_ostream_short_ctor(&ucerr.obj, &filebuf_short_stderr.base, FALSE/*FIXME*/, TRUE);
13070
13071     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stderr, stderr);
13072     basic_ostream_wchar_ctor(&wcerr.obj, &filebuf_wchar_stderr.base, FALSE/*FIXME*/, TRUE);
13073
13074     basic_filebuf_char_ctor_file(&filebuf_char_log, stderr);
13075     basic_ostream_char_ctor(&clog.obj, &filebuf_char_log.base, FALSE/*FIXME*/, TRUE);
13076
13077     basic_filebuf_short_ctor_file(&filebuf_short_log, stderr);
13078     basic_ostream_short_ctor(&uclog.obj, &filebuf_short_log.base, FALSE/*FIXME*/, TRUE);
13079
13080     basic_filebuf_wchar_ctor_file(&filebuf_wchar_log, stderr);
13081     basic_ostream_wchar_ctor(&wclog.obj, &filebuf_wchar_log.base, FALSE/*FIXME*/, TRUE);
13082 }
13083
13084 void free_io(void)
13085 {
13086     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&cin.obj));
13087     basic_filebuf_char_dtor(&filebuf_char_stdin);
13088
13089     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&ucin.obj));
13090     basic_filebuf_wchar_dtor(&filebuf_short_stdin);
13091
13092     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&wcin.obj));
13093     basic_filebuf_wchar_dtor(&filebuf_wchar_stdin);
13094
13095     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&cout.obj));
13096     basic_filebuf_char_dtor(&filebuf_char_stdout);
13097
13098     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&ucout.obj));
13099     basic_filebuf_wchar_dtor(&filebuf_short_stdout);
13100
13101     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wcout.obj));
13102     basic_filebuf_wchar_dtor(&filebuf_wchar_stdout);
13103
13104     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&cerr.obj));
13105     basic_filebuf_char_dtor(&filebuf_char_stderr);
13106
13107     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&ucerr.obj));
13108     basic_filebuf_wchar_dtor(&filebuf_short_stderr);
13109
13110     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wcerr.obj));
13111     basic_filebuf_wchar_dtor(&filebuf_wchar_stderr);
13112
13113     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&clog.obj));
13114     basic_filebuf_char_dtor(&filebuf_char_log);
13115
13116     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&uclog.obj));
13117     basic_filebuf_wchar_dtor(&filebuf_short_log);
13118
13119     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wclog.obj));
13120     basic_filebuf_wchar_dtor(&filebuf_wchar_log);
13121 }