Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Media / safemediahandle.cs / 1 / safemediahandle.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, All Rights Reserved. // // File: SafeMediaHandle.cs // //----------------------------------------------------------------------------- using System; using System.IO; using System.Security; using System.Security.Permissions; using System.Collections; using System.Reflection; using MS.Internal; using MS.Win32; using System.Diagnostics; using System.Windows.Media; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32.SafeHandles; using UnsafeNativeMethods=MS.Win32.PresentationCore.UnsafeNativeMethods; namespace System.Windows.Media { internal class SafeMediaHandle : SafeMILHandle { ////// internal SafeMediaHandle() { } ////// ////// Critical: calls SafeHandle.SetHandle which LinkDemands /// also takes arbitrary IntPtr as a handle /// [SecurityCritical] internal SafeMediaHandle(IntPtr handle) { SetHandle(handle); } ////// Critical - calls unmanaged code, not treat as safe because you must /// validate that handle is a valid COM object. /// [SecurityCritical] protected override bool ReleaseHandle() { HRESULT.Check(MILMedia.Shutdown(handle)); UnsafeNativeMethods.MILUnknown.ReleaseInterface(ref handle); return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, All Rights Reserved. // // File: SafeMediaHandle.cs // //----------------------------------------------------------------------------- using System; using System.IO; using System.Security; using System.Security.Permissions; using System.Collections; using System.Reflection; using MS.Internal; using MS.Win32; using System.Diagnostics; using System.Windows.Media; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using Microsoft.Win32.SafeHandles; using UnsafeNativeMethods=MS.Win32.PresentationCore.UnsafeNativeMethods; namespace System.Windows.Media { internal class SafeMediaHandle : SafeMILHandle { ////// internal SafeMediaHandle() { } ////// ////// Critical: calls SafeHandle.SetHandle which LinkDemands /// also takes arbitrary IntPtr as a handle /// [SecurityCritical] internal SafeMediaHandle(IntPtr handle) { SetHandle(handle); } ////// Critical - calls unmanaged code, not treat as safe because you must /// validate that handle is a valid COM object. /// [SecurityCritical] protected override bool ReleaseHandle() { HRESULT.Check(MILMedia.Shutdown(handle)); UnsafeNativeMethods.MILUnknown.ReleaseInterface(ref 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
- StorageBasedPackageProperties.cs
- ClipboardData.cs
- ExecutedRoutedEventArgs.cs
- FragmentQuery.cs
- MLangCodePageEncoding.cs
- BaseValidator.cs
- TraceContextRecord.cs
- ArraySet.cs
- GeneratedView.cs
- XmlObjectSerializerWriteContext.cs
- RichTextBoxDesigner.cs
- CursorConverter.cs
- _Win32.cs
- AspCompat.cs
- Int32RectConverter.cs
- Compensate.cs
- TextRenderer.cs
- ListParaClient.cs
- FormsAuthenticationTicket.cs
- ObjectDataSource.cs
- StorageEntityContainerMapping.cs
- SerializationStore.cs
- WhileDesigner.cs
- APCustomTypeDescriptor.cs
- ISAPIWorkerRequest.cs
- DocumentXPathNavigator.cs
- EntityObject.cs
- odbcmetadatacolumnnames.cs
- HybridDictionary.cs
- DelimitedListTraceListener.cs
- SByteConverter.cs
- ModuleElement.cs
- DateTimeParse.cs
- ListViewGroup.cs
- AnchoredBlock.cs
- ArraySegment.cs
- ProcessHostFactoryHelper.cs
- SafeRegistryHandle.cs
- QuaternionKeyFrameCollection.cs
- TCEAdapterGenerator.cs
- EncoderBestFitFallback.cs
- WebSysDescriptionAttribute.cs
- WorkItem.cs
- StylusDevice.cs
- MimeFormReflector.cs
- CaseInsensitiveOrdinalStringComparer.cs
- SafeFileMappingHandle.cs
- TargetException.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- ServiceContractListItemList.cs
- AvTraceDetails.cs
- PageBreakRecord.cs
- DoubleLinkListEnumerator.cs
- SoapAttributes.cs
- ellipse.cs
- EntryPointNotFoundException.cs
- WebBrowserProgressChangedEventHandler.cs
- DateTimeConverter2.cs
- InheritanceService.cs
- InstanceDataCollectionCollection.cs
- FixedSOMElement.cs
- NonClientArea.cs
- ProtectedConfiguration.cs
- ValidationHelpers.cs
- GridViewDeletedEventArgs.cs
- MarkupExtensionParser.cs
- CollectionBuilder.cs
- OptimalBreakSession.cs
- WeakEventManager.cs
- PeoplePickerWrapper.cs
- IncrementalReadDecoders.cs
- GridViewRowEventArgs.cs
- DelegatingStream.cs
- Empty.cs
- ClientUtils.cs
- StoragePropertyMapping.cs
- EditorAttribute.cs
- MetadataSource.cs
- RsaSecurityKey.cs
- XmlDigitalSignatureProcessor.cs
- RoleManagerModule.cs
- GraphicsPath.cs
- XamlVector3DCollectionSerializer.cs
- JobCollate.cs
- Descriptor.cs
- InkPresenter.cs
- EntityDataSourceDesignerHelper.cs
- IisTraceWebEventProvider.cs
- XmlSchemaAnyAttribute.cs
- TextBoxBase.cs
- dbdatarecord.cs
- COM2EnumConverter.cs
- RewritingValidator.cs
- ExternalException.cs
- DataBoundControlAdapter.cs
- Equal.cs
- ImageListImage.cs
- TypeDescriptionProvider.cs
- DataColumnPropertyDescriptor.cs
- DataGridCommandEventArgs.cs