[PATCH] msvcirt: Implement remainder of fstream class.

Gijs Vermeulen gijsvrm at gmail.com
Sun Feb 21 11:05:02 CST 2021


---
 dlls/msvcirt/msvcirt.c       | 157 ++++++++++++++
 dlls/msvcirt/msvcirt.spec    |  52 ++---
 dlls/msvcirt/tests/msvcirt.c | 397 ++++++++++++++++++++++++++++++++++-
 dlls/msvcrt20/msvcrt20.spec  |  52 ++---
 dlls/msvcrt40/msvcrt40.spec  |  52 ++---
 5 files changed, 625 insertions(+), 85 deletions(-)

diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c
index a8f162e7f702..4d0dc1521f68 100644
--- a/dlls/msvcirt/msvcirt.c
+++ b/dlls/msvcirt/msvcirt.c
@@ -4811,6 +4811,66 @@ stdiobuf* __thiscall stdiostream_rdbuf(const iostream *this)
     return (stdiobuf*) istream_get_ios(&this->base1)->sb;
 }
 
+/* ??0fstream@@QAE at ABV0@@Z */
+/* ??0fstream@@QEAA at AEBV0@@Z */
+DEFINE_THISCALL_WRAPPER(fstream_copy_ctor, 12)
+iostream* __thiscall fstream_copy_ctor(iostream *this, const iostream *copy, BOOL virt_init)
+{
+    TRACE("(%p %p %d)\n", this, copy, virt_init);
+    iostream_internal_copy_ctor(this, copy, &MSVCP_fstream_vtable, virt_init);
+    return this;
+}
+
+/* ??0fstream@@QAE at HPADH@Z */
+/* ??0fstream@@QEAA at HPEADH@Z */
+DEFINE_THISCALL_WRAPPER(fstream_buffer_ctor, 20)
+iostream* __thiscall fstream_buffer_ctor(iostream *this, filedesc fd, char *buffer, int length, BOOL virt_init)
+{
+    ios *base;
+    filebuf *fb = MSVCRT_operator_new(sizeof(filebuf));
+
+    TRACE("(%p %d %p %d %d)\n", this, fd, buffer, length, virt_init);
+
+    if (!fb) {
+        FIXME("out of memory\n");
+        return NULL;
+    }
+
+    filebuf_fd_reserve_ctor(fb, fd, buffer, length);
+
+    iostream_internal_sb_ctor(this, &fb->base, &MSVCP_fstream_vtable, virt_init);
+
+    base = istream_get_ios(&this->base1);
+    base->delbuf = 1;
+
+    return this;
+}
+
+/* ??0fstream@@QAE at H@Z */
+/* ??0fstream@@QEAA at H@Z */
+DEFINE_THISCALL_WRAPPER(fstream_fd_ctor, 12)
+iostream* __thiscall fstream_fd_ctor(iostream *this, filedesc fd, BOOL virt_init)
+{
+    ios *base;
+    filebuf *fb = MSVCRT_operator_new(sizeof(filebuf));
+
+    TRACE("(%p %d %d)\n", this, fd, virt_init);
+
+    if (!fb) {
+        FIXME("out of memory\n");
+        return NULL;
+    }
+
+    filebuf_fd_ctor(fb, fd);
+
+    iostream_internal_sb_ctor(this, &fb->base, &MSVCP_fstream_vtable, virt_init);
+
+    base = istream_get_ios(&this->base1);
+    base->delbuf = 1;
+
+    return this;
+}
+
 /* ??0fstream@@QAE at PBDHH@Z */
 /* ??0fstream@@QEAA at PEBDHH@Z */
 DEFINE_THISCALL_WRAPPER(fstream_open_ctor, 20)
@@ -4838,6 +4898,103 @@ iostream* __thiscall fstream_open_ctor(iostream *this, const char *name, ios_ope
     return this;
 }
 
+/* ??0fstream@@QAE at XZ */
+/* ??0fstream@@QEAA at XZ */
+DEFINE_THISCALL_WRAPPER(fstream_ctor, 8)
+iostream* __thiscall fstream_ctor(iostream *this, BOOL virt_init)
+{
+    return fstream_fd_ctor(this, -1, virt_init);
+}
+
+/* ?rdbuf at fstream@@QBEPAVfilebuf@@XZ */
+/* ?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ */
+DEFINE_THISCALL_WRAPPER(fstream_rdbuf, 4)
+filebuf* __thiscall fstream_rdbuf(const iostream *this)
+{
+    TRACE("(%p)\n", this);
+    return (filebuf*) istream_get_ios(&this->base1)->sb;
+}
+
+/* ?fd at fstream@@QBEHXZ */
+/* ?fd at fstream@@QEBAHXZ */
+DEFINE_THISCALL_WRAPPER(fstream_fd, 4)
+filedesc __thiscall fstream_fd(iostream *this)
+{
+    TRACE("(%p)\n", this);
+    return filebuf_fd(fstream_rdbuf(this));
+}
+
+/* ?attach at fstream@@QAEXH at Z */
+/* ?attach at fstream@@QEAAXH at Z */
+DEFINE_THISCALL_WRAPPER(fstream_attach, 8)
+void __thiscall fstream_attach(iostream *this, filedesc fd)
+{
+    ios *base = istream_get_ios(&this->base1);
+    TRACE("(%p %d)\n", this, fd);
+    if (filebuf_attach(fstream_rdbuf(this), fd) == NULL)
+        ios_clear(base, base->state | IOSTATE_failbit);
+}
+
+/* ?close at fstream@@QAEXXZ */
+/* ?close at fstream@@QEAAXXZ */
+DEFINE_THISCALL_WRAPPER(fstream_close, 4)
+void __thiscall fstream_close(iostream *this)
+{
+    ios *base = istream_get_ios(&this->base1);
+    TRACE("(%p)\n", this);
+    if (filebuf_close(fstream_rdbuf(this)) == NULL)
+        ios_clear(base, base->state | IOSTATE_failbit);
+    else
+        ios_clear(base, IOSTATE_goodbit);
+}
+
+/* ?is_open at fstream@@QBEHXZ */
+/* ?is_open at fstream@@QEBAHXZ */
+DEFINE_THISCALL_WRAPPER(fstream_is_open, 4)
+int __thiscall fstream_is_open(const iostream *this)
+{
+    TRACE("(%p)\n", this);
+    return filebuf_is_open(fstream_rdbuf(this));
+}
+
+/* ?open at fstream@@QAEXPBDHH at Z */
+/* ?open at fstream@@QEAAXPEBDHH at Z */
+DEFINE_THISCALL_WRAPPER(fstream_open, 16)
+void __thiscall fstream_open(iostream *this, const char *name, ios_open_mode mode, int protection)
+{
+    ios *base = istream_get_ios(&this->base1);
+    TRACE("(%p %s %d %d)\n", this, name, mode, protection);
+    if (filebuf_open(fstream_rdbuf(this), name, mode|OPENMODE_out, protection) == NULL)
+        ios_clear(base, base->state | IOSTATE_failbit);
+}
+
+/* ?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z */
+/* ?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z */
+DEFINE_THISCALL_WRAPPER(fstream_setbuf, 12)
+streambuf* __thiscall fstream_setbuf(iostream *this, char *buffer, int length)
+{
+    ios *base = istream_get_ios(&this->base1);
+    filebuf* fb = fstream_rdbuf(this);
+
+    TRACE("(%p %p %d)\n", this, buffer, length);
+
+    if (filebuf_is_open(fb)) {
+        ios_clear(base, base->state | IOSTATE_failbit);
+        return NULL;
+    }
+
+    return filebuf_setbuf(fb, buffer, length);
+}
+
+/* ?setmode at fstream@@QAEHH at Z */
+/* ?setmode at fstream@@QEAAHH at Z */
+DEFINE_THISCALL_WRAPPER(fstream_setmode, 8)
+int __thiscall fstream_setmode(iostream *this, int mode)
+{
+    TRACE("(%p %d)\n", this, mode);
+    return filebuf_setmode(fstream_rdbuf(this), mode);
+}
+
 /* ??0Iostream_init@@QAE at AAVios@@H at Z */
 /* ??0Iostream_init@@QEAA at AEAVios@@H at Z */
 DEFINE_THISCALL_WRAPPER(Iostream_init_ios_ctor, 12)
diff --git a/dlls/msvcirt/msvcirt.spec b/dlls/msvcirt/msvcirt.spec
index 804300f1a3ea..3d943e8a5c45 100644
--- a/dlls/msvcirt/msvcirt.spec
+++ b/dlls/msvcirt/msvcirt.spec
@@ -16,16 +16,16 @@
 @ cdecl -arch=win64 ??0filebuf@@QEAA at HPEADH@Z(ptr long ptr long) filebuf_fd_reserve_ctor
 @ thiscall -arch=win32 ??0filebuf@@QAE at XZ(ptr) filebuf_ctor
 @ cdecl -arch=win64 ??0filebuf@@QEAA at XZ(ptr) filebuf_ctor
-@ stub -arch=win32 ??0fstream@@QAE at ABV0@@Z  # __thiscall fstream::fstream(class fstream const &)
-@ stub -arch=win64 ??0fstream@@QEAA at AEBV0@@Z
-@ stub -arch=win32 ??0fstream@@QAE at H@Z  # __thiscall fstream::fstream(int)
-@ stub -arch=win64 ??0fstream@@QEAA at H@Z
-@ stub -arch=win32 ??0fstream@@QAE at HPADH@Z  # __thiscall fstream::fstream(int,char *,int)
-@ stub -arch=win64 ??0fstream@@QEAA at HPEADH@Z
+@ thiscall -arch=win32 ??0fstream@@QAE at ABV0@@Z(ptr ptr long) fstream_copy_ctor
+@ cdecl -arch=win64 ??0fstream@@QEAA at AEBV0@@Z(ptr ptr long) fstream_copy_ctor
+@ thiscall -arch=win32 ??0fstream@@QAE at H@Z(ptr long long) fstream_fd_ctor
+@ cdecl -arch=win64 ??0fstream@@QEAA at H@Z(ptr long long) fstream_fd_ctor
+@ thiscall -arch=win32 ??0fstream@@QAE at HPADH@Z(ptr long ptr long long) fstream_buffer_ctor
+@ cdecl -arch=win64 ??0fstream@@QEAA at HPEADH@Z(ptr long ptr long long) fstream_buffer_ctor
 @ thiscall -arch=win32 ??0fstream@@QAE at PBDHH@Z(ptr str long long long) fstream_open_ctor
 @ cdecl -arch=win64 ??0fstream@@QEAA at PEBDHH@Z(ptr str long long long) fstream_open_ctor
