Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / tx / System / Transactions / Oletx / CoTaskMemHandle.cs / 1305376 / CoTaskMemHandle.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Transactions.Oletx { using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Security; internal sealed class CoTaskMemHandle : SafeHandle { // FXCop is complaining because we don't have any callers to the constructor. But they are created by COMInterop when we use them // as "out" parameters to calls to the proxy shim interfaces. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public CoTaskMemHandle() : base(IntPtr.Zero, true) { } public override bool IsInvalid { get { return IsClosed || this.handle == IntPtr.Zero; } } /* [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [DllImport("ole32.dll", EntryPoint="CoTaskMemAlloc"), SuppressUnmanagedCodeSecurity] public static extern CoTaskMemHandle Alloc(IntPtr size); */ [DllImport("ole32.dll"), SuppressUnmanagedCodeSecurity, ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern void CoTaskMemFree(IntPtr ptr); override protected bool ReleaseHandle() { CoTaskMemFree(this.handle); return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Transactions.Oletx { using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Security; internal sealed class CoTaskMemHandle : SafeHandle { // FXCop is complaining because we don't have any callers to the constructor. But they are created by COMInterop when we use them // as "out" parameters to calls to the proxy shim interfaces. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public CoTaskMemHandle() : base(IntPtr.Zero, true) { } public override bool IsInvalid { get { return IsClosed || this.handle == IntPtr.Zero; } } /* [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [DllImport("ole32.dll", EntryPoint="CoTaskMemAlloc"), SuppressUnmanagedCodeSecurity] public static extern CoTaskMemHandle Alloc(IntPtr size); */ [DllImport("ole32.dll"), SuppressUnmanagedCodeSecurity, ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] private static extern void CoTaskMemFree(IntPtr ptr); override protected bool ReleaseHandle() { CoTaskMemFree(this.handle); return true; } } } // 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
- CacheRequest.cs
- LocalizedNameDescriptionPair.cs
- NativeCppClassAttribute.cs
- Rotation3D.cs
- SourceSwitch.cs
- DataGridViewRowsAddedEventArgs.cs
- DependencyObjectType.cs
- GcSettings.cs
- WebControl.cs
- UnsafeNativeMethods.cs
- ScrollViewer.cs
- AuthenticationModuleElement.cs
- CodeIdentifiers.cs
- TreeWalkHelper.cs
- CollectionChangedEventManager.cs
- SapiGrammar.cs
- CommandPlan.cs
- ApplicationSecurityInfo.cs
- Message.cs
- RangeContentEnumerator.cs
- DbDataReader.cs
- sqlnorm.cs
- ErrorEventArgs.cs
- TypedTableBase.cs
- TranslateTransform.cs
- WebConfigurationManager.cs
- KeyGestureValueSerializer.cs
- MasterPageCodeDomTreeGenerator.cs
- MemberInfoSerializationHolder.cs
- WebPartTracker.cs
- ImageListUtils.cs
- SqlCommand.cs
- WebPartVerbsEventArgs.cs
- PolicyLevel.cs
- CaseInsensitiveHashCodeProvider.cs
- MSG.cs
- XmlDigitalSignatureProcessor.cs
- PageCache.cs
- ConfigXmlElement.cs
- Listbox.cs
- PagerSettings.cs
- CompoundFileStreamReference.cs
- MasterPageParser.cs
- ScriptResourceHandler.cs
- WebPartsPersonalization.cs
- Attachment.cs
- ChangeConflicts.cs
- smtppermission.cs
- MarshalDirectiveException.cs
- GroupBoxRenderer.cs
- HwndProxyElementProvider.cs
- XmlSchemaAttributeGroupRef.cs
- VirtualPathUtility.cs
- ComplexBindingPropertiesAttribute.cs
- LoginCancelEventArgs.cs
- LayoutEvent.cs
- MachineSettingsSection.cs
- RequestBringIntoViewEventArgs.cs
- SpellerInterop.cs
- TextElementCollectionHelper.cs
- ChildDocumentBlock.cs
- LoginView.cs
- TextSimpleMarkerProperties.cs
- XmlQuerySequence.cs
- PnrpPermission.cs
- PlainXmlDeserializer.cs
- Attachment.cs
- XmlAtomicValue.cs
- BuildResult.cs
- DataGridViewAutoSizeModeEventArgs.cs
- InvokeProviderWrapper.cs
- AccessDataSource.cs
- UserControlBuildProvider.cs
- PersonalizationAdministration.cs
- GridViewSortEventArgs.cs
- StringToken.cs
- UdpReplyToBehavior.cs
- DragEventArgs.cs
- Bold.cs
- SiteMapDataSourceView.cs
- StringHandle.cs
- SimpleType.cs
- ExpressionParser.cs
- FileNameEditor.cs
- NonParentingControl.cs
- ClientRuntimeConfig.cs
- ResourceReferenceKeyNotFoundException.cs
- PropertyDescriptors.cs
- IChannel.cs
- AdRotatorDesigner.cs
- Stream.cs
- PolyBezierSegmentFigureLogic.cs
- TextViewDesigner.cs
- LocalizableAttribute.cs
- Rect.cs
- BordersPage.cs
- TraversalRequest.cs
- ValueTypeFixupInfo.cs
- SemanticValue.cs
- ServiceHttpHandlerFactory.cs