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
- SiteOfOriginContainer.cs
- AddInBase.cs
- CultureInfoConverter.cs
- SignatureDescription.cs
- RenderTargetBitmap.cs
- XamlToRtfParser.cs
- ShaderEffect.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- CodeSnippetExpression.cs
- ButtonFieldBase.cs
- GroupBox.cs
- base64Transforms.cs
- RemotingService.cs
- NativeObjectSecurity.cs
- CapabilitiesState.cs
- Matrix3D.cs
- AutoGeneratedField.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- TypeSemantics.cs
- MediaTimeline.cs
- ISAPIRuntime.cs
- MobileListItem.cs
- WorkflowServiceAttributes.cs
- SafeWaitHandle.cs
- StrongNameIdentityPermission.cs
- BufferedGraphics.cs
- TemplateControlParser.cs
- StreamingContext.cs
- ToolboxBitmapAttribute.cs
- UpdateTranslator.cs
- Context.cs
- DataListDesigner.cs
- ExtentJoinTreeNode.cs
- HandlerBase.cs
- EventMap.cs
- regiisutil.cs
- HtmlProps.cs
- OdbcError.cs
- URLBuilder.cs
- FixedDSBuilder.cs
- XmlUtf8RawTextWriter.cs
- ZipIOCentralDirectoryBlock.cs
- SingleKeyFrameCollection.cs
- ElementAtQueryOperator.cs
- SqlDesignerDataSourceView.cs
- DynamicObjectAccessor.cs
- Msec.cs
- DiscoveryMessageSequence.cs
- Internal.cs
- HttpFormatExtensions.cs
- TypeToken.cs
- ReverseInheritProperty.cs
- SafeNativeMethods.cs
- DependentList.cs
- WindowsNonControl.cs
- DataGridViewCellStyleBuilderDialog.cs
- DefaultHttpHandler.cs
- FileInfo.cs
- CodeNamespaceImport.cs
- XmlDataDocument.cs
- LogReserveAndAppendState.cs
- StringStorage.cs
- WindowsRegion.cs
- SingleTagSectionHandler.cs
- TextOptions.cs
- PageRequestManager.cs
- SettingsBindableAttribute.cs
- DebugInfo.cs
- NetworkCredential.cs
- AnnouncementService.cs
- CodeDomExtensionMethods.cs
- ExtensionWindow.cs
- Int32RectValueSerializer.cs
- DataGridViewImageColumn.cs
- CacheSection.cs
- ImpersonateTokenRef.cs
- DataList.cs
- DataGridViewComboBoxColumn.cs
- MethodExpression.cs
- ItemCollection.cs
- ConstructorBuilder.cs
- InvalidOperationException.cs
- TrustManagerPromptUI.cs
- EffectiveValueEntry.cs
- OleDbException.cs
- ViewGenResults.cs
- XPathNavigatorReader.cs
- TextOnlyOutput.cs
- HwndSubclass.cs
- AssemblyResourceLoader.cs
- RuleElement.cs
- DockPattern.cs
- TraceInternal.cs
- XmlHierarchyData.cs
- ADMembershipUser.cs
- DoubleAnimationUsingKeyFrames.cs
- InvokePattern.cs
- GeneralTransform.cs
- PasswordPropertyTextAttribute.cs
- thaishape.cs