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
- MenuDesigner.cs
- DataGridViewComponentPropertyGridSite.cs
- TdsParserSafeHandles.cs
- Style.cs
- SetIterators.cs
- LogicalTreeHelper.cs
- ExpressionBuilder.cs
- rsa.cs
- ExpressionBuilderContext.cs
- bindurihelper.cs
- StateDesignerConnector.cs
- ThemeDictionaryExtension.cs
- QilFunction.cs
- RichTextBox.cs
- GlobalAclOperationRequirement.cs
- CodeTypeMemberCollection.cs
- XamlReaderHelper.cs
- TextDecoration.cs
- ObjectListDesigner.cs
- COM2PropertyDescriptor.cs
- FileDialogCustomPlacesCollection.cs
- IdentityNotMappedException.cs
- EmptyEnumerator.cs
- ProfileGroupSettingsCollection.cs
- EndPoint.cs
- ListViewItem.cs
- CompatibleIComparer.cs
- StorageConditionPropertyMapping.cs
- EventRouteFactory.cs
- MouseDevice.cs
- MetadataArtifactLoaderCompositeFile.cs
- ScrollChrome.cs
- ISAPIApplicationHost.cs
- StringUtil.cs
- TemplateControlBuildProvider.cs
- FilteredAttributeCollection.cs
- UnmanagedMemoryStreamWrapper.cs
- ControlSerializer.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- StringPropertyBuilder.cs
- TextTreeNode.cs
- DependencyPropertyChangedEventArgs.cs
- ApplicationSecurityInfo.cs
- IncrementalReadDecoders.cs
- PropertyEmitterBase.cs
- SortFieldComparer.cs
- XmlSubtreeReader.cs
- ToolBarOverflowPanel.cs
- ListenerPerfCounters.cs
- ZipArchive.cs
- ToolboxBitmapAttribute.cs
- XhtmlMobileTextWriter.cs
- RegexReplacement.cs
- CanExecuteRoutedEventArgs.cs
- PointLight.cs
- DoubleKeyFrameCollection.cs
- XPathMultyIterator.cs
- LayoutUtils.cs
- CommandID.cs
- SiteMapSection.cs
- Memoizer.cs
- InstalledFontCollection.cs
- TypeUtil.cs
- XmlValueConverter.cs
- ConnectionPoint.cs
- TabControlAutomationPeer.cs
- ExceptionUtil.cs
- DbConvert.cs
- WebPartDisplayModeCancelEventArgs.cs
- DataGridColumnsPage.cs
- PrivacyNoticeBindingElementImporter.cs
- TCPClient.cs
- ApplicationManager.cs
- RepeatBehaviorConverter.cs
- RoleBoolean.cs
- IgnoreSection.cs
- ComboBox.cs
- WriteFileContext.cs
- Resources.Designer.cs
- Help.cs
- ObjectDataSourceFilteringEventArgs.cs
- EdmToObjectNamespaceMap.cs
- CodeGroup.cs
- RemoteCryptoRsaServiceProvider.cs
- SessionEndingEventArgs.cs
- DigestTraceRecordHelper.cs
- Pair.cs
- autovalidator.cs
- TreePrinter.cs
- WebServiceEnumData.cs
- ScalarOps.cs
- DataRowView.cs
- PanelStyle.cs
- TypeUsage.cs
- TextLine.cs
- ObjectDesignerDataSourceView.cs
- Inflater.cs
- OdbcCommandBuilder.cs
- QilInvokeEarlyBound.cs
- StringArrayConverter.cs