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
- DataReaderContainer.cs
- NameValueCollection.cs
- ADMembershipProvider.cs
- HttpModuleAction.cs
- CacheDependency.cs
- HttpRequestMessageProperty.cs
- Bitmap.cs
- DataDesignUtil.cs
- _NTAuthentication.cs
- PageAsyncTaskManager.cs
- WsdlHelpGeneratorElement.cs
- CodeAttachEventStatement.cs
- AutoCompleteStringCollection.cs
- Filter.cs
- SettingsPropertyWrongTypeException.cs
- AppSettingsSection.cs
- RemoteWebConfigurationHostServer.cs
- RelationshipSet.cs
- Panel.cs
- CurrencyWrapper.cs
- XslVisitor.cs
- precedingquery.cs
- StrokeCollectionDefaultValueFactory.cs
- InvalidEnumArgumentException.cs
- DataGrid.cs
- _BaseOverlappedAsyncResult.cs
- JsonEncodingStreamWrapper.cs
- PathHelper.cs
- BrushConverter.cs
- Trace.cs
- GatewayDefinition.cs
- MonitoringDescriptionAttribute.cs
- Group.cs
- WorkflowServiceHostFactory.cs
- PropertyCondition.cs
- Select.cs
- VariableAction.cs
- HeaderLabel.cs
- FormDocumentDesigner.cs
- XmlReflectionImporter.cs
- OletxResourceManager.cs
- XmlSchemaFacet.cs
- FocusChangedEventArgs.cs
- TabItem.cs
- SpotLight.cs
- FormsAuthenticationUser.cs
- EditorAttribute.cs
- BindingNavigator.cs
- ExcCanonicalXml.cs
- MobileControlsSectionHelper.cs
- RawMouseInputReport.cs
- ArrayHelper.cs
- GenericAuthenticationEventArgs.cs
- MemberDescriptor.cs
- HtmlEmptyTagControlBuilder.cs
- MetadataArtifactLoader.cs
- BuildManager.cs
- EventlogProvider.cs
- TemplatePropertyEntry.cs
- XhtmlConformanceSection.cs
- DataGridViewCellStyleConverter.cs
- BufferedWebEventProvider.cs
- DbParameterHelper.cs
- SocketPermission.cs
- Point4D.cs
- SqlDataSourceFilteringEventArgs.cs
- PerformanceCounterPermissionEntry.cs
- FixedTextContainer.cs
- Margins.cs
- _NativeSSPI.cs
- Connector.xaml.cs
- MasterPage.cs
- ApplicationContext.cs
- RegexWorker.cs
- ProviderIncompatibleException.cs
- ComplexTypeEmitter.cs
- TypeSystemProvider.cs
- FormParameter.cs
- MarkupExtensionReturnTypeAttribute.cs
- FontResourceCache.cs
- Char.cs
- IISUnsafeMethods.cs
- SystemIPInterfaceProperties.cs
- RolePrincipal.cs
- MarshalDirectiveException.cs
- WebConvert.cs
- XmlAttributeOverrides.cs
- ForEach.cs
- DataGridViewCellConverter.cs
- RootBrowserWindowProxy.cs
- URLString.cs
- TableFieldsEditor.cs
- ReceiveCompletedEventArgs.cs
- RoutedEventValueSerializer.cs
- XmlDictionaryReader.cs
- BooleanKeyFrameCollection.cs
- BadImageFormatException.cs
- FrameworkReadOnlyPropertyMetadata.cs
- _Events.cs
- SplitterPanel.cs