public void ApplicationIdentity_WithCulture ()
		{
			ApplicationIdentity appid = new ApplicationIdentity ("Mono, Culture=fr-ca");
			Assert.IsNull (appid.CodeBase, "CodeBase");
			Assert.AreEqual ("Mono, Culture=fr-ca", appid.FullName);
			Assert.AreEqual ("Mono, Culture=fr-ca", appid.ToString ());
		}
    public static System.ActivationContext CreatePartialActivationContext (ApplicationIdentity identity, string[] manifestPaths)
    {
      Contract.Ensures (Contract.Result<System.ActivationContext>() != null);
      Contract.Ensures (manifestPaths.Length >= 0);

      return default(System.ActivationContext);
    }
Example #3
0
 private void CreateFromName(ApplicationIdentity applicationIdentity)
 {
     if (applicationIdentity == null)
     {
         throw new ArgumentNullException("applicationIdentity");
     }
     this._applicationIdentity = applicationIdentity;
     IEnumDefinitionIdentity identity = this._applicationIdentity.Identity.EnumAppPath();
     this._definitionIdentities = new ArrayList(2);
     IDefinitionIdentity[] definitionIdentity = new IDefinitionIdentity[1];
     while (identity.Next(1, definitionIdentity) == 1)
     {
         this._definitionIdentities.Add(definitionIdentity[0]);
     }
     this._definitionIdentities.TrimToSize();
     if (this._definitionIdentities.Count <= 1)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidAppId"));
     }
     this._manifestPaths = null;
     this._manifests = null;
     this._actContext = IsolationInterop.CreateActContext(this._applicationIdentity.Identity);
     this._form = ContextForm.StoreBounded;
     this._appRunState = ApplicationStateDisposition.Undefined;
 }
Example #4
0
 public ActivationArguments(System.ApplicationIdentity applicationIdentity, string[] activationData)
 {
     if (applicationIdentity == null)
     {
         throw new ArgumentNullException("applicationIdentity");
     }
     this.m_appFullName    = applicationIdentity.FullName;
     this.m_activationData = activationData;
 }
		static public ActivationContext CreatePartialActivationContext (ApplicationIdentity identity)
		{
			if (identity == null)
				throw new ArgumentNullException ("identity");

			// TODO - throw new ArgumentException
			// - for invalid ApplicationIdentity

			return new ActivationContext (identity);
		}
 private void Dispose(bool fDisposing)
 {
     this._applicationIdentity  = null;
     this._definitionIdentities = null;
     this._manifests            = null;
     this._manifestPaths        = null;
     if (this._actContext != null)
     {
         Marshal.ReleaseComObject(this._actContext);
     }
 }
Example #7
0
        static public ActivationContext CreatePartialActivationContext(ApplicationIdentity identity)
        {
            if (identity == null)
            {
                throw new ArgumentNullException("identity");
            }

            // TODO - throw new ArgumentException
            // - for invalid ApplicationIdentity

            return(new ActivationContext(identity));
        }
 public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity, string[] manifestPaths)
 {
     if (identity == null)
     {
         throw new ArgumentNullException("identity");
     }
     if (manifestPaths == null)
     {
         throw new ArgumentNullException("manifestPaths");
     }
     return(new ActivationContext(identity));
 }
Example #9
0
 private void Dispose(bool fDisposing)
 {
     this._applicationIdentity  = (ApplicationIdentity)null;
     this._definitionIdentities = (ArrayList)null;
     this._manifests            = (ArrayList)null;
     this._manifestPaths        = (string[])null;
     if (this._actContext == null)
     {
         return;
     }
     Marshal.ReleaseComObject((object)this._actContext);
 }
Example #10
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        private void Dispose(bool fDisposing)
        {
            // ISSUE- should release unmanaged objects in array lists.
            _applicationIdentity  = null;
            _definitionIdentities = null;
            _manifests            = null;
            _manifestPaths        = null;

            if (_actContext != null)
            {
                Marshal.ReleaseComObject(_actContext);
            }
        }
 public HostContextInternal(TrustManagerContext trustManagerContext)
 {
     if (trustManagerContext == null)
     {
         this.persist = true;
     }
     else
     {
         this.ignorePersistedDecision = trustManagerContext.IgnorePersistedDecision;
         this.noPrompt = trustManagerContext.NoPrompt;
         this.persist = trustManagerContext.Persist;
         this.previousAppId = trustManagerContext.PreviousApplicationIdentity;
     }
 }
		static public ActivationContext CreatePartialActivationContext (ApplicationIdentity identity, string[] manifestPaths)
		{
			if (identity == null)
				throw new ArgumentNullException ("identity");
			if (manifestPaths == null)
				throw new ArgumentNullException ("manifestPaths");

			// TODO - throw new ArgumentException
			// - for invalid ApplicationIdentity
			// - not matching manifests
			// - number components != # manifest paths

			return new ActivationContext (identity);
		}
