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
- NativeMethods.cs
- mda.cs
- LogManagementAsyncResult.cs
- EntityClassGenerator.cs
- DesignerPerfEventProvider.cs
- SmiGettersStream.cs
- InstanceLockedException.cs
- DataFormat.cs
- CharEnumerator.cs
- CodeBinaryOperatorExpression.cs
- XmlAttributeAttribute.cs
- TableRow.cs
- ServiceProviders.cs
- MasterPageParser.cs
- TypeUtil.cs
- ValueConversionAttribute.cs
- IndentedWriter.cs
- FontSourceCollection.cs
- SapiGrammar.cs
- PropertyItem.cs
- DeferredTextReference.cs
- BaseEntityWrapper.cs
- WebPartEventArgs.cs
- ColumnWidthChangingEvent.cs
- IgnoreFlushAndCloseStream.cs
- VirtualDirectoryMappingCollection.cs
- WindowsStatusBar.cs
- SortedSetDebugView.cs
- ArrayConverter.cs
- StrokeNodeEnumerator.cs
- ContainsRowNumberChecker.cs
- serverconfig.cs
- SafePEFileHandle.cs
- XmlEnumAttribute.cs
- TemplateControl.cs
- ReadOnlyDataSourceView.cs
- XpsResourceDictionary.cs
- NavigateEvent.cs
- ScaleTransform3D.cs
- RuntimeHelpers.cs
- ContentPosition.cs
- XmlSchemaNotation.cs
- ControlValuePropertyAttribute.cs
- FileSystemEventArgs.cs
- NavigateUrlConverter.cs
- SiteMapPath.cs
- ItemCheckedEvent.cs
- FindSimilarActivitiesVerb.cs
- BinHexDecoder.cs
- CodeExporter.cs
- AdvancedBindingPropertyDescriptor.cs
- IsolatedStorageFileStream.cs
- ByteKeyFrameCollection.cs
- CacheMemory.cs
- GridSplitter.cs
- RuntimeIdentifierPropertyAttribute.cs
- NetworkStream.cs
- GacUtil.cs
- ConfigurationManagerHelperFactory.cs
- RuntimeConfigurationRecord.cs
- StateChangeEvent.cs
- WebPartsPersonalizationAuthorization.cs
- CatalogPart.cs
- TreeViewItem.cs
- SortedSet.cs
- SecurityCredentialsManager.cs
- TemplatePropertyEntry.cs
- BinaryReader.cs
- FlowSwitchLink.cs
- SystemIcmpV6Statistics.cs
- WorkflowRuntimeService.cs
- CommandField.cs
- EditorZoneAutoFormat.cs
- Axis.cs
- TableStyle.cs
- SchemaImporterExtensionElementCollection.cs
- DataSourceGeneratorException.cs
- UniqueID.cs
- PeerServiceMessageContracts.cs
- ImageCodecInfoPrivate.cs
- CommandDevice.cs
- Vector3D.cs
- Odbc32.cs
- ContextItem.cs
- ActivitiesCollection.cs
- ResourceProviderFactory.cs
- WebReference.cs
- Stylesheet.cs
- ZipIOLocalFileHeader.cs
- DetailsViewUpdateEventArgs.cs
- ImageMapEventArgs.cs
- __Error.cs
- CodeAccessPermission.cs
- SmiXetterAccessMap.cs
- DataGridViewTextBoxCell.cs
- Window.cs
- TemplatedMailWebEventProvider.cs
- SoapObjectReader.cs
- KnownTypeDataContractResolver.cs
- EnumerableWrapperWeakToStrong.cs