Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / Microsoft / Win32 / SafeHandles / SafeTimerHandle.cs / 1305376 / SafeTimerHandle.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: SafeTimerHandle
**
** Author: David Gutierrez ([....])
**
** A wrapper for a timer handle
**
** Date: July 23, 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;
using System.Runtime.Versioning;
namespace Microsoft.Win32.SafeHandles {
[HostProtectionAttribute(MayLeakOnAbort=true)]
[SuppressUnmanagedCodeSecurityAttribute]
internal sealed class SafeTimerHandle : SafeHandleZeroOrMinusOneIsInvalid
{
// Note that CreateWaitableTimer returns 0 on failure
internal SafeTimerHandle() : base (true) {}
// Not currently used
//[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)]
//internal SafeTimerHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) {
// SetHandle(existingHandle);
//}
[DllImport(ExternDll.Kernel32, ExactSpelling=true, SetLastError=true)]
[ResourceExposure(ResourceScope.None)]
[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
- RequestStatusBarUpdateEventArgs.cs
- ActionFrame.cs
- AnnotationComponentManager.cs
- MultiView.cs
- FixedSOMImage.cs
- DateTimeOffsetAdapter.cs
- ChannelListenerBase.cs
- GetCertificateRequest.cs
- DropShadowEffect.cs
- ConfigXmlReader.cs
- GenericAuthenticationEventArgs.cs
- NameTable.cs
- FileIOPermission.cs
- VScrollBar.cs
- BamlBinaryReader.cs
- Delay.cs
- BufferedGraphicsManager.cs
- TextEndOfLine.cs
- Pool.cs
- webeventbuffer.cs
- _Connection.cs
- XsltInput.cs
- DataBindingHandlerAttribute.cs
- ConnectionManagementElementCollection.cs
- Polygon.cs
- Context.cs
- ColorConverter.cs
- XmlUnspecifiedAttribute.cs
- SecurityElement.cs
- ChooseAction.cs
- NumberSubstitution.cs
- BackgroundWorker.cs
- Geometry3D.cs
- KeyedHashAlgorithm.cs
- CodeTypeMemberCollection.cs
- StackSpiller.Generated.cs
- ObjectRef.cs
- DocumentPageHost.cs
- OleDbPermission.cs
- Package.cs
- Transform3DGroup.cs
- CalendarButtonAutomationPeer.cs
- updatecommandorderer.cs
- BinaryFormatter.cs
- RegistryPermission.cs
- COM2ExtendedTypeConverter.cs
- SafeRightsManagementPubHandle.cs
- SqlXmlStorage.cs
- FrameworkElement.cs
- TextTabProperties.cs
- PixelFormatConverter.cs
- WsdlContractConversionContext.cs
- ScriptRegistrationManager.cs
- DictionaryKeyPropertyAttribute.cs
- FullTextState.cs
- CreateUserErrorEventArgs.cs
- ObjectDataSourceSelectingEventArgs.cs
- FrugalList.cs
- UiaCoreProviderApi.cs
- TemplateAction.cs
- SpanIndex.cs
- CodeAttachEventStatement.cs
- VisualStyleInformation.cs
- HighlightVisual.cs
- QuotedPairReader.cs
- StringReader.cs
- RemoteWebConfigurationHost.cs
- TTSEvent.cs
- TemplateBindingExtension.cs
- PerformanceCounterPermissionEntry.cs
- BinaryWriter.cs
- PackagePartCollection.cs
- DefaultValueAttribute.cs
- ConversionContext.cs
- FontFaceLayoutInfo.cs
- SystemResourceHost.cs
- ZipIOModeEnforcingStream.cs
- WebBrowserUriTypeConverter.cs
- HtmlSelect.cs
- SqlTriggerContext.cs
- Border.cs
- Light.cs
- MarshalDirectiveException.cs
- ThreadSafeList.cs
- WebPartDisplayModeCollection.cs
- TrustSection.cs
- WhitespaceRuleReader.cs
- DbConnectionFactory.cs
- InternalPolicyElement.cs
- NullRuntimeConfig.cs
- ExceptionUtil.cs
- CodeIdentifiers.cs
- QueryTreeBuilder.cs
- GridEntry.cs
- IPPacketInformation.cs
- SortQuery.cs
- BehaviorEditorPart.cs
- HelpProvider.cs
- ComponentCollection.cs
- HashHelper.cs