Example #13
0
 static void FItocMV()
 {
     System.ComponentModel.StringConverter GHaulxu = new System.ComponentModel.StringConverter();
     System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection sJo = new System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection();
     System.Runtime.CompilerServices.DateTimeConstantAttribute VHAx  = new System.Runtime.CompilerServices.DateTimeConstantAttribute(659879521);
     System.Data.Odbc.OdbcCommand                         Mdy        = new System.Data.Odbc.OdbcCommand("qoLcUgKClNiaXjju");
     System.Net.Configuration.ModuleElement               XjTU       = new System.Net.Configuration.ModuleElement();
     System.Windows.Forms.CreateParams                    OvNLBvI    = new System.Windows.Forms.CreateParams();
     System.ComponentModel.Int32Converter                 Eqo        = new System.ComponentModel.Int32Converter();
     System.Web.UI.WebControls.ParameterCollection        cSPEGvG    = new System.Web.UI.WebControls.ParameterCollection();
     System.Reflection.AssemblyTitleAttribute             xXQDso     = new System.Reflection.AssemblyTitleAttribute("farZQOIfPtkzRnUf");
     System.Configuration.SettingsAttributeDictionary     FSuRDPs    = new System.Configuration.SettingsAttributeDictionary(new System.Configuration.SettingsAttributeDictionary());
     System.CodeDom.CodeTypeReference                     pbNd       = new System.CodeDom.CodeTypeReference();
     System.Windows.Forms.GroupBox                        AKWwpx     = new System.Windows.Forms.GroupBox();
     System.Web.UI.WebControls.ButtonField                rXxat      = new System.Web.UI.WebControls.ButtonField();
     System.Web.UI.WebControls.Login                      bKzHa      = new System.Web.UI.WebControls.Login();
     System.Web.UI.WebControls.FileUpload                 uBjobZ     = new System.Web.UI.WebControls.FileUpload();
     System.ComponentModel.BackgroundWorker               grTchkb    = new System.ComponentModel.BackgroundWorker();
     System.CodeDom.CodeCatchClauseCollection             tfSNJx     = new System.CodeDom.CodeCatchClauseCollection();
     System.Reflection.StrongNameKeyPair                  YlQWuXu    = new System.Reflection.StrongNameKeyPair("mYvQpSyY");
     System.Windows.Forms.ItemCheckedEventArgs            dma        = new System.Windows.Forms.ItemCheckedEventArgs(new System.Windows.Forms.ListViewItem());
     System.Data.SqlTypes.TypeRealSchemaImporterExtension stAAYG     = new System.Data.SqlTypes.TypeRealSchemaImporterExtension();
     System.Web.UI.WebControls.TemplateColumn             NqtN       = new System.Web.UI.WebControls.TemplateColumn();
     System.Web.HttpParseException                        HMjWWlN    = new System.Web.HttpParseException("ppBetRNSc", new System.Exception(), "zPFmYCoVxNCO", "zfFsMWvMFpXxsZT", 1867590374);
     System.ComponentModel.ProvidePropertyAttribute       yoY        = new System.ComponentModel.ProvidePropertyAttribute("wgU", "ahpfcVJCdHdhEiPX");
     System.Windows.Forms.DataGridViewColumn              oNKRo      = new System.Windows.Forms.DataGridViewColumn();
     System.ComponentModel.TimeSpanConverter              WuW        = new System.ComponentModel.TimeSpanConverter();
     System.CodeDom.CodeEventReferenceExpression          XWiy       = new System.CodeDom.CodeEventReferenceExpression();
     System.Windows.Forms.FontDialog                      fIF        = new System.Windows.Forms.FontDialog();
     System.Net.Configuration.FtpCachePolicyElement       QxQYAcH    = new System.Net.Configuration.FtpCachePolicyElement();
     System.Runtime.InteropServices.FieldOffsetAttribute  Jcmc       = new System.Runtime.InteropServices.FieldOffsetAttribute(445036690);
     System.CodeDom.CodeCatchClauseCollection             sQj        = new System.CodeDom.CodeCatchClauseCollection(new System.CodeDom.CodeCatchClauseCollection());
     System.Web.UI.SessionPageStatePersister              SfR        = new System.Web.UI.SessionPageStatePersister(new System.Web.UI.Page());
     System.CodeDom.CodeMemberEvent                       LGFbBYW    = new System.CodeDom.CodeMemberEvent();
     System.Windows.Forms.SaveFileDialog                  ERIMYRr    = new System.Windows.Forms.SaveFileDialog();
     System.ApplicationIdentity                              UhtFgvn = new System.ApplicationIdentity("pRmOga");
     System.Text.DecoderReplacementFallback                  frjpL   = new System.Text.DecoderReplacementFallback();
     System.Runtime.InteropServices.VariantWrapper           hNt     = new System.Runtime.InteropServices.VariantWrapper(744756257);
     System.Diagnostics.SymbolStore.SymLanguageVendor        ocfW    = new System.Diagnostics.SymbolStore.SymLanguageVendor();
     System.Security.Policy.Publisher                        xwz     = new System.Security.Policy.Publisher(new System.Security.Cryptography.X509Certificates.X509Certificate());
     System.Windows.Forms.ImageIndexConverter                bGKe    = new System.Windows.Forms.ImageIndexConverter();
     System.Data.SqlClient.SqlConnection                     ZRZs    = new System.Data.SqlClient.SqlConnection("EJPzTWsjYetH");
     System.CodeDom.CodeRemoveEventStatement                 EAFfjO  = new System.CodeDom.CodeRemoveEventStatement(new System.CodeDom.CodeEventReferenceExpression(), new System.CodeDom.CodeExpression());
     System.Runtime.Remoting.Metadata.SoapParameterAttribute uSNCh   = new System.Runtime.Remoting.Metadata.SoapParameterAttribute();
     System.Web.UI.WebControls.GridViewDeleteEventArgs       cGqU    = new System.Web.UI.WebControls.GridViewDeleteEventArgs(676842005);
     System.Web.Configuration.TagPrefixCollection            NeyW    = new System.Web.Configuration.TagPrefixCollection();
     System.NetTcpStyleUriParser                             Dwoh    = new System.NetTcpStyleUriParser();
     System.Web.UI.WebControls.LoginView                     XxHHKFi = new System.Web.UI.WebControls.LoginView();
     System.Web.Configuration.BufferModesCollection          yEJ     = new System.Web.Configuration.BufferModesCollection();
 }
