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
- PolygonHotSpot.cs
- EventsTab.cs
- TreeView.cs
- EventManager.cs
- WebPartEditorApplyVerb.cs
- XmlDataCollection.cs
- ADMembershipProvider.cs
- COM2IDispatchConverter.cs
- MeshGeometry3D.cs
- DoubleSumAggregationOperator.cs
- SystemWebSectionGroup.cs
- BulletDecorator.cs
- ReliableSessionBindingElement.cs
- PatternMatchRules.cs
- DefaultMemberAttribute.cs
- StateElementCollection.cs
- WebPartZoneBase.cs
- Vector3DKeyFrameCollection.cs
- Themes.cs
- SchemaContext.cs
- GB18030Encoding.cs
- RegexCapture.cs
- ParserOptions.cs
- CSharpCodeProvider.cs
- DrawingContextDrawingContextWalker.cs
- SecurityRuntime.cs
- DataGridAutomationPeer.cs
- InternalConfigEventArgs.cs
- BaseDataList.cs
- StyleCollectionEditor.cs
- DataRowExtensions.cs
- SystemIPGlobalStatistics.cs
- ToolStripItemCollection.cs
- WrappedReader.cs
- SingleResultAttribute.cs
- Guid.cs
- BinaryConverter.cs
- NumericUpDownAcceleration.cs
- TypeReference.cs
- DecimalKeyFrameCollection.cs
- SplashScreen.cs
- BevelBitmapEffect.cs
- METAHEADER.cs
- AssociatedControlConverter.cs
- ReadOnlyHierarchicalDataSourceView.cs
- DesignBindingConverter.cs
- HashSetEqualityComparer.cs
- LinkConverter.cs
- PhysicalFontFamily.cs
- CodeAccessPermission.cs
- DataGridToolTip.cs
- ImpersonateTokenRef.cs
- UserControlFileEditor.cs
- DescendentsWalker.cs
- DataGridViewColumnCollectionDialog.cs
- UTF7Encoding.cs
- HwndSubclass.cs
- Point3DIndependentAnimationStorage.cs
- HMACSHA384.cs
- HttpRuntime.cs
- ApplicationProxyInternal.cs
- JsonDeserializer.cs
- ToolStripSystemRenderer.cs
- MenuStrip.cs
- MultiDataTrigger.cs
- ISAPIApplicationHost.cs
- AssemblyFilter.cs
- ListenerUnsafeNativeMethods.cs
- WinFormsUtils.cs
- MemoryStream.cs
- SkinBuilder.cs
- PartitionResolver.cs
- StatusBarDrawItemEvent.cs
- WithStatement.cs
- AutoResizedEvent.cs
- ResXBuildProvider.cs
- NotifyCollectionChangedEventArgs.cs
- UnicastIPAddressInformationCollection.cs
- OutputCacheSection.cs
- CalendarData.cs
- _BufferOffsetSize.cs
- ZipFileInfoCollection.cs
- parserscommon.cs
- DrawingVisualDrawingContext.cs
- TextSelectionProcessor.cs
- XmlSchemaParticle.cs
- ColumnMapTranslator.cs
- DataGridSortCommandEventArgs.cs
- DesignObjectWrapper.cs
- InstanceOwnerException.cs
- XhtmlBasicTextViewAdapter.cs
- MailAddressCollection.cs
- Effect.cs
- SystemIcmpV4Statistics.cs
- SatelliteContractVersionAttribute.cs
- GlobalItem.cs
- InputMethod.cs
- ColorTranslator.cs
- DesignerOptionService.cs
- SystemNetworkInterface.cs