[Mono-winforms-list] When will winforms be working?

Vlad kaluzhny vkaluzhny@openlinksw.co.uk
Thu, 19 Feb 2004 11:05:03 +0600


--------------030200040303080907010207
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Hi All.

Peter  It  definitely is not clear to me - which part of Wine are  you=20
patching?
And second - lets coordinate our efforts in patches writing,
otherwise we will duplicate  our work

I have already patched ntdll.dll and now working on kernel32.dll.......

Regards, Vlad

Peter Dennis Bartok wrote:

> Hi All,
>
> Sorry for having been so quiet. I was hoping I'd get all the changes=20
> done and could just present a 'complete solution'. But I'm not quite=20
> there yet.
>
> The first patch is in CVS already, it's located under=20
> mcs/class/System.Windows.Forms/wine-patch
>
> I've also attached the patch and a readme.
>
> Keep in mind that it's not complete yet. The patches will allow you to =

> use Wine as a shared library. Unlike the previous patch, where wine=20
> itself was hacked up to be compiled either the traditional way or as a =

> shared library I tried to have a patch that could make it back to the=20
> main wine repository. So the only actual changes to wine itself was=20
> that I prevent wine from calling the WinMain of a passed-in winelib=20
> executable, if the name of the executable is 'mono-winelib'.
>
> Everything else is handled in the mono-winelib executable. It acts as=20
> a winelib binary as well as the library that gets loaded to initialize =

> wine as a shared library. Simply dlopen() and import the=20
> MonoWineInit() function and run it. That function in turn will=20
> initialize wine and then return. At that point any caller should be=20
> able to import and use any symbols/functions from wine.
>
> Keep in mind that I have done only minimal testing with the approach=20
> so far, since I still need to develop a second patch, to make the=20
> x11drv coexist with cairo. It seems that there's some offscreen=20
> caching happening in cairo and when wine draws on the screen cairo=20
> isn't aware and 'overwrites' the wine changes. I'm still in the=20
> process of debugging the issues, give me a few days more on that.
>
> Check the readme that goes along with the patch for some symbolic=20
> links that have to be created manually currently before the wine patch =

> can be used.
>
> I have also attached a patch that's not in CVS yet (mcs-0.30.patch)=20
> which fixes up SWF to properly load the new wine library. Pathnames=20
> are currently fixed to /usr/local/lib/wine. Once the hard problems are =

> worked out I'll take care of these things.
>
> Hope this wasn't too much detail. Please send me any feedback you may=20
> have, but keep in mind that SWF (while it may start displaying windows =

> again) will still not work properly due to the cairo/x11drv issue (and =

> potentially some of the new work done in System.Drawing)
>
> I'm also working on a roadmap for SWF itself, so that we can=20
> coordinate work on the library, but I figure the basic framework=20
> (Wine/Cairo/SWF) needs to be in working order first.
>
>
> Cheers,
>  Peter
>
>
>
> M. Scott Ford wrote:
>
>> Miguel,
>>
>> Thanks for the update. I remember seeing the Cairo/GDI+ conversation, =

>> but I
>> had no idea that it had led to so many cool changes. WINE as a=20
>> library will
>> be great! Please let us know as soon as the changes are committed. I a=
m
>> eager to start working. :)
>>
>> Are there any other lists that we should be watching to keep up with t=
he
>> news?
>>
>> Thanks,
>> -Scott
>>
>> -----Original Message-----
>> From: mono-winforms-list-admin@lists.ximian.com
>> [mailto:mono-winforms-list-admin@lists.ximian.com] On Behalf Of=20
>> Miguel de
>> Icaza
>> Sent: Wednesday, February 18, 2004 12:14 AM
>> To: Scott Ford
>> Cc: mono-winforms-list@lists.ximian.com
>> Subject: RE: [Mono-winforms-list] When will winforms be working?
>>
>> Hello,
>>
>>
>>> What are the problems? I have not really seen mention of any in this
>>> list. If they are being discussed, where is the discussion taking=20
>>> place?
>>> I am sure that many of us are willing to help, but have no idea what =
is
>>> going on.
>>
>>
>>
>> The short answer is "soon".  The long answer is:
>>
>> * When Peter was fixing the Wine/Cairo integration issues, he found
>>   a way of doing this cleanly: to build a driver that knows about
>>   Cairo/GDI+.
>>
>> * When he started writing the driver, we noticed that our patches Wine=

>>   was too old, and that the code we wrote would have to be discarded
>>   when we upgraded to Wine.  So...
>>
>> * Peter started working on porting/patching the latest Wine to work=20
>> as   a library.  Peter noticed that the new Wine requires even less=20
>> changes
>>   to turn into a library and found a fairly clever way of even being=20
>> able
>>   to turn Wine into a library and minimizing the changes.=20
>>   These are good news, because we might be able to merge the few chang=
es
>>   into the main Wine.
>>
>> * We will be building packages of the modified Wine very soon now ;-)
>>
>> * Work on the C#-side of Windows.Forms will resume in a couple of days=
=2E
>>
>> Miguel.
>> _______________________________________________
>> Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>>
>>
>> _______________________________________________
>> Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>>
>------------------------------------------------------------------------=

>
>diff -ruN wine-20040121/configure wine-20040121-mono/configure
>--- wine-20040121/configure	2004-01-21 18:02:29.000000000 -0700
>+++ wine-20040121-mono/configure	2004-02-12 14:33:46.000000000 -0700
>@@ -19070,7 +19070,7 @@
> MAKE_PROG_RULES=3Dprograms/Makeprog.rules
>=20
>=20
>-                                                                       =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                             ac_config_fi=
les=3D"$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules=
 libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/a=
