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
- SpecularMaterial.cs
- CodeBinaryOperatorExpression.cs
- OrderByExpression.cs
- SolidColorBrush.cs
- EndpointDiscoveryMetadataCD1.cs
- WarningException.cs
- ScalarType.cs
- XmlNodeReader.cs
- IsolatedStorageFilePermission.cs
- TabItemAutomationPeer.cs
- SignatureToken.cs
- DbParameterCollectionHelper.cs
- InvalidOleVariantTypeException.cs
- ProfileServiceManager.cs
- TextServicesManager.cs
- ToolStripItem.cs
- DataListItem.cs
- DataServiceQueryOfT.cs
- Point3DKeyFrameCollection.cs
- TextDecorationCollection.cs
- FacetEnabledSchemaElement.cs
- ListBindingHelper.cs
- OdbcConnectionFactory.cs
- MarkupProperty.cs
- ProviderSettings.cs
- QuadraticBezierSegment.cs
- IsolatedStorageFileStream.cs
- SafeHandles.cs
- SettingsPropertyNotFoundException.cs
- PropertyRef.cs
- UIElement3D.cs
- QilXmlReader.cs
- DeadCharTextComposition.cs
- StringDictionaryEditor.cs
- ExpressionBuilder.cs
- GroupBox.cs
- EventLogException.cs
- ConcurrentQueue.cs
- SvcMapFile.cs
- XhtmlBasicFormAdapter.cs
- DecoderExceptionFallback.cs
- ParserExtension.cs
- MsmqTransportSecurity.cs
- NumberFormatter.cs
- Type.cs
- ProxyWebPartManagerDesigner.cs
- TaskFileService.cs
- ExportFileRequest.cs
- HelpKeywordAttribute.cs
- NumericUpDownAcceleration.cs
- TagPrefixCollection.cs
- PtsHelper.cs
- FlagsAttribute.cs
- securitymgrsite.cs
- DispatcherFrame.cs
- DefaultBinder.cs
- ClockController.cs
- XsdBuilder.cs
- Trace.cs
- MultiDataTrigger.cs
- SynchronizedMessageSource.cs
- TreeSet.cs
- DescendantQuery.cs
- ChangesetResponse.cs
- FixedNode.cs
- FilterEventArgs.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- DockingAttribute.cs
- MethodToken.cs
- MobileCategoryAttribute.cs
- LocalValueEnumerator.cs
- MaterializeFromAtom.cs
- ValidationRule.cs
- _SslStream.cs
- PatternMatcher.cs
- EntityDataSourceConfigureObjectContext.cs
- LinkDescriptor.cs
- DataServiceHostFactory.cs
- Sql8ConformanceChecker.cs
- WebPartDisplayModeCollection.cs
- HostedHttpRequestAsyncResult.cs
- BasePattern.cs
- LogicalExpr.cs
- PagesSection.cs
- NavigatingCancelEventArgs.cs
- NavigationPropertyEmitter.cs
- HttpStreamXmlDictionaryWriter.cs
- _AutoWebProxyScriptHelper.cs
- IDReferencePropertyAttribute.cs
- CollectionTypeElement.cs
- TextTreeInsertElementUndoUnit.cs
- QueryResult.cs
- DispatcherExceptionEventArgs.cs
- PeerPresenceInfo.cs
- EntityContainer.cs
- StaticSiteMapProvider.cs
- LayoutInformation.cs
- CommentEmitter.cs
- ZipIOCentralDirectoryBlock.cs
- BuildResult.cs