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
- EndpointDiscoveryMetadata.cs
- MediaPlayer.cs
- PropertyPathWorker.cs
- FileDialogPermission.cs
- ParseChildrenAsPropertiesAttribute.cs
- Polyline.cs
- RemoteDebugger.cs
- SetUserLanguageRequest.cs
- AsnEncodedData.cs
- EnumConverter.cs
- SmiEventSink_DeferedProcessing.cs
- HTTPNotFoundHandler.cs
- InteropAutomationProvider.cs
- LocalizabilityAttribute.cs
- ReadOnlyCollection.cs
- InkCollectionBehavior.cs
- XslTransform.cs
- DefaultValidator.cs
- XPathConvert.cs
- AppSettingsExpressionBuilder.cs
- PageThemeParser.cs
- MenuItemStyle.cs
- MemoryFailPoint.cs
- ObjectTag.cs
- TextReader.cs
- SqlStream.cs
- autovalidator.cs
- StorageEntityTypeMapping.cs
- EntitySetDataBindingList.cs
- MaskDesignerDialog.cs
- TrustManagerPromptUI.cs
- AdCreatedEventArgs.cs
- TaiwanLunisolarCalendar.cs
- cache.cs
- WindowsFormsHostPropertyMap.cs
- HotCommands.cs
- PointCollectionConverter.cs
- LassoSelectionBehavior.cs
- RequiredAttributeAttribute.cs
- Camera.cs
- XmlLanguageConverter.cs
- TemplateGroupCollection.cs
- EnvironmentPermission.cs
- Win32Native.cs
- HttpRawResponse.cs
- XmlSerializationReader.cs
- MatchingStyle.cs
- TaskHelper.cs
- Logging.cs
- ExpressionBinding.cs
- ScrollEvent.cs
- PartialTrustVisibleAssemblyCollection.cs
- shaperfactoryquerycacheentry.cs
- FileUpload.cs
- Material.cs
- AQNBuilder.cs
- OdbcCommand.cs
- Point3DCollection.cs
- UrlPath.cs
- SamlAction.cs
- Rectangle.cs
- smtppermission.cs
- DataGridViewCellMouseEventArgs.cs
- InfoCardSchemas.cs
- SettingsBase.cs
- CngKeyBlobFormat.cs
- DictionaryBase.cs
- DescendantOverDescendantQuery.cs
- ModelPropertyDescriptor.cs
- Shape.cs
- PageCodeDomTreeGenerator.cs
- SqlInternalConnectionSmi.cs
- ReliableOutputSessionChannel.cs
- ProtocolsSection.cs
- BitmapPalette.cs
- PropertyChangedEventArgs.cs
- Identity.cs
- GlyphInfoList.cs
- SectionUpdates.cs
- Converter.cs
- CommentEmitter.cs
- DbParameterCollection.cs
- HtmlButton.cs
- DocumentApplicationJournalEntry.cs
- HtmlImage.cs
- TimeEnumHelper.cs
- PrintDialogException.cs
- ChunkedMemoryStream.cs
- StringOutput.cs
- RecognizedPhrase.cs
- DrawingCollection.cs
- NativeObjectSecurity.cs
- DbConnectionPool.cs
- ScrollItemProviderWrapper.cs
- WebPartHelpVerb.cs
- WebProxyScriptElement.cs
- SByte.cs
- RegionInfo.cs
- OleDbStruct.cs
- RenderContext.cs