Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SkipQueryOptionExpression.cs
- CustomAttributeBuilder.cs
- Keywords.cs
- ParallelEnumerable.cs
- TypedRowGenerator.cs
- SqlWriter.cs
- TableLayoutPanelCellPosition.cs
- ThreadExceptionEvent.cs
- CodeCatchClauseCollection.cs
- ReliabilityContractAttribute.cs
- StateRuntime.cs
- FullTextState.cs
- NestedContainer.cs
- DataGridToolTip.cs
- OciLobLocator.cs
- VerificationAttribute.cs
- OleDbCommand.cs
- CompositeActivityValidator.cs
- QueryResponse.cs
- QueryMatcher.cs
- BoolExpressionVisitors.cs
- ResourceAssociationSet.cs
- WebContext.cs
- ElementHostPropertyMap.cs
- BaseParagraph.cs
- DataControlCommands.cs
- Rules.cs
- DataSvcMapFile.cs
- RelatedView.cs
- Converter.cs
- EnumConverter.cs
- DataGridViewSortCompareEventArgs.cs
- TypeName.cs
- RadialGradientBrush.cs
- ChannelSinkStacks.cs
- Stack.cs
- DataGridViewColumnTypePicker.cs
- ClientSideQueueItem.cs
- MenuAdapter.cs
- RoleService.cs
- columnmapkeybuilder.cs
- PromptEventArgs.cs
- Exceptions.cs
- BoundField.cs
- SmiXetterAccessMap.cs
- XhtmlTextWriter.cs
- FacetDescriptionElement.cs
- Control.cs
- InternalException.cs
- ExternalException.cs
- TextServicesProperty.cs
- ImageCodecInfo.cs
- ActivationWorker.cs
- ErrorHandler.cs
- OutOfProcStateClientManager.cs
- BmpBitmapEncoder.cs
- TreeNodeStyle.cs
- _FixedSizeReader.cs
- ByteRangeDownloader.cs
- SettingsAttributeDictionary.cs
- DSASignatureFormatter.cs
- WorkflowInstanceAbortedRecord.cs
- Dictionary.cs
- NativeMethods.cs
- Keyboard.cs
- AppDomainProtocolHandler.cs
- ArcSegment.cs
- GetWinFXPath.cs
- ApplicationContext.cs
- ModuleElement.cs
- WasEndpointConfigContainer.cs
- ViewCellRelation.cs
- Int32.cs
- FormViewInsertedEventArgs.cs
- WorkerRequest.cs
- X509SubjectKeyIdentifierClause.cs
- SuppressMessageAttribute.cs
- ValidationError.cs
- CompressedStack.cs
- CodeGenerator.cs
- QueryOutputWriter.cs
- CaseInsensitiveHashCodeProvider.cs
- MappingSource.cs
- SecurityProtocol.cs
- ModifierKeysValueSerializer.cs
- ImmutableObjectAttribute.cs
- EntitySqlQueryCacheKey.cs
- _AcceptOverlappedAsyncResult.cs
- ThreadExceptionDialog.cs
- XmlSubtreeReader.cs
- ObjectDataProvider.cs
- IconHelper.cs
- PeerInvitationResponse.cs
- SizeConverter.cs
- DataGridViewRow.cs
- RijndaelManaged.cs
- ZoneMembershipCondition.cs
- ToolBarPanel.cs
- InputGestureCollection.cs
- ProcessModule.cs