Просмотр исходного кода

2005-09-16 Sebastien Pouliot <[email protected]>

	* gdipFunctions.cs: Add [SuppressUnmanagedCodeSecurity] attributes so 
	the JIT won't add demands for UnmanagedCode.
	* carbonFunctions.cs: Add [SuppressUnmanagedCodeSecurity] attributes 
	so the JIT won't add demands for UnmanagedCode on Mac OSX.
	* Bitmap.cs: Added LinkDemand for UnmanagedCode on GetHbitmap 
	(+ overloads) and GetHicon methods.
	* Graphics.cs: Added LinkDemand for UnmanagedCode on FromHdcInternal, 
	FromHwndInternal and ReleaseHdcInternal methods (which are all public 
	despite their names).


svn path=/trunk/mcs/; revision=50150
Sebastien Pouliot 20 лет назад
Родитель
Сommit
aa341255d3

+ 5 - 2
mcs/class/System.Drawing/System.Drawing/Bitmap.cs

@@ -13,7 +13,7 @@
 //
 
 //
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -35,12 +35,12 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
 using System.Drawing.Imaging;
 using System.Runtime.Serialization;
 using System.Runtime.InteropServices;
 using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Drawing
 {
@@ -227,12 +227,14 @@ namespace System.Drawing
 		}
 
 		[EditorBrowsable (EditorBrowsableState.Advanced)]
+		[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
 		public IntPtr GetHbitmap ()
 		{
 			return GetHbitmap(Color.Gray);
 		}
 
 		[EditorBrowsable (EditorBrowsableState.Advanced)]
+		[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
 		public IntPtr GetHbitmap (Color background)
 		{
 			IntPtr HandleBmp;
@@ -244,6 +246,7 @@ namespace System.Drawing
 		}
 
 		[EditorBrowsable (EditorBrowsableState.Advanced)]
+		[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
 		public IntPtr GetHicon ()
 		{
 			IntPtr HandleIcon;

+ 12 - 0
mcs/class/System.Drawing/System.Drawing/ChangeLog

@@ -1,3 +1,15 @@
+2005-09-16  Sebastien Pouliot  <[email protected]>
+
+	* gdipFunctions.cs: Add [SuppressUnmanagedCodeSecurity] attributes so 
+	the JIT won't add demands for UnmanagedCode.
+	* carbonFunctions.cs: Add [SuppressUnmanagedCodeSecurity] attributes 
+	so the JIT won't add demands for UnmanagedCode on Mac OSX.
+	* Bitmap.cs: Added LinkDemand for UnmanagedCode on GetHbitmap 
+	(+ overloads) and GetHicon methods.
+	* Graphics.cs: Added LinkDemand for UnmanagedCode on FromHdcInternal, 
+	FromHwndInternal and ReleaseHdcInternal methods (which are all public 
+	despite their names).
+
 2005-09-15 Konstantin Triger <[email protected]>
 
 	* Graphics.jvm.cs: text transform, headless session

+ 6 - 2
mcs/class/System.Drawing/System.Drawing/Graphics.cs

@@ -8,7 +8,7 @@
 //
 // Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com)
 //
-// Copyright (C) 2004 Novell, Inc. (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc. (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -29,12 +29,13 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.Drawing.Text;
 using System.ComponentModel;
 using System.Runtime.InteropServices;
+using System.Security.Permissions;
 using System.Text;
 
 namespace System.Drawing
@@ -1238,6 +1239,7 @@ namespace System.Drawing
 		}
 
 		[EditorBrowsable (EditorBrowsableState.Advanced)]
+		[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
 		public static Graphics FromHdcInternal (IntPtr hdc)
 		{
 			GDIPlus.Display = hdc;
@@ -1279,6 +1281,7 @@ namespace System.Drawing
 		}
 		
 		[EditorBrowsable (EditorBrowsableState.Advanced)]
+		[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
 		public static Graphics FromHwndInternal (IntPtr hwnd)
 		{
 			return FromHwnd (hwnd);
@@ -1595,6 +1598,7 @@ namespace System.Drawing
 
 		[MonoTODO]
 		[EditorBrowsable (EditorBrowsableState.Advanced)]
+		[SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
 		public void ReleaseHdcInternal (IntPtr hdc)
 		{
 			throw new NotImplementedException ();

+ 3 - 0
mcs/class/System.Drawing/System.Drawing/carbonFunctions.cs

@@ -27,8 +27,11 @@
 //
 
 using System.Runtime.InteropServices;
+using System.Security;
 
 namespace System.Drawing {
+
+	[SuppressUnmanagedCodeSecurity]
 	internal class Carbon {
 
 		internal static CarbonContext GetCGContextForNSView (IntPtr hwnd) {

+ 2 - 0
mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs

@@ -36,6 +36,7 @@ using System.Text;
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.Drawing.Text;
+using System.Security;
 #if NET_2_0
 using System.Runtime.InteropServices.ComTypes;
 #else
@@ -47,6 +48,7 @@ namespace System.Drawing
 	/// <summary>
 	/// GDI+ API Functions
 	/// </summary>
+	[SuppressUnmanagedCodeSecurity]
 	internal class GDIPlus
 	{
 		public const int FACESIZE = 32;