private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo) { Debug.Assert(info != null); if (info.ApplicationBase == null) { info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized: true); } nCreateContext(); // This must be the last action taken _FusionStore = info; }
private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo) { Contract.Requires(info != null); if (info.ApplicationBase == null) { info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized: true); } nCreateContext(); if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization)) { UpdateLoaderOptimization(info.LoaderOptimization); } // This must be the last action taken _FusionStore = info; }
[System.Security.SecurityCritical] // auto-generated private void SetupDomain(bool allowRedirects, String path, String configFile, String[] propertyNames, String[] propertyValues) { // It is possible that we could have multiple threads initializing // the default domain. We will just take the winner of these two. // (eg. one thread doing a com call and another doing attach for IJW) lock (this) { if(_FusionStore == null) { AppDomainSetup setup = new AppDomainSetup(); #if FEATURE_CORECLR // always use internet permission set setup.InternalSetApplicationTrust("Internet"); #endif // FEATURE_CORECLR #if FEATURE_FUSION setup.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true); if(path != null) setup.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] = path; if(configFile != null) setup.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] = configFile; // Default fusion context starts with binding redirects turned off. if (!allowRedirects) setup.DisallowBindingRedirects = true; #endif #if !FEATURE_CORECLR if (propertyNames != null) { BCLDebug.Assert(propertyValues != null, "propertyValues != null"); BCLDebug.Assert(propertyNames.Length == propertyValues.Length, "propertyNames.Length == propertyValues.Length"); for (int i = 0; i < propertyNames.Length; ++i) { if (String.Equals(propertyNames[i], "PARTIAL_TRUST_VISIBLE_ASSEMBLIES", StringComparison.Ordinal)) { // The value of the PARTIAL_TRUST_VISIBLE_ASSEMBLIES property is a semicolon // delimited list of assembly names to add to the // PartialTrustVisibleAssemblies setting of the domain setup if (propertyValues[i] != null) { if (propertyValues[i].Length > 0) { setup.PartialTrustVisibleAssemblies = propertyValues[i].Split(';'); } else { setup.PartialTrustVisibleAssemblies = new string[0]; } } } else { // In v4 we disallow anything but PARTIAL_TRUST_VISIBLE_ASSEMBLIES to come // in via the default domain properties. That restriction could be lifted // in a future release, at which point this assert should be removed. // // This should be kept in sync with the real externally facing filter code // in CorHost2::SetPropertiesForDefaultAppDomain BCLDebug.Assert(false, "Unexpected default domain property"); } } } #endif // !FEATURE_CORECLR #if FEATURE_APTCA // Propigate the set of conditional APTCA assemblies that will be used in the default // domain onto the domain itself and also into the VM PartialTrustVisibleAssemblies = setup.PartialTrustVisibleAssemblies; #endif // FEATURE_APTCA SetupFusionStore(setup, null); } } }
[System.Security.SecurityCritical] // auto-generated private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo) { Contract.Requires(info != null); #if FEATURE_FUSION if (oldInfo == null) { // Create the application base and configuration file from the imagelocation // passed in or use the Win32 Image name. if(info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null || info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null ) #else if (info.ApplicationBase == null) #endif { #if FEATURE_FUSION AppDomain defaultDomain = GetDefaultDomain(); if (this == defaultDomain) { // The default domain gets its defaults from the main process. info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true); } else { // Other domains get their defaults from the default domain. This way, a host process // can use AppDomainManager to set up the defaults for every domain created in the process. if (info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null) info.ConfigurationFile = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue]; if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null) info.ApplicationBase = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue]; if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue] == null) info.ApplicationName = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue]; } #else info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true); #endif } #if FEATURE_FUSION // If there is no relative path then check the // environment if(info.Value[(int) AppDomainSetup.LoaderInformation.PrivateBinPathValue] == null) info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable); // Add the developer path if it exists on this // machine. if(info.DeveloperPath == null) info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath(); } // Set up the fusion context IntPtr fusionContext = GetFusionContext(); info.SetupFusionContext(fusionContext, oldInfo); // Set loader optimization policy #else #if FEATURE_VERSIONING nCreateContext(); #endif // FEATURE_VERSIONING #endif // FEATURE_FUSION #if FEATURE_LOADER_OPTIMIZATION if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization)) UpdateLoaderOptimization(info.LoaderOptimization); #endif // This must be the last action taken _FusionStore = info; }
private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo) { Contract.Requires(info != null); if (info.ApplicationBase == null) { info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true); } #if FEATURE_VERSIONING nCreateContext(); #endif // FEATURE_VERSIONING #if FEATURE_LOADER_OPTIMIZATION if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization)) UpdateLoaderOptimization(info.LoaderOptimization); #endif // This must be the last action taken _FusionStore = info; }
private void SetupDomain(bool allowRedirects, string path, string configFile, string[] propertyNames, string[] propertyValues) { bool flag = false; try { Monitor.Enter(this, ref flag); if (this._FusionStore == null) { AppDomainSetup appDomainSetup = new AppDomainSetup(); appDomainSetup.SetupDefaults(RuntimeEnvironment.GetModuleFileName()); if (path != null) { appDomainSetup.Value[0] = path; } if (configFile != null) { appDomainSetup.Value[1] = configFile; } if (!allowRedirects) { appDomainSetup.DisallowBindingRedirects = true; } if (propertyNames != null) { for (int i = 0; i < propertyNames.Length; i++) { if (string.Equals(propertyNames[i], "PARTIAL_TRUST_VISIBLE_ASSEMBLIES", StringComparison.Ordinal) && propertyValues[i] != null) { if (propertyValues[i].Length > 0) { appDomainSetup.PartialTrustVisibleAssemblies = propertyValues[i].Split(new char[] { ';' }); } else { appDomainSetup.PartialTrustVisibleAssemblies = new string[0]; } } } } this.PartialTrustVisibleAssemblies = appDomainSetup.PartialTrustVisibleAssemblies; this.SetupFusionStore(appDomainSetup, null); } } finally { if (flag) { Monitor.Exit(this); } } }
private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo) { if (oldInfo == null) { if (info.Value[0] == null || info.Value[1] == null) { AppDomain defaultDomain = AppDomain.GetDefaultDomain(); if (this == defaultDomain) { info.SetupDefaults(RuntimeEnvironment.GetModuleFileName()); } else { if (info.Value[1] == null) { info.ConfigurationFile = defaultDomain.FusionStore.Value[1]; } if (info.Value[0] == null) { info.ApplicationBase = defaultDomain.FusionStore.Value[0]; } if (info.Value[4] == null) { info.ApplicationName = defaultDomain.FusionStore.Value[4]; } } } if (info.Value[5] == null) { info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable); } if (info.DeveloperPath == null) { info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath(); } } IntPtr fusionContext = this.GetFusionContext(); info.SetupFusionContext(fusionContext, oldInfo); if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization)) { this.UpdateLoaderOptimization(info.LoaderOptimization); } this._FusionStore = info; }
private void SetupDomain(bool allowRedirects, string path, string configFile, string[] propertyNames, string[] propertyValues) { lock (this) { if (this._FusionStore == null) { AppDomainSetup info = new AppDomainSetup(); info.SetupDefaults(RuntimeEnvironment.GetModuleFileName()); if (path != null) { info.Value[0] = path; } if (configFile != null) { info.Value[1] = configFile; } if (!allowRedirects) { info.DisallowBindingRedirects = true; } if (propertyNames != null) { for (int i = 0; i < propertyNames.Length; i++) { if (string.Equals(propertyNames[i], "PARTIAL_TRUST_VISIBLE_ASSEMBLIES", StringComparison.Ordinal) && (propertyValues[i] != null)) { if (propertyValues[i].Length > 0) { info.PartialTrustVisibleAssemblies = propertyValues[i].Split(new char[] { ';' }); } else { info.PartialTrustVisibleAssemblies = new string[0]; } } } } this.PartialTrustVisibleAssemblies = info.PartialTrustVisibleAssemblies; this.SetupFusionStore(info, null); } } }