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
- WpfXamlLoader.cs
- PowerStatus.cs
- ReflectionHelper.cs
- ResourceDisplayNameAttribute.cs
- SmiRecordBuffer.cs
- MetadataArtifactLoaderComposite.cs
- ContractMapping.cs
- CompositeDataBoundControl.cs
- XmlSchemaImport.cs
- XmlSchemaIdentityConstraint.cs
- ImageMapEventArgs.cs
- LessThanOrEqual.cs
- RoutedEvent.cs
- ApplyImportsAction.cs
- OptimisticConcurrencyException.cs
- activationcontext.cs
- AssociationEndMember.cs
- DefaultShape.cs
- ImageListStreamer.cs
- MobileListItemCollection.cs
- ToolStripDropDownButton.cs
- HtmlPhoneCallAdapter.cs
- KeyEventArgs.cs
- ChannelManager.cs
- NullableIntMinMaxAggregationOperator.cs
- DataRecordInfo.cs
- AudioDeviceOut.cs
- HwndKeyboardInputProvider.cs
- ObjectNavigationPropertyMapping.cs
- XamlSerializationHelper.cs
- AlphaSortedEnumConverter.cs
- DictionarySectionHandler.cs
- DesignerTransaction.cs
- WpfWebRequestHelper.cs
- TraceLevelStore.cs
- TransformValueSerializer.cs
- userdatakeys.cs
- CommandLineParser.cs
- DataTableExtensions.cs
- DataGridColumnHeader.cs
- QueryRewriter.cs
- PageParser.cs
- LoadWorkflowCommand.cs
- X509CertificateCollection.cs
- UrlAuthorizationModule.cs
- HttpAsyncResult.cs
- _DomainName.cs
- ImageAutomationPeer.cs
- PointAnimationBase.cs
- WebPartsPersonalizationAuthorization.cs
- TdsParserStateObject.cs
- SizeLimitedCache.cs
- HttpCachePolicyWrapper.cs
- DocumentOrderQuery.cs
- OdbcPermission.cs
- StaticContext.cs
- MouseGestureConverter.cs
- MobileControlsSectionHelper.cs
- DataGridColumnCollection.cs
- EventMappingSettings.cs
- ColumnClickEvent.cs
- ToggleProviderWrapper.cs
- HitTestResult.cs
- ApplicationProxyInternal.cs
- QilTypeChecker.cs
- TextAction.cs
- IntegerValidator.cs
- AttributeCollection.cs
- GridViewCancelEditEventArgs.cs
- TextEditorCopyPaste.cs
- SafeRsaProviderHandle.cs
- RTTypeWrapper.cs
- HTMLTagNameToTypeMapper.cs
- HMAC.cs
- XmlDocument.cs
- XmlQueryOutput.cs
- QueryOperator.cs
- ResourceManager.cs
- SelectionRangeConverter.cs
- CookielessHelper.cs
- DateBoldEvent.cs
- XmlSchemaComplexContentExtension.cs
- Facet.cs
- PrintPreviewGraphics.cs
- IsolatedStorageFileStream.cs
- OleServicesContext.cs
- DateTimeOffsetAdapter.cs
- MembershipSection.cs
- MissingMethodException.cs
- CollectionConverter.cs
- SqlDataSourceCommandEventArgs.cs
- ObfuscateAssemblyAttribute.cs
- FixedSOMTextRun.cs
- FontStretches.cs
- CheckBoxStandardAdapter.cs
- HashCodeCombiner.cs
- XPathChildIterator.cs
- TextDecorationCollection.cs
- CacheSection.cs
- XmlStreamStore.cs