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
- Boolean.cs
- ExpressionReplacer.cs
- PropertyDescriptor.cs
- QilVisitor.cs
- TableRow.cs
- IOException.cs
- QuaternionAnimation.cs
- TypeConverterAttribute.cs
- MemberAccessException.cs
- MeasureItemEvent.cs
- CodeCatchClause.cs
- ReflectionPermission.cs
- CoTaskMemHandle.cs
- LinkDescriptor.cs
- DataGridHeaderBorder.cs
- UserValidatedEventArgs.cs
- SelectionRange.cs
- WindowsFormsSectionHandler.cs
- PhoneCall.cs
- StrokeCollectionDefaultValueFactory.cs
- AuthenticationModeHelper.cs
- TiffBitmapEncoder.cs
- GenericWebPart.cs
- SerializationObjectManager.cs
- WeakKeyDictionary.cs
- CodePageEncoding.cs
- AutoGeneratedField.cs
- EntityClientCacheKey.cs
- CodeFieldReferenceExpression.cs
- HelpInfo.cs
- AuthenticationModulesSection.cs
- ParallelTimeline.cs
- MembershipValidatePasswordEventArgs.cs
- DbProviderServices.cs
- CatalogZoneBase.cs
- MimeMapping.cs
- TableItemProviderWrapper.cs
- DecoderNLS.cs
- CommonDialog.cs
- EventTrigger.cs
- SizeIndependentAnimationStorage.cs
- FixedTextContainer.cs
- IISMapPath.cs
- CompositeTypefaceMetrics.cs
- FormView.cs
- ToolStripMenuItemCodeDomSerializer.cs
- FontUnitConverter.cs
- SingleAnimation.cs
- WindowsFormsSectionHandler.cs
- NotCondition.cs
- CloudCollection.cs
- activationcontext.cs
- WorkflowDesignerColors.cs
- IntellisenseTextBox.cs
- CollectionViewProxy.cs
- TokenBasedSet.cs
- FeatureSupport.cs
- XmlValidatingReader.cs
- ProjectionPlan.cs
- ExpressionEditorAttribute.cs
- DEREncoding.cs
- SendSecurityHeaderElementContainer.cs
- RtfToXamlLexer.cs
- WorkflowControlEndpoint.cs
- MessageSmuggler.cs
- DBDataPermission.cs
- wgx_sdk_version.cs
- Model3DCollection.cs
- selecteditemcollection.cs
- MessageSmuggler.cs
- ReadOnlyDataSourceView.cs
- DictionaryTraceRecord.cs
- UnsafeNativeMethods.cs
- OptimalBreakSession.cs
- StaticFileHandler.cs
- WebPartEditorApplyVerb.cs
- TextCompositionEventArgs.cs
- ContractCodeDomInfo.cs
- _ProxyChain.cs
- HttpCookieCollection.cs
- InvokeMethodActivityDesigner.cs
- COM2ExtendedUITypeEditor.cs
- SizeConverter.cs
- TypeConverterHelper.cs
- ModuleElement.cs
- Lazy.cs
- DbConnectionOptions.cs
- ObjectView.cs
- FtpWebRequest.cs
- ApplicationFileCodeDomTreeGenerator.cs
- GcSettings.cs
- WaitHandle.cs
- Point3D.cs
- EventMappingSettingsCollection.cs
- MemberDescriptor.cs
- NonBatchDirectoryCompiler.cs
- PeerObject.cs
- ControlBuilder.cs
- StateManagedCollection.cs
- DriveNotFoundException.cs