Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- precedingsibling.cs
- WebCategoryAttribute.cs
- EncodingNLS.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- DataServiceClientException.cs
- SR.cs
- SqlMultiplexer.cs
- DataGridTablesFactory.cs
- SourceSwitch.cs
- HttpVersion.cs
- TreeBuilder.cs
- ToolStripRenderEventArgs.cs
- SpeechRecognitionEngine.cs
- SharedPersonalizationStateInfo.cs
- WinEventHandler.cs
- TypeDependencyAttribute.cs
- LicenseException.cs
- figurelength.cs
- WebPartChrome.cs
- ToolStripRenderEventArgs.cs
- ColumnResizeAdorner.cs
- TracedNativeMethods.cs
- MachineKeyConverter.cs
- ContainerControl.cs
- TabControlEvent.cs
- WebPartVerbsEventArgs.cs
- RuntimeWrappedException.cs
- MatrixTransform.cs
- OdbcInfoMessageEvent.cs
- PropertyOverridesTypeEditor.cs
- XsdBuildProvider.cs
- DependencyPropertyDescriptor.cs
- EventMappingSettings.cs
- StrokeNode.cs
- XmlSchemaSearchPattern.cs
- WindowsSolidBrush.cs
- GridViewEditEventArgs.cs
- DataTableMapping.cs
- AutomationPatternInfo.cs
- HttpApplicationStateWrapper.cs
- ExpandSegment.cs
- FakeModelPropertyImpl.cs
- ListViewTableRow.cs
- RelatedImageListAttribute.cs
- _DisconnectOverlappedAsyncResult.cs
- MappingSource.cs
- SqlCacheDependencyDatabase.cs
- AddInAdapter.cs
- MatrixCamera.cs
- NavigateEvent.cs
- AffineTransform3D.cs
- sqlnorm.cs
- DiagnosticsConfiguration.cs
- SelectQueryOperator.cs
- OdbcUtils.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- ColorTransformHelper.cs
- TypeUtil.cs
- BitmapMetadataBlob.cs
- MetabaseServerConfig.cs
- PermissionAttributes.cs
- RoutedEventValueSerializer.cs
- CultureInfo.cs
- X509ChainElement.cs
- XmlNode.cs
- OuterGlowBitmapEffect.cs
- RegexCompilationInfo.cs
- ConstraintEnumerator.cs
- MimeObjectFactory.cs
- DefaultTraceListener.cs
- NameTable.cs
- PagedDataSource.cs
- MenuAdapter.cs
- VoiceObjectToken.cs
- TrackingServices.cs
- ObjectDataSourceStatusEventArgs.cs
- SecurityManager.cs
- LogicalTreeHelper.cs
- AuditLog.cs
- XhtmlBasicPageAdapter.cs
- SystemIPInterfaceProperties.cs
- Variable.cs
- PolicyManager.cs
- AtomContentProperty.cs
- TypedReference.cs
- OraclePermission.cs
- TickBar.cs
- CompModSwitches.cs
- KeyInfo.cs
- PositiveTimeSpanValidator.cs
- DataObject.cs
- WebPartChrome.cs
- DataGridViewRowsAddedEventArgs.cs
- HtmlControl.cs
- ProfileService.cs
- DropShadowBitmapEffect.cs
- BitmapEffectGroup.cs
- GetPageNumberCompletedEventArgs.cs
- PassportAuthenticationModule.cs
- DataGridViewCellStyleConverter.cs