Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // 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); } } } // 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
- OutputCacheEntry.cs
- SqlDataRecord.cs
- PackageFilter.cs
- RoleManagerModule.cs
- PartDesigner.cs
- StyleCollection.cs
- WebPartEditorCancelVerb.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- _SecureChannel.cs
- ServiceModelActivity.cs
- BidPrivateBase.cs
- _NtlmClient.cs
- LayoutTable.cs
- TextRangeBase.cs
- SiteMapNodeItem.cs
- ContainerSelectorActiveEvent.cs
- IgnoreSectionHandler.cs
- ReadOnlyDataSourceView.cs
- ComPersistableTypeElement.cs
- SmtpNtlmAuthenticationModule.cs
- AudioSignalProblemOccurredEventArgs.cs
- OrderByLifter.cs
- XPathMessageFilter.cs
- WeakReferenceEnumerator.cs
- WmpBitmapEncoder.cs
- clipboard.cs
- SortDescription.cs
- TextEditorContextMenu.cs
- COM2ExtendedBrowsingHandler.cs
- OutputChannelBinder.cs
- AssemblyName.cs
- Variant.cs
- EntryWrittenEventArgs.cs
- ThreadSafeList.cs
- IriParsingElement.cs
- TypedElement.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- coordinator.cs
- IndexOutOfRangeException.cs
- ContextQuery.cs
- SID.cs
- ValidationEventArgs.cs
- SparseMemoryStream.cs
- TreeWalkHelper.cs
- ExpressionDumper.cs
- TrayIconDesigner.cs
- Int64AnimationBase.cs
- DataGridViewTextBoxColumn.cs
- FormsAuthenticationEventArgs.cs
- WebPartDeleteVerb.cs
- BitmapEffectGroup.cs
- ColorConverter.cs
- PenCursorManager.cs
- MiniLockedBorderGlyph.cs
- TransformedBitmap.cs
- HtmlTitle.cs
- CacheHelper.cs
- EntityDataSourceValidationException.cs
- DbXmlEnabledProviderManifest.cs
- DecoderReplacementFallback.cs
- ReadWriteSpinLock.cs
- InputScopeNameConverter.cs
- FilteredDataSetHelper.cs
- GACIdentityPermission.cs
- _UriSyntax.cs
- ParserHooks.cs
- MobileUserControl.cs
- CancellationTokenRegistration.cs
- SpotLight.cs
- ToolCreatedEventArgs.cs
- UrlMappingCollection.cs
- ChildDocumentBlock.cs
- EventEntry.cs
- ToolboxItemAttribute.cs
- DbConnectionPool.cs
- latinshape.cs
- BasicViewGenerator.cs
- ListViewDeletedEventArgs.cs
- HexParser.cs
- ConsoleCancelEventArgs.cs
- WizardStepBase.cs
- TextRangeEdit.cs
- SchemaType.cs
- ProgressBarRenderer.cs
- Privilege.cs
- PreviewPageInfo.cs
- TabletDevice.cs
- ResourceDisplayNameAttribute.cs
- ApplicationBuildProvider.cs
- MessageSmuggler.cs
- DataGridViewCellMouseEventArgs.cs
- ChangeProcessor.cs
- MediaContextNotificationWindow.cs
- PostBackOptions.cs
- ResourceSetExpression.cs
- _NativeSSPI.cs
- ComponentSerializationService.cs
- MemberAssignment.cs
- ExpressionBindingsDialog.cs
- WpfXamlLoader.cs