Esempio n. 1
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;
 }
        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;
        }
Esempio n. 3
0
 public ApplicationContext(ReferenceAppId appid)
 {
     if (appid == null)
     {
         throw new ArgumentNullException();
     }
     this._appcontext = IsolationInterop.CreateActContext(appid._id);
 }
Esempio n. 4
0
 internal ApplicationContext(IActContext a)
 {
     if (a == null)
     {
         throw new ArgumentNullException();
     }
     this._appcontext = a;
 }
        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;
        }
Esempio n. 6
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
        }
Esempio n. 7
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;
 }
Esempio n. 8
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
        } 
Esempio n. 9
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
        }
 public ApplicationContext(ReferenceAppId appid)
 {
     if (appid == null)
         throw new ArgumentNullException();
     _appcontext = IsolationInterop.CreateActContext(appid._id);
 }
 internal ApplicationContext(IActContext a)
 {
     if (a == null)
         throw new ArgumentNullException();
     _appcontext = a;
 }
Esempio n. 12
0
 public void CommitApplication(ref SubscriptionState subState, CommitApplicationParams commitParams)
 {
     Logger.AddMethodCall("CommitApplication called.");
     using (this.AcquireSubscriptionWriterLock(subState))
     {
         if (commitParams.CommitDeploy)
         {
             Logger.AddInternalState("Commiting Deployment :  subscription metadata.");
             UriHelper.ValidateSupportedScheme(commitParams.DeploySourceUri);
             this.CheckDeploymentSubscriptionState(subState, commitParams.DeployManifest);
             this.ValidateFileAssoctiation(subState, commitParams);
             if (commitParams.IsUpdate && !commitParams.IsUpdateInPKTGroup)
             {
                 SubscriptionStore.CheckInstalled(subState);
             }
         }
         if (commitParams.CommitApp)
         {
             Logger.AddInternalState("Commiting Application:  application binaries.");
             UriHelper.ValidateSupportedScheme(commitParams.AppSourceUri);
             if (commitParams.AppGroup != null)
             {
                 SubscriptionStore.CheckInstalled(subState);
             }
             this.CheckApplicationPayload(commitParams);
         }
         bool      flag = false;
         bool      identityGroupFound       = false;
         bool      locationGroupFound       = false;
         string    identityGroupProductName = "";
         ArrayList arrayList = this._compStore.CollectCrossGroupApplications(commitParams.DeploySourceUri, commitParams.DeployManifest.Identity, ref identityGroupFound, ref locationGroupFound, ref identityGroupProductName);
         if (arrayList.Count > 0)
         {
             flag = true;
             Logger.AddInternalState("This installation is a Cross Group: identityGroupFound=" + identityGroupFound.ToString() + ",locationGroupFound=" + locationGroupFound.ToString());
         }
         if (subState.IsShellVisible & identityGroupFound & locationGroupFound)
         {
             throw new DeploymentException(ExceptionTypes.GroupMultipleMatch, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_GroupMultipleMatch"), new object[1]
             {
                 (object)identityGroupProductName
             }));
         }
         subState = this.GetSubscriptionState(commitParams.DeployManifest);
         this._compStore.CommitApplication(subState, commitParams);
         if (flag)
         {
             Logger.AddInternalState("Performing cross group migration.");
             IActContext actContext = IsolationInterop.CreateActContext(subState.CurrentBind.ComPointer);
             actContext.PrepareForExecution(IntPtr.Zero, IntPtr.Zero);
             uint ulDisposition;
             actContext.SetApplicationRunningState(0U, 1U, out ulDisposition);
             actContext.SetApplicationRunningState(0U, 2U, out ulDisposition);
             Logger.AddInternalState("Uninstalling all cross groups.");
             foreach (ComponentStore.CrossGroupApplicationData groupApplicationData in arrayList)
             {
                 if (groupApplicationData.CrossGroupType == ComponentStore.CrossGroupApplicationData.GroupType.LocationGroup)
                 {
                     if (groupApplicationData.SubState.appType == AppType.CustomHostSpecified)
                     {
                         Logger.AddInternalState("UninstallCustomHostSpecifiedSubscription : " + (groupApplicationData.SubState.SubscriptionId != null ? groupApplicationData.SubState.SubscriptionId.ToString() : "null"));
                         this.UninstallCustomHostSpecifiedSubscription(groupApplicationData.SubState);
                     }
                     else if (groupApplicationData.SubState.appType == AppType.CustomUX)
                     {
                         Logger.AddInternalState("UninstallCustomUXSubscription : " + (groupApplicationData.SubState.SubscriptionId != null ? groupApplicationData.SubState.SubscriptionId.ToString() : "null"));
                         this.UninstallCustomUXSubscription(groupApplicationData.SubState);
                     }
                     else if (groupApplicationData.SubState.IsShellVisible)
                     {
                         Logger.AddInternalState("UninstallSubscription : " + (groupApplicationData.SubState.SubscriptionId != null ? groupApplicationData.SubState.SubscriptionId.ToString() : "null"));
                         this.UninstallSubscription(groupApplicationData.SubState);
                     }
                 }
                 else if (groupApplicationData.CrossGroupType == ComponentStore.CrossGroupApplicationData.GroupType.IdentityGroup)
                 {
                     Logger.AddInternalState("Not uninstalled :" + (groupApplicationData.SubState.SubscriptionId != null ? groupApplicationData.SubState.SubscriptionId.ToString() : "null") + ". It is in the identity group.");
                 }
             }
         }
         if (commitParams.IsConfirmed && subState.IsInstalled && (subState.IsShellVisible && commitParams.appType != AppType.CustomUX))
         {
             this.UpdateSubscriptionExposure(subState);
         }
         if (commitParams.appType == AppType.CustomUX)
         {
             ShellExposure.ShellExposureInformation exposureInformation = ShellExposure.ShellExposureInformation.CreateShellExposureInformation(subState.SubscriptionId);
             ShellExposure.UpdateShellExtensions(subState, ref exposureInformation);
         }
         SubscriptionStore.OnDeploymentAdded(subState);
     }
 }
Esempio n. 13
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
        }