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
- DomNameTable.cs
- ButtonColumn.cs
- TextCompositionEventArgs.cs
- XsltInput.cs
- FilterFactory.cs
- ExtensionWindowResizeGrip.cs
- DateTimeConstantAttribute.cs
- IProvider.cs
- WebEventCodes.cs
- DbConnectionPoolIdentity.cs
- BindingListCollectionView.cs
- Transform.cs
- CompilerTypeWithParams.cs
- DragEvent.cs
- AuthenticationModulesSection.cs
- Schema.cs
- MiniMapControl.xaml.cs
- HashUtility.cs
- DataContractSerializerOperationGenerator.cs
- GenericEnumerator.cs
- ProcessModelSection.cs
- CmsUtils.cs
- SHA256Managed.cs
- DoubleAnimationUsingPath.cs
- NotImplementedException.cs
- OperationFormatStyle.cs
- ParameterCollection.cs
- SqlParameterCollection.cs
- CheckBox.cs
- wgx_exports.cs
- XmlWhitespace.cs
- WindowsStartMenu.cs
- InstallerTypeAttribute.cs
- ObjectDataSourceView.cs
- DocumentSequence.cs
- IndentTextWriter.cs
- WebPartTransformerCollection.cs
- ServicePointManagerElement.cs
- PropertyDescriptor.cs
- MultiSelector.cs
- InternalDispatchObject.cs
- HttpVersion.cs
- SvcMapFile.cs
- InvokeBase.cs
- _FtpControlStream.cs
- BamlLocalizationDictionary.cs
- ChannelManager.cs
- InstanceValue.cs
- DesignBindingValueUIHandler.cs
- TransactionValidationBehavior.cs
- View.cs
- SessionMode.cs
- AlternateView.cs
- AtomServiceDocumentSerializer.cs
- EncoderExceptionFallback.cs
- FunctionCommandText.cs
- Soap12ServerProtocol.cs
- HotSpotCollection.cs
- SqlDataSourceCache.cs
- _DigestClient.cs
- CompareValidator.cs
- StructuredTypeEmitter.cs
- HtmlElement.cs
- BinaryNode.cs
- PathFigureCollectionValueSerializer.cs
- ProcessInfo.cs
- ThemeableAttribute.cs
- Parser.cs
- ParameterElementCollection.cs
- CurrentChangingEventManager.cs
- SafeFileMappingHandle.cs
- ProfileGroupSettingsCollection.cs
- XPathDocumentBuilder.cs
- AutomationPropertyInfo.cs
- IOThreadTimer.cs
- EndpointAddressAugust2004.cs
- ModuleBuilder.cs
- FontCacheLogic.cs
- ObjectIDGenerator.cs
- XmlNodeList.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- NavigationCommands.cs
- StateWorkerRequest.cs
- ZipPackage.cs
- WinFormsSpinner.cs
- SafeLibraryHandle.cs
- MembershipUser.cs
- ExpressionLexer.cs
- XmlCharCheckingReader.cs
- XpsException.cs
- PenThread.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- EventSetter.cs
- LiteralText.cs
- SHA512CryptoServiceProvider.cs
- entityreference_tresulttype.cs
- XNodeSchemaApplier.cs
- FlowDocumentScrollViewer.cs
- AssemblyHash.cs
- VisualStyleRenderer.cs