basic_ifstream implementation

Piotr Caban piotr at
Thu Oct 27 02:35:36 CDT 2011

On 10/27/11 2:01 AM, Josh Juran wrote:
> 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.
In order to implement it correctly lots of functions/classes needs to be 
implemented first. I've started stubbing some of them but there's still 
lots to be done.
>> 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.
It may happen because of inlining some functions. The game may also use 
created streams later.
>> +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;
It's not good to add an incomplete structure. We'll end having lots of 
bugs that will need to be debugged to find where the problem is. 
Especially adding uninitialized vtable pointer is not a good idea.

I think it should be implemented by adding all fstream class 
dependencies first. Thanks to it it will be possible to create a 
complete basic_ifstream_char structure.
>> +basic_ifstream_char* __thiscall basic_ifstream_char_ctor(basic_ifstream_char *this, const char *path, int mode, int prot)
>> +@ 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
Arguments in spec file are different then in ios.c.


More information about the wine-devel mailing list