Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / Configuration / GacUtil.cs / 1 / GacUtil.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System.Web.Configuration; using System.Runtime.InteropServices; using System.Security.Permissions; /* class for installing ASP.BrowserCapabilitiesFactory into gac */ internal sealed class GacUtil : IGac { [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] public void GacInstall(string assemblyPath) { #if !FEATURE_PAL IAssemblyCache ac = null; int hr = NativeMethods.CreateAssemblyCache(out ac, 0); if (0 == hr) hr = ac.InstallAssembly(0, assemblyPath, IntPtr.Zero); #else // !FEATURE_PAL int hr = -1; try { Process gacutilprocess = new System.Diagnostics.Process(); if (gacutilprocess != null) { gacutilprocess.StartInfo.CreateNoWindow = true; #if PLATFORM_UNIX gacutilprocess.StartInfo.FileName = "gacutil"; #else gacutilprocess.StartInfo.FileName = "gacutil.exe"; #endif gacutilprocess.StartInfo.UseShellExecute = false; gacutilprocess.StartInfo.Arguments = "/i " + assemblyPath; gacutilprocess.Start(); while (!gacutilprocess.HasExited) { Thread.Sleep(250); } hr = gacutilprocess.ExitCode; } } catch (Exception) { hr = -1; } #endif // FEATURE_PAL if (0 != hr) { throw new Exception(SR.GetString(SR.Failed_gac_install)); } } [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] public bool GacUnInstall(string assemblyName) { IAssemblyCache ac = null; uint position = 0; int hr = NativeMethods.CreateAssemblyCache(out ac, 0); if (0 == hr) { hr = ac.UninstallAssembly(0, assemblyName, IntPtr.Zero, out position); if (position == 3 /*IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED*/) { return false; } } if (0 != hr) { throw new Exception(SR.GetString(SR.Failed_gac_uninstall)); } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System.Web.Configuration; using System.Runtime.InteropServices; using System.Security.Permissions; /* class for installing ASP.BrowserCapabilitiesFactory into gac */ internal sealed class GacUtil : IGac { [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] public void GacInstall(string assemblyPath) { #if !FEATURE_PAL IAssemblyCache ac = null; int hr = NativeMethods.CreateAssemblyCache(out ac, 0); if (0 == hr) hr = ac.InstallAssembly(0, assemblyPath, IntPtr.Zero); #else // !FEATURE_PAL int hr = -1; try { Process gacutilprocess = new System.Diagnostics.Process(); if (gacutilprocess != null) { gacutilprocess.StartInfo.CreateNoWindow = true; #if PLATFORM_UNIX gacutilprocess.StartInfo.FileName = "gacutil"; #else gacutilprocess.StartInfo.FileName = "gacutil.exe"; #endif gacutilprocess.StartInfo.UseShellExecute = false; gacutilprocess.StartInfo.Arguments = "/i " + assemblyPath; gacutilprocess.Start(); while (!gacutilprocess.HasExited) { Thread.Sleep(250); } hr = gacutilprocess.ExitCode; } } catch (Exception) { hr = -1; } #endif // FEATURE_PAL if (0 != hr) { throw new Exception(SR.GetString(SR.Failed_gac_install)); } } [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)] public bool GacUnInstall(string assemblyName) { IAssemblyCache ac = null; uint position = 0; int hr = NativeMethods.CreateAssemblyCache(out ac, 0); if (0 == hr) { hr = ac.UninstallAssembly(0, assemblyName, IntPtr.Zero, out position); if (position == 3 /*IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED*/) { return false; } } if (0 != hr) { throw new Exception(SR.GetString(SR.Failed_gac_uninstall)); } return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ISO2022Encoding.cs
- TreeNodeEventArgs.cs
- MutexSecurity.cs
- AuthorizationRule.cs
- ZipIOModeEnforcingStream.cs
- AnimationClock.cs
- AppSecurityManager.cs
- ToolStripItemEventArgs.cs
- PluralizationServiceUtil.cs
- Int32Rect.cs
- CodeAttributeArgumentCollection.cs
- HelpInfo.cs
- NavigatorOutput.cs
- SmtpDigestAuthenticationModule.cs
- MD5.cs
- XmlILIndex.cs
- ChannelTerminatedException.cs
- ServiceInfo.cs
- ListItemParagraph.cs
- ImageKeyConverter.cs
- SqlOuterApplyReducer.cs
- BaseHashHelper.cs
- SafeLocalMemHandle.cs
- ISFTagAndGuidCache.cs
- ObjectDataSourceEventArgs.cs
- ContextStaticAttribute.cs
- PrintPageEvent.cs
- DataBoundControl.cs
- AnimationLayer.cs
- CodeDelegateCreateExpression.cs
- UserPersonalizationStateInfo.cs
- FileSystemWatcher.cs
- OleDbReferenceCollection.cs
- Rect3DConverter.cs
- WhileDesigner.xaml.cs
- COM2ExtendedTypeConverter.cs
- GridViewHeaderRowPresenter.cs
- Tokenizer.cs
- UserControlAutomationPeer.cs
- PropertyReferenceSerializer.cs
- DataRow.cs
- EdmValidator.cs
- WebRequestModuleElementCollection.cs
- DocumentGridContextMenu.cs
- HandleCollector.cs
- CheckPair.cs
- QilXmlReader.cs
- BuildProviderCollection.cs
- Msec.cs
- SchemaNames.cs
- ArraySubsetEnumerator.cs
- RSAOAEPKeyExchangeDeformatter.cs
- ButtonAutomationPeer.cs
- FormClosedEvent.cs
- CuspData.cs
- XmlSchemaSimpleTypeList.cs
- NameTable.cs
- InstanceKeyCollisionException.cs
- FormsAuthentication.cs
- DbProviderSpecificTypePropertyAttribute.cs
- XmlDataContract.cs
- SafeFileMappingHandle.cs
- Propagator.cs
- HtmlInputRadioButton.cs
- UpdatePanelTrigger.cs
- MimeTypeMapper.cs
- StickyNoteHelper.cs
- RoleManagerSection.cs
- FaultCallbackWrapper.cs
- HtmlInputReset.cs
- WeakEventManager.cs
- CodeChecksumPragma.cs
- SqlWriter.cs
- WrappedIUnknown.cs
- Timeline.cs
- VisualState.cs
- DetailsViewRow.cs
- ServiceDeploymentInfo.cs
- CustomGrammar.cs
- DictionarySectionHandler.cs
- PolicyVersion.cs
- OracleRowUpdatingEventArgs.cs
- PluralizationServiceUtil.cs
- Font.cs
- WebPartDisplayModeEventArgs.cs
- StdValidatorsAndConverters.cs
- StylusPlugin.cs
- ImageClickEventArgs.cs
- MsmqInputChannelListenerBase.cs
- ProfileBuildProvider.cs
- CodeTypeMember.cs
- DbConnectionPoolCounters.cs
- TimeSpanStorage.cs
- MaterializeFromAtom.cs
- ButtonChrome.cs
- DateTimeParse.cs
- ConcurrentStack.cs
- SqlInternalConnectionSmi.cs
- VirtualizedContainerService.cs
- SourceChangedEventArgs.cs