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
- NodeCounter.cs
- ISCIIEncoding.cs
- PreservationFileReader.cs
- RSAPKCS1SignatureFormatter.cs
- FixedStringLookup.cs
- TrackingAnnotationCollection.cs
- AmbientProperties.cs
- UrlPath.cs
- ValidatingReaderNodeData.cs
- XmlSchemaSequence.cs
- RuleInfoComparer.cs
- EntityDataSourceWrapperCollection.cs
- FixedDocument.cs
- WindowsGrip.cs
- WarningException.cs
- UserInitiatedNavigationPermission.cs
- SchemaInfo.cs
- ExpressionBuilderContext.cs
- ConditionCollection.cs
- SqlCommandSet.cs
- GridEntry.cs
- XmlEntity.cs
- MarkedHighlightComponent.cs
- GroupByExpressionRewriter.cs
- CodeRegionDirective.cs
- CompositeControl.cs
- DropShadowBitmapEffect.cs
- cookieexception.cs
- HttpListenerContext.cs
- DbProviderFactory.cs
- ReverseInheritProperty.cs
- GenericTypeParameterConverter.cs
- CommandEventArgs.cs
- PartDesigner.cs
- QilInvokeEarlyBound.cs
- NamedPipeActivation.cs
- HwndProxyElementProvider.cs
- Assembly.cs
- InvokeWebService.cs
- HierarchicalDataSourceControl.cs
- Util.cs
- QueryReaderSettings.cs
- DynamicScriptObject.cs
- InArgumentConverter.cs
- ContextStaticAttribute.cs
- TimeZone.cs
- NativeMethods.cs
- RoleManagerModule.cs
- UrlPropertyAttribute.cs
- SqlDataSourceAdvancedOptionsForm.cs
- SchemaTypeEmitter.cs
- SqlCacheDependency.cs
- CurrencyWrapper.cs
- NamedPipeHostedTransportConfiguration.cs
- LocalFileSettingsProvider.cs
- DrawingContextWalker.cs
- NetDataContractSerializer.cs
- CodeIdentifiers.cs
- RegexNode.cs
- EntityTypeBase.cs
- Cell.cs
- BulletChrome.cs
- DesignerCategoryAttribute.cs
- SqlConnectionFactory.cs
- SByte.cs
- SqlNotificationEventArgs.cs
- HtmlControlPersistable.cs
- Solver.cs
- EtwTrace.cs
- XmlJsonWriter.cs
- GlobalEventManager.cs
- X509Certificate.cs
- ExpressionTable.cs
- DataBoundControl.cs
- UseAttributeSetsAction.cs
- InternalCache.cs
- DES.cs
- ImpersonationContext.cs
- AttributeCollection.cs
- FacetValueContainer.cs
- DeliveryRequirementsAttribute.cs
- ToolStripDropDownClosingEventArgs.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- ParameterReplacerVisitor.cs
- ReadWriteSpinLock.cs
- JpegBitmapDecoder.cs
- DataGridColumn.cs
- BypassElement.cs
- ObjectDataSourceMethodEventArgs.cs
- TimelineClockCollection.cs
- BaseProcessor.cs
- PrePrepareMethodAttribute.cs
- OleDbConnectionInternal.cs
- SchemaName.cs
- TextElement.cs
- FunctionNode.cs
- PassportAuthenticationEventArgs.cs
- ManagedFilter.cs
- BindToObject.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs