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
- tibetanshape.cs
- SortKey.cs
- FeatureSupport.cs
- NativeMethods.cs
- AutomationProperty.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- DataColumnMappingCollection.cs
- ToolStripPanelCell.cs
- SamlAuthenticationClaimResource.cs
- CompoundFileStorageReference.cs
- Effect.cs
- SqlConnectionStringBuilder.cs
- FontStyleConverter.cs
- Floater.cs
- DbgUtil.cs
- Image.cs
- Wizard.cs
- LinqExpressionNormalizer.cs
- FixedSOMPageElement.cs
- MenuItemCollectionEditor.cs
- UiaCoreProviderApi.cs
- CounterCreationData.cs
- Light.cs
- XmlSchemaSimpleTypeList.cs
- PageContentCollection.cs
- MergeLocalizationDirectives.cs
- BasicExpandProvider.cs
- WinInetCache.cs
- VerificationException.cs
- FileDialogCustomPlacesCollection.cs
- PageThemeBuildProvider.cs
- QueryOptionExpression.cs
- SectionUpdates.cs
- FullTextLine.cs
- ClientTarget.cs
- DbExpressionVisitor.cs
- TrackingServices.cs
- SmtpReplyReaderFactory.cs
- AnnotationResourceChangedEventArgs.cs
- ChameleonKey.cs
- EmptyControlCollection.cs
- VarRemapper.cs
- ExpressionPrinter.cs
- WebServiceEnumData.cs
- ServiceModelStringsVersion1.cs
- ModifiableIteratorCollection.cs
- XmlDictionaryReaderQuotas.cs
- ItemsChangedEventArgs.cs
- SqlGenericUtil.cs
- OrderedHashRepartitionStream.cs
- HwndPanningFeedback.cs
- CodeAttributeDeclaration.cs
- DbProviderConfigurationHandler.cs
- ScaleTransform.cs
- XappLauncher.cs
- ProjectionQueryOptionExpression.cs
- WinEventQueueItem.cs
- PointAnimationUsingPath.cs
- UrlPath.cs
- DescendantBaseQuery.cs
- ProfileParameter.cs
- DynamicPropertyHolder.cs
- ObjectItemLoadingSessionData.cs
- QilParameter.cs
- FormViewUpdatedEventArgs.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- DataSourceControlBuilder.cs
- PeerApplicationLaunchInfo.cs
- SqlWebEventProvider.cs
- CatalogUtil.cs
- ConfigXmlSignificantWhitespace.cs
- PropertyInfoSet.cs
- precedingquery.cs
- FileInfo.cs
- DataListItemEventArgs.cs
- SizeKeyFrameCollection.cs
- TextEditorSelection.cs
- ThreadNeutralSemaphore.cs
- WebControlParameterProxy.cs
- CompilerHelpers.cs
- SystemIcmpV6Statistics.cs
- CodeIdentifiers.cs
- SignedXml.cs
- DesignTimeVisibleAttribute.cs
- UnionExpr.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- BasicKeyConstraint.cs
- LocalizableResourceBuilder.cs
- ElementHostPropertyMap.cs
- TypeLibConverter.cs
- Logging.cs
- MruCache.cs
- KeyNotFoundException.cs
- XmlQualifiedNameTest.cs
- ProjectionPlanCompiler.cs
- SqlCaseSimplifier.cs
- TrackingExtract.cs
- CodeMemberField.cs
- FileDetails.cs
- QilXmlWriter.cs