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
- DocumentProperties.cs
- TableRowCollection.cs
- RedistVersionInfo.cs
- SubpageParagraph.cs
- DefaultTraceListener.cs
- TypePropertyEditor.cs
- WebReferenceOptions.cs
- ControlValuePropertyAttribute.cs
- QuadraticBezierSegment.cs
- UserControl.cs
- StylusButtonCollection.cs
- CodeExpressionCollection.cs
- MailSettingsSection.cs
- CompilationAssemblyInstallComponent.cs
- RoleService.cs
- CacheHelper.cs
- CqlErrorHelper.cs
- KeyValueConfigurationCollection.cs
- DbConnectionInternal.cs
- SqlHelper.cs
- RowUpdatedEventArgs.cs
- MemberProjectedSlot.cs
- InfoCardSymmetricCrypto.cs
- UnsafeNativeMethodsCLR.cs
- FixedTextView.cs
- ColumnMapTranslator.cs
- ExpressionLexer.cs
- InputProviderSite.cs
- HexParser.cs
- DecimalConstantAttribute.cs
- InitializationEventAttribute.cs
- MobileControlsSectionHelper.cs
- ReadonlyMessageFilter.cs
- Collection.cs
- HandlerBase.cs
- Baml2006Reader.cs
- CssClassPropertyAttribute.cs
- AutomationPattern.cs
- QueryExpr.cs
- DocumentPageViewAutomationPeer.cs
- NotSupportedException.cs
- OleDbParameter.cs
- CompilerErrorCollection.cs
- PageAsyncTaskManager.cs
- RequestValidator.cs
- DataServiceQueryOfT.cs
- InputMethodStateChangeEventArgs.cs
- InputScopeNameConverter.cs
- OutputBuffer.cs
- Exceptions.cs
- SQLBoolean.cs
- LambdaSerializationException.cs
- _SslState.cs
- ConfigurationLocationCollection.cs
- ControlBuilder.cs
- DbConnectionPoolCounters.cs
- TableMethodGenerator.cs
- PageBuildProvider.cs
- DiffuseMaterial.cs
- FixedSOMLineRanges.cs
- TypeInitializationException.cs
- PropertyIdentifier.cs
- DataGridToolTip.cs
- SynchronizedDispatch.cs
- xmlglyphRunInfo.cs
- SurrogateSelector.cs
- CatalogZoneBase.cs
- SqlVisitor.cs
- InstanceLockedException.cs
- DataRow.cs
- Version.cs
- ContentPlaceHolder.cs
- EventManager.cs
- CryptoHandle.cs
- HandlerBase.cs
- TextEvent.cs
- CompositeScriptReferenceEventArgs.cs
- InfoCardTraceRecord.cs
- Tokenizer.cs
- AttributeQuery.cs
- XsltContext.cs
- RawStylusInputCustomData.cs
- InternalException.cs
- DataStreams.cs
- EventLogSession.cs
- CssTextWriter.cs
- COAUTHINFO.cs
- ToolStripDropDownItem.cs
- Thread.cs
- ReferenceConverter.cs
- CheckBoxRenderer.cs
- QuaternionAnimationUsingKeyFrames.cs
- Pair.cs
- ChainOfDependencies.cs
- ScrollableControlDesigner.cs
- SplineKeyFrames.cs
- DocumentGridPage.cs
- EntityDataSourceDesigner.cs
- ProfileManager.cs
- NavigationPropertyEmitter.cs