Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- AttachedAnnotation.cs
- Style.cs
- DataGridItemEventArgs.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- XmlCodeExporter.cs
- ConfigXmlElement.cs
- AxParameterData.cs
- ContainerParaClient.cs
- ValidationContext.cs
- EventWaitHandle.cs
- XamlParser.cs
- PrintDialog.cs
- _SafeNetHandles.cs
- ControlParser.cs
- PolicyUtility.cs
- DataPagerFieldCommandEventArgs.cs
- DataServices.cs
- NameNode.cs
- As.cs
- ComponentDispatcher.cs
- SafeFileHandle.cs
- ConditionalWeakTable.cs
- CanExpandCollapseAllConverter.cs
- DataContractAttribute.cs
- EndSelectCardRequest.cs
- ObsoleteAttribute.cs
- PropertyInformation.cs
- ListBindingHelper.cs
- BamlBinaryReader.cs
- CodeIdentifier.cs
- GregorianCalendar.cs
- HttpRequestWrapper.cs
- SqlTopReducer.cs
- ContainerSelectorBehavior.cs
- StatusBarDesigner.cs
- InfoCardSymmetricCrypto.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- MinimizableAttributeTypeConverter.cs
- PairComparer.cs
- storagemappingitemcollection.viewdictionary.cs
- GacUtil.cs
- KeyValuePairs.cs
- PlanCompilerUtil.cs
- ReferenceEqualityComparer.cs
- InvalidDataException.cs
- httpapplicationstate.cs
- LazyTextWriterCreator.cs
- AtomMaterializerLog.cs
- RefType.cs
- MsmqHostedTransportManager.cs
- UserUseLicenseDictionaryLoader.cs
- DataTableReader.cs
- RenderingEventArgs.cs
- DataGridCommandEventArgs.cs
- PropertyTabChangedEvent.cs
- CriticalFinalizerObject.cs
- InstanceDescriptor.cs
- IResourceProvider.cs
- QuerySubExprEliminator.cs
- HtmlInputSubmit.cs
- DataControlCommands.cs
- HttpListenerPrefixCollection.cs
- CellTreeNode.cs
- SerializationSectionGroup.cs
- OleDbConnectionInternal.cs
- TrackingProfile.cs
- ImageIndexEditor.cs
- Relationship.cs
- WebPartZone.cs
- UriTemplateVariablePathSegment.cs
- ItemCollection.cs
- ComponentResourceManager.cs
- FloaterBaseParagraph.cs
- WindowPatternIdentifiers.cs
- DetailsViewCommandEventArgs.cs
- Label.cs
- NamespaceList.cs
- odbcmetadatafactory.cs
- FontNameConverter.cs
- TypeToken.cs
- PagerStyle.cs
- NonParentingControl.cs
- ByteStreamMessage.cs
- IResourceProvider.cs
- SQLMoney.cs
- ConstructorArgumentAttribute.cs
- SubtreeProcessor.cs
- SqlTrackingWorkflowInstance.cs
- Stylesheet.cs
- ToolBar.cs
- GenericWebPart.cs
- UDPClient.cs
- ToolStripControlHost.cs
- SiteMapHierarchicalDataSourceView.cs
- HashAlgorithm.cs
- ByteConverter.cs
- Hashtable.cs
- AtomicFile.cs
- SplayTreeNode.cs
- ListViewAutomationPeer.cs