dvapi32/Makefile dlls/advapi32/tests/Makefile dlls/avicap32/Makefile dlls=
/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cfgm=
gr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/t=
ests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Mak=
efile dlls/ctl3d/Makefile dlls/wined3d/Makefile dlls/d3d8/Makefile dlls/d=
3d9/Makefile dlls/d3dim/Makefile dlls/d3dx8/Makefile dlls/dciman32/Makefi=
le dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dl=
ls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcomp=
os/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Make=
file dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dll=
s/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnhpas=
t/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Ma=
kefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls=
/glut32/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/imagehlp/Ma=
kefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Mak=
efile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makef=
ile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm=
/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile=
 dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dll=
s/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Ma=
kefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Make=
file dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvideo/Makefile d=
lls/msvideo/msrle32/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile=
 dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dl=
ls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole=
acc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/ole=
cli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Make=
file dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/q=
uartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/=
Makefile dlls/rpcrt4/tests/Makefile dlls/serialui/Makefile dlls/setupapi/=
Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/M=
akefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/M=
akefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls=
/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makef=
ile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dl=
ls/user/tests/Makefile dlls/uxtheme/Makefile dlls/version/Makefile dlls/w=
in32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Ma=
kefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makef=
ile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/m=
ciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls=
/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Make=
file dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/=
winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winenas/Make=
file dlls/winmm/winejack/Makefile dlls/winmm/wineoss/Makefile dlls/winnls=
/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool=
/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintru=
st/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefil=
e documentation/Makefile include/Makefile libs/Makefile libs/port/Makefil=
e libs/unicode/Makefile libs/uuid/Makefile libs/wine/Makefile libs/wpp/Ma=
kefile loader/Makefile programs/Makefile programs/avitools/Makefile progr=
ams/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile p=
rograms/expand/Makefile programs/notepad/Makefile programs/progman/Makefi=
le programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Ma=
kefile programs/rundll32/Makefile programs/start/Makefile programs/uninst=
aller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/win=
eboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile pr=
ograms/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/M=
akefile programs/winemenubuilder/Makefile programs/winemine/Makefile prog=
rams/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefi=
le programs/winhelp/Makefile programs/winver/Makefile server/Makefile too=
ls/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Mak=
efile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile t=
ools/wrc/Makefile"
>+                                                                       =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                                         =
                                                             ac_config_fi=
les=3D"$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules=
 libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/a=
dvapi32/Makefile dlls/advapi32/tests/Makefile dlls/avicap32/Makefile dlls=
/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cfgm=
gr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/t=
ests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Mak=
efile dlls/ctl3d/Makefile dlls/wined3d/Makefile dlls/d3d8/Makefile dlls/d=
3d9/Makefile dlls/d3dim/Makefile dlls/d3dx8/Makefile dlls/dciman32/Makefi=
le dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dl=
ls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcomp=
os/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Make=
file dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dll=
s/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnhpas=
t/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Ma=
kefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls=
/glut32/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/imagehlp/Ma=
kefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Mak=
efile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makef=
ile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm=
/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile=
 dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dll=
s/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Ma=
kefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Make=
file dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvideo/Makefile d=
lls/msvideo/msrle32/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile=
 dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dl=
