Wine crash before initialization - is this faulty code ?

Martin Wilck Martin.Wilck at
Tue May 21 13:38:47 CDT 2002

Hi -

I had a wine crash today that occurs before wine is properly
initialized, and therefore was pretty nasty to debug. However I traced
it down to the test program below.

The test program is loaded as a winelib app (i.e. a dll).

The program defines a global variable that is an instance of a class
where the constructor calls InitalizeCriticalSection(). 
Interestingly, the call to RtlInitializeCriticalSection() completes
successfully, but subsequently the program crashes and the stack is
corrupted, so that I can't really see where the program is stuck.
It seems that the dlopen() call in wine_dlopen() on never
finishes, though.

This seems to run fine on windows.


#include <winbase.h>
#include <stdio.h>

class cs_test;

class cs_test {
    ~cs_test() {};

    memset ( &(this->crit), 0, sizeof (CRITICAL_SECTION) );
    InitializeCriticalSection ( &(this->crit) );

// this statement causes the crash when called at DLL load time
cs_test tst;

int main()
    return 0;

Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at
D-33106 Paderborn 

More information about the wine-devel mailing list