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
- WmlCommandAdapter.cs
- CacheAxisQuery.cs
- ClassGenerator.cs
- NativeActivityFaultContext.cs
- ServiceObjectContainer.cs
- safex509handles.cs
- Image.cs
- ProfileBuildProvider.cs
- RuntimeHandles.cs
- basenumberconverter.cs
- ToolStripKeyboardHandlingService.cs
- BooleanAnimationUsingKeyFrames.cs
- MessageDroppedTraceRecord.cs
- LayoutDump.cs
- WindowsFormsHostAutomationPeer.cs
- DriveNotFoundException.cs
- WebControlsSection.cs
- ApplicationProxyInternal.cs
- WebPartCloseVerb.cs
- BoundingRectTracker.cs
- RegionIterator.cs
- __Filters.cs
- ProfileProvider.cs
- TraceHwndHost.cs
- SourceFileBuildProvider.cs
- Int32CollectionConverter.cs
- GridViewRowPresenterBase.cs
- rsa.cs
- ColorConvertedBitmapExtension.cs
- SelectionUIHandler.cs
- BinaryNode.cs
- BitmapCodecInfo.cs
- ConstraintStruct.cs
- EntityTemplateUserControl.cs
- SignerInfo.cs
- XamlReaderConstants.cs
- ExceptionUtil.cs
- QuestionEventArgs.cs
- DataControlLinkButton.cs
- _LazyAsyncResult.cs
- XmlTextAttribute.cs
- FrugalMap.cs
- EdgeProfileValidation.cs
- HGlobalSafeHandle.cs
- ThumbButtonInfoCollection.cs
- LayoutEngine.cs
- Tracer.cs
- CssStyleCollection.cs
- ConfigurationValue.cs
- SqlUdtInfo.cs
- DataGrid.cs
- DesigntimeLicenseContext.cs
- PlanCompilerUtil.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- DateTime.cs
- BitmapSource.cs
- PreservationFileWriter.cs
- CodePageEncoding.cs
- DynamicRendererThreadManager.cs
- IntegrationExceptionEventArgs.cs
- shaper.cs
- NamespaceEmitter.cs
- Button.cs
- Visitor.cs
- WebConfigurationHost.cs
- SID.cs
- SessionStateUtil.cs
- ComplexBindingPropertiesAttribute.cs
- AttributeParameterInfo.cs
- TextAnchor.cs
- DataGridViewColumnCollection.cs
- Authorization.cs
- FolderLevelBuildProviderCollection.cs
- ProvidePropertyAttribute.cs
- AsyncResult.cs
- RequestCacheManager.cs
- BindingExpressionBase.cs
- ElementProxy.cs
- infer.cs
- COAUTHINFO.cs
- DynamicResourceExtension.cs
- Misc.cs
- GatewayDefinition.cs
- SqlInternalConnection.cs
- ToolBarButton.cs
- UniqueIdentifierService.cs
- COM2PropertyDescriptor.cs
- RegistrySecurity.cs
- CompilationRelaxations.cs
- XmlDigitalSignatureProcessor.cs
- OperationExecutionFault.cs
- DBCommand.cs
- CorrelationManager.cs
- ColorTransform.cs
- LogicalChannel.cs
- FormCollection.cs
- ToggleButtonAutomationPeer.cs
- LinkDesigner.cs
- AppDomainUnloadedException.cs
- XmlEnumAttribute.cs