Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- unsafenativemethodsother.cs
- Transform3D.cs
- CompiledQueryCacheKey.cs
- TypedAsyncResult.cs
- ConsumerConnectionPoint.cs
- ClaimTypes.cs
- InfoCardSymmetricCrypto.cs
- Control.cs
- ColorMap.cs
- WindowsImpersonationContext.cs
- XPathAxisIterator.cs
- AncestorChangedEventArgs.cs
- Context.cs
- OracleConnectionString.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- MainMenu.cs
- RC2CryptoServiceProvider.cs
- ResourceIDHelper.cs
- DynamicValueConverter.cs
- EncoderExceptionFallback.cs
- TypeEnumerableViewSchema.cs
- ProfileSection.cs
- WebPartUtil.cs
- SHA512Managed.cs
- RegisteredHiddenField.cs
- VideoDrawing.cs
- Internal.cs
- BaseInfoTable.cs
- RenamedEventArgs.cs
- BufferModeSettings.cs
- LinkLabelLinkClickedEvent.cs
- WebEvents.cs
- PropertyOverridesTypeEditor.cs
- ContractBase.cs
- FamilyMapCollection.cs
- FocusTracker.cs
- SynchronizationValidator.cs
- TextParagraphView.cs
- HtmlInputButton.cs
- DataGridAddNewRow.cs
- HttpCacheVary.cs
- ElementProxy.cs
- RefreshEventArgs.cs
- SessionEndedEventArgs.cs
- Thickness.cs
- UIPropertyMetadata.cs
- EdgeProfileValidation.cs
- QueryOutputWriterV1.cs
- ListItemCollection.cs
- DurableInstanceContextProvider.cs
- BasicCellRelation.cs
- AutomationProperty.cs
- WmlCommandAdapter.cs
- ConstructorBuilder.cs
- PassportAuthenticationEventArgs.cs
- HeaderUtility.cs
- HtmlElementEventArgs.cs
- SignatureConfirmationElement.cs
- EFColumnProvider.cs
- _HeaderInfoTable.cs
- ReadOnlyPermissionSet.cs
- BitmapMetadataEnumerator.cs
- IDispatchConstantAttribute.cs
- MimeImporter.cs
- SystemFonts.cs
- UpdateEventArgs.cs
- TextViewSelectionProcessor.cs
- HttpClientCertificate.cs
- ProtocolViolationException.cs
- CollectionBase.cs
- StreamInfo.cs
- CategoryAttribute.cs
- TransformPatternIdentifiers.cs
- SystemNetHelpers.cs
- PkcsUtils.cs
- CallSiteBinder.cs
- InfoCardAsymmetricCrypto.cs
- SoapDocumentServiceAttribute.cs
- StorageAssociationSetMapping.cs
- SqlStream.cs
- FontStyleConverter.cs
- CfgRule.cs
- NativeMethods.cs
- HebrewCalendar.cs
- ActiveXHost.cs
- ContractReference.cs
- Operators.cs
- TableLayoutStyle.cs
- DataList.cs
- TdsParameterSetter.cs
- InheritablePropertyChangeInfo.cs
- MessagePropertyDescriptionCollection.cs
- UniqueID.cs
- RowSpanVector.cs
- PropVariant.cs
- GridSplitter.cs
- SyndicationDeserializer.cs
- StylusCollection.cs
- XmlWriter.cs
- ArrayTypeMismatchException.cs