Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeLibraryHandle.cs / 1 / SafeLibraryHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeLibraryHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for a library handles ** ** Date: July 8, 2002 ** ===========================================================*/ using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; namespace Microsoft.Win32.SafeHandles { [HostProtectionAttribute(MayLeakOnAbort = true)] [SuppressUnmanagedCodeSecurityAttribute] internal sealed class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that LoadLibraryEx returns 0 on failure internal SafeLibraryHandle() : base(true) {} [DllImport(ExternDll.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)] internal static extern SafeLibraryHandle LoadLibraryEx(string libFilename, IntPtr reserved, int flags); [DllImport(ExternDll.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Unicode)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool FreeLibrary(IntPtr hModule); override protected bool ReleaseHandle() { return FreeLibrary(handle); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Vector3DConverter.cs
- XDRSchema.cs
- TextBoxBase.cs
- FactoryGenerator.cs
- ValidationPropertyAttribute.cs
- StrongBox.cs
- BrowserDefinitionCollection.cs
- BaseWebProxyFinder.cs
- TypeConverter.cs
- MultiBinding.cs
- VisualStyleInformation.cs
- CellQuery.cs
- SecurityBindingElement.cs
- DesignerHierarchicalDataSourceView.cs
- BamlRecordHelper.cs
- ToolStripSplitStackLayout.cs
- ReferenceEqualityComparer.cs
- PointHitTestParameters.cs
- HttpCacheVary.cs
- ProcessingInstructionAction.cs
- CqlErrorHelper.cs
- dsa.cs
- GridViewCellAutomationPeer.cs
- PartialCachingControl.cs
- LeaseManager.cs
- WpfWebRequestHelper.cs
- CalendarDay.cs
- baseaxisquery.cs
- InlineCollection.cs
- InheritanceAttribute.cs
- TimeZone.cs
- ImportCatalogPart.cs
- LazyLoadBehavior.cs
- loginstatus.cs
- SystemSounds.cs
- AppDomainFactory.cs
- SerializationEventsCache.cs
- JulianCalendar.cs
- OracleRowUpdatingEventArgs.cs
- SmtpMail.cs
- PatternMatcher.cs
- AsyncCodeActivityContext.cs
- WebSysDefaultValueAttribute.cs
- DataServiceHostWrapper.cs
- CollectionViewSource.cs
- CalendarDateRange.cs
- EdmError.cs
- HttpDebugHandler.cs
- PeerInvitationResponse.cs
- ConfigurationPermission.cs
- XmlSortKeyAccumulator.cs
- CompoundFileDeflateTransform.cs
- SerializerDescriptor.cs
- TextContainerChangedEventArgs.cs
- DesignerSerializerAttribute.cs
- ResourceProviderFactory.cs
- DashStyles.cs
- xmlsaver.cs
- WorkflowMarkupSerializationManager.cs
- IndicShape.cs
- odbcmetadatacollectionnames.cs
- Hash.cs
- DropDownButton.cs
- UIntPtr.cs
- SoapAttributeOverrides.cs
- AsymmetricAlgorithm.cs
- BitmapMetadataBlob.cs
- ResourceAttributes.cs
- DataGridRowDetailsEventArgs.cs
- MappingItemCollection.cs
- TagPrefixAttribute.cs
- ArcSegment.cs
- Socket.cs
- DBCSCodePageEncoding.cs
- SafeViewOfFileHandle.cs
- ContentType.cs
- SqlTrackingWorkflowInstance.cs
- WebFaultClientMessageInspector.cs
- DashStyle.cs
- ServiceOperationInfoTypeConverter.cs
- BitmapEffectInputConnector.cs
- VideoDrawing.cs
- PeerService.cs
- ControlCodeDomSerializer.cs
- UriScheme.cs
- iisPickupDirectory.cs
- DeviceFilterEditorDialog.cs
- MaskDesignerDialog.cs
- X509Certificate.cs
- HtmlContainerControl.cs
- SvcMapFile.cs
- XmlSchemaAll.cs
- XmlHierarchyData.cs
- FileSystemInfo.cs
- LineMetrics.cs
- TagPrefixInfo.cs
- LicenseException.cs
- SpellCheck.cs
- FrameworkElement.cs
- Size3D.cs