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
- TemplateColumn.cs
- CurrentChangedEventManager.cs
- MenuItemBindingCollection.cs
- XmlRootAttribute.cs
- ListBoxItemAutomationPeer.cs
- DateTimeOffset.cs
- ConfigXmlElement.cs
- FormattedText.cs
- WindowsRichEdit.cs
- WebChannelFactory.cs
- ReferentialConstraint.cs
- elementinformation.cs
- OperationDescriptionCollection.cs
- XPathNavigatorKeyComparer.cs
- InstanceLockException.cs
- COM2PropertyDescriptor.cs
- WebPartRestoreVerb.cs
- TagPrefixAttribute.cs
- CodeNamespaceImportCollection.cs
- ClientCultureInfo.cs
- ProfilePropertySettings.cs
- ComponentManagerBroker.cs
- LockRecursionException.cs
- CmsUtils.cs
- CookieProtection.cs
- SchemaImporterExtensionElement.cs
- DocumentCollection.cs
- ToolStripScrollButton.cs
- WebPartCatalogAddVerb.cs
- FilteredXmlReader.cs
- AsyncResult.cs
- TokenCreationException.cs
- DeferrableContent.cs
- WaitForChangedResult.cs
- IndependentlyAnimatedPropertyMetadata.cs
- SqlClientFactory.cs
- DataGridViewAutoSizeModeEventArgs.cs
- Transform.cs
- DataControlImageButton.cs
- SignatureHelper.cs
- ParseElementCollection.cs
- DataSvcMapFileSerializer.cs
- WhitespaceSignificantCollectionAttribute.cs
- StandardBindingElement.cs
- ListCardsInFileRequest.cs
- wmiprovider.cs
- _BufferOffsetSize.cs
- CollectionCodeDomSerializer.cs
- ProviderConnectionPoint.cs
- _SecureChannel.cs
- DataTableClearEvent.cs
- BypassElementCollection.cs
- XmlIlVisitor.cs
- GeneratedCodeAttribute.cs
- SqlDataSourceStatusEventArgs.cs
- SymmetricAlgorithm.cs
- StorageFunctionMapping.cs
- QilList.cs
- InvalidOleVariantTypeException.cs
- BinaryParser.cs
- CachedPathData.cs
- WebServiceTypeData.cs
- Line.cs
- HttpDebugHandler.cs
- VisualStyleElement.cs
- SqlDataAdapter.cs
- Assert.cs
- ServiceHostingEnvironment.cs
- Helpers.cs
- x509store.cs
- StylusPlugInCollection.cs
- XmlWriter.cs
- ResourceDescriptionAttribute.cs
- WhitespaceSignificantCollectionAttribute.cs
- DataServiceQueryProvider.cs
- RegexInterpreter.cs
- SafeEventLogReadHandle.cs
- MsmqHostedTransportManager.cs
- HwndProxyElementProvider.cs
- SapiInterop.cs
- MessageBox.cs
- SerialErrors.cs
- RepeatEnumerable.cs
- ClonableStack.cs
- UIElementHelper.cs
- XPathNodeList.cs
- RuntimeResourceSet.cs
- DynamicPropertyHolder.cs
- DataServiceContext.cs
- WebProxyScriptElement.cs
- StreamProxy.cs
- ViewBase.cs
- LinqDataSourceHelper.cs
- GradientBrush.cs
- ConnectionStringSettingsCollection.cs
- EarlyBoundInfo.cs
- WriterOutput.cs
- FutureFactory.cs
- OdbcDataAdapter.cs
- CleanUpVirtualizedItemEventArgs.cs