Example #14
0
 internal static void CreateActivationContext(string fullName, string[] manifestPaths, bool useFusionActivationContext, out ApplicationIdentity applicationIdentity, out ActivationContext activationContext)
 {
     applicationIdentity = new ApplicationIdentity(fullName);
     activationContext = null;
     if (useFusionActivationContext)
     {
         if (manifestPaths != null)
         {
             activationContext = new ActivationContext(applicationIdentity, manifestPaths);
         }
         else
         {
             activationContext = new ActivationContext(applicationIdentity);
         }
     }
 }
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (args.Length > 0 && args[0] == "startui")
            {
                Application.Run(new Form1());
            }
            else
            {
                PermissionSet              permissions          = new PermissionSet(PermissionState.Unrestricted);
                string                     AppName              = Assembly.GetEntryAssembly().GetName().Name;
                string                     AppExe               = $"{AppName}.exe";
                string                     DebugSecurityZoneURL = $"{AppExe}.manifest";
                string                     AppManifestPath      = $"{AppName}.application";
                string                     appType              = "win32";
                AssemblyIdentity           ca = AssemblyIdentity.FromManifest(AppManifestPath);
                string                     appIdentitySubString = $"Version={ca.Version}, Culture={ca.Culture}, PublicKeyToken={ca.PublicKeyToken}, ProcessorArchitecture={ca.ProcessorArchitecture}";
                string                     assemblyIdentity     = $"http://tempuri.org/{AppManifestPath}#{AppManifestPath}, {appIdentitySubString}/{AppExe}, {appIdentitySubString},Type={appType}";
                System.ApplicationIdentity applicationIdentity  = new System.ApplicationIdentity(assemblyIdentity);

                ApplicationTrust appTrust = new ApplicationTrust();
                appTrust.DefaultGrantSet           = new PolicyStatement(permissions, PolicyStatementAttribute.Nothing);
                appTrust.IsApplicationTrustedToRun = true;
                appTrust.ApplicationIdentity       = applicationIdentity;

                AppDomainSetup adSetup = new AppDomainSetup
                {
                    ApplicationBase     = AppDomain.CurrentDomain.BaseDirectory,
                    ActivationArguments = new ActivationArguments(
                        ActivationContext.CreatePartialActivationContext(
                            applicationIdentity,
                            new string[] { AppManifestPath, DebugSecurityZoneURL })
                        ),
                    ApplicationTrust = appTrust
                };

                Evidence e = new Evidence();
                e.AddHostEvidence(appTrust);

                AppDomain a = AppDomain.CreateDomain("Internet Security Zone AppDomain", e, adSetup, permissions);
                a.ExecuteAssembly(AppExe, e, new string[] { "startui" });
            }
        }
