2004-12-21 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Tue, 21 Dec 2004 16:23:51 +0000 (16:23 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Tue, 21 Dec 2004 16:23:51 +0000 (16:23 -0000)
* icall.c: Added an internal call to retrieve the position and length
of assembly-level declarative security attributes (RequestMinimum,
RequestOptional and RequestRefuse). This is used by the Assembly class
to re-create the corresponding permission sets.

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

mono/metadata/ChangeLog
mono/metadata/icall.c

index 3ee3309e9947df13e240ceee60e10ec5e27ba833..e3290e9f7be4e7f4140f68061fc0c265d56e018f 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-21  Sebastien Pouliot  <sebastien@ximian.com> 
+
+       * icall.c: Added an internal call to retrieve the position and length
+       of assembly-level declarative security attributes (RequestMinimum, 
+       RequestOptional and RequestRefuse). This is used by the Assembly class
+       to re-create the corresponding permission sets.
 
 Tue Dec 21 14:50:31 CET 2004 Paolo Molaro <lupus@ximian.com>
 
index eb8db1fdb638f074b76a3f72e9f9c3d06057ab7e..b4a6af3143a801f092992e9bab4f5ec39af4df12 100644 (file)
@@ -3943,6 +3943,35 @@ ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoString *fname,
        mono_image_close (image);
 }
 
+static MonoBoolean
+ves_icall_System_Reflection_Assembly_LoadPermissions (MonoReflectionAssembly *assembly,
+       char **minimum, guint32 *minLength, char **optional, guint32 *optLength, char **refused, guint32 *refLength)
+{
+       MonoBoolean result = FALSE;
+       MonoDeclSecurityEntry entry;
+
+       /* SecurityAction.RequestMinimum */
+       if (mono_declsec_get_assembly_action (assembly->assembly, SECURITY_ACTION_REQMIN, &entry)) {
+               *minimum = entry.blob;
+               *minLength = entry.size;
+               result = TRUE;
+       }
+       /* SecurityAction.RequestOptional */
+       if (mono_declsec_get_assembly_action (assembly->assembly, SECURITY_ACTION_REQOPT, &entry)) {
+               *optional = entry.blob;
+               *optLength = entry.size;
+               result = TRUE;
+       }
+       /* SecurityAction.RequestRefuse */
+       if (mono_declsec_get_assembly_action (assembly->assembly, SECURITY_ACTION_REQREFUSE, &entry)) {
+               *refused = entry.blob;
+               *refLength = entry.size;
+               result = TRUE;
+       }
+
+       return result;  
+}
+
 static MonoArray*
 mono_module_get_types (MonoDomain *domain, MonoImage *image, 
                                           MonoBoolean exportedOnly)
@@ -5945,6 +5974,7 @@ static const IcallEntry assembly_icalls [] = {
        {"InternalGetType", ves_icall_System_Reflection_Assembly_InternalGetType},
        {"InternalImageRuntimeVersion", ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion},
        {"LoadFrom", ves_icall_System_Reflection_Assembly_LoadFrom},
+       {"LoadPermissions", ves_icall_System_Reflection_Assembly_LoadPermissions},
        /*
         * Private icalls for the Mono Debugger
         */