Miguel de Icaza miguel@ximian.com writes:
Our patch is simple, and we lack the experience to work on Wine, TEB and what not. We just do not have the time to learn everything there is to Wine.
Something along these lines should do the trick:
#include <wine/library.h> #include <stdio.h> #include <windows.h> #include <winternl.h> #include <setjmp.h>
static jmp_buf jmpbuf;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) { longjmp( jmpbuf, 1 ); }
int SharedWineInit(void) { unsigned char Error[1024]=""; char *WineArguments[] = {"sharedapp", LIBPATH "/wine-sharedlib.exe.so", NULL};
if (!setjmp( jmpbuf )) { wine_init(2, WineArguments, Error, sizeof(Error)); printf( "should not get here\n" ); } NtCurrentTeb()->Tib.ExceptionList = (void *)~0UL; VirtualFree( NtCurrentTeb()->DeallocationStack, 0, MEM_RELEASE ); NtCurrentTeb()->DeallocationStack = NULL; NtCurrentTeb()->Tib.StackBase = (void*)~0UL; /* FIXME: should find actual limits here */ NtCurrentTeb()->Tib.StackLimit = 0; return(0); }