-@ stub -arch=win32 ??0fstream@@QAE at XZ  # __thiscall fstream::fstream(void)
-@ stub -arch=win64 ??0fstream@@QEAA at XZ
+@ thiscall -arch=win32 ??0fstream@@QAE at XZ(ptr long) fstream_ctor
+@ cdecl -arch=win64 ??0fstream@@QEAA at XZ(ptr long) fstream_ctor
 @ thiscall -arch=win32 ??0ifstream@@QAE at ABV0@@Z(ptr ptr long) ifstream_copy_ctor
 @ cdecl -arch=win64 ??0ifstream@@QEAA at AEBV0@@Z(ptr ptr long) ifstream_copy_ctor
 @ thiscall -arch=win32 ??0ifstream@@QAE at H@Z(ptr long long) ifstream_fd_ctor
@@ -176,8 +176,8 @@
 @ cdecl -arch=win64 ??4exception@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) MSVCP_exception_assign
 @ thiscall -arch=win32 ??4filebuf@@QAEAAV0 at ABV0@@Z(ptr ptr) filebuf_assign
 @ cdecl -arch=win64 ??4filebuf@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) filebuf_assign
-@ stub -arch=win32 ??4fstream@@QAEAAV0 at AAV0@@Z  # class fstream & __thiscall fstream::operator=(class fstream &)
-@ stub -arch=win64 ??4fstream@@QEAAAEAV0 at AEAV0@@Z
+@ thiscall -arch=win32 ??4fstream@@QAEAAV0 at AAV0@@Z(ptr ptr) iostream_assign
+@ cdecl -arch=win64 ??4fstream@@QEAAAEAV0 at AEAV0@@Z(ptr ptr) iostream_assign
 @ thiscall -arch=win32 ??4ifstream@@QAEAAV0 at ABV0@@Z(ptr ptr) istream_assign
 @ cdecl -arch=win64 ??4ifstream@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) istream_assign
 @ thiscall -arch=win32 ??4ios@@IAEAAV0 at ABV0@@Z(ptr ptr) ios_assign
@@ -404,8 +404,8 @@
 @ cdecl -arch=win64 ?allocate at streambuf@@IEAAHXZ(ptr) streambuf_allocate
 @ thiscall -arch=win32 ?attach at filebuf@@QAEPAV1 at H@Z(ptr long) filebuf_attach
 @ cdecl -arch=win64 ?attach at filebuf@@QEAAPEAV1 at H@Z(ptr long) filebuf_attach
-@ stub -arch=win32 ?attach at fstream@@QAEXH at Z  # void __thiscall fstream::attach(int)
-@ stub -arch=win64 ?attach at fstream@@QEAAXH at Z
+@ thiscall -arch=win32 ?attach at fstream@@QAEXH at Z(ptr long) fstream_attach
+@ cdecl -arch=win64 ?attach at fstream@@QEAAXH at Z(ptr long) fstream_attach
 @ thiscall -arch=win32 ?attach at ifstream@@QAEXH at Z(ptr long) ifstream_attach
 @ cdecl -arch=win64 ?attach at ifstream@@QEAAXH at Z(ptr long) ifstream_attach
 @ thiscall -arch=win32 ?attach at ofstream@@QAEXH at Z(ptr long) ofstream_attach
@@ -426,8 +426,8 @@
 @ extern ?clog@@3Vostream_withassign@@A MSVCP_clog
 @ thiscall -arch=win32 ?close at filebuf@@QAEPAV1 at XZ(ptr) filebuf_close
 @ cdecl -arch=win64 ?close at filebuf@@QEAAPEAV1 at XZ(ptr) filebuf_close
-@ stub -arch=win32 ?close at fstream@@QAEXXZ  # void __thiscall fstream::close(void)
-@ stub -arch=win64 ?close at fstream@@QEAAXXZ
+@ thiscall -arch=win32 ?close at fstream@@QAEXXZ(ptr) fstream_close
+@ cdecl -arch=win64 ?close at fstream@@QEAAXXZ(ptr) fstream_close
 @ thiscall -arch=win32 ?close at ifstream@@QAEXXZ(ptr) ifstream_close
 @ cdecl -arch=win64 ?close at ifstream@@QEAAXXZ(ptr) ifstream_close
 @ thiscall -arch=win32 ?close at ofstream@@QAEXXZ(ptr) ofstream_close
@@ -470,8 +470,8 @@
 @ cdecl -arch=win64 ?fail at ios@@QEBAHXZ(ptr) ios_fail
 @ thiscall -arch=win32 ?fd at filebuf@@QBEHXZ(ptr) filebuf_fd
 @ cdecl -arch=win64 ?fd at filebuf@@QEBAHXZ(ptr) filebuf_fd
-@ stub -arch=win32 ?fd at fstream@@QBEHXZ  # int __thiscall fstream::fd(void)const 
-@ stub -arch=win64 ?fd at fstream@@QEBAHXZ
+@ thiscall -arch=win32 ?fd at fstream@@QBEHXZ(ptr) fstream_fd
+@ cdecl -arch=win64 ?fd at fstream@@QEBAHXZ(ptr) fstream_fd
 @ thiscall -arch=win32 ?fd at ifstream@@QBEHXZ(ptr) ifstream_fd
 @ cdecl -arch=win64 ?fd at ifstream@@QEBAHXZ(ptr) ifstream_fd
 @ thiscall -arch=win32 ?fd at ofstream@@QBEHXZ(ptr) ofstream_fd
@@ -539,8 +539,8 @@
 @ cdecl -arch=win64 ?ipfx at istream@@QEAAHH at Z(ptr long) istream_ipfx
 @ thiscall -arch=win32 ?is_open at filebuf@@QBEHXZ(ptr) filebuf_is_open
 @ cdecl -arch=win64 ?is_open at filebuf@@QEBAHXZ(ptr) filebuf_is_open
-@ stub -arch=win32 ?is_open at fstream@@QBEHXZ  # int __thiscall fstream::is_open(void)const 
-@ stub -arch=win64 ?is_open at fstream@@QEBAHXZ
+@ thiscall -arch=win32 ?is_open at fstream@@QBEHXZ(ptr) fstream_is_open
+@ cdecl -arch=win64 ?is_open at fstream@@QEBAHXZ(ptr) fstream_is_open
 @ thiscall -arch=win32 ?is_open at ifstream@@QBEHXZ(ptr) ifstream_is_open
 @ cdecl -arch=win64 ?is_open at ifstream@@QEBAHXZ(ptr) ifstream_is_open
 @ thiscall -arch=win32 ?is_open at ofstream@@QBEHXZ(ptr) ofstream_is_open
@@ -564,8 +564,8 @@
 @ cdecl -arch=win64 ?oct@@YAAEAVios@@AEAV1@@Z(ptr) ios_oct
 @ thiscall -arch=win32 ?open at filebuf@@QAEPAV1 at PBDHH@Z(ptr str long long) filebuf_open
 @ cdecl -arch=win64 ?open at filebuf@@QEAAPEAV1 at PEBDHH@Z(ptr str long long) filebuf_open
-@ stub -arch=win32 ?open at fstream@@QAEXPBDHH at Z  # void __thiscall fstream::open(char const *,int,int)
-@ stub -arch=win64 ?open at fstream@@QEAAXPEBDHH at Z
+@ thiscall -arch=win32 ?open at fstream@@QAEXPBDHH at Z(ptr str long long) fstream_open
+@ cdecl -arch=win64 ?open at fstream@@QEAAXPEBDHH at Z(ptr str long long) fstream_open
 @ thiscall -arch=win32 ?open at ifstream@@QAEXPBDHH at Z(ptr str long long) ifstream_open
 @ cdecl -arch=win64 ?open at ifstream@@QEAAXPEBDHH at Z(ptr str long long) ifstream_open
 @ thiscall -arch=win32 ?open at ofstream@@QAEXPBDHH at Z(ptr str long long) ofstream_open
@@ -613,8 +613,8 @@
 @ cdecl -arch=win64 ?putback at istream@@QEAAAEAV1 at D@Z(ptr long) istream_putback
 @ thiscall -arch=win32 ?pword at ios@@QBEAAPAXH at Z(ptr long) ios_pword
 @ cdecl -arch=win64 ?pword at ios@@QEBAAEAPEAXH at Z(ptr long) ios_pword
-@ stub -arch=win32 ?rdbuf at fstream@@QBEPAVfilebuf@@XZ  # class filebuf * __thiscall fstream::rdbuf(void)const 
-@ stub -arch=win64 ?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ
+@ thiscall -arch=win32 ?rdbuf at fstream@@QBEPAVfilebuf@@XZ(ptr) fstream_rdbuf
+@ cdecl -arch=win64 ?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ(ptr) fstream_rdbuf
 @ thiscall -arch=win32 ?rdbuf at ifstream@@QBEPAVfilebuf@@XZ(ptr) ifstream_rdbuf
 @ cdecl -arch=win64 ?rdbuf at ifstream@@QEBAPEAVfilebuf@@XZ(ptr) ifstream_rdbuf
 @ thiscall -arch=win32 ?rdbuf at ios@@QBEPAVstreambuf@@XZ(ptr) ios_rdbuf
@@ -661,8 +661,8 @@
 @ cdecl -arch=win64 ?setb at streambuf@@IEAAXPEAD0H at Z(ptr ptr ptr long) streambuf_setb
 @ thiscall -arch=win32 ?setbuf at filebuf@@UAEPAVstreambuf@@PADH at Z(ptr ptr long) filebuf_setbuf
 @ cdecl -arch=win64 ?setbuf at filebuf@@UEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) filebuf_setbuf