ls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole=
acc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/ole=
cli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Make=
file dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/q=
uartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/=
Makefile dlls/rpcrt4/tests/Makefile dlls/serialui/Makefile dlls/setupapi/=
Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/M=
akefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/M=
akefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls=
/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makef=
ile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dl=
ls/user/tests/Makefile dlls/uxtheme/Makefile dlls/version/Makefile dlls/w=
in32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Ma=
kefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makef=
ile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/m=
ciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls=
/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Make=
file dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/=
winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winenas/Make=
file dlls/winmm/winejack/Makefile dlls/winmm/wineoss/Makefile dlls/winnls=
/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool=
/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintru=
st/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefil=
e documentation/Makefile include/Makefile libs/Makefile libs/port/Makefil=
e libs/unicode/Makefile libs/uuid/Makefile libs/wine/Makefile libs/wpp/Ma=
kefile loader/Makefile programs/Makefile programs/avitools/Makefile progr=
ams/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile p=
rograms/expand/Makefile programs/mono-winelib/Makefile programs/notepad/M=
akefile programs/progman/Makefile programs/regedit/Makefile programs/regs=
vr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs=
/start/Makefile programs/uninstaller/Makefile programs/view/Makefile prog=
rams/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefi=
le programs/winecfg/Makefile programs/wineconsole/Makefile programs/wined=
bg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile =
programs/winemine/Makefile programs/winepath/Makefile programs/winetest/M=
akefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winv=
er/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/wina=
pi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegc=
c/Makefile tools/wmc/Makefile tools/wrc/Makefile"
>=20
>=20
> cat >confcache <<\_ACEOF
>@@ -19772,6 +19772,7 @@
>   "programs/cmdlgtst/Makefile" ) CONFIG_FILES=3D"$CONFIG_FILES programs=
/cmdlgtst/Makefile" ;;
>   "programs/control/Makefile" ) CONFIG_FILES=3D"$CONFIG_FILES programs/=
control/Makefile" ;;
>   "programs/expand/Makefile" ) CONFIG_FILES=3D"$CONFIG_FILES programs/e=
xpand/Makefile" ;;
>+  "programs/mono-winelib/Makefile" ) CONFIG_FILES=3D"$CONFIG_FILES prog=
rams/mono-winelib/Makefile" ;;
>   "programs/notepad/Makefile" ) CONFIG_FILES=3D"$CONFIG_FILES programs/=
notepad/Makefile" ;;
>   "programs/progman/Makefile" ) CONFIG_FILES=3D"$CONFIG_FILES programs/=
progman/Makefile" ;;
>   "programs/regedit/Makefile" ) CONFIG_FILES=3D"$CONFIG_FILES programs/=
regedit/Makefile" ;;
>diff -ruN wine-20040121/dlls/kernel/process.c wine-20040121-mono/dlls/ke=
rnel/process.c
>--- wine-20040121/dlls/kernel/process.c	2004-01-20 14:51:27.000000000 -0=
700
>+++ wine-20040121-mono/dlls/kernel/process.c	2004-02-13 15:14:40.0000000=
00 -0700
>@@ -752,8 +752,12 @@
>=20
>         SetLastError( 0 );  /* clear error code */
>         if (peb->BeingDebugged) DbgBreakPoint();
>-        ExitProcess( entry( peb ) );
>+        if (__wine_main_argc!=3D1 || !(__wine_main_argc=3D=3D1 && strle=
n(__wine_main_argv[0])>=3D19 && strncasecmp(__wine_main_argv[0]+strlen(__=
wine_main_argv[0])-19, "mono-winelib.exe.so", 19)=3D=3D0)) {
>+            // This starts the main app and then exits wine
>+            ExitProcess( entry( peb ) );
>+        }
>     }
>+
>     __EXCEPT(UnhandledExceptionFilter)
>     {
>         TerminateThread( GetCurrentThread(), GetExceptionCode() );
>@@ -897,7 +901,16 @@
>     if (!THREAD_InitStack( NtCurrentTeb(), stack_size )) goto error;
>=20
>     /* switch to the new stack */
>-    wine_switch_to_stack( start_process, NULL, NtCurrentTeb()->Tib.Stac=
kBase );
>+
>+    if (__wine_main_argc=3D=3D1 && strlen(__wine_main_argv[0])>=3D19 &&=
 strncasecmp(__wine_main_argv[0]+strlen(__wine_main_argv[0])-19, "mono-wi=
nelib.exe.so", 19)=3D=3D0) {
>+        /* We don't want a new stack. Screws up our return path */
>+        start_process(NULL);
>+    } else {
>+        /* Regular wine startup */
>+        wine_switch_to_stack( start_process, NULL, NtCurrentTeb()->Tib.=
StackBase );
>+    }
>+    return;
>+
>=20
>  error:
>     ExitProcess( GetLastError() );
>diff -ruN wine-20040121/dlls/ntdll/loader.c wine-20040121-mono/dlls/ntdl=
l/loader.c
>--- wine-20040121/dlls/ntdll/loader.c	2004-01-07 20:36:53.000000000 -070=
0
>+++ wine-20040121-mono/dlls/ntdll/loader.c	2004-02-13 15:17:45.000000000=
 -0700
>@@ -1955,7 +1955,9 @@
>     WINE_MODREF *wm;
>     NTSTATUS status;
>     ANSI_STRING func_name;
>-    void (* DECLSPEC_NORETURN init_func)();
>+    /* We might return for shared-lib startup */
>+    /* void (* DECLSPEC_NORETURN init_func)(); */
>+    void (* init_func)();
>     extern void __wine_dbg_ntdll_init(void);
>=20
>     thread_init();
>diff -ruN wine-20040121/programs/Makefile.in wine-20040121-mono/programs=
/Makefile.in
>--- wine-20040121/programs/Makefile.in	2004-01-06 13:49:59.000000000 -07=
00
>+++ wine-20040121-mono/programs/Makefile.in	2004-02-12 14:32:58.00000000=
0 -0700
>@@ -11,6 +11,7 @@
> 	cmdlgtst \
> 	control \
> 	expand \
>+	mono-winelib \
> 	notepad \
> 	progman \
> 	regedit \
>@@ -41,6 +42,7 @@
> 	clock \
> 	control \
> 	expand \
>+	mono-winelib \
> 	notepad \
> 	progman \
> 	regedit \
>@@ -179,6 +181,9 @@
> icinfo.exe$(DLLEXT): avitools/icinfo.exe$(DLLEXT)
> 	$(RM) $@ && $(LN_S) avitools/icinfo.exe$(DLLEXT) $@
>=20
>+mono-winelib.exe$(DLLEXT): mono-winelib/mono-winelib.exe$(DLLEXT)
>+	$(RM) $@ && $(LN_S) mono-winelib/mono-winelib.exe$(DLLEXT) $@
>+
> notepad.exe$(DLLEXT): notepad/notepad.exe$(DLLEXT)
> 	$(RM) $@ && $(LN_S) notepad/notepad.exe$(DLLEXT) $@
>=20
>@@ -255,6 +260,7 @@
> control/control.exe$(DLLEXT): control
> expand/expand.exe$(DLLEXT): expand
> avitools/icinfo.exe$(DLLEXT): avitools
>+mono-winelib/mono-winelib.exe$(DLLEXT): mono-winelib
> notepad/notepad.exe$(DLLEXT): notepad
> progman/progman.exe$(DLLEXT): progman
> regedit/regedit.exe$(DLLEXT): regedit
>diff -ruN wine-20040121/programs/mono-winelib/Makefile.in wine-20040121-=
mono/programs/mono-winelib/Makefile.in
>--- wine-20040121/programs/mono-winelib/Makefile.in	1969-12-31 17:00:00.=
000000000 -0700
>+++ wine-20040121-mono/programs/mono-winelib/Makefile.in	2004-02-12 14:3=
6:36.000000000 -0700
>@@ -0,0 +1,26 @@
>+TOPSRCDIR =3D @top_srcdir@
>+TOPOBJDIR =3D ../..
>+SRCDIR    =3D @srcdir@
>+VPATH     =3D @srcdir@
>+MODULE    =3D mono-winelib.exe
>+APPMODE   =3D gui
>+IMPORTS   =3D kernel32
>+DELAYIMPORTS =3D user32
>+EXTRAINCL =3D=20
>+EXTRADEFS =3D
>+
>+C_SRCS =3D \
>+	mono-winelib.c \
>+	../../loader/pthread.c
>+
>+RC_SRCS =3D
>+RC_BINSRC =3D
>+RC_BINARIES =3D
>+
>+PLTESTS =3D
>+
>+EXTRASUBDIRS =3D
>+
>+@MAKE_PROG_RULES@
>+
>+### Dependencies:
>diff -ruN wine-20040121/programs/mono-winelib/mono-winelib.c wine-200401=
21-mono/programs/mono-winelib/mono-winelib.c
>--- wine-20040121/programs/mono-winelib/mono-winelib.c	1969-12-31 17:00:=
00.000000000 -0700
>+++ wine-20040121-mono/programs/mono-winelib/mono-winelib.c	2004-02-13 1=
4:52:52.000000000 -0700
>@@ -0,0 +1,86 @@
>+/*
>+ * mono-winelib code
>+ *
>+ * Copyright 2004 Novell, Inc. (http://www.novell.com/)
>+ *
>+ * This library is free software; you can redistribute it and/or
>+ * modify it under the terms of the GNU Lesser General Public
>+ * License as published by the Free Software Foundation; either
>+ * version 2.1 of the License, or (at your option) any later version.
>+ *
>+ * This library is distributed in the hope that it will be useful,
>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>+ * Lesser General Public License for more details.
>+ *
>+ * You should have received a copy of the GNU Lesser General Public
>+ * License along with this library; if not, write to the Free Software
>+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307=
  USA
>+ */
>+
>+
>+#include <wine/library.h>
>+#include <windows.h>
>+#include <winsock.h>
>+#include <dlfcn.h>
>+
>+/*
>+	Dummy WinMain. Wine is modified so that this function is never actuall=
y called
>+*/
>+
>+int WINAPI
>+WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine=
, int nCmdShow)
>+{
>+	int	dummy;
>+
>+   dummy=3DGetSystemMetrics(SM_CXSCREEN);
>+	wine_pthread_init_process(NULL);
>+
>+   return(0);
>+}
>+
>+/*
>+	WineLoadLibrary is used by System.Windows.Forms to import the Wine dll=
s
>+*/
>+void	*(*NTDLL_LoadLibraryA)(unsigned char *);
>+
>+void *
>+WineLoadLibrary(unsigned char *dll)
>+{
>+   return(NTDLL_LoadLibraryA(dll));
>+}
>+
>+
>+/*
>+	MonoWineInit()	Must be called to initialize wine. We pass special argu=
ments
>+						which will tell wine to not actually run the specified=20
>+						application
>+*/
>+
>+int
>+MonoWineInit(void)
>+{
>+	unsigned char	Error[1024]=3D"";
>+	char				*WineArguments[] =3D {"monoapp", "/usr/local/lib/wine/mono-win=
elib.exe.so", NULL};
>+	void				*hModule;
>+	int				FileExists;
>+
>+	wine_init(2, WineArguments, Error, sizeof(Error));
>+	if (Error[0]!=3D'\0') {
>+		printf("Wine initialization error:%s\n", Error);
>+		exit(-1);
>+	}
>+
>+   /* Now load kernel32 go get the pointers for LoadLibraryA and GetPro=
cAddress */
>+   hModule=3Dwine_dll_load("kernel32.dll", Error, sizeof(Error), &FileE=
xists);
>+   if (hModule=3D=3DNULL) {
>+      printf("Error loading kernel32.dll: %s\n", Error);
>+      exit(-2);
>+   }
>+
>+   NTDLL_LoadLibraryA=3Ddlsym(hModule, "LoadLibraryA");
>+   if (NTDLL_LoadLibraryA=3D=3DNULL) {
>+      printf("Did not find symbol LoadLibraryA in kernel32.dll\n");
>+      exit(-3);
>+   }
>+}
> =20
>
>------------------------------------------------------------------------=

>
>System.Windows.Forms wine-patch README
>
>After applying the patch to wine, run ./configure in the wine directory =
and=20
>'make && make depend && make install'.
>For now the patch assumes that the prefix_dir is /usr/local.
>
>Also, once the install is done you will need to create symbolic links fo=
r
>all the dlls you plan on using in System.Windows.Forms:
>ln -s /usr/local/lib/wine/kernel32.dll.so /usr/local/lib/libkernel32.dll=
=2Eso
>ln -s /usr/local/lib/wine/user32.dll.so /usr/local/lib/libuser32.dll.so
>ln -s /usr/local/lib/wine/gdi32.dll.so /usr/local/lib/libgdi32.dll.so
>ln -s /usr/local/lib/wine/advapi32.dll.so /usr/local/lib/libgdi32.dll.so=

>
>I still need to work out how to teach mono to load the libs from the win=
e=20
>directory and without the lib prefix.
>
>Peter
>pbartok@novell.com
> =20
>
>------------------------------------------------------------------------=

>
>--- mcs-0.29/class/System.Windows.Forms/System.Windows.Forms/win32functi=
ons.cs	2003-11-12 03:16:24.000000000 -0700
>+++ mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.c=
s	2004-02-12 16:47:29.000000000 -0700
>@@ -1288,12 +1288,8 @@
> 			return 0;
> 		}
>=20
>-
>-		[DllImport ("libwinnt.dll.so", EntryPoint=3D"PROCESS_InitWine")]
>-		extern static void PROCESS_InitWine (int argc, string [] args);
>-
>-		[DllImport ("libwinnt.dll.so", EntryPoint=3D"LoadLibraryA")]
>-		extern static void NTDLL_LoadLibraryA (string s);
>+		[DllImport ("/usr/local/lib/wine/mono-winelib.exe.so", EntryPoint=3D"=
WineLoadLibrary")]
>+		extern static void WineLoadLibrary(string s);
>=20
> 		static string[] WinColors =3D 	{
> 									"COLOR_SCROLLBAR",
>@@ -1389,14 +1385,12 @@
> 				Console.WriteLine ("MonoWin32: Needs Wine MonoStub");			=09
> 				return;
> 			}
>-			=09
>-			string [] args =3D new string [1];
>-			args [0] =3D "mono";
>-
>-			PROCESS_InitWine (0, args);
>-			NTDLL_LoadLibraryA ("kernel32.dll");
>-			NTDLL_LoadLibraryA ("user32.dll");
>-			NTDLL_LoadLibraryA ("comctl32.dll");
>+			Console.WriteLine("Loading Wine dlls");
>+			WineLoadLibrary("gdi32.dll");
>+			WineLoadLibrary("kernel32.dll");
>+			WineLoadLibrary("comctl32.dll");
>+			WineLoadLibrary("user32.dll");
>+			Console.WriteLine("Loading Wine dlls complete");
>=20
> 			string gtk_colors =3D Environment.GetEnvironmentVariable ("SWF_GTK_C=
OLORS");
> 			if (gtk_colors =3D=3D "1") {
>--- mcs-0.29/class/System.Windows.Forms/System.Windows.Forms/Form.cs	200=
3-11-14 21:25:32.000000000 -0700
>+++ mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs	2004-02-=
13 11:59:08.000000000 -0700
>@@ -105,8 +105,13 @@
> 				cancelButton =3D null;
> 			}
>     	=09
>-			static Form () {
>+		  // Initialization for Wine
>+			[DllImport ("/usr/local/lib/wine/mono-winelib.exe.so", EntryPoint=3D=
"MonoWineInit")]
>+			extern static int MonoWineInit();
>=20
>+			static Form () {
>+            Console.WriteLine("Initializing wine\n");
>+            MonoWineInit();
> 			}
>     	=09
> 			//  --- Public Properties
> =20
>


--------------030200040303080907010207
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
Hi All.<br>
<br>
Peter&nbsp; It&nbsp; definitely is not clear to me - which part of Wine are &nbsp;you patching?<br>
And second - lets coordinate our efforts in patches writing,<br>
otherwise we will duplicate &nbsp;our work<br>
<br>
I have already patched ntdll.dll and now working on kernel32.dll.......<br>
<br>
Regards, Vlad<br>
<br>
Peter Dennis Bartok wrote:<br>
<blockquote type="cite" cite="mid4033D4AE.2020506@novonyx.com">Hi All, <br>
 <br>
Sorry for having been so quiet. I was hoping I'd get all the changes  done
and could just present a 'complete solution'. But I'm not quite  there yet. 
  <br>
 <br>
The first patch is in CVS already, it's located under  mcs/class/System.Windows.Forms/wine-patch 
  <br>
 <br>
I've also attached the patch and a readme. <br>
 <br>
Keep in mind that it's not complete yet. The patches will allow you to  use
Wine as a shared library. Unlike the previous patch, where wine  itself was
hacked up to be compiled either the traditional way or as a  shared library
I tried to have a patch that could make it back to the  main wine repository.
So the only actual changes to wine itself was that  I prevent wine from calling
the WinMain of a passed-in winelib  executable, if the name of the executable
is 'mono-winelib'. <br>
 <br>
Everything else is handled in the mono-winelib executable. It acts as a  winelib
binary as well as the library that gets loaded to initialize  wine as a shared
library. Simply dlopen() and import the MonoWineInit()  function and run
it. That function in turn will initialize wine and then  return. At that
point any caller should be able to import and use any  symbols/functions
from wine. <br>
 <br>
Keep in mind that I have done only minimal testing with the approach so  far,
since I still need to develop a second patch, to make the x11drv  coexist
with cairo. It seems that there's some offscreen caching  happening in cairo
and when wine draws on the screen cairo isn't aware  and 'overwrites' the
wine changes. I'm still in the process of debugging  the issues, give me
a few days more on that. <br>
 <br>
Check the readme that goes along with the patch for some symbolic links  that
have to be created manually currently before the wine patch can be  used. 
  <br>
 <br>
I have also attached a patch that's not in CVS yet (mcs-0.30.patch)  which
fixes up SWF to properly load the new wine library. Pathnames are  currently
fixed to /usr/local/lib/wine. Once the hard problems are  worked out I'll
take care of these things. <br>
 <br>
Hope this wasn't too much detail. Please send me any feedback you may  have,
but keep in mind that SWF (while it may start displaying windows  again)
will still not work properly due to the cairo/x11drv issue (and  potentially
some of the new work done in System.Drawing) <br>
 <br>
I'm also working on a roadmap for SWF itself, so that we can coordinate  work
on the library, but I figure the basic framework (Wine/Cairo/SWF)  needs
to be in working order first. <br>
 <br>
 <br>
Cheers, <br>
&nbsp;Peter <br>
 <br>
 <br>
 <br>
M. Scott Ford wrote: <br>
  <blockquote type="cite">Miguel, <br>
 <br>
Thanks for the update. I remember seeing the Cairo/GDI+ conversation, but
I <br>
had no idea that it had led to so many cool changes. WINE as a library will 
    <br>
be great! Please let us know as soon as the changes are committed. I am <br>
eager to start working. :) <br>
 <br>
Are there any other lists that we should be watching to keep up with the <br>
news? <br>
 <br>
Thanks, <br>
-Scott <br>
 <br>
-----Original Message----- <br>
From: <a class="moz-txt-link-abbreviated" href="mailto:mono-winforms-list-admin@lists.ximian.com">mono-winforms-list-admin@lists.ximian.com</a> <br>
[<a class="moz-txt-link-freetext" href="mailto:mono-winforms-list-admin@lists.ximian.com">mailto:mono-winforms-list-admin@lists.ximian.com</a>] On Behalf Of Miguel de 
    <br>
Icaza <br>
Sent: Wednesday, February 18, 2004 12:14 AM <br>
To: Scott Ford <br>
Cc: <a class="moz-txt-link-abbreviated" href="mailto:mono-winforms-list@lists.ximian.com">mono-winforms-list@lists.ximian.com</a> <br>
Subject: RE: [Mono-winforms-list] When will winforms be working? <br>
 <br>
Hello, <br>
 <br>
 <br>
    <blockquote type="cite">What are the problems? I have not really seen
mention of any in this <br>
list. If they are being discussed, where is the discussion taking place? <br>
I am sure that many of us are willing to help, but have no idea what is <br>
going on. <br>
    </blockquote>
 <br>
 <br>
The short answer is "soon".&nbsp; The long answer is: <br>
 <br>
* When Peter was fixing the Wine/Cairo integration issues, he found <br>
&nbsp; a way of doing this cleanly: to build a driver that knows about <br>
&nbsp; Cairo/GDI+. <br>
 <br>
* When he started writing the driver, we noticed that our patches Wine <br>
&nbsp; was too old, and that the code we wrote would have to be discarded <br>
&nbsp; when we upgraded to Wine.&nbsp; So... <br>
 <br>
* Peter started working on porting/patching the latest Wine to work as  &nbsp;
a library.&nbsp; Peter noticed that the new Wine requires even less changes <br>
&nbsp; to turn into a library and found a fairly clever way of even being able 
    <br>
&nbsp; to turn Wine into a library and minimizing the changes.&nbsp;   <br>
&nbsp; These are good news, because we might be able to merge the few changes <br>
&nbsp; into the main Wine. <br>
 <br>
* We will be building packages of the modified Wine very soon now ;-) <br>
 <br>
* Work on the C#-side of Windows.Forms will resume in a couple of days. <br>
 <br>
Miguel. <br>
_______________________________________________ <br>
Mono-winforms-list maillist&nbsp; -&nbsp; <a class="moz-txt-link-abbreviated" href="mailto:Mono-winforms-list@lists.ximian.com">Mono-winforms-list@lists.ximian.com</a> <br>
<a class="moz-txt-link-freetext" href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">http://lists.ximian.com/mailman/listinfo/mono-winforms-list</a> <br>
 <br>
 <br>
_______________________________________________ <br>
Mono-winforms-list maillist&nbsp; -&nbsp; <a class="moz-txt-link-abbreviated" href="mailto:Mono-winforms-list@lists.ximian.com">Mono-winforms-list@lists.ximian.com</a> <br>
<a class="moz-txt-link-freetext" href="http://lists.ximian.com/mailman/listinfo/mono-winforms-list">http://lists.ximian.com/mailman/listinfo/mono-winforms-list</a> <br>
 <br>
  </blockquote>
  <pre wrap="">
<hr width="90%" size="4">
diff -ruN wine-20040121/configure wine-20040121-mono/configure
--- wine-20040121/configure	2004-01-21 18:02:29.000000000 -0700
+++ wine-20040121-mono/configure	2004-02-12 14:33:46.000000000 -0700
@@ -19070,7 +19070,7 @@
 MAKE_PROG_RULES=programs/Makeprog.rules
 
 
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
                                                    ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/wined3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3dx8/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/
Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvideo/Makefile dlls/msvideo/msrle32/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makef
ile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uxtheme/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls
/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winenas/Makefile dlls/winmm/winejack/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/uuid/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile progr
ams/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
                                                    ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/wined3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3dx8/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/
Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvideo/Makefile dlls/msvideo/msrle32/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makef
ile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uxtheme/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls
/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winenas/Makefile dlls/winmm/winejack/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/uuid/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile progr
ams/mono-winelib/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
 
 
 cat &gt;confcache &lt;&lt;\_ACEOF
@@ -19772,6 +19772,7 @@
   "programs/cmdlgtst/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/cmdlgtst/Makefile" ;;
   "programs/control/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/control/Makefile" ;;
   "programs/expand/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/expand/Makefile" ;;
+  "programs/mono-winelib/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/mono-winelib/Makefile" ;;
   "programs/notepad/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/notepad/Makefile" ;;
   "programs/progman/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/progman/Makefile" ;;
   "programs/regedit/Makefile" ) CONFIG_FILES="$CONFIG_FILES programs/regedit/Makefile" ;;
diff -ruN wine-20040121/dlls/kernel/process.c wine-20040121-mono/dlls/kernel/process.c
--- wine-20040121/dlls/kernel/process.c	2004-01-20 14:51:27.000000000 -0700
+++ wine-20040121-mono/dlls/kernel/process.c	2004-02-13 15:14:40.000000000 -0700
@@ -752,8 +752,12 @@
 
         SetLastError( 0 );  /* clear error code */
         if (peb-&gt;BeingDebugged) DbgBreakPoint();
-        ExitProcess( entry( peb ) );
+        if (__wine_main_argc!=1 || !(__wine_main_argc==1 &amp;&amp; strlen(__wine_main_argv[0])&gt;=19 &amp;&amp; strncasecmp(__wine_main_argv[0]+strlen(__wine_main_argv[0])-19, "mono-winelib.exe.so", 19)==0)) {
+            // This starts the main app and then exits wine
+            ExitProcess( entry( peb ) );
+        }
     }
+
     __EXCEPT(UnhandledExceptionFilter)
     {
         TerminateThread( GetCurrentThread(), GetExceptionCode() );
@@ -897,7 +901,16 @@
     if (!THREAD_InitStack( NtCurrentTeb(), stack_size )) goto error;
 
     /* switch to the new stack */
-    wine_switch_to_stack( start_process, NULL, NtCurrentTeb()-&gt;Tib.StackBase );
+
+    if (__wine_main_argc==1 &amp;&amp; strlen(__wine_main_argv[0])&gt;=19 &amp;&amp; strncasecmp(__wine_main_argv[0]+strlen(__wine_main_argv[0])-19, "mono-winelib.exe.so", 19)==0) {
+        /* We don't want a new stack. Screws up our return path */
+        start_process(NULL);
+    } else {
+        /* Regular wine startup */
+        wine_switch_to_stack( start_process, NULL, NtCurrentTeb()-&gt;Tib.StackBase );
+    }
+    return;
+
 
  error:
     ExitProcess( GetLastError() );
diff -ruN wine-20040121/dlls/ntdll/loader.c wine-20040121-mono/dlls/ntdll/loader.c
--- wine-20040121/dlls/ntdll/loader.c	2004-01-07 20:36:53.000000000 -0700
+++ wine-20040121-mono/dlls/ntdll/loader.c	2004-02-13 15:17:45.000000000 -0700
@@ -1955,7 +1955,9 @@
     WINE_MODREF *wm;
     NTSTATUS status;
     ANSI_STRING func_name;
-    void (* DECLSPEC_NORETURN init_func)();
+    /* We might return for shared-lib startup */
+    /* void (* DECLSPEC_NORETURN init_func)(); */
+    void (* init_func)();
     extern void __wine_dbg_ntdll_init(void);
 
     thread_init();
diff -ruN wine-20040121/programs/Makefile.in wine-20040121-mono/programs/Makefile.in
--- wine-20040121/programs/Makefile.in	2004-01-06 13:49:59.000000000 -0700
+++ wine-20040121-mono/programs/Makefile.in	2004-02-12 14:32:58.000000000 -0700
@@ -11,6 +11,7 @@
 	cmdlgtst \
 	control \
 	expand \
+	mono-winelib \
 	notepad \
 	progman \
 	regedit \
@@ -41,6 +42,7 @@
 	clock \
 	control \
 	expand \
+	mono-winelib \
 	notepad \
 	progman \
 	regedit \
@@ -179,6 +181,9 @@
 icinfo.exe$(DLLEXT): avitools/icinfo.exe$(DLLEXT)
 	$(RM) $@ &amp;&amp; $(LN_S) avitools/icinfo.exe$(DLLEXT) $@
 
+mono-winelib.exe$(DLLEXT): mono-winelib/mono-winelib.exe$(DLLEXT)
+	$(RM) $@ &amp;&amp; $(LN_S) mono-winelib/mono-winelib.exe$(DLLEXT) $@
+
 notepad.exe$(DLLEXT): notepad/notepad.exe$(DLLEXT)
 	$(RM) $@ &amp;&amp; $(LN_S) notepad/notepad.exe$(DLLEXT) $@
 
@@ -255,6 +260,7 @@
 control/control.exe$(DLLEXT): control
 expand/expand.exe$(DLLEXT): expand
 avitools/icinfo.exe$(DLLEXT): avitools
+mono-winelib/mono-winelib.exe$(DLLEXT): mono-winelib
 notepad/notepad.exe$(DLLEXT): notepad
 progman/progman.exe$(DLLEXT): progman
 regedit/regedit.exe$(DLLEXT): regedit
diff -ruN wine-20040121/programs/mono-winelib/Makefile.in wine-20040121-mono/programs/mono-winelib/Makefile.in
--- wine-20040121/programs/mono-winelib/Makefile.in	1969-12-31 17:00:00.000000000 -0700
+++ wine-20040121-mono/programs/mono-winelib/Makefile.in	2004-02-12 14:36:36.000000000 -0700
@@ -0,0 +1,26 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = mono-winelib.exe
+APPMODE   = gui
+IMPORTS   = kernel32
+DELAYIMPORTS = user32
+EXTRAINCL = 
+EXTRADEFS =
+
+C_SRCS = \
+	mono-winelib.c \
+	../../loader/pthread.c
+
+RC_SRCS =
+RC_BINSRC =
+RC_BINARIES =
+
+PLTESTS =
+
+EXTRASUBDIRS =
+
+@MAKE_PROG_RULES@
+
+### Dependencies:
diff -ruN wine-20040121/programs/mono-winelib/mono-winelib.c wine-20040121-mono/programs/mono-winelib/mono-winelib.c
--- wine-20040121/programs/mono-winelib/mono-winelib.c	1969-12-31 17:00:00.000000000 -0700
+++ wine-20040121-mono/programs/mono-winelib/mono-winelib.c	2004-02-13 14:52:52.000000000 -0700
@@ -0,0 +1,86 @@
+/*
+ * mono-winelib code
+ *
+ * Copyright 2004 Novell, Inc. (<a class="moz-txt-link-freetext" href="http://www.novell.com/">http://www.novell.com/</a>)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include &lt;wine/library.h&gt;
+#include &lt;windows.h&gt;
+#include &lt;winsock.h&gt;
+#include &lt;dlfcn.h&gt;
+
+/*
+	Dummy WinMain. Wine is modified so that this function is never actually called
+*/
+
+int WINAPI
+WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
+{
+	int	dummy;
+
+   dummy=GetSystemMetrics(SM_CXSCREEN);
+	wine_pthread_init_process(NULL);
+
+   return(0);
+}
+
+/*
+	WineLoadLibrary is used by System.Windows.Forms to import the Wine dlls
+*/
+void	*(*NTDLL_LoadLibraryA)(unsigned char *);
+
+void *
+WineLoadLibrary(unsigned char *dll)
+{
+   return(NTDLL_LoadLibraryA(dll));
+}
+
+
+/*
+	MonoWineInit()	Must be called to initialize wine. We pass special arguments
+						which will tell wine to not actually run the specified 
+						application
+*/
+
+int
+MonoWineInit(void)
+{
+	unsigned char	Error[1024]="";
+	char				*WineArguments[] = {"monoapp", "/usr/local/lib/wine/mono-winelib.exe.so", NULL};
+	void				*hModule;
+	int				FileExists;
+
+	wine_init(2, WineArguments, Error, sizeof(Error));
+	if (Error[0]!='\0') {
+		printf("Wine initialization error:%s\n", Error);
+		exit(-1);
+	}
+
+   /* Now load kernel32 go get the pointers for LoadLibraryA and GetProcAddress */
+   hModule=wine_dll_load("kernel32.dll", Error, sizeof(Error), &amp;FileExists);
+   if (hModule==NULL) {
+      printf("Error loading kernel32.dll: %s\n", Error);
+      exit(-2);
+   }
+
+   NTDLL_LoadLibraryA=dlsym(hModule, "LoadLibraryA");
+   if (NTDLL_LoadLibraryA==NULL) {
+      printf("Did not find symbol LoadLibraryA in kernel32.dll\n");
+      exit(-3);
+   }
+}
  </pre>
  <pre wrap="">
<hr width="90%" size="4">
System.Windows.Forms wine-patch README

After applying the patch to wine, run ./configure in the wine directory and 
'make &amp;&amp; make depend &amp;&amp; make install'.
For now the patch assumes that the prefix_dir is /usr/local.

Also, once the install is done you will need to create symbolic links for
all the dlls you plan on using in System.Windows.Forms:
ln -s /usr/local/lib/wine/kernel32.dll.so /usr/local/lib/libkernel32.dll.so
ln -s /usr/local/lib/wine/user32.dll.so /usr/local/lib/libuser32.dll.so
ln -s /usr/local/lib/wine/gdi32.dll.so /usr/local/lib/libgdi32.dll.so
ln -s /usr/local/lib/wine/advapi32.dll.so /usr/local/lib/libgdi32.dll.so

I still need to work out how to teach mono to load the libs from the wine 
directory and without the lib prefix.

Peter
<a class="moz-txt-link-abbreviated" href="mailto:pbartok@novell.com">pbartok@novell.com</a>
  </pre>
  <pre wrap="">
<hr width="90%" size="4">
--- mcs-0.29/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs	2003-11-12 03:16:24.000000000 -0700
+++ mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs	2004-02-12 16:47:29.000000000 -0700
@@ -1288,12 +1288,8 @@
 			return 0;
 		}
 
-
-		[DllImport ("libwinnt.dll.so", EntryPoint="PROCESS_InitWine")]
-		extern static void PROCESS_InitWine (int argc, string [] args);
-
-		[DllImport ("libwinnt.dll.so", EntryPoint="LoadLibraryA")]
-		extern static void NTDLL_LoadLibraryA (string s);
+		[DllImport ("/usr/local/lib/wine/mono-winelib.exe.so", EntryPoint="WineLoadLibrary")]
+		extern static void WineLoadLibrary(string s);
 
 		static string[] WinColors = 	{
 									"COLOR_SCROLLBAR",
@@ -1389,14 +1385,12 @@
 				Console.WriteLine ("MonoWin32: Needs Wine MonoStub");				
 				return;
 			}
-				
-			string [] args = new string [1];
-			args [0] = "mono";
-
-			PROCESS_InitWine (0, args);
-			NTDLL_LoadLibraryA ("kernel32.dll");
-			NTDLL_LoadLibraryA ("user32.dll");
-			NTDLL_LoadLibraryA ("comctl32.dll");
+			Console.WriteLine("Loading Wine dlls");
+			WineLoadLibrary("gdi32.dll");
+			WineLoadLibrary("kernel32.dll");
+			WineLoadLibrary("comctl32.dll");
+			WineLoadLibrary("user32.dll");
+			Console.WriteLine("Loading Wine dlls complete");
 
 			string gtk_colors = Environment.GetEnvironmentVariable ("SWF_GTK_COLORS");
 			if (gtk_colors == "1") {
--- mcs-0.29/class/System.Windows.Forms/System.Windows.Forms/Form.cs	2003-11-14 21:25:32.000000000 -0700
+++ mcs/class/System.Windows.Forms/System.Windows.Forms/Form.cs	2004-02-13 11:59:08.000000000 -0700
@@ -105,8 +105,13 @@
 				cancelButton = null;
 			}
     		
-			static Form () {
+		  // Initialization for Wine
+			[DllImport ("/usr/local/lib/wine/mono-winelib.exe.so", EntryPoint="MonoWineInit")]
+			extern static int MonoWineInit();
 
+			static Form () {
+            Console.WriteLine("Initializing wine\n");
+            MonoWineInit();
 			}
     		
 			//  --- Public Properties
  </pre>
</blockquote>
<br>
</body>
</html>

--------------030200040303080907010207--