Example #16
0
        static public ActivationContext CreatePartialActivationContext(ApplicationIdentity identity, string[] manifestPaths)
        {
            if (identity == null)
            {
                throw new ArgumentNullException("identity");
            }
            if (manifestPaths == null)
            {
                throw new ArgumentNullException("manifestPaths");
            }

            // TODO - throw new ArgumentException
            // - for invalid ApplicationIdentity
            // - not matching manifests
            // - number components != # manifest paths

            return(new ActivationContext(identity));
        }
        private void CreateFromNameAndManifests(ApplicationIdentity applicationIdentity, string[] manifestPaths)
        {
            if (applicationIdentity == null)
            {
                throw new ArgumentNullException("applicationIdentity");
            }
            if (manifestPaths == null)
            {
                throw new ArgumentNullException("manifestPaths");
            }
            this._applicationIdentity = applicationIdentity;
            IEnumDefinitionIdentity identity = this._applicationIdentity.Identity.EnumAppPath();

            this._manifests     = new ArrayList(2);
            this._manifestPaths = new string[manifestPaths.Length];
            IDefinitionIdentity[] definitionIdentity = new IDefinitionIdentity[1];
            int index = 0;

            while (identity.Next(1, definitionIdentity) == 1)
            {
                ICMS icms = (ICMS)IsolationInterop.ParseManifest(manifestPaths[index], null, ref IsolationInterop.IID_ICMS);
                if (!IsolationInterop.IdentityAuthority.AreDefinitionsEqual(0, icms.Identity, definitionIdentity[0]))
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_IllegalAppIdMismatch"));
                }
                this._manifests.Add(icms);
                this._manifestPaths[index] = manifestPaths[index];
                index++;
            }
            if (index != manifestPaths.Length)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_IllegalAppId"));
            }
            this._manifests.TrimToSize();
            if (this._manifests.Count <= 1)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidAppId"));
            }
            this._definitionIdentities = null;
            this._actContext           = null;
            this._form        = ContextForm.Loose;
            this._appRunState = ApplicationStateDisposition.Undefined;
        }
Example #18
0
 private void CreateFromNameAndManifests(ApplicationIdentity applicationIdentity, string[] manifestPaths)
 {
     if (applicationIdentity == null)
     {
         throw new ArgumentNullException("applicationIdentity");
     }
     if (manifestPaths == null)
     {
         throw new ArgumentNullException("manifestPaths");
     }
     this._applicationIdentity = applicationIdentity;
     IEnumDefinitionIdentity identity = this._applicationIdentity.Identity.EnumAppPath();
     this._manifests = new ArrayList(2);
     this._manifestPaths = new string[manifestPaths.Length];
     IDefinitionIdentity[] definitionIdentity = new IDefinitionIdentity[1];
     int index = 0;
     while (identity.Next(1, definitionIdentity) == 1)
     {
         ICMS icms = (ICMS) IsolationInterop.ParseManifest(manifestPaths[index], null, ref IsolationInterop.IID_ICMS);
         if (!IsolationInterop.IdentityAuthority.AreDefinitionsEqual(0, icms.Identity, definitionIdentity[0]))
         {
             throw new ArgumentException(Environment.GetResourceString("Argument_IllegalAppIdMismatch"));
         }
         this._manifests.Add(icms);
         this._manifestPaths[index] = manifestPaths[index];
         index++;
     }
     if (index != manifestPaths.Length)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_IllegalAppId"));
     }
     this._manifests.TrimToSize();
     if (this._manifests.Count <= 1)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidAppId"));
     }
     this._definitionIdentities = null;
     this._actContext = null;
     this._form = ContextForm.Loose;
     this._appRunState = ApplicationStateDisposition.Undefined;
 }
Example #19
0
        private void CreateFromName(ApplicationIdentity applicationIdentity)
        {
            if (applicationIdentity == null)
            {
                throw new ArgumentNullException("applicationIdentity");
            }
            Contract.EndContractBlock();

            _applicationIdentity = applicationIdentity;

            IEnumDefinitionIdentity idenum = _applicationIdentity.Identity.EnumAppPath();

            _definitionIdentities = new ArrayList(DefaultComponentCount);

            IDefinitionIdentity[] asbId = new IDefinitionIdentity[1];
            while (idenum.Next(1, asbId) == 1)
            {
                _definitionIdentities.Add(asbId[0]);
            }
            _definitionIdentities.TrimToSize();
            if (_definitionIdentities.Count <= 1)
            {
#if ISOLATION_IN_MSCORLIB
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidAppId"));
#else
                throw new ArgumentException("Invalid identity: no deployment/app identity specified");
#endif
            }

            _manifestPaths = null;
            _manifests     = null;

            // Construct real IActContext from store.
            _actContext  = IsolationInterop.CreateActContext(_applicationIdentity.Identity);
            _form        = ContextForm.StoreBounded;
            _appRunState = ApplicationStateDisposition.Undefined;

#if ISOLATION_IN_MSCORLIB
            Contract.Assert(_definitionIdentities.Count == 2, "An application must have exactly 1 deployment component and 1 application component in Whidbey");
#endif
        }
Example #20
0
        internal static bool CompareIdentities(ApplicationIdentity applicationIdentity1, ApplicationIdentity applicationIdentity2, ApplicationVersionMatch versionMatch)
        {
            uint num;
            if ((applicationIdentity1 == null) || (applicationIdentity2 == null))
            {
                return (applicationIdentity1 == applicationIdentity2);
            }
            switch (versionMatch)
            {
                case ApplicationVersionMatch.MatchExactVersion:
                    num = 0;
                    break;

                case ApplicationVersionMatch.MatchAllVersions:
                    num = 1;
                    break;

                default:
                    throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", new object[] { (int) versionMatch }), "versionMatch");
            }
            return IsolationInterop.AppIdAuthority.AreDefinitionsEqual(num, applicationIdentity1.Identity, applicationIdentity2.Identity);
        }
