basic_ifstream implementation

Josh Juran josh at iswifter.net
Wed Oct 26 19:01:41 CDT 2011


On Oct 26, 2011, at 11:59 AM, Josh Juran wrote:

> I'm ready to begin work on a basic_ifstream implementation for Wine, which is needed for the game Vampire Secrets among others.
> 
> http://bugs.winehq.org/show_bug.cgi?id=28612
> 
> First I'd like to check that Piotr isn't already working on this.  If not, I'm open to any advice on how to proceed.  My plan is to create fstream.c, and use string.c as a guide.

Well, it turns out that the game creates an ifstream for its intro movie and then uses a completely different mechanism to read from it.  Defining a (nearly) empty constructor and destructor for basic_ifstream<char> was sufficient to make things work.

The good news is that this ticket can be resolved if the patch attached to it and included below (or one like it) is applied.  The bad news is that I won't be providing an actual implementation or otherwise working on this any further.

Josh


diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 84dfb17..4290469 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -1727,3 +1727,35 @@ basic_ostream_char* __thiscall basic_ostream_char_write(basic_ostream_char *this
     FIXME("(%p %s %lu) stub\n", this, debugstr_a(str), count);
     return NULL;
 }
+
+static const vtable_ptr basic_ifstream_char_vtable;
+
+typedef struct _basic_ifstream_char
+{
+    const vtable_ptr *vtable;
+
+    int filler[ 140 / sizeof (int) - sizeof (const vtable_ptr*) ];
+}
+basic_ifstream_char;
+
+/* ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAE at PBDHH@Z */
+/* ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QEAA at PEBDHH@Z */
+DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor, 16)
+basic_ifstream_char* __thiscall basic_ifstream_char_ctor(basic_ifstream_char *this, const char *path, int mode, int prot)
+{
+    FIXME("(%p, %s, %d, %d) stub\n", this, path, mode, prot);
+
+    this->vtable = &basic_ifstream_char_vtable;
+
+    return this;
+}
+
+/* ??_D?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAEXXZ */
+/* ??_D?$basic_ifstream at DU?$char_traits at D@std@@@std@@QEAAXXZ */
+DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vbase_dtor, 4)
+basic_ifstream_char* __thiscall basic_ifstream_char_vbase_dtor(basic_ifstream_char *this)
+{
+    FIXME("(%p) stub\n", this);
+
+    return this;
+}
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index 33d5619..f43a669 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -590,7 +590,7 @@
 @ stub -arch=win64 ??0?$basic_fstream at _WU?$char_traits at _W@std@@@std@@QEAA at XZ
 @ stub -arch=win32 ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAE at PAU_iobuf@@@Z
 @ stub -arch=win64 ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QEAA at PEAU_iobuf@@@Z
-@ stub -arch=win32 ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAE at PBDHH@Z
+@ thiscall -arch=win32 ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAE at PBDHH@Z(ptr long long) basic_ifstream_char_ctor
 @ stub -arch=win64 ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QEAA at PEBDHH@Z
 @ stub -arch=win32 ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAE at PBGHH@Z
 @ stub -arch=win64 ??0?$basic_ifstream at DU?$char_traits at D@std@@@std@@QEAA at PEBGHH@Z
@@ -1907,7 +1907,7 @@
 @ stub -arch=win64 ??_D?$basic_fstream at GU?$char_traits at G@std@@@std@@QEAAXXZ
 @ stub -arch=win32 ??_D?$basic_fstream at _WU?$char_traits at _W@std@@@std@@QAEXXZ
 @ stub -arch=win64 ??_D?$basic_fstream at _WU?$char_traits at _W@std@@@std@@QEAAXXZ
-@ stub -arch=win32 ??_D?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAEXXZ
+@ thiscall -arch=win32 ??_D?$basic_ifstream at DU?$char_traits at D@std@@@std@@QAEXXZ(ptr) basic_ifstream_char_vbase_dtor
 @ stub -arch=win64 ??_D?$basic_ifstream at DU?$char_traits at D@std@@@std@@QEAAXXZ
 @ stub -arch=win32 ??_D?$basic_ifstream at GU?$char_traits at G@std@@@std@@QAEXXZ
 @ stub -arch=win64 ??_D?$basic_ifstream at GU?$char_traits at G@std@@@std@@QEAAXXZ




More information about the wine-devel mailing list