Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeEventHandle.cs / 1 / SafeEventHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for a win32 event 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 SafeEventHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that CreateEvent returns 0 on failure internal SafeEventHandle() : base(true) {} [DllImport(ExternDll.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Unicode)] internal static extern SafeEventHandle CreateEvent(HandleRef lpEventAttributes, bool bManualReset, bool bInitialState, string name); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool CloseHandle(IntPtr handle); override protected bool ReleaseHandle() { return CloseHandle(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: SafeEventHandle ** **Author: David Gutierrez ([....]) ** ** A wrapper for a win32 event 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 SafeEventHandle : SafeHandleZeroOrMinusOneIsInvalid { // Note that CreateEvent returns 0 on failure internal SafeEventHandle() : base(true) {} [DllImport(ExternDll.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Unicode)] internal static extern SafeEventHandle CreateEvent(HandleRef lpEventAttributes, bool bManualReset, bool bInitialState, string name); [DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern bool CloseHandle(IntPtr handle); override protected bool ReleaseHandle() { return CloseHandle(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
- Int64.cs
- XPathPatternBuilder.cs
- DocumentOrderComparer.cs
- AccessText.cs
- AvTraceFormat.cs
- MSAANativeProvider.cs
- DataListItemEventArgs.cs
- ComplexObject.cs
- XmlSubtreeReader.cs
- DocumentGridContextMenu.cs
- ParentQuery.cs
- BitmapVisualManager.cs
- DataGridTablesFactory.cs
- RotateTransform.cs
- EditableRegion.cs
- TemplatePropertyEntry.cs
- LicenseException.cs
- HotSpotCollection.cs
- DefinitionBase.cs
- ExpressionValueEditor.cs
- MouseOverProperty.cs
- WbmpConverter.cs
- DataObjectFieldAttribute.cs
- Table.cs
- HttpRequestTraceRecord.cs
- ContentPresenter.cs
- NotifyParentPropertyAttribute.cs
- ToolCreatedEventArgs.cs
- FlowDocumentPaginator.cs
- ElementNotAvailableException.cs
- TextParagraphView.cs
- GridViewUpdatedEventArgs.cs
- ItemAutomationPeer.cs
- Constraint.cs
- Transform3D.cs
- ExeConfigurationFileMap.cs
- BitHelper.cs
- URIFormatException.cs
- ObjectStateManager.cs
- Image.cs
- PanningMessageFilter.cs
- storepermissionattribute.cs
- Rect3DConverter.cs
- OrCondition.cs
- OledbConnectionStringbuilder.cs
- MediaScriptCommandRoutedEventArgs.cs
- BrowserCapabilitiesFactory.cs
- PersonalizationStateInfoCollection.cs
- Int16AnimationUsingKeyFrames.cs
- SiteMapPath.cs
- AgileSafeNativeMemoryHandle.cs
- BookmarkResumptionRecord.cs
- PropertyItem.cs
- baseaxisquery.cs
- Binding.cs
- TrailingSpaceComparer.cs
- DockPanel.cs
- XMLSchema.cs
- CryptoKeySecurity.cs
- HttpListenerException.cs
- CursorConverter.cs
- SqlMetaData.cs
- GraphicsState.cs
- HwndProxyElementProvider.cs
- UnknownBitmapDecoder.cs
- HttpContext.cs
- DeclarativeCatalogPart.cs
- EntityUtil.cs
- brushes.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- ScrollChangedEventArgs.cs
- ListGeneralPage.cs
- InputLanguageCollection.cs
- SubqueryRules.cs
- HostingEnvironmentSection.cs
- SafeRightsManagementSessionHandle.cs
- DefaultProxySection.cs
- InternalsVisibleToAttribute.cs
- TaiwanLunisolarCalendar.cs
- XamlTypeMapper.cs
- SkewTransform.cs
- TemplateEditingService.cs
- SchemaComplexType.cs
- KeyInterop.cs
- SiteMapNodeItem.cs
- TableLayoutRowStyleCollection.cs
- XmlAttributeProperties.cs
- EntityTypeBase.cs
- SvcMapFileSerializer.cs
- DefaultExpressionVisitor.cs
- DataGridCommandEventArgs.cs
- NativeWindow.cs
- XmlElement.cs
- BindingExpressionBase.cs
- TextBoxAutomationPeer.cs
- InternalMappingException.cs
- CallbackTimeoutsBehavior.cs
- XmlIgnoreAttribute.cs
- Pair.cs
- ModuleElement.cs