-@ stub -arch=win32 ?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z  # class streambuf * __thiscall fstream::setbuf(char *,int)
-@ stub -arch=win64 ?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z
+@ thiscall -arch=win32 ?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) fstream_setbuf
+@ cdecl -arch=win64 ?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) fstream_setbuf
 @ thiscall -arch=win32 ?setbuf at ifstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) ifstream_setbuf
 @ cdecl -arch=win64 ?setbuf at ifstream@@QEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) ifstream_setbuf
 @ thiscall -arch=win32 ?setbuf at ofstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) ofstream_setbuf
@@ -683,8 +683,8 @@
 @ cdecl -arch=win64 ?setlock at streambuf@@QEAAXXZ(ptr) streambuf_setlock
 @ thiscall -arch=win32 ?setmode at filebuf@@QAEHH at Z(ptr long) filebuf_setmode
 @ cdecl -arch=win64 ?setmode at filebuf@@QEAAHH at Z(ptr long) filebuf_setmode
-@ stub -arch=win32 ?setmode at fstream@@QAEHH at Z  # int __thiscall fstream::setmode(int)
-@ stub -arch=win64 ?setmode at fstream@@QEAAHH at Z
+@ thiscall -arch=win32 ?setmode at fstream@@QAEHH at Z(ptr long) fstream_setmode
+@ cdecl -arch=win64 ?setmode at fstream@@QEAAHH at Z(ptr long) fstream_setmode
 @ thiscall -arch=win32 ?setmode at ifstream@@QAEHH at Z(ptr long) ifstream_setmode
 @ cdecl -arch=win64 ?setmode at ifstream@@QEAAHH at Z(ptr long) ifstream_setmode
 @ thiscall -arch=win32 ?setmode at ofstream@@QAEHH at Z(ptr long) ofstream_setmode
diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index 8ee880480a04..21d513c0fd90 100644
--- a/dlls/msvcirt/tests/msvcirt.c
+++ b/dlls/msvcirt/tests/msvcirt.c
@@ -455,9 +455,21 @@ static void (*__thiscall p_stdiostream_vbase_dtor)(iostream*);
 static iostream* (*__thiscall p_stdiostream_assign)(iostream*, const iostream*);
 
 /* fstream */
-static iostream* (*__thiscall p_fstream_open_ctor)(iostream*, const char*, ios_open_mode, int, BOOL);
+static iostream* (*__thiscall p_fstream_copy_ctor)(iostream*, const iostream*, BOOL);
+static iostream* (*__thiscall p_fstream_buffer_ctor)(iostream*, filedesc, char*, int, BOOL);
+static iostream* (*__thiscall p_fstream_fd_ctor)(iostream*, filedesc fd, BOOL virt_init);
+static iostream* (*__thiscall p_fstream_open_ctor)(iostream*, const char *name, ios_open_mode, int, BOOL);
+static iostream* (*__thiscall p_fstream_ctor)(iostream*, BOOL);
 static void (*__thiscall p_fstream_dtor)(ios*);
 static void (*__thiscall p_fstream_vbase_dtor)(iostream*);
+static void (*__thiscall p_fstream_attach)(iostream*, filedesc);
+static void (*__thiscall p_fstream_close)(iostream*);
+static filedesc (*__thiscall p_fstream_fd)(iostream*);
+static int (*__thiscall p_fstream_is_open)(const iostream*);
+static void (*__thiscall p_fstream_open)(iostream*, const char*, ios_open_mode, int);
+static filebuf* (*__thiscall p_fstream_rdbuf)(const iostream*);
+static streambuf* (*__thiscall p_fstream_setbuf)(iostream*, char*, int);
+static int (*__thiscall p_fstream_setmode)(iostream*, int);
 
 /* Iostream_init */
 static void* (*__thiscall p_Iostream_init_ios_ctor)(void*, ios*, int);
@@ -794,9 +806,21 @@ static BOOL init(void)
         SET(p_stdiostream_vbase_dtor, "??_Dstdiostream@@QEAAXXZ");
         SET(p_stdiostream_assign, "??4stdiostream@@QEAAAEAV0 at AEAV0@@Z");
 
+        SET(p_fstream_copy_ctor, "??0fstream@@QEAA at AEBV0@@Z");
+        SET(p_fstream_buffer_ctor, "??0fstream@@QEAA at HPEADH@Z");
+        SET(p_fstream_fd_ctor, "??0fstream@@QEAA at H@Z");
         SET(p_fstream_open_ctor, "??0fstream@@QEAA at PEBDHH@Z");
+        SET(p_fstream_ctor, "??0fstream@@QEAA at XZ");
         SET(p_fstream_dtor, "??1fstream@@UEAA at XZ");
         SET(p_fstream_vbase_dtor, "??_Dfstream@@QEAAXXZ");
+        SET(p_fstream_attach, "?attach at fstream@@QEAAXH at Z");
+        SET(p_fstream_close, "?close at fstream@@QEAAXXZ");
+        SET(p_fstream_fd, "?fd at fstream@@QEBAHXZ");
+        SET(p_fstream_is_open, "?is_open at fstream@@QEBAHXZ");
+        SET(p_fstream_open, "?open at fstream@@QEAAXPEBDHH at Z");
+        SET(p_fstream_rdbuf, "?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ");
+        SET(p_fstream_setbuf, "?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z");
+        SET(p_fstream_setmode, "?setmode at fstream@@QEAAHH at Z");
 
         SET(p_Iostream_init_ios_ctor, "??0Iostream_init@@QEAA at AEAVios@@H at Z");
 
@@ -1045,9 +1069,21 @@ static BOOL init(void)
         SET(p_stdiostream_vbase_dtor, "??_Dstdiostream@@QAEXXZ");
         SET(p_stdiostream_assign, "??4stdiostream@@QAEAAV0 at AAV0@@Z");
 
+        SET(p_fstream_copy_ctor, "??0fstream@@QAE at ABV0@@Z");
+        SET(p_fstream_fd_ctor, "??0fstream@@QAE at H@Z");
+        SET(p_fstream_buffer_ctor, "??0fstream@@QAE at HPADH@Z");
         SET(p_fstream_open_ctor, "??0fstream@@QAE at PBDHH@Z");
+        SET(p_fstream_ctor, "??0fstream@@QAE at XZ");
         SET(p_fstream_dtor, "??1fstream@@UAE at XZ");
         SET(p_fstream_vbase_dtor, "??_Dfstream@@QAEXXZ");
+        SET(p_fstream_attach, "?attach at fstream@@QAEXH at Z");
+        SET(p_fstream_close, "?close at fstream@@QAEXXZ");
+        SET(p_fstream_fd, "?fd at fstream@@QBEHXZ");
+        SET(p_fstream_is_open, "?is_open at fstream@@QBEHXZ");
+        SET(p_fstream_open, "?open at fstream@@QAEXPBDHH at Z");
+        SET(p_fstream_rdbuf, "?rdbuf at fstream@@QBEPAVfilebuf@@XZ");
+        SET(p_fstream_setbuf, "?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z");
+        SET(p_fstream_setmode, "?setmode at fstream@@QAEHH at Z");
 
         SET(p_Iostream_init_ios_ctor, "??0Iostream_init@@QAE at AAVios@@H at Z");
 
@@ -4651,7 +4687,7 @@ static void test_ofstream(void)
     call_func5(p_ofstream_buffer_ctor, &ofs, -1, NULL, 0, TRUE);
     ok(ofs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", ofs.base_ios.sb->base);
     ok(ofs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", ofs.base_ios.sb->ebuf);
-    ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", pfb->base.unbuffered);
+    ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
     ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
 
     psb = call_func3(p_ofstream_setbuf, &ofs, buffer, ARRAY_SIZE(buffer));
@@ -8341,21 +8377,368 @@ static void test_std_streams(void)
 
 static void test_fstream(void)
 {
-    iostream fs, *pfs;
+    const char *filename = "fstream_test";
+    iostream fs, fs_copy, *pfs;
+    char buffer[64];
+    streambuf *psb;
     filebuf *pfb;
     ostream *pos;
     istream *pis;
-    int i;
     char st[8];
-    const char *filename = "fstream_test";
+    int i, ret, fd;
+
+    memset(&fs, 0xab, sizeof(iostream));
+
+    /* constructors/destructors */
+    pfs = call_func2(p_fstream_ctor, &fs, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    ok(fs.base1.extract_delim == 0, "expected 0 got %d\n", fs.base1.extract_delim);
+    ok(fs.base1.count == 0, "expected 0 got %d\n", fs.base1.count);
+    ok(fs.base2.unknown == 0, "expected 0 got %d\n", fs.base2.unknown);
+    ok(fs.base_ios.sb != NULL, "expected not %p got %p\n", NULL, fs.base_ios.sb);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(fs.base_ios.delbuf == 1, "expected 1 got %d\n", fs.base_ios.delbuf);
+    ok(fs.base_ios.tie == NULL, "expected %p got %p\n", NULL, fs.base_ios.tie);
+    ok(fs.base_ios.flags == FLAGS_skipws, "expected %x got %x\n", FLAGS_skipws, fs.base_ios.flags);
+    ok(fs.base_ios.precision == 6, "expected 6 got %d\n", fs.base_ios.precision);
+    ok(fs.base_ios.fill == ' ', "expected 32 got %d\n", fs.base_ios.fill);
+    ok(fs.base_ios.width == 0, "expected 0 got %d\n", fs.base_ios.width);
+    ok(fs.base_ios.do_lock == -1, "expected -1 got %d\n", fs.base_ios.do_lock);
+    ok(pfb->fd == -1, "wrong fd, expected -1 got %d\n", pfb->fd);
+    ok(pfb->close == 0, "wrong value, expected 0 got %d\n", pfb->close);
+    ok(pfb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pfb->base.allocated);
+    ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+    ok(pfb->base.base == NULL, "wrong buffer, expected %p got %p\n", NULL, pfb->base.base);
+    ok(pfb->base.ebuf == NULL, "wrong ebuf, expected %p got %p\n", NULL, pfb->base.ebuf);
+    ok(pfb->fd == -1, "wrong fd, expected 0 got %d\n", pfb->fd);
+    call_func1(p_fstream_vbase_dtor, &fs);
+
+    pfs = call_func3(p_fstream_fd_ctor, &fs, 42, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(fs.base_ios.delbuf == 1, "expected 1 got %d\n", fs.base_ios.delbuf);
+    ok(pfb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pfb->base.allocated);
+    ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+    ok(pfb->base.base == NULL, "wrong buffer, expected %p got %p\n", NULL, pfb->base.base);
+    ok(pfb->base.ebuf == NULL, "wrong ebuf, expected %p got %p\n", NULL, pfb->base.ebuf);
+    ok(pfb->fd == 42, "wrong fd, expected 42 got %d\n", pfb->fd);
+    ok(pfb->close == 0, "wrong value, expected 0 got %d\n", pfb->close);
+
+    pfs = call_func3(p_fstream_copy_ctor, &fs_copy, &fs, TRUE);
+    pfb = (filebuf*) fs_copy.base_ios.sb;
+    ok(pfs == &fs_copy, "wrong return, expected %p got %p\n", &fs_copy, pfs);
+    ok(fs_copy.base_ios.sb == fs.base_ios.sb, "expected shared streambuf\n");
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(fs_copy.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs_copy.base_ios.state);
+
+    call_func1(p_fstream_vbase_dtor, &fs_copy);
+    call_func1(p_fstream_dtor, &fs.base_ios);
+
+    pfs = call_func5(p_fstream_buffer_ctor, &fs, 53, buffer, ARRAY_SIZE(buffer), TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(fs.base_ios.delbuf == 1, "expected 1 got %d\n", fs.base_ios.delbuf);
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(pfb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pfb->base.allocated);
+    ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+    ok(pfb->base.base == buffer, "wrong buffer, expected %p got %p\n", buffer, pfb->base.base);
+    ok(pfb->base.ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), pfb->base.ebuf);
+    ok(pfb->fd == 53, "wrong fd, expected 53 got %d\n", pfb->fd);
+    ok(pfb->close == 0, "wrong value, expected 0 got %d\n", pfb->close);
+    call_func1(p_fstream_dtor, &fs.base_ios);
+
+    pfs = call_func5(p_fstream_buffer_ctor, &fs, 64, NULL, 0, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(fs.base_ios.delbuf == 1, "expected 1 got %d\n", fs.base_ios.delbuf);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(pfb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pfb->base.allocated);
+    ok(pfb->base.unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", pfb->base.unbuffered);
+    ok(pfb->base.base == NULL, "wrong buffer, expected %p got %p\n", NULL, pfb->base.base);
+    ok(pfb->base.ebuf == NULL, "wrong ebuf, expected %p got %p\n", NULL, pfb->base.ebuf);
+    ok(pfb->fd == 64, "wrong fd, expected 64 got %d\n", pfb->fd);
+    ok(pfb->close == 0, "wrong value, expected 0 got %d\n", pfb->close);
+    call_func1(p_fstream_vbase_dtor, &fs);
+
+    pfs = call_func5(p_fstream_open_ctor, &fs, filename, OPENMODE_out, filebuf_openprot, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(fs.base_ios.delbuf == 1, "expected 1 got %d\n", fs.base_ios.delbuf);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    ok(pfb->base.allocated == 1, "wrong allocate value, expected 1 got %d\n", pfb->base.allocated);
+    ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+    ok(pfb->base.base != NULL, "wrong buffer, expected not %p got %p\n", NULL, pfb->base.base);
+    ok(pfb->base.ebuf != NULL, "wrong ebuf, expected not %p got %p\n", NULL, pfb->base.ebuf);
+    ok(pfb->fd != -1, "wrong fd, expected not -1 got %d\n", pfb->fd);
+    fd = pfb->fd;
+    ok(pfb->close == 1, "wrong value, expected 1 got %d\n", pfb->close);
+    call_func1(p_fstream_vbase_dtor, &fs);
+    ok(_close(fd) == -1, "expected fstream to close opened file\n");
+    ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+
+    pfs = call_func5(p_fstream_open_ctor, &fs, filename, OPENMODE_in, filebuf_openprot, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(fs.base_ios.delbuf == 1, "expected 1 got %d\n", fs.base_ios.delbuf);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    ok(pfb->base.allocated == 1, "wrong allocate value, expected 1 got %d\n", pfb->base.allocated);
+    ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+    ok(pfb->base.base != NULL, "wrong buffer, expected not %p got %p\n", NULL, pfb->base.base);
+    ok(pfb->base.ebuf != NULL, "wrong ebuf, expected not %p got %p\n", NULL, pfb->base.ebuf);
+    ok(pfb->fd != -1, "wrong fd, expected not -1 got %d\n", pfb->fd);
+    fd = pfb->fd;
+    ok(pfb->close == 1, "wrong value, expected 1 got %d\n", pfb->close);
+    call_func1(p_fstream_vbase_dtor, &fs);
+    ok(_close(fd) == -1, "expected fstream to close opened file\n");
+    ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+
+    /* setbuf */
+    call_func5(p_fstream_buffer_ctor, &fs, -1, NULL, 0, TRUE);
+    ok(fs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+
+    psb = call_func3(p_fstream_setbuf, &fs, buffer, ARRAY_SIZE(buffer));
+    ok(psb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, psb);
+    ok(fs.base_ios.sb->base == buffer, "wrong buffer, expected %p got %p\n", buffer, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    psb = call_func3(p_fstream_setbuf, &fs, NULL, 0);
+    ok(psb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, psb);
+    ok(fs.base_ios.sb->base == buffer, "wrong buffer, expected %p got %p\n", buffer, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    call_func1(p_fstream_vbase_dtor, &fs);
+
+    call_func2(p_fstream_ctor, &fs, TRUE);
+    ok(fs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    psb = call_func3(p_fstream_setbuf, &fs, buffer, ARRAY_SIZE(buffer));
+    ok(psb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, psb);
+    ok(fs.base_ios.sb->base == buffer, "wrong buffer, expected %p got %p\n", buffer, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    psb = call_func3(p_fstream_setbuf, &fs, NULL, 0);
+    ok(psb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, psb);
+    ok(fs.base_ios.sb->base == buffer, "wrong buffer, expected %p got %p\n", buffer, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    psb = call_func3(p_fstream_setbuf, &fs, buffer + 8, ARRAY_SIZE(buffer) - 8);
+    ok(psb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, psb);
+    ok(fs.base_ios.sb->base == buffer + 8, "wrong buffer, expected %p got %p\n", buffer + 8, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    psb = call_func3(p_fstream_setbuf, &fs, buffer + 8, 0);
+    ok(psb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, psb);
+    ok(fs.base_ios.sb->base == buffer + 8, "wrong buffer, expected %p got %p\n", buffer + 8, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    psb = call_func3(p_fstream_setbuf, &fs, buffer + 4, ARRAY_SIZE(buffer) - 4);
+    ok(psb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, psb);
+    ok(fs.base_ios.sb->base == buffer + 4, "wrong buffer, expected %p got %p\n", buffer + 4, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    psb = call_func3(p_fstream_setbuf, &fs, NULL, 5);
+    ok(psb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, psb);
+    ok(fs.base_ios.sb->base == buffer + 4, "wrong buffer, expected %p got %p\n", buffer + 4, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    call_func1(p_fstream_vbase_dtor, &fs);
+
+    /* setbuf - seems to be a nop and always return NULL in those other cases */
+    pfs = call_func5(p_fstream_buffer_ctor, &fs, 42, NULL, 0, TRUE);
+    ok(fs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+
+    fs.base_ios.state = IOSTATE_eofbit;
+    psb = call_func3(p_fstream_setbuf, &fs, buffer, ARRAY_SIZE(buffer));
+    ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+    ok(fs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+
+    fs.base_ios.state = IOSTATE_eofbit;
+    psb = call_func3(p_fstream_setbuf, &fs, NULL, 0);
+    ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+    ok(fs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+    call_func1(p_fstream_vbase_dtor, &fs);
+
+    pfs = call_func5(p_fstream_open_ctor, &fs, filename, OPENMODE_out, filebuf_openprot, TRUE);
+    fs.base_ios.state = IOSTATE_eofbit;
+    psb = call_func3(p_fstream_setbuf, &fs, NULL, 0);
+    ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+    ok(fs.base_ios.sb->base != NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf != NULL, "wrong ebuf value, expected NULL got %p\n", fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 1, "wrong allocated value, expected 1 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+
+    fs.base_ios.state = IOSTATE_eofbit;
+    psb = call_func3(p_fstream_setbuf, &fs, buffer, ARRAY_SIZE(buffer));
+    ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+    ok(fs.base_ios.sb->base != NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->base != buffer, "wrong base value, expected not %p got %p\n", buffer, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 1, "wrong allocated value, expected 1 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+    call_func1(p_fstream_vbase_dtor, &fs);
+    ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+
+    pfs = call_func5(p_fstream_open_ctor, &fs, filename, OPENMODE_in, filebuf_openprot, TRUE);
+    fs.base_ios.state = IOSTATE_eofbit;
+    psb = call_func3(p_fstream_setbuf, &fs, NULL, 0);
+    ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+    ok(fs.base_ios.sb->base != NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->ebuf != NULL, "wrong ebuf value, expected NULL got %p\n", fs.base_ios.sb->ebuf);
+    ok(fs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 1, "wrong allocated value, expected 1 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+
+    fs.base_ios.state = IOSTATE_eofbit;
+    psb = call_func3(p_fstream_setbuf, &fs, buffer, ARRAY_SIZE(buffer));
+    ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+    ok(fs.base_ios.sb->base != NULL, "wrong base value, expected NULL got %p\n", fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->base != buffer, "wrong base value, expected not %p got %p\n", buffer, fs.base_ios.sb->base);
+    ok(fs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", fs.base_ios.sb->unbuffered);
+    ok(fs.base_ios.sb->allocated == 1, "wrong allocated value, expected 1 got %d\n", fs.base_ios.sb->allocated);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+    call_func1(p_fstream_vbase_dtor, &fs);
+    ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+
+    /* attach */
+    pfs = call_func2(p_fstream_ctor, &fs, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    call_func2(p_fstream_attach, &fs, 42);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "attaching on vanilla stream set some state bits\n");
+    fd = (int) call_func1(p_fstream_fd, &fs);
+    ok(fd == 42, "wrong fd, expected 42 got %d\n", fd);
+    ok(pfb->close == 0, "wrong close value, expected 0 got %d\n", pfb->close);
+    fs.base_ios.state = IOSTATE_eofbit;
+    call_func2(p_fstream_attach, &fs, 53);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+    ok(fd == 42, "wrong fd, expected 42 got %d\n", fd);
+    call_func1(p_fstream_vbase_dtor, &fs);
+
+    /* fd */
+    pfs = call_func2(p_fstream_ctor, &fs, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    fd = (int) call_func1(p_fstream_fd, &fs);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(fd == -1, "wrong fd, expected -1 but got %d\n", fd);
+    call_func1(p_fstream_vbase_dtor, &fs);
+
+    pfs = call_func5(p_fstream_open_ctor, &fs, filename, OPENMODE_in, filebuf_openprot, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    fd = (int) call_func1(p_fstream_fd, &fs);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(fd == pfb->fd, "wrong fd, expected %d but got %d\n", pfb->fd, fd);
+    call_func1(p_fstream_vbase_dtor, &fs);
+    ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+
+    pfs = call_func2(p_fstream_ctor, &fs, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    fd = (int) call_func1(p_fstream_fd, &fs);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(fd == -1, "wrong fd, expected -1 but got %d\n", fd);
+    call_func1(p_fstream_vbase_dtor, &fs);
+
+    pfs = call_func5(p_fstream_open_ctor, &fs, filename, OPENMODE_out, filebuf_openprot, TRUE);
+    pfb = (filebuf*) fs.base_ios.sb;
+    ok(pfs == &fs, "wrong return, expected %p got %p\n", &fs, pfs);
+    fd = (int) call_func1(p_fstream_fd, &fs);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ok(fd == pfb->fd, "wrong fd, expected %d but got %d\n", pfb->fd, fd);
+
+    /* rdbuf */
+    pfb = (filebuf*) call_func1(p_fstream_rdbuf, &fs);
+    ok((streambuf*) pfb == fs.base_ios.sb, "wrong return, expected %p got %p\n", fs.base_ios.sb, pfb);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    /* setmode */
+    ret = (int) call_func2(p_fstream_setmode, &fs, filebuf_binary);
+    ok(ret == filebuf_text, "wrong return, expected %d got %d\n", filebuf_text, ret);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ret = (int) call_func2(p_fstream_setmode, &fs, filebuf_binary);
+    ok(ret == filebuf_binary, "wrong return, expected %d got %d\n", filebuf_binary, ret);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ret = (int) call_func2(p_fstream_setmode, &fs, filebuf_text);
+    ok(ret == filebuf_binary, "wrong return, expected %d got %d\n", filebuf_binary, ret);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+    ret = (int) call_func2(p_fstream_setmode, &fs, 0x9000);
+    ok(ret == -1, "wrong return, expected -1 got %d\n", ret);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
+
+    /* close && is_open */
+    ok((int) call_func1(p_fstream_is_open, &fs) == 1, "expected fstream to be open\n");
+    fs.base_ios.state = IOSTATE_eofbit | IOSTATE_failbit;
+    call_func1(p_fstream_close, &fs);
+    ok(fs.base_ios.state == IOSTATE_goodbit, "close did not clear state = %d\n", fs.base_ios.state);
+    fs.base_ios.state = IOSTATE_eofbit;
+    call_func1(p_fstream_close, &fs);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "close on a closed stream did not set failbit\n");
+    ok((int) call_func1(p_fstream_is_open, &fs) == 0, "expected fstream to not be open\n");
+    ok(_close(fd) == -1, "expected close to close the opened file\n");
+
+    /* open */
+    fs.base_ios.state = IOSTATE_eofbit;
+    call_func4(p_fstream_open, &fs, filename, OPENMODE_out, filebuf_openprot);
+    fd = (int) call_func1(p_fstream_fd, &fs);
+    ok(fd != -1, "wrong fd, expected not -1 got %d\n", fd);
+    ok(fs.base_ios.state == IOSTATE_eofbit, "open did not succeed\n");
+    call_func4(p_fstream_open, &fs, filename, OPENMODE_out, filebuf_openprot);
+    ok(fs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "second open did not set failbit\n");
+    call_func1(p_fstream_close, &fs);
+    call_func1(p_fstream_vbase_dtor, &fs);
+    ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
 
-    /* constructors */
     pfs = call_func5(p_fstream_open_ctor, &fs, filename, OPENMODE_out, filebuf_openprot, TRUE);
     ok(pfs == &fs, "constructor returned wrong pointer, expected %p got %p\n", &fs, pfs);
     ok(fs.base_ios.state == IOSTATE_goodbit, "wrong stream state, expected %d got %d\n", IOSTATE_goodbit, fs.base_ios.state);
     pfb = (filebuf*) fs.base_ios.sb;
     ok((int) call_func1(p_filebuf_is_open, pfb) == TRUE, "expected filebuf to be open\n");
-    ok(fs.base_ios.delbuf == 1, "internal filebuf not makred for deletion\n");
+    ok(fs.base_ios.delbuf == 1, "internal filebuf not marked for deletion\n");
 
     /* integration with ostream */
     pos = call_func2(p_ostream_print_str, (ostream*) &fs.base2, "ftest ");
diff --git a/dlls/msvcrt20/msvcrt20.spec b/dlls/msvcrt20/msvcrt20.spec
index e386ed8511d8..8c4e4a233cb4 100644
--- a/dlls/msvcrt20/msvcrt20.spec
+++ b/dlls/msvcrt20/msvcrt20.spec
@@ -10,16 +10,16 @@
 @ cdecl -arch=win64 ??0filebuf@@QEAA at HPEADH@Z(ptr long ptr long) msvcirt.??0filebuf@@QEAA at HPEADH@Z
 @ thiscall -arch=win32 ??0filebuf@@QAE at XZ(ptr) msvcirt.??0filebuf@@QAE at XZ
 @ cdecl -arch=win64 ??0filebuf@@QEAA at XZ(ptr) msvcirt.??0filebuf@@QEAA at XZ
-@ stub -arch=win32 ??0fstream@@QAE at ABV0@@Z
-@ stub -arch=win64 ??0fstream@@QEAA at AEBV0@@Z
-@ stub -arch=win32 ??0fstream@@QAE at H@Z
-@ stub -arch=win64 ??0fstream@@QEAA at H@Z
-@ stub -arch=win32 ??0fstream@@QAE at HPADH@Z
-@ stub -arch=win64 ??0fstream@@QEAA at HPEADH@Z
+@ thiscall -arch=win32 ??0fstream@@QAE at ABV0@@Z(ptr ptr long) msvcirt.??0fstream@@QAE at ABV0@@Z
+@ cdecl -arch=win64 ??0fstream@@QEAA at AEBV0@@Z(ptr ptr long) msvcirt.??0fstream@@QEAA at AEBV0@@Z
+@ thiscall -arch=win32 ??0fstream@@QAE at H@Z(ptr long long) msvcirt.??0fstream@@QAE at H@Z
+@ cdecl -arch=win64 ??0fstream@@QEAA at H@Z(ptr long long) msvcirt.??0fstream@@QEAA at H@Z
+@ thiscall -arch=win32 ??0fstream@@QAE at HPADH@Z(ptr long ptr long long) msvcirt.??0fstream@@QAE at HPADH@Z
+@ cdecl -arch=win64 ??0fstream@@QEAA at HPEADH@Z(ptr long ptr long long) msvcirt.??0fstream@@QEAA at HPEADH@Z
 @ thiscall -arch=win32 ??0fstream@@QAE at PBDHH@Z(ptr str long long long) msvcirt.??0fstream@@QAE at PBDHH@Z
 @ cdecl -arch=win64 ??0fstream@@QEAA at PEBDHH@Z(ptr str long long long) msvcirt.??0fstream@@QEAA at PEBDHH@Z
-@ stub -arch=win32 ??0fstream@@QAE at XZ
-@ stub -arch=win64 ??0fstream@@QEAA at XZ
+@ thiscall -arch=win32 ??0fstream@@QAE at XZ(ptr long) msvcirt.??0fstream@@QAE at XZ
+@ cdecl -arch=win64 ??0fstream@@QEAA at XZ(ptr long) msvcirt.??0fstream@@QEAA at XZ
 @ thiscall -arch=win32 ??0ifstream@@QAE at ABV0@@Z(ptr ptr long) msvcirt.??0ifstream@@QAE at ABV0@@Z
 @ cdecl -arch=win64 ??0ifstream@@QEAA at AEBV0@@Z(ptr ptr long) msvcirt.??0ifstream@@QEAA at AEBV0@@Z
 @ thiscall -arch=win32 ??0ifstream@@QAE at H@Z(ptr long long) msvcirt.??0ifstream@@QAE at H@Z
@@ -162,8 +162,8 @@
 @ cdecl -arch=win64 ??4Iostream_init@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) msvcirt.??4Iostream_init@@QEAAAEAV0 at AEBV0@@Z
 @ thiscall -arch=win32 ??4filebuf@@QAEAAV0 at ABV0@@Z(ptr ptr) msvcirt.??4filebuf@@QAEAAV0 at ABV0@@Z
 @ cdecl -arch=win64 ??4filebuf@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) msvcirt.??4filebuf@@QEAAAEAV0 at AEBV0@@Z
-@ stub -arch=win32 ??4fstream@@QAEAAV0 at AAV0@@Z
-@ stub -arch=win64 ??4fstream@@QEAAAEAV0 at AEAV0@@Z
+@ thiscall -arch=win32 ??4fstream@@QAEAAV0 at AAV0@@Z(ptr ptr) msvcirt.??4fstream@@QAEAAV0 at AAV0@@Z
+@ cdecl -arch=win64 ??4fstream@@QEAAAEAV0 at AEAV0@@Z(ptr ptr) msvcirt.??4fstream@@QEAAAEAV0 at AEAV0@@Z
 @ thiscall -arch=win32 ??4ifstream@@QAEAAV0 at ABV0@@Z(ptr ptr) msvcirt.??4ifstream@@QAEAAV0 at ABV0@@Z
 @ cdecl -arch=win64 ??4ifstream@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) msvcirt.??4ifstream@@QEAAAEAV0 at AEBV0@@Z
 @ thiscall -arch=win32 ??4ios@@IAEAAV0 at ABV0@@Z(ptr ptr) msvcirt.??4ios@@IAEAAV0 at ABV0@@Z
@@ -392,8 +392,8 @@
 @ cdecl -arch=win64 ?allocate at streambuf@@IEAAHXZ(ptr) msvcirt.?allocate at streambuf@@IEAAHXZ
 @ thiscall -arch=win32 ?attach at filebuf@@QAEPAV1 at H@Z(ptr long) msvcirt.?attach at filebuf@@QAEPAV1 at H@Z
 @ cdecl -arch=win64 ?attach at filebuf@@QEAAPEAV1 at H@Z(ptr long) msvcirt.?attach at filebuf@@QEAAPEAV1 at H@Z
-@ stub -arch=win32 ?attach at fstream@@QAEXH at Z
-@ stub -arch=win64 ?attach at fstream@@QEAAXH at Z
+@ thiscall -arch=win32 ?attach at fstream@@QAEXH at Z(ptr long) msvcirt.?attach at fstream@@QAEXH at Z
+@ cdecl -arch=win64 ?attach at fstream@@QEAAXH at Z(ptr long) msvcirt.?attach at fstream@@QEAAXH at Z
 @ thiscall -arch=win32 ?attach at ifstream@@QAEXH at Z(ptr long) msvcirt.?attach at ifstream@@QAEXH at Z
 @ cdecl -arch=win64 ?attach at ifstream@@QEAAXH at Z(ptr long) msvcirt.?attach at ifstream@@QEAAXH at Z
 @ thiscall -arch=win32 ?attach at ofstream@@QAEXH at Z(ptr long) msvcirt.?attach at ofstream@@QAEXH at Z
@@ -414,8 +414,8 @@
 @ extern ?clog@@3Vostream_withassign@@A msvcirt.?clog@@3Vostream_withassign@@A
 @ thiscall -arch=win32 ?close at filebuf@@QAEPAV1 at XZ(ptr) msvcirt.?close at filebuf@@QAEPAV1 at XZ
 @ cdecl -arch=win64 ?close at filebuf@@QEAAPEAV1 at XZ(ptr) msvcirt.?close at filebuf@@QEAAPEAV1 at XZ
-@ stub -arch=win32 ?close at fstream@@QAEXXZ
-@ stub -arch=win64 ?close at fstream@@QEAAXXZ
+@ thiscall -arch=win32 ?close at fstream@@QAEXXZ(ptr) msvcirt.?close at fstream@@QAEXXZ
+@ cdecl -arch=win64 ?close at fstream@@QEAAXXZ(ptr) msvcirt.?close at fstream@@QEAAXXZ
 @ thiscall -arch=win32 ?close at ifstream@@QAEXXZ(ptr) msvcirt.?close at ifstream@@QAEXXZ
 @ cdecl -arch=win64 ?close at ifstream@@QEAAXXZ(ptr) msvcirt.?close at ifstream@@QEAAXXZ
 @ thiscall -arch=win32 ?close at ofstream@@QAEXXZ(ptr) msvcirt.?close at ofstream@@QAEXXZ
@@ -458,8 +458,8 @@
 @ cdecl -arch=win64 ?fail at ios@@QEBAHXZ(ptr) msvcirt.?fail at ios@@QEBAHXZ
 @ thiscall -arch=win32 ?fd at filebuf@@QBEHXZ(ptr) msvcirt.?fd at filebuf@@QBEHXZ
 @ cdecl -arch=win64 ?fd at filebuf@@QEBAHXZ(ptr) msvcirt.?fd at filebuf@@QEBAHXZ
-@ stub -arch=win32 ?fd at fstream@@QBEHXZ
-@ stub -arch=win64 ?fd at fstream@@QEBAHXZ
+@ thiscall -arch=win32 ?fd at fstream@@QBEHXZ(ptr) msvcirt.?fd at fstream@@QBEHXZ
+@ cdecl -arch=win64 ?fd at fstream@@QEBAHXZ(ptr) msvcirt.?fd at fstream@@QEBAHXZ
 @ thiscall -arch=win32 ?fd at ifstream@@QBEHXZ(ptr) msvcirt.?fd at ifstream@@QBEHXZ
 @ cdecl -arch=win64 ?fd at ifstream@@QEBAHXZ(ptr) msvcirt.?fd at ifstream@@QEBAHXZ
 @ thiscall -arch=win32 ?fd at ofstream@@QBEHXZ(ptr) msvcirt.?fd at ofstream@@QBEHXZ
@@ -525,8 +525,8 @@
 @ cdecl -arch=win64 ?ipfx at istream@@QEAAHH at Z(ptr long) msvcirt.?ipfx at istream@@QEAAHH at Z
 @ thiscall -arch=win32 ?is_open at filebuf@@QBEHXZ(ptr) msvcirt.?is_open at filebuf@@QBEHXZ
 @ cdecl -arch=win64 ?is_open at filebuf@@QEBAHXZ(ptr) msvcirt.?is_open at filebuf@@QEBAHXZ
-@ stub -arch=win32 ?is_open at fstream@@QBEHXZ
-@ stub -arch=win64 ?is_open at fstream@@QEBAHXZ
+@ thiscall -arch=win32 ?is_open at fstream@@QBEHXZ(ptr) msvcirt.?is_open at fstream@@QBEHXZ
+@ cdecl -arch=win64 ?is_open at fstream@@QEBAHXZ(ptr) msvcirt.?is_open at fstream@@QEBAHXZ
 @ thiscall -arch=win32 ?is_open at ifstream@@QBEHXZ(ptr) msvcirt.?is_open at ifstream@@QBEHXZ
 @ cdecl -arch=win64 ?is_open at ifstream@@QEBAHXZ(ptr) msvcirt.?is_open at ifstream@@QEBAHXZ
 @ thiscall -arch=win32 ?is_open at ofstream@@QBEHXZ(ptr) msvcirt.?is_open at ofstream@@QBEHXZ
@@ -550,8 +550,8 @@
 @ cdecl -arch=win64 ?oct@@YAAEAVios@@AEAV1@@Z(ptr) msvcirt.?oct@@YAAEAVios@@AEAV1@@Z
 @ thiscall -arch=win32 ?open at filebuf@@QAEPAV1 at PBDHH@Z(ptr str long long) msvcirt.?open at filebuf@@QAEPAV1 at PBDHH@Z
 @ cdecl -arch=win64 ?open at filebuf@@QEAAPEAV1 at PEBDHH@Z(ptr str long long) msvcirt.?open at filebuf@@QEAAPEAV1 at PEBDHH@Z
-@ stub -arch=win32 ?open at fstream@@QAEXPBDHH at Z
-@ stub -arch=win64 ?open at fstream@@QEAAXPEBDHH at Z
+@ thiscall -arch=win32 ?open at fstream@@QAEXPBDHH at Z(ptr str long long) msvcirt.?open at fstream@@QAEXPBDHH at Z
+@ cdecl -arch=win64 ?open at fstream@@QEAAXPEBDHH at Z(ptr str long long) msvcirt.?open at fstream@@QEAAXPEBDHH at Z
 @ thiscall -arch=win32 ?open at ifstream@@QAEXPBDHH at Z(ptr str long long) msvcirt.?open at ifstream@@QAEXPBDHH at Z
 @ cdecl -arch=win64 ?open at ifstream@@QEAAXPEBDHH at Z(ptr str long long) msvcirt.?open at ifstream@@QEAAXPEBDHH at Z
 @ thiscall -arch=win32 ?open at ofstream@@QAEXPBDHH at Z(ptr str long long) msvcirt.?open at ofstream@@QAEXPBDHH at Z
@@ -599,8 +599,8 @@
 @ cdecl -arch=win64 ?putback at istream@@QEAAAEAV1 at D@Z(ptr long) msvcirt.?putback at istream@@QEAAAEAV1 at D@Z
 @ thiscall -arch=win32 ?pword at ios@@QBEAAPAXH at Z(ptr long) msvcirt.?pword at ios@@QBEAAPAXH at Z
 @ cdecl -arch=win64 ?pword at ios@@QEBAAEAPEAXH at Z(ptr long) msvcirt.?pword at ios@@QEBAAEAPEAXH at Z
-@ stub -arch=win32 ?rdbuf at fstream@@QBEPAVfilebuf@@XZ
-@ stub -arch=win64 ?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ
+@ thiscall -arch=win32 ?rdbuf at fstream@@QBEPAVfilebuf@@XZ(ptr) msvcirt.?rdbuf at fstream@@QBEPAVfilebuf@@XZ
+@ cdecl -arch=win64 ?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ(ptr) msvcirt.?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ
 @ thiscall -arch=win32 ?rdbuf at ifstream@@QBEPAVfilebuf@@XZ(ptr) msvcirt.?rdbuf at ifstream@@QBEPAVfilebuf@@XZ
 @ cdecl -arch=win64 ?rdbuf at ifstream@@QEBAPEAVfilebuf@@XZ(ptr) msvcirt.?rdbuf at ifstream@@QEBAPEAVfilebuf@@XZ
 @ thiscall -arch=win32 ?rdbuf at ios@@QBEPAVstreambuf@@XZ(ptr) msvcirt.?rdbuf at ios@@QBEPAVstreambuf@@XZ
@@ -649,8 +649,8 @@
 @ cdecl -arch=win64 ?setb at streambuf@@IEAAXPEAD0H at Z(ptr ptr ptr long) msvcirt.?setb at streambuf@@IEAAXPEAD0H at Z
 @ thiscall -arch=win32 ?setbuf at filebuf@@UAEPAVstreambuf@@PADH at Z(ptr ptr long) msvcirt.?setbuf at filebuf@@UAEPAVstreambuf@@PADH at Z
 @ cdecl -arch=win64 ?setbuf at filebuf@@UEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) msvcirt.?setbuf at filebuf@@UEAAPEAVstreambuf@@PEADH at Z
-@ stub -arch=win32 ?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z
-@ stub -arch=win64 ?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z
+@ thiscall -arch=win32 ?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) msvcirt.?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z
+@ cdecl -arch=win64 ?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) msvcirt.?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z
 @ thiscall -arch=win32 ?setbuf at ifstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) msvcirt.?setbuf at ifstream@@QAEPAVstreambuf@@PADH at Z
 @ cdecl -arch=win64 ?setbuf at ifstream@@QEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) msvcirt.?setbuf at ifstream@@QEAAPEAVstreambuf@@PEADH at Z
 @ thiscall -arch=win32 ?setbuf at ofstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) msvcirt.?setbuf at ofstream@@QAEPAVstreambuf@@PADH at Z
@@ -671,8 +671,8 @@
 @ cdecl -arch=win64 ?setlock at streambuf@@QEAAXXZ(ptr) msvcirt.?setlock at streambuf@@QEAAXXZ
 @ thiscall -arch=win32 ?setmode at filebuf@@QAEHH at Z(ptr long) msvcirt.?setmode at filebuf@@QAEHH at Z
 @ cdecl -arch=win64 ?setmode at filebuf@@QEAAHH at Z(ptr long) msvcirt.?setmode at filebuf@@QEAAHH at Z
-@ stub -arch=win32 ?setmode at fstream@@QAEHH at Z
-@ stub -arch=win64 ?setmode at fstream@@QEAAHH at Z
+@ thiscall -arch=win32 ?setmode at fstream@@QAEHH at Z(ptr long) msvcirt.?setmode at fstream@@QAEHH at Z
+@ cdecl -arch=win64 ?setmode at fstream@@QEAAHH at Z(ptr long) msvcirt.?setmode at fstream@@QEAAHH at Z
 @ thiscall -arch=win32 ?setmode at ifstream@@QAEHH at Z(ptr long) msvcirt.?setmode at ifstream@@QAEHH at Z
 @ cdecl -arch=win64 ?setmode at ifstream@@QEAAHH at Z(ptr long) msvcirt.?setmode at ifstream@@QEAAHH at Z
 @ thiscall -arch=win32 ?setmode at ofstream@@QAEHH at Z(ptr long) msvcirt.?setmode at ofstream@@QAEHH at Z
diff --git a/dlls/msvcrt40/msvcrt40.spec b/dlls/msvcrt40/msvcrt40.spec
index 1024644b29cd..943dcc537018 100644
--- a/dlls/msvcrt40/msvcrt40.spec
+++ b/dlls/msvcrt40/msvcrt40.spec
@@ -28,16 +28,16 @@
 @ cdecl -arch=win64 ??0filebuf@@QEAA at HPEADH@Z(ptr long ptr long) msvcirt.??0filebuf@@QEAA at HPEADH@Z
 @ thiscall -arch=win32 ??0filebuf@@QAE at XZ(ptr) msvcirt.??0filebuf@@QAE at XZ
 @ cdecl -arch=win64 ??0filebuf@@QEAA at XZ(ptr) msvcirt.??0filebuf@@QEAA at XZ
-@ stub -arch=win32 ??0fstream@@QAE at ABV0@@Z
-@ stub -arch=win64 ??0fstream@@QEAA at AEBV0@@Z
-@ stub -arch=win32 ??0fstream@@QAE at H@Z
-@ stub -arch=win64 ??0fstream@@QEAA at H@Z
-@ stub -arch=win32 ??0fstream@@QAE at HPADH@Z
-@ stub -arch=win64 ??0fstream@@QEAA at HPEADH@Z
+@ thiscall -arch=win32 ??0fstream@@QAE at ABV0@@Z(ptr ptr long) msvcirt.??0fstream@@QAE at ABV0@@Z
+@ cdecl -arch=win64 ??0fstream@@QEAA at AEBV0@@Z(ptr ptr long) msvcirt.??0fstream@@QEAA at AEBV0@@Z
+@ thiscall -arch=win32 ??0fstream@@QAE at H@Z(ptr long long) msvcirt.??0fstream@@QAE at H@Z
+@ cdecl -arch=win64 ??0fstream@@QEAA at H@Z(ptr long long) msvcirt.??0fstream@@QEAA at H@Z
+@ thiscall -arch=win32 ??0fstream@@QAE at HPADH@Z(ptr long ptr long long) msvcirt.??0fstream@@QAE at HPADH@Z
+@ cdecl -arch=win64 ??0fstream@@QEAA at HPEADH@Z(ptr long ptr long long) msvcirt.??0fstream@@QEAA at HPEADH@Z
 @ thiscall -arch=win32 ??0fstream@@QAE at PBDHH@Z(ptr str long long long) msvcirt.??0fstream@@QAE at PBDHH@Z
 @ cdecl -arch=win64 ??0fstream@@QEAA at PEBDHH@Z(ptr str long long long) msvcirt.??0fstream@@QEAA at PEBDHH@Z
-@ stub -arch=win32 ??0fstream@@QAE at XZ
-@ stub -arch=win64 ??0fstream@@QEAA at XZ
+@ thiscall -arch=win32 ??0fstream@@QAE at XZ(ptr long) msvcirt.??0fstream@@QAE at XZ
+@ cdecl -arch=win64 ??0fstream@@QEAA at XZ(ptr long) msvcirt.??0fstream@@QEAA at XZ
 @ thiscall -arch=win32 ??0ifstream@@QAE at ABV0@@Z(ptr ptr long) msvcirt.??0ifstream@@QAE at ABV0@@Z
 @ cdecl -arch=win64 ??0ifstream@@QEAA at AEBV0@@Z(ptr ptr long) msvcirt.??0ifstream@@QEAA at AEBV0@@Z
 @ thiscall -arch=win32 ??0ifstream@@QAE at H@Z(ptr long long) msvcirt.??0ifstream@@QAE at H@Z
@@ -204,8 +204,8 @@
 @ cdecl -arch=win64 ??4exception@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) msvcrt.??4exception@@QEAAAEAV0 at AEBV0@@Z
 @ thiscall -arch=win32 ??4filebuf@@QAEAAV0 at ABV0@@Z(ptr ptr) msvcirt.??4filebuf@@QAEAAV0 at ABV0@@Z
 @ cdecl -arch=win64 ??4filebuf@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) msvcirt.??4filebuf@@QEAAAEAV0 at AEBV0@@Z
-@ stub -arch=win32 ??4fstream@@QAEAAV0 at AAV0@@Z
-@ stub -arch=win64 ??4fstream@@QEAAAEAV0 at AEAV0@@Z
+@ thiscall -arch=win32 ??4fstream@@QAEAAV0 at AAV0@@Z(ptr ptr) msvcirt.??4fstream@@QAEAAV0 at AAV0@@Z
+@ cdecl -arch=win64 ??4fstream@@QEAAAEAV0 at AEAV0@@Z(ptr ptr) msvcirt.??4fstream@@QEAAAEAV0 at AEAV0@@Z
 @ thiscall -arch=win32 ??4ifstream@@QAEAAV0 at ABV0@@Z(ptr ptr) msvcirt.??4ifstream@@QAEAAV0 at ABV0@@Z
 @ cdecl -arch=win64 ??4ifstream@@QEAAAEAV0 at AEBV0@@Z(ptr ptr) msvcirt.??4ifstream@@QEAAAEAV0 at AEBV0@@Z
 @ thiscall -arch=win32 ??4ios@@IAEAAV0 at ABV0@@Z(ptr ptr) msvcirt.??4ios@@IAEAAV0 at ABV0@@Z
@@ -455,8 +455,8 @@
 @ cdecl -arch=win64 ?allocate at streambuf@@IEAAHXZ(ptr) msvcirt.?allocate at streambuf@@IEAAHXZ
 @ thiscall -arch=win32 ?attach at filebuf@@QAEPAV1 at H@Z(ptr long) msvcirt.?attach at filebuf@@QAEPAV1 at H@Z
 @ cdecl -arch=win64 ?attach at filebuf@@QEAAPEAV1 at H@Z(ptr long) msvcirt.?attach at filebuf@@QEAAPEAV1 at H@Z
-@ stub -arch=win32 ?attach at fstream@@QAEXH at Z
-@ stub -arch=win64 ?attach at fstream@@QEAAXH at Z
+@ thiscall -arch=win32 ?attach at fstream@@QAEXH at Z(ptr long) msvcirt.?attach at fstream@@QAEXH at Z
+@ cdecl -arch=win64 ?attach at fstream@@QEAAXH at Z(ptr long) msvcirt.?attach at fstream@@QEAAXH at Z
 @ thiscall -arch=win32 ?attach at ifstream@@QAEXH at Z(ptr long) msvcirt.?attach at ifstream@@QAEXH at Z
 @ cdecl -arch=win64 ?attach at ifstream@@QEAAXH at Z(ptr long) msvcirt.?attach at ifstream@@QEAAXH at Z
 @ thiscall -arch=win32 ?attach at ofstream@@QAEXH at Z(ptr long) msvcirt.?attach at ofstream@@QAEXH at Z
@@ -479,8 +479,8 @@
 @ extern ?clog@@3Vostream_withassign@@A msvcirt.?clog@@3Vostream_withassign@@A
 @ thiscall -arch=win32 ?close at filebuf@@QAEPAV1 at XZ(ptr) msvcirt.?close at filebuf@@QAEPAV1 at XZ
 @ cdecl -arch=win64 ?close at filebuf@@QEAAPEAV1 at XZ(ptr) msvcirt.?close at filebuf@@QEAAPEAV1 at XZ
-@ stub -arch=win32 ?close at fstream@@QAEXXZ
-@ stub -arch=win64 ?close at fstream@@QEAAXXZ
+@ thiscall -arch=win32 ?close at fstream@@QAEXXZ(ptr) msvcirt.?close at fstream@@QAEXXZ
+@ cdecl -arch=win64 ?close at fstream@@QEAAXXZ(ptr) msvcirt.?close at fstream@@QEAAXXZ
 @ thiscall -arch=win32 ?close at ifstream@@QAEXXZ(ptr) msvcirt.?close at ifstream@@QAEXXZ
 @ cdecl -arch=win64 ?close at ifstream@@QEAAXXZ(ptr) msvcirt.?close at ifstream@@QEAAXXZ
 @ thiscall -arch=win32 ?close at ofstream@@QAEXXZ(ptr) msvcirt.?close at ofstream@@QAEXXZ
@@ -523,8 +523,8 @@
 @ cdecl -arch=win64 ?fail at ios@@QEBAHXZ(ptr) msvcirt.?fail at ios@@QEBAHXZ
 @ thiscall -arch=win32 ?fd at filebuf@@QBEHXZ(ptr) msvcirt.?fd at filebuf@@QBEHXZ
 @ cdecl -arch=win64 ?fd at filebuf@@QEBAHXZ(ptr) msvcirt.?fd at filebuf@@QEBAHXZ
-@ stub -arch=win32 ?fd at fstream@@QBEHXZ
-@ stub -arch=win64 ?fd at fstream@@QEBAHXZ
+@ thiscall -arch=win32 ?fd at fstream@@QBEHXZ(ptr) msvcirt.?fd at fstream@@QBEHXZ
+@ cdecl -arch=win64 ?fd at fstream@@QEBAHXZ(ptr) msvcirt.?fd at fstream@@QEBAHXZ
 @ thiscall -arch=win32 ?fd at ifstream@@QBEHXZ(ptr) msvcirt.?fd at ifstream@@QBEHXZ
 @ cdecl -arch=win64 ?fd at ifstream@@QEBAHXZ(ptr) msvcirt.?fd at ifstream@@QEBAHXZ
 @ thiscall -arch=win32 ?fd at ofstream@@QBEHXZ(ptr) msvcirt.?fd at ofstream@@QBEHXZ
@@ -592,8 +592,8 @@
 @ cdecl -arch=win64 ?ipfx at istream@@QEAAHH at Z(ptr long) msvcirt.?ipfx at istream@@QEAAHH at Z
 @ thiscall -arch=win32 ?is_open at filebuf@@QBEHXZ(ptr) msvcirt.?is_open at filebuf@@QBEHXZ
 @ cdecl -arch=win64 ?is_open at filebuf@@QEBAHXZ(ptr) msvcirt.?is_open at filebuf@@QEBAHXZ
-@ stub -arch=win32 ?is_open at fstream@@QBEHXZ
-@ stub -arch=win64 ?is_open at fstream@@QEBAHXZ
+@ thiscall -arch=win32 ?is_open at fstream@@QBEHXZ(ptr) msvcirt.?is_open at fstream@@QBEHXZ
+@ cdecl -arch=win64 ?is_open at fstream@@QEBAHXZ(ptr) msvcirt.?is_open at fstream@@QEBAHXZ
 @ thiscall -arch=win32 ?is_open at ifstream@@QBEHXZ(ptr) msvcirt.?is_open at ifstream@@QBEHXZ
 @ cdecl -arch=win64 ?is_open at ifstream@@QEBAHXZ(ptr) msvcirt.?is_open at ifstream@@QEBAHXZ
 @ thiscall -arch=win32 ?is_open at ofstream@@QBEHXZ(ptr) msvcirt.?is_open at ofstream@@QBEHXZ
@@ -619,8 +619,8 @@
 @ cdecl -arch=win64 ?oct@@YAAEAVios@@AEAV1@@Z(ptr) msvcirt.?oct@@YAAEAVios@@AEAV1@@Z
 @ thiscall -arch=win32 ?open at filebuf@@QAEPAV1 at PBDHH@Z(ptr str long long) msvcirt.?open at filebuf@@QAEPAV1 at PBDHH@Z
 @ cdecl -arch=win64 ?open at filebuf@@QEAAPEAV1 at PEBDHH@Z(ptr str long long) msvcirt.?open at filebuf@@QEAAPEAV1 at PEBDHH@Z
-@ stub -arch=win32 ?open at fstream@@QAEXPBDHH at Z
-@ stub -arch=win64 ?open at fstream@@QEAAXPEBDHH at Z
+@ thiscall -arch=win32 ?open at fstream@@QAEXPBDHH at Z(ptr str long long) msvcirt.?open at fstream@@QAEXPBDHH at Z
+@ cdecl -arch=win64 ?open at fstream@@QEAAXPEBDHH at Z(ptr str long long) msvcirt.?open at fstream@@QEAAXPEBDHH at Z
 @ thiscall -arch=win32 ?open at ifstream@@QAEXPBDHH at Z(ptr str long long) msvcirt.?open at ifstream@@QAEXPBDHH at Z
 @ cdecl -arch=win64 ?open at ifstream@@QEAAXPEBDHH at Z(ptr str long long) msvcirt.?open at ifstream@@QEAAXPEBDHH at Z
 @ thiscall -arch=win32 ?open at ofstream@@QAEXPBDHH at Z(ptr str long long) msvcirt.?open at ofstream@@QAEXPBDHH at Z
@@ -670,8 +670,8 @@
 @ cdecl -arch=win64 ?pword at ios@@QEBAAEAPEAXH at Z(ptr long) msvcirt.?pword at ios@@QEBAAEAPEAXH at Z
 @ thiscall -arch=i386 ?raw_name at type_info@@QBEPBDXZ(ptr) msvcrt.?raw_name at type_info@@QBEPBDXZ
 @ cdecl -arch=win64 ?raw_name at type_info@@QEBAPEBDXZ(ptr) msvcrt.?raw_name at type_info@@QEBAPEBDXZ
-@ stub -arch=win32 ?rdbuf at fstream@@QBEPAVfilebuf@@XZ
-@ stub -arch=win64 ?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ
+@ thiscall -arch=win32 ?rdbuf at fstream@@QBEPAVfilebuf@@XZ(ptr) msvcirt.?rdbuf at fstream@@QBEPAVfilebuf@@XZ
+@ cdecl -arch=win64 ?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ(ptr) msvcirt.?rdbuf at fstream@@QEBAPEAVfilebuf@@XZ
 @ thiscall -arch=win32 ?rdbuf at ifstream@@QBEPAVfilebuf@@XZ(ptr) msvcirt.?rdbuf at ifstream@@QBEPAVfilebuf@@XZ
 @ cdecl -arch=win64 ?rdbuf at ifstream@@QEBAPEAVfilebuf@@XZ(ptr) msvcirt.?rdbuf at ifstream@@QEBAPEAVfilebuf@@XZ
 @ thiscall -arch=win32 ?rdbuf at ios@@QBEPAVstreambuf@@XZ(ptr) msvcirt.?rdbuf at ios@@QBEPAVstreambuf@@XZ
@@ -721,8 +721,8 @@
 @ cdecl -arch=win64 ?setb at streambuf@@IEAAXPEAD0H at Z(ptr ptr ptr long) msvcirt.?setb at streambuf@@IEAAXPEAD0H at Z
 @ thiscall -arch=win32 ?setbuf at filebuf@@UAEPAVstreambuf@@PADH at Z(ptr ptr long) msvcirt.?setbuf at filebuf@@UAEPAVstreambuf@@PADH at Z
 @ cdecl -arch=win64 ?setbuf at filebuf@@UEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) msvcirt.?setbuf at filebuf@@UEAAPEAVstreambuf@@PEADH at Z
-@ stub -arch=win32 ?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z
-@ stub -arch=win64 ?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z
+@ thiscall -arch=win32 ?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) msvcirt.?setbuf at fstream@@QAEPAVstreambuf@@PADH at Z
+@ cdecl -arch=win64 ?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) msvcirt.?setbuf at fstream@@QEAAPEAVstreambuf@@PEADH at Z
 @ thiscall -arch=win32 ?setbuf at ifstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) msvcirt.?setbuf at ifstream@@QAEPAVstreambuf@@PADH at Z
 @ cdecl -arch=win64 ?setbuf at ifstream@@QEAAPEAVstreambuf@@PEADH at Z(ptr ptr long) msvcirt.?setbuf at ifstream@@QEAAPEAVstreambuf@@PEADH at Z
 @ thiscall -arch=win32 ?setbuf at ofstream@@QAEPAVstreambuf@@PADH at Z(ptr ptr long) msvcirt.?setbuf at ofstream@@QAEPAVstreambuf@@PADH at Z
@@ -743,8 +743,8 @@
 @ cdecl -arch=win64 ?setlock at streambuf@@QEAAXXZ(ptr) msvcirt.?setlock at streambuf@@QEAAXXZ
 @ thiscall -arch=win32 ?setmode at filebuf@@QAEHH at Z(ptr long) msvcirt.?setmode at filebuf@@QAEHH at Z
 @ cdecl -arch=win64 ?setmode at filebuf@@QEAAHH at Z(ptr long) msvcirt.?setmode at filebuf@@QEAAHH at Z
-@ stub -arch=win32 ?setmode at fstream@@QAEHH at Z
-@ stub -arch=win64 ?setmode at fstream@@QEAAHH at Z
+@ thiscall -arch=win32 ?setmode at fstream@@QAEHH at Z(ptr long) msvcirt.?setmode at fstream@@QAEHH at Z
+@ cdecl -arch=win64 ?setmode at fstream@@QEAAHH at Z(ptr long) msvcirt.?setmode at fstream@@QEAAHH at Z
 @ thiscall -arch=win32 ?setmode at ifstream@@QAEHH at Z(ptr long) msvcirt.?setmode at ifstream@@QAEHH at Z
 @ cdecl -arch=win64 ?setmode at ifstream@@QEAAHH at Z(ptr long) msvcirt.?setmode at ifstream@@QEAAHH at Z
 @ thiscall -arch=win32 ?setmode at ofstream@@QAEHH at Z(ptr long) msvcirt.?setmode at ofstream@@QAEHH at Z
-- 
2.30.1




More information about the wine-devel mailing list