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
- DiscoveryCallbackBehavior.cs
- DispatcherObject.cs
- HttpConfigurationSystem.cs
- ClientBuildManagerCallback.cs
- ObjectManager.cs
- sqlstateclientmanager.cs
- MetadataPropertyCollection.cs
- UserPreferenceChangedEventArgs.cs
- AxisAngleRotation3D.cs
- AggregateNode.cs
- HttpContextWrapper.cs
- DbUpdateCommandTree.cs
- WinFormsSecurity.cs
- FrameworkElement.cs
- CacheVirtualItemsEvent.cs
- HtmlSelect.cs
- VersionValidator.cs
- CompilerCollection.cs
- Not.cs
- shaperfactoryquerycacheentry.cs
- WindowsFormsSynchronizationContext.cs
- PerfService.cs
- SoapCodeExporter.cs
- SqlVersion.cs
- ErrorHandler.cs
- TemplateAction.cs
- Page.cs
- Clause.cs
- OperationGenerator.cs
- MenuItem.cs
- EntityDataSourceContainerNameItem.cs
- sitestring.cs
- SoapUnknownHeader.cs
- SegmentInfo.cs
- SqlNotificationRequest.cs
- ServiceParser.cs
- OleDbWrapper.cs
- InvokeBase.cs
- MobileDeviceCapabilitiesSectionHandler.cs
- EtwTrace.cs
- OutputCacheSection.cs
- SqlUDTStorage.cs
- Stream.cs
- GridViewRowEventArgs.cs
- TimeoutValidationAttribute.cs
- QueryTaskGroupState.cs
- WaitForChangedResult.cs
- SerializerDescriptor.cs
- SpecialFolderEnumConverter.cs
- MimePart.cs
- CreateDataSourceDialog.cs
- DocumentStatusResources.cs
- OrderByExpression.cs
- DrawingAttributes.cs
- RepeatButtonAutomationPeer.cs
- ParallelTimeline.cs
- WebPartActionVerb.cs
- HMACSHA384.cs
- LineInfo.cs
- ListViewSelectEventArgs.cs
- altserialization.cs
- SelectionItemProviderWrapper.cs
- DependencyPropertyConverter.cs
- CapabilitiesState.cs
- LocalizedNameDescriptionPair.cs
- GridViewPageEventArgs.cs
- ObjectContext.cs
- SimpleWebHandlerParser.cs
- OutputWindow.cs
- Internal.cs
- TableHeaderCell.cs
- WebUtil.cs
- BasicKeyConstraint.cs
- LeaseManager.cs
- PeerNameRegistration.cs
- ServiceBusyException.cs
- ButtonColumn.cs
- EntityDataSourceContainerNameItem.cs
- WhitespaceRuleReader.cs
- IconConverter.cs
- OutputCacheProviderCollection.cs
- MimeImporter.cs
- LostFocusEventManager.cs
- EnumValAlphaComparer.cs
- XamlPointCollectionSerializer.cs
- ToolstripProfessionalRenderer.cs
- Container.cs
- _AuthenticationState.cs
- NamespaceCollection.cs
- FrameworkName.cs
- TemplateNameScope.cs
- MailMessageEventArgs.cs
- XsltContext.cs
- QueryGeneratorBase.cs
- CompatibleIComparer.cs
- IPipelineRuntime.cs
- PointKeyFrameCollection.cs
- Quaternion.cs
- ColorContext.cs
- SynchronousSendBindingElement.cs