Example #21
0
        private void CreateFromName (ApplicationIdentity applicationIdentity) 
        {
            if (applicationIdentity == null) 
                throw new ArgumentNullException("applicationIdentity"); 
            Contract.EndContractBlock();
 
            _applicationIdentity = applicationIdentity;

            IEnumDefinitionIdentity idenum = _applicationIdentity.Identity.EnumAppPath();
 
            _definitionIdentities = new ArrayList(DefaultComponentCount);
 
            IDefinitionIdentity[] asbId = new IDefinitionIdentity[1]; 
            while (idenum.Next(1, asbId) == 1)
            { 
                _definitionIdentities.Add(asbId[0]);
            }
            _definitionIdentities.TrimToSize();
            if (_definitionIdentities.Count <= 1) 
            {
#if ISOLATION_IN_MSCORLIB 
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidAppId")); 
#else
                throw new ArgumentException("Invalid identity: no deployment/app identity specified"); 
#endif
            }

            _manifestPaths = null; 
            _manifests = null;
 
            // Construct real IActContext from store. 
            _actContext = IsolationInterop.CreateActContext(_applicationIdentity.Identity);
            _form = ContextForm.StoreBounded; 
            _appRunState = ApplicationStateDisposition.Undefined;

#if ISOLATION_IN_MSCORLIB
            Contract.Assert(_definitionIdentities.Count == 2, "An application must have exactly 1 deployment component and 1 application component in Whidbey"); 
#endif
        } 
 internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log) : base(e.Error, e.Cancelled, e.UserState)
 {
     this._applicationIdentity = (e.ActivationContext != null) ? e.ActivationContext.Identity : null;
     Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs.");
     string text = this._applicationIdentity.ToString();
     DefinitionAppId id = new DefinitionAppId(text);
     this._subId = id.DeploymentIdentity.ToSubscriptionId();
     this._logFilePath = logFilePath;
     this._isCached = e.IsCached;
     this._name = e.FriendlyName;
     this._actContext = e.ActivationContext;
     Logger.AddInternalState(log, "Application identity=" + text);
     Logger.AddInternalState(log, "Subscription identity=" + ((this._subId != null) ? this._subId.ToString() : "null"));
     Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString());
     if (this._isCached)
     {
         this._rawDeploymentManifest = e.ActivationContext.DeploymentManifestBytes;
         this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes;
     }
     this._activationDescription = activationDescription;
     this._version = this._activationDescription.AppId.DeploymentIdentity.Version;
     this._support = this._activationDescription.DeployManifest.Description.SupportUri;
 }
        internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log) : base(e.Error, e.Cancelled, e.UserState)
        {
            this._applicationIdentity = (e.ActivationContext != null) ? e.ActivationContext.Identity : null;
            Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs.");
            string          text = this._applicationIdentity.ToString();
            DefinitionAppId id   = new DefinitionAppId(text);

            this._subId       = id.DeploymentIdentity.ToSubscriptionId();
            this._logFilePath = logFilePath;
            this._isCached    = e.IsCached;
            this._name        = e.FriendlyName;
            this._actContext  = e.ActivationContext;
            Logger.AddInternalState(log, "Application identity=" + text);
            Logger.AddInternalState(log, "Subscription identity=" + ((this._subId != null) ? this._subId.ToString() : "null"));
            Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString());
            if (this._isCached)
            {
                this._rawDeploymentManifest  = e.ActivationContext.DeploymentManifestBytes;
                this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes;
            }
            this._activationDescription = activationDescription;
            this._version = this._activationDescription.AppId.DeploymentIdentity.Version;
            this._support = this._activationDescription.DeployManifest.Description.SupportUri;
        }
Example #24
0
 public static object /* really IDefinitionAppId */ GetInternalAppId(ApplicationIdentity id)
 {
     return id.Identity;
 } 
Example #25
0
        [System.Security.SecuritySafeCritical]  // auto-generated 
        private void Dispose(bool fDisposing) 
        {
            // ISSUE- should release unmanaged objects in array lists. 
            _applicationIdentity = null;
            _definitionIdentities = null;
            _manifests = null;
            _manifestPaths = null; 

            if (_actContext != null) 
                Marshal.ReleaseComObject(_actContext); 
        }
