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
- BufferedStream.cs
- ApplicationServicesHostFactory.cs
- PrintingPermissionAttribute.cs
- DataKey.cs
- ComNativeDescriptor.cs
- ResourceDisplayNameAttribute.cs
- ApplicationSecurityInfo.cs
- MultiBinding.cs
- XmlValueConverter.cs
- RijndaelManaged.cs
- BrowserCapabilitiesFactory.cs
- Int32Collection.cs
- CustomErrorsSectionWrapper.cs
- CheckedListBox.cs
- ScalarType.cs
- SocketElement.cs
- SystemUnicastIPAddressInformation.cs
- ComboBoxDesigner.cs
- AuthorizationPolicyTypeElement.cs
- ProviderUtil.cs
- ImageField.cs
- HttpApplicationFactory.cs
- Border.cs
- PolygonHotSpot.cs
- NameValueConfigurationElement.cs
- FtpCachePolicyElement.cs
- ConfigsHelper.cs
- TogglePattern.cs
- AsyncOperation.cs
- BuiltInPermissionSets.cs
- DataError.cs
- AddInServer.cs
- MemberHolder.cs
- ObjectPersistData.cs
- ListBoxChrome.cs
- DoubleSumAggregationOperator.cs
- DesignTimeParseData.cs
- PermissionSet.cs
- WorkflowInstanceSuspendedRecord.cs
- SortAction.cs
- PeerInvitationResponse.cs
- Executor.cs
- OdbcConnectionHandle.cs
- WmlLiteralTextAdapter.cs
- CollectionType.cs
- HtmlFormWrapper.cs
- EmptyEnumerable.cs
- DataGridViewCellEventArgs.cs
- ClientSettingsStore.cs
- RectAnimationClockResource.cs
- SortKey.cs
- DataSourceSelectArguments.cs
- Triangle.cs
- SqlStream.cs
- _ConnectStream.cs
- PngBitmapDecoder.cs
- LinqExpressionNormalizer.cs
- PKCS1MaskGenerationMethod.cs
- RuleCache.cs
- TextTreeUndo.cs
- MediaPlayerState.cs
- RangeValidator.cs
- DataKeyPropertyAttribute.cs
- CustomErrorsSectionWrapper.cs
- OledbConnectionStringbuilder.cs
- SiteOfOriginContainer.cs
- TypeBuilder.cs
- HostingEnvironmentSection.cs
- HttpApplication.cs
- ContractInstanceProvider.cs
- CqlParser.cs
- SqlRowUpdatedEvent.cs
- SByteConverter.cs
- DataServiceExpressionVisitor.cs
- TableLayoutPanelCellPosition.cs
- Pair.cs
- FixedHighlight.cs
- XsdDuration.cs
- mactripleDES.cs
- KeyEvent.cs
- TypeUsage.cs
- FlowDocument.cs
- _HeaderInfoTable.cs
- IndexedString.cs
- XmlParserContext.cs
- X509Certificate2.cs
- GacUtil.cs
- PropertyEmitter.cs
- ToolboxService.cs
- DispatchRuntime.cs
- ContourSegment.cs
- BuiltInExpr.cs
- ToolStrip.cs
- OrderedDictionaryStateHelper.cs
- WindowsStartMenu.cs
- ParserContext.cs
- FixedTextPointer.cs
- __ComObject.cs
- BlobPersonalizationState.cs
- TemplateNameScope.cs