Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / CoTaskMemUnicodeSafeHandle.cs / 1305376 / CoTaskMemUnicodeSafeHandle.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: CoTaskMemUnicodeSafeHandle ** ** Purpose: ** This internal class is a SafeHandle implementation over a ** native CoTaskMem allocated via SecureStringToCoTaskMemUnicode. ** ============================================================*/ using System; using System.Runtime.InteropServices; using System.Security.Permissions; namespace System.Diagnostics.Eventing.Reader { // // Marked as SecurityCritical due to link demands from inherited // SafeHandle members. // #pragma warning disable 618 // Have not migrated to v4 transparency yet [System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)] #pragma warning restore 618 internal sealed class CoTaskMemUnicodeSafeHandle : SafeHandle { internal CoTaskMemUnicodeSafeHandle() : base(IntPtr.Zero, true) { } internal CoTaskMemUnicodeSafeHandle(IntPtr handle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) { SetHandle(handle); } internal void SetMemory(IntPtr handle) { SetHandle(handle); } internal IntPtr GetMemory() { return handle; } public override bool IsInvalid { get { return IsClosed || handle == IntPtr.Zero; } } protected override bool ReleaseHandle() { Marshal.ZeroFreeCoTaskMemUnicode(handle); handle = IntPtr.Zero; return true; } // DONT compare CoTaskMemUnicodeSafeHandle with CoTaskMemUnicodeSafeHandle.Zero // use IsInvalid instead. Zero is provided where a NULL handle needed public static CoTaskMemUnicodeSafeHandle Zero { get { return new CoTaskMemUnicodeSafeHandle(); } } } } // 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
- IisTraceListener.cs
- BitmapFrameDecode.cs
- ClientBuildManagerCallback.cs
- PresentationAppDomainManager.cs
- GlyphRunDrawing.cs
- AssemblyCollection.cs
- SqlDataSourceQuery.cs
- ToolStripContentPanelRenderEventArgs.cs
- EditCommandColumn.cs
- FormViewInsertEventArgs.cs
- X509CertificateValidator.cs
- EventProviderWriter.cs
- SeekStoryboard.cs
- ModuleBuilderData.cs
- ResourceAttributes.cs
- XmlDataDocument.cs
- KerberosTicketHashIdentifierClause.cs
- Animatable.cs
- ProfileInfo.cs
- GenericTypeParameterBuilder.cs
- SslStreamSecurityUpgradeProvider.cs
- FaultDescriptionCollection.cs
- ImageList.cs
- PasswordRecovery.cs
- ToolStripGrip.cs
- FocusChangedEventArgs.cs
- CachedCompositeFamily.cs
- DoubleLinkList.cs
- IntegerCollectionEditor.cs
- ToolStripDropDownItem.cs
- XhtmlBasicObjectListAdapter.cs
- ThemeConfigurationDialog.cs
- UnmanagedMarshal.cs
- UInt64Storage.cs
- BooleanExpr.cs
- PackageFilter.cs
- TableLayoutPanelCellPosition.cs
- JulianCalendar.cs
- BaseUriHelper.cs
- DataRowCollection.cs
- BuildResultCache.cs
- SoapObjectReader.cs
- SynchronizedKeyedCollection.cs
- SerializableAttribute.cs
- UrlMappingsModule.cs
- CalloutQueueItem.cs
- UpdateManifestForBrowserApplication.cs
- CompositeScriptReferenceEventArgs.cs
- RoleManagerEventArgs.cs
- CapacityStreamGeometryContext.cs
- TableLayoutRowStyleCollection.cs
- DoubleUtil.cs
- StylusPointDescription.cs
- DigitalSignatureProvider.cs
- Transform.cs
- Root.cs
- HtmlTableCellCollection.cs
- ProcessHostFactoryHelper.cs
- Int32AnimationBase.cs
- LocalizableAttribute.cs
- _SslStream.cs
- CipherData.cs
- ArrangedElementCollection.cs
- StaticSiteMapProvider.cs
- DESCryptoServiceProvider.cs
- ProvidePropertyAttribute.cs
- SyndicationItemFormatter.cs
- InputLangChangeRequestEvent.cs
- OwnerDrawPropertyBag.cs
- SafeNativeMethods.cs
- Visual.cs
- StyleXamlParser.cs
- ExtenderHelpers.cs
- FileDialogCustomPlacesCollection.cs
- FieldNameLookup.cs
- CodeMemberProperty.cs
- ErrorFormatterPage.cs
- ToolboxItemImageConverter.cs
- StylusButtonCollection.cs
- StackOverflowException.cs
- DocumentViewerBase.cs
- TypeSemantics.cs
- ArrayHelper.cs
- ThreadPoolTaskScheduler.cs
- ConditionCollection.cs
- _Win32.cs
- ArrayConverter.cs
- HashHelper.cs
- SqlProvider.cs
- HttpContextBase.cs
- figurelength.cs
- PatternMatchRules.cs
- GroupBox.cs
- SqlMetaData.cs
- CombinedGeometry.cs
- returneventsaver.cs
- PropertyGeneratedEventArgs.cs
- DiscoveryProxy.cs
- ReferentialConstraint.cs
- PublisherMembershipCondition.cs