Code:
/ 4.0 / 4.0 / 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. // ==++== // // 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
- XhtmlBasicTextViewAdapter.cs
- XsltFunctions.cs
- DurableRuntimeValidator.cs
- CodeGenerator.cs
- SchemaAttDef.cs
- WindowHideOrCloseTracker.cs
- TokenizerHelper.cs
- XmlSigningNodeWriter.cs
- EasingKeyFrames.cs
- HostTimeoutsElement.cs
- FtpWebResponse.cs
- BinaryFormatter.cs
- DataPagerFieldItem.cs
- ToolStripManager.cs
- ObjectDataSourceView.cs
- XmlSchemaAnyAttribute.cs
- UnknownWrapper.cs
- ExtentKey.cs
- OdbcPermission.cs
- TypeResolver.cs
- GraphicsPathIterator.cs
- ReverseQueryOperator.cs
- BindingCompleteEventArgs.cs
- BaseUriHelper.cs
- PermissionSet.cs
- TextViewSelectionProcessor.cs
- BindingMAnagerBase.cs
- PointLight.cs
- TypeReference.cs
- InternalDuplexChannelFactory.cs
- SafeNativeMethods.cs
- IxmlLineInfo.cs
- IisTraceWebEventProvider.cs
- Switch.cs
- TypeElementCollection.cs
- DynamicILGenerator.cs
- CommandHelper.cs
- ParseNumbers.cs
- TextServicesCompartmentEventSink.cs
- Size.cs
- ServiceControllerDesigner.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ContractMapping.cs
- CurrentTimeZone.cs
- SHA384.cs
- WindowsFormsSynchronizationContext.cs
- ResizeGrip.cs
- Span.cs
- Parameter.cs
- TemplateControlParser.cs
- DataGridPageChangedEventArgs.cs
- ToolStripLocationCancelEventArgs.cs
- SqlDeflator.cs
- BitmapEffectGeneralTransform.cs
- EdmItemCollection.cs
- HijriCalendar.cs
- Marshal.cs
- Point3DCollectionConverter.cs
- DBSqlParserTableCollection.cs
- RegexCompilationInfo.cs
- ProcessModelInfo.cs
- InputProviderSite.cs
- DataRecordInternal.cs
- EditBehavior.cs
- SchemaObjectWriter.cs
- SwitchAttribute.cs
- SystemWebSectionGroup.cs
- ToolStripPanelRow.cs
- BinaryCommonClasses.cs
- KeyInstance.cs
- RawAppCommandInputReport.cs
- TableLayoutStyleCollection.cs
- OleDbParameterCollection.cs
- FileVersion.cs
- TableLayoutRowStyleCollection.cs
- AssemblyAttributes.cs
- FixedSOMElement.cs
- SmtpNetworkElement.cs
- regiisutil.cs
- Helpers.cs
- SharedConnectionWorkflowTransactionService.cs
- ValueType.cs
- CacheOutputQuery.cs
- WeakReferenceKey.cs
- PngBitmapDecoder.cs
- GenericWebPart.cs
- ConnectionInterfaceCollection.cs
- Odbc32.cs
- codemethodreferenceexpression.cs
- CachingHintValidation.cs
- WebPartConnection.cs
- EventLogEntryCollection.cs
- EmptyEnumerator.cs
- OneOfScalarConst.cs
- Calendar.cs
- StorageTypeMapping.cs
- RepeaterItem.cs
- InvalidPropValue.cs
- SQLBinaryStorage.cs
- SerialReceived.cs