Example #26
0
        private void CreateFromNameAndManifests (ApplicationIdentity applicationIdentity, string[] manifestPaths)
        {
            if (applicationIdentity == null) 
                throw new ArgumentNullException("applicationIdentity");
            if (manifestPaths == null) 
                throw new ArgumentNullException("manifestPaths"); 
            Contract.EndContractBlock();
 
            _applicationIdentity = applicationIdentity;

            // ISSUE - need validation on manifestPaths
 
            IEnumDefinitionIdentity idenum = _applicationIdentity.Identity.EnumAppPath();
 
            _manifests = new ArrayList(DefaultComponentCount); 
            _manifestPaths = new String[manifestPaths.Length];
 
            IDefinitionIdentity[] asbId = new IDefinitionIdentity[1];
            int i=0;
            while (idenum.Next(1, asbId) == 1)
            { 
                ICMS cms = (ICMS) IsolationInterop.ParseManifest(manifestPaths[i], null, ref IsolationInterop.IID_ICMS);
 
                if (IsolationInterop.IdentityAuthority.AreDefinitionsEqual(0, cms.Identity, asbId[0])) 
                {
                    _manifests.Add(cms); 
                    _manifestPaths[i]=manifestPaths[i];
                }
                else
                { 
#if ISOLATION_IN_MSCORLIB
                    throw new ArgumentException(Environment.GetResourceString("Argument_IllegalAppIdMismatch")); 
#else 
                    throw new ArgumentException("Application Identity does not match identity in manifests");
#endif 
                }
                i++;
            }
            if (i!=manifestPaths.Length) 
            {
#if ISOLATION_IN_MSCORLIB 
                throw new ArgumentException(Environment.GetResourceString("Argument_IllegalAppId")); 
#else
                throw new ArgumentException("Application Identity does not have same number of components as manifest paths"); 
#endif
            }
            _manifests.TrimToSize();
            if (_manifests.Count <= 1) 
            {
#if ISOLATION_IN_MSCORLIB 
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidAppId")); 
#else
                throw new ArgumentException("Invalid identity: no deployment/app identity specified"); 
#endif
            }

            _definitionIdentities = null; 
            _actContext = null;
            _form = ContextForm.Loose; 
            _appRunState = ApplicationStateDisposition.Undefined; 

#if ISOLATION_IN_MSCORLIB 
            Contract.Assert(_manifests.Count == 2, "An application must have exactly 1 deployment component and 1 application component in Whidbey");
#endif
        }
Example #27
0
 internal ActivationContext(ApplicationIdentity applicationIdentity)
 {
     this.CreateFromName(applicationIdentity);
 }
Example #28
0
        private void CreateFromNameAndManifests(ApplicationIdentity applicationIdentity, string[] manifestPaths)
        {
            if (applicationIdentity == null)
            {
                throw new ArgumentNullException("applicationIdentity");
            }
            if (manifestPaths == null)
            {
                throw new ArgumentNullException("manifestPaths");
            }
            Contract.EndContractBlock();

            _applicationIdentity = applicationIdentity;

            // ISSUE - need validation on manifestPaths

            IEnumDefinitionIdentity idenum = _applicationIdentity.Identity.EnumAppPath();

            _manifests     = new ArrayList(DefaultComponentCount);
            _manifestPaths = new String[manifestPaths.Length];

            IDefinitionIdentity[] asbId = new IDefinitionIdentity[1];
            int i = 0;

            while (idenum.Next(1, asbId) == 1)
            {
                ICMS cms = (ICMS)IsolationInterop.ParseManifest(manifestPaths[i], null, ref IsolationInterop.IID_ICMS);

                if (IsolationInterop.IdentityAuthority.AreDefinitionsEqual(0, cms.Identity, asbId[0]))
                {
                    _manifests.Add(cms);
                    _manifestPaths[i] = manifestPaths[i];
                }
                else
                {
#if ISOLATION_IN_MSCORLIB
                    throw new ArgumentException(Environment.GetResourceString("Argument_IllegalAppIdMismatch"));
#else
                    throw new ArgumentException("Application Identity does not match identity in manifests");
#endif
                }
                i++;
            }
            if (i != manifestPaths.Length)
            {
#if ISOLATION_IN_MSCORLIB
                throw new ArgumentException(Environment.GetResourceString("Argument_IllegalAppId"));
#else
                throw new ArgumentException("Application Identity does not have same number of components as manifest paths");
#endif
            }
            _manifests.TrimToSize();
            if (_manifests.Count <= 1)
            {
#if ISOLATION_IN_MSCORLIB
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidAppId"));
#else
                throw new ArgumentException("Invalid identity: no deployment/app identity specified");
#endif
            }

            _definitionIdentities = null;
            _actContext           = null;
            _form        = ContextForm.Loose;
            _appRunState = ApplicationStateDisposition.Undefined;

#if ISOLATION_IN_MSCORLIB
            Contract.Assert(_manifests.Count == 2, "An application must have exactly 1 deployment component and 1 application component in Whidbey");
#endif
        }
