scripts
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Runtime.Hosting
|
||||
{
|
||||
/// <summary>Provides data for manifest-based activation of an application. This class cannot be inherited. </summary>
|
||||
// Token: 0x020002B9 RID: 697
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public sealed class ActivationArguments
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Hosting.ActivationArguments" /> class with the specified activation context. </summary>
|
||||
/// <param name="activationData">An <see cref="T:System.ActivationContext" /> object identifying the manifest-based activation application.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="activationData" /> is null.</exception>
|
||||
// Token: 0x06002104 RID: 8452 RVA: 0x00078D10 File Offset: 0x00076F10
|
||||
public ActivationArguments(ActivationContext activationData)
|
||||
{
|
||||
if (activationData == null)
|
||||
{
|
||||
throw new ArgumentNullException("activationData");
|
||||
}
|
||||
this._context = activationData;
|
||||
this._identity = activationData.Identity;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Hosting.ActivationArguments" /> class with the specified application identity.</summary>
|
||||
/// <param name="applicationIdentity">An <see cref="T:System.ApplicationIdentity" /> object identifying the manifest-based activation application.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="applicationIdentity" /> is null.</exception>
|
||||
// Token: 0x06002105 RID: 8453 RVA: 0x00078D48 File Offset: 0x00076F48
|
||||
public ActivationArguments(ApplicationIdentity applicationIdentity)
|
||||
{
|
||||
if (applicationIdentity == null)
|
||||
{
|
||||
throw new ArgumentNullException("applicationIdentity");
|
||||
}
|
||||
this._identity = applicationIdentity;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Hosting.ActivationArguments" /> class with the specified activation context and activation data.</summary>
|
||||
/// <param name="activationContext">An <see cref="T:System.ActivationContext" /> object identifying the manifest-based activation application.</param>
|
||||
/// <param name="activationData">An array of strings containing host-provided activation data.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="activationContext" /> is null.</exception>
|
||||
// Token: 0x06002106 RID: 8454 RVA: 0x00078D68 File Offset: 0x00076F68
|
||||
public ActivationArguments(ActivationContext activationContext, string[] activationData)
|
||||
{
|
||||
if (activationContext == null)
|
||||
{
|
||||
throw new ArgumentNullException("activationContext");
|
||||
}
|
||||
this._context = activationContext;
|
||||
this._identity = activationContext.Identity;
|
||||
this._data = activationData;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Hosting.ActivationArguments" /> class with the specified application identity and activation data.</summary>
|
||||
/// <param name="applicationIdentity">An <see cref="T:System.ApplicationIdentity" /> object identifying the manifest-based activation application.</param>
|
||||
/// <param name="activationData">An array of strings containing host-provided activation data.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="applicationIdentity" /> is null.</exception>
|
||||
// Token: 0x06002107 RID: 8455 RVA: 0x00078D9C File Offset: 0x00076F9C
|
||||
public ActivationArguments(ApplicationIdentity applicationIdentity, string[] activationData)
|
||||
{
|
||||
if (applicationIdentity == null)
|
||||
{
|
||||
throw new ArgumentNullException("applicationIdentity");
|
||||
}
|
||||
this._identity = applicationIdentity;
|
||||
this._data = activationData;
|
||||
}
|
||||
|
||||
/// <summary>Gets the activation context for manifest-based activation of an application.</summary>
|
||||
/// <returns>An <see cref="T:System.ActivationContext" /> object identifying a manifest-based activation application.</returns>
|
||||
// Token: 0x17000636 RID: 1590
|
||||
// (get) Token: 0x06002108 RID: 8456 RVA: 0x00078DC4 File Offset: 0x00076FC4
|
||||
public ActivationContext ActivationContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._context;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets activation data from the host.</summary>
|
||||
/// <returns>An array of strings containing host-provided activation data.</returns>
|
||||
// Token: 0x17000637 RID: 1591
|
||||
// (get) Token: 0x06002109 RID: 8457 RVA: 0x00078DCC File Offset: 0x00076FCC
|
||||
public string[] ActivationData
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the application identity for a manifest-activated application.</summary>
|
||||
/// <returns>An <see cref="T:System.ApplicationIdentity" /> object identifying an application for manifest-based activation.</returns>
|
||||
// Token: 0x17000638 RID: 1592
|
||||
// (get) Token: 0x0600210A RID: 8458 RVA: 0x00078DD4 File Offset: 0x00076FD4
|
||||
public ApplicationIdentity ApplicationIdentity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._identity;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000BE6 RID: 3046
|
||||
private ActivationContext _context;
|
||||
|
||||
// Token: 0x04000BE7 RID: 3047
|
||||
private ApplicationIdentity _identity;
|
||||
|
||||
// Token: 0x04000BE8 RID: 3048
|
||||
private string[] _data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Security;
|
||||
using System.Security.Policy;
|
||||
|
||||
namespace System.Runtime.Hosting
|
||||
{
|
||||
/// <summary>Provides the base class for the activation of manifest-based assemblies. </summary>
|
||||
// Token: 0x020002BA RID: 698
|
||||
[MonoTODO("missing manifest support")]
|
||||
[ComVisible(true)]
|
||||
public class ApplicationActivator
|
||||
{
|
||||
/// <summary>Creates an instance of the application to be activated, using the specified activation context. </summary>
|
||||
/// <returns>An <see cref="T:System.Runtime.Remoting.ObjectHandle" /> that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object. </returns>
|
||||
/// <param name="activationContext">An <see cref="T:System.ActivationContext" /> that identifies the application to activate.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="activationContext" /> is null. </exception>
|
||||
// Token: 0x0600210C RID: 8460 RVA: 0x00078DE4 File Offset: 0x00076FE4
|
||||
public virtual ObjectHandle CreateInstance(ActivationContext activationContext)
|
||||
{
|
||||
return this.CreateInstance(activationContext, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates an instance of the application to be activated, using the specified activation context and custom activation data. </summary>
|
||||
/// <returns>An <see cref="T:System.Runtime.Remoting.ObjectHandle" /> that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object.</returns>
|
||||
/// <param name="activationContext">An <see cref="T:System.ActivationContext" /> that identifies the application to activate.</param>
|
||||
/// <param name="activationCustomData">Custom activation data.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="activationContext" /> is null. </exception>
|
||||
// Token: 0x0600210D RID: 8461 RVA: 0x00078DF0 File Offset: 0x00076FF0
|
||||
public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData)
|
||||
{
|
||||
if (activationContext == null)
|
||||
{
|
||||
throw new ArgumentNullException("activationContext");
|
||||
}
|
||||
AppDomainSetup appDomainSetup = new AppDomainSetup(activationContext);
|
||||
return ApplicationActivator.CreateInstanceHelper(appDomainSetup);
|
||||
}
|
||||
|
||||
/// <summary>Creates an instance of an application using the specified <see cref="T:System.AppDomainSetup" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Runtime.Remoting.ObjectHandle" /> that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object. </returns>
|
||||
/// <param name="adSetup">An <see cref="T:System.AppDomainSetup" /> object whose <see cref="P:System.AppDomainSetup.ActivationArguments" /> property identifies the application to activate.</param>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.AppDomainSetup.ActivationArguments" /> property of <paramref name="adSetup " />is null. </exception>
|
||||
/// <exception cref="T:System.Security.Policy.PolicyException">The application instance failed to execute because the policy settings on the current application domain do not provide permission for this application to run.</exception>
|
||||
// Token: 0x0600210E RID: 8462 RVA: 0x00078E1C File Offset: 0x0007701C
|
||||
protected static ObjectHandle CreateInstanceHelper(AppDomainSetup adSetup)
|
||||
{
|
||||
if (adSetup == null)
|
||||
{
|
||||
throw new ArgumentNullException("adSetup");
|
||||
}
|
||||
if (adSetup.ActivationArguments == null)
|
||||
{
|
||||
string text = Locale.GetText("{0} is missing it's {1} property");
|
||||
throw new ArgumentException(string.Format(text, "AppDomainSetup", "ActivationArguments"), "adSetup");
|
||||
}
|
||||
HostSecurityManager hostSecurityManager;
|
||||
if (AppDomain.CurrentDomain.DomainManager != null)
|
||||
{
|
||||
hostSecurityManager = AppDomain.CurrentDomain.DomainManager.HostSecurityManager;
|
||||
}
|
||||
else
|
||||
{
|
||||
hostSecurityManager = new HostSecurityManager();
|
||||
}
|
||||
Evidence evidence = new Evidence();
|
||||
evidence.AddHost(adSetup.ActivationArguments);
|
||||
TrustManagerContext trustManagerContext = new TrustManagerContext();
|
||||
ApplicationTrust applicationTrust = hostSecurityManager.DetermineApplicationTrust(evidence, null, trustManagerContext);
|
||||
if (!applicationTrust.IsApplicationTrustedToRun)
|
||||
{
|
||||
string text2 = Locale.GetText("Current policy doesn't allow execution of addin.");
|
||||
throw new PolicyException(text2);
|
||||
}
|
||||
AppDomain appDomain = AppDomain.CreateDomain("friendlyName", null, adSetup);
|
||||
return appDomain.CreateInstance("assemblyName", "typeName", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user