Przeglądaj źródła

In .:
2007-05-29 Robert Jordan <[email protected]>

* data/config.in: add mono_win32_compat entries.

In mono/metadata:
2007-05-29 Robert Jordan <[email protected]>

* marshal.[c|h]: add mono_win32_compat_* wrappers. Fixes #81754.


svn path=/trunk/mono/; revision=78159

Robert Jordan 18 lat temu
rodzic
commit
217d5255f0
5 zmienionych plików z 65 dodań i 0 usunięć
  1. 4 0
      ChangeLog
  2. 6 0
      data/config.in
  3. 4 0
      mono/metadata/ChangeLog
  4. 39 0
      mono/metadata/marshal.c
  5. 12 0
      mono/metadata/marshal.h

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+2007-05-29  Robert Jordan  <[email protected]>
+
+	* data/config.in: add mono_win32_compat entries.
+
 2007-05-11  Raja R Harinath  <[email protected]>
 
 	* Makefile.am (get-monolite-latest): Redirect wget output too.

+ 6 - 0
data/config.in

@@ -15,4 +15,10 @@
 	<dllmap dll="sqlite3" target="@SQLITE3@" os="!windows"/>
 	<dllmap dll="libX11" target="@X11@" os="!windows" />
 	<dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
+	<dllmap dll="i:kernel32.dll">
+		<dllentry dll="__Internal" name="CopyMemory" target="mono_win32_compat_CopyMemory"/>
+		<dllentry dll="__Internal" name="FillMemory" target="mono_win32_compat_FillMemory"/>
+		<dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/>
+		<dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/>
+	</dllmap>
 </configuration>

+ 4 - 0
mono/metadata/ChangeLog

@@ -1,3 +1,7 @@
+2007-05-29  Robert Jordan  <[email protected]>
+
+	* marshal.[c|h]: add mono_win32_compat_* wrappers. Fixes #81754.
+
 2007-05-28  Zoltan Varga  <[email protected]>
 
 	* icall.c (ves_icall_get_method_info): Handle loader errors. Fixes #81724.

+ 39 - 0
mono/metadata/marshal.c

@@ -11239,6 +11239,45 @@ mono_marshal_get_generic_array_helper (MonoClass *class, MonoClass *iface, gchar
 	return res;
 }
 
+/*
+ * The mono_win32_compat_* functions are implementations of inline
+ * Windows kernel32 APIs, which are DllImport-able under MS.NET,
+ * although not exported by kernel32.
+ *
+ * We map the appropiate kernel32 entries to these functions using
+ * dllmaps declared in the global etc/mono/config.
+ */
+
+void
+mono_win32_compat_CopyMemory (gpointer dest, gconstpointer source, gsize length)
+{
+	if (!dest || !source)
+		return;
+
+	memcpy (dest, source, length);
+}
+
+void
+mono_win32_compat_FillMemory (gpointer dest, gsize length, guchar fill)
+{
+	memset (dest, fill, length);
+}
+
+void
+mono_win32_compat_MoveMemory (gpointer dest, gconstpointer source, gsize length)
+{
+	if (!dest || !source)
+		return;
+
+	memmove (dest, source, length);
+}
+
+void
+mono_win32_compat_ZeroMemory (gpointer dest, gsize length)
+{
+	memset (dest, 0, length);
+}
+
 /* Put COM Interop related stuff here */
 
 /**

+ 12 - 0
mono/metadata/marshal.h

@@ -432,6 +432,18 @@ ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropPr
 MonoComInteropProxy*
 ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk) MONO_INTERNAL;
 
+void
+mono_win32_compat_CopyMemory (gpointer dest, gconstpointer source, gsize length);
+
+void
+mono_win32_compat_FillMemory (gpointer dest, gsize length, guchar fill);
+
+void
+mono_win32_compat_MoveMemory (gpointer dest, gconstpointer source, gsize length);
+
+void
+mono_win32_compat_ZeroMemory (gpointer dest, gsize length);
+
 G_END_DECLS
 
 #endif /* __MONO_MARSHAL_H__ */