[Mono-winforms-list] Re: patches for Win32 API libraries
Miguel de Icaza
miguel@ximian.com
05 May 2003 21:17:38 -0400
Hello Vlad,
> On this URL http://host.kaluzh.info/win32api.tgz you will find the tarball
> with patches for Wine-20030318 (directory "wine").
> I have tested this patches on Linux and FreeBSD, on both platforms
> it's working nicely.
Thanks! This is wonderful work!
> Additionaly you will find there the directory "mono", where you will
> find the modified mono runtime in order to use new Win21 API
> libraries. I've called it "monogui".
> Miguel , could you please instruct me - may I commit this into mono
> cvs tree onto the right place myself or you will do this yourself?
> Now I've created separate runtime in order to do not bring the troubles
> for existing runtime.
> I think these two runtimes should be merged into one runtime and
> the new key should be used in order to set the runtime mode:
> gui or shell. What do you think ?
I have found a solution that does not require the creation of a
`monogui' wrapper. Basically, we define a static constructor for the
Win32 class. This constructor is invoked before any Wine routines are
invoked. I have attached a patch that shows this.
I am not commiting this work right away, because it would break things
for people who are actively developing with the current setup.
I think we could do something like:
if (RunningInMono && UsingTheWineLibrarySetup){
MyWorkaround ();
}
I will post in a separate message my comments on the wine changes.
Miguel.
----
Index: System.Windows.Forms/win32functions.cs
===================================================================
RCS file: /cvs/public/mcs/class/System.Windows.Forms/System.Windows.Forms/win32functions.cs,v
retrieving revision 1.22
diff -u -r1.22 win32functions.cs
--- System.Windows.Forms/win32functions.cs 26 Apr 2003 02:56:19 -0000 1.22
+++ System.Windows.Forms/win32functions.cs 6 May 2003 01:22:31 -0000
@@ -1089,5 +1089,25 @@
Win32.ReleaseDC ( hWnd, hDC );
return size;
}
+
+ [DllImport ("libntdll.dll.so", EntryPoint="PROCESS_InitWine")]
+ extern static void PROCESS_InitWine (int argc, string [] args);
+
+ [DllImport ("libntdll.dll.so", EntryPoint="LoadLibraryA")]
+ extern static void NTDLL_LoadLibraryA (string s);
+
+ //
+ // Used to initialize the runtime
+ //
+ static Win32 ()
+ {
+ string [] args = new string [1];
+ args [0] = "mono";
+
+ PROCESS_InitWine (0, args);
+ NTDLL_LoadLibraryA ("kernel32.dll");
+ NTDLL_LoadLibraryA ("user32.dll");
+ NTDLL_LoadLibraryA ("comctl32.dll");
+ }
}
}