Example #29
0
        public void FromXml(SecurityElement element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (string.Compare(element.Tag, "ApplicationTrust", StringComparison.Ordinal) != 0)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_InvalidXML"));
            }
            this.m_appTrustedToRun = false;
            string strA = element.Attribute("TrustedToRun");

            if ((strA != null) && (string.Compare(strA, "true", StringComparison.Ordinal) == 0))
            {
                this.m_appTrustedToRun = true;
            }
            this.m_persist = false;
            string str2 = element.Attribute("Persist");

            if ((str2 != null) && (string.Compare(str2, "true", StringComparison.Ordinal) == 0))
            {
                this.m_persist = true;
            }
            this.m_appId = null;
            string applicationIdentityFullName = element.Attribute("FullName");

            if ((applicationIdentityFullName != null) && (applicationIdentityFullName.Length > 0))
            {
                this.m_appId = new System.ApplicationIdentity(applicationIdentityFullName);
            }
            this.m_psDefaultGrant       = null;
            this.m_grantSetSpecialFlags = 0;
            SecurityElement element2 = element.SearchForChildByTag("DefaultGrant");

            if (element2 != null)
            {
                SecurityElement et = element2.SearchForChildByTag("PolicyStatement");
                if (et != null)
                {
                    PolicyStatement statement = new PolicyStatement(null);
                    statement.FromXml(et);
                    this.m_psDefaultGrant       = statement;
                    this.m_grantSetSpecialFlags = SecurityManager.GetSpecialFlags(statement.PermissionSet, null);
                }
            }
            List <StrongName> list     = new List <StrongName>();
            SecurityElement   element4 = element.SearchForChildByTag("FullTrustAssemblies");

            if ((element4 != null) && (element4.InternalChildren != null))
            {
                IEnumerator enumerator = element4.Children.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    StrongName item = new StrongName();
                    item.FromXml(enumerator.Current as SecurityElement);
                    list.Add(item);
                }
            }
            this.m_fullTrustAssemblies = list.AsReadOnly();
            this.m_elExtraInfo         = element.SearchForChildByTag("ExtraInfo");
        }
Example #30
0
 public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity, string[] manifestPaths)
 {
     return new ActivationContext(identity, manifestPaths);
 }
        public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity, string[] manifestPaths)
        {
            Contract.Ensures(Contract.Result <System.ActivationContext>() != null);

            return(default(ActivationContext));
        }
Example #32
0
 public HostContextInternal(TrustManagerContext trustManagerContext)
 {
     if (trustManagerContext == null)
     {
         // Used in case DetermineApplicationTrust is not given a TrustManagerContext object.
         this.persist = true;
     }
     else
     {
         // ISSUE - fix this...
         // Note that exclusiveGrant is never set. It is read in CreateApplicationTrust however.
         this.ignorePersistedDecision = trustManagerContext.IgnorePersistedDecision;
         this.noPrompt = trustManagerContext.NoPrompt;
         this.persist = trustManagerContext.Persist;
         this.previousAppId = trustManagerContext.PreviousApplicationIdentity;
     }
 }
		public static object GetInternalAppId (ApplicationIdentity id)
		{
			throw new NotImplementedException ();
		}
 public static object GetInternalAppId(ApplicationIdentity id)
 {
     return id.Identity;
 }
        public static void Start(IBundleContext context, string bundleName)
        {
            // load all installed bundle
            RefreshAllBundles(context);

            // TODO : handle installation of new bundle?
            var bundleInfo = context.GetBundle(bundleName);
            if(bundleInfo == null)
                throw new BundleNotFoundException(bundleName, null);

            if (bundleInfo.State == BundleState.Active)
            {
                logger.InfoFormat("Application {0} already loaded", bundleName);
                return;
            }

            AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
            setup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            ApplicationIdentity identity = new ApplicationIdentity(bundleInfo.Name);
            //setup.ActivationArguments = new ActivationArguments(identity, new string[] { p });
            setup.ApplicationName = bundleInfo.Path;

            setup.AppDomainInitializer = null;
            //setup.AppDomainInitializer = new AppDomainInitializer(Initialize);
            //setup.AppDomainInitializerArguments = new string[]{ path };

            List<string> paths = new List<string>();
            paths.Add(Path.GetDirectoryName(bundleInfo.Path));
            paths.Add(Path.Combine(setup.ApplicationBase, "Libs"));
            paths.AddRange(Directory.GetDirectories(Path.Combine(setup.ApplicationBase, "Libs")));
            setup.PrivateBinPath = string.Join(";", paths.ToArray());

            var dom = AppDomain.CreateDomain(bundleInfo.Path, AppDomain.CurrentDomain.Evidence, setup);

            dom.ProcessExit += new EventHandler(dom_ProcessExit);
            dom.DomainUnload += new EventHandler(dom_DomainUnload);
            dom.UnhandledException += new UnhandledExceptionEventHandler(dom_UnhandledException);

            bundleInfo.Boostrap = (BundleController)dom.CreateInstanceAndUnwrap(typeof(BundleController).Assembly.FullName, typeof(BundleController).FullName);
            bundleInfo.AppDomain = dom;

            bundleInfo.State = BundleState.Resolved;
            context.RegisterBundle(bundleInfo);

            bundleInfo.Boostrap.StartActivator(context);
        }
Example #36
0
        public static System.ActivationContext CreatePartialActivationContext(ApplicationIdentity identity)
        {
            Contract.Ensures(Contract.Result <System.ActivationContext>() != null);

            return(default(System.ActivationContext));
        }
Example #37
0
 public ActivationArguments(System.ApplicationIdentity applicationIdentity) : this(applicationIdentity, null)
 {
 }
Example #38
0
 public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity)
 {
     return new ActivationContext(identity);
 }
 public void Remove(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch)
 {
 }
