private unsafe static bool InheritanceDemand (AppDomain ad, Assembly a, RuntimeDeclSecurityActions *actions)
{
try {
PermissionSet ps = null;
bool result = true;
if (actions->cas.size > 0) {
ps = Decode (actions->cas.blob, actions->cas.size);
result = (SecurityManager.CheckPermissionSet (a, ps, false) == null);
if (result) {
// also check appdomain
result = (SecurityManager.CheckPermissionSet (ad, ps) == null);
}
}
if (actions->noncas.size > 0) {
ps = Decode (actions->noncas.blob, actions->noncas.size);
result = (SecurityManager.CheckPermissionSet (a, ps, true) == null);
if (result) {
// also check appdomain
result = (SecurityManager.CheckPermissionSet (ad, ps) == null);
}
}
return result;
}
catch (SecurityException) {
return false;
}
}