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
- TypeUtil.cs
- CopyNamespacesAction.cs
- XmlSchemaAnnotation.cs
- ExpressionBindingsDialog.cs
- QilTernary.cs
- WebPartCatalogAddVerb.cs
- OdbcConnectionString.cs
- SecurityRuntime.cs
- processwaithandle.cs
- SessionStateSection.cs
- FixedDSBuilder.cs
- MonthChangedEventArgs.cs
- CheckedListBox.cs
- XmlMembersMapping.cs
- Rotation3DAnimation.cs
- InputProcessorProfiles.cs
- WhitespaceSignificantCollectionAttribute.cs
- MultiViewDesigner.cs
- StringResourceManager.cs
- RichTextBoxConstants.cs
- ExtendedProtectionPolicyElement.cs
- SimpleBitVector32.cs
- ExpressionConverter.cs
- WebConfigurationHost.cs
- ExceptionHandlersDesigner.cs
- DBSchemaTable.cs
- AutomationAttributeInfo.cs
- SmiGettersStream.cs
- XsdCachingReader.cs
- SqlDataSource.cs
- ItemCheckedEvent.cs
- ComboBoxAutomationPeer.cs
- WebErrorHandler.cs
- ConditionBrowserDialog.cs
- TypeConverterBase.cs
- TraceListeners.cs
- NavigationPropertySingletonExpression.cs
- Stackframe.cs
- SystemColors.cs
- FormsAuthenticationTicket.cs
- ListViewDeletedEventArgs.cs
- PasswordTextContainer.cs
- BitmapMetadataEnumerator.cs
- CodeDelegateCreateExpression.cs
- GlobalEventManager.cs
- ResetableIterator.cs
- DelegateArgumentReference.cs
- DateRangeEvent.cs
- XmlException.cs
- HighContrastHelper.cs
- SizeValueSerializer.cs
- FormattedTextSymbols.cs
- SqlClientPermission.cs
- HandlerFactoryWrapper.cs
- ConnectionManagementElement.cs
- ImageAttributes.cs
- connectionpool.cs
- WebPartConnection.cs
- printdlgexmarshaler.cs
- TrackingProfileCache.cs
- SqlTypesSchemaImporter.cs
- XmlName.cs
- ZipIOLocalFileHeader.cs
- EntryWrittenEventArgs.cs
- UInt16Converter.cs
- DataGridCellsPresenter.cs
- FontUnit.cs
- PolicyStatement.cs
- TextRangeBase.cs
- ManagedWndProcTracker.cs
- PreviewPageInfo.cs
- EventLogWatcher.cs
- DelegateSerializationHolder.cs
- GridToolTip.cs
- GreaterThan.cs
- HtmlForm.cs
- HttpListenerResponse.cs
- MDIControlStrip.cs
- DataGridPageChangedEventArgs.cs
- BlobPersonalizationState.cs
- InternalMappingException.cs
- AndAlso.cs
- EntityProxyTypeInfo.cs
- ControlCodeDomSerializer.cs
- odbcmetadatafactory.cs
- PointCollectionValueSerializer.cs
- SQLBytesStorage.cs
- NullableIntMinMaxAggregationOperator.cs
- WebControlParameterProxy.cs
- ClientTarget.cs
- NeutralResourcesLanguageAttribute.cs
- SimpleTypeResolver.cs
- PersistenceProviderBehavior.cs
- PersonalizableAttribute.cs
- VisualBasicSettings.cs
- As.cs
- Pick.cs
- FusionWrap.cs
- Monitor.cs
- TableStyle.cs