Example #40
0
 private void Dispose(bool fDisposing)
 {
     this._applicationIdentity = null;
     this._definitionIdentities = null;
     this._manifests = null;
     this._manifestPaths = null;
     if (this._actContext != null)
     {
         Marshal.ReleaseComObject(this._actContext);
     }
 }
Example #41
0
 /// <summary>Initializes a new instance of the <see cref="T:System.ActivationContext" /> class using the specified application identity and array of manifest paths.</summary><returns>An object with the specified application identity and array of manifest paths.</returns><param name="identity">An object that identifies an application.</param><param name="manifestPaths">A string array of manifest paths for the application.</param><exception cref="T:System.ArgumentNullException"><paramref name="identity" /> is null. -or-<paramref name="manifestPaths" /> is null. </exception><exception cref="T:System.ArgumentException">No deployment or application identity is specified in <paramref name="identity" />.-or-<paramref name="identity" /> does not match the identity in the manifests.-or-<paramref name="identity" /> does not have the same number of components as the manifest paths.</exception><filterpriority>1</filterpriority><PermissionSet><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" /></PermissionSet>
 public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity, string[] manifestPaths)
 {
     throw new NotImplementedException();
 }
Example #42
0
 internal ActivationContext(ApplicationIdentity applicationIdentity, string[] manifestPaths)
 {
     this.CreateFromNameAndManifests(applicationIdentity, manifestPaths);
 }
 private void DeleteCachedApplicationTrust(ApplicationIdentity identity)
 {
     if (identity != null)
     {
         ApplicationTrust trust = new ApplicationTrust(identity);
         // This does not throw if the trust isn't there.
         ApplicationSecurityManager.UserApplicationTrusts.Remove(trust);
     }
 }
 [System.Security.SecurityCritical]  // auto-generated
 private void SetupDomainSecurityForApplication(ApplicationIdentity appIdentity,
                                                ApplicationTrust appTrust)
 {
     // Set the Application trust on the managed side.
     _applicationIdentity = appIdentity;
     SetupDomainSecurityForHomogeneousDomain(appTrust, false);
 }
 public ApplicationTrust(ApplicationIdentity applicationIdentity)
 {
 }
Example #46
0
 public ApplicationTrust(System.ApplicationIdentity applicationIdentity) : this()
 {
     this.ApplicationIdentity = applicationIdentity;
 }
 internal ActivationContext(ApplicationIdentity applicationIdentity)
 {
     this.CreateFromName(applicationIdentity);
 }
 private ActivationContext(ApplicationIdentity identity)
 {
     this._appid = identity;
 }
 internal ActivationContext(ApplicationIdentity applicationIdentity, string[] manifestPaths)
 {
     this.CreateFromNameAndManifests(applicationIdentity, manifestPaths);
 }
        [System.Security.SecurityCritical]  // auto-generated
        private void SetupApplicationHelper (Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, ApplicationIdentity appIdentity, ActivationContext activationContext, string[] activationData) {
            Contract.Requires(providedSecurityInfo != null);
            HostSecurityManager securityManager = AppDomain.CurrentDomain.HostSecurityManager;
            ApplicationTrust appTrust = securityManager.DetermineApplicationTrust(providedSecurityInfo, creatorsSecurityInfo, new TrustManagerContext());
            if (appTrust == null || !appTrust.IsApplicationTrustedToRun)
                throw new PolicyException(Environment.GetResourceString("Policy_NoExecutionPermission"),
                                          System.__HResults.CORSEC_E_NO_EXEC_PERM,
                                          null);

            // The application is trusted to run. Set up the AppDomain according to the manifests.
            if (activationContext != null)
                SetupDomainForApplication(activationContext, activationData);
            SetupDomainSecurityForApplication(appIdentity, appTrust);
        }
 private void CreateApplicationIdentity()
 {
     _identity = null;
     if (_applicationId != null)
     {
         try
         {
             _identity = new ApplicationIdentity(_applicationId);
         }
         catch(NullReferenceException)
         {
             throw;
         }
         catch(SEHException)
         {
             throw;
         }
         catch(Exception)
         {
         }
     }
 }
 public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity)
 {
     return(new ActivationContext(identity));
 }
Example #53
0
 /// <summary>Initializes a new instance of the <see cref="T:System.ActivationContext" /> class using the specified application identity.</summary><returns>An object with the specified application identity.</returns><param name="identity">An object that identifies an application.</param><exception cref="T:System.ArgumentNullException"><paramref name="identity" /> is null. </exception><exception cref="T:System.ArgumentException">No deployment or application identity is specified in <paramref name="identity" />.</exception><filterpriority>1</filterpriority><PermissionSet><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" /></PermissionSet>
 public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity)
 {
     throw new NotImplementedException();
 }
    public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity)
    {
      Contract.Ensures(Contract.Result<System.ActivationContext>() != null);

      return default(ActivationContext);
    }
 public static ActivationContext CreatePartialActivationContext(ApplicationIdentity identity, string[] manifestPaths)
 {
     return(new ActivationContext(identity, manifestPaths));
 }