[Mono-dev] [PATCH] CAS changes for System.Drawing.dll

Sebastien Pouliot sebastien at ximian.com
Fri Sep 9 10:39:10 EDT 2005


Oops, attachments were bigger than I expected (and refused by the list).
-------- Forwarded Message --------
From: Sebastien Pouliot <sebastien.pouliot at gmail.com>
Reply-To: sebastien.pouliot at gmail.com
To: mono-devel-list at lists.ximian.com
Subject: [PATCH] CAS changes for System.Drawing.dll
Date: Fri, 9 Sep 2005 10:25:50 -0400

Hello,

System.Drawing provides a (mostly) "safe" API, which means that you can
call it's methods without having the UnmanagedCode permission (even if
most of it's code is unmanaged). Currently this isn't the case on Mono,
i.e. if you activate the security manager (mono --security) then you
would need UnmanagedCode permission to run any code using
System.Drawing.

The first patch is on the class library.
a. It add the required security attributes to the classes (mostly some
LinkDemands for "unsafe" calls);
b. It add the [SuppressUnmanagedCodeSecurity] attribute to all p/invoke
calls so that UnmanagedCode isn't required to use System.Drawing.

The second patch is for the unit tests.
a. It denies UnmanagedCode permission before running the existing tests
- which works on MS implementation and also works on Mono with the
previous patch applied.
b. It add new tests for class/methods protected with LinkDemands (which
requires reflection to test properly).

Both patches shouldn't change the current behaviour when the security
manager isn't active (default).

-- 
Sebastien Pouliot
email: sebastien at ximian.com
blog: http://pages.infinit.net/ctech/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sd.20050909.tar.gz
Type: application/x-compressed-tar
Size: 7127 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050909/17549c82/attachment.bin 


More information about the Mono-devel-list mailing list