msvcp100: Manually define virtual destructors in vtables.
[wine] / dlls / msvcp100 / 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 "msvcp.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(%s %s %d)", wine_dbgstr_longlong(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, ALIGNED_SIZE(sizeof(basic_ostream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_ostream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_ostream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_istream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_istream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_istream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_iostream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_iostream_char), 8)-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, ALIGNED_SIZE(sizeof(basic_iostream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_iostream_wchar), 8)-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, ALIGNED_SIZE(sizeof(basic_ofstream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_ofstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_ofstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_ifstream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_ifstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_ifstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_fstream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_fstream_char), 8)-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, ALIGNED_SIZE(sizeof(basic_fstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_fstream_wchar), 8)-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, ALIGNED_SIZE(sizeof(basic_ostringstream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_ostringstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_ostringstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_istringstream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_istringstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_istringstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_stringstream_char), 8)};
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, ALIGNED_SIZE(sizeof(basic_stringstream_char), 8)-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, ALIGNED_SIZE(sizeof(basic_stringstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_stringstream_wchar), 8)-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, ALIGNED_SIZE(sizeof(basic_stringstream_wchar), 8)};
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, ALIGNED_SIZE(sizeof(basic_stringstream_wchar), 8)-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__Lock)
630             VTABLE_ADD_FUNC(basic_streambuf_char__Unlock)
631             VTABLE_ADD_FUNC(basic_streambuf_char_overflow)
632             VTABLE_ADD_FUNC(basic_streambuf_char_pbackfail)
633             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
634             VTABLE_ADD_FUNC(basic_streambuf_char_underflow)
635             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
636             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
637             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
638             VTABLE_ADD_FUNC(basic_streambuf_char_seekoff)
639             VTABLE_ADD_FUNC(basic_streambuf_char_seekpos)
640             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
641             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
642             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
643     __ASM_VTABLE(basic_streambuf_wchar,
644             VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
645             VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
646             VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
647             VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
648             VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
649             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
650             VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
651             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
652             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
653             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
654             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
655             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
656             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
657             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
658             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
659     __ASM_VTABLE(basic_streambuf_short,
660             VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
661             VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
662             VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
663             VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
664             VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
665             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
666             VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
667             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
668             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
669             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
670             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
671             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
672             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
673             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
674             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
675     __ASM_VTABLE(basic_filebuf_char,
676             VTABLE_ADD_FUNC(basic_filebuf_char_vector_dtor)
677             VTABLE_ADD_FUNC(basic_streambuf_char__Lock)
678             VTABLE_ADD_FUNC(basic_streambuf_char__Unlock)
679             VTABLE_ADD_FUNC(basic_filebuf_char_overflow)
680             VTABLE_ADD_FUNC(basic_filebuf_char_pbackfail)
681             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
682             VTABLE_ADD_FUNC(basic_filebuf_char_underflow)
683             VTABLE_ADD_FUNC(basic_filebuf_char_uflow)
684             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
685             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
686             VTABLE_ADD_FUNC(basic_filebuf_char_seekoff)
687             VTABLE_ADD_FUNC(basic_filebuf_char_seekpos)
688             VTABLE_ADD_FUNC(basic_filebuf_char_setbuf)
689             VTABLE_ADD_FUNC(basic_filebuf_char_sync)
690             VTABLE_ADD_FUNC(basic_filebuf_char_imbue));
691     __ASM_VTABLE(basic_filebuf_wchar,
692             VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
693             VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
694             VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
695             VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
696             VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
697             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
698             VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
699             VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
700             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
701             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
702             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
703             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
704             VTABLE_ADD_FUNC(basic_filebuf_wchar_setbuf)
705             VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
706             VTABLE_ADD_FUNC(basic_filebuf_wchar_imbue));
707     __ASM_VTABLE(basic_filebuf_short,
708             VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
709             VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
710             VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
711             VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
712             VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
713             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
714             VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
715             VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
716             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
717             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
718             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
719             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
720             VTABLE_ADD_FUNC(basic_filebuf_short_setbuf)
721             VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
722             VTABLE_ADD_FUNC(basic_filebuf_short_imbue));
723     __ASM_VTABLE(basic_stringbuf_char,
724             VTABLE_ADD_FUNC(basic_stringbuf_char_vector_dtor)
725             VTABLE_ADD_FUNC(basic_streambuf_char__Lock)
726             VTABLE_ADD_FUNC(basic_streambuf_char__Unlock)
727             VTABLE_ADD_FUNC(basic_stringbuf_char_overflow)
728             VTABLE_ADD_FUNC(basic_stringbuf_char_pbackfail)
729             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
730             VTABLE_ADD_FUNC(basic_stringbuf_char_underflow)
731             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
732             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
733             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
734             VTABLE_ADD_FUNC(basic_stringbuf_char_seekoff)
735             VTABLE_ADD_FUNC(basic_stringbuf_char_seekpos)
736             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
737             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
738             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
739     __ASM_VTABLE(basic_stringbuf_wchar,
740             VTABLE_ADD_FUNC(basic_stringbuf_wchar_vector_dtor)
741             VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
742             VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
743             VTABLE_ADD_FUNC(basic_stringbuf_wchar_overflow)
744             VTABLE_ADD_FUNC(basic_stringbuf_wchar_pbackfail)
745             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
746             VTABLE_ADD_FUNC(basic_stringbuf_wchar_underflow)
747             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
748             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
749             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
750             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekoff)
751             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekpos)
752             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
753             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
754             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
755     __ASM_VTABLE(basic_stringbuf_short,
756             VTABLE_ADD_FUNC(basic_stringbuf_wchar_vector_dtor)
757             VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
758             VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
759             VTABLE_ADD_FUNC(basic_stringbuf_wchar_overflow)
760             VTABLE_ADD_FUNC(basic_stringbuf_wchar_pbackfail)
761             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
762             VTABLE_ADD_FUNC(basic_stringbuf_wchar_underflow)
763             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
764             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
765             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
766             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekoff)
767             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekpos)
768             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
769             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
770             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
771     __ASM_VTABLE(basic_ostream_char,
772             VTABLE_ADD_FUNC(basic_ostream_char_vector_dtor));
773     __ASM_VTABLE(basic_ostream_wchar,
774             VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
775     __ASM_VTABLE(basic_ostream_short,
776             VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
777     __ASM_VTABLE(basic_istream_char,
778             VTABLE_ADD_FUNC(basic_istream_char_vector_dtor));
779     __ASM_VTABLE(basic_istream_wchar,
780             VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
781     __ASM_VTABLE(basic_istream_short,
782             VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
783     __ASM_VTABLE(basic_iostream_char,
784             VTABLE_ADD_FUNC(basic_iostream_char_vector_dtor));
785     __ASM_VTABLE(basic_iostream_wchar,
786             VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
787     __ASM_VTABLE(basic_iostream_short,
788             VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
789     __ASM_VTABLE(basic_ofstream_char,
790             VTABLE_ADD_FUNC(basic_ofstream_char_vector_dtor));
791     __ASM_VTABLE(basic_ofstream_wchar,
792             VTABLE_ADD_FUNC(basic_ofstream_wchar_vector_dtor));
793     __ASM_VTABLE(basic_ofstream_short,
794             VTABLE_ADD_FUNC(basic_ofstream_wchar_vector_dtor));
795     __ASM_VTABLE(basic_ifstream_char,
796             VTABLE_ADD_FUNC(basic_ifstream_char_vector_dtor));
797     __ASM_VTABLE(basic_ifstream_wchar,
798             VTABLE_ADD_FUNC(basic_ifstream_wchar_vector_dtor));
799     __ASM_VTABLE(basic_ifstream_short,
800             VTABLE_ADD_FUNC(basic_ifstream_wchar_vector_dtor));
801     __ASM_VTABLE(basic_fstream_char,
802             VTABLE_ADD_FUNC(basic_fstream_char_vector_dtor));
803     __ASM_VTABLE(basic_fstream_wchar,
804             VTABLE_ADD_FUNC(basic_fstream_wchar_vector_dtor));
805     __ASM_VTABLE(basic_fstream_short,
806             VTABLE_ADD_FUNC(basic_fstream_wchar_vector_dtor));
807     __ASM_VTABLE(basic_ostringstream_char,
808             VTABLE_ADD_FUNC(basic_ostringstream_char_vector_dtor));
809     __ASM_VTABLE(basic_ostringstream_wchar,
810             VTABLE_ADD_FUNC(basic_ostringstream_wchar_vector_dtor));
811     __ASM_VTABLE(basic_ostringstream_short,
812             VTABLE_ADD_FUNC(basic_ostringstream_wchar_vector_dtor));
813     __ASM_VTABLE(basic_istringstream_char,
814             VTABLE_ADD_FUNC(basic_istringstream_char_vector_dtor));
815     __ASM_VTABLE(basic_istringstream_wchar,
816             VTABLE_ADD_FUNC(basic_istringstream_wchar_vector_dtor));
817     __ASM_VTABLE(basic_istringstream_short,
818             VTABLE_ADD_FUNC(basic_istringstream_wchar_vector_dtor));
819     __ASM_VTABLE(basic_stringstream_char,
820             VTABLE_ADD_FUNC(basic_stringstream_char_vector_dtor));
821     __ASM_VTABLE(basic_stringstream_wchar,
822             VTABLE_ADD_FUNC(basic_stringstream_wchar_vector_dtor));
823     __ASM_VTABLE(basic_stringstream_short,
824             VTABLE_ADD_FUNC(basic_stringstream_wchar_vector_dtor));
825     __ASM_VTABLE(strstreambuf,
826             VTABLE_ADD_FUNC(strstreambuf_vector_dtor)
827             VTABLE_ADD_FUNC(basic_streambuf_char__Lock)
828             VTABLE_ADD_FUNC(basic_streambuf_char__Unlock)
829             VTABLE_ADD_FUNC(strstreambuf_overflow)
830             VTABLE_ADD_FUNC(strstreambuf_pbackfail)
831             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
832             VTABLE_ADD_FUNC(strstreambuf_underflow)
833             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
834             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
835             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
836             VTABLE_ADD_FUNC(strstreambuf_seekoff)
837             VTABLE_ADD_FUNC(strstreambuf_seekpos)
838             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
839             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
840             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
841 #ifndef __GNUC__
842 }
843 #endif
844
845 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
846 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
847 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp_next, 16)
848 void __thiscall basic_streambuf_char_setp_next(basic_streambuf_char *this, char *first, char *next, char *last)
849 {
850     TRACE("(%p %p %p %p)\n", this, first, next, last);
851
852     this->wbuf = first;
853     this->wpos = next;
854     this->wsize = last-next;
855 }
856
857 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z */
858 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD0@Z */
859 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp, 12)
860 void __thiscall basic_streambuf_char_setp(basic_streambuf_char *this, char *first, char *last)
861 {
862     basic_streambuf_char_setp_next(this, first, first, last);
863 }
864
865 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
866 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
867 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setg, 16)
868 void __thiscall basic_streambuf_char_setg(basic_streambuf_char *this, char *first, char *next, char *last)
869 {
870     TRACE("(%p %p %p %p)\n", this, first, next, last);
871
872     this->rbuf = first;
873     this->rpos = next;
874     this->rsize = last-next;
875 }
876
877 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXXZ */
878 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXXZ */
879 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init_empty, 4)
880 void __thiscall basic_streambuf_char__Init_empty(basic_streambuf_char *this)
881 {
882     TRACE("(%p)\n", this);
883
884     this->prbuf = &this->rbuf;
885     this->pwbuf = &this->wbuf;
886     this->prpos = &this->rpos;
887     this->pwpos = &this->wpos;
888     this->prsize = &this->rsize;
889     this->pwsize = &this->wsize;
890
891     basic_streambuf_char_setp(this, NULL, NULL);
892     basic_streambuf_char_setg(this, NULL, NULL, NULL);
893 }
894
895 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@W4_Uninitialized@1@@Z */
896 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
897 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor_uninitialized, 8)
898 basic_streambuf_char* __thiscall basic_streambuf_char_ctor_uninitialized(basic_streambuf_char *this, int uninitialized)
899 {
900     TRACE("(%p %d)\n", this, uninitialized);
901     this->vtable = &MSVCP_basic_streambuf_char_vtable;
902     mutex_ctor(&this->lock);
903     return this;
904 }
905
906 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ */
907 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ */
908 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor, 4)
909 basic_streambuf_char* __thiscall basic_streambuf_char_ctor(basic_streambuf_char *this)
910 {
911     TRACE("(%p)\n", this);
912
913     this->vtable = &MSVCP_basic_streambuf_char_vtable;
914     mutex_ctor(&this->lock);
915     this->loc = MSVCRT_operator_new(sizeof(locale));
916     locale_ctor(this->loc);
917     basic_streambuf_char__Init_empty(this);
918
919     return this;
920 }
921
922 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
923 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
924 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_dtor, 4)
925 void __thiscall basic_streambuf_char_dtor(basic_streambuf_char *this)
926 {
927     TRACE("(%p)\n", this);
928
929     mutex_dtor(&this->lock);
930     locale_dtor(this->loc);
931     MSVCRT_operator_delete(this->loc);
932 }
933
934 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_vector_dtor, 8)
935 basic_streambuf_char* __thiscall basic_streambuf_char_vector_dtor(basic_streambuf_char *this, unsigned int flags)
936 {
937     TRACE("(%p %x)\n", this, flags);
938     if(flags & 2) {
939         /* we have an array, with the number of elements stored before the first object */
940         int i, *ptr = (int *)this-1;
941
942         for(i=*ptr-1; i>=0; i--)
943             basic_streambuf_char_dtor(this+i);
944         MSVCRT_operator_delete(ptr);
945     } else {
946         basic_streambuf_char_dtor(this);
947         if(flags & 1)
948             MSVCRT_operator_delete(this);
949     }
950
951     return this;
952 }
953
954 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
955 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
956 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnavail, 4)
957 streamsize __thiscall basic_streambuf_char__Gnavail(const basic_streambuf_char *this)
958 {
959     TRACE("(%p)\n", this);
960     return *this->prpos ? *this->prsize : 0;
961 }
962
963 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
964 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
965 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gndec, 4)
966 char* __thiscall basic_streambuf_char__Gndec(basic_streambuf_char *this)
967 {
968     TRACE("(%p)\n", this);
969     (*this->prsize)++;
970     (*this->prpos)--;
971     return *this->prpos;
972 }
973
974 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
975 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
976 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gninc, 4)
977 char* __thiscall basic_streambuf_char__Gninc(basic_streambuf_char *this)
978 {
979     TRACE("(%p)\n", this);
980     (*this->prsize)--;
981     return (*this->prpos)++;
982 }
983
984 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
985 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
986 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnpreinc, 4)
987 char* __thiscall basic_streambuf_char__Gnpreinc(basic_streambuf_char *this)
988 {
989     TRACE("(%p)\n", this);
990     (*this->prsize)--;
991     (*this->prpos)++;
992     return *this->prpos;
993 }
994
995 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAPAD0PAH001@Z */
996 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAPEAD0PEAH001@Z */
997 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init, 28)
998 void __thiscall basic_streambuf_char__Init(basic_streambuf_char *this, char **gf, char **gn, int *gc, char **pf, char **pn, int *pc)
999 {
1000     TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
1001
1002     this->prbuf = gf;
1003     this->pwbuf = pf;
1004     this->prpos = gn;
1005     this->pwpos = pn;
1006     this->prsize = gc;
1007     this->pwsize = pc;
1008 }
1009
1010 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1011 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1012 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Lock, 4)
1013 #define call_basic_streambuf_char__Lock(this) CALL_VTBL_FUNC(this, 4, \
1014         void, (basic_streambuf_char*), (this))
1015 void __thiscall basic_streambuf_char__Lock(basic_streambuf_char *this)
1016 {
1017     TRACE("(%p)\n", this);
1018     mutex_lock(&this->lock);
1019 }
1020
1021 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
1022 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
1023 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pnavail, 4)
1024 streamsize __thiscall basic_streambuf_char__Pnavail(const basic_streambuf_char *this)
1025 {
1026     TRACE("(%p)\n", this);
1027     return *this->pwpos ? *this->pwsize : 0;
1028 }
1029
1030 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
1031 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
1032 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pninc, 4)
1033 char* __thiscall basic_streambuf_char__Pninc(basic_streambuf_char *this)
1034 {
1035     TRACE("(%p)\n", this);
1036     (*this->pwsize)--;
1037     return (*this->pwpos)++;
1038 }
1039
1040 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1041 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1042 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_underflow, 4)
1043 #define call_basic_streambuf_char_underflow(this) CALL_VTBL_FUNC(this, 24, \
1044         int, (basic_streambuf_char*), (this))
1045 int __thiscall basic_streambuf_char_underflow(basic_streambuf_char *this)
1046 {
1047     TRACE("(%p)\n", this);
1048     return EOF;
1049 }
1050
1051 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1052 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1053 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_uflow, 4)
1054 #define call_basic_streambuf_char_uflow(this) CALL_VTBL_FUNC(this, 28, \
1055         int, (basic_streambuf_char*), (this))
1056 int __thiscall basic_streambuf_char_uflow(basic_streambuf_char *this)
1057 {
1058     int ret;
1059
1060     TRACE("(%p)\n", this);
1061
1062     if(call_basic_streambuf_char_underflow(this)==EOF)
1063         return EOF;
1064
1065     ret = **this->prpos;
1066     (*this->prsize)--;
1067     (*this->prpos)++;
1068     return ret;
1069 }
1070
1071 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADIH@Z */
1072 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_K_J@Z */
1073 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Xsgetn_s, 20)
1074 #define call_basic_streambuf_char__Xsgetn_s(this, ptr, size, count) CALL_VTBL_FUNC(this, 28, \
1075         streamsize, (basic_streambuf_char*, char*, MSVCP_size_t, streamsize), (this, ptr, size, count))
1076 streamsize __thiscall basic_streambuf_char__Xsgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
1077 {
1078     streamsize copied, chunk;
1079     int c;
1080
1081     TRACE("(%p %p %lu %s)\n", this, ptr, size, wine_dbgstr_longlong(count));
1082
1083     for(copied=0; copied<count && size;) {
1084         chunk = basic_streambuf_char__Gnavail(this);
1085         if(chunk > count-copied)
1086             chunk = count-copied;
1087
1088         if(chunk > 0) {
1089             memcpy_s(ptr+copied, size, *this->prpos, chunk);
1090             *this->prpos += chunk;
1091             *this->prsize -= chunk;
1092             copied += chunk;
1093             size -= chunk;
1094         }else if((c = call_basic_streambuf_char_uflow(this)) != EOF) {
1095             ptr[copied] = c;
1096             copied++;
1097             size--;
1098         }else {
1099             break;
1100         }
1101     }
1102
1103     return copied;
1104 }
1105
1106 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
1107 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
1108 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Sgetn_s, 20)
1109 streamsize __thiscall basic_streambuf_char__Sgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
1110 {
1111     TRACE("(%p %p %lu %s)\n", this, ptr, size, wine_dbgstr_longlong(count));
1112     return call_basic_streambuf_char__Xsgetn_s(this, ptr, size, count);
1113 }
1114
1115 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1116 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1117 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Unlock, 4)
1118 #define call_basic_streambuf_char__Unlock(this) CALL_VTBL_FUNC(this, 8, \
1119         void, (basic_streambuf_char*), (this))
1120 void __thiscall basic_streambuf_char__Unlock(basic_streambuf_char *this)
1121 {
1122     TRACE("(%p)\n", this);
1123     mutex_unlock(&this->lock);
1124 }
1125
1126 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1127 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1128 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_eback, 4)
1129 char* __thiscall basic_streambuf_char_eback(const basic_streambuf_char *this)
1130 {
1131     TRACE("(%p)\n", this);
1132     return *this->prbuf;
1133 }
1134
1135 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1136 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1137 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gptr, 4)
1138 char* __thiscall basic_streambuf_char_gptr(const basic_streambuf_char *this)
1139 {
1140     TRACE("(%p)\n", this);
1141     return *this->prpos;
1142 }
1143
1144 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1145 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1146 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_egptr, 4)
1147 char* __thiscall basic_streambuf_char_egptr(const basic_streambuf_char *this)
1148 {
1149     TRACE("(%p)\n", this);
1150     return *this->prpos+*this->prsize;
1151 }
1152
1153 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1154 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1155 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_epptr, 4)
1156 char* __thiscall basic_streambuf_char_epptr(const basic_streambuf_char *this)
1157 {
1158     TRACE("(%p)\n", this);
1159     return *this->pwpos+*this->pwsize;
1160 }
1161
1162 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
1163 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
1164 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gbump, 8)
1165 void __thiscall basic_streambuf_char_gbump(basic_streambuf_char *this, int off)
1166 {
1167     TRACE("(%p %d)\n", this, off);
1168     *this->prpos += off;
1169     *this->prsize -= off;
1170 }
1171
1172 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QBE?AVlocale@2@XZ */
1173 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEBA?AVlocale@2@XZ */
1174 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_getloc, 8)
1175 locale* __thiscall basic_streambuf_char_getloc(const basic_streambuf_char *this, locale *ret)
1176 {
1177     TRACE("(%p)\n", this);
1178     return locale_copy_ctor(ret, this->loc);
1179 }
1180
1181 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
1182 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
1183 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_imbue, 8)
1184 #define call_basic_streambuf_char_imbue(this, loc) CALL_VTBL_FUNC(this, 56, \
1185         void, (basic_streambuf_char*, const locale*), (this, loc))
1186 void __thiscall basic_streambuf_char_imbue(basic_streambuf_char *this, const locale *loc)
1187 {
1188     TRACE("(%p %p)\n", this, loc);
1189 }
1190
1191 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
1192 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
1193 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_overflow, 8)
1194 #define call_basic_streambuf_char_overflow(this, ch) CALL_VTBL_FUNC(this, 12, \
1195         int, (basic_streambuf_char*, int), (this, ch))
1196 int __thiscall basic_streambuf_char_overflow(basic_streambuf_char *this, int ch)
1197 {
1198     TRACE("(%p %d)\n", this, ch);
1199     return EOF;
1200 }
1201
1202 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
1203 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
1204 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbackfail, 8)
1205 #define call_basic_streambuf_char_pbackfail(this, ch) CALL_VTBL_FUNC(this, 16, \
1206         int, (basic_streambuf_char*, int), (this, ch))
1207 int __thiscall basic_streambuf_char_pbackfail(basic_streambuf_char *this, int ch)
1208 {
1209     TRACE("(%p %d)\n", this, ch);
1210     return EOF;
1211 }
1212
1213 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1214 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1215 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbase, 4)
1216 char* __thiscall basic_streambuf_char_pbase(const basic_streambuf_char *this)
1217 {
1218     TRACE("(%p)\n", this);
1219     return *this->pwbuf;
1220 }
1221
1222 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
1223 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
1224 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbump, 8)
1225 void __thiscall basic_streambuf_char_pbump(basic_streambuf_char *this, int off)
1226 {
1227     TRACE("(%p %d)\n", this, off);
1228     *this->pwpos += off;
1229     *this->pwsize -= off;
1230 }
1231
1232 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1233 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1234 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pptr, 4)
1235 char* __thiscall basic_streambuf_char_pptr(const basic_streambuf_char *this)
1236 {
1237     TRACE("(%p)\n", this);
1238     return *this->pwpos;
1239 }
1240
1241 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1242 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
1243 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubimbue, 12)
1244 locale* __thiscall basic_streambuf_char_pubimbue(basic_streambuf_char *this, locale *ret, const locale *loc)
1245 {
1246     TRACE("(%p %p)\n", this, loc);
1247     memcpy(ret, this->loc, sizeof(locale));
1248     call_basic_streambuf_char_imbue(this, loc);
1249     locale_copy_ctor(this->loc, loc);
1250     return ret;
1251 }
1252
1253 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
1254 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
1255 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekoff, 24)
1256 #define call_basic_streambuf_char_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 40, \
1257         fpos_int*, (basic_streambuf_char*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
1258 fpos_int* __thiscall basic_streambuf_char_seekoff(basic_streambuf_char *this,
1259         fpos_int *ret, streamoff off, int way, int mode)
1260 {
1261     TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
1262     ret->off = 0;
1263     ret->pos = -1;
1264     ret->state = 0;
1265     return ret;
1266 }
1267
1268 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
1269 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
1270 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff, 24)
1271 fpos_int* __thiscall basic_streambuf_char_pubseekoff(basic_streambuf_char *this,
1272         fpos_int *ret, streamoff off, int way, int mode)
1273 {
1274     TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
1275     return call_basic_streambuf_char_seekoff(this, ret, off, way, mode);
1276 }
1277
1278 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
1279 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
1280 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff_old, 24)
1281 fpos_int* __thiscall basic_streambuf_char_pubseekoff_old(basic_streambuf_char *this,
1282         fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
1283 {
1284     TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
1285     return basic_streambuf_char_pubseekoff(this, ret, off, way, mode);
1286 }
1287
1288 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
1289 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
1290 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekpos, 36)
1291 #define call_basic_streambuf_char_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 44, \
1292         fpos_int*, (basic_streambuf_char*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
1293 fpos_int* __thiscall basic_streambuf_char_seekpos(basic_streambuf_char *this,
1294         fpos_int *ret, fpos_int pos, int mode)
1295 {
1296     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1297     ret->off = 0;
1298     ret->pos = -1;
1299     ret->state = 0;
1300     return ret;
1301 }
1302
1303 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
1304 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
1305 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos, 36)
1306 fpos_int* __thiscall basic_streambuf_char_pubseekpos(basic_streambuf_char *this,
1307         fpos_int *ret, fpos_int pos, int mode)
1308 {
1309     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1310     return call_basic_streambuf_char_seekpos(this, ret, pos, mode);
1311 }
1312
1313 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
1314 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
1315 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos_old, 36)
1316 fpos_int* __thiscall basic_streambuf_char_pubseekpos_old(basic_streambuf_char *this,
1317         fpos_int *ret, fpos_int pos, unsigned int mode)
1318 {
1319     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1320     return basic_streambuf_char_pubseekpos(this, ret, pos, mode);
1321 }
1322
1323 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEPAV12@PADH@Z */
1324 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAPEAV12@PEAD_J@Z */
1325 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setbuf, 16)
1326 #define call_basic_streambuf_char_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 48, \
1327         basic_streambuf_char*, (basic_streambuf_char*, char*, streamsize), (this, buf, count))
1328 basic_streambuf_char* __thiscall basic_streambuf_char_setbuf(basic_streambuf_char *this, char *buf, streamsize count)
1329 {
1330     TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
1331     return this;
1332 }
1333
1334 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PADH@Z */
1335 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEAD_J@Z */
1336 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsetbuf, 16)
1337 basic_streambuf_char* __thiscall basic_streambuf_char_pubsetbuf(basic_streambuf_char *this, char *buf, streamsize count)
1338 {
1339     TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
1340     return call_basic_streambuf_char_setbuf(this, buf, count);
1341 }
1342
1343 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1344 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1345 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sync, 4)
1346 #define call_basic_streambuf_char_sync(this) CALL_VTBL_FUNC(this, 52, \
1347         int, (basic_streambuf_char*), (this))
1348 int __thiscall basic_streambuf_char_sync(basic_streambuf_char *this)
1349 {
1350     TRACE("(%p)\n", this);
1351     return 0;
1352 }
1353
1354 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1355 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1356 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsync, 4)
1357 int __thiscall basic_streambuf_char_pubsync(basic_streambuf_char *this)
1358 {
1359     TRACE("(%p)\n", this);
1360     return call_basic_streambuf_char_sync(this);
1361 }
1362
1363 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
1364 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
1365 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetn, 16)
1366 streamsize __thiscall basic_streambuf_char_sgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1367 {
1368     TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1369     return call_basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1370 }
1371
1372 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1373 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JXZ */
1374 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_showmanyc, 4)
1375 #define call_basic_streambuf_char_showmanyc(this) CALL_VTBL_FUNC(this, 20, \
1376         streamsize, (basic_streambuf_char*), (this))
1377 streamsize __thiscall basic_streambuf_char_showmanyc(basic_streambuf_char *this)
1378 {
1379     TRACE("(%p)\n", this);
1380     return 0;
1381 }
1382
1383 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1384 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JXZ */
1385 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_in_avail, 4)
1386 streamsize __thiscall basic_streambuf_char_in_avail(basic_streambuf_char *this)
1387 {
1388     streamsize ret;
1389
1390     TRACE("(%p)\n", this);
1391
1392     ret = basic_streambuf_char__Gnavail(this);
1393     return ret ? ret : call_basic_streambuf_char_showmanyc(this);
1394 }
1395
1396 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
1397 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
1398 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputbackc, 8)
1399 int __thiscall basic_streambuf_char_sputbackc(basic_streambuf_char *this, char ch)
1400 {
1401     TRACE("(%p %d)\n", this, ch);
1402     if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
1403         (*this->prsize)++;
1404         (*this->prpos)--;
1405         return ch;
1406     }
1407
1408     return call_basic_streambuf_char_pbackfail(this, ch);
1409 }
1410
1411 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
1412 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
1413 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputc, 8)
1414 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char *this, char ch)
1415 {
1416     TRACE("(%p %d)\n", this, ch);
1417     return basic_streambuf_char__Pnavail(this) ?
1418         (*basic_streambuf_char__Pninc(this) = ch) :
1419         call_basic_streambuf_char_overflow(this, ch);
1420 }
1421
1422 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1423 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1424 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sungetc, 4)
1425 int __thiscall basic_streambuf_char_sungetc(basic_streambuf_char *this)
1426 {
1427     TRACE("(%p)\n", this);
1428     if(*this->prpos && *this->prpos>*this->prbuf) {
1429         (*this->prsize)++;
1430         (*this->prpos)--;
1431         return **this->prpos;
1432     }
1433
1434     return call_basic_streambuf_char_pbackfail(this, EOF);
1435 }
1436
1437 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1438 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1439 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_stossc, 4)
1440 void __thiscall basic_streambuf_char_stossc(basic_streambuf_char *this)
1441 {
1442     TRACE("(%p)\n", this);
1443     if(basic_streambuf_char__Gnavail(this))
1444         basic_streambuf_char__Gninc(this);
1445     else
1446         call_basic_streambuf_char_uflow(this);
1447 }
1448
1449 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1450 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1451 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sbumpc, 4)
1452 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char *this)
1453 {
1454     TRACE("(%p)\n", this);
1455     return basic_streambuf_char__Gnavail(this) ?
1456         *basic_streambuf_char__Gninc(this) : call_basic_streambuf_char_uflow(this);
1457 }
1458
1459 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1460 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1461 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetc, 4)
1462 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char *this)
1463 {
1464     TRACE("(%p)\n", this);
1465     return basic_streambuf_char__Gnavail(this) ?
1466         *basic_streambuf_char_gptr(this) : call_basic_streambuf_char_underflow(this);
1467 }
1468
1469 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1470 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1471 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_snextc, 4)
1472 int __thiscall basic_streambuf_char_snextc(basic_streambuf_char *this)
1473 {
1474     TRACE("(%p)\n", this);
1475
1476     if(basic_streambuf_char__Gnavail(this) > 1)
1477         return *basic_streambuf_char__Gnpreinc(this);
1478     return basic_streambuf_char_sbumpc(this)==EOF ?
1479         EOF : basic_streambuf_char_sgetc(this);
1480 }
1481
1482 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADH@Z */
1483 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z */
1484 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsgetn, 16)
1485 #define call_basic_streambuf_char_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
1486         streamsize, (basic_streambuf_char*, char*, streamsize), (this, ptr, count))
1487 streamsize __thiscall basic_streambuf_char_xsgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1488 {
1489     TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1490     return call_basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1491 }
1492
1493 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPBDH@Z */
1494 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z */
1495 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsputn, 16)
1496 #define call_basic_streambuf_char_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 36, \
1497         streamsize, (basic_streambuf_char*, const char*, streamsize), (this, ptr, count))
1498 streamsize __thiscall basic_streambuf_char_xsputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1499 {
1500     streamsize copied, chunk;
1501
1502     TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1503
1504     for(copied=0; copied<count;) {
1505         chunk = basic_streambuf_char__Pnavail(this);
1506         if(chunk > count-copied)
1507             chunk = count-copied;
1508
1509         if(chunk > 0) {
1510             memcpy(*this->pwpos, ptr+copied, chunk);
1511             *this->pwpos += chunk;
1512             *this->pwsize -= chunk;
1513             copied += chunk;
1514         }else if(call_basic_streambuf_char_overflow(this, ptr[copied]) != EOF) {
1515             copied++;
1516         }else {
1517             break;
1518         }
1519     }
1520
1521     return copied;
1522 }
1523
1524 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z */
1525 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEBD_J@Z */
1526 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputn, 16)
1527 streamsize __thiscall basic_streambuf_char_sputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1528 {
1529     TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1530     return call_basic_streambuf_char_xsputn(this, ptr, count);
1531 }
1532
1533 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1534 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1535 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1536 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1537 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp_next, 16)
1538 void __thiscall basic_streambuf_wchar_setp_next(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1539 {
1540     TRACE("(%p %p %p %p)\n", this, first, next, last);
1541
1542     this->wbuf = first;
1543     this->wpos = next;
1544     this->wsize = last-next;
1545 }
1546
1547 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W0@Z */
1548 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W0@Z */
1549 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG0@Z */
1550 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG0@Z */
1551 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp, 12)
1552 void __thiscall basic_streambuf_wchar_setp(basic_streambuf_wchar *this, wchar_t *first, wchar_t *last)
1553 {
1554     basic_streambuf_wchar_setp_next(this, first, first, last);
1555 }
1556
1557 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1558 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1559 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1560 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1561 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setg, 16)
1562 void __thiscall basic_streambuf_wchar_setg(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1563 {
1564     TRACE("(%p %p %p %p)\n", this, first, next, last);
1565
1566     this->rbuf = first;
1567     this->rpos = next;
1568     this->rsize = last-next;
1569 }
1570
1571 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXXZ */
1572 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXXZ */
1573 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXXZ */
1574 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXXZ */
1575 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init_empty, 4)
1576 void __thiscall basic_streambuf_wchar__Init_empty(basic_streambuf_wchar *this)
1577 {
1578     TRACE("(%p)\n", this);
1579
1580     this->prbuf = &this->rbuf;
1581     this->pwbuf = &this->wbuf;
1582     this->prpos = &this->rpos;
1583     this->pwpos = &this->wpos;
1584     this->prsize = &this->rsize;
1585     this->pwsize = &this->wsize;
1586
1587     basic_streambuf_wchar_setp(this, NULL, NULL);
1588     basic_streambuf_wchar_setg(this, NULL, NULL, NULL);
1589 }
1590
1591 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1592 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1593 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor_uninitialized, 8)
1594 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1595 {
1596     TRACE("(%p %d)\n", this, uninitialized);
1597     this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1598     mutex_ctor(&this->lock);
1599     return this;
1600 }
1601
1602 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1603 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1604 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor_uninitialized, 8)
1605 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1606 {
1607     TRACE("(%p %d)\n", this, uninitialized);
1608     basic_streambuf_wchar_ctor_uninitialized(this, uninitialized);
1609     this->vtable = &MSVCP_basic_streambuf_short_vtable;
1610     return this;
1611 }
1612
1613 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
1614 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
1615 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor, 4)
1616 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor(basic_streambuf_wchar *this)
1617 {
1618     TRACE("(%p)\n", this);
1619
1620     this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1621     mutex_ctor(&this->lock);
1622     this->loc = MSVCRT_operator_new(sizeof(locale));
1623     locale_ctor(this->loc);
1624     basic_streambuf_wchar__Init_empty(this);
1625
1626     return this;
1627 }
1628
1629 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@XZ */
1630 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@XZ */
1631 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor, 4)
1632 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor(basic_streambuf_wchar *this)
1633 {
1634     TRACE("(%p)\n", this);
1635     basic_streambuf_wchar_ctor(this);
1636     this->vtable = &MSVCP_basic_streambuf_short_vtable;
1637     return this;
1638 }
1639
1640 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
1641 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
1642 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
1643 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
1644 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_dtor, 4)
1645 void __thiscall basic_streambuf_wchar_dtor(basic_streambuf_wchar *this)
1646 {
1647     TRACE("(%p)\n", this);
1648
1649     mutex_dtor(&this->lock);
1650     locale_dtor(this->loc);
1651     MSVCRT_operator_delete(this->loc);
1652 }
1653
1654 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_vector_dtor, 8)
1655 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_vector_dtor(basic_streambuf_wchar *this, unsigned int flags)
1656 {
1657     TRACE("(%p %x)\n", this, flags);
1658     if(flags & 2) {
1659         /* we have an array, with the number of elements stored before the first object */
1660         int i, *ptr = (int *)this-1;
1661
1662         for(i=*ptr-1; i>=0; i--)
1663             basic_streambuf_wchar_dtor(this+i);
1664         MSVCRT_operator_delete(ptr);
1665     } else {
1666         basic_streambuf_wchar_dtor(this);
1667         if(flags & 1)
1668             MSVCRT_operator_delete(this);
1669     }
1670
1671     return this;
1672 }
1673
1674 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1675 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1676 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1677 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1678 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnavail, 4)
1679 streamsize __thiscall basic_streambuf_wchar__Gnavail(const basic_streambuf_wchar *this)
1680 {
1681     TRACE("(%p)\n", this);
1682     return *this->prpos ? *this->prsize : 0;
1683 }
1684
1685 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1686 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1687 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1688 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1689 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gndec, 4)
1690 wchar_t* __thiscall basic_streambuf_wchar__Gndec(basic_streambuf_wchar *this)
1691 {
1692     TRACE("(%p)\n", this);
1693     (*this->prsize)++;
1694     (*this->prpos)--;
1695     return *this->prpos;
1696 }
1697
1698 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1699 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1700 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1701 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1702 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gninc, 4)
1703 wchar_t* __thiscall basic_streambuf_wchar__Gninc(basic_streambuf_wchar *this)
1704 {
1705     TRACE("(%p)\n", this);
1706     (*this->prsize)--;
1707     return (*this->prpos)++;
1708 }
1709
1710 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1711 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1712 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1713 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1714 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnpreinc, 4)
1715 wchar_t* __thiscall basic_streambuf_wchar__Gnpreinc(basic_streambuf_wchar *this)
1716 {
1717     TRACE("(%p)\n", this);
1718     (*this->prsize)--;
1719     (*this->prpos)++;
1720     return *this->prpos;
1721 }
1722
1723 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPAPA_W0PAH001@Z */
1724 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAPEA_W0PEAH001@Z */
1725 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAPAG0PAH001@Z */
1726 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAPEAG0PEAH001@Z */
1727 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init, 28)
1728 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)
1729 {
1730     TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
1731
1732     this->prbuf = gf;
1733     this->pwbuf = pf;
1734     this->prpos = gn;
1735     this->pwpos = pn;
1736     this->prsize = gc;
1737     this->pwsize = pc;
1738 }
1739
1740 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1741 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1742 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1743 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1744 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Lock, 4)
1745 void __thiscall basic_streambuf_wchar__Lock(basic_streambuf_wchar *this)
1746 {
1747     TRACE("(%p)\n", this);
1748     mutex_lock(&this->lock);
1749 }
1750
1751 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1752 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1753 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1754 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1755 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pnavail, 4)
1756 streamsize __thiscall basic_streambuf_wchar__Pnavail(const basic_streambuf_wchar *this)
1757 {
1758     TRACE("(%p)\n", this);
1759     return *this->pwpos ? *this->pwsize : 0;
1760 }
1761
1762 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1763 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1764 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1765 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1766 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pninc, 4)
1767 wchar_t* __thiscall basic_streambuf_wchar__Pninc(basic_streambuf_wchar *this)
1768 {
1769     TRACE("(%p)\n", this);
1770     (*this->pwsize)--;
1771     return (*this->pwpos)++;
1772 }
1773
1774 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1775 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1776 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1777 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1778 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_underflow, 4)
1779 #define call_basic_streambuf_wchar_underflow(this) CALL_VTBL_FUNC(this, 24, \
1780         unsigned short, (basic_streambuf_wchar*), (this))
1781 unsigned short __thiscall basic_streambuf_wchar_underflow(basic_streambuf_wchar *this)
1782 {
1783     TRACE("(%p)\n", this);
1784     return WEOF;
1785 }
1786
1787 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1788 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1789 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1790 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1791 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_uflow, 4)
1792 #define call_basic_streambuf_wchar_uflow(this) CALL_VTBL_FUNC(this, 28, \
1793         unsigned short, (basic_streambuf_wchar*), (this))
1794 unsigned short __thiscall basic_streambuf_wchar_uflow(basic_streambuf_wchar *this)
1795 {
1796     int ret;
1797
1798     TRACE("(%p)\n", this);
1799
1800     if(call_basic_streambuf_wchar_underflow(this)==WEOF)
1801         return WEOF;
1802
1803     ret = **this->prpos;
1804     (*this->prsize)--;
1805     (*this->prpos)++;
1806     return ret;
1807 }
1808
1809 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WIH@Z */
1810 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_K_J@Z */
1811 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGIH@Z */
1812 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_K_J@Z */
1813 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Xsgetn_s, 20)
1814 #define call_basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count) CALL_VTBL_FUNC(this, 28, \
1815         streamsize, (basic_streambuf_wchar*, wchar_t*, MSVCP_size_t, streamsize), (this, ptr, size, count))
1816 streamsize __thiscall basic_streambuf_wchar__Xsgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1817 {
1818     streamsize copied, chunk;
1819     unsigned short c;
1820
1821     TRACE("(%p %p %lu %s)\n", this, ptr, size, wine_dbgstr_longlong(count));
1822
1823     for(copied=0; copied<count && size;) {
1824         chunk = basic_streambuf_wchar__Gnavail(this);
1825         if(chunk > count-copied)
1826             chunk = count-copied;
1827
1828         if(chunk > 0) {
1829             memcpy_s(ptr+copied, size, *this->prpos, chunk);
1830             *this->prpos += chunk;
1831             *this->prsize -= chunk;
1832             copied += chunk;
1833             size -= chunk;
1834         }else if((c = call_basic_streambuf_wchar_uflow(this)) != WEOF) {
1835             ptr[copied] = c;
1836             copied++;
1837             size--;
1838         }else {
1839             break;
1840         }
1841     }
1842
1843     return copied;
1844 }
1845
1846 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
1847 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
1848 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
1849 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
1850 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Sgetn_s, 20)
1851 streamsize __thiscall basic_streambuf_wchar__Sgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1852 {
1853     TRACE("(%p %p %lu %s)\n", this, ptr, size, wine_dbgstr_longlong(count));
1854     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count);
1855 }
1856
1857 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1858 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1859 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1860 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1861 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Unlock, 4)
1862 void __thiscall basic_streambuf_wchar__Unlock(basic_streambuf_wchar *this)
1863 {
1864     TRACE("(%p)\n", this);
1865     mutex_unlock(&this->lock);
1866 }
1867
1868 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1869 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1870 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1871 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1872 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_eback, 4)
1873 wchar_t* __thiscall basic_streambuf_wchar_eback(const basic_streambuf_wchar *this)
1874 {
1875     TRACE("(%p)\n", this);
1876     return *this->prbuf;
1877 }
1878
1879 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1880 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1881 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1882 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1883 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gptr, 4)
1884 wchar_t* __thiscall basic_streambuf_wchar_gptr(const basic_streambuf_wchar *this)
1885 {
1886     TRACE("(%p)\n", this);
1887     return *this->prpos;
1888 }
1889
1890 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1891 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1892 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1893 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1894 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_egptr, 4)
1895 wchar_t* __thiscall basic_streambuf_wchar_egptr(const basic_streambuf_wchar *this)
1896 {
1897     TRACE("(%p)\n", this);
1898     return *this->prpos+*this->prsize;
1899 }
1900
1901 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1902 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1903 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1904 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1905 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_epptr, 4)
1906 wchar_t* __thiscall basic_streambuf_wchar_epptr(const basic_streambuf_wchar *this)
1907 {
1908     TRACE("(%p)\n", this);
1909     return *this->pwpos+*this->pwsize;
1910 }
1911
1912 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1913 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1914 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1915 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1916 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gbump, 8)
1917 void __thiscall basic_streambuf_wchar_gbump(basic_streambuf_wchar *this, int off)
1918 {
1919     TRACE("(%p %d)\n", this, off);
1920     *this->prpos += off;
1921     *this->prsize -= off;
1922 }
1923
1924 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QBE?AVlocale@2@XZ */
1925 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEBA?AVlocale@2@XZ */
1926 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QBE?AVlocale@2@XZ */
1927 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEBA?AVlocale@2@XZ */
1928 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_getloc, 8)
1929 locale* __thiscall basic_streambuf_wchar_getloc(const basic_streambuf_wchar *this, locale *ret)
1930 {
1931     TRACE("(%p)\n", this);
1932     return locale_copy_ctor(ret, this->loc);
1933 }
1934
1935 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
1936 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
1937 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
1938 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
1939 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_imbue, 8)
1940 #define call_basic_streambuf_wchar_imbue(this, loc) CALL_VTBL_FUNC(this, 56, \
1941         void, (basic_streambuf_wchar*, const locale*), (this, loc))
1942 void __thiscall basic_streambuf_wchar_imbue(basic_streambuf_wchar *this, const locale *loc)
1943 {
1944     TRACE("(%p %p)\n", this, loc);
1945 }
1946
1947 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1948 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1949 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1950 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1951 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_overflow, 8)
1952 #define call_basic_streambuf_wchar_overflow(this, ch) CALL_VTBL_FUNC(this, 12, \
1953         unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1954 unsigned short __thiscall basic_streambuf_wchar_overflow(basic_streambuf_wchar *this, unsigned short ch)
1955 {
1956     TRACE("(%p %d)\n", this, ch);
1957     return WEOF;
1958 }
1959
1960 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1961 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1962 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1963 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1964 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbackfail, 8)
1965 #define call_basic_streambuf_wchar_pbackfail(this, ch) CALL_VTBL_FUNC(this, 16, \
1966         unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1967 unsigned short __thiscall basic_streambuf_wchar_pbackfail(basic_streambuf_wchar *this, unsigned short ch)
1968 {
1969     TRACE("(%p %d)\n", this, ch);
1970     return WEOF;
1971 }
1972
1973 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1974 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1975 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1976 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1977 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbase, 4)
1978 wchar_t* __thiscall basic_streambuf_wchar_pbase(const basic_streambuf_wchar *this)
1979 {
1980     TRACE("(%p)\n", this);
1981     return *this->pwbuf;
1982 }
1983
1984 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1985 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1986 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1987 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1988 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbump, 8)
1989 void __thiscall basic_streambuf_wchar_pbump(basic_streambuf_wchar *this, int off)
1990 {
1991     TRACE("(%p %d)\n", this, off);
1992     *this->pwpos += off;
1993     *this->pwsize -= off;
1994 }
1995
1996 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1997 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1998 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1999 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
2000 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pptr, 4)
2001 wchar_t* __thiscall basic_streambuf_wchar_pptr(const basic_streambuf_wchar *this)
2002 {
2003     TRACE("(%p)\n", this);
2004     return *this->pwpos;
2005 }
2006
2007 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
2008 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
2009 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
2010 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
2011 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubimbue, 12)
2012 locale* __thiscall basic_streambuf_wchar_pubimbue(basic_streambuf_wchar *this, locale *ret, const locale *loc)
2013 {
2014     TRACE("(%p %p)\n", this, loc);
2015     memcpy(ret, this->loc, sizeof(locale));
2016     call_basic_streambuf_wchar_imbue(this, loc);
2017     locale_copy_ctor(this->loc, loc);
2018     return ret;
2019 }
2020
2021 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2022 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2023 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2024 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2025 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekoff, 24)
2026 #define call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 40, \
2027         fpos_int*, (basic_streambuf_wchar*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
2028 fpos_int* __thiscall basic_streambuf_wchar_seekoff(basic_streambuf_wchar *this,
2029         fpos_int *ret, streamoff off, int way, int mode)
2030 {
2031     TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
2032     ret->off = 0;
2033     ret->pos = -1;
2034     ret->state = 0;
2035     return ret;
2036 }
2037
2038 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
2039 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
2040 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
2041 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
2042 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff, 24)
2043 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff(basic_streambuf_wchar *this,
2044         fpos_int *ret, streamoff off, int way, int mode)
2045 {
2046     TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
2047     return call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode);
2048 }
2049
2050 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
2051 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
2052 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
2053 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
2054 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff_old, 24)
2055 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff_old(basic_streambuf_wchar *this,
2056         fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
2057 {
2058     TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
2059     return basic_streambuf_wchar_pubseekoff(this, ret, off, way, mode);
2060 }
2061
2062 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2063 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2064 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2065 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2066 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekpos, 36)
2067 #define call_basic_streambuf_wchar_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 44, \
2068         fpos_int*, (basic_streambuf_wchar*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
2069 fpos_int* __thiscall basic_streambuf_wchar_seekpos(basic_streambuf_wchar *this,
2070         fpos_int *ret, fpos_int pos, int mode)
2071 {
2072     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2073     ret->off = 0;
2074     ret->pos = -1;
2075     ret->state = 0;
2076     return ret;
2077 }
2078
2079 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
2080 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
2081 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
2082 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
2083 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos, 36)
2084 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos(basic_streambuf_wchar *this,
2085         fpos_int *ret, fpos_int pos, int mode)
2086 {
2087     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2088     return call_basic_streambuf_wchar_seekpos(this, ret, pos, mode);
2089 }
2090
2091 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
2092 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
2093 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
2094 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
2095 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos_old, 36)
2096 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos_old(basic_streambuf_wchar *this,
2097         fpos_int *ret, fpos_int pos, unsigned int mode)
2098 {
2099     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2100     return basic_streambuf_wchar_pubseekpos(this, ret, pos, mode);
2101 }
2102
2103 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEPAV12@PA_WH@Z */
2104 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV12@PEA_W_J@Z */
2105 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEPAV12@PAGH@Z */
2106 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAPEAV12@PEAG_J@Z */
2107 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setbuf, 16)
2108 #define call_basic_streambuf_wchar_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 48, \
2109         basic_streambuf_wchar*, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, buf, count))
2110 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_setbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
2111 {
2112     TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
2113     return this;
2114 }
2115
2116 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PA_WH@Z */
2117 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEA_W_J@Z */
2118 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PAGH@Z */
2119 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEAG_J@Z */
2120 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsetbuf, 16)
2121 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_pubsetbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
2122 {
2123     TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
2124     return call_basic_streambuf_wchar_setbuf(this, buf, count);
2125 }
2126
2127 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2128 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
2129 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2130 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
2131 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sync, 4)
2132 #define call_basic_streambuf_wchar_sync(this) CALL_VTBL_FUNC(this, 52, \
2133         int, (basic_streambuf_wchar*), (this))
2134 int __thiscall basic_streambuf_wchar_sync(basic_streambuf_wchar *this)
2135 {
2136     TRACE("(%p)\n", this);
2137     return 0;
2138 }
2139
2140 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
2141 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
2142 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
2143 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHXZ */
2144 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsync, 4)
2145 int __thiscall basic_streambuf_wchar_pubsync(basic_streambuf_wchar *this)
2146 {
2147     TRACE("(%p)\n", this);
2148     return call_basic_streambuf_wchar_sync(this);
2149 }
2150
2151 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
2152 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
2153 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
2154 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
2155 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetn, 16)
2156 streamsize __thiscall basic_streambuf_wchar_sgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
2157 {
2158     TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
2159     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
2160 }
2161
2162 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2163 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JXZ */
2164 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2165 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JXZ */
2166 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_showmanyc, 4)
2167 #define call_basic_streambuf_wchar_showmanyc(this) CALL_VTBL_FUNC(this, 20, \
2168         streamsize, (basic_streambuf_wchar*), (this))
2169 streamsize __thiscall basic_streambuf_wchar_showmanyc(basic_streambuf_wchar *this)
2170 {
2171     TRACE("(%p)\n", this);
2172     return 0;
2173 }
2174
2175 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
2176 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JXZ */
2177 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
2178 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JXZ */
2179 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_in_avail, 4)
2180 streamsize __thiscall basic_streambuf_wchar_in_avail(basic_streambuf_wchar *this)
2181 {
2182     streamsize ret;
2183
2184     TRACE("(%p)\n", this);
2185
2186     ret = basic_streambuf_wchar__Gnavail(this);
2187     return ret ? ret : call_basic_streambuf_wchar_showmanyc(this);
2188 }
2189
2190 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
2191 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
2192 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
2193 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
2194 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputbackc, 8)
2195 unsigned short __thiscall basic_streambuf_wchar_sputbackc(basic_streambuf_wchar *this, wchar_t ch)
2196 {
2197     TRACE("(%p %d)\n", this, ch);
2198     if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
2199         (*this->prsize)++;
2200         (*this->prpos)--;
2201         return ch;
2202     }
2203
2204     return call_basic_streambuf_wchar_pbackfail(this, ch);
2205 }
2206
2207 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
2208 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
2209 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
2210 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHG@Z */
2211 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputc, 8)
2212 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar *this, wchar_t ch)
2213 {
2214     TRACE("(%p %d)\n", this, ch);
2215     return basic_streambuf_wchar__Pnavail(this) ?
2216         (*basic_streambuf_wchar__Pninc(this) = ch) :
2217         call_basic_streambuf_wchar_overflow(this, ch);
2218 }
2219
2220 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2221 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2222 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2223 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2224 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sungetc, 4)
2225 unsigned short __thiscall basic_streambuf_wchar_sungetc(basic_streambuf_wchar *this)
2226 {
2227     TRACE("(%p)\n", this);
2228     if(*this->prpos && *this->prpos>*this->prbuf) {
2229         (*this->prsize)++;
2230         (*this->prpos)--;
2231         return **this->prpos;
2232     }
2233
2234     return call_basic_streambuf_wchar_pbackfail(this, WEOF);
2235 }
2236
2237 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
2238 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
2239 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
2240 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
2241 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_stossc, 4)
2242 void __thiscall basic_streambuf_wchar_stossc(basic_streambuf_wchar *this)
2243 {
2244     TRACE("(%p)\n", this);
2245     if(basic_streambuf_wchar__Gnavail(this))
2246         basic_streambuf_wchar__Gninc(this);
2247     else
2248         call_basic_streambuf_wchar_uflow(this);
2249 }
2250
2251 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2252 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2253 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2254 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2255 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sbumpc, 4)
2256 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar *this)
2257 {
2258     TRACE("(%p)\n", this);
2259     return basic_streambuf_wchar__Gnavail(this) ?
2260         *basic_streambuf_wchar__Gninc(this) : call_basic_streambuf_wchar_uflow(this);
2261 }
2262
2263 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2264 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2265 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2266 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2267 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetc, 4)
2268 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar *this)
2269 {
2270     TRACE("(%p)\n", this);
2271     return basic_streambuf_wchar__Gnavail(this) ?
2272         *basic_streambuf_wchar_gptr(this) : call_basic_streambuf_wchar_underflow(this);
2273 }
2274
2275 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2276 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2277 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2278 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2279 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_snextc, 4)
2280 unsigned short __thiscall basic_streambuf_wchar_snextc(basic_streambuf_wchar *this)
2281 {
2282     TRACE("(%p)\n", this);
2283
2284     if(basic_streambuf_wchar__Gnavail(this) > 1)
2285         return *basic_streambuf_wchar__Gnpreinc(this);
2286     return basic_streambuf_wchar_sbumpc(this)==WEOF ?
2287         WEOF : basic_streambuf_wchar_sgetc(this);
2288 }
2289
2290 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WH@Z */
2291 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_J@Z */
2292 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGH@Z */
2293 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_J@Z */
2294 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsgetn, 16)
2295 #define call_basic_streambuf_wchar_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
2296         streamsize, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, ptr, count))
2297 streamsize __thiscall basic_streambuf_wchar_xsgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
2298 {
2299     TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
2300     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
2301 }
2302
2303 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPB_WH@Z */
2304 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEB_W_J@Z */
2305 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPBGH@Z */
2306 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEBG_J@Z */
2307 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsputn, 16)
2308 #define call_basic_streambuf_wchar_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 36, \
2309         streamsize, (basic_streambuf_wchar*, const wchar_t*, streamsize), (this, ptr, count))
2310 streamsize __thiscall basic_streambuf_wchar_xsputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
2311 {
2312     streamsize copied, chunk;
2313
2314     TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
2315
2316     for(copied=0; copied<count;) {
2317         chunk = basic_streambuf_wchar__Pnavail(this);
2318         if(chunk > count-copied)
2319             chunk = count-copied;
2320
2321         if(chunk > 0) {
2322             memcpy(*this->pwpos, ptr+copied, chunk);
2323             *this->pwpos += chunk;
2324             *this->pwsize -= chunk;
2325             copied += chunk;
2326         }else if(call_basic_streambuf_wchar_overflow(this, ptr[copied]) != WEOF) {
2327             copied++;
2328         }else {
2329             break;
2330         }
2331     }
2332
2333     return copied;
2334 }
2335
2336 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPB_WH@Z */
2337 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEB_W_J@Z */
2338 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPBGH@Z */
2339 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEBG_J@Z */
2340 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputn, 16)
2341 streamsize __thiscall basic_streambuf_wchar_sputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
2342 {
2343     TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
2344     return call_basic_streambuf_wchar_xsputn(this, ptr, count);
2345 }
2346
2347 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2348 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2349 int basic_filebuf_char__Init__Stinit = 0;
2350
2351 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2352 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2353 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Init, 12)
2354 void __thiscall basic_filebuf_char__Init(basic_filebuf_char *this, FILE *file, basic_filebuf__Initfl which)
2355 {
2356     TRACE("(%p %p %d)\n", this, file, which);
2357
2358     this->cvt = NULL;
2359     this->wrotesome = FALSE;
2360     this->state = basic_filebuf_char__Init__Stinit;
2361     this->close = (which == INITFL_open);
2362     this->file = file;
2363
2364     basic_streambuf_char__Init_empty(&this->base);
2365     if(file)
2366         basic_streambuf_char__Init(&this->base, &file->_base, &file->_ptr,
2367                 &file->_cnt, &file->_base, &file->_ptr, &file->_cnt);
2368 }
2369
2370 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAV?$codecvt@DDH@2@@Z */
2371 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$codecvt@DDH@2@@Z */
2372 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Initcvt, 8)
2373 void __thiscall basic_filebuf_char__Initcvt(basic_filebuf_char *this, codecvt_char *cvt)
2374 {
2375     TRACE("(%p %p)\n", this, cvt);
2376
2377     if(codecvt_base_always_noconv(&cvt->base)) {
2378         this->cvt = NULL;
2379     }else {
2380         basic_streambuf_char__Init_empty(&this->base);
2381         this->cvt = cvt;
2382     }
2383 }
2384
2385 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAE_NXZ */
2386 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAA_NXZ */
2387 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Endwrite, 4)
2388 MSVCP_bool __thiscall basic_filebuf_char__Endwrite(basic_filebuf_char *this)
2389 {
2390     TRACE("(%p)\n", this);
2391
2392     if(!this->wrotesome || !this->cvt)
2393         return TRUE;
2394
2395
2396     if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2397         return FALSE;
2398
2399     while(1) {
2400         /* TODO: check if we need a dynamic buffer here */
2401         char buf[128];
2402         char *next;
2403         int ret;
2404
2405         ret = codecvt_char_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2406         switch(ret) {
2407         case CODECVT_ok:
2408             this->wrotesome = FALSE;
2409             /* fall through */
2410         case CODECVT_partial:
2411             if(!fwrite(buf, next-buf, 1, this->file))
2412                 return FALSE;
2413             if(this->wrotesome)
2414                 break;
2415             /* fall through */
2416         case CODECVT_noconv:
2417             if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2418                 return FALSE;
2419             return TRUE;
2420         default:
2421             return FALSE;
2422         }
2423     }
2424 }
2425
2426 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@XZ */
2427 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@XZ */
2428 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_close, 4)
2429 basic_filebuf_char* __thiscall basic_filebuf_char_close(basic_filebuf_char *this)
2430 {
2431     basic_filebuf_char *ret = this;
2432
2433     TRACE("(%p)\n", this);
2434
2435     if(!this->file)
2436         return NULL;
2437
2438     /* TODO: handle exceptions */
2439     if(!basic_filebuf_char__Endwrite(this))
2440         ret = NULL;
2441     if(!fclose(this->file))
2442         ret  = NULL;
2443
2444     basic_filebuf_char__Init(this, NULL, INITFL_close);
2445     return ret;
2446 }
2447
2448 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
2449 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
2450 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor_file, 8)
2451 basic_filebuf_char* __thiscall basic_filebuf_char_ctor_file(basic_filebuf_char *this, FILE *file)
2452 {
2453     TRACE("(%p %p)\n", this, file);
2454
2455     basic_streambuf_char_ctor(&this->base);
2456     this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2457
2458     basic_filebuf_char__Init(this, file, INITFL_new);
2459     return this;
2460 }
2461
2462 /* ??_F?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
2463 /* ??_F?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
2464 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor, 4)
2465 basic_filebuf_char* __thiscall basic_filebuf_char_ctor(basic_filebuf_char *this)
2466 {
2467     return basic_filebuf_char_ctor_file(this, NULL);
2468 }
2469
2470 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
2471 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
2472 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor_uninitialized, 8)
2473 basic_filebuf_char* __thiscall basic_filebuf_char_ctor_uninitialized(basic_filebuf_char *this, int uninitialized)
2474 {
2475     TRACE("(%p %d)\n", this, uninitialized);
2476
2477     basic_streambuf_char_ctor(&this->base);
2478     this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2479     return this;
2480 }
2481
2482 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
2483 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
2484 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_dtor, 4)
2485 void __thiscall basic_filebuf_char_dtor(basic_filebuf_char *this)
2486 {
2487     TRACE("(%p)\n", this);
2488
2489     if(this->close)
2490         basic_filebuf_char_close(this);
2491     basic_streambuf_char_dtor(&this->base);
2492 }
2493
2494 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_vector_dtor, 8)
2495 basic_filebuf_char* __thiscall basic_filebuf_char_vector_dtor(basic_filebuf_char *this, unsigned int flags)
2496 {
2497     TRACE("(%p %x)\n", this, flags);
2498     if(flags & 2) {
2499         /* we have an array, with the number of elements stored before the first object */
2500         int i, *ptr = (int *)this-1;
2501
2502         for(i=*ptr-1; i>=0; i--)
2503             basic_filebuf_char_dtor(this+i);
2504         MSVCRT_operator_delete(ptr);
2505     } else {
2506         basic_filebuf_char_dtor(this);
2507         if(flags & 1)
2508             MSVCRT_operator_delete(this);
2509     }
2510
2511     return this;
2512 }
2513
2514 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QBE_NXZ */
2515 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
2516 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_is_open, 4)
2517 MSVCP_bool __thiscall basic_filebuf_char_is_open(const basic_filebuf_char *this)
2518 {
2519     TRACE("(%p)\n", this);
2520     return this->file != NULL;
2521 }
2522
2523 /* ?_Fiopen@std@@YAPAU_iobuf@@PB_WHH@Z */
2524 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEB_WHH@Z */
2525 FILE* __cdecl _Fiopen_wchar(const wchar_t *name, int mode, int prot)
2526 {
2527     static const wchar_t rW[] = {'r',0};
2528     static const struct {
2529         int mode;
2530         const wchar_t str[4];
2531         const wchar_t str_bin[4];
2532     } str_mode[] = {
2533         {OPENMODE_out,                            {'w',0},     {'w','b',0}},
2534         {OPENMODE_out|OPENMODE_app,               {'a',0},     {'a','b',0}},
2535         {OPENMODE_app,                            {'a',0},     {'a','b',0}},
2536         {OPENMODE_out|OPENMODE_trunc,             {'w',0},     {'w','b',0}},
2537         {OPENMODE_in,                             {'r',0},     {'r','b',0}},
2538         {OPENMODE_in|OPENMODE_out,                {'r','+',0}, {'r','+','b',0}},
2539         {OPENMODE_in|OPENMODE_out|OPENMODE_trunc, {'w','+',0}, {'w','+','b',0}},
2540         {OPENMODE_in|OPENMODE_out|OPENMODE_app,   {'a','+',0}, {'a','+','b',0}},
2541         {OPENMODE_in|OPENMODE_app,                {'a','+',0}, {'a','+','b',0}}
2542     };
2543
2544     int real_mode = mode & ~(OPENMODE_ate|OPENMODE__Nocreate|OPENMODE__Noreplace|OPENMODE_binary);
2545     int mode_idx;
2546     FILE *f = NULL;
2547
2548     TRACE("(%s %d %d)\n", debugstr_w(name), mode, prot);
2549
2550     for(mode_idx=0; mode_idx<sizeof(str_mode)/sizeof(str_mode[0]); mode_idx++)
2551         if(str_mode[mode_idx].mode == real_mode)
2552             break;
2553     if(mode_idx == sizeof(str_mode)/sizeof(str_mode[0]))
2554         return NULL;
2555
2556     if((mode & OPENMODE__Nocreate) && !(f = _wfopen(name, rW)))
2557         return NULL;
2558     else if(f)
2559         fclose(f);
2560
2561     if((mode & OPENMODE__Noreplace) && (mode & (OPENMODE_out|OPENMODE_app))
2562             && (f = _wfopen(name, rW))) {
2563         fclose(f);
2564         return NULL;
2565     }
2566
2567     f = _wfsopen(name, (mode & OPENMODE_binary) ? str_mode[mode_idx].str_bin
2568             : str_mode[mode_idx].str, prot);
2569     if(!f)
2570         return NULL;
2571
2572     if((mode & OPENMODE_ate) && fseek(f, 0, SEEK_END)) {
2573         fclose(f);
2574         return NULL;
2575     }
2576
2577     return f;
2578 }
2579
2580 /* ?_Fiopen@std@@YAPAU_iobuf@@PBDHH@Z */
2581 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEBDHH@Z */
2582 FILE* __cdecl _Fiopen(const char *name, int mode, int prot)
2583 {
2584     wchar_t nameW[FILENAME_MAX];
2585
2586     TRACE("(%s %d %d)\n", name, mode, prot);
2587
2588     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2589         return NULL;
2590     return _Fiopen_wchar(nameW, mode, prot);
2591 }
2592
2593 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WHH@Z */
2594 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
2595 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGHH@Z */
2596 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGHH@Z */
2597 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_wchar, 16)
2598 basic_filebuf_char* __thiscall basic_filebuf_char_open_wchar(basic_filebuf_char *this, const wchar_t *name, int mode, int prot)
2599 {
2600     FILE *f = NULL;
2601
2602     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
2603
2604     if(basic_filebuf_char_is_open(this))
2605         return NULL;
2606
2607     if(!(f = _Fiopen_wchar(name, mode, prot)))
2608         return NULL;
2609
2610     basic_filebuf_char__Init(this, f, INITFL_open);
2611     basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(this->base.loc));
2612     return this;
2613 }
2614
2615 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WI@Z */
2616 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WI@Z */
2617 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGI@Z */
2618 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGI@Z */
2619 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_wchar_mode, 12)
2620 basic_filebuf_char* __thiscall basic_filebuf_char_open_wchar_mode(basic_filebuf_char *this, const wchar_t *name, unsigned int mode)
2621 {
2622     return basic_filebuf_char_open_wchar(this, name, mode, SH_DENYNO);
2623 }
2624
2625 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDHH@Z */
2626 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDHH@Z */
2627 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open, 16)
2628 basic_filebuf_char* __thiscall basic_filebuf_char_open(basic_filebuf_char *this, const char *name, int mode, int prot)
2629 {
2630     wchar_t nameW[FILENAME_MAX];
2631
2632     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
2633
2634     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2635         return NULL;
2636     return basic_filebuf_char_open_wchar(this, nameW, mode, prot);
2637 }
2638
2639 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDI@Z */
2640 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDI@Z */
2641 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_mode, 12)
2642 basic_filebuf_char* __thiscall basic_filebuf_char_open_mode(basic_filebuf_char *this, const char *name, unsigned int mode)
2643 {
2644     return basic_filebuf_char_open(this, name, mode, SH_DENYNO);
2645 }
2646
2647 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2648 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2649 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_overflow, 8)
2650 int __thiscall basic_filebuf_char_overflow(basic_filebuf_char *this, int c)
2651 {
2652     char buf[8], *dyn_buf;
2653     char ch = c, *to_next;
2654     const char *from_next;
2655     int ret, max_size;
2656
2657
2658     TRACE("(%p %d)\n", this, c);
2659
2660     if(!basic_filebuf_char_is_open(this))
2661         return EOF;
2662     if(c == EOF)
2663         return !c;
2664
2665     if(!this->cvt)
2666         return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2667
2668     from_next = &ch;
2669     do {
2670         ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2671                 &from_next, buf, buf+sizeof(buf), &to_next);
2672
2673         switch(ret) {
2674         case CODECVT_partial:
2675             if(to_next == buf)
2676                 break;
2677             /* fall through */
2678         case CODECVT_ok:
2679             if(!fwrite(buf, to_next-buf, 1, this->file))
2680                 return EOF;
2681             if(ret == CODECVT_partial)
2682                 continue;
2683             return c;
2684         case CODECVT_noconv:
2685             return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2686         default:
2687             return EOF;
2688         }
2689
2690         break;
2691     } while(1);
2692
2693     max_size = codecvt_base_max_length(&this->cvt->base);
2694     dyn_buf = malloc(max_size);
2695     if(!dyn_buf)
2696         return EOF;
2697
2698     ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2699             &from_next, dyn_buf, dyn_buf+max_size, &to_next);
2700
2701     switch(ret) {
2702     case CODECVT_ok:
2703         ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
2704         free(dyn_buf);
2705         return ret ? c : EOF;
2706     case CODECVT_partial:
2707         ERR("buffer should be big enough to store all output\n");
2708         /* fall through */
2709     default:
2710         free(dyn_buf);
2711         return EOF;
2712     }
2713 }
2714
2715 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2716 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2717 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_pbackfail, 8)
2718 int __thiscall basic_filebuf_char_pbackfail(basic_filebuf_char *this, int c)
2719 {
2720     TRACE("(%p %d)\n", this, c);
2721
2722     if(!basic_filebuf_char_is_open(this))
2723         return EOF;
2724
2725     if(basic_streambuf_char_gptr(&this->base)>basic_streambuf_char_eback(&this->base)
2726             && (c==EOF || basic_streambuf_char_gptr(&this->base)[-1]==(char)c)) {
2727         basic_streambuf_char__Gndec(&this->base);
2728         return c==EOF ? !c : c;
2729     }else if(c!=EOF && !this->cvt) {
2730         return ungetc(c, this->file);
2731     }
2732
2733     return EOF;
2734 }
2735
2736 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2737 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2738 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_uflow, 4)
2739 int __thiscall basic_filebuf_char_uflow(basic_filebuf_char *this)
2740 {
2741     char ch, buf[128], *to_next;
2742     const char *buf_next;
2743     int c, i;
2744
2745     TRACE("(%p)\n", this);
2746
2747     if(!basic_filebuf_char_is_open(this))
2748         return EOF;
2749
2750     if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2751         return *basic_streambuf_char__Gninc(&this->base);
2752
2753     c = fgetc(this->file);
2754     if(!this->cvt || c==EOF)
2755         return c;
2756
2757     buf_next = buf;
2758     for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
2759         buf[i] = c;
2760
2761         switch(codecvt_char_in(this->cvt, &this->state, buf_next,
2762                     buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
2763         case CODECVT_partial:
2764         case CODECVT_ok:
2765             if(to_next == &ch) {
2766                 c = fgetc(this->file);
2767                 if(c == EOF)
2768                     return EOF;
2769                 continue;
2770             }
2771
2772             for(i--; i>=buf_next-buf; i--)
2773                 ungetc(buf[i], this->file);
2774             return ch;
2775         case CODECVT_noconv:
2776             return buf[0];
2777         default:
2778             return EOF;
2779         }
2780     }
2781
2782     FIXME("buffer is too small\n");
2783     return EOF;
2784 }
2785
2786 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2787 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2788 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_underflow, 4)
2789 int __thiscall basic_filebuf_char_underflow(basic_filebuf_char *this)
2790 {
2791     int ret;
2792
2793     TRACE("(%p)\n", this);
2794
2795     if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2796         return *basic_streambuf_char_gptr(&this->base);
2797
2798     ret = call_basic_streambuf_char_uflow(&this->base);
2799     if(ret != EOF)
2800         ret = call_basic_streambuf_char_pbackfail(&this->base, ret);
2801     return ret;
2802 }
2803
2804 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2805 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2806 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekoff, 24)
2807 fpos_int* __thiscall basic_filebuf_char_seekoff(basic_filebuf_char *this,
2808         fpos_int *ret, streamoff off, int way, int mode)
2809 {
2810     fpos_t pos;
2811
2812     TRACE("(%p %p %s %d %d)\n", this, ret, wine_dbgstr_longlong(off), way, mode);
2813
2814     if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2815             || fseek(this->file, off, way)) {
2816         ret->off = 0;
2817         ret->pos = -1;
2818         ret->state = 0;
2819         return ret;
2820     }
2821
2822     fgetpos(this->file, &pos);
2823     ret->off = 0;
2824     ret->pos = pos;
2825     ret->state = this->state;
2826     return ret;
2827 }
2828
2829 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2830 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2831 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekpos, 36)
2832 fpos_int* __thiscall basic_filebuf_char_seekpos(basic_filebuf_char *this,
2833         fpos_int *ret, fpos_int pos, int mode)
2834 {
2835     fpos_t fpos;
2836
2837     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
2838
2839     if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2840             || fseek(this->file, (LONG)pos.pos, SEEK_SET)
2841             || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
2842         ret->off = 0;
2843         ret->pos = -1;
2844         ret->state = 0;
2845         return ret;
2846     }
2847
2848     fgetpos(this->file, &fpos);
2849     ret->off = 0;
2850     ret->pos = fpos;
2851     ret->state = this->state;
2852     return ret;
2853 }
2854
2855 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PADH@Z */
2856 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAD_J@Z */
2857 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_setbuf, 16)
2858 basic_streambuf_char* __thiscall basic_filebuf_char_setbuf(basic_filebuf_char *this, char *buf, streamsize count)
2859 {
2860     TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
2861
2862     if(!basic_filebuf_char_is_open(this))
2863         return NULL;
2864
2865     if(setvbuf(this->file, buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count))
2866         return NULL;
2867
2868     basic_filebuf_char__Init(this, this->file, INITFL_open);
2869     return &this->base;
2870 }
2871
2872 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2873 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2874 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_sync, 4)
2875 int __thiscall basic_filebuf_char_sync(basic_filebuf_char *this)
2876 {
2877     TRACE("(%p)\n", this);
2878
2879     if(!basic_filebuf_char_is_open(this))
2880         return 0;
2881
2882     if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2883         return 0;
2884     return fflush(this->file);
2885 }
2886
2887 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
2888 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
2889 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_imbue, 8)
2890 void __thiscall basic_filebuf_char_imbue(basic_filebuf_char *this, const locale *loc)
2891 {
2892     TRACE("(%p %p)\n", this, loc);
2893     basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(loc));
2894 }
2895
2896 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2897 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2898 int basic_filebuf_wchar__Init__Stinit = 0;
2899
2900 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2901 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2902 int basic_filebuf_short__Init__Stinit = 0;
2903
2904 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2905 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2906 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Init, 12)
2907 void __thiscall basic_filebuf_wchar__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2908 {
2909     TRACE("(%p %p %d)\n", this, file, which);
2910
2911     this->cvt = NULL;
2912     this->wrotesome = FALSE;
2913     this->state = basic_filebuf_wchar__Init__Stinit;
2914     this->close = (which == INITFL_open);
2915     this->file = file;
2916
2917     basic_streambuf_wchar__Init_empty(&this->base);
2918 }
2919
2920 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2921 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2922 DEFINE_THISCALL_WRAPPER(basic_filebuf_short__Init, 12)
2923 void __thiscall basic_filebuf_short__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2924 {
2925     TRACE("(%p %p %d)\n", this, file, which);
2926
2927     this->cvt = NULL;
2928     this->wrotesome = FALSE;
2929     this->state = basic_filebuf_short__Init__Stinit;
2930     this->close = (which == INITFL_open);
2931     this->file = file;
2932
2933     basic_streambuf_wchar__Init_empty(&this->base);
2934 }
2935
2936 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$codecvt@_WDH@2@@Z */
2937 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$codecvt@_WDH@2@@Z */
2938 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAV?$codecvt@GDH@2@@Z */
2939 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$codecvt@GDH@2@@Z */
2940 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Initcvt, 8)
2941 void __thiscall basic_filebuf_wchar__Initcvt(basic_filebuf_wchar *this, codecvt_wchar *cvt)
2942 {
2943     TRACE("(%p %p)\n", this, cvt);
2944
2945     if(codecvt_base_always_noconv(&cvt->base)) {
2946         this->cvt = NULL;
2947     }else {
2948         basic_streambuf_wchar__Init_empty(&this->base);
2949         this->cvt = cvt;
2950     }
2951 }
2952
2953 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAE_NXZ */
2954 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAA_NXZ */
2955 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAE_NXZ */
2956 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAA_NXZ */
2957 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Endwrite, 4)
2958 MSVCP_bool __thiscall basic_filebuf_wchar__Endwrite(basic_filebuf_wchar *this)
2959 {
2960     TRACE("(%p)\n", this);
2961
2962     if(!this->wrotesome || !this->cvt)
2963         return TRUE;
2964
2965     if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2966         return FALSE;
2967
2968     while(1) {
2969         /* TODO: check if we need a dynamic buffer here */
2970         char buf[128];
2971         char *next;
2972         int ret;
2973
2974         ret = codecvt_wchar_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2975         switch(ret) {
2976         case CODECVT_ok:
2977             this->wrotesome = FALSE;
2978             /* fall through */
2979         case CODECVT_partial:
2980             if(!fwrite(buf, next-buf, 1, this->file))
2981                 return FALSE;
2982             if(this->wrotesome)
2983                 break;
2984             /* fall through */
2985         case CODECVT_noconv:
2986             if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2987                 return FALSE;
2988             return TRUE;
2989         default:
2990             return FALSE;
2991         }
2992     }
2993 }
2994
2995 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@XZ */
2996 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@XZ */
2997 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@XZ */
2998 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@XZ */
2999 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_close, 4)
3000 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_close(basic_filebuf_wchar *this)
3001 {
3002     basic_filebuf_wchar *ret = this;
3003
3004     TRACE("(%p)\n", this);
3005
3006     if(!this->file)
3007         return NULL;
3008
3009     /* TODO: handle exceptions */
3010     if(!basic_filebuf_wchar__Endwrite(this))
3011         ret = NULL;
3012     if(!fclose(this->file))
3013         ret  = NULL;
3014
3015     basic_filebuf_wchar__Init(this, NULL, INITFL_close);
3016     return ret;
3017 }
3018
3019 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
3020 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
3021 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor_file, 8)
3022 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor_file(basic_filebuf_wchar *this, FILE *file)
3023 {
3024     TRACE("(%p %p)\n", this, file);
3025
3026     basic_streambuf_wchar_ctor(&this->base);
3027     this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
3028
3029     basic_filebuf_wchar__Init(this, file, INITFL_new);
3030     return this;
3031 }
3032
3033 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
3034 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
3035 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor_file, 8)
3036 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor_file(basic_filebuf_wchar *this, FILE *file)
3037 {
3038     TRACE("(%p %p)\n", this, file);
3039
3040     basic_streambuf_short_ctor(&this->base);
3041     this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
3042
3043     basic_filebuf_short__Init(this, file, INITFL_new);
3044     return this;
3045 }
3046
3047 /* ??_F?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
3048 /* ??_F?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
3049 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor, 4)
3050 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor(basic_filebuf_wchar *this)
3051 {
3052     return basic_filebuf_wchar_ctor_file(this, NULL);
3053 }
3054
3055 /* ??_F?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
3056 /* ??_F?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
3057 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor, 4)
3058 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor(basic_filebuf_wchar *this)
3059 {
3060     return basic_filebuf_short_ctor_file(this, NULL);
3061 }
3062
3063 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
3064 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
3065 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor_uninitialized, 8)
3066 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor_uninitialized(basic_filebuf_wchar *this, int uninitialized)
3067 {
3068     TRACE("(%p %d)\n", this, uninitialized);
3069
3070     basic_streambuf_wchar_ctor(&this->base);
3071     this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
3072     return this;
3073 }
3074
3075 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
3076 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
3077 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor_uninitialized, 8)
3078 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor_uninitialized(basic_filebuf_wchar *this, int uninitialized)
3079 {
3080     TRACE("(%p %d)\n", this, uninitialized);
3081
3082     basic_streambuf_short_ctor(&this->base);
3083     this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
3084     return this;
3085 }
3086
3087 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
3088 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
3089 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
3090 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
3091 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_dtor, 4)
3092 void __thiscall basic_filebuf_wchar_dtor(basic_filebuf_wchar *this)
3093 {
3094     TRACE("(%p)\n", this);
3095
3096     if(this->close)
3097         basic_filebuf_wchar_close(this);
3098     basic_streambuf_wchar_dtor(&this->base);
3099 }
3100
3101 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_vector_dtor, 8)
3102 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_vector_dtor(basic_filebuf_wchar *this, unsigned int flags)
3103 {
3104     TRACE("(%p %x)\n", this, flags);
3105     if(flags & 2) {
3106         /* we have an array, with the number of elements stored before the first object */
3107         int i, *ptr = (int *)this-1;
3108
3109         for(i=*ptr-1; i>=0; i--)
3110             basic_filebuf_wchar_dtor(this+i);
3111         MSVCRT_operator_delete(ptr);
3112     } else {
3113         basic_filebuf_wchar_dtor(this);
3114         if(flags & 1)
3115             MSVCRT_operator_delete(this);
3116     }
3117
3118     return this;
3119 }
3120
3121 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
3122 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
3123 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QBE_NXZ */
3124 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
3125 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_is_open, 4)
3126 MSVCP_bool __thiscall basic_filebuf_wchar_is_open(const basic_filebuf_wchar *this)
3127 {
3128     TRACE("(%p)\n", this);
3129     return this->file != NULL;
3130 }
3131
3132 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WHH@Z */
3133 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
3134 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGHH@Z */
3135 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGHH@Z */
3136 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_wchar, 16)
3137 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot)
3138 {
3139     FILE *f = NULL;
3140
3141     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
3142
3143     if(basic_filebuf_wchar_is_open(this))
3144         return NULL;
3145
3146     if(!(f = _Fiopen_wchar(name, mode, prot)))
3147         return NULL;
3148
3149     basic_filebuf_wchar__Init(this, f, INITFL_open);
3150     basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(this->base.loc));
3151     return this;
3152 }
3153
3154 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PB_WHH@Z */
3155 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
3156 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBGHH@Z */
3157 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBGHH@Z */
3158 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_wchar, 16)
3159 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot)
3160 {
3161     FILE *f = NULL;
3162
3163     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
3164
3165     if(basic_filebuf_wchar_is_open(this))
3166         return NULL;
3167
3168     if(!(f = _Fiopen_wchar(name, mode, prot)))
3169         return NULL;
3170
3171     basic_filebuf_short__Init(this, f, INITFL_open);
3172     basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(this->base.loc));
3173     return this;
3174 }
3175
3176 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WI@Z */
3177 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WI@Z */
3178 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGI@Z */
3179 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGI@Z */
3180 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_wchar_mode, 12)
3181 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_wchar_mode(basic_filebuf_wchar *this, const wchar_t *name, unsigned int mode)
3182 {
3183     return basic_filebuf_wchar_open_wchar(this, name, mode, SH_DENYNO);
3184 }
3185
3186 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PB_WI@Z */
3187 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEB_WI@Z */
3188 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBGI@Z */
3189 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBGI@Z */
3190 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_wchar_mode, 12)
3191 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_wchar_mode(basic_filebuf_wchar *this, const wchar_t *name, unsigned int mode)
3192 {
3193     return basic_filebuf_short_open_wchar(this, name, mode, SH_DENYNO);
3194 }
3195
3196 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDHH@Z */
3197 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDHH@Z */
3198 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open, 16)
3199 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_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_wchar_open_wchar(this, nameW, mode, prot);
3208 }
3209
3210 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDHH@Z */
3211 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDHH@Z */
3212 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open, 16)
3213 basic_filebuf_wchar* __thiscall basic_filebuf_short_open(basic_filebuf_wchar *this, const char *name, int mode, int prot)
3214 {
3215     wchar_t nameW[FILENAME_MAX];
3216
3217     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
3218
3219     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
3220         return NULL;
3221     return basic_filebuf_short_open_wchar(this, nameW, mode, prot);
3222 }
3223
3224 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDI@Z */
3225 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDI@Z */
3226 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_mode, 12)
3227 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_mode(basic_filebuf_wchar *this, const char *name, unsigned int mode)
3228 {
3229     return basic_filebuf_wchar_open(this, name, mode, SH_DENYNO);
3230 }
3231
3232 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDI@Z */
3233 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDI@Z */
3234 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_mode, 12)
3235 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_mode(basic_filebuf_wchar *this, const char *name, unsigned int mode)
3236 {
3237     return basic_filebuf_short_open(this, name, mode, SH_DENYNO);
3238 }
3239
3240 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
3241 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
3242 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
3243 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
3244 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_overflow, 8)
3245 unsigned short __thiscall basic_filebuf_wchar_overflow(basic_filebuf_wchar *this, unsigned short c)
3246 {
3247     char buf[8], *dyn_buf, *to_next;
3248     wchar_t ch = c;
3249     const wchar_t *from_next;
3250     int max_size;
3251     unsigned short ret;
3252
3253
3254     TRACE("(%p %d)\n", this, c);
3255
3256     if(!basic_filebuf_wchar_is_open(this))
3257         return WEOF;
3258     if(c == WEOF)
3259         return !c;
3260
3261     if(!this->cvt)
3262         return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
3263
3264     from_next = &ch;
3265     do {
3266         ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
3267                 &from_next, buf, buf+sizeof(buf), &to_next);
3268
3269         switch(ret) {
3270         case CODECVT_partial:
3271             if(to_next == buf)
3272                 break;
3273             /* fall through */
3274         case CODECVT_ok:
3275             if(!fwrite(buf, to_next-buf, 1, this->file))
3276                 return WEOF;
3277             if(ret == CODECVT_partial)
3278                 continue;
3279             return c;
3280         case CODECVT_noconv:
3281             return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
3282         default:
3283             return WEOF;
3284         }
3285
3286         break;
3287     } while(1);
3288
3289     max_size = codecvt_base_max_length(&this->cvt->base);
3290     dyn_buf = malloc(max_size);
3291     if(!dyn_buf)
3292         return WEOF;
3293
3294     ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
3295             &from_next, dyn_buf, dyn_buf+max_size, &to_next);
3296
3297     switch(ret) {
3298     case CODECVT_ok:
3299         ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
3300         free(dyn_buf);
3301         return ret ? c : WEOF;
3302     case CODECVT_partial:
3303         ERR("buffer should be big enough to store all output\n");
3304         /* fall through */
3305     default:
3306         free(dyn_buf);
3307         return WEOF;
3308     }
3309 }
3310
3311 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
3312 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
3313 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
3314 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
3315 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_pbackfail, 8)
3316 unsigned short __thiscall basic_filebuf_wchar_pbackfail(basic_filebuf_wchar *this, unsigned short c)
3317 {
3318     TRACE("(%p %d)\n", this, c);
3319
3320     if(!basic_filebuf_wchar_is_open(this))
3321         return WEOF;
3322
3323     if(basic_streambuf_wchar_gptr(&this->base)>basic_streambuf_wchar_eback(&this->base)
3324             && (c==WEOF || basic_streambuf_wchar_gptr(&this->base)[-1]==(wchar_t)c)) {
3325         basic_streambuf_wchar__Gndec(&this->base);
3326         return c==WEOF ? !c : c;
3327     }else if(c!=WEOF && !this->cvt) {
3328         return ungetwc(c, this->file);
3329     }else if(c!=WEOF && basic_streambuf_wchar_gptr(&this->base)!=&this->putback) {
3330         this->putback = c;
3331         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback, &this->putback+1);
3332         return c;
3333     }
3334
3335     return WEOF;
3336 }
3337
3338 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
3339 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
3340 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
3341 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
3342 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_uflow, 4)
3343 unsigned short __thiscall basic_filebuf_wchar_uflow(basic_filebuf_wchar *this)
3344 {
3345     wchar_t ch, *to_next;
3346     char buf[128];
3347     const char *buf_next;
3348     int c, i;
3349
3350     TRACE("(%p)\n", this);
3351
3352     if(!basic_filebuf_wchar_is_open(this))
3353         return WEOF;
3354
3355     if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
3356         return *basic_streambuf_wchar__Gninc(&this->base);
3357
3358     if(!this->cvt)
3359         return fgetwc(this->file);
3360
3361     buf_next = buf;
3362     for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
3363         if((c = fgetc(this->file)) == EOF)
3364             return WEOF;
3365         buf[i] = c;
3366
3367         switch(codecvt_wchar_in(this->cvt, &this->state, buf_next,
3368                     buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
3369         case CODECVT_partial:
3370         case CODECVT_ok:
3371             if(to_next == &ch)
3372                 continue;
3373
3374             for(i--; i>=buf_next-buf; i--)
3375                 ungetc(buf[i], this->file);
3376             return ch;
3377         case CODECVT_noconv:
3378             if(i+1 < sizeof(wchar_t))
3379                 continue;
3380
3381             memcpy(&ch, buf, sizeof(wchar_t));
3382             return ch;
3383         default:
3384             return WEOF;
3385         }
3386     }
3387
3388     FIXME("buffer is too small\n");
3389     return WEOF;
3390 }
3391
3392 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
3393 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
3394 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
3395 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
3396 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_underflow, 4)
3397 unsigned short __thiscall basic_filebuf_wchar_underflow(basic_filebuf_wchar *this)
3398 {
3399     unsigned short ret;
3400
3401     TRACE("(%p)\n", this);
3402
3403     if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
3404         return *basic_streambuf_wchar_gptr(&this->base);
3405
3406     ret = call_basic_streambuf_wchar_uflow(&this->base);
3407     if(ret != WEOF)
3408         ret = call_basic_streambuf_wchar_pbackfail(&this->base, ret);
3409     return ret;
3410 }
3411
3412 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3413 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3414 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3415 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3416 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekoff, 24)
3417 fpos_int* __thiscall basic_filebuf_wchar_seekoff(basic_filebuf_wchar *this,
3418         fpos_int *ret, streamoff off, int way, int mode)
3419 {
3420     fpos_t pos;
3421
3422     TRACE("(%p %p %s %d %d)\n", this, ret, wine_dbgstr_longlong(off), way, mode);
3423
3424     if(basic_streambuf_wchar_gptr(&this->base) == &this->putback) {
3425         if(way == SEEKDIR_cur)
3426             off -= sizeof(wchar_t);
3427
3428         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
3429     }
3430
3431     if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
3432             || fseek(this->file, off, way)) {
3433         ret->off = 0;
3434         ret->pos = -1;
3435         ret->state = 0;
3436         return ret;
3437     }
3438
3439     fgetpos(this->file, &pos);
3440     ret->off = 0;
3441     ret->pos = pos;
3442     ret->state = this->state;
3443     return ret;
3444 }
3445
3446 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3447 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3448 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3449 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3450 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekpos, 36)
3451 fpos_int* __thiscall basic_filebuf_wchar_seekpos(basic_filebuf_wchar *this,
3452         fpos_int *ret, fpos_int pos, int mode)
3453 {
3454     fpos_t fpos;
3455
3456     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
3457
3458     if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
3459             || fseek(this->file, (LONG)pos.pos, SEEK_SET)
3460             || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
3461         ret->off = 0;
3462         ret->pos = -1;
3463         ret->state = 0;
3464         return ret;
3465     }
3466
3467     if(basic_streambuf_wchar_gptr(&this->base) == &this->putback)
3468         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
3469
3470     fgetpos(this->file, &fpos);
3471     ret->off = 0;
3472     ret->pos = fpos;
3473     ret->state = this->state;
3474     return ret;
3475 }
3476
3477 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PA_WH@Z */
3478 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEA_W_J@Z */
3479 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_setbuf, 16)
3480 basic_streambuf_wchar* __thiscall basic_filebuf_wchar_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
3481 {
3482     TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
3483
3484     if(!basic_filebuf_wchar_is_open(this))
3485         return NULL;
3486
3487     if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
3488         return NULL;
3489
3490     basic_filebuf_wchar__Init(this, this->file, INITFL_open);
3491     return &this->base;
3492 }
3493
3494 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAGH@Z */
3495 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAG_J@Z */
3496 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_setbuf, 16)
3497 basic_streambuf_wchar* __thiscall basic_filebuf_short_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
3498 {
3499     TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
3500
3501     if(!basic_filebuf_wchar_is_open(this))
3502         return NULL;
3503
3504     if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
3505         return NULL;
3506
3507     basic_filebuf_short__Init(this, this->file, INITFL_open);
3508     return &this->base;
3509 }
3510
3511 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
3512 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
3513 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
3514 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
3515 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_sync, 4)
3516 int __thiscall basic_filebuf_wchar_sync(basic_filebuf_wchar *this)
3517 {
3518     TRACE("(%p)\n", this);
3519
3520     if(!basic_filebuf_wchar_is_open(this))
3521         return 0;
3522
3523     if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
3524         return 0;
3525     return fflush(this->file);
3526 }
3527
3528 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
3529 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
3530 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_imbue, 8)
3531 void __thiscall basic_filebuf_wchar_imbue(basic_filebuf_wchar *this, const locale *loc)
3532 {
3533     TRACE("(%p %p)\n", this, loc);
3534     basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(loc));
3535 }
3536
3537 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
3538 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
3539 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_imbue, 8)
3540 void __thiscall basic_filebuf_short_imbue(basic_filebuf_wchar *this, const locale *loc)
3541 {
3542     TRACE("(%p %p)\n", this, loc);
3543     basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(loc));
3544 }
3545
3546 /* ?_Getstate@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEHH@Z */
3547 /* ?_Getstate@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAHH@Z */
3548 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Getstate, 8)
3549 int __thiscall basic_stringbuf_char__Getstate(basic_stringbuf_char *this, IOSB_openmode mode)
3550 {
3551     int state = 0;
3552
3553     if(!(mode & OPENMODE_in))
3554         state |= STRINGBUF_no_read;
3555
3556     if(!(mode & OPENMODE_out))
3557         state |= STRINGBUF_no_write;
3558
3559     if(mode & OPENMODE_ate)
3560         state |= STRINGBUF_at_end;
3561
3562     if(mode & OPENMODE_app)
3563         state |= STRINGBUF_append;
3564
3565     return state;
3566 }
3567
3568 /* ?_Init@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXPBDIH@Z */
3569 /* ?_Init@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAXPEBD_KH@Z */
3570 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Init, 16)
3571 void __thiscall basic_stringbuf_char__Init(basic_stringbuf_char *this, const char *str, MSVCP_size_t count, int state)
3572 {
3573     TRACE("(%p, %p, %lu, %d)\n", this, str, count, state);
3574
3575     basic_streambuf_char__Init_empty(&this->base);
3576
3577     this->state = state;
3578     this->seekhigh = NULL;
3579
3580     if(count && str) {
3581         char *buf = MSVCRT_operator_new(count);
3582         if(!buf) {
3583             ERR("Out of memory\n");
3584             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3585         }
3586
3587         memcpy(buf, str, count);
3588         this->seekhigh = buf + count;
3589
3590         this->state |= STRINGBUF_allocated;
3591
3592         if(!(state & STRINGBUF_no_read))
3593             basic_streambuf_char_setg(&this->base, buf, buf, buf + count);
3594
3595         if(!(state & STRINGBUF_no_write)) {
3596             basic_streambuf_char_setp_next(&this->base, buf, (state & STRINGBUF_at_end) ? buf + count : buf, buf + count);
3597
3598             if(!basic_streambuf_char_gptr(&this->base))
3599                 basic_streambuf_char_setg(&this->base, buf, 0, buf);
3600         }
3601     }
3602 }
3603
3604 /* ??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 */
3605 /* ??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 */
3606 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor_str, 12)
3607 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor_str(basic_stringbuf_char *this,
3608         const basic_string_char *str, IOSB_openmode mode)
3609 {
3610     TRACE("(%p %p %d)\n", this, str, mode);
3611
3612     basic_streambuf_char_ctor(&this->base);
3613     this->base.vtable = &MSVCP_basic_stringbuf_char_vtable;
3614
3615     basic_stringbuf_char__Init(this, MSVCP_basic_string_char_c_str(str),
3616             str->size, basic_stringbuf_char__Getstate(this, mode));
3617     return this;
3618 }
3619
3620 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
3621 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
3622 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor_mode, 8)
3623 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor_mode(
3624         basic_stringbuf_char *this, IOSB_openmode mode)
3625 {
3626     TRACE("(%p %d)\n", this, mode);
3627
3628     basic_streambuf_char_ctor(&this->base);
3629     this->base.vtable = &MSVCP_basic_stringbuf_char_vtable;
3630
3631     basic_stringbuf_char__Init(this, NULL, 0, basic_stringbuf_char__Getstate(this, mode));
3632     return this;
3633 }
3634
3635 /* ??_F?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
3636 /* ??_F?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
3637 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor, 4)
3638 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor(basic_stringbuf_char *this)
3639 {
3640     return basic_stringbuf_char_ctor_mode(this, OPENMODE_in|OPENMODE_out);
3641 }
3642
3643 /* ?_Tidy@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXXZ */
3644 /* ?_Tidy@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAXXZ */
3645 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Tidy, 4)
3646 void __thiscall basic_stringbuf_char__Tidy(basic_stringbuf_char *this)
3647 {
3648     TRACE("(%p)\n", this);
3649
3650     if(this->state & STRINGBUF_allocated) {
3651         MSVCRT_operator_delete(basic_streambuf_char_eback(&this->base));
3652         this->seekhigh = NULL;
3653         this->state &= ~STRINGBUF_allocated;
3654     }
3655
3656     basic_streambuf_char__Init_empty(&this->base);
3657 }
3658
3659 /* ??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
3660 /* ??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
3661 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_dtor, 4)
3662 void __thiscall basic_stringbuf_char_dtor(basic_stringbuf_char *this)
3663 {
3664     TRACE("(%p)\n", this);
3665
3666     basic_stringbuf_char__Tidy(this);
3667     basic_streambuf_char_dtor(&this->base);
3668 }
3669
3670 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_vector_dtor, 8)
3671 basic_stringbuf_char* __thiscall basic_stringbuf_char_vector_dtor(basic_stringbuf_char *this, unsigned int flags)
3672 {
3673     TRACE("(%p %x)\n", this, flags);
3674
3675     if(flags & 2) {
3676         /* we have an array, with the number of elements stored before the first object */
3677         int i, *ptr = (int *) this - 1;
3678
3679         for (i = *ptr - 1; i >= 0; i--)
3680             basic_stringbuf_char_dtor(this+i);
3681
3682         MSVCRT_operator_delete(ptr);
3683     }else {
3684         basic_stringbuf_char_dtor(this);
3685
3686         if(flags & 1)
3687             MSVCRT_operator_delete(this);
3688     }
3689
3690     return this;
3691 }
3692
3693 /* ?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z */
3694 /* ?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHH@Z */
3695 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_overflow, 8)
3696 int __thiscall basic_stringbuf_char_overflow(basic_stringbuf_char *this, int meta)
3697 {
3698     MSVCP_size_t oldsize, size;
3699     char *ptr, *buf;
3700
3701     TRACE("(%p %x)\n", this, meta);
3702
3703     if(meta == EOF)
3704         return !EOF;
3705     if(this->state & STRINGBUF_no_write)
3706         return EOF;
3707
3708     ptr = basic_streambuf_char_pptr(&this->base);
3709     if((this->state&STRINGBUF_append) && ptr<this->seekhigh)
3710         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
3711                 this->seekhigh, basic_streambuf_char_epptr(&this->base));
3712
3713     if(ptr && ptr<basic_streambuf_char_epptr(&this->base))
3714         return (*basic_streambuf_char__Pninc(&this->base) = meta);
3715
3716     oldsize = (ptr ? basic_streambuf_char_epptr(&this->base)-basic_streambuf_char_eback(&this->base): 0);
3717     size = oldsize|0xf;
3718     size += size/2;
3719     buf = MSVCRT_operator_new(size);
3720     if(!buf) {
3721         ERR("Out of memory\n");
3722         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3723     }
3724
3725     if(!oldsize) {
3726         this->seekhigh = buf;
3727         basic_streambuf_char_setp(&this->base, buf, buf+size);
3728         if(this->state & STRINGBUF_no_read)
3729             basic_streambuf_char_setg(&this->base, buf, NULL, buf);
3730         else
3731             basic_streambuf_char_setg(&this->base, buf, buf, buf+1);
3732
3733         this->state |= STRINGBUF_allocated;
3734     }else {
3735         ptr = basic_streambuf_char_eback(&this->base);
3736         memcpy(buf, ptr, oldsize);
3737
3738         this->seekhigh = buf+(this->seekhigh-ptr);
3739         basic_streambuf_char_setp_next(&this->base, buf,
3740                 buf+(basic_streambuf_char_pptr(&this->base)-ptr), buf+size);
3741         if(this->state & STRINGBUF_no_read)
3742             basic_streambuf_char_setg(&this->base, buf, NULL, buf);
3743         else
3744             basic_streambuf_char_setg(&this->base, buf,
3745                     buf+(basic_streambuf_char_gptr(&this->base)-ptr),
3746                     basic_streambuf_char_pptr(&this->base)+1);
3747
3748         MSVCRT_operator_delete(ptr);
3749     }
3750
3751     return (*basic_streambuf_char__Pninc(&this->base) = meta);
3752 }
3753
3754 /* ?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z */
3755 /* ?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHH@Z */
3756 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_pbackfail, 8)
3757 int __thiscall basic_stringbuf_char_pbackfail(basic_stringbuf_char *this, int c)
3758 {
3759     char *cur;
3760
3761     TRACE("(%p %x)\n", this, c);
3762
3763     cur = basic_streambuf_char_gptr(&this->base);
3764     if(!cur || cur==basic_streambuf_char_eback(&this->base)
3765             || (c!=EOF && c!=cur[-1] && this->state&STRINGBUF_no_write))
3766         return EOF;
3767
3768     if(c != EOF)
3769         cur[-1] = c;
3770     basic_streambuf_char_gbump(&this->base, -1);
3771     return c==EOF ? !EOF : c;
3772 }
3773
3774 /* ?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHXZ */
3775 /* ?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHXZ */
3776 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_underflow, 4)
3777 int __thiscall basic_stringbuf_char_underflow(basic_stringbuf_char *this)
3778 {
3779     char *ptr, *cur;
3780
3781     TRACE("(%p)\n", this);
3782
3783     cur = basic_streambuf_char_gptr(&this->base);
3784     if(!cur || this->state&STRINGBUF_no_read)
3785         return EOF;
3786
3787     ptr  = basic_streambuf_char_pptr(&this->base);
3788     if(this->seekhigh < ptr)
3789         this->seekhigh = ptr;
3790
3791     ptr = basic_streambuf_char_egptr(&this->base);
3792     if(this->seekhigh > ptr)
3793         basic_streambuf_char_setg(&this->base, basic_streambuf_char_eback(&this->base), cur, this->seekhigh);
3794
3795     if(cur < this->seekhigh)
3796         return *cur;
3797     return EOF;
3798 }
3799
3800 /* ?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3801 /* ?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3802 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_seekoff, 24)
3803 fpos_int* __thiscall basic_stringbuf_char_seekoff(basic_stringbuf_char *this,
3804         fpos_int *ret, streamoff off, int way, int mode)
3805 {
3806     char *beg, *cur_r, *cur_w;
3807
3808     TRACE("(%p %p %s %d %d)\n", this, ret, wine_dbgstr_longlong(off), way, mode);
3809
3810     cur_w = basic_streambuf_char_pptr(&this->base);
3811     if(cur_w > this->seekhigh)
3812         this->seekhigh = cur_w;
3813
3814     ret->off = 0;
3815     ret->state = 0;
3816
3817     beg = basic_streambuf_char_eback(&this->base);
3818     cur_r = basic_streambuf_char_gptr(&this->base);
3819     if((mode & OPENMODE_in) && cur_r) {
3820         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
3821             off += cur_r-beg;
3822         else if(way == SEEKDIR_end)
3823             off += this->seekhigh-beg;
3824         else if(way != SEEKDIR_beg)
3825             off = -1;
3826
3827         if(off<0 || off>this->seekhigh-beg) {
3828             off = -1;
3829         }else {
3830             basic_streambuf_char_gbump(&this->base, beg-cur_r+off);
3831             if((mode & OPENMODE_out) && cur_w) {
3832                 basic_streambuf_char_setp_next(&this->base, beg,
3833                         basic_streambuf_char_gptr(&this->base),
3834                         basic_streambuf_char_epptr(&this->base));
3835             }
3836         }
3837     }else if((mode & OPENMODE_out) && cur_w) {
3838         if(way == SEEKDIR_cur)
3839             off += cur_w-beg;
3840         else if(way == SEEKDIR_end)
3841             off += this->seekhigh-beg;
3842         else if(way != SEEKDIR_beg)
3843             off = -1;
3844
3845         if(off<0 || off>this->seekhigh-beg)
3846             off = -1;
3847         else
3848             basic_streambuf_char_pbump(&this->base, beg-cur_w+off);
3849     }else {
3850         off = -1;
3851     }
3852
3853     ret->pos = off;
3854     return ret;
3855 }
3856
3857 /* ?seekpos@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3858 /* ?seekpos@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3859 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_seekpos, 36)
3860 fpos_int* __thiscall basic_stringbuf_char_seekpos(basic_stringbuf_char *this,
3861         fpos_int *ret, fpos_int pos, int mode)
3862 {
3863     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
3864
3865     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
3866         *ret = pos;
3867         return ret;
3868     }
3869
3870     return basic_stringbuf_char_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
3871 }
3872
3873 /* ?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 */
3874 /* ?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 */
3875 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_str_set, 8)
3876 void __thiscall basic_stringbuf_char_str_set(basic_stringbuf_char *this, const basic_string_char *str)
3877 {
3878     TRACE("(%p %p)\n", this, str);
3879
3880     basic_stringbuf_char__Tidy(this);
3881     basic_stringbuf_char__Init(this, MSVCP_basic_string_char_c_str(str), str->size, this->state);
3882 }
3883
3884 /* ?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 */
3885 /* ?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 */
3886 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_str_get, 8)
3887 basic_string_char* __thiscall basic_stringbuf_char_str_get(const basic_stringbuf_char *this, basic_string_char *ret)
3888 {
3889     char *ptr;
3890
3891     TRACE("(%p)\n", this);
3892
3893     if(!(this->state & STRINGBUF_no_write) && basic_streambuf_char_pptr(&this->base)) {
3894         char *pptr;
3895
3896         ptr = basic_streambuf_char_pbase(&this->base);
3897         pptr = basic_streambuf_char_pptr(&this->base);
3898
3899         return MSVCP_basic_string_char_ctor_cstr_len(ret, ptr, (this->seekhigh < pptr ? pptr : this->seekhigh) - ptr);
3900     }
3901
3902     if(!(this->state & STRINGBUF_no_read) && basic_streambuf_char_gptr(&this->base)) {
3903         ptr = basic_streambuf_char_eback(&this->base);
3904         return MSVCP_basic_string_char_ctor_cstr_len(ret, ptr, basic_streambuf_char_egptr(&this->base) - ptr);
3905     }
3906
3907     return MSVCP_basic_string_char_ctor(ret);
3908 }
3909
3910 /* ?_Getstate@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AAEHH@Z */
3911 /* ?_Getstate@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEAAHH@Z */
3912 /* ?_Getstate@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEHH@Z */
3913 /* ?_Getstate@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAHH@Z */
3914 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Getstate, 8)
3915 int __thiscall basic_stringbuf_wchar__Getstate(basic_stringbuf_wchar *this, IOSB_openmode mode)
3916 {
3917     int state = 0;
3918
3919     if(!(mode & OPENMODE_in))
3920         state |= STRINGBUF_no_read;
3921
3922     if(!(mode & OPENMODE_out))
3923         state |= STRINGBUF_no_write;
3924
3925     if(mode & OPENMODE_ate)
3926         state |= STRINGBUF_at_end;
3927
3928     if(mode & OPENMODE_app)
3929         state |= STRINGBUF_append;
3930
3931     return state;
3932 }
3933
3934 /* ?_Init@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXPB_WIH@Z */
3935 /* ?_Init@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAXPEB_W_KH@Z */
3936 /* ?_Init@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXPBGIH@Z */
3937 /* ?_Init@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAXPEBG_KH@Z */
3938 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Init, 16)
3939 void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const wchar_t *str, MSVCP_size_t count, int state)
3940 {
3941     TRACE("(%p, %p, %lu, %d)\n", this, str, count, state);
3942
3943     basic_streambuf_wchar__Init_empty(&this->base);
3944
3945     this->state = state;
3946     this->seekhigh = NULL;
3947
3948     if(count && str) {
3949         wchar_t *buf = MSVCRT_operator_new(count);
3950         if(!buf) {
3951             ERR("Out of memory\n");
3952             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3953         }
3954
3955         memcpy(buf, str, count);
3956         this->seekhigh = buf + count;
3957
3958         this->state |= STRINGBUF_allocated;
3959
3960         if(!(state & STRINGBUF_no_read))
3961             basic_streambuf_wchar_setg(&this->base, buf, buf, buf + count);
3962
3963         if(!(state & STRINGBUF_no_write)) {
3964             basic_streambuf_wchar_setp_next(&this->base, buf, (state & STRINGBUF_at_end) ? buf + count : buf, buf + count);
3965
3966             if(!basic_streambuf_wchar_gptr(&this->base))
3967                 basic_streambuf_wchar_setg(&this->base, buf, 0, buf);
3968         }
3969     }
3970 }
3971
3972 /* ??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 */
3973 /* ??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 */
3974 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor_str, 12)
3975 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor_str(basic_stringbuf_wchar *this,
3976         const basic_string_wchar *str, IOSB_openmode mode)
3977 {
3978     TRACE("(%p %p %d)\n", this, str, mode);
3979
3980     basic_streambuf_wchar_ctor(&this->base);
3981     this->base.vtable = &MSVCP_basic_stringbuf_wchar_vtable;
3982
3983     basic_stringbuf_wchar__Init(this, MSVCP_basic_string_wchar_c_str(str),
3984             str->size, basic_stringbuf_wchar__Getstate(this, mode));
3985     return this;
3986 }
3987
3988 /* ??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 */
3989 /* ??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 */
3990 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor_str, 12)
3991 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor_str(basic_stringbuf_wchar *this,
3992         const basic_string_wchar *str, IOSB_openmode mode)
3993 {
3994     basic_stringbuf_wchar_ctor_str(this, str, mode);
3995     this->base.vtable = &MSVCP_basic_stringbuf_short_vtable;
3996     return this;
3997 }
3998
3999 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
4000 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
4001 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor_mode, 8)
4002 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor_mode(
4003         basic_stringbuf_wchar *this, IOSB_openmode mode)
4004 {
4005     TRACE("(%p %d)\n", this, mode);
4006
4007     basic_streambuf_wchar_ctor(&this->base);
4008     this->base.vtable = &MSVCP_basic_stringbuf_wchar_vtable;
4009
4010     basic_stringbuf_wchar__Init(this, NULL, 0, basic_stringbuf_wchar__Getstate(this, mode));
4011     return this;
4012 }
4013
4014 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
4015 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
4016 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor_mode, 8)
4017 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor_mode(
4018         basic_stringbuf_wchar *this, IOSB_openmode mode)
4019 {
4020     basic_stringbuf_wchar_ctor_mode(this, mode);
4021     this->base.vtable = &MSVCP_basic_stringbuf_short_vtable;
4022     return this;
4023 }
4024
4025 /* ??_F?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
4026 /* ??_F?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
4027 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor, 4)
4028 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor(basic_stringbuf_wchar *this)
4029 {
4030     return basic_stringbuf_wchar_ctor_mode(this, OPENMODE_in|OPENMODE_out);
4031 }
4032
4033 /* ??_F?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
4034 /* ??_F?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
4035 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor, 4)
4036 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor(basic_stringbuf_wchar *this)
4037 {
4038     return basic_stringbuf_short_ctor_mode(this, OPENMODE_in|OPENMODE_out);
4039 }
4040
4041 /* ?_Tidy@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXXZ */
4042 /* ?_Tidy@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAXXZ */
4043 /* ?_Tidy@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXXZ */
4044 /* ?_Tidy@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAXXZ */
4045 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Tidy, 4)
4046 void __thiscall basic_stringbuf_wchar__Tidy(basic_stringbuf_wchar *this)
4047 {
4048     TRACE("(%p)\n", this);
4049
4050     if(this->state & STRINGBUF_allocated) {
4051         MSVCRT_operator_delete(basic_streambuf_wchar_eback(&this->base));
4052         this->seekhigh = NULL;
4053         this->state &= ~STRINGBUF_allocated;
4054     }
4055
4056     basic_streambuf_wchar__Init_empty(&this->base);
4057 }
4058
4059 /* ??1?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
4060 /* ??1?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
4061 /* ??1?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
4062 /* ??1?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
4063 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_dtor, 4)
4064 void __thiscall basic_stringbuf_wchar_dtor(basic_stringbuf_wchar *this)
4065 {
4066     TRACE("(%p)\n", this);
4067
4068     basic_stringbuf_wchar__Tidy(this);
4069     basic_streambuf_wchar_dtor(&this->base);
4070 }
4071
4072 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_vector_dtor, 8)
4073 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_vector_dtor(basic_stringbuf_wchar *this, unsigned int flags)
4074 {
4075     TRACE("(%p %x)\n", this, flags);
4076
4077     if(flags & 2) {
4078         /* we have an array, with the number of elements stored before the first object */
4079         int i, *ptr = (int *) this - 1;
4080
4081         for (i = *ptr - 1; i >= 0; i--)
4082             basic_stringbuf_wchar_dtor(this+i);
4083
4084         MSVCRT_operator_delete(ptr);
4085     }else {
4086         basic_stringbuf_wchar_dtor(this);
4087
4088         if(flags & 1)
4089             MSVCRT_operator_delete(this);
4090     }
4091
4092     return this;
4093 }
4094
4095 /* ?overflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGG@Z */
4096 /* ?overflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGG@Z */
4097 /* ?overflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGG@Z */
4098 /* ?overflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGG@Z */
4099 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_overflow, 8)
4100 unsigned short __thiscall basic_stringbuf_wchar_overflow(basic_stringbuf_wchar *this, unsigned short meta)
4101 {
4102     MSVCP_size_t oldsize, size;
4103     wchar_t *ptr, *buf;
4104
4105     TRACE("(%p %x)\n", this, meta);
4106
4107     if(meta == WEOF)
4108         return !WEOF;
4109     if(this->state & STRINGBUF_no_write)
4110         return WEOF;
4111
4112     ptr = basic_streambuf_wchar_pptr(&this->base);
4113     if((this->state&STRINGBUF_append) && ptr<this->seekhigh)
4114         basic_streambuf_wchar_setp_next(&this->base, basic_streambuf_wchar_pbase(&this->base),
4115                 this->seekhigh, basic_streambuf_wchar_epptr(&this->base));
4116
4117     if(ptr && ptr<basic_streambuf_wchar_epptr(&this->base))
4118         return (*basic_streambuf_wchar__Pninc(&this->base) = meta);
4119
4120     oldsize = (ptr ? basic_streambuf_wchar_epptr(&this->base)-basic_streambuf_wchar_eback(&this->base): 0);
4121     size = oldsize|0xf;
4122     size += size/2;
4123     buf = MSVCRT_operator_new(size);
4124     if(!buf) {
4125         ERR("Out of memory\n");
4126         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4127     }
4128
4129     if(!oldsize) {
4130         this->seekhigh = buf;
4131         basic_streambuf_wchar_setp(&this->base, buf, buf+size);
4132         if(this->state & STRINGBUF_no_read)
4133             basic_streambuf_wchar_setg(&this->base, buf, NULL, buf);
4134         else
4135             basic_streambuf_wchar_setg(&this->base, buf, buf, buf+1);
4136
4137         this->state |= STRINGBUF_allocated;
4138     }else {
4139         ptr = basic_streambuf_wchar_eback(&this->base);
4140         memcpy(buf, ptr, oldsize);
4141
4142         this->seekhigh = buf+(this->seekhigh-ptr);
4143         basic_streambuf_wchar_setp_next(&this->base, buf,
4144                 buf+(basic_streambuf_wchar_pptr(&this->base)-ptr), buf+size);
4145         if(this->state & STRINGBUF_no_read)
4146             basic_streambuf_wchar_setg(&this->base, buf, NULL, buf);
4147         else
4148             basic_streambuf_wchar_setg(&this->base, buf,
4149                     buf+(basic_streambuf_wchar_gptr(&this->base)-ptr),
4150                     basic_streambuf_wchar_pptr(&this->base)+1);
4151
4152         MSVCRT_operator_delete(ptr);
4153     }
4154
4155     return (*basic_streambuf_wchar__Pninc(&this->base) = meta);
4156 }
4157
4158 /* ?pbackfail@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGG@Z */
4159 /* ?pbackfail@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGG@Z */
4160 /* ?pbackfail@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGG@Z */
4161 /* ?pbackfail@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGG@Z */
4162 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_pbackfail, 8)
4163 unsigned short __thiscall basic_stringbuf_wchar_pbackfail(basic_stringbuf_wchar *this, unsigned short c)
4164 {
4165     wchar_t *cur;
4166
4167     TRACE("(%p %x)\n", this, c);
4168
4169     cur = basic_streambuf_wchar_gptr(&this->base);
4170     if(!cur || cur==basic_streambuf_wchar_eback(&this->base)
4171             || (c!=WEOF && c!=cur[-1] && this->state&STRINGBUF_no_write))
4172         return WEOF;
4173
4174     if(c != WEOF)
4175         cur[-1] = c;
4176     basic_streambuf_wchar_gbump(&this->base, -1);
4177     return c==WEOF ? !WEOF : c;
4178 }
4179
4180 /* ?underflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGXZ */
4181 /* ?underflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGXZ */
4182 /* ?underflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGXZ */
4183 /* ?underflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGXZ */
4184 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_underflow, 4)
4185 unsigned short __thiscall basic_stringbuf_wchar_underflow(basic_stringbuf_wchar *this)
4186 {
4187     wchar_t *ptr, *cur;
4188
4189     TRACE("(%p)\n", this);
4190
4191     cur = basic_streambuf_wchar_gptr(&this->base);
4192     if(!cur || this->state&STRINGBUF_no_read)
4193         return WEOF;
4194
4195     ptr  = basic_streambuf_wchar_pptr(&this->base);
4196     if(this->seekhigh < ptr)
4197         this->seekhigh = ptr;
4198
4199     ptr = basic_streambuf_wchar_egptr(&this->base);
4200     if(this->seekhigh > ptr)
4201         basic_streambuf_wchar_setg(&this->base, basic_streambuf_wchar_eback(&this->base), cur, this->seekhigh);
4202
4203     if(cur < this->seekhigh)
4204         return *cur;
4205     return WEOF;
4206 }
4207
4208 /* ?seekoff@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
4209 /* ?seekoff@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
4210 /* ?seekoff@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
4211 /* ?seekoff@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
4212 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_seekoff, 24)
4213 fpos_int* __thiscall basic_stringbuf_wchar_seekoff(basic_stringbuf_wchar *this,
4214         fpos_int *ret, streamoff off, int way, int mode)
4215 {
4216     wchar_t *beg, *cur_r, *cur_w;
4217
4218     TRACE("(%p %p %s %d %d)\n", this, ret, wine_dbgstr_longlong(off), way, mode);
4219
4220     cur_w = basic_streambuf_wchar_pptr(&this->base);
4221     if(cur_w > this->seekhigh)
4222         this->seekhigh = cur_w;
4223
4224     ret->off = 0;
4225     ret->state = 0;
4226
4227     beg = basic_streambuf_wchar_eback(&this->base);
4228     cur_r = basic_streambuf_wchar_gptr(&this->base);
4229     if((mode & OPENMODE_in) && cur_r) {
4230         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
4231             off += cur_r-beg;
4232         else if(way == SEEKDIR_end)
4233             off += this->seekhigh-beg;
4234         else if(way != SEEKDIR_beg)
4235             off = -1;
4236
4237         if(off<0 || off>this->seekhigh-beg) {
4238             off = -1;
4239         }else {
4240             basic_streambuf_wchar_gbump(&this->base, beg-cur_r+off);
4241             if((mode & OPENMODE_out) && cur_w) {
4242                 basic_streambuf_wchar_setp_next(&this->base, beg,
4243                         basic_streambuf_wchar_gptr(&this->base),
4244                         basic_streambuf_wchar_epptr(&this->base));
4245             }
4246         }
4247     }else if((mode & OPENMODE_out) && cur_w) {
4248         if(way == SEEKDIR_cur)
4249             off += cur_w-beg;
4250         else if(way == SEEKDIR_end)
4251             off += this->seekhigh-beg;
4252         else if(way != SEEKDIR_beg)
4253             off = -1;
4254
4255         if(off<0 || off>this->seekhigh-beg)
4256             off = -1;
4257         else
4258             basic_streambuf_wchar_pbump(&this->base, beg-cur_w+off);
4259     }else {
4260         off = -1;
4261     }
4262
4263     ret->pos = off;
4264     return ret;
4265 }
4266
4267 /* ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
4268 /* ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
4269 /* ?seekpos@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
4270 /* ?seekpos@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
4271 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_seekpos, 36)
4272 fpos_int* __thiscall basic_stringbuf_wchar_seekpos(basic_stringbuf_wchar *this,
4273         fpos_int *ret, fpos_int pos, int mode)
4274 {
4275     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
4276
4277     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
4278         *ret = pos;
4279         return ret;
4280     }
4281
4282     return basic_stringbuf_wchar_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
4283 }
4284
4285 /* ?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 */
4286 /* ?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 */
4287 /* ?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 */
4288 /* ?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 */
4289 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_str_set, 8)
4290 void __thiscall basic_stringbuf_wchar_str_set(basic_stringbuf_wchar *this, const basic_string_wchar *str)
4291 {
4292     TRACE("(%p %p)\n", this, str);
4293
4294     basic_stringbuf_wchar__Tidy(this);
4295     basic_stringbuf_wchar__Init(this, MSVCP_basic_string_wchar_c_str(str), str->size, this->state);
4296 }
4297
4298 /* ?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 */
4299 /* ?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 */
4300 /* ?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 */
4301 /* ?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 */
4302 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_str_get, 8)
4303 basic_string_wchar* __thiscall basic_stringbuf_wchar_str_get(const basic_stringbuf_wchar *this, basic_string_wchar *ret)
4304 {
4305     wchar_t *ptr;
4306
4307     TRACE("(%p)\n", this);
4308
4309     if(!(this->state & STRINGBUF_no_write) && basic_streambuf_wchar_pptr(&this->base)) {
4310         wchar_t *pptr;
4311
4312         ptr = basic_streambuf_wchar_pbase(&this->base);
4313         pptr = basic_streambuf_wchar_pptr(&this->base);
4314
4315         return MSVCP_basic_string_wchar_ctor_cstr_len(ret, ptr, (this->seekhigh < pptr ? pptr : this->seekhigh) - ptr);
4316     }
4317
4318     if(!(this->state & STRINGBUF_no_read) && basic_streambuf_wchar_gptr(&this->base)) {
4319         ptr = basic_streambuf_wchar_eback(&this->base);
4320         return MSVCP_basic_string_wchar_ctor_cstr_len(ret, ptr, basic_streambuf_wchar_egptr(&this->base) - ptr);
4321     }
4322
4323     return MSVCP_basic_string_wchar_ctor(ret);
4324 }
4325
4326 /* ??0ios_base@std@@IAE@XZ */
4327 /* ??0ios_base@std@@IEAA@XZ */
4328 DEFINE_THISCALL_WRAPPER(ios_base_ctor, 4)
4329 ios_base* __thiscall ios_base_ctor(ios_base *this)
4330 {
4331     TRACE("(%p)\n", this);
4332     this->vtable = &MSVCP_ios_base_vtable;
4333     return this;
4334 }
4335
4336 /* ??0ios_base@std@@QAE@ABV01@@Z */
4337 /* ??0ios_base@std@@QEAA@AEBV01@@Z */
4338 DEFINE_THISCALL_WRAPPER(ios_base_copy_ctor, 8)
4339 ios_base* __thiscall ios_base_copy_ctor(ios_base *this, const ios_base *copy)
4340 {
4341     TRACE("(%p %p)\n", this, copy);
4342     *this = *copy;
4343     this->vtable = &MSVCP_ios_base_vtable;
4344     return this;
4345 }
4346
4347 /* ?_Callfns@ios_base@std@@AAEXW4event@12@@Z */
4348 /* ?_Callfns@ios_base@std@@AEAAXW4event@12@@Z */
4349 DEFINE_THISCALL_WRAPPER(ios_base_Callfns, 8)
4350 void __thiscall ios_base_Callfns(ios_base *this, IOS_BASE_event event)
4351 {
4352     IOS_BASE_fnarray *cur;
4353
4354     TRACE("(%p %x)\n", this, event);
4355
4356     for(cur=this->calls; cur; cur=cur->next)
4357         cur->event_handler(event, this, cur->index);
4358 }
4359
4360 /* ?_Tidy@ios_base@std@@AAAXXZ */
4361 /* ?_Tidy@ios_base@std@@AEAAXXZ */
4362 void CDECL ios_base_Tidy(ios_base *this)
4363 {
4364     IOS_BASE_iosarray *arr_cur, *arr_next;
4365     IOS_BASE_fnarray *event_cur, *event_next;
4366
4367     TRACE("(%p)\n", this);
4368
4369     ios_base_Callfns(this, EVENT_erase_event);
4370
4371     for(arr_cur=this->arr; arr_cur; arr_cur=arr_next) {
4372         arr_next = arr_cur->next;
4373         MSVCRT_operator_delete(arr_cur);
4374     }
4375     this->arr = NULL;
4376
4377     for(event_cur=this->calls; event_cur; event_cur=event_next) {
4378         event_next = event_cur->next;
4379         MSVCRT_operator_delete(event_cur);
4380     }
4381     this->calls = NULL;
4382 }
4383
4384 /* ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z */
4385 /* ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z */
4386 void CDECL ios_base_Ios_base_dtor(ios_base *obj)
4387 {
4388     TRACE("(%p)\n", obj);
4389     if(obj->loc) {
4390         locale_dtor(obj->loc);
4391         MSVCRT_operator_delete(obj->loc);
4392     }
4393     ios_base_Tidy(obj);
4394 }
4395
4396 /* ??1ios_base@std@@UAE@XZ */
4397 /* ??1ios_base@std@@UEAA@XZ */
4398 DEFINE_THISCALL_WRAPPER(ios_base_dtor, 4)
4399 void __thiscall ios_base_dtor(ios_base *this)
4400 {
4401     ios_base_Ios_base_dtor(this);
4402 }
4403
4404 DEFINE_THISCALL_WRAPPER(ios_base_vector_dtor, 8)
4405 ios_base* __thiscall ios_base_vector_dtor(ios_base *this, unsigned int flags)
4406 {
4407     TRACE("(%p %x)\n", this, flags);
4408     if(flags & 2) {
4409         /* we have an array, with the number of elements stored before the first object */
4410         int i, *ptr = (int *)this-1;
4411
4412         for(i=*ptr-1; i>=0; i--)
4413             ios_base_dtor(this+i);
4414         MSVCRT_operator_delete(ptr);
4415     } else {
4416         ios_base_dtor(this);
4417         if(flags & 1)
4418             MSVCRT_operator_delete(this);
4419     }
4420
4421     return this;
4422 }
4423
4424 DEFINE_THISCALL_WRAPPER(iosb_vector_dtor, 8)
4425 void* __thiscall iosb_vector_dtor(void *this, unsigned int flags)
4426 {
4427     TRACE("(%p %x)\n", this, flags);
4428     if(flags & 2) {
4429         int *ptr = (int *)this-1;
4430         MSVCRT_operator_delete(ptr);
4431     } else {
4432         if(flags & 1)
4433             MSVCRT_operator_delete(this);
4434     }
4435
4436     return this;
4437 }
4438
4439 /* ?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z */
4440 /* ?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z */
4441 DEFINE_THISCALL_WRAPPER(ios_base_Findarr, 8)
4442 IOS_BASE_iosarray* __thiscall ios_base_Findarr(ios_base *this, int index)
4443 {
4444     IOS_BASE_iosarray *p;
4445
4446     TRACE("(%p %d)\n", this, index);
4447
4448     for(p=this->arr; p; p=p->next) {
4449         if(p->index == index)
4450             return p;
4451     }
4452
4453     for(p=this->arr; p; p=p->next) {
4454         if(!p->long_val && !p->ptr_val) {
4455             p->index = index;
4456             return p;
4457         }
4458     }
4459
4460     p = MSVCRT_operator_new(sizeof(IOS_BASE_iosarray));
4461     p->next = this->arr;
4462     p->index = index;
4463     p->long_val = 0;
4464     p->ptr_val = NULL;
4465     this->arr = p;
4466     return p;
4467 }
4468
4469 /* ?iword@ios_base@std@@QAEAAJH@Z */
4470 /* ?iword@ios_base@std@@QEAAAEAJH@Z */
4471 DEFINE_THISCALL_WRAPPER(ios_base_iword, 8)
4472 LONG* __thiscall ios_base_iword(ios_base *this, int index)
4473 {
4474     TRACE("(%p %d)\n", this, index);
4475     return &ios_base_Findarr(this, index)->long_val;
4476 }
4477
4478 /* ?pword@ios_base@std@@QAEAAPAXH@Z */
4479 /* ?pword@ios_base@std@@QEAAAEAPEAXH@Z */
4480 DEFINE_THISCALL_WRAPPER(ios_base_pword, 8)
4481 void** __thiscall ios_base_pword(ios_base *this, int index)
4482 {
4483     TRACE("(%p %d)\n", this, index);
4484     return &ios_base_Findarr(this, index)->ptr_val;
4485 }
4486
4487 /* ?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z */
4488 /* ?register_callback@ios_base@std@@QEAAXP6AXW4event@12@AEAV12@H@ZH@Z */
4489 DEFINE_THISCALL_WRAPPER(ios_base_register_callback, 12)
4490 void __thiscall ios_base_register_callback(ios_base *this, IOS_BASE_event_callback callback, int index)
4491 {
4492     IOS_BASE_fnarray *event;
4493
4494     TRACE("(%p %p %d)\n", this, callback, index);
4495
4496     event = MSVCRT_operator_new(sizeof(IOS_BASE_fnarray));
4497     event->next = this->calls;
4498     event->index = index;
4499     event->event_handler = callback;
4500     this->calls = event;
4501 }
4502
4503 /* ?clear@ios_base@std@@QAEXH_N@Z */
4504 /* ?clear@ios_base@std@@QEAAXH_N@Z */
4505 DEFINE_THISCALL_WRAPPER(ios_base_clear_reraise, 12)
4506 void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
4507 {
4508     TRACE("(%p %x %x)\n", this, state, reraise);
4509
4510     this->state = state & IOSTATE_mask;
4511     if(!(this->state & this->except))
4512         return;
4513
4514     if(reraise)
4515         throw_exception(EXCEPTION_RERAISE, NULL);
4516     else if(this->state & this->except & IOSTATE_eofbit)
4517         throw_exception(EXCEPTION_FAILURE, "eofbit is set");
4518     else if(this->state & this->except & IOSTATE_failbit)
4519         throw_exception(EXCEPTION_FAILURE, "failbit is set");
4520     else if(this->state & this->except & IOSTATE_badbit)
4521         throw_exception(EXCEPTION_FAILURE, "badbit is set");
4522     else if(this->state & this->except & IOSTATE__Hardfail)
4523         throw_exception(EXCEPTION_FAILURE, "_Hardfail is set");
4524 }
4525
4526 /* ?clear@ios_base@std@@QAEXH@Z */
4527 /* ?clear@ios_base@std@@QEAAXH@Z */
4528 DEFINE_THISCALL_WRAPPER(ios_base_clear, 8)
4529 void __thiscall ios_base_clear(ios_base *this, IOSB_iostate state)
4530 {
4531     ios_base_clear_reraise(this, state, FALSE);
4532 }
4533
4534 /* ?clear@ios_base@std@@QAEXI@Z */
4535 /* ?clear@ios_base@std@@QEAAXI@Z */
4536 DEFINE_THISCALL_WRAPPER(ios_base_clear_unsigned, 8)
4537 void __thiscall ios_base_clear_unsigned(ios_base *this, unsigned int state)
4538 {
4539     ios_base_clear_reraise(this, (IOSB_iostate)state, FALSE);
4540 }
4541
4542 /* ?exceptions@ios_base@std@@QAEXH@Z */
4543 /* ?exceptions@ios_base@std@@QEAAXH@Z */
4544 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set, 8)
4545 void __thiscall ios_base_exceptions_set(ios_base *this, IOSB_iostate state)
4546 {
4547     TRACE("(%p %x)\n", this, state);
4548     this->except = state & IOSTATE_mask;
4549     ios_base_clear(this, this->state);
4550 }
4551
4552 /* ?exceptions@ios_base@std@@QAEXI@Z */
4553 /* ?exceptions@ios_base@std@@QEAAXI@Z */
4554 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set_unsigned, 8)
4555 void __thiscall ios_base_exceptions_set_unsigned(ios_base *this, unsigned int state)
4556 {
4557     TRACE("(%p %x)\n", this, state);
4558     ios_base_exceptions_set(this, state);
4559 }
4560
4561 /* ?exceptions@ios_base@std@@QBEHXZ */
4562 /* ?exceptions@ios_base@std@@QEBAHXZ */
4563 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_get, 4)
4564 IOSB_iostate __thiscall ios_base_exceptions_get(ios_base *this)
4565 {
4566     TRACE("(%p)\n", this);
4567     return this->except;
4568 }
4569
4570 /* ?copyfmt@ios_base@std@@QAEAAV12@ABV12@@Z */
4571 /* ?copyfmt@ios_base@std@@QEAAAEAV12@AEBV12@@Z */
4572 DEFINE_THISCALL_WRAPPER(ios_base_copyfmt, 8)
4573 ios_base* __thiscall ios_base_copyfmt(ios_base *this, const ios_base *rhs)
4574 {
4575     TRACE("(%p %p)\n", this, rhs);
4576
4577     if(this != rhs) {
4578         IOS_BASE_iosarray *arr_cur;
4579         IOS_BASE_fnarray *event_cur;
4580
4581         ios_base_Tidy(this);
4582
4583         for(arr_cur=rhs->arr; arr_cur; arr_cur=arr_cur->next) {
4584             if(arr_cur->long_val)
4585                 *ios_base_iword(this, arr_cur->index) = arr_cur->long_val;
4586             if(arr_cur->ptr_val)
4587                 *ios_base_pword(this, arr_cur->index) = arr_cur->ptr_val;
4588         }
4589         this->stdstr = rhs->stdstr;
4590         this->fmtfl = rhs->fmtfl;
4591         this->prec = rhs->prec;
4592         this->wide = rhs->wide;
4593         locale_operator_assign(this->loc, rhs->loc);
4594
4595         for(event_cur=rhs->calls; event_cur; event_cur=event_cur->next)
4596             ios_base_register_callback(this, event_cur->event_handler, event_cur->index);
4597
4598         ios_base_Callfns(this, EVENT_copyfmt_event);
4599         ios_base_exceptions_set(this, rhs->except);
4600     }
4601
4602     return this;
4603 }
4604
4605 /* ??4ios_base@std@@QAEAAV01@ABV01@@Z */
4606 /* ??4ios_base@std@@QEAAAEAV01@AEBV01@@Z */
4607 DEFINE_THISCALL_WRAPPER(ios_base_assign, 8)
4608 ios_base* __thiscall ios_base_assign(ios_base *this, const ios_base *right)
4609 {
4610     TRACE("(%p %p)\n", this, right);
4611
4612     if(this != right) {
4613         this->state = right->state;
4614         ios_base_copyfmt(this, right);
4615     }
4616
4617     return this;
4618 }
4619
4620 /* ?fail@ios_base@std@@QBE_NXZ */
4621 /* ?fail@ios_base@std@@QEBA_NXZ */
4622 DEFINE_THISCALL_WRAPPER(ios_base_fail, 4)
4623 MSVCP_bool __thiscall ios_base_fail(const ios_base *this)
4624 {
4625     TRACE("(%p)\n", this);
4626     return (this->state & (IOSTATE_failbit|IOSTATE_badbit)) != 0;
4627 }
4628
4629 /* ??7ios_base@std@@QBE_NXZ */
4630 /* ??7ios_base@std@@QEBA_NXZ */
4631 DEFINE_THISCALL_WRAPPER(ios_base_op_succ, 4)
4632 MSVCP_bool __thiscall ios_base_op_succ(const ios_base *this)
4633 {
4634     TRACE("(%p)\n", this);
4635     return ios_base_fail(this);
4636 }
4637
4638 /* ??Bios_base@std@@QBEPAXXZ */
4639 /* ??Bios_base@std@@QEBAPEAXXZ */
4640 DEFINE_THISCALL_WRAPPER(ios_base_op_fail, 4)
4641 void* __thiscall ios_base_op_fail(const ios_base *this)
4642 {
4643     TRACE("(%p)\n", this);
4644     return ios_base_fail(this) ? NULL : (void*)this;
4645 }
4646
4647 /* ?_Addstd@ios_base@std@@SAXPAV12@@Z */
4648 /* ?_Addstd@ios_base@std@@SAXPEAV12@@Z */
4649 void CDECL ios_base_Addstd(ios_base *add)
4650 {
4651     FIXME("(%p) stub\n", add);
4652 }
4653
4654 /* ?_Index_func@ios_base@std@@CAAAHXZ */
4655 /* ?_Index_func@ios_base@std@@CAAEAHXZ */
4656 int* CDECL ios_base_Index_func(void)
4657 {
4658     TRACE("\n");
4659     return &ios_base_Index;
4660 }
4661
4662 /* ?_Init@ios_base@std@@IAEXXZ */
4663 /* ?_Init@ios_base@std@@IEAAXXZ */
4664 DEFINE_THISCALL_WRAPPER(ios_base_Init, 4)
4665 void __thiscall ios_base_Init(ios_base *this)
4666 {
4667     TRACE("(%p)\n", this);
4668
4669     this->stdstr = 0;
4670     this->state = this->except = IOSTATE_goodbit;
4671     this->fmtfl = FMTFLAG_skipws | FMTFLAG_dec;
4672     this->prec = 6;
4673     this->wide = 0;
4674     this->arr = NULL;
4675     this->calls = NULL;
4676     this->loc = MSVCRT_operator_new(sizeof(locale));
4677     locale_ctor(this->loc);
4678 }
4679
4680 /* ?_Sync_func@ios_base@std@@CAAA_NXZ */
4681 /* ?_Sync_func@ios_base@std@@CAAEA_NXZ */
4682 MSVCP_bool* CDECL ios_base_Sync_func(void)
4683 {
4684     TRACE("\n");
4685     return &ios_base_Sync;
4686 }
4687
4688 /* ?bad@ios_base@std@@QBE_NXZ */
4689 /* ?bad@ios_base@std@@QEBA_NXZ */
4690 DEFINE_THISCALL_WRAPPER(ios_base_bad, 4)
4691 MSVCP_bool __thiscall ios_base_bad(const ios_base *this)
4692 {
4693     TRACE("(%p)\n", this);
4694     return (this->state & IOSTATE_badbit) != 0;
4695 }
4696
4697 /* ?eof@ios_base@std@@QBE_NXZ */
4698 /* ?eof@ios_base@std@@QEBA_NXZ */
4699 DEFINE_THISCALL_WRAPPER(ios_base_eof, 4)
4700 MSVCP_bool __thiscall ios_base_eof(const ios_base *this)
4701 {
4702     TRACE("(%p)\n", this);
4703     return (this->state & IOSTATE_eofbit) != 0;
4704 }
4705
4706 /* ?flags@ios_base@std@@QAEHH@Z */
4707 /* ?flags@ios_base@std@@QEAAHH@Z */
4708 DEFINE_THISCALL_WRAPPER(ios_base_flags_set, 8)
4709 IOSB_fmtflags __thiscall ios_base_flags_set(ios_base *this, IOSB_fmtflags flags)
4710 {
4711     IOSB_fmtflags ret = this->fmtfl;
4712
4713     TRACE("(%p %x)\n", this, flags);
4714
4715     this->fmtfl = flags & FMTFLAG_mask;
4716     return ret;
4717 }
4718
4719 /* ?flags@ios_base@std@@QBEHXZ */
4720 /* ?flags@ios_base@std@@QEBAHXZ */
4721 DEFINE_THISCALL_WRAPPER(ios_base_flags_get, 4)
4722 IOSB_fmtflags __thiscall ios_base_flags_get(const ios_base *this)
4723 {
4724     TRACE("(%p)\n", this);
4725     return this->fmtfl;
4726 }
4727
4728 /* ?getloc@ios_base@std@@QBE?AVlocale@2@XZ */
4729 /* ?getloc@ios_base@std@@QEBA?AVlocale@2@XZ */
4730 DEFINE_THISCALL_WRAPPER(ios_base_getloc, 8)
4731 locale* __thiscall ios_base_getloc(const ios_base *this, locale *ret)
4732 {
4733     TRACE("(%p)\n", this);
4734     return locale_copy_ctor(ret, this->loc);
4735 }
4736
4737 /* ?good@ios_base@std@@QBE_NXZ */
4738 /* ?good@ios_base@std@@QEBA_NXZ */
4739 DEFINE_THISCALL_WRAPPER(ios_base_good, 4)
4740 MSVCP_bool __thiscall ios_base_good(const ios_base *this)
4741 {
4742     TRACE("(%p)\n", this);
4743     return this->state == IOSTATE_goodbit;
4744 }
4745
4746 /* ?imbue@ios_base@std@@QAE?AVlocale@2@ABV32@@Z */
4747 /* ?imbue@ios_base@std@@QEAA?AVlocale@2@AEBV32@@Z */
4748 DEFINE_THISCALL_WRAPPER(ios_base_imbue, 12)
4749 locale* __thiscall ios_base_imbue(ios_base *this, locale *ret, const locale *loc)
4750 {
4751     TRACE("(%p %p)\n", this, loc);
4752     *ret = *this->loc;
4753     locale_copy_ctor(this->loc, loc);
4754     return ret;
4755 }
4756
4757 /* ?precision@ios_base@std@@QAEHH@Z */
4758 /* ?precision@ios_base@std@@QEAA_J_J@Z */
4759 DEFINE_THISCALL_WRAPPER(ios_base_precision_set, 12)
4760 streamsize __thiscall ios_base_precision_set(ios_base *this, streamsize precision)
4761 {
4762     streamsize ret = this->prec;
4763
4764     TRACE("(%p %s)\n", this, wine_dbgstr_longlong(precision));
4765
4766     this->prec = precision;
4767     return ret;
4768 }
4769
4770 /* ?precision@ios_base@std@@QBEHXZ */
4771 /* ?precision@ios_base@std@@QEBA_JXZ */
4772 DEFINE_THISCALL_WRAPPER(ios_base_precision_get, 4)
4773 streamsize __thiscall ios_base_precision_get(const ios_base *this)
4774 {
4775     TRACE("(%p)\n", this);
4776     return this->prec;
4777 }
4778
4779 /* ?rdstate@ios_base@std@@QBEHXZ */
4780 /* ?rdstate@ios_base@std@@QEBAHXZ */
4781 DEFINE_THISCALL_WRAPPER(ios_base_rdstate, 4)
4782 IOSB_iostate __thiscall ios_base_rdstate(const ios_base *this)
4783 {
4784     TRACE("(%p)\n", this);
4785     return this->state;
4786 }
4787
4788 /* ?setf@ios_base@std@@QAEHHH@Z */
4789 /* ?setf@ios_base@std@@QEAAHHH@Z */
4790 DEFINE_THISCALL_WRAPPER(ios_base_setf_mask, 12)
4791 IOSB_fmtflags __thiscall ios_base_setf_mask(ios_base *this, IOSB_fmtflags flags, IOSB_fmtflags mask)
4792 {
4793     IOSB_fmtflags ret = this->fmtfl;
4794
4795     TRACE("(%p %x %x)\n", this, flags, mask);
4796
4797     this->fmtfl = (this->fmtfl & (~mask)) | (flags & mask & FMTFLAG_mask);
4798     return ret;
4799 }
4800
4801 /* ?setf@ios_base@std@@QAEHH@Z */
4802 /* ?setf@ios_base@std@@QEAAHH@Z */
4803 DEFINE_THISCALL_WRAPPER(ios_base_setf, 8)
4804 IOSB_fmtflags __thiscall ios_base_setf(ios_base *this, IOSB_fmtflags flags)
4805 {
4806     return ios_base_setf_mask(this, flags, ~0);
4807 }
4808
4809 /* ?setstate@ios_base@std@@QAEXH_N@Z */
4810 /* ?setstate@ios_base@std@@QEAAXH_N@Z */
4811 DEFINE_THISCALL_WRAPPER(ios_base_setstate_reraise, 12)
4812 void __thiscall ios_base_setstate_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
4813 {
4814     TRACE("(%p %x %x)\n", this, state, reraise);
4815
4816     if(state != IOSTATE_goodbit)
4817         ios_base_clear_reraise(this, this->state | state, reraise);
4818 }
4819
4820 /* ?setstate@ios_base@std@@QAEXH@Z */
4821 /* ?setstate@ios_base@std@@QEAAXH@Z */
4822 DEFINE_THISCALL_WRAPPER(ios_base_setstate, 8)
4823 void __thiscall ios_base_setstate(ios_base *this, IOSB_iostate state)
4824 {
4825     ios_base_setstate_reraise(this, state, FALSE);
4826 }
4827
4828 /* ?setstate@ios_base@std@@QAEXI@Z */
4829 /* ?setstate@ios_base@std@@QEAAXI@Z */
4830 DEFINE_THISCALL_WRAPPER(ios_base_setstate_unsigned, 8)
4831 void __thiscall ios_base_setstate_unsigned(ios_base *this, unsigned int state)
4832 {
4833     ios_base_setstate_reraise(this, (IOSB_iostate)state, FALSE);
4834 }
4835
4836 /* ?sync_with_stdio@ios_base@std@@SA_N_N@Z */
4837 MSVCP_bool CDECL ios_base_sync_with_stdio(MSVCP_bool sync)
4838 {
4839     _Lockit lock;
4840     MSVCP_bool ret;
4841
4842     TRACE("(%x)\n", sync);
4843
4844     _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
4845     ret = ios_base_Sync;
4846     ios_base_Sync = sync;
4847     _Lockit_dtor(&lock);
4848     return ret;
4849 }
4850
4851 /* ?unsetf@ios_base@std@@QAEXH@Z */
4852 /* ?unsetf@ios_base@std@@QEAAXH@Z */
4853 DEFINE_THISCALL_WRAPPER(ios_base_unsetf, 8)
4854 void __thiscall ios_base_unsetf(ios_base *this, IOSB_fmtflags flags)
4855 {
4856     TRACE("(%p %x)\n", this, flags);
4857     this->fmtfl &= ~flags;
4858 }
4859
4860 /* ?width@ios_base@std@@QAEHH@Z */
4861 /* ?width@ios_base@std@@QEAA_J_J@Z */
4862 DEFINE_THISCALL_WRAPPER(ios_base_width_set, 12)
4863 streamsize __thiscall ios_base_width_set(ios_base *this, streamsize width)
4864 {
4865     streamsize ret = this->wide;
4866
4867     TRACE("(%p %s)\n", this, wine_dbgstr_longlong(width));
4868
4869     this->wide = width;
4870     return ret;
4871 }
4872
4873 /* ?width@ios_base@std@@QBEHXZ */
4874 /* ?width@ios_base@std@@QEBA_JXZ */
4875 DEFINE_THISCALL_WRAPPER(ios_base_width_get, 4)
4876 streamsize __thiscall ios_base_width_get(ios_base *this)
4877 {
4878     TRACE("(%p)\n", this);
4879     return this->wide;
4880 }
4881
4882 /* ?xalloc@ios_base@std@@SAHXZ */
4883 int CDECL ios_base_xalloc(void)
4884 {
4885     _Lockit lock;
4886     int ret;
4887
4888     TRACE("\n");
4889
4890     _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
4891     ret = ios_base_Index++;
4892     _Lockit_dtor(&lock);
4893     return ret;
4894 }
4895
4896 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ */
4897 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IEAA@XZ */
4898 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor, 4)
4899 basic_ios_char* __thiscall basic_ios_char_ctor(basic_ios_char *this)
4900 {
4901     TRACE("(%p)\n", this);
4902
4903     ios_base_ctor(&this->base);
4904     this->base.vtable = &MSVCP_basic_ios_char_vtable;
4905     return this;
4906 }
4907
4908 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IAEXPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
4909 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
4910 DEFINE_THISCALL_WRAPPER(basic_ios_char_init, 12)
4911 void __thiscall basic_ios_char_init(basic_ios_char *this, basic_streambuf_char *streambuf, MSVCP_bool isstd)
4912 {
4913     TRACE("(%p %p %x)\n", this, streambuf, isstd);
4914     ios_base_Init(&this->base);
4915     this->strbuf = streambuf;
4916     this->stream = NULL;
4917     this->fillch = ' ';
4918
4919     if(!streambuf)
4920         ios_base_setstate(&this->base, IOSTATE_badbit);
4921
4922     if(isstd)
4923         FIXME("standard streams not handled yet\n");
4924 }
4925
4926 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4927 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4928 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor_streambuf, 8)
4929 basic_ios_char* __thiscall basic_ios_char_ctor_streambuf(basic_ios_char *this, basic_streambuf_char *strbuf)
4930 {
4931     TRACE("(%p %p)\n", this, strbuf);
4932
4933     basic_ios_char_ctor(this);
4934     basic_ios_char_init(this, strbuf, FALSE);
4935     return this;
4936 }
4937
4938 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ */
4939 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ */
4940 DEFINE_THISCALL_WRAPPER(basic_ios_char_dtor, 4)
4941 void __thiscall basic_ios_char_dtor(basic_ios_char *this)
4942 {
4943     TRACE("(%p)\n", this);
4944     ios_base_dtor(&this->base);
4945 }
4946
4947 DEFINE_THISCALL_WRAPPER(basic_ios_char_vector_dtor, 8)
4948 basic_ios_char* __thiscall basic_ios_char_vector_dtor(basic_ios_char *this, unsigned int flags)
4949 {
4950     TRACE("(%p %x)\n", this, flags);
4951     if(flags & 2) {
4952         /* we have an array, with the number of elements stored before the first object */
4953         int i, *ptr = (int *)this-1;
4954
4955         for(i=*ptr-1; i>=0; i--)
4956             basic_ios_char_dtor(this+i);
4957         MSVCRT_operator_delete(ptr);
4958     } else {
4959         basic_ios_char_dtor(this);
4960         if(flags & 1)
4961             MSVCRT_operator_delete(this);
4962     }
4963
4964     return this;
4965 }
4966
4967 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
4968 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
4969 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear_reraise, 12)
4970 void __thiscall basic_ios_char_clear_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
4971 {
4972     TRACE("(%p %x %x)\n", this, state, reraise);
4973     ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
4974 }
4975
4976 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
4977 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
4978 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear, 8)
4979 void __thiscall basic_ios_char_clear(basic_ios_char *this, unsigned int state)
4980 {
4981     basic_ios_char_clear_reraise(this, (IOSB_iostate)state, FALSE);
4982 }
4983
4984 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEAAV12@ABV12@@Z */
4985 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEBV12@@Z */
4986 DEFINE_THISCALL_WRAPPER(basic_ios_char_copyfmt, 8)
4987 basic_ios_char* __thiscall basic_ios_char_copyfmt(basic_ios_char *this, basic_ios_char *copy)
4988 {
4989     TRACE("(%p %p)\n", this, copy);
4990     if(this == copy)
4991         return this;
4992
4993     this->stream = copy->stream;
4994     this->fillch = copy->fillch;
4995     ios_base_copyfmt(&this->base, &copy->base);
4996     return this;
4997 }
4998
4999 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEDD@Z */
5000 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAADD@Z */
5001 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_set, 8)
5002 char __thiscall basic_ios_char_fill_set(basic_ios_char *this, char fill)
5003 {
5004     char ret = this->fillch;
5005
5006     TRACE("(%p %c)\n", this, fill);
5007
5008     this->fillch = fill;
5009     return ret;
5010 }
5011
5012 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ */
5013 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADXZ */
5014 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_get, 4)
5015 char __thiscall basic_ios_char_fill_get(basic_ios_char *this)
5016 {
5017     TRACE("(%p)\n", this);
5018     return this->fillch;
5019 }
5020
5021 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5022 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5023 DEFINE_THISCALL_WRAPPER(basic_ios_char_imbue, 12)
5024 locale *__thiscall basic_ios_char_imbue(basic_ios_char *this, locale *ret, const locale *loc)
5025 {
5026     TRACE("(%p %p %p)\n", this, ret, loc);
5027
5028     if(this->strbuf) {
5029         basic_streambuf_char_pubimbue(this->strbuf, ret, loc);
5030         locale_dtor(ret);
5031     }
5032
5033     return ios_base_imbue(&this->base, ret, loc);
5034 }
5035
5036 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDDD@Z */
5037 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADDD@Z */
5038 DEFINE_THISCALL_WRAPPER(basic_ios_char_narrow, 12)
5039 char __thiscall basic_ios_char_narrow(basic_ios_char *this, char ch, char def)
5040 {
5041     TRACE("(%p %c %c)\n", this, ch, def);
5042     return ctype_char_narrow_ch(ctype_char_use_facet(this->strbuf->loc), ch, def);
5043 }
5044
5045 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PAV32@@Z */
5046 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAV32@@Z */
5047 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_set, 8)
5048 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_set(basic_ios_char *this, basic_streambuf_char *streambuf)
5049 {
5050     basic_streambuf_char *ret = this->strbuf;
5051
5052     TRACE("(%p %p)\n", this, streambuf);
5053
5054     this->strbuf = streambuf;
5055     basic_ios_char_clear(this, IOSTATE_goodbit);
5056     return ret;
5057 }
5058
5059 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
5060 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
5061 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_get, 4)
5062 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_get(const basic_ios_char *this)
5063 {
5064     TRACE("(%p)\n", this);
5065     return this->strbuf;
5066 }
5067
5068 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
5069 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
5070 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate_reraise, 12)
5071 void __thiscall basic_ios_char_setstate_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
5072 {
5073     TRACE("(%p %x %x)\n", this, state, reraise);
5074
5075     if(state != IOSTATE_goodbit)
5076         basic_ios_char_clear_reraise(this, this->base.state | state, reraise);
5077 }
5078
5079 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
5080 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
5081 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate, 8)
5082 void __thiscall basic_ios_char_setstate(basic_ios_char *this, unsigned int state)
5083 {
5084     basic_ios_char_setstate_reraise(this, (IOSB_iostate)state, FALSE);
5085 }
5086
5087 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@PAV32@@Z */
5088 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@PEAV32@@Z */
5089 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_set, 8)
5090 basic_ostream_char* __thiscall basic_ios_char_tie_set(basic_ios_char *this, basic_ostream_char *ostream)
5091 {
5092     basic_ostream_char *ret = this->stream;
5093
5094     TRACE("(%p %p)\n", this, ostream);
5095
5096     this->stream = ostream;
5097     return ret;
5098 }
5099
5100 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
5101 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
5102 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_get, 4)
5103 basic_ostream_char* __thiscall basic_ios_char_tie_get(const basic_ios_char *this)
5104 {
5105     TRACE("(%p)\n", this);
5106     return this->stream;
5107 }
5108
5109 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDD@Z */
5110 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADD@Z */
5111 DEFINE_THISCALL_WRAPPER(basic_ios_char_widen, 8)
5112 char __thiscall basic_ios_char_widen(basic_ios_char *this, char ch)
5113 {
5114     TRACE("(%p %c)\n", this, ch);
5115     return ctype_char_widen_ch(ctype_char_use_facet(this->strbuf->loc), ch);
5116 }
5117
5118
5119 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
5120 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
5121 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor, 4)
5122 basic_ios_wchar* __thiscall basic_ios_wchar_ctor(basic_ios_wchar *this)
5123 {
5124     TRACE("(%p)\n", this);
5125
5126     ios_base_ctor(&this->base);
5127     this->base.vtable = &MSVCP_basic_ios_wchar_vtable;
5128     return this;
5129 }
5130
5131 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IAE@XZ */
5132 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IEAA@XZ */
5133 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor, 4)
5134 basic_ios_wchar* __thiscall basic_ios_short_ctor(basic_ios_wchar *this)
5135 {
5136     basic_ios_wchar_ctor(this);
5137     this->base.vtable = &MSVCP_basic_ios_short_vtable;
5138     return this;
5139 }
5140
5141 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
5142 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
5143 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IAEXPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
5144 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
5145 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_init, 12)
5146 void __thiscall basic_ios_wchar_init(basic_ios_wchar *this, basic_streambuf_wchar *streambuf, MSVCP_bool isstd)
5147 {
5148     TRACE("(%p %p %x)\n", this, streambuf, isstd);
5149     ios_base_Init(&this->base);
5150     this->strbuf = streambuf;
5151     this->stream = NULL;
5152     this->fillch = ' ';
5153
5154     if(!streambuf)
5155         ios_base_setstate(&this->base, IOSTATE_badbit);
5156
5157     if(isstd)
5158         FIXME("standard streams not handled yet\n");
5159 }
5160
5161 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5162 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5163 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor_streambuf, 8)
5164 basic_ios_wchar* __thiscall basic_ios_wchar_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
5165 {
5166     TRACE("(%p %p)\n", this, strbuf);
5167
5168     basic_ios_wchar_ctor(this);
5169     basic_ios_wchar_init(this, strbuf, FALSE);
5170     return this;
5171 }
5172
5173 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5174 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5175 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor_streambuf, 8)
5176 basic_ios_wchar* __thiscall basic_ios_short_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
5177 {
5178     basic_ios_wchar_ctor_streambuf(this, strbuf);
5179     this->base.vtable = &MSVCP_basic_ios_short_vtable;
5180     return this;
5181 }
5182
5183 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
5184 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
5185 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UAE@XZ */
5186 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UEAA@XZ */
5187 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_dtor, 4)
5188 void __thiscall basic_ios_wchar_dtor(basic_ios_wchar *this)
5189 {
5190     TRACE("(%p)\n", this);
5191     ios_base_dtor(&this->base);
5192 }
5193
5194 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_vector_dtor, 8)
5195 basic_ios_wchar* __thiscall basic_ios_wchar_vector_dtor(basic_ios_wchar *this, unsigned int flags)
5196 {
5197     TRACE("(%p %x)\n", this, flags);
5198     if(flags & 2) {
5199         /* we have an array, with the number of elements stored before the first object */
5200         int i, *ptr = (int *)this-1;
5201
5202         for(i=*ptr-1; i>=0; i--)
5203             basic_ios_wchar_dtor(this+i);
5204         MSVCRT_operator_delete(ptr);
5205     } else {
5206         basic_ios_wchar_dtor(this);
5207         if(flags & 1)
5208             MSVCRT_operator_delete(this);
5209     }
5210
5211     return this;
5212 }
5213
5214 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
5215 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
5216 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
5217 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
5218 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear_reraise, 12)
5219 void __thiscall basic_ios_wchar_clear_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
5220 {
5221     TRACE("(%p %x %x)\n", this, state, reraise);
5222     ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
5223 }
5224
5225 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
5226 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
5227 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
5228 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
5229 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear, 8)
5230 void __thiscall basic_ios_wchar_clear(basic_ios_wchar *this, unsigned int state)
5231 {
5232     basic_ios_wchar_clear_reraise(this, (IOSB_iostate)state, FALSE);
5233 }
5234
5235 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEAAV12@ABV12@@Z */
5236 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEBV12@@Z */
5237 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEAAV12@ABV12@@Z */
5238 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEBV12@@Z */
5239 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_copyfmt, 8)
5240 basic_ios_wchar* __thiscall basic_ios_wchar_copyfmt(basic_ios_wchar *this, basic_ios_wchar *copy)
5241 {
5242     TRACE("(%p %p)\n", this, copy);
5243     if(this == copy)
5244         return this;
5245
5246     this->stream = copy->stream;
5247     this->fillch = copy->fillch;
5248     ios_base_copyfmt(&this->base, &copy->base);
5249     return this;
5250 }
5251
5252 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE_W_W@Z */
5253 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA_W_W@Z */
5254 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEGG@Z */
5255 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
5256 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_set, 8)
5257 wchar_t __thiscall basic_ios_wchar_fill_set(basic_ios_wchar *this, wchar_t fill)
5258 {
5259     wchar_t ret = this->fillch;
5260
5261     TRACE("(%p %c)\n", this, fill);
5262
5263     this->fillch = fill;
5264     return ret;
5265 }
5266
5267 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WXZ */
5268 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WXZ */
5269 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGXZ */
5270 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGXZ */
5271 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_get, 4)
5272 wchar_t __thiscall basic_ios_wchar_fill_get(basic_ios_wchar *this)
5273 {
5274     TRACE("(%p)\n", this);
5275     return this->fillch;
5276 }
5277
5278 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5279 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5280 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5281 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5282 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_imbue, 12)
5283 locale *__thiscall basic_ios_wchar_imbue(basic_ios_wchar *this, locale *ret, const locale *loc)
5284 {
5285     TRACE("(%p %p %p)\n", this, ret, loc);
5286
5287     if(this->strbuf)
5288         return basic_streambuf_wchar_pubimbue(this->strbuf, ret, loc);
5289
5290     locale_copy_ctor(ret, loc);
5291     return ret;
5292 }
5293
5294 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBED_WD@Z */
5295 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAD_WD@Z */
5296 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEDGD@Z */
5297 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBADGD@Z */
5298 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_narrow, 12)
5299 char __thiscall basic_ios_wchar_narrow(basic_ios_wchar *this, wchar_t ch, char def)
5300 {
5301     TRACE("(%p %c %c)\n", this, ch, def);
5302     return ctype_wchar_narrow_ch(ctype_wchar_use_facet(this->strbuf->loc), ch, def);
5303 }
5304
5305 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
5306 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
5307 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAV32@@Z */
5308 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAV32@@Z */
5309 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_set, 8)
5310 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_set(basic_ios_wchar *this, basic_streambuf_wchar *streambuf)
5311 {
5312     basic_streambuf_wchar *ret = this->strbuf;
5313
5314     TRACE("(%p %p)\n", this, streambuf);
5315
5316     this->strbuf = streambuf;
5317     basic_ios_wchar_clear(this, IOSTATE_goodbit);
5318     return ret;
5319 }
5320
5321 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
5322 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
5323 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
5324 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
5325 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_get, 4)
5326 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_get(const basic_ios_wchar *this)
5327 {
5328     TRACE("(%p)\n", this);
5329     return this->strbuf;
5330 }
5331
5332 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
5333 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
5334 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
5335 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
5336 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate_reraise, 12)
5337 void __thiscall basic_ios_wchar_setstate_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
5338 {
5339     TRACE("(%p %x %x)\n", this, state, reraise);
5340
5341     if(state != IOSTATE_goodbit)
5342         basic_ios_wchar_clear_reraise(this, this->base.state | state, reraise);
5343 }
5344
5345 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
5346 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
5347 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
5348 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
5349 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate, 8)
5350 void __thiscall basic_ios_wchar_setstate(basic_ios_wchar *this, IOSB_iostate state)
5351 {
5352     basic_ios_wchar_setstate_reraise(this, state, FALSE);
5353 }
5354
5355 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
5356 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
5357 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@PAV32@@Z */
5358 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@PEAV32@@Z */
5359 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_set, 8)
5360 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_set(basic_ios_wchar *this, basic_ostream_wchar *ostream)
5361 {
5362     basic_ostream_wchar *ret = this->stream;
5363
5364     TRACE("(%p %p)\n", this, ostream);
5365
5366     this->stream = ostream;
5367     return ret;
5368 }
5369
5370 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
5371 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
5372 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
5373 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
5374 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_get, 4)
5375 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_get(const basic_ios_wchar *this)
5376 {
5377     TRACE("(%p)\n", this);
5378     return this->stream;
5379 }
5380
5381 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WD@Z */
5382 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WD@Z */
5383 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGD@Z */
5384 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGD@Z */
5385 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_widen, 8)
5386 wchar_t __thiscall basic_ios_wchar_widen(basic_ios_wchar *this, char ch)
5387 {
5388     TRACE("(%p %c)\n", this, ch);
5389     return ctype_wchar_widen_ch(ctype_wchar_use_facet(this->strbuf->loc), ch);
5390 }
5391
5392 /* Caution: basic_ostream uses virtual inheritance.
5393  * All constructors have additional parameter that says if base class should be initialized.
5394  * Base class needs to be accessed using vbtable.
5395  */
5396 static inline basic_ios_char* basic_ostream_char_get_basic_ios(basic_ostream_char *this)
5397 {
5398     return (basic_ios_char*)((char*)this+this->vbtable[1]);
5399 }
5400
5401 static inline basic_ios_char* basic_ostream_char_to_basic_ios(basic_ostream_char *ptr)
5402 {
5403     return (basic_ios_char*)((char*)ptr+basic_ostream_char_vbtable[1]);
5404 }
5405
5406 static inline basic_ostream_char* basic_ostream_char_from_basic_ios(basic_ios_char *ptr)
5407 {
5408     return (basic_ostream_char*)((char*)ptr-basic_ostream_char_vbtable[1]);
5409 }
5410
5411 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5412 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5413 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor, 16)
5414 basic_ostream_char* __thiscall basic_ostream_char_ctor(basic_ostream_char *this,
5415         basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
5416 {
5417     basic_ios_char *base;
5418
5419     TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
5420
5421     if(virt_init) {
5422         this->vbtable = basic_ostream_char_vbtable;
5423         base = basic_ostream_char_get_basic_ios(this);
5424         basic_ios_char_ctor(base);
5425     }else {
5426         base = basic_ostream_char_get_basic_ios(this);
5427     }
5428
5429     base->base.vtable = &MSVCP_basic_ostream_char_vtable;
5430     basic_ios_char_init(base, strbuf, isstd);
5431     return this;
5432 }
5433
5434 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
5435 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
5436 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor_uninitialized, 16)
5437 basic_ostream_char* __thiscall basic_ostream_char_ctor_uninitialized(basic_ostream_char *this,
5438         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
5439 {
5440     basic_ios_char *base;
5441
5442     TRACE("(%p %d %x)\n", this, uninitialized, addstd);
5443
5444     if(virt_init) {
5445         this->vbtable = basic_ostream_char_vbtable;
5446         base = basic_ostream_char_get_basic_ios(this);
5447         basic_ios_char_ctor(base);
5448     }else {
5449         base = basic_ostream_char_get_basic_ios(this);
5450     }
5451
5452     base->base.vtable = &MSVCP_basic_ostream_char_vtable;
5453     if(addstd)
5454         ios_base_Addstd(&base->base);
5455     return this;
5456 }
5457
5458 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
5459 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
5460 DEFINE_THISCALL_WRAPPER(basic_ostream_char_dtor, 4)
5461 void __thiscall basic_ostream_char_dtor(basic_ios_char *base)
5462 {
5463     basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
5464
5465     /* don't destroy virtual base here */
5466     TRACE("(%p)\n", this);
5467 }
5468
5469 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5470 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5471 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vbase_dtor, 4)
5472 void __thiscall basic_ostream_char_vbase_dtor(basic_ostream_char *this)
5473 {
5474     TRACE("(%p)\n", this);
5475     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(this));
5476     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(this));
5477 }
5478
5479 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vector_dtor, 8)
5480 basic_ostream_char* __thiscall basic_ostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
5481 {
5482     basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
5483
5484     TRACE("(%p %x)\n", this, flags);
5485
5486     if(flags & 2) {
5487         /* we have an array, with the number of elements stored before the first object */
5488         int i, *ptr = (int *)this-1;
5489
5490         for(i=*ptr-1; i>=0; i--)
5491             basic_ostream_char_vbase_dtor(this+i);
5492         MSVCRT_operator_delete(ptr);
5493     } else {
5494         basic_ostream_char_vbase_dtor(this);
5495         if(flags & 1)
5496             MSVCRT_operator_delete(this);
5497     }
5498
5499     return this;
5500 }
5501
5502 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
5503 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
5504 DEFINE_THISCALL_WRAPPER(basic_ostream_char_flush, 4)
5505 basic_ostream_char* __thiscall basic_ostream_char_flush(basic_ostream_char *this)
5506 {
5507     /* this function is not matching C++ specification */
5508     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5509
5510     TRACE("(%p)\n", this);
5511
5512     if(basic_ios_char_rdbuf_get(base) && ios_base_good(&base->base)
5513             && basic_streambuf_char_pubsync(basic_ios_char_rdbuf_get(base))==-1)
5514         basic_ios_char_setstate(base, IOSTATE_badbit);
5515     return this;
5516 }
5517
5518 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5519 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5520 DEFINE_THISCALL_WRAPPER(basic_ostream_char__Osfx, 4)
5521 void __thiscall basic_ostream_char__Osfx(basic_ostream_char *this)
5522 {
5523     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5524
5525     TRACE("(%p)\n", this);
5526
5527     if(base->base.fmtfl & FMTFLAG_unitbuf)
5528         basic_ostream_char_flush(this);
5529 }
5530
5531 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5532 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5533 DEFINE_THISCALL_WRAPPER(basic_ostream_char_osfx, 4)
5534 void __thiscall basic_ostream_char_osfx(basic_ostream_char *this)
5535 {
5536     TRACE("(%p)\n", this);
5537     basic_ostream_char__Osfx(this);
5538 }
5539
5540 static BOOL basic_ostream_char_sentry_create(basic_ostream_char *ostr)
5541 {
5542     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5543
5544     if(basic_ios_char_rdbuf_get(base))
5545         call_basic_streambuf_char__Lock(base->strbuf);
5546
5547     if(ios_base_good(&base->base) && base->stream)
5548         basic_ostream_char_flush(base->stream);
5549
5550     return ios_base_good(&base->base);
5551 }
5552
5553 static void basic_ostream_char_sentry_destroy(basic_ostream_char *ostr)
5554 {
5555     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5556
5557     if(ios_base_good(&base->base) && !__uncaught_exception())
5558         basic_ostream_char_osfx(ostr);
5559
5560     if(basic_ios_char_rdbuf_get(base))
5561         call_basic_streambuf_char__Unlock(base->strbuf);
5562 }
5563
5564 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE_NXZ */
5565 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA_NXZ */
5566 DEFINE_THISCALL_WRAPPER(basic_ostream_char_opfx, 4)
5567 MSVCP_bool __thiscall basic_ostream_char_opfx(basic_ostream_char *this)
5568 {
5569     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5570
5571     TRACE("(%p)\n", this);
5572
5573     if(ios_base_good(&base->base) && base->stream)
5574         basic_ostream_char_flush(base->stream);
5575     return ios_base_good(&base->base);
5576 }
5577
5578 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
5579 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
5580 DEFINE_THISCALL_WRAPPER(basic_ostream_char_put, 8)
5581 basic_ostream_char* __thiscall basic_ostream_char_put(basic_ostream_char *this, char ch)
5582 {
5583     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5584
5585     TRACE("(%p %c)\n", this, ch);
5586
5587     if(!basic_ostream_char_sentry_create(this)
5588             || basic_streambuf_char_sputc(base->strbuf, ch)==EOF) {
5589         basic_ostream_char_sentry_destroy(this);
5590         basic_ios_char_setstate(base, IOSTATE_badbit);
5591         return this;
5592     }
5593
5594     basic_ostream_char_sentry_destroy(this);
5595     return this;
5596 }
5597
5598 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
5599 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
5600 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp, 16)
5601 basic_ostream_char* __thiscall basic_ostream_char_seekp(basic_ostream_char *this, streamoff off, int way)
5602 {
5603     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5604
5605     TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), way);
5606
5607     if(!ios_base_fail(&base->base)) {
5608         fpos_int seek;
5609
5610         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
5611                 &seek, off, way, OPENMODE_out);
5612         if(seek.off==0 && seek.pos==-1 && seek.state==0)
5613             basic_ios_char_setstate(base, IOSTATE_failbit);
5614     }
5615     return this;
5616 }
5617
5618 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
5619 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
5620 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp_fpos, 28)
5621 basic_ostream_char* __thiscall basic_ostream_char_seekp_fpos(basic_ostream_char *this, fpos_int pos)
5622 {
5623     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5624
5625     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
5626
5627     if(!ios_base_fail(&base->base)) {
5628         fpos_int seek;
5629
5630         basic_streambuf_char_pubseekpos(basic_ios_char_rdbuf_get(base),
5631                 &seek, pos, OPENMODE_out);
5632         if(seek.off==0 && seek.pos==-1 && seek.state==0)
5633             basic_ios_char_setstate(base, IOSTATE_failbit);
5634     }
5635     return this;
5636 }
5637
5638 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
5639 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
5640 DEFINE_THISCALL_WRAPPER(basic_ostream_char_tellp, 8)
5641 fpos_int* __thiscall basic_ostream_char_tellp(basic_ostream_char *this, fpos_int *ret)
5642 {
5643     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5644
5645     TRACE("(%p)\n", this);
5646
5647     if(!ios_base_fail(&base->base)) {
5648         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
5649                 ret, 0, SEEKDIR_cur, OPENMODE_out);
5650     }else {
5651         ret->off = 0;
5652         ret->pos = -1;
5653         ret->state = 0;
5654     }
5655     return ret;
5656 }
5657
5658 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@PBDH@Z */
5659 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEBD_J@Z */
5660 DEFINE_THISCALL_WRAPPER(basic_ostream_char_write, 16)
5661 basic_ostream_char* __thiscall basic_ostream_char_write(basic_ostream_char *this, const char *str, streamsize count)
5662 {
5663     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5664
5665     TRACE("(%p %s %s)\n", this, debugstr_a(str), wine_dbgstr_longlong(count));
5666
5667     if(!basic_ostream_char_sentry_create(this)
5668             || basic_streambuf_char_sputn(base->strbuf, str, count)!=count) {
5669         basic_ostream_char_sentry_destroy(this);
5670         basic_ios_char_setstate(base, IOSTATE_badbit);
5671         return this;
5672     }
5673
5674     basic_ostream_char_sentry_destroy(this);
5675     return this;
5676 }
5677
5678 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@F@Z */
5679 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@F@Z */
5680 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_short, 8)
5681 basic_ostream_char* __thiscall basic_ostream_char_print_short(basic_ostream_char *this, short val)
5682 {
5683     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5684     int state = IOSTATE_goodbit;
5685
5686     TRACE("(%p %d)\n", this, val);
5687
5688     if(basic_ostream_char_sentry_create(this)) {
5689         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5690         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5691         ostreambuf_iterator_char dest = {0, strbuf};
5692
5693         num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base),
5694                 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
5695                 ? (LONG)((unsigned short)val) : (LONG)val);
5696     }
5697     basic_ostream_char_sentry_destroy(this);
5698
5699     basic_ios_char_setstate(base, state);
5700     return this;
5701 }
5702
5703 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@G@Z */
5704 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@G@Z */
5705 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ushort, 8)
5706 basic_ostream_char* __thiscall basic_ostream_char_print_ushort(basic_ostream_char *this, unsigned short val)
5707 {
5708     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5709     int state = IOSTATE_goodbit;
5710
5711     TRACE("(%p %u)\n", this, val);
5712
5713     if(basic_ostream_char_sentry_create(this)) {
5714         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5715         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5716         ostreambuf_iterator_char dest = {0, strbuf};
5717
5718         num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5719     }
5720     basic_ostream_char_sentry_destroy(this);
5721
5722     basic_ios_char_setstate(base, state);
5723     return this;
5724 }
5725
5726 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z */
5727 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@H@Z */
5728 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@J@Z */
5729 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@J@Z */
5730 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int, 8)
5731 basic_ostream_char* __thiscall basic_ostream_char_print_int(basic_ostream_char *this, int val)
5732 {
5733     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5734     int state = IOSTATE_goodbit;
5735
5736     TRACE("(%p %d)\n", this, val);
5737
5738     if(basic_ostream_char_sentry_create(this)) {
5739         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5740         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5741         ostreambuf_iterator_char dest = {0, strbuf};
5742
5743         num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5744     }
5745     basic_ostream_char_sentry_destroy(this);
5746
5747     basic_ios_char_setstate(base, state);
5748     return this;
5749 }
5750
5751 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@I@Z */
5752 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@I@Z */
5753 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@K@Z */
5754 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@K@Z */
5755 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint, 8)
5756 basic_ostream_char* __thiscall basic_ostream_char_print_uint(basic_ostream_char *this, unsigned int val)
5757 {
5758     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5759     int state = IOSTATE_goodbit;
5760
5761     TRACE("(%p %u)\n", this, val);
5762
5763     if(basic_ostream_char_sentry_create(this)) {
5764         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5765         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5766         ostreambuf_iterator_char dest = {0, strbuf};
5767
5768         num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5769     }
5770     basic_ostream_char_sentry_destroy(this);
5771
5772     basic_ios_char_setstate(base, state);
5773     return this;
5774 }
5775
5776 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@M@Z */
5777 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@M@Z */
5778 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_float, 8)
5779 basic_ostream_char* __thiscall basic_ostream_char_print_float(basic_ostream_char *this, float val)
5780 {
5781     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5782     int state = IOSTATE_goodbit;
5783
5784     TRACE("(%p %f)\n", this, val);
5785
5786     if(basic_ostream_char_sentry_create(this)) {
5787         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5788         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5789         ostreambuf_iterator_char dest = {0, strbuf};
5790
5791         num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5792     }
5793     basic_ostream_char_sentry_destroy(this);
5794
5795     basic_ios_char_setstate(base, state);
5796     return this;
5797 }
5798
5799 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@N@Z */
5800 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@N@Z */
5801 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_double, 12)
5802 basic_ostream_char* __thiscall basic_ostream_char_print_double(basic_ostream_char *this, double val)
5803 {
5804     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5805     int state = IOSTATE_goodbit;
5806
5807     TRACE("(%p %lf)\n", this, val);
5808
5809     if(basic_ostream_char_sentry_create(this)) {
5810         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5811         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5812         ostreambuf_iterator_char dest = {0, strbuf};
5813
5814         num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5815     }
5816     basic_ostream_char_sentry_destroy(this);
5817
5818     basic_ios_char_setstate(base, state);
5819     return this;
5820 }
5821
5822 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@O@Z */
5823 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@O@Z */
5824 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ldouble, 12)
5825 basic_ostream_char* __thiscall basic_ostream_char_print_ldouble(basic_ostream_char *this, double val)
5826 {
5827     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5828     int state = IOSTATE_goodbit;
5829
5830     TRACE("(%p %lf)\n", this, val);
5831
5832     if(basic_ostream_char_sentry_create(this)) {
5833         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5834         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5835         ostreambuf_iterator_char dest = {0, strbuf};
5836
5837         num_put_char_put_ldouble(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5838     }
5839     basic_ostream_char_sentry_destroy(this);
5840
5841     basic_ios_char_setstate(base, state);
5842     return this;
5843 }
5844
5845 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
5846 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
5847 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_streambuf, 8)
5848 basic_ostream_char* __thiscall basic_ostream_char_print_streambuf(basic_ostream_char *this, basic_streambuf_char *val)
5849 {
5850     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5851     IOSB_iostate state = IOSTATE_badbit;
5852     int c = '\n';
5853
5854     TRACE("(%p %p)\n", this, val);
5855
5856     if(basic_ostream_char_sentry_create(this)) {
5857         for(c = basic_streambuf_char_sgetc(val); c!=EOF;
5858                 c = basic_streambuf_char_snextc(val)) {
5859             state = IOSTATE_goodbit;
5860
5861             if(basic_streambuf_char_sputc(base->strbuf, c) == EOF) {
5862                 state = IOSTATE_badbit;
5863                 break;
5864             }
5865         }
5866     }else {
5867         state = IOSTATE_badbit;
5868     }
5869     basic_ostream_char_sentry_destroy(this);
5870
5871     ios_base_width_set(&base->base, 0);
5872     basic_ios_char_setstate(base, state);
5873     return this;
5874 }
5875
5876 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PBX@Z */
5877 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z */
5878 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ptr, 8)
5879 basic_ostream_char* __thiscall basic_ostream_char_print_ptr(basic_ostream_char *this, const void *val)
5880 {
5881     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5882     int state = IOSTATE_goodbit;
5883
5884     TRACE("(%p %p)\n", this, val);
5885
5886     if(basic_ostream_char_sentry_create(this)) {
5887         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5888         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5889         ostreambuf_iterator_char dest = {0, strbuf};
5890
5891         num_put_char_put_ptr(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5892     }
5893     basic_ostream_char_sentry_destroy(this);
5894
5895     basic_ios_char_setstate(base, state);
5896     return this;
5897 }
5898
5899 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_J@Z */
5900 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_J@Z */
5901 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int64, 12)
5902 basic_ostream_char* __thiscall basic_ostream_char_print_int64(basic_ostream_char *this, __int64 val)
5903 {
5904     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5905     int state = IOSTATE_goodbit;
5906
5907     TRACE("(%p)\n", this);
5908
5909     if(basic_ostream_char_sentry_create(this)) {
5910         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5911         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5912         ostreambuf_iterator_char dest = {0, strbuf};
5913
5914         num_put_char_put_int64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5915     }
5916     basic_ostream_char_sentry_destroy(this);
5917
5918     basic_ios_char_setstate(base, state);
5919     return this;
5920 }
5921
5922 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_K@Z */
5923 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_K@Z */
5924 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint64, 12)
5925 basic_ostream_char* __thiscall basic_ostream_char_print_uint64(basic_ostream_char *this, unsigned __int64 val)
5926 {
5927     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5928     int state = IOSTATE_goodbit;
5929
5930     TRACE("(%p)\n", this);
5931
5932     if(basic_ostream_char_sentry_create(this)) {
5933         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5934         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5935         ostreambuf_iterator_char dest = {0, strbuf};
5936
5937         num_put_char_put_uint64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5938     }
5939     basic_ostream_char_sentry_destroy(this);
5940
5941     basic_ios_char_setstate(base, state);
5942     return this;
5943 }
5944
5945 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_N@Z */
5946 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_N@Z */
5947 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_bool, 8)
5948 basic_ostream_char* __thiscall basic_ostream_char_print_bool(basic_ostream_char *this, MSVCP_bool val)
5949 {
5950     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5951     int state = IOSTATE_goodbit;
5952
5953     TRACE("(%p %x)\n", this, val);
5954
5955     if(basic_ostream_char_sentry_create(this)) {
5956         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5957         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5958         ostreambuf_iterator_char dest = {0, strbuf};
5959
5960         num_put_char_put_bool(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5961     }
5962     basic_ostream_char_sentry_destroy(this);
5963
5964     basic_ios_char_setstate(base, state);
5965     return this;
5966 }
5967
5968 /* ?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5969 /* ?endl@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5970 basic_ostream_char* __cdecl basic_ostream_char_endl(basic_ostream_char *ostr)
5971 {
5972     TRACE("(%p)\n", ostr);
5973
5974     basic_ostream_char_put(ostr, '\n');
5975     basic_ostream_char_flush(ostr);
5976     return ostr;
5977 }
5978
5979 /* $?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 */
5980 /* ??$?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 */
5981 basic_ostream_char* __cdecl basic_ostream_char_print_bstr(basic_ostream_char *ostr, const basic_string_char *str)
5982 {
5983     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5984     IOSB_iostate state = IOSTATE_goodbit;
5985
5986     TRACE("(%p %p)\n", ostr, str);
5987
5988     if(basic_ostream_char_sentry_create(ostr)) {
5989         MSVCP_size_t len = MSVCP_basic_string_char_length(str);
5990         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
5991
5992         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
5993             for(; pad!=0; pad--) {
5994                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
5995                     state = IOSTATE_badbit;
5996                     break;
5997                 }
5998             }
5999         }
6000
6001         if(state == IOSTATE_goodbit) {
6002             if(basic_streambuf_char_sputn(base->strbuf, MSVCP_basic_string_char_c_str(str), len) != len)
6003                     state = IOSTATE_badbit;
6004         }
6005
6006         if(state == IOSTATE_goodbit) {
6007             for(; pad!=0; pad--) {
6008                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6009                     state = IOSTATE_badbit;
6010                     break;
6011                 }
6012             }
6013         }
6014
6015         base->base.wide = 0;
6016     }else {
6017         state = IOSTATE_badbit;
6018     }
6019     basic_ostream_char_sentry_destroy(ostr);
6020
6021     basic_ios_char_setstate(base, state);
6022     return ostr;
6023 }
6024
6025 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@C@Z */
6026 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@C@Z */
6027 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@D@Z */
6028 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z */
6029 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@E@Z */
6030 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@E@Z */
6031 basic_ostream_char* __cdecl basic_ostream_char_print_ch(basic_ostream_char *ostr, char ch)
6032 {
6033     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
6034     IOSB_iostate state = IOSTATE_goodbit;
6035
6036     TRACE("(%p %d)\n", ostr, ch);
6037
6038     if(basic_ostream_char_sentry_create(ostr)) {
6039         streamsize pad = (base->base.wide>1 ? base->base.wide-1 : 0);
6040
6041         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6042             for(; pad!=0; pad--) {
6043                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6044                     state = IOSTATE_badbit;
6045                     break;
6046                 }
6047             }
6048         }
6049
6050         if(state == IOSTATE_goodbit) {
6051             if(basic_streambuf_char_sputc(base->strbuf, ch) == EOF)
6052                 state = IOSTATE_badbit;
6053         }
6054
6055         if(state == IOSTATE_goodbit) {
6056             for(; pad!=0; pad--) {
6057                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6058                     state = IOSTATE_badbit;
6059                     break;
6060                 }
6061             }
6062         }
6063
6064         base->base.wide = 0;
6065     }else {
6066         state = IOSTATE_badbit;
6067     }
6068     basic_ostream_char_sentry_destroy(ostr);
6069
6070     basic_ios_char_setstate(base, state);
6071     return ostr;
6072 }
6073
6074 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBC@Z */
6075 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBC@Z */
6076 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z */
6077 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z */
6078 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBE@Z */
6079 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBE@Z */
6080 basic_ostream_char* __cdecl basic_ostream_char_print_str(basic_ostream_char *ostr, const char *str)
6081 {
6082     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
6083     IOSB_iostate state = IOSTATE_goodbit;
6084
6085     TRACE("(%p %s)\n", ostr, str);
6086
6087     if(basic_ostream_char_sentry_create(ostr)) {
6088         MSVCP_size_t len = strlen(str);
6089         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6090
6091         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6092             for(; pad!=0; pad--) {
6093                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6094                     state = IOSTATE_badbit;
6095                     break;
6096                 }
6097             }
6098         }
6099
6100         if(state == IOSTATE_goodbit) {
6101             if(basic_streambuf_char_sputn(base->strbuf, str, len) != len)
6102                 state = IOSTATE_badbit;
6103         }
6104
6105         if(state == IOSTATE_goodbit) {
6106             for(; pad!=0; pad--) {
6107                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6108                     state = IOSTATE_badbit;
6109                     break;
6110                 }
6111             }
6112         }
6113
6114         base->base.wide = 0;
6115     }else {
6116         state = IOSTATE_badbit;
6117     }
6118     basic_ostream_char_sentry_destroy(ostr);
6119
6120     basic_ios_char_setstate(base, state);
6121     return ostr;
6122 }
6123
6124 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
6125 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
6126 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func, 8)
6127 basic_ostream_char* __thiscall basic_ostream_char_print_func(basic_ostream_char *this,
6128         basic_ostream_char* (__cdecl *pfunc)(basic_ostream_char*))
6129 {
6130     TRACE("(%p %p)\n", this, pfunc);
6131     pfunc(this);
6132     return this;
6133 }
6134
6135 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
6136 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
6137 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_basic_ios, 8)
6138 basic_ostream_char* __thiscall basic_ostream_char_print_func_basic_ios(basic_ostream_char *this,
6139         basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
6140 {
6141     TRACE("(%p %p)\n", this, pfunc);
6142     pfunc(basic_ostream_char_get_basic_ios(this));
6143     return this;
6144 }
6145
6146 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
6147 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
6148 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_ios_base, 8)
6149 basic_ostream_char* __thiscall basic_ostream_char_print_func_ios_base(
6150         basic_ostream_char *this, ios_base* (__cdecl *pfunc)(ios_base*))
6151 {
6152     TRACE("(%p %p)\n", this, pfunc);
6153     pfunc(&basic_ostream_char_get_basic_ios(this)->base);
6154     return this;
6155 }
6156
6157 /* Caution: basic_ostream uses virtual inheritance. */
6158 static inline basic_ios_wchar* basic_ostream_wchar_get_basic_ios(basic_ostream_wchar *this)
6159 {
6160     return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
6161 }
6162
6163 static inline basic_ios_wchar* basic_ostream_wchar_to_basic_ios(basic_ostream_wchar *ptr)
6164 {
6165     return (basic_ios_wchar*)((char*)ptr+basic_ostream_wchar_vbtable[1]);
6166 }
6167
6168 static inline basic_ostream_wchar* basic_ostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
6169 {
6170     return (basic_ostream_wchar*)((char*)ptr-basic_ostream_wchar_vbtable[1]);
6171 }
6172
6173 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6174 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6175 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor, 16)
6176 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor(basic_ostream_wchar *this,
6177         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6178 {
6179     basic_ios_wchar *base;
6180
6181     TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
6182
6183     if(virt_init) {
6184         this->vbtable = basic_ostream_wchar_vbtable;
6185         base = basic_ostream_wchar_get_basic_ios(this);
6186         basic_ios_wchar_ctor(base);
6187     }else {
6188         base = basic_ostream_wchar_get_basic_ios(this);
6189     }
6190
6191     base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
6192     basic_ios_wchar_init(base, strbuf, isstd);
6193     return this;
6194 }
6195
6196 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6197 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6198 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor, 16)
6199 basic_ostream_wchar* __thiscall basic_ostream_short_ctor(basic_ostream_wchar *this,
6200         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6201 {
6202     basic_ostream_wchar_ctor(this, strbuf, isstd, virt_init);
6203     basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
6204     return this;
6205 }
6206
6207 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
6208 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
6209 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor_uninitialized, 16)
6210 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor_uninitialized(basic_ostream_wchar *this,
6211         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
6212 {
6213     basic_ios_wchar *base;
6214
6215     TRACE("(%p %d %x)\n", this, uninitialized, addstd);
6216
6217     if(virt_init) {
6218         this->vbtable = basic_ostream_wchar_vbtable;
6219         base = basic_ostream_wchar_get_basic_ios(this);
6220         basic_ios_wchar_ctor(base);
6221     }else {
6222         base = basic_ostream_wchar_get_basic_ios(this);
6223     }
6224
6225     base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
6226     if(addstd)
6227         ios_base_Addstd(&base->base);
6228     return this;
6229 }
6230
6231 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
6232 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
6233 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor_uninitialized, 16)
6234 basic_ostream_wchar* __thiscall basic_ostream_short_ctor_uninitialized(basic_ostream_wchar *this,
6235         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
6236 {
6237     basic_ostream_wchar_ctor_uninitialized(this, uninitialized, addstd, virt_init);
6238     basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
6239     return this;
6240 }
6241
6242 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
6243 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
6244 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
6245 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
6246 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_dtor, 4)
6247 void __thiscall basic_ostream_wchar_dtor(basic_ios_wchar *base)
6248 {
6249     basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
6250
6251     /* don't destroy virtual base here */
6252     TRACE("(%p)\n", this);
6253 }
6254
6255 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6256 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6257 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6258 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6259 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vbase_dtor, 4)
6260 void __thiscall basic_ostream_wchar_vbase_dtor(basic_ostream_wchar *this)
6261 {
6262     TRACE("(%p)\n", this);
6263     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(this));
6264     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(this));
6265 }
6266
6267 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vector_dtor, 8)
6268 basic_ostream_wchar* __thiscall basic_ostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
6269 {
6270     basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
6271
6272     TRACE("(%p %x)\n", this, flags);
6273
6274     if(flags & 2) {
6275         /* we have an array, with the number of elements stored before the first object */
6276         int i, *ptr = (int *)this-1;
6277
6278         for(i=*ptr-1; i>=0; i--)
6279             basic_ostream_wchar_vbase_dtor(this+i);
6280         MSVCRT_operator_delete(ptr);
6281     } else {
6282         basic_ostream_wchar_vbase_dtor(this);
6283         if(flags & 1)
6284             MSVCRT_operator_delete(this);
6285     }
6286
6287     return this;
6288 }
6289
6290 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
6291 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
6292 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
6293 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
6294 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_flush, 4)
6295 basic_ostream_wchar* __thiscall basic_ostream_wchar_flush(basic_ostream_wchar *this)
6296 {
6297     /* this function is not matching C++ specification */
6298     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6299
6300     TRACE("(%p)\n", this);
6301
6302     if(basic_ios_wchar_rdbuf_get(base) && ios_base_good(&base->base)
6303             && basic_streambuf_wchar_pubsync(basic_ios_wchar_rdbuf_get(base))==-1)
6304         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6305     return this;
6306 }
6307
6308 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6309 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6310 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6311 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6312 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar__Osfx, 4)
6313 void __thiscall basic_ostream_wchar__Osfx(basic_ostream_wchar *this)
6314 {
6315     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6316
6317     TRACE("(%p)\n", this);
6318
6319     if(base->base.fmtfl & FMTFLAG_unitbuf)
6320         basic_ostream_wchar_flush(this);
6321 }
6322
6323 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6324 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6325 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6326 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6327 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_osfx, 4)
6328 void __thiscall basic_ostream_wchar_osfx(basic_ostream_wchar *this)
6329 {
6330     TRACE("(%p)\n", this);
6331     basic_ostream_wchar__Osfx(this);
6332 }
6333
6334 static BOOL basic_ostream_wchar_sentry_create(basic_ostream_wchar *ostr)
6335 {
6336     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6337
6338     if(basic_ios_wchar_rdbuf_get(base))
6339         basic_streambuf_wchar__Lock(base->strbuf);
6340
6341     if(ios_base_good(&base->base) && base->stream)
6342         basic_ostream_wchar_flush(base->stream);
6343
6344     return ios_base_good(&base->base);
6345 }
6346
6347 static void basic_ostream_wchar_sentry_destroy(basic_ostream_wchar *ostr)
6348 {
6349     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6350
6351     if(ios_base_good(&base->base) && !__uncaught_exception())
6352         basic_ostream_wchar_osfx(ostr);
6353
6354     if(basic_ios_wchar_rdbuf_get(base))
6355         basic_streambuf_wchar__Unlock(base->strbuf);
6356 }
6357
6358 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE_NXZ */
6359 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA_NXZ */
6360 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE_NXZ */
6361 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA_NXZ */
6362 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_opfx, 4)
6363 MSVCP_bool __thiscall basic_ostream_wchar_opfx(basic_ostream_wchar *this)
6364 {
6365     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6366
6367     TRACE("(%p)\n", this);
6368
6369     if(ios_base_good(&base->base) && base->stream)
6370         basic_ostream_wchar_flush(base->stream);
6371     return ios_base_good(&base->base);
6372 }
6373
6374 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
6375 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
6376 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
6377 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
6378 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_put, 8)
6379 basic_ostream_wchar* __thiscall basic_ostream_wchar_put(basic_ostream_wchar *this, wchar_t ch)
6380 {
6381     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6382
6383     TRACE("(%p %c)\n", this, ch);
6384
6385     if(!basic_ostream_wchar_sentry_create(this)
6386             || basic_streambuf_wchar_sputc(base->strbuf, ch)==WEOF) {
6387         basic_ostream_wchar_sentry_destroy(this);
6388         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6389         return this;
6390     }
6391
6392     basic_ostream_wchar_sentry_destroy(this);
6393     return this;
6394 }
6395
6396 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
6397 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
6398 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
6399 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
6400 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp, 16)
6401 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp(basic_ostream_wchar *this, streamoff off, int way)
6402 {
6403     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6404
6405     TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), way);
6406
6407     if(!ios_base_fail(&base->base)) {
6408         fpos_int seek;
6409
6410         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
6411                 &seek, off, way, OPENMODE_out);
6412         if(seek.off==0 && seek.pos==-1 && seek.state==0)
6413             basic_ios_wchar_setstate(base, IOSTATE_failbit);
6414     }
6415     return this;
6416 }
6417
6418 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6419 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6420 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6421 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6422 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp_fpos, 28)
6423 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp_fpos(basic_ostream_wchar *this, fpos_int pos)
6424 {
6425     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6426
6427     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
6428
6429     if(!ios_base_fail(&base->base)) {
6430         fpos_int seek;
6431
6432         basic_streambuf_wchar_pubseekpos(basic_ios_wchar_rdbuf_get(base),
6433                 &seek, pos, OPENMODE_out);
6434         if(seek.off==0 && seek.pos==-1 && seek.state==0)
6435             basic_ios_wchar_setstate(base, IOSTATE_failbit);
6436     }
6437     return this;
6438 }
6439
6440 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6441 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6442 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6443 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6444 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_tellp, 8)
6445 fpos_int* __thiscall basic_ostream_wchar_tellp(basic_ostream_wchar *this, fpos_int *ret)
6446 {
6447     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6448
6449     TRACE("(%p)\n", this);
6450
6451     if(!ios_base_fail(&base->base)) {
6452         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
6453                 ret, 0, SEEKDIR_cur, OPENMODE_out);
6454     }else {
6455         ret->off = 0;
6456         ret->pos = -1;
6457         ret->state = 0;
6458     }
6459     return ret;
6460 }
6461
6462 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PB_WH@Z */
6463 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEB_W_J@Z */
6464 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@PBGH@Z */
6465 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEBG_J@Z */
6466 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_write, 16)
6467 basic_ostream_wchar* __thiscall basic_ostream_wchar_write(basic_ostream_wchar *this, const wchar_t *str, streamsize count)
6468 {
6469     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6470
6471     TRACE("(%p %s %s)\n", this, debugstr_w(str), wine_dbgstr_longlong(count));
6472
6473     if(!basic_ostream_wchar_sentry_create(this)
6474             || basic_streambuf_wchar_sputn(base->strbuf, str, count)!=count) {
6475         basic_ostream_wchar_sentry_destroy(this);
6476         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6477         return this;
6478     }
6479
6480     basic_ostream_wchar_sentry_destroy(this);
6481     return this;
6482 }
6483
6484 static basic_ostream_wchar* basic_ostream_print_short(basic_ostream_wchar *this, short val, const num_put *numput)
6485 {
6486     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6487     int state = IOSTATE_goodbit;
6488
6489     TRACE("(%p %d)\n", this, val);
6490
6491     if(basic_ostream_wchar_sentry_create(this)) {
6492         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6493         ostreambuf_iterator_wchar dest = {0, strbuf};
6494
6495         num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base),
6496                 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
6497                 ? (LONG)((unsigned short)val) : (LONG)val);
6498     }
6499     basic_ostream_wchar_sentry_destroy(this);
6500
6501     basic_ios_wchar_setstate(base, state);
6502     return this;
6503 }
6504
6505 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@F@Z */
6506 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@F@Z */
6507 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_short, 8)
6508 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_short(basic_ostream_wchar *this, short val)
6509 {
6510     return basic_ostream_print_short(this, val, num_put_wchar_use_facet(
6511                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6512 }
6513
6514 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@F@Z */
6515 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@F@Z */
6516 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_short, 8)
6517 basic_ostream_wchar* __thiscall basic_ostream_short_print_short(basic_ostream_wchar *this, short val)
6518 {
6519     return basic_ostream_print_short(this, val, num_put_short_use_facet(
6520                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6521 }
6522
6523 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@G@Z */
6524 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@G@Z */
6525 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ushort, 8)
6526 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ushort(basic_ostream_wchar *this, unsigned short val)
6527 {
6528     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6529     int state = IOSTATE_goodbit;
6530
6531     TRACE("(%p %u)\n", this, val);
6532
6533     if(basic_ostream_wchar_sentry_create(this)) {
6534         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6535         const num_put *numput = num_put_wchar_use_facet(strbuf->loc);
6536         ostreambuf_iterator_wchar dest = {0, strbuf};
6537
6538         num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6539     }
6540     basic_ostream_wchar_sentry_destroy(this);
6541
6542     basic_ios_wchar_setstate(base, state);
6543     return this;
6544 }
6545
6546 static basic_ostream_wchar* basic_ostream_print_int(basic_ostream_wchar *this, int val, const num_put *numput)
6547 {
6548     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6549     int state = IOSTATE_goodbit;
6550
6551     TRACE("(%p %d)\n", this, val);
6552
6553     if(basic_ostream_wchar_sentry_create(this)) {
6554         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6555         ostreambuf_iterator_wchar dest = {0, strbuf};
6556
6557         num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6558     }
6559     basic_ostream_wchar_sentry_destroy(this);
6560
6561     basic_ios_wchar_setstate(base, state);
6562     return this;
6563 }
6564
6565 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@H@Z */
6566 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@H@Z */
6567 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@J@Z */
6568 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@J@Z */
6569 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int, 8)
6570 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int(basic_ostream_wchar *this, int val)
6571 {
6572     return basic_ostream_print_int(this, val, num_put_wchar_use_facet(
6573                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6574 }
6575
6576 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@H@Z */
6577 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@H@Z */
6578 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@J@Z */
6579 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@J@Z */
6580 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int, 8)
6581 basic_ostream_wchar* __thiscall basic_ostream_short_print_int(basic_ostream_wchar *this, int val)
6582 {
6583     return basic_ostream_print_int(this, val, num_put_short_use_facet(
6584                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6585 }
6586
6587 static basic_ostream_wchar* basic_ostream_print_uint(basic_ostream_wchar *this, unsigned int val, const num_put *numput)
6588 {
6589     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6590     int state = IOSTATE_goodbit;
6591
6592     TRACE("(%p %u)\n", this, val);
6593
6594     if(basic_ostream_wchar_sentry_create(this)) {
6595         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6596         ostreambuf_iterator_wchar dest = {0, strbuf};
6597
6598         num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6599     }
6600     basic_ostream_wchar_sentry_destroy(this);
6601
6602     basic_ios_wchar_setstate(base, state);
6603     return this;
6604 }
6605
6606 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@I@Z */
6607 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@I@Z */
6608 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@K@Z */
6609 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@K@Z */
6610 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint, 8)
6611 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint(basic_ostream_wchar *this, unsigned int val)
6612 {
6613     return basic_ostream_print_uint(this, val, num_put_wchar_use_facet(
6614                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6615 }
6616
6617 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@I@Z */
6618 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@I@Z */
6619 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@K@Z */
6620 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@K@Z */
6621 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint, 8)
6622 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint(basic_ostream_wchar *this, unsigned int val)
6623 {
6624     return basic_ostream_print_uint(this, val, num_put_short_use_facet(
6625                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6626 }
6627
6628 static basic_ostream_wchar* basic_ostream_print_float(basic_ostream_wchar *this, float val, const num_put *numput)
6629 {
6630     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6631     int state = IOSTATE_goodbit;
6632
6633     TRACE("(%p %f)\n", this, val);
6634
6635     if(basic_ostream_wchar_sentry_create(this)) {
6636         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6637         ostreambuf_iterator_wchar dest = {0, strbuf};
6638
6639         num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6640     }
6641     basic_ostream_wchar_sentry_destroy(this);
6642
6643     basic_ios_wchar_setstate(base, state);
6644     return this;
6645 }
6646
6647 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@M@Z */
6648 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@M@Z */
6649 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_float, 8)
6650 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_float(basic_ostream_wchar *this, float val)
6651 {
6652     return basic_ostream_print_float(this, val, num_put_wchar_use_facet(
6653                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6654 }
6655
6656 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@M@Z */
6657 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@M@Z */
6658 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_float, 8)
6659 basic_ostream_wchar* __thiscall basic_ostream_short_print_float(basic_ostream_wchar *this, float val)
6660 {
6661     return basic_ostream_print_float(this, val, num_put_short_use_facet(
6662                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6663 }
6664
6665 static basic_ostream_wchar* basic_ostream_print_double(basic_ostream_wchar *this, double val, const num_put *numput)
6666 {
6667     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6668     int state = IOSTATE_goodbit;
6669
6670     TRACE("(%p %lf)\n", this, val);
6671
6672     if(basic_ostream_wchar_sentry_create(this)) {
6673         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6674         ostreambuf_iterator_wchar dest = {0, strbuf};
6675
6676         num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6677     }
6678     basic_ostream_wchar_sentry_destroy(this);
6679
6680     basic_ios_wchar_setstate(base, state);
6681     return this;
6682 }
6683
6684 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@N@Z */
6685 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@N@Z */
6686 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_double, 12)
6687 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_double(basic_ostream_wchar *this, double val)
6688 {
6689     return basic_ostream_print_double(this, val, num_put_wchar_use_facet(
6690                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6691 }
6692
6693 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@N@Z */
6694 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@N@Z */
6695 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_double, 12)
6696 basic_ostream_wchar* __thiscall basic_ostream_short_print_double(basic_ostream_wchar *this, double val)
6697 {
6698     return basic_ostream_print_double(this, val, num_put_short_use_facet(
6699                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6700 }
6701
6702 static basic_ostream_wchar* basic_ostream_print_ldouble(basic_ostream_wchar *this, double val, const num_put *numput)
6703 {
6704     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6705     int state = IOSTATE_goodbit;
6706
6707     TRACE("(%p %lf)\n", this, val);
6708
6709     if(basic_ostream_wchar_sentry_create(this)) {
6710         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6711         ostreambuf_iterator_wchar dest = {0, strbuf};
6712
6713         num_put_wchar_put_ldouble(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6714     }
6715     basic_ostream_wchar_sentry_destroy(this);
6716
6717     basic_ios_wchar_setstate(base, state);
6718     return this;
6719 }
6720
6721 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@O@Z */
6722 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@O@Z */
6723 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ldouble, 12)
6724 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ldouble(basic_ostream_wchar *this, double val)
6725 {
6726     return basic_ostream_print_ldouble(this, val, num_put_wchar_use_facet(
6727                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6728 }
6729
6730 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@O@Z */
6731 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@O@Z */
6732 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ldouble, 12)
6733 basic_ostream_wchar* __thiscall basic_ostream_short_print_ldouble(basic_ostream_wchar *this, double val)
6734 {
6735     return basic_ostream_print_ldouble(this, val, num_put_short_use_facet(
6736                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6737 }
6738
6739 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
6740 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
6741 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
6742 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
6743 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_streambuf, 8)
6744 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_streambuf(basic_ostream_wchar *this, basic_streambuf_wchar *val)
6745 {
6746     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6747     IOSB_iostate state = IOSTATE_badbit;
6748     unsigned short c = '\n';
6749
6750     TRACE("(%p %p)\n", this, val);
6751
6752     if(basic_ostream_wchar_sentry_create(this)) {
6753         for(c = basic_streambuf_wchar_sgetc(val); c!=WEOF;
6754                 c = basic_streambuf_wchar_snextc(val)) {
6755             state = IOSTATE_goodbit;
6756
6757             if(basic_streambuf_wchar_sputc(base->strbuf, c) == WEOF) {
6758                 state = IOSTATE_badbit;
6759                 break;
6760             }
6761         }
6762     }else {
6763         state = IOSTATE_badbit;
6764     }
6765     basic_ostream_wchar_sentry_destroy(this);
6766
6767     ios_base_width_set(&base->base, 0);
6768     basic_ios_wchar_setstate(base, state);
6769     return this;
6770 }
6771
6772 static basic_ostream_wchar* basic_ostream_print_ptr(basic_ostream_wchar *this, const void *val, const num_put *numput)
6773 {
6774     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6775     int state = IOSTATE_goodbit;
6776
6777     TRACE("(%p %p)\n", this, val);
6778
6779     if(basic_ostream_wchar_sentry_create(this)) {
6780         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6781         ostreambuf_iterator_wchar dest = {0, strbuf};
6782
6783         num_put_wchar_put_ptr(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6784     }
6785     basic_ostream_wchar_sentry_destroy(this);
6786
6787     basic_ios_wchar_setstate(base, state);
6788     return this;
6789 }
6790
6791 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PBX@Z */
6792 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEBX@Z */
6793 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ptr, 8)
6794 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ptr(basic_ostream_wchar *this, const void *val)
6795 {
6796     return basic_ostream_print_ptr(this, val, num_put_wchar_use_facet(
6797                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6798 }
6799
6800 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z */
6801 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEBX@Z */
6802 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ptr, 8)
6803 basic_ostream_wchar* __thiscall basic_ostream_short_print_ptr(basic_ostream_wchar *this, const void *val)
6804 {
6805     return basic_ostream_print_ptr(this, val, num_put_short_use_facet(
6806                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6807 }
6808
6809 static basic_ostream_wchar* basic_ostream_print_int64(basic_ostream_wchar *this, __int64 val, const num_put *numput)
6810 {
6811     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6812     int state = IOSTATE_goodbit;
6813
6814     TRACE("(%p)\n", this);
6815
6816     if(basic_ostream_wchar_sentry_create(this)) {
6817         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6818         ostreambuf_iterator_wchar dest = {0, strbuf};
6819
6820         num_put_wchar_put_int64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6821     }
6822     basic_ostream_wchar_sentry_destroy(this);
6823
6824     basic_ios_wchar_setstate(base, state);
6825     return this;
6826 }
6827
6828 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_J@Z */
6829 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_J@Z */
6830 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int64, 12)
6831 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int64(basic_ostream_wchar *this, __int64 val)
6832 {
6833     return basic_ostream_print_int64(this, val, num_put_wchar_use_facet(
6834                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6835 }
6836
6837 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_J@Z */
6838 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_J@Z */
6839 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int64, 12)
6840 basic_ostream_wchar* __thiscall basic_ostream_short_print_int64(basic_ostream_wchar *this, __int64 val)
6841 {
6842     return basic_ostream_print_int64(this, val, num_put_short_use_facet(
6843                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6844 }
6845
6846 static basic_ostream_wchar* basic_ostream_print_uint64(basic_ostream_wchar *this, unsigned __int64 val, const num_put *numput)
6847 {
6848     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6849     int state = IOSTATE_goodbit;
6850
6851     TRACE("(%p)\n", this);
6852
6853     if(basic_ostream_wchar_sentry_create(this)) {
6854         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6855         ostreambuf_iterator_wchar dest = {0, strbuf};
6856
6857         num_put_wchar_put_uint64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6858     }
6859     basic_ostream_wchar_sentry_destroy(this);
6860
6861     basic_ios_wchar_setstate(base, state);
6862     return this;
6863 }
6864
6865 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_K@Z */
6866 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_K@Z */
6867 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint64, 12)
6868 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
6869 {
6870     return basic_ostream_print_uint64(this, val, num_put_wchar_use_facet(
6871                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6872 }
6873
6874 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_K@Z */
6875 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_K@Z */
6876 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint64, 12)
6877 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
6878 {
6879     return basic_ostream_print_uint64(this, val, num_put_short_use_facet(
6880                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6881 }
6882
6883 static basic_ostream_wchar* basic_ostream_print_bool(basic_ostream_wchar *this, MSVCP_bool val, const num_put *numput)
6884 {
6885     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6886     int state = IOSTATE_goodbit;
6887
6888     TRACE("(%p %x)\n", this, val);
6889
6890     if(basic_ostream_wchar_sentry_create(this)) {
6891         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6892         ostreambuf_iterator_wchar dest = {0, strbuf};
6893
6894         num_put_wchar_put_bool(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6895     }
6896     basic_ostream_wchar_sentry_destroy(this);
6897
6898     basic_ios_wchar_setstate(base, state);
6899     return this;
6900 }
6901
6902 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_N@Z */
6903 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_N@Z */
6904 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_bool, 8)
6905 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
6906 {
6907     return basic_ostream_print_bool(this, val, num_put_wchar_use_facet(
6908                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6909 }
6910
6911 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_N@Z */
6912 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_N@Z */
6913 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_bool, 8)
6914 basic_ostream_wchar* __thiscall basic_ostream_short_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
6915 {
6916     return basic_ostream_print_bool(this, val, num_put_short_use_facet(
6917                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6918 }
6919
6920 /* ?endl@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6921 /* ?endl@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6922 /* ?endl@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6923 /* ?endl@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6924 basic_ostream_wchar* __cdecl basic_ostream_wchar_endl(basic_ostream_wchar *ostr)
6925 {
6926     TRACE("(%p)\n", ostr);
6927
6928     basic_ostream_wchar_put(ostr, '\n');
6929     basic_ostream_wchar_flush(ostr);
6930     return ostr;
6931 }
6932
6933 /* ??$?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 */
6934 /* ??$?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 */
6935 /* ??$?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 */
6936 /* ??$?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 */
6937 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_bstr(basic_ostream_wchar *ostr, const basic_string_wchar *str)
6938 {
6939     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6940     IOSB_iostate state = IOSTATE_goodbit;
6941
6942     TRACE("(%p %p)\n", ostr, str);
6943
6944     if(basic_ostream_wchar_sentry_create(ostr)) {
6945         MSVCP_size_t len = MSVCP_basic_string_wchar_length(str);
6946         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6947
6948         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6949             for(; pad!=0; pad--) {
6950                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6951                     state = IOSTATE_badbit;
6952                     break;
6953                 }
6954             }
6955         }
6956
6957         if(state == IOSTATE_goodbit) {
6958             if(basic_streambuf_wchar_sputn(base->strbuf, MSVCP_basic_string_wchar_c_str(str), len) != len)
6959                 state = IOSTATE_badbit;
6960         }
6961
6962         if(state == IOSTATE_goodbit) {
6963             for(; pad!=0; pad--) {
6964                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6965                     state = IOSTATE_badbit;
6966                     break;
6967                 }
6968             }
6969         }
6970
6971         base->base.wide = 0;
6972     }else {
6973         state = IOSTATE_badbit;
6974     }
6975     basic_ostream_wchar_sentry_destroy(ostr);
6976
6977     basic_ios_wchar_setstate(base, state);
6978     return ostr;
6979 }
6980
6981 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@_W@Z */
6982 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@_W@Z */
6983 /* ??$?6GU?$char_traits@G@std@@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@G@Z */
6984 /* ??$?6GU?$char_traits@G@std@@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@G@Z */
6985 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_ch(basic_ostream_wchar *ostr, wchar_t ch)
6986 {
6987     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6988     IOSB_iostate state = IOSTATE_goodbit;
6989
6990     TRACE("(%p %d)\n", ostr, ch);
6991
6992     if(basic_ostream_wchar_sentry_create(ostr)) {
6993         streamsize pad = (base->base.wide>1 ? base->base.wide-1 : 0);
6994
6995         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6996             for(; pad!=0; pad--) {
6997                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6998                     state = IOSTATE_badbit;
6999                     break;
7000                 }
7001             }
7002         }
7003
7004         if(state == IOSTATE_goodbit) {
7005             if(basic_streambuf_wchar_sputc(base->strbuf, ch) == WEOF)
7006                 state = IOSTATE_badbit;
7007         }
7008
7009         if(state == IOSTATE_goodbit) {
7010             for(; pad!=0; pad--) {
7011                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7012                     state = IOSTATE_badbit;
7013                     break;
7014                 }
7015             }
7016         }
7017
7018         base->base.wide = 0;
7019     }else {
7020         state = IOSTATE_badbit;
7021     }
7022     basic_ostream_wchar_sentry_destroy(ostr);
7023
7024     basic_ios_wchar_setstate(base, state);
7025     return ostr;
7026 }
7027
7028 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@PB_W@Z */
7029 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@PEB_W@Z */
7030 /* ??$?6GU?$char_traits@G@std@@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@PBG@Z */
7031 /* ??$?6GU?$char_traits@G@std@@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@PEBG@Z */
7032 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_str(basic_ostream_wchar *ostr, const wchar_t *str)
7033 {
7034     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
7035     IOSB_iostate state = IOSTATE_goodbit;
7036
7037     TRACE("(%p %s)\n", ostr, debugstr_w(str));
7038
7039     if(basic_ostream_wchar_sentry_create(ostr)) {
7040         MSVCP_size_t len = wcslen(str);
7041         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
7042
7043         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7044             for(; pad!=0; pad--) {
7045                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7046                     state = IOSTATE_badbit;
7047                     break;
7048                 }
7049             }
7050         }
7051
7052         if(state == IOSTATE_goodbit) {
7053             if(basic_streambuf_wchar_sputn(base->strbuf, str, len) != len)
7054                                         state = IOSTATE_badbit;
7055         }
7056
7057         if(state == IOSTATE_goodbit) {
7058             for(; pad!=0; pad--) {
7059                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7060                     state = IOSTATE_badbit;
7061                     break;
7062                 }
7063             }
7064         }
7065
7066         base->base.wide = 0;
7067     }else {
7068         state = IOSTATE_badbit;
7069     }
7070     basic_ostream_wchar_sentry_destroy(ostr);
7071
7072     basic_ios_wchar_setstate(base, state);
7073     return ostr;
7074 }
7075
7076 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7077 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7078 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7079 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7080 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func, 8)
7081 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func(basic_ostream_wchar *this,
7082         basic_ostream_wchar* (__cdecl *pfunc)(basic_ostream_wchar*))
7083 {
7084     TRACE("(%p %p)\n", this, pfunc);
7085     pfunc(this);
7086     return this;
7087 }
7088
7089 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
7090 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
7091 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
7092 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
7093 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_basic_ios, 8)
7094 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_basic_ios(basic_ostream_wchar *this,
7095         basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
7096 {
7097     TRACE("(%p %p)\n", this, pfunc);
7098     pfunc(basic_ostream_wchar_get_basic_ios(this));
7099     return this;
7100 }
7101
7102 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7103 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7104 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7105 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7106 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_ios_base, 8)
7107 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_ios_base(
7108         basic_ostream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
7109 {
7110     TRACE("(%p %p)\n", this, pfunc);
7111     pfunc(&basic_ostream_wchar_get_basic_ios(this)->base);
7112     return this;
7113 }
7114
7115 /* Caution: basic_istream uses virtual inheritance. */
7116 static inline basic_ios_char* basic_istream_char_get_basic_ios(basic_istream_char *this)
7117 {
7118     return (basic_ios_char*)((char*)this+this->vbtable[1]);
7119 }
7120
7121 static inline basic_ios_char* basic_istream_char_to_basic_ios(basic_istream_char *ptr)
7122 {
7123     return (basic_ios_char*)((char*)ptr+basic_istream_char_vbtable[1]);
7124 }
7125
7126 static inline basic_istream_char* basic_istream_char_from_basic_ios(basic_ios_char *ptr)
7127 {
7128     return (basic_istream_char*)((char*)ptr-basic_istream_char_vbtable[1]);
7129 }
7130
7131 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
7132 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
7133 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_init, 20)
7134 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)
7135 {
7136     basic_ios_char *base;
7137
7138     TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
7139
7140     if(virt_init) {
7141         this->vbtable = basic_istream_char_vbtable;
7142         base = basic_istream_char_get_basic_ios(this);
7143         basic_ios_char_ctor(base);
7144     }else {
7145         base = basic_istream_char_get_basic_ios(this);
7146     }
7147
7148     base->base.vtable = &MSVCP_basic_istream_char_vtable;
7149     this->count = 0;
7150     if(!noinit)
7151         basic_ios_char_init(base, strbuf, isstd);
7152     return this;
7153 }
7154
7155 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
7156 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
7157 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor, 16)
7158 basic_istream_char* __thiscall basic_istream_char_ctor(basic_istream_char *this, basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
7159 {
7160     return basic_istream_char_ctor_init(this, strbuf, isstd, FALSE, virt_init);
7161 }
7162
7163 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
7164 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
7165 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_uninitialized, 12)
7166 basic_istream_char* __thiscall basic_istream_char_ctor_uninitialized(basic_istream_char *this, int uninitialized, MSVCP_bool virt_init)
7167 {
7168     basic_ios_char *base;
7169
7170     TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
7171
7172     if(virt_init) {
7173         this->vbtable = basic_istream_char_vbtable;
7174         base = basic_istream_char_get_basic_ios(this);
7175         basic_ios_char_ctor(base);
7176     }else {
7177         base = basic_istream_char_get_basic_ios(this);
7178     }
7179
7180     base->base.vtable = &MSVCP_basic_istream_char_vtable;
7181     ios_base_Addstd(&base->base);
7182     return this;
7183 }
7184
7185 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UAE@XZ */
7186 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
7187 DEFINE_THISCALL_WRAPPER(basic_istream_char_dtor, 4)
7188 void __thiscall basic_istream_char_dtor(basic_ios_char *base)
7189 {
7190     basic_istream_char *this = basic_istream_char_from_basic_ios(base);
7191
7192     /* don't destroy virtual base here */
7193     TRACE("(%p)\n", this);
7194 }
7195
7196 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7197 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7198 DEFINE_THISCALL_WRAPPER(basic_istream_char_vbase_dtor, 4)
7199 void __thiscall basic_istream_char_vbase_dtor(basic_istream_char *this)
7200 {
7201     TRACE("(%p)\n", this);
7202     basic_istream_char_dtor(basic_istream_char_to_basic_ios(this));
7203     basic_ios_char_dtor(basic_istream_char_get_basic_ios(this));
7204 }
7205
7206 DEFINE_THISCALL_WRAPPER(basic_istream_char_vector_dtor, 8)
7207 basic_istream_char* __thiscall basic_istream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
7208 {
7209     basic_istream_char *this = basic_istream_char_from_basic_ios(base);
7210
7211     TRACE("(%p %x)\n", this, flags);
7212
7213     if(flags & 2) {
7214         /* we have an array, with the number of elements stored before the first object */
7215         int i, *ptr = (int *)this-1;
7216
7217         for(i=*ptr-1; i>=0; i--)
7218             basic_istream_char_vbase_dtor(this+i);
7219         MSVCRT_operator_delete(ptr);
7220     } else {
7221         basic_istream_char_vbase_dtor(this);
7222         if(flags & 1)
7223             MSVCRT_operator_delete(this);
7224     }
7225
7226     return this;
7227 }
7228
7229 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
7230 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
7231 DEFINE_THISCALL_WRAPPER(basic_istream_char__Ipfx, 8)
7232 MSVCP_bool __thiscall basic_istream_char__Ipfx(basic_istream_char *this, MSVCP_bool noskip)
7233 {
7234     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7235
7236     TRACE("(%p %d)\n", this, noskip);
7237
7238     if(!ios_base_good(&base->base)) {
7239         basic_ios_char_setstate(base, IOSTATE_failbit);
7240         return FALSE;
7241     }
7242
7243     if(basic_ios_char_tie_get(base))
7244         basic_ostream_char_flush(basic_ios_char_tie_get(base));
7245
7246     if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
7247         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7248         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
7249         int ch;
7250
7251         for(ch = basic_streambuf_char_sgetc(strbuf); ;
7252                 ch = basic_streambuf_char_snextc(strbuf)) {
7253             if(ch == EOF) {
7254                 basic_ios_char_setstate(base, IOSTATE_eofbit);
7255                 return FALSE;
7256             }
7257
7258             if(!ctype_char_is_ch(ctype, _SPACE|_BLANK, ch))
7259                 break;
7260         }
7261     }
7262
7263     return TRUE;
7264 }
7265
7266 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
7267 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
7268 DEFINE_THISCALL_WRAPPER(basic_istream_char_ipfx, 8)
7269 MSVCP_bool __thiscall basic_istream_char_ipfx(basic_istream_char *this, MSVCP_bool noskip)
7270 {
7271     return basic_istream_char__Ipfx(this, noskip);
7272 }
7273
7274 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7275 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7276 DEFINE_THISCALL_WRAPPER(basic_istream_char_isfx, 4)
7277 void __thiscall basic_istream_char_isfx(basic_istream_char *this)
7278 {
7279     TRACE("(%p)\n", this);
7280 }
7281
7282 static BOOL basic_istream_char_sentry_create(basic_istream_char *istr, MSVCP_bool noskip)
7283 {
7284     basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
7285
7286     if(basic_ios_char_rdbuf_get(base))
7287         call_basic_streambuf_char__Lock(base->strbuf);
7288
7289     return basic_istream_char_ipfx(istr, noskip);
7290 }
7291
7292 static void basic_istream_char_sentry_destroy(basic_istream_char *istr)
7293 {
7294     basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
7295
7296     if(basic_ios_char_rdbuf_get(base))
7297         call_basic_streambuf_char__Unlock(base->strbuf);
7298 }
7299
7300 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QBEHXZ */
7301 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QEBA_JXZ */
7302 DEFINE_THISCALL_WRAPPER(basic_istream_char_gcount, 4)
7303 int __thiscall basic_istream_char_gcount(const basic_istream_char *this)
7304 {
7305     TRACE("(%p)\n", this);
7306     return this->count;
7307 }
7308
7309 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7310 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7311 DEFINE_THISCALL_WRAPPER(basic_istream_char_get, 4)
7312 int __thiscall basic_istream_char_get(basic_istream_char *this)
7313 {
7314     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7315     int ret;
7316
7317     TRACE("(%p)\n", this);
7318
7319     this->count = 0;
7320
7321     if(!basic_istream_char_sentry_create(this, TRUE)) {
7322         basic_istream_char_sentry_destroy(this);
7323         return EOF;
7324     }
7325
7326     ret = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(base));
7327     basic_istream_char_sentry_destroy(this);
7328     if(ret == EOF)
7329         basic_ios_char_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
7330     else
7331         this->count++;
7332
7333     return ret;
7334 }
7335
7336 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAD@Z */
7337 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAD@Z */
7338 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_ch, 8)
7339 basic_istream_char* __thiscall basic_istream_char_get_ch(basic_istream_char *this, char *ch)
7340 {
7341     int ret;
7342
7343     TRACE("(%p %p)\n", this, ch);
7344
7345     ret = basic_istream_char_get(this);
7346     if(ret != EOF)
7347         *ch = (char)ret;
7348     return this;
7349 }
7350
7351 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
7352 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
7353 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str_delim, 20)
7354 basic_istream_char* __thiscall basic_istream_char_get_str_delim(basic_istream_char *this, char *str, streamsize count, char delim)
7355 {
7356     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7357     int ch = delim;
7358
7359     TRACE("(%p %p %s %c)\n", this, str, wine_dbgstr_longlong(count), delim);
7360
7361     this->count = 0;
7362
7363     if(basic_istream_char_sentry_create(this, TRUE)) {
7364         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7365
7366         for(ch = basic_streambuf_char_sgetc(strbuf); count>1;
7367                 ch = basic_streambuf_char_snextc(strbuf)) {
7368             if(ch==EOF || ch==delim)
7369                 break;
7370
7371             *str++ = ch;
7372             this->count++;
7373             count--;
7374         }
7375     }
7376     basic_istream_char_sentry_destroy(this);
7377
7378     basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
7379             (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7380     if(count > 0)
7381         *str = 0;
7382     return this;
7383 }
7384
7385 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7386 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7387 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str, 16)
7388 basic_istream_char* __thiscall basic_istream_char_get_str(basic_istream_char *this, char *str, streamsize count)
7389 {
7390     return basic_istream_char_get_str_delim(this, str, count, '\n');
7391 }
7392
7393 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
7394 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
7395 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf_delim, 12)
7396 basic_istream_char* __thiscall basic_istream_char_get_streambuf_delim(basic_istream_char *this, basic_streambuf_char *strbuf, char delim)
7397 {
7398     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7399     int ch = delim;
7400
7401     TRACE("(%p %p %c)\n", this, strbuf, delim);
7402
7403     this->count = 0;
7404
7405     if(basic_istream_char_sentry_create(this, TRUE)) {
7406         basic_streambuf_char *strbuf_read = basic_ios_char_rdbuf_get(base);
7407
7408         for(ch = basic_streambuf_char_sgetc(strbuf_read); ;
7409                 ch = basic_streambuf_char_snextc(strbuf_read)) {
7410             if(ch==EOF || ch==delim)
7411                 break;
7412
7413             if(basic_streambuf_char_sputc(strbuf, ch) == EOF)
7414                 break;
7415             this->count++;
7416         }
7417     }
7418     basic_istream_char_sentry_destroy(this);
7419
7420     basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
7421             (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7422     return this;
7423 }
7424
7425 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
7426 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
7427 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf, 8)
7428 basic_istream_char* __thiscall basic_istream_char_get_streambuf(basic_istream_char *this, basic_streambuf_char *strbuf)
7429 {
7430     return basic_istream_char_get_streambuf_delim(this, strbuf, '\n');
7431 }
7432
7433 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
7434 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
7435 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline_delim, 20)
7436 basic_istream_char* __thiscall basic_istream_char_getline_delim(basic_istream_char *this, char *str, streamsize count, char delim)
7437 {
7438     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7439     int ch = delim;
7440
7441     TRACE("(%p %p %s %c)\n", this, str, wine_dbgstr_longlong(count), delim);
7442
7443     this->count = 0;
7444
7445     if(basic_istream_char_sentry_create(this, TRUE) && count>0) {
7446         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7447
7448         while(count > 1) {
7449             ch = basic_streambuf_char_sbumpc(strbuf);
7450
7451             if(ch==EOF || ch==delim)
7452                 break;
7453
7454             *str++ = ch;
7455             this->count++;
7456             count--;
7457         }
7458
7459         if(ch == delim)
7460             this->count++;
7461         else if(ch != EOF) {
7462             ch = basic_streambuf_char_sgetc(strbuf);
7463
7464             if(ch == delim) {
7465                 basic_streambuf_char__Gninc(strbuf);
7466                 this->count++;
7467             }
7468         }
7469     }
7470     basic_istream_char_sentry_destroy(this);
7471
7472     basic_ios_char_setstate(base, (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
7473             (!this->count || (ch!=delim && ch!=EOF) ? IOSTATE_failbit : IOSTATE_goodbit));
7474     if(count > 0)
7475         *str = 0;
7476     return this;
7477 }
7478
7479 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7480 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7481 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline, 16)
7482 basic_istream_char* __thiscall basic_istream_char_getline(basic_istream_char *this, char *str, streamsize count)
7483 {
7484     return basic_istream_char_getline_delim(this, str, count, '\n');
7485 }
7486
7487 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@HH@Z */
7488 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
7489 DEFINE_THISCALL_WRAPPER(basic_istream_char_ignore, 16)
7490 basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *this, streamsize count, int delim)
7491 {
7492     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7493     int ch = delim;
7494
7495     TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(count), delim);
7496
7497     this->count = 0;
7498
7499     if(basic_istream_char_sentry_create(this, TRUE)) {
7500         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7501
7502         while(count > 0) {
7503             ch = basic_streambuf_char_sbumpc(strbuf);
7504
7505             if(ch==EOF || ch==delim)
7506                 break;
7507
7508             this->count++;
7509             if(count != INT_MAX)
7510                 count--;
7511         }
7512     }
7513     basic_istream_char_sentry_destroy(this);
7514
7515     if(ch == EOF)
7516         basic_ios_char_setstate(base, IOSTATE_eofbit);
7517     return this;
7518 }
7519
7520 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7521 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7522 DEFINE_THISCALL_WRAPPER(basic_istream_char_peek, 4)
7523 int __thiscall basic_istream_char_peek(basic_istream_char *this)
7524 {
7525     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7526     int ret = EOF;
7527
7528     TRACE("(%p)\n", this);
7529
7530     this->count = 0;
7531
7532     if(basic_istream_char_sentry_create(this, TRUE))
7533         ret = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
7534     basic_istream_char_sentry_destroy(this);
7535     return ret;
7536 }
7537
7538 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADIH@Z */
7539 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_K_J@Z */
7540 DEFINE_THISCALL_WRAPPER(basic_istream_char__Read_s, 20)
7541 basic_istream_char* __thiscall basic_istream_char__Read_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
7542 {
7543     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7544     IOSB_iostate state = IOSTATE_goodbit;
7545
7546     TRACE("(%p %p %lu %s)\n", this, str, size, wine_dbgstr_longlong(count));
7547
7548     if(basic_istream_char_sentry_create(this, TRUE)) {
7549         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7550
7551         this->count = basic_streambuf_char__Sgetn_s(strbuf, str, size, count);
7552         if(this->count != count)
7553             state |= IOSTATE_failbit | IOSTATE_eofbit;
7554     }else {
7555         this->count = 0;
7556     }
7557     basic_istream_char_sentry_destroy(this);
7558
7559     basic_ios_char_setstate(base, state);
7560     return this;
7561 }
7562
7563 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7564 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7565 DEFINE_THISCALL_WRAPPER(basic_istream_char_read, 16)
7566 basic_istream_char* __thiscall basic_istream_char_read(basic_istream_char *this, char *str, streamsize count)
7567 {
7568     return basic_istream_char__Read_s(this, str, count, count);
7569 }
7570
7571 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
7572 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
7573 DEFINE_THISCALL_WRAPPER(basic_istream_char__Readsome_s, 20)
7574 streamsize __thiscall basic_istream_char__Readsome_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
7575 {
7576     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7577     IOSB_iostate state = IOSTATE_goodbit;
7578
7579     TRACE("(%p %p %lu %s)\n", this, str, size, wine_dbgstr_longlong(count));
7580
7581     this->count = 0;
7582
7583     if(basic_istream_char_sentry_create(this, TRUE)) {
7584         streamsize avail = basic_streambuf_char_in_avail(basic_ios_char_rdbuf_get(base));
7585         if(avail > count)
7586             avail = count;
7587
7588         if(avail == -1)
7589             state |= IOSTATE_eofbit;
7590         else if(avail > 0)
7591             basic_istream_char__Read_s(this, str, size, avail);
7592     }else {
7593         state |= IOSTATE_failbit;
7594     }
7595     basic_istream_char_sentry_destroy(this);
7596
7597     basic_ios_char_setstate(base, state);
7598     return this->count;
7599 }
7600
7601 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
7602 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
7603 DEFINE_THISCALL_WRAPPER(basic_istream_char_readsome, 16)
7604 streamsize __thiscall basic_istream_char_readsome(basic_istream_char *this, char *str, streamsize count)
7605 {
7606     return basic_istream_char__Readsome_s(this, str, count, count);
7607 }
7608
7609 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
7610 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
7611 DEFINE_THISCALL_WRAPPER(basic_istream_char_putback, 8)
7612 basic_istream_char* __thiscall basic_istream_char_putback(basic_istream_char *this, char ch)
7613 {
7614     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7615     IOSB_iostate state = IOSTATE_goodbit;
7616
7617     TRACE("(%p %c)\n", this, ch);
7618
7619     this->count = 0;
7620
7621     if(basic_istream_char_sentry_create(this, TRUE)) {
7622         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7623
7624         if(!ios_base_good(&base->base))
7625             state |= IOSTATE_failbit;
7626         else if(!strbuf || basic_streambuf_char_sputbackc(strbuf, ch)==EOF)
7627             state |= IOSTATE_badbit;
7628     }
7629     basic_istream_char_sentry_destroy(this);
7630
7631     basic_ios_char_setstate(base, state);
7632     return this;
7633 }
7634
7635 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
7636 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
7637 DEFINE_THISCALL_WRAPPER(basic_istream_char_unget, 4)
7638 basic_istream_char* __thiscall basic_istream_char_unget(basic_istream_char *this)
7639 {
7640     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7641     IOSB_iostate state = IOSTATE_goodbit;
7642
7643     TRACE("(%p)\n", this);
7644
7645     this->count = 0;
7646
7647     if(basic_istream_char_sentry_create(this, TRUE)) {
7648         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7649
7650         if(!ios_base_good(&base->base))
7651             state |= IOSTATE_failbit;
7652         else if(!strbuf || basic_streambuf_char_sungetc(strbuf)==EOF)
7653             state |= IOSTATE_badbit;
7654     }
7655     basic_istream_char_sentry_destroy(this);
7656
7657     basic_ios_char_setstate(base, state);
7658     return this;
7659 }
7660
7661 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7662 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7663 DEFINE_THISCALL_WRAPPER(basic_istream_char_sync, 4)
7664 int __thiscall basic_istream_char_sync(basic_istream_char *this)
7665 {
7666     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7667     basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7668
7669     TRACE("(%p)\n", this);
7670
7671     if(!strbuf)
7672         return -1;
7673
7674     if(basic_istream_char_sentry_create(this, TRUE)) {
7675         if(basic_streambuf_char_pubsync(strbuf) != -1) {
7676             basic_istream_char_sentry_destroy(this);
7677             return 0;
7678         }
7679     }
7680     basic_istream_char_sentry_destroy(this);
7681
7682     basic_ios_char_setstate(base, IOSTATE_badbit);
7683     return -1;
7684 }
7685
7686 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
7687 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
7688 DEFINE_THISCALL_WRAPPER(basic_istream_char_tellg, 8)
7689 fpos_int* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpos_int *ret)
7690 {
7691     TRACE("(%p %p)\n", this, ret);
7692
7693     if(basic_istream_char_sentry_create(this, TRUE)) {
7694         basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7695         if(!ios_base_fail(&base->base)) {
7696             basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
7697                     ret, 0, SEEKDIR_cur, OPENMODE_in);
7698             basic_istream_char_sentry_destroy(this);
7699
7700             if(ret->off==0 && ret->pos==-1 && ret->state==0)
7701                 basic_ios_char_setstate(base, IOSTATE_failbit);
7702             return ret;
7703         }
7704     }
7705     basic_istream_char_sentry_destroy(this);
7706
7707     ret->off = 0;
7708     ret->pos = -1;
7709     ret->state = 0;
7710     return ret;
7711 }
7712
7713 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
7714 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
7715 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg, 16)
7716 basic_istream_char* __thiscall basic_istream_char_seekg(basic_istream_char *this, streamoff off, int dir)
7717 {
7718     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7719
7720     TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), dir);
7721
7722     if(basic_istream_char_sentry_create(this, TRUE)) {
7723         if(!ios_base_fail(&base->base)) {
7724             basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7725             fpos_int ret;
7726
7727             basic_streambuf_char_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
7728             basic_istream_char_sentry_destroy(this);
7729
7730             if(ret.off==0 && ret.pos==-1 && ret.state==0)
7731                 basic_ios_char_setstate(base, IOSTATE_failbit);
7732             else
7733                 basic_ios_char_clear(base, IOSTATE_goodbit);
7734             return this;
7735         }
7736     }
7737     basic_istream_char_sentry_destroy(this);
7738
7739     basic_ios_char_setstate(base, IOSTATE_failbit);
7740     return this;
7741 }
7742
7743 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
7744 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
7745 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg_fpos, 28)
7746 basic_istream_char* __thiscall basic_istream_char_seekg_fpos(basic_istream_char *this, fpos_int pos)
7747 {
7748     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7749
7750     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
7751
7752     if(basic_istream_char_sentry_create(this, TRUE)) {
7753         if(!ios_base_fail(&base->base)) {
7754             basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7755             fpos_int ret;
7756
7757             basic_streambuf_char_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
7758             basic_istream_char_sentry_destroy(this);
7759
7760             if(ret.off==0 && ret.pos==-1 && ret.state==0)
7761                 basic_ios_char_setstate(base, IOSTATE_failbit);
7762             else
7763                 basic_ios_char_clear(base, IOSTATE_goodbit);
7764             return this;
7765         }
7766     }
7767     basic_istream_char_sentry_destroy(this);
7768
7769     basic_ios_char_setstate(base, IOSTATE_failbit);
7770     return this;
7771 }
7772
7773 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAF@Z */
7774 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAF@Z */
7775 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_short, 8)
7776 basic_istream_char* __thiscall basic_istream_char_read_short(basic_istream_char *this, short *v)
7777 {
7778     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7779     int state = IOSTATE_goodbit;
7780
7781     TRACE("(%p %p)\n", this, v);
7782
7783     if(basic_istream_char_sentry_create(this, FALSE)) {
7784         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7785         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7786         istreambuf_iterator_char first={0}, last={0};
7787         LONG tmp;
7788
7789         first.strbuf = strbuf;
7790         num_get_char_get_long(numget, &last, first, last, &base->base, &state, &tmp);
7791
7792         if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
7793             *v = tmp;
7794         else
7795             state |= IOSTATE_failbit;
7796     }
7797     basic_istream_char_sentry_destroy(this);
7798
7799     basic_ios_char_setstate(base, state);
7800     return this;
7801 }
7802
7803 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAG@Z */
7804 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAG@Z */
7805 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ushort, 8)
7806 basic_istream_char* __thiscall basic_istream_char_read_ushort(basic_istream_char *this, unsigned short *v)
7807 {
7808     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7809     int state = IOSTATE_goodbit;
7810
7811     TRACE("(%p %p)\n", this, v);
7812
7813     if(basic_istream_char_sentry_create(this, FALSE)) {
7814         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7815         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7816         istreambuf_iterator_char first={0}, last={0};
7817
7818         first.strbuf = strbuf;
7819         num_get_char_get_ushort(numget, &last, first, last, &base->base, &state, v);
7820     }
7821     basic_istream_char_sentry_destroy(this);
7822
7823     basic_ios_char_setstate(base, state);
7824     return this;
7825 }
7826
7827 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z */
7828 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAH@Z */
7829 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int, 8)
7830 basic_istream_char* __thiscall basic_istream_char_read_int(basic_istream_char *this, int *v)
7831 {
7832     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7833     int state = IOSTATE_goodbit;
7834
7835     TRACE("(%p %p)\n", this, v);
7836
7837     if(basic_istream_char_sentry_create(this, FALSE)) {
7838         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7839         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7840         istreambuf_iterator_char first={0}, last={0};
7841
7842         first.strbuf = strbuf;
7843         num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
7844     }
7845     basic_istream_char_sentry_destroy(this);
7846
7847     basic_ios_char_setstate(base, state);
7848     return this;
7849 }
7850
7851 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAI@Z */
7852 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAI@Z */
7853 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint, 8)
7854 basic_istream_char* __thiscall basic_istream_char_read_uint(basic_istream_char *this, unsigned int *v)
7855 {
7856     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7857     int state = IOSTATE_goodbit;
7858
7859     TRACE("(%p %p)\n", this, v);
7860
7861     if(basic_istream_char_sentry_create(this, FALSE)) {
7862         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7863         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7864         istreambuf_iterator_char first={0}, last={0};
7865
7866         first.strbuf = strbuf;
7867         num_get_char_get_uint(numget, &last, first, last, &base->base, &state, v);
7868     }
7869     basic_istream_char_sentry_destroy(this);
7870
7871     basic_ios_char_setstate(base, state);
7872     return this;
7873 }
7874
7875 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAJ@Z */
7876 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAJ@Z */
7877 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_long, 8)
7878 basic_istream_char* __thiscall basic_istream_char_read_long(basic_istream_char *this, LONG *v)
7879 {
7880     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7881     int state = IOSTATE_goodbit;
7882
7883     TRACE("(%p %p)\n", this, v);
7884
7885     if(basic_istream_char_sentry_create(this, FALSE)) {
7886         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7887         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7888         istreambuf_iterator_char first={0}, last={0};
7889
7890         first.strbuf = strbuf;
7891         num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
7892     }
7893     basic_istream_char_sentry_destroy(this);
7894
7895     basic_ios_char_setstate(base, state);
7896     return this;
7897 }
7898
7899 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAK@Z */
7900 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAK@Z */
7901 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ulong, 8)
7902 basic_istream_char* __thiscall basic_istream_char_read_ulong(basic_istream_char *this, ULONG *v)
7903 {
7904     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7905     int state = IOSTATE_goodbit;
7906
7907     TRACE("(%p %p)\n", this, v);
7908
7909     if(basic_istream_char_sentry_create(this, FALSE)) {
7910         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7911         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7912         istreambuf_iterator_char first={0}, last={0};
7913
7914         first.strbuf = strbuf;
7915         num_get_char_get_ulong(numget, &last, first, last, &base->base, &state, v);
7916     }
7917     basic_istream_char_sentry_destroy(this);
7918
7919     basic_ios_char_setstate(base, state);
7920     return this;
7921 }
7922
7923 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAM@Z */
7924 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAM@Z */
7925 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_float, 8)
7926 basic_istream_char* __thiscall basic_istream_char_read_float(basic_istream_char *this, float *v)
7927 {
7928     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7929     int state = IOSTATE_goodbit;
7930
7931     TRACE("(%p %p)\n", this, v);
7932
7933     if(basic_istream_char_sentry_create(this, FALSE)) {
7934         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7935         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7936         istreambuf_iterator_char first={0}, last={0};
7937
7938         first.strbuf = strbuf;
7939         num_get_char_get_float(numget, &last, first, last, &base->base, &state, v);
7940     }
7941     basic_istream_char_sentry_destroy(this);
7942
7943     basic_ios_char_setstate(base, state);
7944     return this;
7945 }
7946
7947 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAN@Z */
7948 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAN@Z */
7949 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_double, 8)
7950 basic_istream_char* __thiscall basic_istream_char_read_double(basic_istream_char *this, double *v)
7951 {
7952     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7953     int state = IOSTATE_goodbit;
7954
7955     TRACE("(%p %p)\n", this, v);
7956
7957     if(basic_istream_char_sentry_create(this, FALSE)) {
7958         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7959         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7960         istreambuf_iterator_char first={0}, last={0};
7961
7962         first.strbuf = strbuf;
7963         num_get_char_get_double(numget, &last, first, last, &base->base, &state, v);
7964     }
7965     basic_istream_char_sentry_destroy(this);
7966
7967     basic_ios_char_setstate(base, state);
7968     return this;
7969 }
7970
7971 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAO@Z */
7972 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAO@Z */
7973 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ldouble, 8)
7974 basic_istream_char* __thiscall basic_istream_char_read_ldouble(basic_istream_char *this, double *v)
7975 {
7976     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7977     int state = IOSTATE_goodbit;
7978
7979     TRACE("(%p %p)\n", this, v);
7980
7981     if(basic_istream_char_sentry_create(this, FALSE)) {
7982         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7983         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7984         istreambuf_iterator_char first={0}, last={0};
7985
7986         first.strbuf = strbuf;
7987         num_get_char_get_ldouble(numget, &last, first, last, &base->base, &state, v);
7988     }
7989     basic_istream_char_sentry_destroy(this);
7990
7991     basic_ios_char_setstate(base, state);
7992     return this;
7993 }
7994
7995 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAPAX@Z */
7996 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
7997 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ptr, 8)
7998 basic_istream_char* __thiscall basic_istream_char_read_ptr(basic_istream_char *this, void **v)
7999 {
8000     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8001     int state = IOSTATE_goodbit;
8002
8003     TRACE("(%p %p)\n", this, v);
8004
8005     if(basic_istream_char_sentry_create(this, FALSE)) {
8006         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8007         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8008         istreambuf_iterator_char first={0}, last={0};
8009
8010         first.strbuf = strbuf;
8011         num_get_char_get_void(numget, &last, first, last, &base->base, &state, v);
8012     }
8013     basic_istream_char_sentry_destroy(this);
8014
8015     basic_ios_char_setstate(base, state);
8016     return this;
8017 }
8018
8019 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_J@Z */
8020 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_J@Z */
8021 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int64, 8)
8022 basic_istream_char* __thiscall basic_istream_char_read_int64(basic_istream_char *this, __int64 *v)
8023 {
8024     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8025     int state = IOSTATE_goodbit;
8026
8027     TRACE("(%p %p)\n", this, v);
8028
8029     if(basic_istream_char_sentry_create(this, FALSE)) {
8030         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8031         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8032         istreambuf_iterator_char first={0}, last={0};
8033
8034         first.strbuf = strbuf;
8035         num_get_char_get_int64(numget, &last, first, last, &base->base, &state, v);
8036     }
8037     basic_istream_char_sentry_destroy(this);
8038
8039     basic_ios_char_setstate(base, state);
8040     return this;
8041 }
8042
8043 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_K@Z */
8044 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_K@Z */
8045 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint64, 8)
8046 basic_istream_char* __thiscall basic_istream_char_read_uint64(basic_istream_char *this, unsigned __int64 *v)
8047 {
8048     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8049     int state = IOSTATE_goodbit;
8050
8051     TRACE("(%p %p)\n", this, v);
8052
8053     if(basic_istream_char_sentry_create(this, FALSE)) {
8054         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8055         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8056         istreambuf_iterator_char first={0}, last={0};
8057
8058         first.strbuf = strbuf;
8059         num_get_char_get_uint64(numget, &last, first, last, &base->base, &state, v);
8060     }
8061     basic_istream_char_sentry_destroy(this);
8062
8063     basic_ios_char_setstate(base, state);
8064     return this;
8065 }
8066
8067 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_N@Z */
8068 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_N@Z */
8069 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_bool, 8)
8070 basic_istream_char* __thiscall basic_istream_char_read_bool(basic_istream_char *this, MSVCP_bool *v)
8071 {
8072     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8073     int state = IOSTATE_goodbit;
8074
8075     TRACE("(%p %p)\n", this, v);
8076
8077     if(basic_istream_char_sentry_create(this, FALSE)) {
8078         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8079         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8080         istreambuf_iterator_char first={0}, last={0};
8081
8082         first.strbuf = strbuf;
8083         num_get_char_get_bool(numget, &last, first, last, &base->base, &state, v);
8084     }
8085     basic_istream_char_sentry_destroy(this);
8086
8087     basic_ios_char_setstate(base, state);
8088     return this;
8089 }
8090
8091 /* ??$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 */
8092 /* ??$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 */
8093 basic_istream_char* __cdecl basic_istream_char_getline_bstr_delim(
8094         basic_istream_char *istream, basic_string_char *str, char delim)
8095 {
8096     IOSB_iostate state = IOSTATE_failbit;
8097     int c = delim;
8098
8099     TRACE("(%p %p %c)\n", istream, str, delim);
8100
8101     if(basic_istream_char_sentry_create(istream, TRUE)) {
8102         MSVCP_basic_string_char_clear(str);
8103
8104         for(c = basic_istream_char_get(istream); c!=delim && c!=EOF;
8105                 c = basic_istream_char_get(istream)) {
8106             state = IOSTATE_goodbit;
8107             MSVCP_basic_string_char_append_ch(str, c);
8108         }
8109     }
8110     basic_istream_char_sentry_destroy(istream);
8111
8112     basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream),
8113         state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8114     return istream;
8115 }
8116
8117 /* ??$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 */
8118 /* ??$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 */
8119 basic_istream_char* __cdecl basic_istream_char_getline_bstr(
8120         basic_istream_char *istream, basic_string_char *str)
8121 {
8122     return basic_istream_char_getline_bstr_delim(istream, str, '\n');
8123 }
8124
8125 /* ??$?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 */
8126 /* ??$?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 */
8127 basic_istream_char* __cdecl basic_istream_char_read_bstr(
8128         basic_istream_char *istream, basic_string_char *str)
8129 {
8130     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8131     IOSB_iostate state = IOSTATE_failbit;
8132     int c = '\n';
8133
8134     TRACE("(%p %p)\n", istream, str);
8135
8136     if(basic_istream_char_sentry_create(istream, FALSE)) {
8137         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
8138         MSVCP_size_t count = ios_base_width_get(&base->base);
8139
8140         if(!count)
8141             count = -1;
8142
8143         MSVCP_basic_string_char_clear(str);
8144
8145         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
8146                 c!=EOF && !ctype_char_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
8147                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base)), count--) {
8148             state = IOSTATE_goodbit;
8149             MSVCP_basic_string_char_append_ch(str, c);
8150         }
8151     }
8152     basic_istream_char_sentry_destroy(istream);
8153
8154     ios_base_width_set(&base->base, 0);
8155     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8156     return istream;
8157 }
8158
8159 /* ??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAD@Z */
8160 /* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAD@Z */
8161 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAC@Z */
8162 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAC@Z */
8163 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAE@Z */
8164 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAE@Z */
8165 basic_istream_char* __cdecl basic_istream_char_read_str(basic_istream_char *istream, char *str)
8166 {
8167     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8168     IOSB_iostate state = IOSTATE_failbit;
8169     int c = '\n';
8170
8171     TRACE("(%p %p)\n", istream, str);
8172
8173     if(basic_istream_char_sentry_create(istream, FALSE)) {
8174         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
8175         MSVCP_size_t count = ios_base_width_get(&base->base)-1;
8176
8177         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
8178                 c!=EOF && !ctype_char_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
8179                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base)), count--) {
8180             state = IOSTATE_goodbit;
8181             *str++ = c;
8182         }
8183     }
8184     basic_istream_char_sentry_destroy(istream);
8185
8186     *str = 0;
8187     ios_base_width_set(&base->base, 0);
8188     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8189     return istream;
8190 }
8191
8192 /* ??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAD@Z */
8193 /* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAD@Z */
8194 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z */
8195 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAC@Z */
8196 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z */
8197 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAE@Z */
8198 basic_istream_char* __cdecl basic_istream_char_read_ch(basic_istream_char *istream, char *ch)
8199 {
8200     IOSB_iostate state = IOSTATE_failbit;
8201     int c = 0;
8202
8203     TRACE("(%p %p)\n", istream, ch);
8204
8205     if(basic_istream_char_sentry_create(istream, FALSE)) {
8206         c = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(
8207                     basic_istream_char_get_basic_ios(istream)));
8208         if(c != EOF) {
8209             state = IOSTATE_goodbit;
8210             *ch = c;
8211         }
8212     }
8213     basic_istream_char_sentry_destroy(istream);
8214
8215     basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream),
8216             state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8217     return istream;
8218 }
8219
8220 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
8221 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
8222 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_streambuf, 8)
8223 basic_istream_char* __thiscall basic_istream_char_read_streambuf(
8224         basic_istream_char *this, basic_streambuf_char *streambuf)
8225 {
8226     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8227     IOSB_iostate state = IOSTATE_failbit;
8228     int c = '\n';
8229
8230     TRACE("(%p %p)\n", this, streambuf);
8231
8232     if(basic_istream_char_sentry_create(this, FALSE)) {
8233         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base)); c!=EOF;
8234                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base))) {
8235             state = IOSTATE_goodbit;
8236             if(basic_streambuf_char_sputc(streambuf, c) == EOF)
8237                 break;
8238         }
8239     }
8240     basic_istream_char_sentry_destroy(this);
8241
8242     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8243     return this;
8244 }
8245
8246 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
8247 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
8248 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func, 8)
8249 basic_istream_char* __thiscall basic_istream_char_read_func(basic_istream_char *this,
8250         basic_istream_char* (__cdecl *pfunc)(basic_istream_char*))
8251 {
8252     TRACE("(%p %p)\n", this, pfunc);
8253     pfunc(this);
8254     return this;
8255 }
8256
8257 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
8258 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
8259 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_basic_ios, 8)
8260 basic_istream_char* __thiscall basic_istream_char_read_func_basic_ios(basic_istream_char *this,
8261         basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
8262 {
8263     TRACE("(%p %p)\n", this, pfunc);
8264     pfunc(basic_istream_char_get_basic_ios(this));
8265     return this;
8266 }
8267
8268 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
8269 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
8270 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_ios_base, 8)
8271 basic_istream_char* __thiscall basic_istream_char_read_func_ios_base(basic_istream_char *this,
8272         ios_base* (__cdecl *pfunc)(ios_base*))
8273 {
8274     TRACE("(%p %p)\n", this, pfunc);
8275     pfunc(&basic_istream_char_get_basic_ios(this)->base);
8276     return this;
8277 }
8278
8279 /* Caution: basic_istream uses virtual inheritance. */
8280 static inline basic_ios_wchar* basic_istream_wchar_get_basic_ios(basic_istream_wchar *this)
8281 {
8282     return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
8283 }
8284
8285 static inline basic_ios_wchar* basic_istream_wchar_to_basic_ios(basic_istream_wchar *ptr)
8286 {
8287     return (basic_ios_wchar*)((char*)ptr+basic_istream_wchar_vbtable[1]);
8288 }
8289
8290 static inline basic_istream_wchar* basic_istream_wchar_from_basic_ios(basic_ios_wchar *ptr)
8291 {
8292     return (basic_istream_wchar*)((char*)ptr-basic_istream_wchar_vbtable[1]);
8293 }
8294
8295 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
8296 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
8297 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_init, 20)
8298 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_init(basic_istream_wchar *this,
8299         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
8300 {
8301     basic_ios_wchar *base;
8302
8303     TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
8304
8305     if(virt_init) {
8306         this->vbtable = basic_istream_wchar_vbtable;
8307         base = basic_istream_wchar_get_basic_ios(this);
8308         basic_ios_wchar_ctor(base);
8309     }else {
8310         base = basic_istream_wchar_get_basic_ios(this);
8311     }
8312
8313     base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
8314     this->count = 0;
8315     if(!noinit)
8316         basic_ios_wchar_init(base, strbuf, isstd);
8317     return this;
8318 }
8319
8320 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
8321 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
8322 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_init, 20)
8323 basic_istream_wchar* __thiscall basic_istream_short_ctor_init(basic_istream_wchar *this,
8324         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
8325 {
8326     basic_istream_wchar_ctor_init(this, strbuf, isstd, noinit, virt_init);
8327     basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
8328     return this;
8329 }
8330
8331 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
8332 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
8333 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor, 16)
8334 basic_istream_wchar* __thiscall basic_istream_wchar_ctor(basic_istream_wchar *this,
8335         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
8336 {
8337     return basic_istream_wchar_ctor_init(this, strbuf, isstd, FALSE, virt_init);
8338 }
8339
8340 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
8341 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
8342 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor, 16)
8343 basic_istream_wchar* __thiscall basic_istream_short_ctor(basic_istream_wchar *this,
8344         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
8345 {
8346     return basic_istream_short_ctor_init(this, strbuf, isstd, FALSE, virt_init);
8347 }
8348
8349 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
8350 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
8351 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_uninitialized, 12)
8352 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_uninitialized(
8353         basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
8354 {
8355     basic_ios_wchar *base;
8356
8357     TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
8358
8359     if(virt_init) {
8360         this->vbtable = basic_istream_wchar_vbtable;
8361         base = basic_istream_wchar_get_basic_ios(this);
8362         basic_ios_wchar_ctor(base);
8363     }else {
8364         base = basic_istream_wchar_get_basic_ios(this);
8365     }
8366
8367     base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
8368     ios_base_Addstd(&base->base);
8369     return this;
8370 }
8371
8372 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
8373 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
8374 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_uninitialized, 12)
8375 basic_istream_wchar* __thiscall basic_istream_short_ctor_uninitialized(
8376         basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
8377 {
8378     basic_istream_wchar_ctor_uninitialized(this, uninitialized, virt_init);
8379     basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
8380     return this;
8381 }
8382
8383 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
8384 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
8385 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UAE@XZ */
8386 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
8387 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_dtor, 4)
8388 void __thiscall basic_istream_wchar_dtor(basic_ios_wchar *base)
8389 {
8390     basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
8391
8392     /* don't destroy virtual base here */
8393     TRACE("(%p)\n", this);
8394 }
8395
8396 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
8397 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
8398 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
8399 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
8400 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vbase_dtor, 4)
8401 void __thiscall basic_istream_wchar_vbase_dtor(basic_istream_wchar *this)
8402 {
8403     TRACE("(%p)\n", this);
8404     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(this));
8405     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(this));
8406 }
8407
8408 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vector_dtor, 8)
8409 basic_istream_wchar* __thiscall basic_istream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
8410 {
8411     basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
8412
8413     TRACE("(%p %x)\n", this, flags);
8414
8415     if(flags & 2) {
8416         /* we have an array, with the number of elements stored before the first object */
8417         int i, *ptr = (int *)this-1;
8418
8419         for(i=*ptr-1; i>=0; i--)
8420             basic_istream_wchar_vbase_dtor(this+i);
8421         MSVCRT_operator_delete(ptr);
8422     } else {
8423         basic_istream_wchar_vbase_dtor(this);
8424         if(flags & 1)
8425             MSVCRT_operator_delete(this);
8426     }
8427
8428     return this;
8429 }
8430
8431 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
8432 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
8433 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
8434 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
8435 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Ipfx, 8)
8436 MSVCP_bool __thiscall basic_istream_wchar__Ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
8437 {
8438     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8439
8440     TRACE("(%p %d)\n", this, noskip);
8441
8442     if(!ios_base_good(&base->base)) {
8443         basic_ios_wchar_setstate(base, IOSTATE_failbit);
8444         return FALSE;
8445     }
8446
8447     if(basic_ios_wchar_tie_get(base))
8448         basic_ostream_wchar_flush(basic_ios_wchar_tie_get(base));
8449
8450     if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
8451         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8452         const ctype_wchar *ctype = ctype_wchar_use_facet(base->strbuf->loc);
8453         int ch;
8454
8455         for(ch = basic_streambuf_wchar_sgetc(strbuf); ;
8456                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8457             if(ch == WEOF) {
8458                 basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8459                 return FALSE;
8460             }
8461
8462             if(!ctype_wchar_is_ch(ctype, _SPACE|_BLANK, ch))
8463                 break;
8464         }
8465     }
8466
8467     return TRUE;
8468 }
8469
8470 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
8471 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
8472 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
8473 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
8474 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ipfx, 8)
8475 MSVCP_bool __thiscall basic_istream_wchar_ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
8476 {
8477     return basic_istream_wchar__Ipfx(this, noskip);
8478 }
8479
8480 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
8481 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
8482 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
8483 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
8484 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_isfx, 4)
8485 void __thiscall basic_istream_wchar_isfx(basic_istream_wchar *this)
8486 {
8487     TRACE("(%p)\n", this);
8488 }
8489
8490 static BOOL basic_istream_wchar_sentry_create(basic_istream_wchar *istr, MSVCP_bool noskip)
8491 {
8492     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
8493
8494     if(basic_ios_wchar_rdbuf_get(base))
8495         basic_streambuf_wchar__Lock(base->strbuf);
8496
8497     return basic_istream_wchar_ipfx(istr, noskip);
8498 }
8499
8500 static void basic_istream_wchar_sentry_destroy(basic_istream_wchar *istr)
8501 {
8502     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
8503
8504     if(basic_ios_wchar_rdbuf_get(base))
8505         basic_streambuf_wchar__Unlock(base->strbuf);
8506 }
8507
8508 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QBEHXZ */
8509 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEBA_JXZ */
8510 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QBEHXZ */
8511 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QEBA_JXZ */
8512 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_gcount, 4)
8513 int __thiscall basic_istream_wchar_gcount(const basic_istream_wchar *this)
8514 {
8515     TRACE("(%p)\n", this);
8516     return this->count;
8517 }
8518
8519 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
8520 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
8521 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
8522 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
8523 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get, 4)
8524 unsigned short __thiscall basic_istream_wchar_get(basic_istream_wchar *this)
8525 {
8526     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8527     int ret;
8528
8529     TRACE("(%p)\n", this);
8530
8531     this->count = 0;
8532
8533     if(!basic_istream_wchar_sentry_create(this, TRUE)) {
8534         basic_istream_wchar_sentry_destroy(this);
8535         return WEOF;
8536     }
8537
8538     ret = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(base));
8539     basic_istream_wchar_sentry_destroy(this);
8540     if(ret == WEOF)
8541         basic_ios_wchar_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
8542     else
8543         this->count++;
8544
8545     return ret;
8546 }
8547
8548 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AA_W@Z */
8549 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEA_W@Z */
8550 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAG@Z */
8551 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAG@Z */
8552 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_ch, 8)
8553 basic_istream_wchar* __thiscall basic_istream_wchar_get_ch(basic_istream_wchar *this, wchar_t *ch)
8554 {
8555     unsigned short ret;
8556
8557     TRACE("(%p %p)\n", this, ch);
8558
8559     ret = basic_istream_wchar_get(this);
8560     if(ret != WEOF)
8561         *ch = (wchar_t)ret;
8562     return this;
8563 }
8564
8565 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
8566 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
8567 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
8568 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
8569 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str_delim, 20)
8570 basic_istream_wchar* __thiscall basic_istream_wchar_get_str_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
8571 {
8572     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8573     unsigned short ch = delim;
8574
8575     TRACE("(%p %p %s %c)\n", this, str, wine_dbgstr_longlong(count), delim);
8576
8577     this->count = 0;
8578
8579     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8580         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8581
8582         for(ch = basic_streambuf_wchar_sgetc(strbuf); count>1;
8583                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8584             if(ch==WEOF || ch==delim)
8585                 break;
8586
8587             *str++ = ch;
8588             this->count++;
8589             count--;
8590         }
8591     }
8592     basic_istream_wchar_sentry_destroy(this);
8593
8594     basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
8595             (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8596     if(count > 0)
8597         *str = 0;
8598     return this;
8599 }
8600
8601 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8602 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8603 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8604 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8605 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str, 16)
8606 basic_istream_wchar* __thiscall basic_istream_wchar_get_str(basic_istream_wchar *this, wchar_t *str, streamsize count)
8607 {
8608     return basic_istream_wchar_get_str_delim(this, str, count, '\n');
8609 }
8610
8611 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
8612 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
8613 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
8614 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
8615 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf_delim, 12)
8616 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf_delim(basic_istream_wchar *this, basic_streambuf_wchar *strbuf, wchar_t delim)
8617 {
8618     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8619     unsigned short ch = delim;
8620
8621     TRACE("(%p %p %c)\n", this, strbuf, delim);
8622
8623     this->count = 0;
8624
8625     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8626         basic_streambuf_wchar *strbuf_read = basic_ios_wchar_rdbuf_get(base);
8627
8628         for(ch = basic_streambuf_wchar_sgetc(strbuf_read); ;
8629                 ch = basic_streambuf_wchar_snextc(strbuf_read)) {
8630             if(ch==WEOF || ch==delim)
8631                 break;
8632
8633             if(basic_streambuf_wchar_sputc(strbuf, ch) == WEOF)
8634                 break;
8635             this->count++;
8636         }
8637     }
8638     basic_istream_wchar_sentry_destroy(this);
8639
8640     basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
8641             (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8642     return this;
8643 }
8644
8645 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
8646 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
8647 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
8648 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
8649 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf, 8)
8650 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf(basic_istream_wchar *this, basic_streambuf_wchar *strbuf)
8651 {
8652     return basic_istream_wchar_get_streambuf_delim(this, strbuf, '\n');
8653 }
8654
8655 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
8656 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
8657 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
8658 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
8659 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline_delim, 20)
8660 basic_istream_wchar* __thiscall basic_istream_wchar_getline_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
8661 {
8662     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8663     unsigned short ch = delim;
8664
8665     TRACE("(%p %p %s %c)\n", this, str, wine_dbgstr_longlong(count), delim);
8666
8667     this->count = 0;
8668
8669     if(basic_istream_wchar_sentry_create(this, TRUE) && count>0) {
8670         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8671
8672         while(count > 1) {
8673             ch = basic_streambuf_wchar_sbumpc(strbuf);
8674
8675             if(ch==WEOF || ch==delim)
8676                 break;
8677
8678             *str++ = ch;
8679             this->count++;
8680             count--;
8681         }
8682
8683         if(ch == delim)
8684             this->count++;
8685         else if(ch != WEOF) {
8686             ch = basic_streambuf_wchar_sgetc(strbuf);
8687
8688             if(ch == delim) {
8689                 basic_streambuf_wchar__Gninc(strbuf);
8690                 this->count++;
8691             }
8692         }
8693     }
8694     basic_istream_wchar_sentry_destroy(this);
8695
8696     basic_ios_wchar_setstate(base, (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
8697             (!this->count || (ch!=delim && ch!=WEOF) ? IOSTATE_failbit : IOSTATE_goodbit));
8698     if(count > 0)
8699         *str = 0;
8700     return this;
8701 }
8702
8703 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8704 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8705 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8706 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8707 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline, 16)
8708 basic_istream_wchar* __thiscall basic_istream_wchar_getline(basic_istream_wchar *this, wchar_t *str, streamsize count)
8709 {
8710     return basic_istream_wchar_getline_delim(this, str, count, '\n');
8711 }
8712
8713 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@HG@Z */
8714 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JG@Z */
8715 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@HG@Z */
8716 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JG@Z */
8717 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ignore, 16)
8718 basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar *this, streamsize count, unsigned short delim)
8719 {
8720     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8721     unsigned short ch = delim;
8722
8723     TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(count), delim);
8724
8725     this->count = 0;
8726
8727     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8728         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8729
8730         while(count > 0) {
8731             ch = basic_streambuf_wchar_sbumpc(strbuf);
8732
8733             if(ch==WEOF || ch==delim)
8734                 break;
8735
8736             this->count++;
8737             if(count != INT_MAX)
8738                 count--;
8739         }
8740     }
8741     basic_istream_wchar_sentry_destroy(this);
8742
8743     if(ch == WEOF)
8744         basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8745     return this;
8746 }
8747
8748 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
8749 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
8750 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
8751 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
8752 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_peek, 4)
8753 unsigned short __thiscall basic_istream_wchar_peek(basic_istream_wchar *this)
8754 {
8755     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8756     unsigned short ret = WEOF;
8757
8758     TRACE("(%p)\n", this);
8759
8760     this->count = 0;
8761
8762     if(basic_istream_wchar_sentry_create(this, TRUE))
8763         ret = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
8764     basic_istream_wchar_sentry_destroy(this);
8765     return ret;
8766 }
8767
8768 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WIH@Z */
8769 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_K_J@Z */
8770 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGIH@Z */
8771 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_K_J@Z */
8772 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Read_s, 20)
8773 basic_istream_wchar* __thiscall basic_istream_wchar__Read_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
8774 {
8775     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8776     IOSB_iostate state = IOSTATE_goodbit;
8777
8778     TRACE("(%p %p %lu %s)\n", this, str, size, wine_dbgstr_longlong(count));
8779
8780     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8781         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8782
8783         this->count = basic_streambuf_wchar__Sgetn_s(strbuf, str, size, count);
8784         if(this->count != count)
8785             state |= IOSTATE_failbit | IOSTATE_eofbit;
8786     }else {
8787         this->count = 0;
8788     }
8789     basic_istream_wchar_sentry_destroy(this);
8790
8791     basic_ios_wchar_setstate(base, state);
8792     return this;
8793 }
8794
8795 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8796 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8797 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8798 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8799 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read, 16)
8800 basic_istream_wchar* __thiscall basic_istream_wchar_read(basic_istream_wchar *this, wchar_t *str, streamsize count)
8801 {
8802     return basic_istream_wchar__Read_s(this, str, count, count);
8803 }
8804
8805 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
8806 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
8807 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
8808 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
8809 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Readsome_s, 20)
8810 streamsize __thiscall basic_istream_wchar__Readsome_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
8811 {
8812     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8813     IOSB_iostate state = IOSTATE_goodbit;
8814
8815     TRACE("(%p %p %lu %s)\n", this, str, size, wine_dbgstr_longlong(count));
8816
8817     this->count = 0;
8818
8819     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8820         streamsize avail = basic_streambuf_wchar_in_avail(basic_ios_wchar_rdbuf_get(base));
8821         if(avail > count)
8822             avail = count;
8823
8824         if(avail == -1)
8825             state |= IOSTATE_eofbit;
8826         else if(avail > 0)
8827             basic_istream_wchar__Read_s(this, str, size, avail);
8828     }else {
8829         state |= IOSTATE_failbit;
8830     }
8831     basic_istream_wchar_sentry_destroy(this);
8832
8833     basic_ios_wchar_setstate(base, state);
8834     return this->count;
8835 }
8836
8837 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
8838 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
8839 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
8840 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
8841 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_readsome, 16)
8842 streamsize __thiscall basic_istream_wchar_readsome(basic_istream_wchar *this, wchar_t *str, streamsize count)
8843 {
8844     return basic_istream_wchar__Readsome_s(this, str, count, count);
8845 }
8846
8847 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
8848 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
8849 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
8850 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
8851 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_putback, 8)
8852 basic_istream_wchar* __thiscall basic_istream_wchar_putback(basic_istream_wchar *this, wchar_t ch)
8853 {
8854     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8855     IOSB_iostate state = IOSTATE_goodbit;
8856
8857     TRACE("(%p %c)\n", this, ch);
8858
8859     this->count = 0;
8860
8861     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8862         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8863
8864         if(!ios_base_good(&base->base))
8865             state |= IOSTATE_failbit;
8866         else if(!strbuf || basic_streambuf_wchar_sputbackc(strbuf, ch)==WEOF)
8867             state |= IOSTATE_badbit;
8868     }
8869     basic_istream_wchar_sentry_destroy(this);
8870
8871     basic_ios_wchar_setstate(base, state);
8872     return this;
8873 }
8874
8875 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
8876 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
8877 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
8878 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
8879 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_unget, 4)
8880 basic_istream_wchar* __thiscall basic_istream_wchar_unget(basic_istream_wchar *this)
8881 {
8882     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8883     IOSB_iostate state = IOSTATE_goodbit;
8884
8885     TRACE("(%p)\n", this);
8886
8887     this->count = 0;
8888
8889     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8890         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8891
8892         if(!ios_base_good(&base->base))
8893             state |= IOSTATE_failbit;
8894         else if(!strbuf || basic_streambuf_wchar_sungetc(strbuf)==WEOF)
8895             state |= IOSTATE_badbit;
8896     }
8897     basic_istream_wchar_sentry_destroy(this);
8898
8899     basic_ios_wchar_setstate(base, state);
8900     return this;
8901 }
8902
8903 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
8904 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
8905 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHXZ */
8906 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAHXZ */
8907 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_sync, 4)
8908 int __thiscall basic_istream_wchar_sync(basic_istream_wchar *this)
8909 {
8910     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8911     basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8912
8913     TRACE("(%p)\n", this);
8914
8915     if(!strbuf)
8916         return -1;
8917
8918     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8919         if(basic_streambuf_wchar_pubsync(strbuf) != -1) {
8920             basic_istream_wchar_sentry_destroy(this);
8921             return 0;
8922         }
8923     }
8924     basic_istream_wchar_sentry_destroy(this);
8925
8926     basic_ios_wchar_setstate(base, IOSTATE_badbit);
8927     return -1;
8928 }
8929
8930 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
8931 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
8932 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
8933 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
8934 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_tellg, 8)
8935 fpos_int* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, fpos_int *ret)
8936 {
8937     TRACE("(%p %p)\n", this, ret);
8938
8939     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8940         basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8941         if(!ios_base_fail(&base->base)) {
8942             basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
8943                     ret, 0, SEEKDIR_cur, OPENMODE_in);
8944             basic_istream_wchar_sentry_destroy(this);
8945
8946             if(ret->off==0 && ret->pos==-1 && ret->state==0)
8947                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
8948             return ret;
8949         }
8950     }
8951     basic_istream_wchar_sentry_destroy(this);
8952
8953     ret->off = 0;
8954     ret->pos = -1;
8955     ret->state = 0;
8956     return ret;
8957 }
8958
8959 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
8960 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
8961 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
8962 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
8963 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg, 16)
8964 basic_istream_wchar* __thiscall basic_istream_wchar_seekg(basic_istream_wchar *this, streamoff off, int dir)
8965 {
8966     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8967
8968     TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), dir);
8969
8970     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8971         if(!ios_base_fail(&base->base)) {
8972             basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8973             fpos_int ret;
8974
8975             basic_streambuf_wchar_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
8976             basic_istream_wchar_sentry_destroy(this);
8977
8978             if(ret.off==0 && ret.pos==-1 && ret.state==0)
8979                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
8980             else
8981                 basic_ios_wchar_clear(base, IOSTATE_goodbit);
8982             return this;
8983         }
8984     }
8985     basic_istream_wchar_sentry_destroy(this);
8986
8987     basic_ios_wchar_setstate(base, IOSTATE_failbit);
8988     return this;
8989 }
8990
8991 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
8992 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
8993 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
8994 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
8995 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg_fpos, 28)
8996 basic_istream_wchar* __thiscall basic_istream_wchar_seekg_fpos(basic_istream_wchar *this, fpos_int pos)
8997 {
8998     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8999
9000     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
9001
9002     if(basic_istream_wchar_sentry_create(this, TRUE)) {
9003         if(!ios_base_fail(&base->base)) {
9004             basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9005             fpos_int ret;
9006
9007             basic_streambuf_wchar_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
9008             basic_istream_wchar_sentry_destroy(this);
9009
9010             if(ret.off==0 && ret.pos==-1 && ret.state==0)
9011                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
9012             else
9013                 basic_ios_wchar_clear(base, IOSTATE_goodbit);
9014             return this;
9015         }
9016     }
9017     basic_istream_wchar_sentry_destroy(this);
9018
9019     basic_ios_wchar_setstate(base, IOSTATE_failbit);
9020     return this;
9021 }
9022
9023 static basic_istream_wchar* basic_istream_read_short(basic_istream_wchar *this, short *v, const num_get *numget)
9024 {
9025     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9026     int state = IOSTATE_goodbit;
9027
9028     TRACE("(%p %p)\n", this, v);
9029
9030     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9031         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9032         istreambuf_iterator_wchar first={0}, last={0};
9033         LONG tmp;
9034
9035         first.strbuf = strbuf;
9036         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, &tmp);
9037
9038         if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
9039             *v = tmp;
9040         else
9041             state |= IOSTATE_failbit;
9042     }
9043     basic_istream_wchar_sentry_destroy(this);
9044
9045     basic_ios_wchar_setstate(base, state);
9046     return this;
9047 }
9048
9049 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAF@Z */
9050 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAF@Z */
9051 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_short, 8)
9052 basic_istream_wchar* __thiscall basic_istream_wchar_read_short(basic_istream_wchar *this, short *v)
9053 {
9054     return basic_istream_read_short(this, v, num_get_wchar_use_facet(
9055                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9056 }
9057
9058 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAF@Z */
9059 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAF@Z */
9060 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_short, 8)
9061 basic_istream_wchar* __thiscall basic_istream_short_read_short(basic_istream_wchar *this, short *v)
9062 {
9063     return basic_istream_read_short(this, v, num_get_short_use_facet(
9064                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9065 }
9066
9067 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAG@Z */
9068 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAG@Z */
9069 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ushort, 8)
9070 basic_istream_wchar* __thiscall basic_istream_wchar_read_ushort(basic_istream_wchar *this, unsigned short *v)
9071 {
9072     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9073     int state = IOSTATE_goodbit;
9074
9075     TRACE("(%p %p)\n", this, v);
9076
9077     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9078         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9079         const num_get *numget = num_get_wchar_use_facet(strbuf->loc);
9080         istreambuf_iterator_wchar first={0}, last={0};
9081
9082         first.strbuf = strbuf;
9083         num_get_wchar_get_ushort(numget, &last, first, last, &base->base, &state, v);
9084     }
9085     basic_istream_wchar_sentry_destroy(this);
9086
9087     basic_ios_wchar_setstate(base, state);
9088     return this;
9089 }
9090
9091 static basic_istream_wchar* basic_istream_read_int(basic_istream_wchar *this, int *v, const num_get *numget)
9092 {
9093     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9094     int state = IOSTATE_goodbit;
9095
9096     TRACE("(%p %p)\n", this, v);
9097
9098     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9099         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9100         istreambuf_iterator_wchar first={0}, last={0};
9101
9102         first.strbuf = strbuf;
9103         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
9104     }
9105     basic_istream_wchar_sentry_destroy(this);
9106
9107     basic_ios_wchar_setstate(base, state);
9108     return this;
9109 }
9110
9111 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAH@Z */
9112 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAH@Z */
9113 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int, 8)
9114 basic_istream_wchar* __thiscall basic_istream_wchar_read_int(basic_istream_wchar *this, int *v)
9115 {
9116     return basic_istream_read_int(this, v, num_get_wchar_use_facet(
9117                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9118 }
9119
9120 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAH@Z */
9121 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAH@Z */
9122 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int, 8)
9123 basic_istream_wchar* __thiscall basic_istream_short_read_int(basic_istream_wchar *this, int *v)
9124 {
9125     return basic_istream_read_int(this, v, num_get_short_use_facet(
9126                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9127 }
9128
9129 static basic_istream_wchar* basic_istream_read_uint(basic_istream_wchar *this, unsigned int *v, const num_get *numget)
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         istreambuf_iterator_wchar first={0}, last={0};
9139
9140         first.strbuf = strbuf;
9141         num_get_wchar_get_uint(numget, &last, first, last, &base->base, &state, v);
9142     }
9143     basic_istream_wchar_sentry_destroy(this);
9144
9145     basic_ios_wchar_setstate(base, state);
9146     return this;
9147 }
9148
9149 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAI@Z */
9150 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAI@Z */
9151 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint, 8)
9152 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint(basic_istream_wchar *this, unsigned int *v)
9153 {
9154     return basic_istream_read_uint(this, v, num_get_wchar_use_facet(
9155                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9156 }
9157
9158 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAI@Z */
9159 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAI@Z */
9160 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint, 8)
9161 basic_istream_wchar* __thiscall basic_istream_short_read_uint(basic_istream_wchar *this, unsigned int *v)
9162 {
9163     return basic_istream_read_uint(this, v, num_get_short_use_facet(
9164                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9165 }
9166
9167 static basic_istream_wchar* basic_istream_read_long(basic_istream_wchar *this, LONG *v, const num_get *numget)
9168 {
9169     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9170     int state = IOSTATE_goodbit;
9171
9172     TRACE("(%p %p)\n", this, v);
9173
9174     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9175         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9176         istreambuf_iterator_wchar first={0}, last={0};
9177
9178         first.strbuf = strbuf;
9179         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
9180     }
9181     basic_istream_wchar_sentry_destroy(this);
9182
9183     basic_ios_wchar_setstate(base, state);
9184     return this;
9185 }
9186
9187 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
9188 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
9189 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_long, 8)
9190 basic_istream_wchar* __thiscall basic_istream_wchar_read_long(basic_istream_wchar *this, LONG *v)
9191 {
9192     return basic_istream_read_long(this, v, num_get_wchar_use_facet(
9193                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9194 }
9195
9196 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
9197 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
9198 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_long, 8)
9199 basic_istream_wchar* __thiscall basic_istream_short_read_long(basic_istream_wchar *this, LONG *v)
9200 {
9201     return basic_istream_read_long(this, v, num_get_short_use_facet(
9202                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9203 }
9204
9205 static basic_istream_wchar* basic_istream_read_ulong(basic_istream_wchar *this, ULONG *v, const num_get *numget)
9206 {
9207     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9208     int state = IOSTATE_goodbit;
9209
9210     TRACE("(%p %p)\n", this, v);
9211
9212     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9213         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9214         istreambuf_iterator_wchar first={0}, last={0};
9215
9216         first.strbuf = strbuf;
9217         num_get_wchar_get_ulong(numget, &last, first, last, &base->base, &state, v);
9218     }
9219     basic_istream_wchar_sentry_destroy(this);
9220
9221     basic_ios_wchar_setstate(base, state);
9222     return this;
9223 }
9224
9225 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAK@Z */
9226 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAK@Z */
9227 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ulong, 8)
9228 basic_istream_wchar* __thiscall basic_istream_wchar_read_ulong(basic_istream_wchar *this, ULONG *v)
9229 {
9230     return basic_istream_read_ulong(this, v, num_get_wchar_use_facet(
9231                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9232 }
9233
9234 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAK@Z */
9235 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAK@Z */
9236 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ulong, 8)
9237 basic_istream_wchar* __thiscall basic_istream_short_read_ulong(basic_istream_wchar *this, ULONG *v)
9238 {
9239     return basic_istream_read_ulong(this, v, num_get_short_use_facet(
9240                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9241 }
9242
9243 static basic_istream_wchar* basic_istream_read_float(basic_istream_wchar *this, float *v, const num_get *numget)
9244 {
9245     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9246     int state = IOSTATE_goodbit;
9247
9248     TRACE("(%p %p)\n", this, v);
9249
9250     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9251         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9252         istreambuf_iterator_wchar first={0}, last={0};
9253
9254         first.strbuf = strbuf;
9255         num_get_wchar_get_float(numget, &last, first, last, &base->base, &state, v);
9256     }
9257     basic_istream_wchar_sentry_destroy(this);
9258
9259     basic_ios_wchar_setstate(base, state);
9260     return this;
9261 }
9262
9263 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAM@Z */
9264 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAM@Z */
9265 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_float, 8)
9266 basic_istream_wchar* __thiscall basic_istream_wchar_read_float(basic_istream_wchar *this, float *v)
9267 {
9268     return basic_istream_read_float(this, v, num_get_wchar_use_facet(
9269                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9270 }
9271
9272 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAM@Z */
9273 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAM@Z */
9274 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_float, 8)
9275 basic_istream_wchar* __thiscall basic_istream_short_read_float(basic_istream_wchar *this, float *v)
9276 {
9277     return basic_istream_read_float(this, v, num_get_short_use_facet(
9278                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9279 }
9280
9281 static basic_istream_wchar* basic_istream_read_double(basic_istream_wchar *this, double *v, const num_get *numget)
9282 {
9283     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9284     int state = IOSTATE_goodbit;
9285
9286     TRACE("(%p %p)\n", this, v);
9287
9288     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9289         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9290         istreambuf_iterator_wchar first={0}, last={0};
9291
9292         first.strbuf = strbuf;
9293         num_get_wchar_get_double(numget, &last, first, last, &base->base, &state, v);
9294     }
9295     basic_istream_wchar_sentry_destroy(this);
9296
9297     basic_ios_wchar_setstate(base, state);
9298     return this;
9299 }
9300
9301 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAN@Z */
9302 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAN@Z */
9303 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_double, 8)
9304 basic_istream_wchar* __thiscall basic_istream_wchar_read_double(basic_istream_wchar *this, double *v)
9305 {
9306     return basic_istream_read_double(this, v, num_get_wchar_use_facet(
9307                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9308 }
9309
9310 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAN@Z */
9311 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAN@Z */
9312 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_double, 8)
9313 basic_istream_wchar* __thiscall basic_istream_short_read_double(basic_istream_wchar *this, double *v)
9314 {
9315     return basic_istream_read_double(this, v, num_get_short_use_facet(
9316                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9317 }
9318
9319 static basic_istream_wchar* basic_istream_read_ldouble(basic_istream_wchar *this, double *v, const num_get *numget)
9320 {
9321     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9322     int state = IOSTATE_goodbit;
9323
9324     TRACE("(%p %p)\n", this, v);
9325
9326     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9327         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9328         istreambuf_iterator_wchar first={0}, last={0};
9329
9330         first.strbuf = strbuf;
9331         num_get_wchar_get_ldouble(numget, &last, first, last, &base->base, &state, v);
9332     }
9333     basic_istream_wchar_sentry_destroy(this);
9334
9335     basic_ios_wchar_setstate(base, state);
9336     return this;
9337 }
9338
9339 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAO@Z */
9340 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAO@Z */
9341 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ldouble, 8)
9342 basic_istream_wchar* __thiscall basic_istream_wchar_read_ldouble(basic_istream_wchar *this, double *v)
9343 {
9344     return basic_istream_read_ldouble(this, v, num_get_wchar_use_facet(
9345                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9346 }
9347
9348 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAO@Z */
9349 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAO@Z */
9350 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ldouble, 8)
9351 basic_istream_wchar* __thiscall basic_istream_short_read_ldouble(basic_istream_wchar *this, double *v)
9352 {
9353     return basic_istream_read_ldouble(this, v, num_get_short_use_facet(
9354                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9355 }
9356
9357 static basic_istream_wchar* basic_istream_read_ptr(basic_istream_wchar *this, void **v, const num_get *numget)
9358 {
9359     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9360     int state = IOSTATE_goodbit;
9361
9362     TRACE("(%p %p)\n", this, v);
9363
9364     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9365         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9366         istreambuf_iterator_wchar first={0}, last={0};
9367
9368         first.strbuf = strbuf;
9369         num_get_wchar_get_void(numget, &last, first, last, &base->base, &state, v);
9370     }
9371     basic_istream_wchar_sentry_destroy(this);
9372
9373     basic_ios_wchar_setstate(base, state);
9374     return this;
9375 }
9376
9377 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAPAX@Z */
9378 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
9379 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ptr, 8)
9380 basic_istream_wchar* __thiscall basic_istream_wchar_read_ptr(basic_istream_wchar *this, void **v)
9381 {
9382     return basic_istream_read_ptr(this, v, num_get_wchar_use_facet(
9383                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9384 }
9385
9386 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAPAX@Z */
9387 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
9388 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ptr, 8)
9389 basic_istream_wchar* __thiscall basic_istream_short_read_ptr(basic_istream_wchar *this, void **v)
9390 {
9391     return basic_istream_read_ptr(this, v, num_get_short_use_facet(
9392                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9393 }
9394
9395 static basic_istream_wchar* basic_istream_read_int64(basic_istream_wchar *this, __int64 *v, const num_get *numget)
9396 {
9397     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9398     int state = IOSTATE_goodbit;
9399
9400     TRACE("(%p %p)\n", this, v);
9401
9402     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9403         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9404         istreambuf_iterator_wchar first={0}, last={0};
9405
9406         first.strbuf = strbuf;
9407         num_get_wchar_get_int64(numget, &last, first, last, &base->base, &state, v);
9408     }
9409     basic_istream_wchar_sentry_destroy(this);
9410
9411     basic_ios_wchar_setstate(base, state);
9412     return this;
9413 }
9414
9415 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_J@Z */
9416 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_J@Z */
9417 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int64, 8)
9418 basic_istream_wchar* __thiscall basic_istream_wchar_read_int64(basic_istream_wchar *this, __int64 *v)
9419 {
9420     return basic_istream_read_int64(this, v, num_get_wchar_use_facet(
9421                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9422 }
9423
9424 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_J@Z */
9425 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_J@Z */
9426 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int64, 8)
9427 basic_istream_wchar* __thiscall basic_istream_short_read_int64(basic_istream_wchar *this, __int64 *v)
9428 {
9429     return basic_istream_read_int64(this, v, num_get_short_use_facet(
9430                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9431 }
9432
9433 static basic_istream_wchar* basic_istream_read_uint64(basic_istream_wchar *this, unsigned __int64 *v, const num_get *numget)
9434 {
9435     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9436     int state = IOSTATE_goodbit;
9437
9438     TRACE("(%p %p)\n", this, v);
9439
9440     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9441         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9442         istreambuf_iterator_wchar first={0}, last={0};
9443
9444         first.strbuf = strbuf;
9445         num_get_wchar_get_uint64(numget, &last, first, last, &base->base, &state, v);
9446     }
9447     basic_istream_wchar_sentry_destroy(this);
9448
9449     basic_ios_wchar_setstate(base, state);
9450     return this;
9451 }
9452
9453 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_K@Z */
9454 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_K@Z */
9455 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint64, 8)
9456 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
9457 {
9458     return basic_istream_read_uint64(this, v, num_get_wchar_use_facet(
9459                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9460 }
9461
9462 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_K@Z */
9463 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_K@Z */
9464 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint64, 8)
9465 basic_istream_wchar* __thiscall basic_istream_short_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
9466 {
9467     return basic_istream_read_uint64(this, v, num_get_short_use_facet(
9468                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9469 }
9470
9471 static basic_istream_wchar* basic_istream_read_bool(basic_istream_wchar *this, MSVCP_bool *v, const num_get *numget)
9472 {
9473     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9474     int state = IOSTATE_goodbit;
9475
9476     TRACE("(%p %p)\n", this, v);
9477
9478     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9479         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9480         istreambuf_iterator_wchar first={0}, last={0};
9481
9482         first.strbuf = strbuf;
9483         num_get_wchar_get_bool(numget, &last, first, last, &base->base, &state, v);
9484     }
9485     basic_istream_wchar_sentry_destroy(this);
9486
9487     basic_ios_wchar_setstate(base, state);
9488     return this;
9489 }
9490
9491 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_N@Z */
9492 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_N@Z */
9493 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_bool, 8)
9494 basic_istream_wchar* __thiscall basic_istream_wchar_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
9495 {
9496     return basic_istream_read_bool(this, v, num_get_wchar_use_facet(
9497                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9498 }
9499
9500 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_N@Z */
9501 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_N@Z */
9502 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_bool, 8)
9503 basic_istream_wchar* __thiscall basic_istream_short_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
9504 {
9505     return basic_istream_read_bool(this, v, num_get_short_use_facet(
9506                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9507 }
9508
9509 /* ??$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 */
9510 /* ??$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 */
9511 /* ??$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 */
9512 /* ??$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 */
9513 basic_istream_wchar* __cdecl basic_istream_wchar_getline_bstr_delim(
9514         basic_istream_wchar *istream, basic_string_wchar *str, wchar_t delim)
9515 {
9516     IOSB_iostate state = IOSTATE_failbit;
9517     int c = delim;
9518
9519     TRACE("(%p %p %c)\n", istream, str, delim);
9520
9521     if(basic_istream_wchar_sentry_create(istream, TRUE)) {
9522         MSVCP_basic_string_wchar_clear(str);
9523
9524         for(c = basic_istream_wchar_get(istream); c!=delim && c!=WEOF;
9525                 c = basic_istream_wchar_get(istream)) {
9526             state = IOSTATE_goodbit;
9527             MSVCP_basic_string_wchar_append_ch(str, c);
9528         }
9529     }
9530     basic_istream_wchar_sentry_destroy(istream);
9531
9532     basic_ios_wchar_setstate(basic_istream_wchar_get_basic_ios(istream),
9533             state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9534     return istream;
9535 }
9536
9537 /* ??$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 */
9538 /* ??$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 */
9539 /* ??$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 */
9540 /* ??$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 */
9541 basic_istream_wchar* __cdecl basic_istream_wchar_getline_bstr(
9542         basic_istream_wchar *istream, basic_string_wchar *str)
9543 {
9544     return basic_istream_wchar_getline_bstr_delim(istream, str, '\n');
9545 }
9546
9547 static basic_istream_wchar* basic_istream_read_bstr(basic_istream_wchar *istream,
9548         basic_string_wchar *str, const ctype_wchar *ctype)
9549 {
9550     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9551     IOSB_iostate state = IOSTATE_failbit;
9552     int c = '\n';
9553
9554     TRACE("(%p %p)\n", istream, str);
9555
9556     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9557         MSVCP_size_t count = ios_base_width_get(&base->base);
9558
9559         if(!count)
9560             count = -1;
9561
9562         MSVCP_basic_string_wchar_clear(str);
9563
9564         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
9565                 c!=WEOF && !ctype_wchar_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
9566                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base)), count--) {
9567             state = IOSTATE_goodbit;
9568             MSVCP_basic_string_wchar_append_ch(str, c);
9569         }
9570     }
9571     basic_istream_wchar_sentry_destroy(istream);
9572
9573     ios_base_width_set(&base->base, 0);
9574     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9575     return istream;
9576 }
9577
9578 /* ??$?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 */
9579 /* ??$?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 */
9580 basic_istream_wchar* __cdecl basic_istream_wchar_read_bstr(
9581         basic_istream_wchar *istream, basic_string_wchar *str)
9582 {
9583     return basic_istream_read_bstr(istream, str, ctype_wchar_use_facet(
9584                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9585 }
9586
9587 /* ??$?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 */
9588 /* ??$?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 */
9589 basic_istream_wchar* __cdecl basic_istream_short_read_bstr(
9590         basic_istream_wchar *istream, basic_string_wchar *str)
9591 {
9592     return basic_istream_read_bstr(istream, str, ctype_short_use_facet(
9593                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9594 }
9595
9596 basic_istream_wchar* basic_istream_read_str(basic_istream_wchar *istream, wchar_t *str, const ctype_wchar *ctype)
9597 {
9598     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9599     IOSB_iostate state = IOSTATE_failbit;
9600     unsigned short c = '\n';
9601
9602     TRACE("(%p %p)\n", istream, str);
9603
9604     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9605         MSVCP_size_t count = ios_base_width_get(&base->base)-1;
9606
9607         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
9608                 c!=WEOF && !ctype_wchar_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
9609                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base)), count--) {
9610             state = IOSTATE_goodbit;
9611             *str++ = c;
9612         }
9613     }
9614     basic_istream_wchar_sentry_destroy(istream);
9615
9616     *str = 0;
9617     ios_base_width_set(&base->base, 0);
9618     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9619     return istream;
9620 }
9621
9622 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@PA_W@Z */
9623 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@PEA_W@Z */
9624 basic_istream_wchar* __cdecl basic_istream_wchar_read_str(basic_istream_wchar *istream, wchar_t *str)
9625 {
9626     return basic_istream_read_str(istream, str, ctype_wchar_use_facet(
9627                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9628 }
9629
9630 /* ??$?5GU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@PAG@Z */
9631 /* ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@PEAG@Z */
9632 basic_istream_wchar* __cdecl basic_istream_short_read_str(basic_istream_wchar *istream, wchar_t *str)
9633 {
9634     return basic_istream_read_str(istream, str, ctype_short_use_facet(
9635                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9636 }
9637
9638 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AA_W@Z */
9639 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEA_W@Z */
9640 /* ??$?5GU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAG@Z */
9641 /* ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAG@Z */
9642 basic_istream_wchar* __cdecl basic_istream_wchar_read_ch(basic_istream_wchar *istream, wchar_t *ch)
9643 {
9644     IOSB_iostate state = IOSTATE_failbit;
9645     unsigned short c = 0;
9646
9647     TRACE("(%p %p)\n", istream, ch);
9648
9649     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9650         c = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(
9651                     basic_istream_wchar_get_basic_ios(istream)));
9652         if(c != WEOF) {
9653             state = IOSTATE_goodbit;
9654             *ch = c;
9655         }
9656     }
9657     basic_istream_wchar_sentry_destroy(istream);
9658
9659     basic_ios_wchar_setstate(basic_istream_wchar_get_basic_ios(istream),
9660             state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9661     return istream;
9662 }
9663
9664 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9665 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9666 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9667 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9668 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_streambuf, 8)
9669 basic_istream_wchar* __thiscall basic_istream_wchar_read_streambuf(
9670         basic_istream_wchar *this, basic_streambuf_wchar *streambuf)
9671 {
9672     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9673     IOSB_iostate state = IOSTATE_failbit;
9674     unsigned short c = '\n';
9675
9676     TRACE("(%p %p)\n", this, streambuf);
9677
9678     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9679         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base)); c!=WEOF;
9680                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base))) {
9681             state = IOSTATE_goodbit;
9682             if(basic_streambuf_wchar_sputc(streambuf, c) == WEOF)
9683                 break;
9684         }
9685     }
9686     basic_istream_wchar_sentry_destroy(this);
9687
9688     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9689     return this;
9690 }
9691
9692 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
9693 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
9694 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
9695 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
9696 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func, 8)
9697 basic_istream_wchar* __thiscall basic_istream_wchar_read_func(basic_istream_wchar *this,
9698         basic_istream_wchar* (__cdecl *pfunc)(basic_istream_wchar*))
9699 {
9700     TRACE("(%p %p)\n", this, pfunc);
9701     pfunc(this);
9702     return this;
9703 }
9704
9705 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
9706 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
9707 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
9708 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
9709 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_basic_ios, 8)
9710 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_basic_ios(basic_istream_wchar *this,
9711         basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
9712 {
9713     TRACE("(%p %p)\n", this, pfunc);
9714     pfunc(basic_istream_wchar_get_basic_ios(this));
9715     return this;
9716 }
9717
9718 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
9719 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
9720 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
9721 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
9722 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_ios_base, 8)
9723 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_ios_base(
9724         basic_istream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
9725 {
9726     TRACE("(%p %p)\n", this, pfunc);
9727     pfunc(&basic_istream_wchar_get_basic_ios(this)->base);
9728     return this;
9729 }
9730
9731 static inline basic_ios_char* basic_iostream_char_to_basic_ios(basic_iostream_char *ptr)
9732 {
9733     return (basic_ios_char*)((char*)ptr+basic_iostream_char_vbtable1[1]);
9734 }
9735
9736 static inline basic_iostream_char* basic_iostream_char_from_basic_ios(basic_ios_char *ptr)
9737 {
9738     return (basic_iostream_char*)((char*)ptr-basic_iostream_char_vbtable1[1]);
9739 }
9740
9741 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
9742 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
9743 DEFINE_THISCALL_WRAPPER(basic_iostream_char_ctor, 12)
9744 basic_iostream_char* __thiscall basic_iostream_char_ctor(basic_iostream_char *this, basic_streambuf_char *strbuf, MSVCP_bool virt_init)
9745 {
9746     basic_ios_char *basic_ios;
9747
9748     TRACE("(%p %p %d)\n", this, strbuf, virt_init);
9749
9750     if(virt_init) {
9751         this->base1.vbtable = basic_iostream_char_vbtable1;
9752         this->base2.vbtable = basic_iostream_char_vbtable2;
9753         basic_ios = basic_istream_char_get_basic_ios(&this->base1);
9754         basic_ios_char_ctor(basic_ios);
9755     }else {
9756         basic_ios = basic_istream_char_get_basic_ios(&this->base1);
9757     }
9758
9759     basic_ios->base.vtable = &MSVCP_basic_iostream_char_vtable;
9760
9761     basic_istream_char_ctor(&this->base1, strbuf, FALSE, FALSE);
9762     basic_ostream_char_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
9763     return this;
9764 }
9765
9766 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
9767 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
9768 DEFINE_THISCALL_WRAPPER(basic_iostream_char_dtor, 4)
9769 void __thiscall basic_iostream_char_dtor(basic_ios_char *base)
9770 {
9771     basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
9772
9773     TRACE("(%p)\n", this);
9774     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base2));
9775     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base1));
9776 }
9777
9778 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
9779 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
9780 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vbase_dtor, 4)
9781 void __thiscall basic_iostream_char_vbase_dtor(basic_iostream_char *this)
9782 {
9783     TRACE("(%p)\n", this);
9784     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(this));
9785     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base1));
9786 }
9787
9788 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vector_dtor, 8)
9789 basic_iostream_char* __thiscall basic_iostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
9790 {
9791     basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
9792
9793     TRACE("(%p %x)\n", this, flags);
9794
9795     if(flags & 2) {
9796         /* we have an array, with the number of elements stored before the first object */
9797         int i, *ptr = (int *)this-1;
9798
9799         for(i=*ptr-1; i>=0; i--)
9800             basic_iostream_char_vbase_dtor(this+i);
9801         MSVCRT_operator_delete(ptr);
9802     } else {
9803         basic_iostream_char_vbase_dtor(this);
9804         if(flags & 1)
9805             MSVCRT_operator_delete(this);
9806     }
9807
9808     return this;
9809 }
9810
9811 static inline basic_ios_wchar* basic_iostream_wchar_to_basic_ios(basic_iostream_wchar *ptr)
9812 {
9813     return (basic_ios_wchar*)((char*)ptr+basic_iostream_wchar_vbtable1[1]);
9814 }
9815
9816 static inline basic_iostream_wchar* basic_iostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
9817 {
9818     return (basic_iostream_wchar*)((char*)ptr-basic_iostream_wchar_vbtable1[1]);
9819 }
9820
9821 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9822 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9823 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_ctor, 12)
9824 basic_iostream_wchar* __thiscall basic_iostream_wchar_ctor(basic_iostream_wchar *this,
9825         basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
9826 {
9827     basic_ios_wchar *basic_ios;
9828
9829     TRACE("(%p %p %d)\n", this, strbuf, virt_init);
9830
9831     if(virt_init) {
9832         this->base1.vbtable = basic_iostream_wchar_vbtable1;
9833         this->base2.vbtable = basic_iostream_wchar_vbtable2;
9834         basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
9835         basic_ios_wchar_ctor(basic_ios);
9836     }else {
9837         basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
9838     }
9839
9840     basic_istream_wchar_ctor(&this->base1, strbuf, FALSE, FALSE);
9841     basic_ostream_wchar_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
9842
9843     basic_ios->base.vtable = &MSVCP_basic_iostream_wchar_vtable;
9844     return this;
9845 }
9846
9847 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9848 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9849 DEFINE_THISCALL_WRAPPER(basic_iostream_short_ctor, 12)
9850 basic_iostream_wchar* __thiscall basic_iostream_short_ctor(basic_iostream_wchar *this,
9851         basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
9852 {
9853     basic_iostream_wchar_ctor(this, strbuf, virt_init);
9854     basic_istream_wchar_get_basic_ios(&this->base1)->base.vtable = &MSVCP_basic_iostream_short_vtable;
9855     return this;
9856 }
9857
9858 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
9859 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
9860 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
9861 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
9862 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_dtor, 4)
9863 void __thiscall basic_iostream_wchar_dtor(basic_ios_wchar *base)
9864 {
9865     basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
9866
9867     TRACE("(%p)\n", this);
9868     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base2));
9869     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base1));
9870 }
9871
9872 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
9873 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
9874 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
9875 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
9876 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vbase_dtor, 4)
9877 void __thiscall basic_iostream_wchar_vbase_dtor(basic_iostream_wchar *this)
9878 {
9879     TRACE("(%p)\n", this);
9880     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(this));
9881     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base1));
9882 }
9883
9884 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vector_dtor, 8)
9885 basic_iostream_wchar* __thiscall basic_iostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
9886 {
9887     basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
9888
9889     TRACE("(%p %x)\n", this, flags);
9890
9891     if(flags & 2) {
9892         /* we have an array, with the number of elements stored before the first object */
9893         int i, *ptr = (int *)this-1;
9894
9895         for(i=*ptr-1; i>=0; i--)
9896             basic_iostream_wchar_vbase_dtor(this+i);
9897         MSVCRT_operator_delete(ptr);
9898     } else {
9899         basic_iostream_wchar_vbase_dtor(this);
9900         if(flags & 1)
9901             MSVCRT_operator_delete(this);
9902     }
9903
9904     return this;
9905 }
9906
9907 static inline basic_ios_char* basic_ofstream_char_to_basic_ios(basic_ofstream_char *ptr)
9908 {
9909     return (basic_ios_char*)((char*)ptr+basic_ofstream_char_vbtable[1]);
9910 }
9911
9912 static inline basic_ofstream_char* basic_ofstream_char_from_basic_ios(basic_ios_char *ptr)
9913 {
9914     return (basic_ofstream_char*)((char*)ptr-basic_ofstream_char_vbtable[1]);
9915 }
9916
9917 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
9918 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
9919 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor, 8)
9920 basic_ofstream_char* __thiscall basic_ofstream_char_ctor(basic_ofstream_char *this, MSVCP_bool virt_init)
9921 {
9922     basic_ios_char *basic_ios;
9923
9924     TRACE("(%p %d)\n", this, virt_init);
9925
9926     if(virt_init) {
9927         this->base.vbtable = basic_ofstream_char_vbtable;
9928         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9929         basic_ios_char_ctor(basic_ios);
9930     }else {
9931         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9932     }
9933
9934     basic_filebuf_char_ctor(&this->filebuf);
9935     basic_ostream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
9936     basic_ios->base.vtable = &MSVCP_basic_ofstream_char_vtable;
9937     return this;
9938 }
9939
9940 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
9941 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
9942 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_file, 12)
9943 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_file(
9944         basic_ofstream_char *this, FILE *file, MSVCP_bool virt_init)
9945 {
9946     basic_ios_char *basic_ios;
9947
9948     TRACE("(%p %p %d)\n", this, file, virt_init);
9949
9950     if(virt_init) {
9951         this->base.vbtable = basic_ofstream_char_vbtable;
9952         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9953         basic_ios_char_ctor(basic_ios);
9954     }else {
9955         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9956     }
9957
9958     basic_filebuf_char_ctor_file(&this->filebuf, file);
9959     basic_ostream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
9960     basic_ios->base.vtable = &MSVCP_basic_ofstream_char_vtable;
9961     return this;
9962 }
9963
9964 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
9965 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
9966 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_name, 20)
9967 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_name(basic_ofstream_char *this,
9968         const char *name, int mode, int prot, MSVCP_bool virt_init)
9969 {
9970     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
9971
9972     basic_ofstream_char_ctor(this, virt_init);
9973
9974     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
9975         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9976         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
9977     }
9978     return this;
9979 }
9980
9981 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
9982 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
9983 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
9984 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
9985 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_name_wchar, 20)
9986 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_name_wchar(basic_ofstream_char *this,
9987         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
9988 {
9989     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
9990
9991     basic_ofstream_char_ctor(this, virt_init);
9992
9993     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
9994         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9995         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
9996     }
9997     return this;
9998 }
9999
10000 /* ??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
10001 /* ??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
10002 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_dtor, 4)
10003 void __thiscall basic_ofstream_char_dtor(basic_ios_char *base)
10004 {
10005     basic_ofstream_char *this = basic_ofstream_char_from_basic_ios(base);
10006
10007     TRACE("(%p)\n", this);
10008
10009     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
10010     basic_filebuf_char_dtor(&this->filebuf);
10011 }
10012
10013 /* ??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10014 /* ??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10015 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_vbase_dtor, 4)
10016 void __thiscall basic_ofstream_char_vbase_dtor(basic_ofstream_char *this)
10017 {
10018     TRACE("(%p)\n", this);
10019
10020     basic_ofstream_char_dtor(basic_ofstream_char_to_basic_ios(this));
10021     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
10022 }
10023
10024 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_vector_dtor, 8)
10025 basic_ofstream_char* __thiscall basic_ofstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
10026 {
10027     basic_ofstream_char *this = basic_ofstream_char_from_basic_ios(base);
10028
10029     TRACE("(%p %x)\n", this, flags);
10030
10031     if(flags & 2) {
10032         /* we have an array, with the number of elements stored before the first object */
10033         int i, *ptr = (int *)this-1;
10034
10035         for(i=*ptr-1; i>=0; i--)
10036             basic_ofstream_char_vbase_dtor(this+i);
10037         MSVCRT_operator_delete(ptr);
10038     } else {
10039         basic_ofstream_char_vbase_dtor(this);
10040         if(flags & 1)
10041             MSVCRT_operator_delete(this);
10042     }
10043
10044     return this;
10045 }
10046
10047 /* ?close@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10048 /* ?close@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10049 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_close, 4)
10050 void __thiscall basic_ofstream_char_close(basic_ofstream_char *this)
10051 {
10052     TRACE("(%p)\n", this);
10053
10054     if(!basic_filebuf_char_close(&this->filebuf)) {
10055         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10056         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10057     }
10058 }
10059
10060 /* ?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
10061 /* ?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
10062 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_is_open, 4)
10063 MSVCP_bool __thiscall basic_ofstream_char_is_open(const basic_ofstream_char *this)
10064 {
10065     TRACE("(%p)\n", this);
10066     return basic_filebuf_char_is_open(&this->filebuf);
10067 }
10068
10069 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
10070 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
10071 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open, 16)
10072 void __thiscall basic_ofstream_char_open(basic_ofstream_char *this,
10073         const char *name, int mode, int prot)
10074 {
10075     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10076
10077     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10078         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10079         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10080     }
10081 }
10082
10083 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
10084 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
10085 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_old, 12)
10086 void __thiscall basic_ofstream_char_open_old(basic_ofstream_char *this,
10087         const char *name, unsigned int mode)
10088 {
10089     basic_ofstream_char_open(this, name, mode, _SH_DENYNO);
10090 }
10091
10092 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
10093 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
10094 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
10095 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
10096 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_wchar, 16)
10097 void __thiscall basic_ofstream_char_open_wchar(basic_ofstream_char *this,
10098         const wchar_t *name, int mode, int prot)
10099 {
10100     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10101
10102     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10103         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10104         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10105     }
10106 }
10107
10108 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
10109 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
10110 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
10111 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
10112 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_wchar_old, 12)
10113 void __thiscall basic_ofstream_char_open_wchar_old(basic_ofstream_char *this,
10114         const wchar_t *name, unsigned int mode)
10115 {
10116     basic_ofstream_char_open_wchar(this, name, mode, _SH_DENYNO);
10117 }
10118
10119 /* ?rdbuf@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10120 /* ?rdbuf@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10121 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_rdbuf, 4)
10122 basic_filebuf_char* __thiscall basic_ofstream_char_rdbuf(const basic_ofstream_char *this)
10123 {
10124     TRACE("(%p)\n", this);
10125     return (basic_filebuf_char*)&this->filebuf;
10126 }
10127
10128 static inline basic_ios_wchar* basic_ofstream_wchar_to_basic_ios(basic_ofstream_wchar *ptr)
10129 {
10130     return (basic_ios_wchar*)((char*)ptr+basic_ofstream_wchar_vbtable[1]);
10131 }
10132
10133 static inline basic_ofstream_wchar* basic_ofstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
10134 {
10135     return (basic_ofstream_wchar*)((char*)ptr-basic_ofstream_wchar_vbtable[1]);
10136 }
10137
10138 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
10139 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
10140 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor, 8)
10141 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor(basic_ofstream_wchar *this, MSVCP_bool virt_init)
10142 {
10143     basic_ios_wchar *basic_ios;
10144
10145     TRACE("(%p %d)\n", this, virt_init);
10146
10147     if(virt_init) {
10148         this->base.vbtable = basic_ofstream_wchar_vbtable;
10149         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10150         basic_ios_wchar_ctor(basic_ios);
10151     }else {
10152         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10153     }
10154
10155     basic_filebuf_wchar_ctor(&this->filebuf);
10156     basic_ostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10157     basic_ios->base.vtable = &MSVCP_basic_ofstream_wchar_vtable;
10158     return this;
10159 }
10160
10161 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
10162 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
10163 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor, 8)
10164 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor(basic_ofstream_wchar *this, MSVCP_bool virt_init)
10165 {
10166     basic_ofstream_wchar_ctor(this, virt_init);
10167     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10168     return this;
10169 }
10170
10171 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
10172 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10173 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_file, 12)
10174 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_file(
10175         basic_ofstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10176 {
10177     basic_ios_wchar *basic_ios;
10178
10179     TRACE("(%p %p %d)\n", this, file, virt_init);
10180
10181     if(virt_init) {
10182         this->base.vbtable = basic_ofstream_wchar_vbtable;
10183         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10184         basic_ios_wchar_ctor(basic_ios);
10185     }else {
10186         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10187     }
10188
10189     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
10190     basic_ostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10191     basic_ios->base.vtable = &MSVCP_basic_ofstream_wchar_vtable;
10192     return this;
10193 }
10194
10195 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
10196 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10197 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_file, 12)
10198 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_file(
10199         basic_ofstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10200 {
10201     basic_ofstream_wchar_ctor_file(this, file, virt_init);
10202     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10203     return this;
10204 }
10205
10206 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PBDHH@Z */
10207 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBDHH@Z */
10208 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_name, 20)
10209 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_name(basic_ofstream_wchar *this,
10210         const char *name, int mode, int prot, MSVCP_bool virt_init)
10211 {
10212     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10213
10214     basic_ofstream_wchar_ctor(this, virt_init);
10215
10216     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10217         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10218         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10219     }
10220     return this;
10221 }
10222
10223 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PBDHH@Z */
10224 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEBDHH@Z */
10225 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_name, 20)
10226 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_name(basic_ofstream_wchar *this,
10227         const char *name, int mode, int prot, MSVCP_bool virt_init)
10228 {
10229     basic_ofstream_wchar_ctor_name(this, name, mode, prot, virt_init);
10230     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10231     return this;
10232 }
10233
10234 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
10235 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
10236 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
10237 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
10238 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_name_wchar, 20)
10239 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_name_wchar(basic_ofstream_wchar *this,
10240         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10241 {
10242     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10243
10244     basic_ofstream_wchar_ctor(this, virt_init);
10245
10246     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10247         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10248         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10249     }
10250     return this;
10251 }
10252
10253 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
10254 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
10255 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
10256 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
10257 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_name_wchar, 20)
10258 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_name_wchar(basic_ofstream_wchar *this,
10259         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10260 {
10261     basic_ofstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
10262     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10263     return this;
10264 }
10265
10266 /* ??1?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
10267 /* ??1?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
10268 /* ??1?$basic_ofstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
10269 /* ??1?$basic_ofstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
10270 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_dtor, 4)
10271 void __thiscall basic_ofstream_wchar_dtor(basic_ios_wchar *base)
10272 {
10273     basic_ofstream_wchar *this = basic_ofstream_wchar_from_basic_ios(base);
10274
10275     TRACE("(%p)\n", this);
10276
10277     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base));
10278     basic_filebuf_wchar_dtor(&this->filebuf);
10279 }
10280
10281 /* ??_D?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10282 /* ??_D?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10283 /* ??_D?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10284 /* ??_D?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10285 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_vbase_dtor, 4)
10286 void __thiscall basic_ofstream_wchar_vbase_dtor(basic_ofstream_wchar *this)
10287 {
10288     TRACE("(%p)\n", this);
10289
10290     basic_ofstream_wchar_dtor(basic_ofstream_wchar_to_basic_ios(this));
10291     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(&this->base));
10292 }
10293
10294 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_vector_dtor, 8)
10295 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
10296 {
10297     basic_ofstream_wchar *this = basic_ofstream_wchar_from_basic_ios(base);
10298
10299     TRACE("(%p %x)\n", this, flags);
10300
10301     if(flags & 2) {
10302         /* we have an array, with the number of elements stored before the first object */
10303         int i, *ptr = (int *)this-1;
10304
10305         for(i=*ptr-1; i>=0; i--)
10306             basic_ofstream_wchar_vbase_dtor(this+i);
10307         MSVCRT_operator_delete(ptr);
10308     } else {
10309         basic_ofstream_wchar_vbase_dtor(this);
10310         if(flags & 1)
10311             MSVCRT_operator_delete(this);
10312     }
10313
10314     return this;
10315 }
10316
10317 /* ?close@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10318 /* ?close@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10319 /* ?close@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10320 /* ?close@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10321 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_close, 4)
10322 void __thiscall basic_ofstream_wchar_close(basic_ofstream_wchar *this)
10323 {
10324     TRACE("(%p)\n", this);
10325
10326     if(!basic_filebuf_wchar_close(&this->filebuf)) {
10327         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10328         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10329     }
10330 }
10331
10332 /* ?is_open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
10333 /* ?is_open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
10334 /* ?is_open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
10335 /* ?is_open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
10336 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_is_open, 4)
10337 MSVCP_bool __thiscall basic_ofstream_wchar_is_open(const basic_ofstream_wchar *this)
10338 {
10339     TRACE("(%p)\n", this);
10340     return basic_filebuf_wchar_is_open(&this->filebuf);
10341 }
10342
10343 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
10344 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
10345 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
10346 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
10347 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open, 16)
10348 void __thiscall basic_ofstream_wchar_open(basic_ofstream_wchar *this,
10349         const char *name, int mode, int prot)
10350 {
10351     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10352
10353     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10354         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10355         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10356     }
10357 }
10358
10359 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
10360 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
10361 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
10362 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
10363 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_old, 12)
10364 void __thiscall basic_ofstream_wchar_open_old(basic_ofstream_wchar *this,
10365         const char *name, unsigned int mode)
10366 {
10367     basic_ofstream_wchar_open(this, name, mode, _SH_DENYNO);
10368 }
10369
10370 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
10371 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
10372 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
10373 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
10374 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
10375 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
10376 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
10377 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
10378 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_wchar, 16)
10379 void __thiscall basic_ofstream_wchar_open_wchar(basic_ofstream_wchar *this,
10380         const wchar_t *name, int mode, int prot)
10381 {
10382     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10383
10384     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10385         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10386         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10387     }
10388 }
10389
10390 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
10391 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
10392 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
10393 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
10394 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
10395 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
10396 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
10397 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
10398 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_wchar_old, 12)
10399 void __thiscall basic_ofstream_wchar_open_wchar_old(basic_ofstream_wchar *this,
10400         const wchar_t *name, unsigned int mode)
10401 {
10402     basic_ofstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
10403 }
10404
10405 /* ?rdbuf@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10406 /* ?rdbuf@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10407 /* ?rdbuf@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10408 /* ?rdbuf@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10409 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_rdbuf, 4)
10410 basic_filebuf_wchar* __thiscall basic_ofstream_wchar_rdbuf(const basic_ofstream_wchar *this)
10411 {
10412     TRACE("(%p)\n", this);
10413     return (basic_filebuf_wchar*)&this->filebuf;
10414 }
10415
10416 static inline basic_ios_char* basic_ifstream_char_to_basic_ios(basic_ifstream_char *ptr)
10417 {
10418     return (basic_ios_char*)((char*)ptr+basic_ifstream_char_vbtable[1]);
10419 }
10420
10421 static inline basic_ifstream_char* basic_ifstream_char_from_basic_ios(basic_ios_char *ptr)
10422 {
10423     return (basic_ifstream_char*)((char*)ptr-basic_ifstream_char_vbtable[1]);
10424 }
10425
10426 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
10427 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
10428 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor, 8)
10429 basic_ifstream_char* __thiscall basic_ifstream_char_ctor(basic_ifstream_char *this, MSVCP_bool virt_init)
10430 {
10431     basic_ios_char *basic_ios;
10432
10433     TRACE("(%p %d)\n", this, virt_init);
10434
10435     if(virt_init) {
10436         this->base.vbtable = basic_ifstream_char_vbtable;
10437         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10438         basic_ios_char_ctor(basic_ios);
10439     }else {
10440         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10441     }
10442
10443     basic_filebuf_char_ctor(&this->filebuf);
10444     basic_istream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10445     basic_ios->base.vtable = &MSVCP_basic_ifstream_char_vtable;
10446     return this;
10447 }
10448
10449 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
10450 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10451 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_file, 12)
10452 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_file(
10453         basic_ifstream_char *this, FILE *file, MSVCP_bool virt_init)
10454 {
10455     basic_ios_char *basic_ios;
10456
10457     TRACE("(%p %p %d)\n", this, file, virt_init);
10458
10459     if(virt_init) {
10460         this->base.vbtable = basic_ifstream_char_vbtable;
10461         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10462         basic_ios_char_ctor(basic_ios);
10463     }else {
10464         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10465     }
10466
10467     basic_filebuf_char_ctor_file(&this->filebuf, file);
10468     basic_istream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10469     basic_ios->base.vtable = &MSVCP_basic_ifstream_char_vtable;
10470     return this;
10471 }
10472
10473 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
10474 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
10475 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_name, 20)
10476 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_name(basic_ifstream_char *this,
10477         const char *name, int mode, int prot, MSVCP_bool virt_init)
10478 {
10479     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10480
10481     basic_ifstream_char_ctor(this, virt_init);
10482
10483     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10484         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10485         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10486     }
10487     return this;
10488 }
10489
10490 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
10491 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
10492 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
10493 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
10494 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_name_wchar, 20)
10495 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_name_wchar(basic_ifstream_char *this,
10496         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10497 {
10498     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10499
10500     basic_ifstream_char_ctor(this, virt_init);
10501
10502     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10503         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10504         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10505     }
10506     return this;
10507 }
10508
10509 /* ??1?$basic_ifstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
10510 /* ??1?$basic_ifstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
10511 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_dtor, 4)
10512 void __thiscall basic_ifstream_char_dtor(basic_ios_char *base)
10513 {
10514     basic_ifstream_char *this = basic_ifstream_char_from_basic_ios(base);
10515
10516     TRACE("(%p)\n", this);
10517
10518     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
10519     basic_filebuf_char_dtor(&this->filebuf);
10520 }
10521
10522 /* ??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10523 /* ??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10524 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vbase_dtor, 4)
10525 void __thiscall basic_ifstream_char_vbase_dtor(basic_ifstream_char *this)
10526 {
10527     TRACE("(%p)\n", this);
10528
10529     basic_ifstream_char_dtor(basic_ifstream_char_to_basic_ios(this));
10530     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base));
10531 }
10532
10533 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vector_dtor, 8)
10534 basic_ifstream_char* __thiscall basic_ifstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
10535 {
10536     basic_ifstream_char *this = basic_ifstream_char_from_basic_ios(base);
10537
10538     TRACE("(%p %x)\n", this, flags);
10539
10540     if(flags & 2) {
10541         /* we have an array, with the number of elements stored before the first object */
10542         int i, *ptr = (int *)this-1;
10543
10544         for(i=*ptr-1; i>=0; i--)
10545             basic_ifstream_char_vbase_dtor(this+i);
10546         MSVCRT_operator_delete(ptr);
10547     } else {
10548         basic_ifstream_char_vbase_dtor(this);
10549         if(flags & 1)
10550             MSVCRT_operator_delete(this);
10551     }
10552
10553     return this;
10554 }
10555
10556 /* ?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10557 /* ?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10558 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_close, 4)
10559 void __thiscall basic_ifstream_char_close(basic_ifstream_char *this)
10560 {
10561     TRACE("(%p)\n", this);
10562
10563     if(!basic_filebuf_char_close(&this->filebuf)) {
10564         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10565         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10566     }
10567 }
10568
10569 /* ?is_open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
10570 /* ?is_open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
10571 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_is_open, 4)
10572 MSVCP_bool __thiscall basic_ifstream_char_is_open(const basic_ifstream_char *this)
10573 {
10574     TRACE("(%p)\n", this);
10575     return basic_filebuf_char_is_open(&this->filebuf);
10576 }
10577
10578 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
10579 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
10580 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open, 16)
10581 void __thiscall basic_ifstream_char_open(basic_ifstream_char *this,
10582         const char *name, int mode, int prot)
10583 {
10584     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10585
10586     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10587         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10588         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10589     }
10590 }
10591
10592 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
10593 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
10594 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_old, 12)
10595 void __thiscall basic_ifstream_char_open_old(basic_ifstream_char *this,
10596         const char *name, unsigned int mode)
10597 {
10598     basic_ifstream_char_open(this, name, mode, _SH_DENYNO);
10599 }
10600
10601 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
10602 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
10603 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
10604 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
10605 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_wchar, 16)
10606 void __thiscall basic_ifstream_char_open_wchar(basic_ifstream_char *this,
10607         const wchar_t *name, int mode, int prot)
10608 {
10609     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10610
10611     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10612         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10613         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10614     }
10615 }
10616
10617 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
10618 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
10619 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
10620 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
10621 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_wchar_old, 12)
10622 void __thiscall basic_ifstream_char_open_wchar_old(basic_ifstream_char *this,
10623         const wchar_t *name, unsigned int mode)
10624 {
10625     basic_ifstream_char_open_wchar(this, name, mode, _SH_DENYNO);
10626 }
10627
10628 /* ?rdbuf@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10629 /* ?rdbuf@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10630 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_rdbuf, 4)
10631 basic_filebuf_char* __thiscall basic_ifstream_char_rdbuf(const basic_ifstream_char *this)
10632 {
10633     TRACE("(%p)\n", this);
10634     return (basic_filebuf_char*)&this->filebuf;
10635 }
10636
10637 static inline basic_ios_wchar* basic_ifstream_wchar_to_basic_ios(basic_ifstream_wchar *ptr)
10638 {
10639     return (basic_ios_wchar*)((char*)ptr+basic_ifstream_wchar_vbtable[1]);
10640 }
10641
10642 static inline basic_ifstream_wchar* basic_ifstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
10643 {
10644     return (basic_ifstream_wchar*)((char*)ptr-basic_ifstream_wchar_vbtable[1]);
10645 }
10646
10647 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
10648 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
10649 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor, 8)
10650 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor(basic_ifstream_wchar *this, MSVCP_bool virt_init)
10651 {
10652     basic_ios_wchar *basic_ios;
10653
10654     TRACE("(%p %d)\n", this, virt_init);
10655
10656     if(virt_init) {
10657         this->base.vbtable = basic_ifstream_wchar_vbtable;
10658         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10659         basic_ios_wchar_ctor(basic_ios);
10660     }else {
10661         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10662     }
10663
10664     basic_filebuf_wchar_ctor(&this->filebuf);
10665     basic_istream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10666     basic_ios->base.vtable = &MSVCP_basic_ifstream_wchar_vtable;
10667     return this;
10668 }
10669
10670 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
10671 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
10672 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor, 8)
10673 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor(basic_ifstream_wchar *this, MSVCP_bool virt_init)
10674 {
10675     basic_ifstream_wchar_ctor(this, virt_init);
10676     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10677     return this;
10678 }
10679
10680 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
10681 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10682 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_file, 12)
10683 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_file(
10684         basic_ifstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10685 {
10686     basic_ios_wchar *basic_ios;
10687
10688     TRACE("(%p %p %d)\n", this, file, virt_init);
10689
10690     if(virt_init) {
10691         this->base.vbtable = basic_ifstream_wchar_vbtable;
10692         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10693         basic_ios_wchar_ctor(basic_ios);
10694     }else {
10695         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10696     }
10697
10698     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
10699     basic_istream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10700     basic_ios->base.vtable = &MSVCP_basic_ifstream_wchar_vtable;
10701     return this;
10702 }
10703
10704 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
10705 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10706 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_file, 12)
10707 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_file(
10708         basic_ifstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10709 {
10710     basic_ifstream_wchar_ctor_file(this, file, virt_init);
10711     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10712     return this;
10713 }
10714
10715 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PBDHH@Z */
10716 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBDHH@Z */
10717 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_name, 20)
10718 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_name(basic_ifstream_wchar *this,
10719         const char *name, int mode, int prot, MSVCP_bool virt_init)
10720 {
10721     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10722
10723     basic_ifstream_wchar_ctor(this, virt_init);
10724
10725     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10726         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10727         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10728     }
10729     return this;
10730 }
10731
10732 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PBDHH@Z */
10733 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEBDHH@Z */
10734 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_name, 20)
10735 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_name(basic_ifstream_wchar *this,
10736         const char *name, int mode, int prot, MSVCP_bool virt_init)
10737 {
10738     basic_ifstream_wchar_ctor_name(this, name, mode, prot, virt_init);
10739     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10740     return this;
10741 }
10742
10743 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
10744 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
10745 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
10746 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
10747 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_name_wchar, 20)
10748 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_name_wchar(basic_ifstream_wchar *this,
10749         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10750 {
10751     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10752
10753     basic_ifstream_wchar_ctor(this, virt_init);
10754
10755     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10756         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10757         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10758     }
10759     return this;
10760 }
10761
10762 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
10763 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
10764 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
10765 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
10766 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_name_wchar, 20)
10767 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_name_wchar(basic_ifstream_wchar *this,
10768         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10769 {
10770     basic_ifstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
10771     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10772     return this;
10773 }
10774
10775 /* ??1?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
10776 /* ??1?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
10777 /* ??1?$basic_ifstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
10778 /* ??1?$basic_ifstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
10779 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_dtor, 4)
10780 void __thiscall basic_ifstream_wchar_dtor(basic_ios_wchar *base)
10781 {
10782     basic_ifstream_wchar *this = basic_ifstream_wchar_from_basic_ios(base);
10783
10784     TRACE("(%p)\n", this);
10785
10786     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base));
10787     basic_filebuf_wchar_dtor(&this->filebuf);
10788 }
10789
10790 /* ??_D?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10791 /* ??_D?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10792 /* ??_D?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10793 /* ??_D?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10794 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_vbase_dtor, 4)
10795 void __thiscall basic_ifstream_wchar_vbase_dtor(basic_ifstream_wchar *this)
10796 {
10797     TRACE("(%p)\n", this);
10798
10799     basic_ifstream_wchar_dtor(basic_ifstream_wchar_to_basic_ios(this));
10800     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base));
10801 }
10802
10803 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_vector_dtor, 8)
10804 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
10805 {
10806     basic_ifstream_wchar *this = basic_ifstream_wchar_from_basic_ios(base);
10807
10808     TRACE("(%p %x)\n", this, flags);
10809
10810     if(flags & 2) {
10811         /* we have an array, with the number of elements stored before the first object */
10812         int i, *ptr = (int *)this-1;
10813
10814         for(i=*ptr-1; i>=0; i--)
10815             basic_ifstream_wchar_vbase_dtor(this+i);
10816         MSVCRT_operator_delete(ptr);
10817     } else {
10818         basic_ifstream_wchar_vbase_dtor(this);
10819         if(flags & 1)
10820             MSVCRT_operator_delete(this);
10821     }
10822
10823     return this;
10824 }
10825
10826 /* ?close@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10827 /* ?close@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10828 /* ?close@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10829 /* ?close@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10830 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_close, 4)
10831 void __thiscall basic_ifstream_wchar_close(basic_ifstream_wchar *this)
10832 {
10833     TRACE("(%p)\n", this);
10834
10835     if(!basic_filebuf_wchar_close(&this->filebuf)) {
10836         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10837         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10838     }
10839 }
10840
10841 /* ?is_open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
10842 /* ?is_open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
10843 /* ?is_open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
10844 /* ?is_open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
10845 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_is_open, 4)
10846 MSVCP_bool __thiscall basic_ifstream_wchar_is_open(const basic_ifstream_wchar *this)
10847 {
10848     TRACE("(%p)\n", this);
10849     return basic_filebuf_wchar_is_open(&this->filebuf);
10850 }
10851
10852 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
10853 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
10854 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
10855 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
10856 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open, 16)
10857 void __thiscall basic_ifstream_wchar_open(basic_ifstream_wchar *this,
10858         const char *name, int mode, int prot)
10859 {
10860     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10861
10862     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10863         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10864         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10865     }
10866 }
10867
10868 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
10869 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
10870 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
10871 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
10872 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_old, 12)
10873 void __thiscall basic_ifstream_wchar_open_old(basic_ifstream_wchar *this,
10874         const char *name, unsigned int mode)
10875 {
10876     basic_ifstream_wchar_open(this, name, mode, _SH_DENYNO);
10877 }
10878
10879 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
10880 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
10881 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
10882 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
10883 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
10884 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
10885 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
10886 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
10887 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_wchar, 16)
10888 void __thiscall basic_ifstream_wchar_open_wchar(basic_ifstream_wchar *this,
10889         const wchar_t *name, int mode, int prot)
10890 {
10891     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10892
10893     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10894         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10895         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10896     }
10897 }
10898
10899 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
10900 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
10901 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
10902 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
10903 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
10904 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
10905 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
10906 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
10907 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_wchar_old, 12)
10908 void __thiscall basic_ifstream_wchar_open_wchar_old(basic_ifstream_wchar *this,
10909         const wchar_t *name, unsigned int mode)
10910 {
10911     basic_ifstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
10912 }
10913
10914 /* ?rdbuf@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10915 /* ?rdbuf@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10916 /* ?rdbuf@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10917 /* ?rdbuf@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10918 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_rdbuf, 4)
10919 basic_filebuf_wchar* __thiscall basic_ifstream_wchar_rdbuf(const basic_ifstream_wchar *this)
10920 {
10921     TRACE("(%p)\n", this);
10922     return (basic_filebuf_wchar*)&this->filebuf;
10923 }
10924
10925 static inline basic_ios_char* basic_fstream_char_to_basic_ios(basic_fstream_char *ptr)
10926 {
10927     return (basic_ios_char*)((char*)ptr+basic_fstream_char_vbtable1[1]);
10928 }
10929
10930 static inline basic_fstream_char* basic_fstream_char_from_basic_ios(basic_ios_char *ptr)
10931 {
10932     return (basic_fstream_char*)((char*)ptr-basic_fstream_char_vbtable1[1]);
10933 }
10934
10935 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
10936 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
10937 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor, 8)
10938 basic_fstream_char* __thiscall basic_fstream_char_ctor(basic_fstream_char *this, MSVCP_bool virt_init)
10939 {
10940     basic_ios_char *basic_ios;
10941
10942     TRACE("(%p %d)\n", this, virt_init);
10943
10944     if(virt_init) {
10945         this->base.base1.vbtable = basic_fstream_char_vbtable1;
10946         this->base.base2.vbtable = basic_fstream_char_vbtable2;
10947         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
10948         basic_ios_char_ctor(basic_ios);
10949     }else {
10950         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
10951     }
10952
10953     basic_filebuf_char_ctor(&this->filebuf);
10954     basic_iostream_char_ctor(&this->base, &this->filebuf.base, FALSE);
10955     basic_ios->base.vtable = &MSVCP_basic_fstream_char_vtable;
10956     return this;
10957 }
10958
10959 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
10960 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10961 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_file, 12)
10962 basic_fstream_char* __thiscall basic_fstream_char_ctor_file(basic_fstream_char *this,
10963         FILE *file, MSVCP_bool virt_init)
10964 {
10965     basic_ios_char *basic_ios;
10966
10967     TRACE("(%p %p %d)\n", this, file, virt_init);
10968
10969     if(virt_init) {
10970         this->base.base1.vbtable = basic_fstream_char_vbtable1;
10971         this->base.base2.vbtable = basic_fstream_char_vbtable2;
10972         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
10973         basic_ios_char_ctor(basic_ios);
10974     }else {
10975         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
10976     }
10977
10978     basic_filebuf_char_ctor_file(&this->filebuf, file);
10979     basic_iostream_char_ctor(&this->base, &this->filebuf.base, FALSE);
10980     basic_ios->base.vtable = &MSVCP_basic_fstream_char_vtable;
10981     return this;
10982 }
10983
10984 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
10985 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
10986 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_name, 20)
10987 basic_fstream_char* __thiscall basic_fstream_char_ctor_name(basic_fstream_char *this,
10988         const char *name, int mode, int prot, MSVCP_bool virt_init)
10989 {
10990     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10991
10992     basic_fstream_char_ctor(this, virt_init);
10993
10994     if(!basic_filebuf_char_open(&this->filebuf, name, mode, prot)) {
10995         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
10996         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10997     }
10998     return this;
10999 }
11000
11001 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
11002 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
11003 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
11004 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
11005 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_name_wchar, 20)
11006 basic_fstream_char* __thiscall basic_fstream_char_ctor_name_wchar(basic_fstream_char *this,
11007         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11008 {
11009     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
11010
11011     basic_fstream_char_ctor(this, virt_init);
11012
11013     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode, prot)) {
11014         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11015         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11016     }
11017     return this;
11018 }
11019
11020 /* ??1?$basic_fstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
11021 /* ??1?$basic_fstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
11022 DEFINE_THISCALL_WRAPPER(basic_fstream_char_dtor, 4)
11023 void __thiscall basic_fstream_char_dtor(basic_ios_char *base)
11024 {
11025     basic_fstream_char *this = basic_fstream_char_from_basic_ios(base);
11026
11027     TRACE("(%p)\n", this);
11028
11029     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
11030     basic_filebuf_char_dtor(&this->filebuf);
11031 }
11032
11033 /* ??_D?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
11034 /* ??_D?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
11035 DEFINE_THISCALL_WRAPPER(basic_fstream_char_vbase_dtor, 4)
11036 void __thiscall basic_fstream_char_vbase_dtor(basic_fstream_char *this)
11037 {
11038     TRACE("(%p)\n", this);
11039
11040     basic_fstream_char_dtor(basic_fstream_char_to_basic_ios(this));
11041     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
11042 }
11043
11044 DEFINE_THISCALL_WRAPPER(basic_fstream_char_vector_dtor, 8)
11045 basic_fstream_char* __thiscall basic_fstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11046 {
11047     basic_fstream_char *this = basic_fstream_char_from_basic_ios(base);
11048
11049     TRACE("(%p %x)\n", this, flags);
11050
11051     if(flags & 2) {
11052         /* we have an array, with the number of elements stored before the first object */
11053         int i, *ptr = (int *)this-1;
11054
11055         for(i=*ptr-1; i>=0; i--)
11056             basic_fstream_char_vbase_dtor(this+i);
11057         MSVCRT_operator_delete(ptr);
11058     } else {
11059         basic_fstream_char_vbase_dtor(this);
11060         if(flags & 1)
11061             MSVCRT_operator_delete(this);
11062     }
11063
11064     return this;
11065 }
11066
11067 /* ?close@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
11068 /* ?close@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
11069 DEFINE_THISCALL_WRAPPER(basic_fstream_char_close, 4)
11070 void __thiscall basic_fstream_char_close(basic_fstream_char *this)
11071 {
11072     TRACE("(%p)\n", this);
11073
11074     if(!basic_filebuf_char_close(&this->filebuf)) {
11075         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11076         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11077     }
11078 }
11079
11080 /* ?is_open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
11081 /* ?is_open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
11082 DEFINE_THISCALL_WRAPPER(basic_fstream_char_is_open, 4)
11083 MSVCP_bool __thiscall basic_fstream_char_is_open(const basic_fstream_char *this)
11084 {
11085     TRACE("(%p)\n", this);
11086     return basic_filebuf_char_is_open(&this->filebuf);
11087 }
11088
11089 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
11090 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
11091 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open, 16)
11092 void __thiscall basic_fstream_char_open(basic_fstream_char *this,
11093         const char *name, int mode, int prot)
11094 {
11095     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
11096
11097     if(!basic_filebuf_char_open(&this->filebuf, name, mode, prot)) {
11098         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11099         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11100     }
11101 }
11102
11103 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
11104 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
11105 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_old, 12)
11106 void __thiscall basic_fstream_char_open_old(basic_fstream_char *this,
11107         const char *name, unsigned int mode)
11108 {
11109     basic_fstream_char_open(this, name, mode, _SH_DENYNO);
11110 }
11111
11112 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
11113 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
11114 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
11115 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
11116 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_wchar, 16)
11117 void __thiscall basic_fstream_char_open_wchar(basic_fstream_char *this,
11118         const wchar_t *name, int mode, int prot)
11119 {
11120     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
11121
11122     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode, prot)) {
11123         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11124         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11125     }
11126 }
11127
11128 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
11129 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
11130 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
11131 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
11132 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_wchar_old, 12)
11133 void __thiscall basic_fstream_char_open_wchar_old(basic_fstream_char *this,
11134         const wchar_t *name, unsigned int mode)
11135 {
11136     basic_fstream_char_open_wchar(this, name, mode, _SH_DENYNO);
11137 }
11138
11139 /* ?rdbuf@?$basic_fstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
11140 /* ?rdbuf@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
11141 DEFINE_THISCALL_WRAPPER(basic_fstream_char_rdbuf, 4)
11142 basic_filebuf_char* __thiscall basic_fstream_char_rdbuf(const basic_fstream_char *this)
11143 {
11144     TRACE("(%p)\n", this);
11145     return (basic_filebuf_char*)&this->filebuf;
11146 }
11147
11148 static inline basic_ios_wchar* basic_fstream_wchar_to_basic_ios(basic_fstream_wchar *ptr)
11149 {
11150     return (basic_ios_wchar*)((char*)ptr+basic_fstream_wchar_vbtable1[1]);
11151 }
11152
11153 static inline basic_fstream_wchar* basic_fstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11154 {
11155     return (basic_fstream_wchar*)((char*)ptr-basic_fstream_wchar_vbtable1[1]);
11156 }
11157
11158 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
11159 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
11160 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor, 8)
11161 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor(basic_fstream_wchar *this, MSVCP_bool virt_init)
11162 {
11163     basic_ios_wchar *basic_ios;
11164
11165     TRACE("(%p %d)\n", this, virt_init);
11166
11167     if(virt_init) {
11168         this->base.base1.vbtable = basic_fstream_wchar_vbtable1;
11169         this->base.base2.vbtable = basic_fstream_wchar_vbtable2;
11170         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11171         basic_ios_wchar_ctor(basic_ios);
11172     }else {
11173         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11174     }
11175
11176     basic_filebuf_wchar_ctor(&this->filebuf);
11177     basic_iostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE);
11178     basic_ios->base.vtable = &MSVCP_basic_fstream_wchar_vtable;
11179     return this;
11180 }
11181
11182 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
11183 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
11184 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor, 8)
11185 basic_fstream_wchar* __thiscall basic_fstream_short_ctor(basic_fstream_wchar *this, MSVCP_bool virt_init)
11186 {
11187     basic_fstream_wchar_ctor(this, virt_init);
11188     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11189     return this;
11190 }
11191
11192 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
11193 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11194 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_file, 12)
11195 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_file(basic_fstream_wchar *this,
11196         FILE *file, MSVCP_bool virt_init)
11197 {
11198     basic_ios_wchar *basic_ios;
11199
11200     TRACE("(%p %p %d)\n", this, file, virt_init);
11201
11202     if(virt_init) {
11203         this->base.base1.vbtable = basic_fstream_wchar_vbtable1;
11204         this->base.base2.vbtable = basic_fstream_wchar_vbtable2;
11205         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11206         basic_ios_wchar_ctor(basic_ios);
11207     }else {
11208         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11209     }
11210
11211     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
11212     basic_iostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE);
11213     basic_ios->base.vtable = &MSVCP_basic_fstream_wchar_vtable;
11214     return this;
11215 }
11216
11217 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
11218 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11219 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_file, 12)
11220 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_file(basic_fstream_wchar *this,
11221         FILE *file, MSVCP_bool virt_init)
11222 {
11223     basic_fstream_wchar_ctor_file(this, file, virt_init);
11224     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11225     return this;
11226 }
11227
11228 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
11229 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
11230 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_name, 20)
11231 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_name(basic_fstream_wchar *this,
11232         const char *name, int mode, int prot, MSVCP_bool virt_init)
11233 {
11234     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
11235
11236     basic_fstream_wchar_ctor(this, virt_init);
11237
11238     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode, prot)) {
11239         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11240         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11241     }
11242     return this;
11243 }
11244
11245 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
11246 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
11247 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_name, 20)
11248 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_name(basic_fstream_wchar *this,
11249         const char *name, int mode, int prot, MSVCP_bool virt_init)
11250 {
11251     basic_fstream_wchar_ctor_name(this, name, mode, prot, virt_init);
11252     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11253     return this;
11254 }
11255
11256 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
11257 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
11258 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
11259 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
11260 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_name_wchar, 20)
11261 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_name_wchar(basic_fstream_wchar *this,
11262         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11263 {
11264     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
11265
11266     basic_fstream_wchar_ctor(this, virt_init);
11267
11268     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode, prot)) {
11269         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11270         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11271     }
11272     return this;
11273 }
11274
11275 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
11276 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
11277 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
11278 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
11279 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_name_wchar, 20)
11280 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_name_wchar(basic_fstream_wchar *this,
11281         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11282 {
11283     basic_fstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
11284     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11285     return this;
11286 }
11287
11288 /* ??1?$basic_fstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
11289 /* ??1?$basic_fstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
11290 /* ??1?$basic_fstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
11291 /* ??1?$basic_fstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
11292 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_dtor, 4)
11293 void __thiscall basic_fstream_wchar_dtor(basic_ios_wchar *base)
11294 {
11295     basic_fstream_wchar *this = basic_fstream_wchar_from_basic_ios(base);
11296
11297     TRACE("(%p)\n", this);
11298
11299     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(&this->base));
11300     basic_filebuf_wchar_dtor(&this->filebuf);
11301 }
11302
11303 /* ??_D?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
11304 /* ??_D?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
11305 /* ??_D?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
11306 /* ??_D?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
11307 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_vbase_dtor, 4)
11308 void __thiscall basic_fstream_wchar_vbase_dtor(basic_fstream_wchar *this)
11309 {
11310     TRACE("(%p)\n", this);
11311
11312     basic_fstream_wchar_dtor(basic_fstream_wchar_to_basic_ios(this));
11313     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base.base1));
11314 }
11315
11316 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_vector_dtor, 8)
11317 basic_fstream_wchar* __thiscall basic_fstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
11318 {
11319     basic_fstream_wchar *this = basic_fstream_wchar_from_basic_ios(base);
11320
11321     TRACE("(%p %x)\n", this, flags);
11322
11323     if(flags & 2) {
11324         /* we have an array, with the number of elements stored before the first object */
11325         int i, *ptr = (int *)this-1;
11326
11327         for(i=*ptr-1; i>=0; i--)
11328             basic_fstream_wchar_vbase_dtor(this+i);
11329         MSVCRT_operator_delete(ptr);
11330     } else {
11331         basic_fstream_wchar_vbase_dtor(this);
11332         if(flags & 1)
11333             MSVCRT_operator_delete(this);
11334     }
11335
11336     return this;
11337 }
11338
11339 /* ?close@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
11340 /* ?close@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
11341 /* ?close@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
11342 /* ?close@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
11343 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_close, 4)
11344 void __thiscall basic_fstream_wchar_close(basic_fstream_wchar *this)
11345 {
11346     TRACE("(%p)\n", this);
11347
11348     if(!basic_filebuf_wchar_close(&this->filebuf)) {
11349         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11350         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11351     }
11352 }
11353
11354 /* ?is_open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
11355 /* ?is_open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
11356 /* ?is_open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
11357 /* ?is_open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
11358 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_is_open, 4)
11359 MSVCP_bool __thiscall basic_fstream_wchar_is_open(const basic_fstream_wchar *this)
11360 {
11361     TRACE("(%p)\n", this);
11362     return basic_filebuf_wchar_is_open(&this->filebuf);
11363 }
11364
11365 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
11366 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
11367 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
11368 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
11369 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open, 16)
11370 void __thiscall basic_fstream_wchar_open(basic_fstream_wchar *this,
11371         const char *name, int mode, int prot)
11372 {
11373     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
11374
11375     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode, prot)) {
11376         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11377         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11378     }
11379 }
11380
11381 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
11382 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
11383 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
11384 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
11385 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_old, 12)
11386 void __thiscall basic_fstream_wchar_open_old(basic_fstream_wchar *this,
11387         const char *name, unsigned int mode)
11388 {
11389     basic_fstream_wchar_open(this, name, mode, _SH_DENYNO);
11390 }
11391
11392 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
11393 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
11394 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
11395 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
11396 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
11397 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
11398 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
11399 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
11400 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_wchar, 16)
11401 void __thiscall basic_fstream_wchar_open_wchar(basic_fstream_wchar *this,
11402         const wchar_t *name, int mode, int prot)
11403 {
11404     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
11405
11406     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode, prot)) {
11407         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11408         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11409     }
11410 }
11411
11412 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
11413 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
11414 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
11415 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
11416 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
11417 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
11418 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
11419 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
11420 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_wchar_old, 12)
11421 void __thiscall basic_fstream_wchar_open_wchar_old(basic_fstream_wchar *this,
11422         const wchar_t *name, unsigned int mode)
11423 {
11424     basic_fstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
11425 }
11426
11427 /* ?rdbuf@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11428 /* ?rdbuf@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11429 /* ?rdbuf@?$basic_fstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11430 /* ?rdbuf@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11431 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_rdbuf, 4)
11432 basic_filebuf_wchar* __thiscall basic_fstream_wchar_rdbuf(const basic_fstream_wchar *this)
11433 {
11434     TRACE("(%p)\n", this);
11435     return (basic_filebuf_wchar*)&this->filebuf;
11436 }
11437
11438 static inline basic_ios_char* basic_ostringstream_char_to_basic_ios(basic_ostringstream_char *ptr)
11439 {
11440     return (basic_ios_char*)((char*)ptr+basic_ostringstream_char_vbtable[1]);
11441 }
11442
11443 static inline basic_ostringstream_char* basic_ostringstream_char_from_basic_ios(basic_ios_char *ptr)
11444 {
11445     return (basic_ostringstream_char*)((char*)ptr-basic_ostringstream_char_vbtable[1]);
11446 }
11447
11448 /* ??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 */
11449 /* ??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 */
11450 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor_str, 16)
11451 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor_str(basic_ostringstream_char *this,
11452         const basic_string_char *str, int mode, MSVCP_bool virt_init)
11453 {
11454     basic_ios_char *basic_ios;
11455
11456     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11457
11458     if(virt_init) {
11459         this->base.vbtable = basic_ostringstream_char_vbtable;
11460         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11461         basic_ios_char_ctor(basic_ios);
11462     }else {
11463         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11464     }
11465
11466     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode|OPENMODE_out);
11467     basic_ostream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11468     basic_ios->base.vtable = &MSVCP_basic_ostringstream_char_vtable;
11469     return this;
11470 }
11471
11472 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
11473 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
11474 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor_mode, 12)
11475 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor_mode(
11476         basic_ostringstream_char *this, int mode, MSVCP_bool virt_init)
11477 {
11478     basic_ios_char *basic_ios;
11479
11480     TRACE("(%p %d %d)\n", this, mode, virt_init);
11481
11482     if(virt_init) {
11483         this->base.vbtable = basic_ostringstream_char_vbtable;
11484         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11485         basic_ios_char_ctor(basic_ios);
11486     }else {
11487         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11488     }
11489
11490     basic_stringbuf_char_ctor_mode(&this->strbuf, mode|OPENMODE_out);
11491     basic_ostream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11492     basic_ios->base.vtable = &MSVCP_basic_ostringstream_char_vtable;
11493     return this;
11494 }
11495
11496 /* ??_F?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11497 /* ??_F?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11498 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor, 8)
11499 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor(
11500         basic_ostringstream_char *this, MSVCP_bool virt_init)
11501 {
11502     return basic_ostringstream_char_ctor_mode(this, 0, virt_init);
11503 }
11504
11505 /* ??1?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
11506 /* ??1?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
11507 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_dtor, 4)
11508 void __thiscall basic_ostringstream_char_dtor(basic_ios_char *base)
11509 {
11510     basic_ostringstream_char *this = basic_ostringstream_char_from_basic_ios(base);
11511
11512     TRACE("(%p)\n", this);
11513
11514     basic_stringbuf_char_dtor(&this->strbuf);
11515     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
11516 }
11517
11518 /* ??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11519 /* ??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11520 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_vbase_dtor, 4)
11521 void __thiscall basic_ostringstream_char_vbase_dtor(basic_ostringstream_char *this)
11522 {
11523     TRACE("(%p)\n", this);
11524
11525     basic_ostringstream_char_dtor(basic_ostringstream_char_to_basic_ios(this));
11526     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
11527 }
11528
11529 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_vector_dtor, 8)
11530 basic_ostringstream_char* __thiscall basic_ostringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11531 {
11532     basic_ostringstream_char *this = basic_ostringstream_char_from_basic_ios(base);
11533
11534     TRACE("(%p %x)\n", this, flags);
11535
11536     if(flags & 2) {
11537         /* we have an array, with the number of elements stored before the first object */
11538         int i, *ptr = (int *)this-1;
11539
11540         for(i=*ptr-1; i>=0; i--)
11541             basic_ostringstream_char_vbase_dtor(this+i);
11542         MSVCRT_operator_delete(ptr);
11543     } else {
11544         basic_ostringstream_char_vbase_dtor(this);
11545         if(flags & 1)
11546             MSVCRT_operator_delete(this);
11547     }
11548
11549     return this;
11550 }
11551
11552 /* ?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 */
11553 /* ?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 */
11554 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_rdbuf, 4)
11555 basic_stringbuf_char* __thiscall basic_ostringstream_char_rdbuf(const basic_ostringstream_char *this)
11556 {
11557     TRACE("(%p)\n", this);
11558     return (basic_stringbuf_char*)&this->strbuf;
11559 }
11560
11561 /* ?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 */
11562 /* ?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 */
11563 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_str_set, 8)
11564 void __thiscall basic_ostringstream_char_str_set(basic_ostringstream_char *this, const basic_string_char *str)
11565 {
11566     TRACE("(%p %p)\n", this, str);
11567     basic_stringbuf_char_str_set(&this->strbuf, str);
11568 }
11569
11570 /* ?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 */
11571 /* ?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 */
11572 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_str_get, 8)
11573 basic_string_char* __thiscall basic_ostringstream_char_str_get(const basic_ostringstream_char *this, basic_string_char *ret)
11574 {
11575     TRACE("(%p %p)\n", this, ret);
11576     return basic_stringbuf_char_str_get(&this->strbuf, ret);
11577 }
11578
11579 static inline basic_ios_wchar* basic_ostringstream_wchar_to_basic_ios(basic_ostringstream_wchar *ptr)
11580 {
11581     return (basic_ios_wchar*)((char*)ptr+basic_ostringstream_wchar_vbtable[1]);
11582 }
11583
11584 static inline basic_ostringstream_wchar* basic_ostringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11585 {
11586     return (basic_ostringstream_wchar*)((char*)ptr-basic_ostringstream_wchar_vbtable[1]);
11587 }
11588
11589 /* ??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 */
11590 /* ??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 */
11591 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor_str, 16)
11592 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor_str(basic_ostringstream_wchar *this,
11593         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11594 {
11595     basic_ios_wchar *basic_ios;
11596
11597     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11598
11599     if(virt_init) {
11600         this->base.vbtable = basic_ostringstream_wchar_vbtable;
11601         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11602         basic_ios_wchar_ctor(basic_ios);
11603     }else {
11604         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11605     }
11606
11607     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode|OPENMODE_out);
11608     basic_ostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11609     basic_ios->base.vtable = &MSVCP_basic_ostringstream_wchar_vtable;
11610     return this;
11611 }
11612
11613 /* ??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 */
11614 /* ??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 */
11615 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor_str, 16)
11616 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor_str(basic_ostringstream_wchar *this,
11617         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11618 {
11619     basic_ostringstream_wchar_ctor_str(this, str, mode, virt_init);
11620     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ostringstream_short_vtable;
11621     return this;
11622 }
11623
11624 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
11625 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
11626 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor_mode, 12)
11627 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor_mode(
11628         basic_ostringstream_wchar *this, int mode, MSVCP_bool virt_init)
11629 {
11630     basic_ios_wchar *basic_ios;
11631
11632     TRACE("(%p %d %d)\n", this, mode, virt_init);
11633
11634     if(virt_init) {
11635         this->base.vbtable = basic_ostringstream_wchar_vbtable;
11636         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11637         basic_ios_wchar_ctor(basic_ios);
11638     }else {
11639         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11640     }
11641
11642     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode|OPENMODE_out);
11643     basic_ostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11644     basic_ios->base.vtable = &MSVCP_basic_ostringstream_wchar_vtable;
11645     return this;
11646 }
11647
11648 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
11649 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
11650 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor_mode, 12)
11651 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor_mode(
11652         basic_ostringstream_wchar *this, int mode, MSVCP_bool virt_init)
11653 {
11654     basic_ostringstream_wchar_ctor_mode(this, mode, virt_init);
11655     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ostringstream_short_vtable;
11656     return this;
11657 }
11658
11659 /* ??_F?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11660 /* ??_F?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11661 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor, 8)
11662 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor(
11663         basic_ostringstream_wchar *this, MSVCP_bool virt_init)
11664 {
11665     return basic_ostringstream_wchar_ctor_mode(this, 0, virt_init);
11666 }
11667
11668 /* ??_F?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11669 /* ??_F?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11670 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor, 8)
11671 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor(
11672         basic_ostringstream_wchar *this, MSVCP_bool virt_init)
11673 {
11674     return basic_ostringstream_short_ctor_mode(this, 0, virt_init);
11675 }
11676
11677 /* ??1?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
11678 /* ??1?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
11679 /* ??1?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
11680 /* ??1?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
11681 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_dtor, 4)
11682 void __thiscall basic_ostringstream_wchar_dtor(basic_ios_wchar *base)
11683 {
11684     basic_ostringstream_wchar *this = basic_ostringstream_wchar_from_basic_ios(base);
11685
11686     TRACE("(%p)\n", this);
11687
11688     basic_stringbuf_wchar_dtor(&this->strbuf);
11689     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base));
11690 }
11691
11692 /* ??_D?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11693 /* ??_D?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11694 /* ??_D?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11695 /* ??_D?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11696 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_vbase_dtor, 4)
11697 void __thiscall basic_ostringstream_wchar_vbase_dtor(basic_ostringstream_wchar *this)
11698 {
11699     TRACE("(%p)\n", this);
11700
11701     basic_ostringstream_wchar_dtor(basic_ostringstream_wchar_to_basic_ios(this));
11702     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(&this->base));
11703 }
11704
11705 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_vector_dtor, 8)
11706 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
11707 {
11708     basic_ostringstream_wchar *this = basic_ostringstream_wchar_from_basic_ios(base);
11709
11710     TRACE("(%p %x)\n", this, flags);
11711
11712     if(flags & 2) {
11713         /* we have an array, with the number of elements stored before the first object */
11714         int i, *ptr = (int *)this-1;
11715
11716         for(i=*ptr-1; i>=0; i--)
11717             basic_ostringstream_wchar_vbase_dtor(this+i);
11718         MSVCRT_operator_delete(ptr);
11719     } else {
11720         basic_ostringstream_wchar_vbase_dtor(this);
11721         if(flags & 1)
11722             MSVCRT_operator_delete(this);
11723     }
11724
11725     return this;
11726 }
11727
11728 /* ?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 */
11729 /* ?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 */
11730 /* ?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 */
11731 /* ?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 */
11732 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_rdbuf, 4)
11733 basic_stringbuf_wchar* __thiscall basic_ostringstream_wchar_rdbuf(const basic_ostringstream_wchar *this)
11734 {
11735     TRACE("(%p)\n", this);
11736     return (basic_stringbuf_wchar*)&this->strbuf;
11737 }
11738
11739 /* ?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 */
11740 /* ?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 */
11741 /* ?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 */
11742 /* ?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 */
11743 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_str_set, 8)
11744 void __thiscall basic_ostringstream_wchar_str_set(basic_ostringstream_wchar *this, const basic_string_wchar *str)
11745 {
11746     TRACE("(%p %p)\n", this, str);
11747     basic_stringbuf_wchar_str_set(&this->strbuf, str);
11748 }
11749
11750 /* ?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 */
11751 /* ?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 */
11752 /* ?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 */
11753 /* ?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 */
11754 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_str_get, 8)
11755 basic_string_wchar* __thiscall basic_ostringstream_wchar_str_get(const basic_ostringstream_wchar *this, basic_string_wchar *ret)
11756 {
11757     TRACE("(%p %p)\n", this, ret);
11758     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
11759 }
11760
11761 static inline basic_ios_char* basic_istringstream_char_to_basic_ios(basic_istringstream_char *ptr)
11762 {
11763     return (basic_ios_char*)((char*)ptr+basic_istringstream_char_vbtable[1]);
11764 }
11765
11766 static inline basic_istringstream_char* basic_istringstream_char_from_basic_ios(basic_ios_char *ptr)
11767 {
11768     return (basic_istringstream_char*)((char*)ptr-basic_istringstream_char_vbtable[1]);
11769 }
11770
11771 /* ??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 */
11772 /* ??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 */
11773 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor_str, 16)
11774 basic_istringstream_char* __thiscall basic_istringstream_char_ctor_str(basic_istringstream_char *this,
11775         const basic_string_char *str, int mode, MSVCP_bool virt_init)
11776 {
11777     basic_ios_char *basic_ios;
11778
11779     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11780
11781     if(virt_init) {
11782         this->base.vbtable = basic_istringstream_char_vbtable;
11783         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11784         basic_ios_char_ctor(basic_ios);
11785     }else {
11786         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11787     }
11788
11789     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode|OPENMODE_in);
11790     basic_istream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11791     basic_ios->base.vtable = &MSVCP_basic_istringstream_char_vtable;
11792     return this;
11793 }
11794
11795 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
11796 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
11797 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor_mode, 12)
11798 basic_istringstream_char* __thiscall basic_istringstream_char_ctor_mode(
11799         basic_istringstream_char *this, int mode, MSVCP_bool virt_init)
11800 {
11801     basic_ios_char *basic_ios;
11802
11803     TRACE("(%p %d %d)\n", this, mode, virt_init);
11804
11805     if(virt_init) {
11806         this->base.vbtable = basic_istringstream_char_vbtable;
11807         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11808         basic_ios_char_ctor(basic_ios);
11809     }else {
11810         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11811     }
11812
11813     basic_stringbuf_char_ctor_mode(&this->strbuf, mode|OPENMODE_in);
11814     basic_istream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11815     basic_ios->base.vtable = &MSVCP_basic_istringstream_char_vtable;
11816     return this;
11817 }
11818
11819 /* ??_F?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11820 /* ??_F?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11821 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor, 8)
11822 basic_istringstream_char* __thiscall basic_istringstream_char_ctor(
11823         basic_istringstream_char *this, MSVCP_bool virt_init)
11824 {
11825     return basic_istringstream_char_ctor_mode(this, 0, virt_init);
11826 }
11827
11828 /* ??1?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
11829 /* ??1?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
11830 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_dtor, 4)
11831 void __thiscall basic_istringstream_char_dtor(basic_ios_char *base)
11832 {
11833     basic_istringstream_char *this = basic_istringstream_char_from_basic_ios(base);
11834
11835     TRACE("(%p)\n", this);
11836
11837     basic_stringbuf_char_dtor(&this->strbuf);
11838     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
11839 }
11840
11841 /* ??_D?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11842 /* ??_D?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11843 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_vbase_dtor, 4)
11844 void __thiscall basic_istringstream_char_vbase_dtor(basic_istringstream_char *this)
11845 {
11846     TRACE("(%p)\n", this);
11847
11848     basic_istringstream_char_dtor(basic_istringstream_char_to_basic_ios(this));
11849     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base));
11850 }
11851
11852 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_vector_dtor, 8)
11853 basic_istringstream_char* __thiscall basic_istringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11854 {
11855     basic_istringstream_char *this = basic_istringstream_char_from_basic_ios(base);
11856
11857     TRACE("(%p %x)\n", this, flags);
11858
11859     if(flags & 2) {
11860         /* we have an array, with the number of elements stored before the first object */
11861         int i, *ptr = (int *)this-1;
11862
11863         for(i=*ptr-1; i>=0; i--)
11864             basic_istringstream_char_vbase_dtor(this+i);
11865         MSVCRT_operator_delete(ptr);
11866     } else {
11867         basic_istringstream_char_vbase_dtor(this);
11868         if(flags & 1)
11869             MSVCRT_operator_delete(this);
11870     }
11871
11872     return this;
11873 }
11874
11875 /* ?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 */
11876 /* ?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 */
11877 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_rdbuf, 4)
11878 basic_stringbuf_char* __thiscall basic_istringstream_char_rdbuf(const basic_istringstream_char *this)
11879 {
11880     TRACE("(%p)\n", this);
11881     return (basic_stringbuf_char*)&this->strbuf;
11882 }
11883
11884 /* ?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 */
11885 /* ?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 */
11886 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_str_set, 8)
11887 void __thiscall basic_istringstream_char_str_set(basic_istringstream_char *this, const basic_string_char *str)
11888 {
11889     TRACE("(%p %p)\n", this, str);
11890     basic_stringbuf_char_str_set(&this->strbuf, str);
11891 }
11892
11893 /* ?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 */
11894 /* ?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 */
11895 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_str_get, 8)
11896 basic_string_char* __thiscall basic_istringstream_char_str_get(const basic_istringstream_char *this, basic_string_char *ret)
11897 {
11898     TRACE("(%p %p)\n", this, ret);
11899     return basic_stringbuf_char_str_get(&this->strbuf, ret);
11900 }
11901
11902 static inline basic_ios_wchar* basic_istringstream_wchar_to_basic_ios(basic_istringstream_wchar *ptr)
11903 {
11904     return (basic_ios_wchar*)((char*)ptr+basic_istringstream_wchar_vbtable[1]);
11905 }
11906
11907 static inline basic_istringstream_wchar* basic_istringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11908 {
11909     return (basic_istringstream_wchar*)((char*)ptr-basic_istringstream_wchar_vbtable[1]);
11910 }
11911
11912 /* ??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 */
11913 /* ??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 */
11914 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor_str, 16)
11915 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor_str(basic_istringstream_wchar *this,
11916         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11917 {
11918     basic_ios_wchar *basic_ios;
11919
11920     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11921
11922     if(virt_init) {
11923         this->base.vbtable = basic_istringstream_wchar_vbtable;
11924         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
11925         basic_ios_wchar_ctor(basic_ios);
11926     }else {
11927         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
11928     }
11929
11930     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode|OPENMODE_in);
11931     basic_istream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11932     basic_ios->base.vtable = &MSVCP_basic_istringstream_wchar_vtable;
11933     return this;
11934 }
11935
11936 /* ??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 */
11937 /* ??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 */
11938 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor_str, 16)
11939 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor_str(basic_istringstream_wchar *this,
11940         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11941 {
11942     basic_istringstream_wchar_ctor_str(this, str, mode, virt_init);
11943     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_istringstream_short_vtable;
11944     return this;
11945 }
11946
11947 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
11948 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
11949 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor_mode, 12)
11950 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor_mode(
11951         basic_istringstream_wchar *this, int mode, MSVCP_bool virt_init)
11952 {
11953     basic_ios_wchar *basic_ios;
11954
11955     TRACE("(%p %d %d)\n", this, mode, virt_init);
11956
11957     if(virt_init) {
11958         this->base.vbtable = basic_istringstream_wchar_vbtable;
11959         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
11960         basic_ios_wchar_ctor(basic_ios);
11961     }else {
11962         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
11963     }
11964
11965     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode|OPENMODE_in);
11966     basic_istream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11967     basic_ios->base.vtable = &MSVCP_basic_istringstream_wchar_vtable;
11968     return this;
11969 }
11970
11971 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
11972 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
11973 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor_mode, 12)
11974 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor_mode(
11975         basic_istringstream_wchar *this, int mode, MSVCP_bool virt_init)
11976 {
11977     basic_istringstream_wchar_ctor_mode(this, mode, virt_init);
11978     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_istringstream_short_vtable;
11979     return this;
11980 }
11981
11982 /* ??_F?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11983 /* ??_F?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11984 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor, 8)
11985 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor(
11986         basic_istringstream_wchar *this, MSVCP_bool virt_init)
11987 {
11988     return basic_istringstream_wchar_ctor_mode(this, 0, virt_init);
11989 }
11990
11991 /* ??_F?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11992 /* ??_F?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11993 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor, 8)
11994 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor(
11995         basic_istringstream_wchar *this, MSVCP_bool virt_init)
11996 {
11997     return basic_istringstream_short_ctor_mode(this, 0, virt_init);
11998 }
11999
12000 /* ??1?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
12001 /* ??1?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
12002 /* ??1?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
12003 /* ??1?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
12004 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_dtor, 4)
12005 void __thiscall basic_istringstream_wchar_dtor(basic_ios_wchar *base)
12006 {
12007     basic_istringstream_wchar *this = basic_istringstream_wchar_from_basic_ios(base);
12008
12009     TRACE("(%p)\n", this);
12010
12011     basic_stringbuf_wchar_dtor(&this->strbuf);
12012     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base));
12013 }
12014
12015 /* ??_D?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12016 /* ??_D?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12017 /* ??_D?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12018 /* ??_D?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12019 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_vbase_dtor, 4)
12020 void __thiscall basic_istringstream_wchar_vbase_dtor(basic_istringstream_wchar *this)
12021 {
12022     TRACE("(%p)\n", this);
12023
12024     basic_istringstream_wchar_dtor(basic_istringstream_wchar_to_basic_ios(this));
12025     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base));
12026 }
12027
12028 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_vector_dtor, 8)
12029 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
12030 {
12031     basic_istringstream_wchar *this = basic_istringstream_wchar_from_basic_ios(base);
12032
12033     TRACE("(%p %x)\n", this, flags);
12034
12035     if(flags & 2) {
12036         /* we have an array, with the number of elements stored before the first object */
12037         int i, *ptr = (int *)this-1;
12038
12039         for(i=*ptr-1; i>=0; i--)
12040             basic_istringstream_wchar_vbase_dtor(this+i);
12041         MSVCRT_operator_delete(ptr);
12042     } else {
12043         basic_istringstream_wchar_vbase_dtor(this);
12044         if(flags & 1)
12045             MSVCRT_operator_delete(this);
12046     }
12047
12048     return this;
12049 }
12050
12051 /* ?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 */
12052 /* ?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 */
12053 /* ?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 */
12054 /* ?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 */
12055 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_rdbuf, 4)
12056 basic_stringbuf_wchar* __thiscall basic_istringstream_wchar_rdbuf(const basic_istringstream_wchar *this)
12057 {
12058     TRACE("(%p)\n", this);
12059     return (basic_stringbuf_wchar*)&this->strbuf;
12060 }
12061
12062 /* ?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 */
12063 /* ?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 */
12064 /* ?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 */
12065 /* ?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 */
12066 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_str_set, 8)
12067 void __thiscall basic_istringstream_wchar_str_set(basic_istringstream_wchar *this, const basic_string_wchar *str)
12068 {
12069     TRACE("(%p %p)\n", this, str);
12070     basic_stringbuf_wchar_str_set(&this->strbuf, str);
12071 }
12072
12073 /* ?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 */
12074 /* ?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 */
12075 /* ?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 */
12076 /* ?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 */
12077 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_str_get, 8)
12078 basic_string_wchar* __thiscall basic_istringstream_wchar_str_get(const basic_istringstream_wchar *this, basic_string_wchar *ret)
12079 {
12080     TRACE("(%p %p)\n", this, ret);
12081     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
12082 }
12083
12084 static inline basic_ios_char* basic_stringstream_char_to_basic_ios(basic_stringstream_char *ptr)
12085 {
12086     return (basic_ios_char*)((char*)ptr+basic_stringstream_char_vbtable1[1]);
12087 }
12088
12089 static inline basic_stringstream_char* basic_stringstream_char_from_basic_ios(basic_ios_char *ptr)
12090 {
12091     return (basic_stringstream_char*)((char*)ptr-basic_stringstream_char_vbtable1[1]);
12092 }
12093
12094 /* ??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 */
12095 /* ??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 */
12096 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor_str, 16)
12097 basic_stringstream_char* __thiscall basic_stringstream_char_ctor_str(basic_stringstream_char *this,
12098         const basic_string_char *str, int mode, MSVCP_bool virt_init)
12099 {
12100     basic_ios_char *basic_ios;
12101
12102     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12103
12104     if(virt_init) {
12105         this->base.base1.vbtable = basic_stringstream_char_vbtable1;
12106         this->base.base2.vbtable = basic_stringstream_char_vbtable2;
12107         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12108         basic_ios_char_ctor(basic_ios);
12109     }else {
12110         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12111     }
12112
12113     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode);
12114     basic_iostream_char_ctor(&this->base, &this->strbuf.base, FALSE);
12115     basic_ios->base.vtable = &MSVCP_basic_stringstream_char_vtable;
12116     return this;
12117 }
12118
12119 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
12120 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
12121 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor_mode, 12)
12122 basic_stringstream_char* __thiscall basic_stringstream_char_ctor_mode(
12123         basic_stringstream_char *this, int mode, MSVCP_bool virt_init)
12124 {
12125     basic_ios_char *basic_ios;
12126
12127     TRACE("(%p %d %d)\n", this, mode, virt_init);
12128
12129     if(virt_init) {
12130         this->base.base1.vbtable = basic_stringstream_char_vbtable1;
12131         this->base.base2.vbtable = basic_stringstream_char_vbtable2;
12132         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12133         basic_ios_char_ctor(basic_ios);
12134     }else {
12135         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12136     }
12137
12138     basic_stringbuf_char_ctor_mode(&this->strbuf, mode);
12139     basic_iostream_char_ctor(&this->base, &this->strbuf.base, FALSE);
12140     basic_ios->base.vtable = &MSVCP_basic_stringstream_char_vtable;
12141     return this;
12142 }
12143
12144 /* ??_F?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
12145 /* ??_F?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
12146 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor, 8)
12147 basic_stringstream_char* __thiscall basic_stringstream_char_ctor(
12148         basic_stringstream_char *this, MSVCP_bool virt_init)
12149 {
12150     return basic_stringstream_char_ctor_mode(
12151             this, OPENMODE_out|OPENMODE_in, virt_init);
12152 }
12153
12154 /* ??1?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
12155 /* ??1?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
12156 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_dtor, 4)
12157 void __thiscall basic_stringstream_char_dtor(basic_ios_char *base)
12158 {
12159     basic_stringstream_char *this = basic_stringstream_char_from_basic_ios(base);
12160
12161     TRACE("(%p)\n", this);
12162
12163     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
12164     basic_stringbuf_char_dtor(&this->strbuf);
12165 }
12166
12167 /* ??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
12168 /* ??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
12169 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_vbase_dtor, 4)
12170 void __thiscall basic_stringstream_char_vbase_dtor(basic_stringstream_char *this)
12171 {
12172     TRACE("(%p)\n", this);
12173
12174     basic_stringstream_char_dtor(basic_stringstream_char_to_basic_ios(this));
12175     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
12176 }
12177
12178 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_vector_dtor, 8)
12179 basic_stringstream_char* __thiscall basic_stringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
12180 {
12181     basic_stringstream_char *this = basic_stringstream_char_from_basic_ios(base);
12182
12183     TRACE("(%p %x)\n", this, flags);
12184
12185     if(flags & 2) {
12186         /* we have an array, with the number of elements stored before the first object */
12187         int i, *ptr = (int *)this-1;
12188
12189         for(i=*ptr-1; i>=0; i--)
12190             basic_stringstream_char_vbase_dtor(this+i);
12191         MSVCRT_operator_delete(ptr);
12192     } else {
12193         basic_stringstream_char_vbase_dtor(this);
12194         if(flags & 1)
12195             MSVCRT_operator_delete(this);
12196     }
12197
12198     return this;
12199 }
12200
12201 /* ?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 */
12202 /* ?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 */
12203 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_rdbuf, 4)
12204 basic_stringbuf_char* __thiscall basic_stringstream_char_rdbuf(const basic_stringstream_char *this)
12205 {
12206     TRACE("(%p)\n", this);
12207     return (basic_stringbuf_char*)&this->strbuf;
12208 }
12209
12210 /* ?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 */
12211 /* ?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 */
12212 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_str_set, 8)
12213 void __thiscall basic_stringstream_char_str_set(basic_stringstream_char *this, const basic_string_char *str)
12214 {
12215     TRACE("(%p %p)\n", this, str);
12216     basic_stringbuf_char_str_set(&this->strbuf, str);
12217 }
12218
12219 /* ?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 */
12220 /* ?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 */
12221 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_str_get, 8)
12222 basic_string_char* __thiscall basic_stringstream_char_str_get(const basic_stringstream_char *this, basic_string_char *ret)
12223 {
12224     TRACE("(%p %p)\n", this, ret);
12225     return basic_stringbuf_char_str_get(&this->strbuf, ret);
12226 }
12227
12228 static inline basic_ios_wchar* basic_stringstream_wchar_to_basic_ios(basic_stringstream_wchar *ptr)
12229 {
12230     return (basic_ios_wchar*)((char*)ptr+basic_stringstream_wchar_vbtable1[1]);
12231 }
12232
12233 static inline basic_stringstream_wchar* basic_stringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
12234 {
12235     return (basic_stringstream_wchar*)((char*)ptr-basic_stringstream_wchar_vbtable1[1]);
12236 }
12237
12238 /* ??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 */
12239 /* ??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 */
12240 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor_str, 16)
12241 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor_str(basic_stringstream_wchar *this,
12242         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12243 {
12244     basic_ios_wchar *basic_ios;
12245
12246     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12247
12248     if(virt_init) {
12249         this->base.base1.vbtable = basic_stringstream_wchar_vbtable1;
12250         this->base.base2.vbtable = basic_stringstream_wchar_vbtable2;
12251         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12252         basic_ios_wchar_ctor(basic_ios);
12253     }else {
12254         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12255     }
12256
12257     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode);
12258     basic_iostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE);
12259     basic_ios->base.vtable = &MSVCP_basic_stringstream_wchar_vtable;
12260     return this;
12261 }
12262
12263 /* ??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 */
12264 /* ??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 */
12265 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor_str, 16)
12266 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor_str(basic_stringstream_wchar *this,
12267         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12268 {
12269     basic_stringstream_wchar_ctor_str(this, str, mode, virt_init);
12270     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_stringstream_short_vtable;
12271     return this;
12272 }
12273
12274 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
12275 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
12276 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor_mode, 12)
12277 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor_mode(
12278         basic_stringstream_wchar *this, int mode, MSVCP_bool virt_init)
12279 {
12280     basic_ios_wchar *basic_ios;
12281
12282     TRACE("(%p %d %d)\n", this, mode, virt_init);
12283
12284     if(virt_init) {
12285         this->base.base1.vbtable = basic_stringstream_wchar_vbtable1;
12286         this->base.base2.vbtable = basic_stringstream_wchar_vbtable2;
12287         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12288         basic_ios_wchar_ctor(basic_ios);
12289     }else {
12290         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12291     }
12292
12293     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode);
12294     basic_iostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE);
12295     basic_ios->base.vtable = &MSVCP_basic_stringstream_wchar_vtable;
12296     return this;
12297 }
12298
12299 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
12300 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
12301 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor_mode, 12)
12302 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor_mode(
12303         basic_stringstream_wchar *this, int mode, MSVCP_bool virt_init)
12304 {
12305     basic_stringstream_wchar_ctor_mode(this, mode, virt_init);
12306     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_stringstream_short_vtable;
12307     return this;
12308 }
12309
12310 /* ??_F?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12311 /* ??_F?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12312 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor, 8)
12313 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor(
12314         basic_stringstream_wchar *this, MSVCP_bool virt_init)
12315 {
12316     return basic_stringstream_wchar_ctor_mode(
12317             this, OPENMODE_out|OPENMODE_in, virt_init);
12318 }
12319
12320 /* ??_F?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12321 /* ??_F?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12322 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor, 8)
12323 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor(
12324         basic_stringstream_wchar *this, MSVCP_bool virt_init)
12325 {
12326     return basic_stringstream_short_ctor_mode(
12327             this, OPENMODE_out|OPENMODE_in, virt_init);
12328 }
12329
12330 /* ??1?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
12331 /* ??1?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
12332 /* ??1?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
12333 /* ??1?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
12334 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_dtor, 4)
12335 void __thiscall basic_stringstream_wchar_dtor(basic_ios_wchar *base)
12336 {
12337     basic_stringstream_wchar *this = basic_stringstream_wchar_from_basic_ios(base);
12338
12339     TRACE("(%p)\n", this);
12340
12341     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(&this->base));
12342     basic_stringbuf_wchar_dtor(&this->strbuf);
12343 }
12344
12345 /* ??_D?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12346 /* ??_D?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12347 /* ??_D?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12348 /* ??_D?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12349 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_vbase_dtor, 4)
12350 void __thiscall basic_stringstream_wchar_vbase_dtor(basic_stringstream_wchar *this)
12351 {
12352     TRACE("(%p)\n", this);
12353
12354     basic_stringstream_wchar_dtor(basic_stringstream_wchar_to_basic_ios(this));
12355     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base.base1));
12356 }
12357
12358 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_vector_dtor, 8)
12359 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
12360 {
12361     basic_stringstream_wchar *this = basic_stringstream_wchar_from_basic_ios(base);
12362
12363     TRACE("(%p %x)\n", this, flags);
12364
12365     if(flags & 2) {
12366         /* we have an array, with the number of elements stored before the first object */
12367         int i, *ptr = (int *)this-1;
12368
12369         for(i=*ptr-1; i>=0; i--)
12370             basic_stringstream_wchar_vbase_dtor(this+i);
12371         MSVCRT_operator_delete(ptr);
12372     } else {
12373         basic_stringstream_wchar_vbase_dtor(this);
12374         if(flags & 1)
12375             MSVCRT_operator_delete(this);
12376     }
12377
12378     return this;
12379 }
12380
12381 /* ?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 */
12382 /* ?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 */
12383 /* ?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 */
12384 /* ?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 */
12385 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_rdbuf, 4)
12386 basic_stringbuf_wchar* __thiscall basic_stringstream_wchar_rdbuf(const basic_stringstream_wchar *this)
12387 {
12388     TRACE("(%p)\n", this);
12389     return (basic_stringbuf_wchar*)&this->strbuf;
12390 }
12391
12392 /* ?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 */
12393 /* ?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 */
12394 /* ?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 */
12395 /* ?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 */
12396 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_str_set, 8)
12397 void __thiscall basic_stringstream_wchar_str_set(basic_stringstream_wchar *this, const basic_string_wchar *str)
12398 {
12399     TRACE("(%p %p)\n", this, str);
12400     basic_stringbuf_wchar_str_set(&this->strbuf, str);
12401 }
12402
12403 /* ?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 */
12404 /* ?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 */
12405 /* ?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 */
12406 /* ?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 */
12407 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_str_get, 8)
12408 basic_string_wchar* __thiscall basic_stringstream_wchar_str_get(const basic_stringstream_wchar *this, basic_string_wchar *ret)
12409 {
12410     TRACE("(%p %p)\n", this, ret);
12411     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
12412 }
12413
12414 /* ?_Init@strstreambuf@std@@IAEXHPAD0H@Z */
12415 /* ?_Init@strstreambuf@std@@IEAAX_JPEAD1H@Z */
12416 DEFINE_THISCALL_WRAPPER(strstreambuf__Init, 24)
12417 void __thiscall strstreambuf__Init(strstreambuf *this, streamsize len, char *g, char *p, int mode)
12418 {
12419     TRACE("(%p %s %p %p %d)\n", this, wine_dbgstr_longlong(len), g, p, mode);
12420
12421     this->minsize = 32;
12422     this->endsave = NULL;
12423     this->strmode = mode;
12424     this->palloc = NULL;
12425     this->pfree = NULL;
12426
12427     if(!g) {
12428         this->strmode |= STRSTATE_Dynamic;
12429         if(len > this->minsize)
12430             this->minsize = len;
12431         this->seekhigh = NULL;
12432         return;
12433     }
12434
12435     if(len < 0)
12436         len = INT_MAX;
12437     else if(!len)
12438         len = strlen(g);
12439
12440     this->seekhigh = g+len;
12441     basic_streambuf_char_setg(&this->base, g, g, p ? p : this->seekhigh);
12442     if(p)
12443         basic_streambuf_char_setp(&this->base, p, this->seekhigh);
12444 }
12445
12446 /* ??0strstreambuf@std@@QAE@PACH0@Z */
12447 /* ??0strstreambuf@std@@QEAA@PEAC_J0@Z */
12448 /* ??0strstreambuf@std@@QAE@PADH0@Z */
12449 /* ??0strstreambuf@std@@QEAA@PEAD_J0@Z */
12450 /* ??0strstreambuf@std@@QAE@PAEH0@Z */
12451 /* ??0strstreambuf@std@@QEAA@PEAE_J0@Z */
12452 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_get_put, 20)
12453 strstreambuf* __thiscall strstreambuf_ctor_get_put(strstreambuf *this, char *g, streamsize len, char *p)
12454 {
12455     TRACE("(%p %p %s %p)\n", this, g, wine_dbgstr_longlong(len), p);
12456
12457     basic_streambuf_char_ctor(&this->base);
12458     this->base.vtable = &MSVCP_strstreambuf_vtable;
12459
12460     strstreambuf__Init(this, len, g, p, 0);
12461     return this;
12462 }
12463
12464 /* ??0strstreambuf@std@@QAE@H@Z */
12465 /* ??0strstreambuf@std@@QEAA@_J@Z */
12466 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_len, 12)
12467 strstreambuf* __thiscall strstreambuf_ctor_len(strstreambuf *this, streamsize len)
12468 {
12469     return strstreambuf_ctor_get_put(this, NULL, len, NULL);
12470 }
12471
12472 /* ??0strstreambuf@std@@QAE@P6APAXI@ZP6AXPAX@Z@Z */
12473 /* ??0strstreambuf@std@@QEAA@P6APEAX_K@ZP6AXPEAX@Z@Z */
12474 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_alloc, 12)
12475 strstreambuf* __thiscall strstreambuf_ctor_alloc(strstreambuf *this, void* (__cdecl *palloc)(MSVCP_size_t), void (__cdecl *pfree)(void*))
12476 {
12477     TRACE("(%p %p %p)\n", this, palloc, pfree);
12478
12479     strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12480     this->palloc = palloc;
12481     this->pfree = pfree;
12482     return this;
12483 }
12484
12485 /* ??0strstreambuf@std@@QAE@PBCH@Z */
12486 /* ??0strstreambuf@std@@QEAA@PEBC_J@Z */
12487 /* ??0strstreambuf@std@@QAE@PBDH@Z */
12488 /* ??0strstreambuf@std@@QEAA@PEBD_J@Z */
12489 /* ??0strstreambuf@std@@QAE@PBEH@Z */
12490 /* ??0strstreambuf@std@@QEAA@PEBE_J@Z */
12491 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_get, 16)
12492 strstreambuf* __thiscall strstreambuf_ctor_get(strstreambuf *this, const char *g, streamsize len)
12493 {
12494     TRACE("(%p %p %s)\n", this, g, wine_dbgstr_longlong(len));
12495
12496     strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12497     this->strmode |= STRSTATE_Constant;
12498     return this;
12499 }
12500
12501 /* ??_Fstrstreambuf@std@@QAEXXZ */
12502 /* ??_Fstrstreambuf@std@@QEAAXXZ */
12503 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor, 4)
12504 strstreambuf* __thiscall strstreambuf_ctor(strstreambuf *this)
12505 {
12506     return strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12507 }
12508
12509 /* ?_Tidy@strstreambuf@std@@IAEXXZ */
12510 /* ?_Tidy@strstreambuf@std@@IEAAXXZ */
12511 DEFINE_THISCALL_WRAPPER(strstreambuf__Tidy, 4)
12512 void __thiscall strstreambuf__Tidy(strstreambuf *this)
12513 {
12514     TRACE("(%p)\n", this);
12515
12516     if((this->strmode & STRSTATE_Allocated) && !(this->strmode & STRSTATE_Frozen)) {
12517         if(this->pfree)
12518             this->pfree(basic_streambuf_char_eback(&this->base));
12519         else
12520             MSVCRT_operator_delete(basic_streambuf_char_eback(&this->base));
12521     }
12522
12523     this->endsave = NULL;
12524     this->seekhigh = NULL;
12525     this->strmode &= ~(STRSTATE_Allocated | STRSTATE_Frozen);
12526     basic_streambuf_char_setg(&this->base, NULL, NULL, NULL);
12527     basic_streambuf_char_setp(&this->base, NULL, NULL);
12528 }
12529
12530 /* ??1strstreambuf@std@@UAE@XZ */
12531 /* ??1strstreambuf@std@@UEAA@XZ */
12532 DEFINE_THISCALL_WRAPPER(strstreambuf_dtor, 4)
12533 void __thiscall strstreambuf_dtor(strstreambuf *this)
12534 {
12535     TRACE("(%p)\n", this);
12536
12537     strstreambuf__Tidy(this);
12538     basic_streambuf_char_dtor(&this->base);
12539 }
12540
12541 DEFINE_THISCALL_WRAPPER(strstreambuf_vector_dtor, 8)
12542 strstreambuf* __thiscall strstreambuf_vector_dtor(strstreambuf *this, unsigned int flags)
12543 {
12544     TRACE("(%p %x)\n", this, flags);
12545     if(flags & 2) {
12546         /* we have an array, with the number of elements stored before the first object */
12547         int i, *ptr = (int *)this-1;
12548
12549         for(i=*ptr-1; i>=0; i--)
12550             strstreambuf_dtor(this+i);
12551         MSVCRT_operator_delete(ptr);
12552     } else {
12553         strstreambuf_dtor(this);
12554         if(flags & 1)
12555             MSVCRT_operator_delete(this);
12556     }
12557
12558     return this;
12559 }
12560
12561 /* ?freeze@strstreambuf@std@@QAEX_N@Z */
12562 /* ?freeze@strstreambuf@std@@QEAAX_N@Z */
12563 DEFINE_THISCALL_WRAPPER(strstreambuf_freeze, 8)
12564 void __thiscall strstreambuf_freeze(strstreambuf *this, MSVCP_bool freeze)
12565 {
12566     TRACE("(%p %d)\n", this, freeze);
12567
12568     if(!freeze == !(this->strmode *STRSTATE_Frozen))
12569         return;
12570
12571     if(freeze) {
12572         this->strmode |= STRSTATE_Frozen;
12573         this->endsave = basic_streambuf_char_epptr(&this->base);
12574         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
12575                 basic_streambuf_char_pptr(&this->base), basic_streambuf_char_eback(&this->base));
12576     }else {
12577         this->strmode &= ~STRSTATE_Frozen;
12578         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
12579                 basic_streambuf_char_pptr(&this->base), this->endsave);
12580     }
12581 }
12582
12583 /* ?str@strstreambuf@std@@QAEPADXZ */
12584 /* ?str@strstreambuf@std@@QEAAPEADXZ */
12585 DEFINE_THISCALL_WRAPPER(strstreambuf_str, 4)
12586 char* __thiscall strstreambuf_str(strstreambuf *this)
12587 {
12588     TRACE("(%p)\n", this);
12589
12590     strstreambuf_freeze(this, TRUE);
12591     return basic_streambuf_char_gptr(&this->base);
12592 }
12593
12594 /* ?pcount@strstreambuf@std@@QBEHXZ */
12595 /* ?pcount@strstreambuf@std@@QEBA_JXZ */
12596 DEFINE_THISCALL_WRAPPER(strstreambuf_pcount, 4)
12597 streamsize __thiscall strstreambuf_pcount(const strstreambuf *this)
12598 {
12599     char *ppos = basic_streambuf_char_pptr(&this->base);
12600
12601     TRACE("(%p)\n", this);
12602
12603     return ppos ? ppos-basic_streambuf_char_pbase(&this->base) : 0;
12604 }
12605
12606 /* ?overflow@strstreambuf@std@@MAEHH@Z */
12607 /* ?overflow@strstreambuf@std@@MEAAHH@Z */
12608 DEFINE_THISCALL_WRAPPER(strstreambuf_overflow, 8)
12609 int __thiscall strstreambuf_overflow(strstreambuf *this, int c)
12610 {
12611     MSVCP_size_t old_size, size;
12612     char *ptr, *buf;
12613
12614     TRACE("(%p %d)\n", this, c);
12615
12616     if(c == EOF)
12617         return !EOF;
12618
12619     if(this->strmode & STRSTATE_Frozen)
12620         return EOF;
12621
12622     ptr = basic_streambuf_char_pptr(&this->base);
12623     if(ptr && ptr<basic_streambuf_char_epptr(&this->base))
12624         return (unsigned char)(*basic_streambuf_char__Pninc(&this->base) = c);
12625
12626     if(!(this->strmode & STRSTATE_Dynamic) || (this->strmode & STRSTATE_Constant))
12627         return EOF;
12628
12629     ptr = basic_streambuf_char_eback(&this->base);
12630     old_size = ptr ? basic_streambuf_char_epptr(&this->base) - ptr : 0;
12631
12632     size = old_size + old_size/2;
12633     if(size < this->minsize)
12634         size = this->minsize;
12635
12636     if(this->palloc)
12637         buf = this->palloc(size);
12638     else
12639         buf = MSVCRT_operator_new(size);
12640     if(!buf)
12641         return EOF;
12642
12643     memcpy(buf, ptr, old_size);
12644     if(this->strmode & STRSTATE_Allocated) {
12645         if(this->pfree)
12646             this->pfree(ptr);
12647         else
12648             MSVCRT_operator_delete(ptr);
12649     }
12650
12651     this->strmode |= STRSTATE_Allocated;
12652     if(!old_size) {
12653         this->seekhigh = buf;
12654         basic_streambuf_char_setp(&this->base, buf, buf+size);
12655         basic_streambuf_char_setg(&this->base, buf, buf, buf);
12656     }else {
12657         this->seekhigh = this->seekhigh-ptr+buf;
12658         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base)-ptr+buf,
12659                 basic_streambuf_char_pptr(&this->base)-ptr+buf, buf+size);
12660         basic_streambuf_char_setg(&this->base, buf, basic_streambuf_char_gptr(&this->base)-ptr+buf,
12661                 basic_streambuf_char_pptr(&this->base));
12662     }
12663
12664     return (unsigned char)(*basic_streambuf_char__Pninc(&this->base) = c);
12665 }
12666
12667 /* ?pbackfail@strstreambuf@std@@MAEHH@Z */
12668 /* ?pbackfail@strstreambuf@std@@MEAAHH@Z */
12669 DEFINE_THISCALL_WRAPPER(strstreambuf_pbackfail, 8)
12670 int __thiscall strstreambuf_pbackfail(strstreambuf *this, int c)
12671 {
12672     char *ptr = basic_streambuf_char_gptr(&this->base);
12673
12674     TRACE("(%p %d)\n", this, c);
12675
12676     if(ptr<=basic_streambuf_char_eback(&this->base)
12677             || ((this->strmode & STRSTATE_Constant) && c!=ptr[-1]))
12678         return EOF;
12679
12680     basic_streambuf_char_gbump(&this->base, -1);
12681     if(c == EOF)
12682         return !EOF;
12683     if(this->strmode & STRSTATE_Constant)
12684         return (unsigned char)c;
12685
12686     return (unsigned char)(ptr[0] = c);
12687 }
12688
12689 /* ?seekoff@strstreambuf@std@@MAE?AV?$fpos@H@2@JHH@Z */
12690 /* ?seekoff@strstreambuf@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
12691 DEFINE_THISCALL_WRAPPER(strstreambuf_seekoff, 24)
12692 fpos_int* __thiscall strstreambuf_seekoff(strstreambuf *this, fpos_int *ret, streamoff off, int way, int mode)
12693 {
12694     char *eback = basic_streambuf_char_eback(&this->base);
12695     char *pptr = basic_streambuf_char_pptr(&this->base);
12696     char *gptr = basic_streambuf_char_gptr(&this->base);
12697
12698     TRACE("(%p %p %s %d %d)\n", this, ret, wine_dbgstr_longlong(off), way, mode);
12699
12700     ret->off = 0;
12701     ret->state = 0;
12702
12703     if(pptr > this->seekhigh)
12704         this->seekhigh = pptr;
12705
12706     if((mode & OPENMODE_in) && gptr) {
12707         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
12708             off += gptr-eback;
12709         else if(way == SEEKDIR_end)
12710             off += this->seekhigh-eback;
12711         else if(way != SEEKDIR_beg)
12712             off = -1;
12713
12714         if(off<0 || off>this->seekhigh-eback) {
12715             off = -1;
12716         }else {
12717             basic_streambuf_char_gbump(&this->base, eback-gptr+off);
12718             if((mode & OPENMODE_out) && pptr) {
12719                 basic_streambuf_char_setp_next(&this->base, eback,
12720                         gptr, basic_streambuf_char_epptr(&this->base));
12721             }
12722         }
12723     }else if((mode & OPENMODE_out) && pptr) {
12724         if(way == SEEKDIR_cur)
12725             off += pptr-eback;
12726         else if(way == SEEKDIR_end)
12727             off += this->seekhigh-eback;
12728         else if(way != SEEKDIR_beg)
12729             off = -1;
12730
12731          if(off<0 || off>this->seekhigh-eback)
12732              off = -1;
12733          else
12734              basic_streambuf_char_pbump(&this->base, eback-pptr+off);
12735     }else {
12736         off = -1;
12737     }
12738
12739     ret->pos = off;
12740     return ret;
12741 }
12742
12743 /* ?seekpos@strstreambuf@std@@MAE?AV?$fpos@H@2@V32@H@Z */
12744 /* ?seekpos@strstreambuf@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
12745 DEFINE_THISCALL_WRAPPER(strstreambuf_seekpos, 36)
12746 fpos_int* __thiscall strstreambuf_seekpos(strstreambuf *this, fpos_int *ret, fpos_int pos, int mode)
12747 {
12748     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
12749
12750     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
12751         *ret = pos;
12752         return ret;
12753     }
12754
12755     return strstreambuf_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
12756 }
12757
12758 /* ?underflow@strstreambuf@std@@MAEHXZ */
12759 /* ?underflow@strstreambuf@std@@MEAAHXZ */
12760 DEFINE_THISCALL_WRAPPER(strstreambuf_underflow, 4)
12761 int __thiscall strstreambuf_underflow(strstreambuf *this)
12762 {
12763     char *gptr = basic_streambuf_char_gptr(&this->base);
12764     char *pptr;
12765
12766     TRACE("(%p)\n", this);
12767
12768     if(!gptr)
12769         return EOF;
12770
12771     if(gptr < basic_streambuf_char_egptr(&this->base))
12772         return (unsigned char)(*gptr);
12773
12774     pptr = basic_streambuf_char_gptr(&this->base);
12775     if(pptr > this->seekhigh)
12776         this->seekhigh = pptr;
12777
12778     if(this->seekhigh <= gptr)
12779         return EOF;
12780
12781     basic_streambuf_char_setg(&this->base, basic_streambuf_char_eback(&this->base),
12782             gptr, this->seekhigh);
12783     return (unsigned char)(*gptr);
12784 }
12785
12786 static void __cdecl setprecision_func(ios_base *base, streamsize prec)
12787 {
12788     ios_base_precision_set(base, prec);
12789 }
12790
12791 /* ?setprecision@std@@YA?AU?$_Smanip@H@1@H@Z */
12792 /* ?setprecision@std@@YA?AU?$_Smanip@_J@1@_J@Z */
12793 manip_streamsize* __cdecl setprecision(manip_streamsize *ret, streamsize prec)
12794 {
12795     TRACE("(%p %s)\n", ret, wine_dbgstr_longlong(prec));
12796
12797     ret->pfunc = setprecision_func;
12798     ret->arg = prec;
12799     return ret;
12800 }
12801
12802 static void __cdecl setw_func(ios_base *base, streamsize width)
12803 {
12804     ios_base_width_set(base, width);
12805 }
12806
12807 /* ?setw@std@@YA?AU?$_Smanip@H@1@H@Z */
12808 /* ?setw@std@@YA?AU?$_Smanip@_J@1@_J@Z */
12809 manip_streamsize* __cdecl setw(manip_streamsize *ret, streamsize width)
12810 {
12811     TRACE("(%p %s)\n", ret, wine_dbgstr_longlong(width));
12812
12813     ret->pfunc = setw_func;
12814     ret->arg = width;
12815     return ret;
12816 }
12817
12818 static basic_filebuf_char filebuf_char_stdin;
12819 /* ?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A */
12820 struct {
12821     basic_istream_char obj;
12822     basic_ios_char vbase;
12823 } cin = { { 0 } };
12824 /* ?_Ptr_cin@std@@3PAV?$basic_istream@DU?$char_traits@D@std@@@1@A */
12825 /* ?_Ptr_cin@std@@3PEAV?$basic_istream@DU?$char_traits@D@std@@@1@EA */
12826 basic_istream_char *_Ptr_cin = &cin.obj;
12827
12828 static basic_filebuf_wchar filebuf_short_stdin;
12829 /* ?wcin@std@@3V?$basic_istream@GU?$char_traits@G@std@@@1@A */
12830 struct {
12831     basic_istream_wchar obj;
12832     basic_ios_wchar vbase;
12833 } ucin = { { 0 } };
12834 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@GU?$char_traits@G@std@@@1@A */
12835 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@GU?$char_traits@G@std@@@1@EA */
12836 basic_istream_wchar *_Ptr_ucin = &ucin.obj;
12837
12838 static basic_filebuf_wchar filebuf_wchar_stdin;
12839 /* ?wcin@std@@3V?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
12840 struct {
12841     basic_istream_wchar obj;
12842     basic_ios_wchar vbase;
12843 } wcin = { { 0 } };
12844 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
12845 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@EA */
12846 basic_istream_wchar *_Ptr_wcin = &wcin.obj;
12847
12848 static basic_filebuf_char filebuf_char_stdout;
12849 /* ?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12850 struct {
12851     basic_ostream_char obj;
12852     basic_ios_char vbase;
12853 } cout = { { 0 } };
12854 /* ?_Ptr_cout@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12855 /* ?_Ptr_cout@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
12856 basic_ostream_char *_Ptr_cout = &cout.obj;
12857
12858 static basic_filebuf_wchar filebuf_short_stdout;
12859 /* ?wcout@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12860 struct {
12861     basic_ostream_wchar obj;
12862     basic_ios_wchar vbase;
12863 } ucout = { { 0 } };
12864 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12865 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
12866 basic_ostream_wchar *_Ptr_ucout = &ucout.obj;
12867
12868 static basic_filebuf_wchar filebuf_wchar_stdout;
12869 /* ?wcout@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12870 struct {
12871     basic_ostream_wchar obj;
12872     basic_ios_wchar vbase;
12873 } wcout = { { 0 } };
12874 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12875 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
12876 basic_ostream_wchar *_Ptr_wcout = &wcout.obj;
12877
12878 static basic_filebuf_char filebuf_char_stderr;
12879 /* ?cerr@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12880 struct {
12881     basic_ostream_char obj;
12882     basic_ios_char vbase;
12883 } cerr = { { 0 } };
12884 /* ?_Ptr_cerr@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12885 /* ?_Ptr_cerr@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
12886 basic_ostream_char *_Ptr_cerr = &cerr.obj;
12887
12888 static basic_filebuf_wchar filebuf_short_stderr;
12889 /* ?wcerr@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12890 struct {
12891     basic_ostream_wchar obj;
12892     basic_ios_wchar vbase;
12893 } ucerr = { { 0 } };
12894 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12895 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
12896 basic_ostream_wchar *_Ptr_ucerr = &ucerr.obj;
12897
12898 static basic_filebuf_wchar filebuf_wchar_stderr;
12899 /* ?wcerr@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12900 struct {
12901     basic_ostream_wchar obj;
12902     basic_ios_wchar vbase;
12903 } wcerr = { { 0 } };
12904 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12905 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
12906 basic_ostream_wchar *_Ptr_wcerr = &wcerr.obj;
12907
12908 static basic_filebuf_char filebuf_char_log;
12909 /* ?clog@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12910 struct {
12911     basic_ostream_char obj;
12912     basic_ios_char vbase;
12913 } clog = { { 0 } };
12914 /* ?_Ptr_clog@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12915 /* ?_Ptr_clog@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
12916 basic_ostream_char *_Ptr_clog = &clog.obj;
12917
12918 static basic_filebuf_wchar filebuf_short_log;
12919 /* ?wclog@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12920 struct {
12921     basic_ostream_wchar obj;
12922     basic_ios_wchar vbase;
12923 } uclog = { { 0 } };
12924 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12925 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
12926 basic_ostream_wchar *_Ptr_uclog = &uclog.obj;
12927
12928 static basic_filebuf_wchar filebuf_wchar_log;
12929 /* ?wclog@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12930 struct {
12931     basic_ostream_wchar obj;
12932     basic_ios_wchar vbase;
12933 } wclog = { { 0 } };
12934 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12935 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
12936 basic_ostream_wchar *_Ptr_wclog = &wclog.obj;
12937
12938 void init_io(void)
12939 {
12940     basic_filebuf_char_ctor_file(&filebuf_char_stdin, stdin);
12941     basic_istream_char_ctor(&cin.obj, &filebuf_char_stdin.base, FALSE/*FIXME*/, TRUE);
12942
12943     basic_filebuf_short_ctor_file(&filebuf_short_stdin, stdin);
12944     basic_istream_short_ctor(&ucin.obj, &filebuf_short_stdin.base, FALSE/*FIXME*/, TRUE);
12945
12946     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdin, stdin);
12947     basic_istream_wchar_ctor(&wcin.obj, &filebuf_wchar_stdin.base, FALSE/*FIXME*/, TRUE);
12948
12949     basic_filebuf_char_ctor_file(&filebuf_char_stdout, stdout);
12950     basic_ostream_char_ctor(&cout.obj, &filebuf_char_stdout.base, FALSE/*FIXME*/, TRUE);
12951
12952     basic_filebuf_short_ctor_file(&filebuf_short_stdout, stdout);
12953     basic_ostream_short_ctor(&ucout.obj, &filebuf_short_stdout.base, FALSE/*FIXME*/, TRUE);
12954
12955     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdout, stdout);
12956     basic_ostream_wchar_ctor(&wcout.obj, &filebuf_wchar_stdout.base, FALSE/*FIXME*/, TRUE);
12957
12958     basic_filebuf_char_ctor_file(&filebuf_char_stderr, stderr);
12959     basic_ostream_char_ctor(&cerr.obj, &filebuf_char_stderr.base, FALSE/*FIXME*/, TRUE);
12960
12961     basic_filebuf_short_ctor_file(&filebuf_short_stderr, stderr);
12962     basic_ostream_short_ctor(&ucerr.obj, &filebuf_short_stderr.base, FALSE/*FIXME*/, TRUE);
12963
12964     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stderr, stderr);
12965     basic_ostream_wchar_ctor(&wcerr.obj, &filebuf_wchar_stderr.base, FALSE/*FIXME*/, TRUE);
12966
12967     basic_filebuf_char_ctor_file(&filebuf_char_log, stderr);
12968     basic_ostream_char_ctor(&clog.obj, &filebuf_char_log.base, FALSE/*FIXME*/, TRUE);
12969
12970     basic_filebuf_short_ctor_file(&filebuf_short_log, stderr);
12971     basic_ostream_short_ctor(&uclog.obj, &filebuf_short_log.base, FALSE/*FIXME*/, TRUE);
12972
12973     basic_filebuf_wchar_ctor_file(&filebuf_wchar_log, stderr);
12974     basic_ostream_wchar_ctor(&wclog.obj, &filebuf_wchar_log.base, FALSE/*FIXME*/, TRUE);
12975 }
12976
12977 void free_io(void)
12978 {
12979     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&cin.obj));
12980     basic_filebuf_char_dtor(&filebuf_char_stdin);
12981
12982     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&ucin.obj));
12983     basic_filebuf_wchar_dtor(&filebuf_short_stdin);
12984
12985     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&wcin.obj));
12986     basic_filebuf_wchar_dtor(&filebuf_wchar_stdin);
12987
12988     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&cout.obj));
12989     basic_filebuf_char_dtor(&filebuf_char_stdout);
12990
12991     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&ucout.obj));
12992     basic_filebuf_wchar_dtor(&filebuf_short_stdout);
12993
12994     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wcout.obj));
12995     basic_filebuf_wchar_dtor(&filebuf_wchar_stdout);
12996
12997     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&cerr.obj));
12998     basic_filebuf_char_dtor(&filebuf_char_stderr);
12999
13000     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&ucerr.obj));
13001     basic_filebuf_wchar_dtor(&filebuf_short_stderr);
13002
13003     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wcerr.obj));
13004     basic_filebuf_wchar_dtor(&filebuf_wchar_stderr);
13005
13006     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&clog.obj));
13007     basic_filebuf_char_dtor(&filebuf_char_log);
13008
13009     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&uclog.obj));
13010     basic_filebuf_wchar_dtor(&filebuf_short_log);
13011
13012     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wclog.obj));
13013     basic_filebuf_wchar_dtor(&filebuf_wchar_log);
13014 }