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
- MetadataArtifactLoaderComposite.cs
- TextRunTypographyProperties.cs
- TypeConvertions.cs
- MonitoringDescriptionAttribute.cs
- GridLength.cs
- WebResponse.cs
- TextParentUndoUnit.cs
- NativeRecognizer.cs
- CaseStatementProjectedSlot.cs
- CodeDomDecompiler.cs
- TargetInvocationException.cs
- TextTreeExtractElementUndoUnit.cs
- PageContentCollection.cs
- ButtonBaseAdapter.cs
- SqlConnectionHelper.cs
- ObjectItemAssemblyLoader.cs
- PrintEvent.cs
- Track.cs
- ListComponentEditorPage.cs
- COM2PropertyPageUITypeConverter.cs
- CorePropertiesFilter.cs
- FixedSOMLineRanges.cs
- UriWriter.cs
- SecurityException.cs
- PrintDialogException.cs
- SessionStateContainer.cs
- FilteredDataSetHelper.cs
- PageBuildProvider.cs
- DataGridViewCellCancelEventArgs.cs
- DependencyPropertyAttribute.cs
- ParallelLoopState.cs
- JournalEntryStack.cs
- FormatterServices.cs
- PublisherMembershipCondition.cs
- WebReferencesBuildProvider.cs
- TokenBasedSet.cs
- URI.cs
- TrackingConditionCollection.cs
- CircleHotSpot.cs
- DataBoundControlActionList.cs
- BidPrivateBase.cs
- TypeBuilder.cs
- MetadataHelper.cs
- SerializationObjectManager.cs
- CodeLabeledStatement.cs
- PhysicalOps.cs
- StylusCaptureWithinProperty.cs
- DataListItem.cs
- EntityWrapperFactory.cs
- WebPartCancelEventArgs.cs
- SqlDataSourceView.cs
- PropertyChangingEventArgs.cs
- IPAddressCollection.cs
- ClosableStream.cs
- TextBounds.cs
- XslUrlEditor.cs
- UIElementAutomationPeer.cs
- BaseAddressElementCollection.cs
- SystemIcmpV4Statistics.cs
- GeometryHitTestResult.cs
- ManagedWndProcTracker.cs
- WebPartDescription.cs
- HtmlInputCheckBox.cs
- JoinTreeSlot.cs
- EarlyBoundInfo.cs
- UInt16.cs
- ExtenderProvidedPropertyAttribute.cs
- MetadataArtifactLoader.cs
- EventSourceCreationData.cs
- ServiceHttpModule.cs
- ParagraphResult.cs
- FontDifferentiator.cs
- DragDrop.cs
- StreamingContext.cs
- WebPartMinimizeVerb.cs
- LazyTextWriterCreator.cs
- IPipelineRuntime.cs
- TextBoxBaseDesigner.cs
- MenuItemBindingCollection.cs
- CellPartitioner.cs
- CompositeFontFamily.cs
- SqlMethodCallConverter.cs
- ScrollProviderWrapper.cs
- InkSerializer.cs
- SqlDataSourceCommandEventArgs.cs
- RegexRunner.cs
- ConfigXmlText.cs
- XmlDocumentType.cs
- GroupBoxAutomationPeer.cs
- OpenFileDialog.cs
- ConfigXmlElement.cs
- DataReaderContainer.cs
- NodeFunctions.cs
- FamilyTypefaceCollection.cs
- EnumValidator.cs
- PenLineCapValidation.cs
- ResourceAssociationSet.cs
- HostProtectionPermission.cs
- PageStatePersister.cs
- CollectionChangeEventArgs.cs