Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / UIAutomation / Win32Providers / MS / Internal / AutomationProxies / SafeCoTaskMem.cs / 1305600 / 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
- JsonClassDataContract.cs
- GenericAuthenticationEventArgs.cs
- PointAnimationClockResource.cs
- MetaData.cs
- Clipboard.cs
- CodeDirectiveCollection.cs
- DrawListViewSubItemEventArgs.cs
- XmlAnyElementAttribute.cs
- WsiProfilesElementCollection.cs
- TreeView.cs
- GridView.cs
- PositiveTimeSpanValidatorAttribute.cs
- Selector.cs
- ModulesEntry.cs
- SectionInformation.cs
- RepeatBehavior.cs
- WeakEventTable.cs
- XmlBinaryReader.cs
- MarshalDirectiveException.cs
- Model3D.cs
- CharacterShapingProperties.cs
- TypefaceMap.cs
- TextBoxAutoCompleteSourceConverter.cs
- VerticalAlignConverter.cs
- DesignerTransactionCloseEvent.cs
- Path.cs
- CompiledIdentityConstraint.cs
- IList.cs
- TypeDescriptionProvider.cs
- CapabilitiesPattern.cs
- VisualStyleInformation.cs
- DesignerVerbCollection.cs
- DataGridViewCell.cs
- DashStyle.cs
- StatusBarDrawItemEvent.cs
- ObjectItemLoadingSessionData.cs
- ReadOnlyHierarchicalDataSource.cs
- ApplicationTrust.cs
- _HeaderInfo.cs
- CheckBoxList.cs
- ConstraintConverter.cs
- SqlNodeTypeOperators.cs
- ThousandthOfEmRealPoints.cs
- TableLayoutPanelDesigner.cs
- ToolboxComponentsCreatingEventArgs.cs
- ArrayConverter.cs
- UIElementHelper.cs
- XmlCountingReader.cs
- CategoryEditor.cs
- FontConverter.cs
- ProxyDataContractResolver.cs
- SessionState.cs
- DataGridViewLayoutData.cs
- TypeLoadException.cs
- SessionState.cs
- PeerNameRecordCollection.cs
- SystemFonts.cs
- EnumerableRowCollection.cs
- TreeViewAutomationPeer.cs
- SqlProviderServices.cs
- CellTreeNodeVisitors.cs
- ModelVisual3D.cs
- DataSourceNameHandler.cs
- ListDesigner.cs
- DataStorage.cs
- documentsequencetextview.cs
- Converter.cs
- InternalControlCollection.cs
- SupportingTokenAuthenticatorSpecification.cs
- CheckedListBox.cs
- TextTreeUndo.cs
- DataTableExtensions.cs
- XmlQueryCardinality.cs
- TreeNodeStyleCollection.cs
- WsdlBuildProvider.cs
- ComEventsInfo.cs
- TTSEngineProxy.cs
- PeerContact.cs
- XmlNamespaceMappingCollection.cs
- ImplicitInputBrush.cs
- WebPartChrome.cs
- InputElement.cs
- ScrollPattern.cs
- EncryptionUtility.cs
- DocumentReferenceCollection.cs
- GetPageNumberCompletedEventArgs.cs
- PeerApplicationLaunchInfo.cs
- PropertyChangingEventArgs.cs
- TagMapCollection.cs
- DbgUtil.cs
- DataGridViewSortCompareEventArgs.cs
- NotFiniteNumberException.cs
- CompilationRelaxations.cs
- ManagementOperationWatcher.cs
- NameValueSectionHandler.cs
- DataGridViewTopRowAccessibleObject.cs
- EntityCommand.cs
- TemplateBaseAction.cs
- TraceLevelStore.cs
- RemoteWebConfigurationHostServer.cs