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
- ComponentEditorForm.cs
- HybridDictionary.cs
- FixedDSBuilder.cs
- StrokeNodeOperations2.cs
- X509Certificate.cs
- DateTimeFormat.cs
- WorkflowRuntimeBehavior.cs
- NumberFormatInfo.cs
- ControlTemplate.cs
- PerformanceCounterPermission.cs
- ToolStripItemClickedEventArgs.cs
- GridViewCancelEditEventArgs.cs
- JournalEntryStack.cs
- ApplicationInfo.cs
- CollectionMarkupSerializer.cs
- ObjectContext.cs
- InsufficientMemoryException.cs
- XmlAttributeOverrides.cs
- SHA256.cs
- BaseHashHelper.cs
- TraceListener.cs
- KeysConverter.cs
- ProcessHostConfigUtils.cs
- FontDriver.cs
- AddInStore.cs
- NeutralResourcesLanguageAttribute.cs
- NavigatingCancelEventArgs.cs
- QuaternionKeyFrameCollection.cs
- CancellationToken.cs
- XPathAncestorQuery.cs
- CalloutQueueItem.cs
- Image.cs
- HtmlProps.cs
- StateMachineWorkflowInstance.cs
- dtdvalidator.cs
- LockedActivityGlyph.cs
- PersonalizationDictionary.cs
- RequestValidator.cs
- MediaElement.cs
- HtmlControlPersistable.cs
- Page.cs
- DependencyObjectType.cs
- WindowProviderWrapper.cs
- ToolStripItemEventArgs.cs
- Rotation3D.cs
- StackSpiller.Generated.cs
- _CookieModule.cs
- Timer.cs
- JpegBitmapDecoder.cs
- XsltConvert.cs
- TraceSwitch.cs
- XmlRawWriter.cs
- MenuScrollingVisibilityConverter.cs
- AssemblySettingAttributes.cs
- InternalConfigEventArgs.cs
- SafeProcessHandle.cs
- TransactionScope.cs
- ClientCredentialsSecurityTokenManager.cs
- EntityViewGenerationConstants.cs
- BindingGroup.cs
- ParentUndoUnit.cs
- Utils.cs
- XmlNullResolver.cs
- OrthographicCamera.cs
- RedirectionProxy.cs
- OleTxTransaction.cs
- DataViewListener.cs
- ListBase.cs
- NavigationPropertyEmitter.cs
- ValidationRuleCollection.cs
- ProxyAttribute.cs
- FontDialog.cs
- DocumentGrid.cs
- Intellisense.cs
- MDIClient.cs
- StringReader.cs
- CompiledIdentityConstraint.cs
- ComNativeDescriptor.cs
- IResourceProvider.cs
- SimpleWorkerRequest.cs
- PermissionSet.cs
- XslTransform.cs
- TrackingServices.cs
- IndividualDeviceConfig.cs
- TextProperties.cs
- CollectionDataContract.cs
- ContactManager.cs
- SqlHelper.cs
- PieceNameHelper.cs
- ServicesUtilities.cs
- WebPartVerbCollection.cs
- XmlNodeReader.cs
- Win32.cs
- ControlBuilderAttribute.cs
- ElementProxy.cs
- PrintDocument.cs
- ConfigurationSchemaErrors.cs
- CfgParser.cs
- DictionaryGlobals.cs
- Variant.cs