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
- SynchronizedInputHelper.cs
- SecUtil.cs
- KeyValuePairs.cs
- GeometryGroup.cs
- HotSpotCollection.cs
- GridItemCollection.cs
- CaseInsensitiveOrdinalStringComparer.cs
- SqlGenerator.cs
- AuthenticationConfig.cs
- ComponentResourceManager.cs
- ListBindableAttribute.cs
- InvokeHandlers.cs
- RelationshipDetailsCollection.cs
- OleDbTransaction.cs
- EmbeddedMailObjectsCollection.cs
- TextParagraphCache.cs
- FilterQueryOptionExpression.cs
- ListViewEditEventArgs.cs
- Typography.cs
- MetadataItemEmitter.cs
- EntitySqlException.cs
- ProcessInputEventArgs.cs
- MasterPageCodeDomTreeGenerator.cs
- InternalDispatchObject.cs
- isolationinterop.cs
- DataContractSerializerSection.cs
- InputMethod.cs
- AssemblyAttributesGoHere.cs
- SerializerWriterEventHandlers.cs
- CqlErrorHelper.cs
- WorkflowViewService.cs
- RectangleHotSpot.cs
- FlowLayoutSettings.cs
- PreviewKeyDownEventArgs.cs
- ApplicationContext.cs
- SimpleApplicationHost.cs
- ControlPropertyNameConverter.cs
- UTF32Encoding.cs
- IProvider.cs
- DefaultBinder.cs
- Int32AnimationBase.cs
- SchemaDeclBase.cs
- VoiceInfo.cs
- IUnknownConstantAttribute.cs
- WebBrowserNavigatedEventHandler.cs
- ZipPackagePart.cs
- LowerCaseStringConverter.cs
- StartUpEventArgs.cs
- BuildProviderCollection.cs
- AssertSection.cs
- XPathNavigatorReader.cs
- DiscoveryReference.cs
- XamlDesignerSerializationManager.cs
- XmlRawWriterWrapper.cs
- ArrayElementGridEntry.cs
- X509UI.cs
- CompressionTransform.cs
- SqlBuffer.cs
- DataGridViewCellConverter.cs
- DoubleConverter.cs
- PropertyGrid.cs
- NameValueCollection.cs
- BrowserDefinitionCollection.cs
- DesignerView.cs
- EditorOptionAttribute.cs
- RawStylusSystemGestureInputReport.cs
- CodeAssignStatement.cs
- EntityDataSourceChangingEventArgs.cs
- ResolvedKeyFrameEntry.cs
- xdrvalidator.cs
- GridViewColumnHeader.cs
- ByteBufferPool.cs
- ProjectionPath.cs
- DateTimeValueSerializerContext.cs
- RowToFieldTransformer.cs
- StringToken.cs
- CacheVirtualItemsEvent.cs
- CheckBoxList.cs
- Win32.cs
- VirtualDirectoryMapping.cs
- TypeNameConverter.cs
- Authorization.cs
- ISAPIApplicationHost.cs
- CompositeCollection.cs
- RangeBaseAutomationPeer.cs
- GroupBox.cs
- PrintController.cs
- ChangeBlockUndoRecord.cs
- WebCategoryAttribute.cs
- Types.cs
- DataGridTablesFactory.cs
- Point3DKeyFrameCollection.cs
- Sql8ExpressionRewriter.cs
- FilteredAttributeCollection.cs
- SqlParameter.cs
- SQLDoubleStorage.cs
- MenuItemBindingCollection.cs
- Command.cs
- OperationInvokerBehavior.cs
- EFDataModelProvider.cs