Code:
/ DotNET / DotNET / 8.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
- DynamicActionMessageFilter.cs
- MessageContractAttribute.cs
- WorkflowIdleElement.cs
- Decoder.cs
- XmlRootAttribute.cs
- XmlSubtreeReader.cs
- KeyTimeConverter.cs
- LocalizableAttribute.cs
- _DisconnectOverlappedAsyncResult.cs
- NullableDecimalSumAggregationOperator.cs
- WebBrowserSiteBase.cs
- FileReader.cs
- ADMembershipProvider.cs
- InstanceCreationEditor.cs
- PackWebResponse.cs
- AudioStateChangedEventArgs.cs
- SystemColors.cs
- ExclusiveHandleList.cs
- ViewStateException.cs
- LicFileLicenseProvider.cs
- MaskPropertyEditor.cs
- LocatorPart.cs
- QueryCacheKey.cs
- KeyFrames.cs
- _TransmitFileOverlappedAsyncResult.cs
- XamlBuildTaskServices.cs
- HMACMD5.cs
- MenuItemBindingCollection.cs
- AnyAllSearchOperator.cs
- TimeoutValidationAttribute.cs
- TranslateTransform3D.cs
- ReflectionUtil.cs
- PlaceHolder.cs
- ReferentialConstraint.cs
- CodeDefaultValueExpression.cs
- EditBehavior.cs
- WebPartEditorCancelVerb.cs
- AnnotationHighlightLayer.cs
- GridErrorDlg.cs
- GiveFeedbackEventArgs.cs
- ArgumentOutOfRangeException.cs
- RichTextBoxDesigner.cs
- SoapWriter.cs
- InheritablePropertyChangeInfo.cs
- InvalidStoreProtectionKeyException.cs
- CompositeControl.cs
- ClientConvert.cs
- WebBrowser.cs
- DataListItemCollection.cs
- ActiveDocumentEvent.cs
- CryptoKeySecurity.cs
- SqlCacheDependency.cs
- HttpClientCredentialType.cs
- WinFormsSecurity.cs
- UIElementHelper.cs
- log.cs
- MailWebEventProvider.cs
- RectAnimationUsingKeyFrames.cs
- NavigationService.cs
- Win32Native.cs
- SystemTcpStatistics.cs
- VisemeEventArgs.cs
- WindowCollection.cs
- WCFModelStrings.Designer.cs
- DrawListViewSubItemEventArgs.cs
- Context.cs
- SqlProvider.cs
- SharedDp.cs
- ToolStripRenderer.cs
- CacheDependency.cs
- EntryWrittenEventArgs.cs
- RawStylusInputReport.cs
- Array.cs
- ObjectToken.cs
- PagerSettings.cs
- WorkItem.cs
- PrintControllerWithStatusDialog.cs
- TypeListConverter.cs
- Selector.cs
- ObjectManager.cs
- FixedBufferAttribute.cs
- SqlBuilder.cs
- DataGridPageChangedEventArgs.cs
- AssemblyCollection.cs
- Zone.cs
- xml.cs
- SortedDictionary.cs
- metadatamappinghashervisitor.cs
- XmlIterators.cs
- LocalClientSecuritySettings.cs
- LinqDataSourceDeleteEventArgs.cs
- BamlBinaryReader.cs
- CustomWebEventKey.cs
- DBSqlParser.cs
- InkCanvasFeedbackAdorner.cs
- AsyncOperationManager.cs
- MimeWriter.cs
- TextSchema.cs
- NamespaceCollection.cs
- PropertyGrid.cs