Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / AccessibleTech / longhorn / Automation / Win32Providers / MS / Internal / AutomationProxies / SafeCoTaskMem.cs / 1 / SafeCoTaskMem.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // // History: // 10/04/2003 : [....] Created //--------------------------------------------------------------------------- using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32.SafeHandles; using MS.Win32; namespace MS.Internal.AutomationProxies { internal sealed class SafeCoTaskMem : SafeHandleZeroOrMinusOneIsInvalid { // This constructor is used by the P/Invoke marshaling layer // to allocate a SafeHandle instance. P/Invoke then does the // appropriate method call, storing the handle in this class. private SafeCoTaskMem() : base(true) {} internal SafeCoTaskMem(int length) : base(true) { SetHandle(Marshal.AllocCoTaskMem(length * sizeof (char))); } internal string GetStringAuto() { return Marshal.PtrToStringAuto(handle); } internal string GetStringUni(int length) { // Convert the local unmanaged buffer in to a string object return Marshal.PtrToStringUni(handle, length); } // protected override bool ReleaseHandle() { Marshal.FreeCoTaskMem(handle); return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConvertTextFrag.cs
- X509ChainElement.cs
- ViewBox.cs
- NonSerializedAttribute.cs
- DesignerGenericWebPart.cs
- CodeVariableReferenceExpression.cs
- AuthenticationManager.cs
- FontWeightConverter.cs
- PanelStyle.cs
- FormatVersion.cs
- UIAgentRequest.cs
- FormsAuthenticationCredentials.cs
- DetailsView.cs
- Odbc32.cs
- TypeDescriptionProviderAttribute.cs
- ScrollViewer.cs
- Constant.cs
- ApplicationId.cs
- FixedSOMSemanticBox.cs
- FacetChecker.cs
- TextRenderer.cs
- XmlSchemaInclude.cs
- TargetInvocationException.cs
- Point4DValueSerializer.cs
- ListViewTableCell.cs
- FrameworkReadOnlyPropertyMetadata.cs
- DateTimeParse.cs
- VariableQuery.cs
- ListViewCommandEventArgs.cs
- FlowLayoutPanel.cs
- Vector3DAnimationUsingKeyFrames.cs
- ZoneLinkButton.cs
- HasCopySemanticsAttribute.cs
- ExtendedPropertiesHandler.cs
- FlowLayoutPanel.cs
- QueueAccessMode.cs
- HtmlInputImage.cs
- SizeF.cs
- HttpConfigurationContext.cs
- ImageCollectionEditor.cs
- CryptographicAttribute.cs
- __FastResourceComparer.cs
- CLRBindingWorker.cs
- ACE.cs
- NameValuePair.cs
- FileClassifier.cs
- Registry.cs
- SecurityUtils.cs
- BitmapEffectDrawingContent.cs
- ServiceRoute.cs
- InternalSafeNativeMethods.cs
- DataMemberConverter.cs
- DocumentGridPage.cs
- MobileDeviceCapabilitiesSectionHandler.cs
- TextBox.cs
- XamlReader.cs
- ListSourceHelper.cs
- Control.cs
- FixedSOMTable.cs
- FilteredAttributeCollection.cs
- ResourcesGenerator.cs
- Baml2006KnownTypes.cs
- DateTimeFormatInfo.cs
- RecordManager.cs
- TargetParameterCountException.cs
- XmlSerializer.cs
- ConstantSlot.cs
- InlineCollection.cs
- WhitespaceReader.cs
- Command.cs
- TableRowCollection.cs
- DesignerVerb.cs
- SignerInfo.cs
- SqlErrorCollection.cs
- DataGridColumnReorderingEventArgs.cs
- Models.cs
- MergablePropertyAttribute.cs
- TableRowsCollectionEditor.cs
- ColumnTypeConverter.cs
- SecurityKeyIdentifierClause.cs
- AccessViolationException.cs
- CodeDefaultValueExpression.cs
- MemberExpression.cs
- ColumnMapProcessor.cs
- XmlTextAttribute.cs
- ConditionalWeakTable.cs
- DebugInfo.cs
- TypefaceMetricsCache.cs
- CommonDialog.cs
- UpdateTracker.cs
- AnnotationMap.cs
- WindowInteropHelper.cs
- ChannelHandler.cs
- OleTxTransaction.cs
- AssemblyBuilder.cs
- RijndaelManagedTransform.cs
- IdentityReference.cs
- AdapterUtil.cs
- LayoutInformation.cs
- Clause.cs