Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- TextElementAutomationPeer.cs
- QilTargetType.cs
- MediaPlayerState.cs
- CngAlgorithm.cs
- ConnectionPoolRegistry.cs
- ListViewGroupItemCollection.cs
- ByteAnimationBase.cs
- TableColumnCollectionInternal.cs
- LookupBindingPropertiesAttribute.cs
- CompositeActivityTypeDescriptor.cs
- EventLogSession.cs
- PaintValueEventArgs.cs
- Misc.cs
- LocalFileSettingsProvider.cs
- APCustomTypeDescriptor.cs
- CodeGotoStatement.cs
- ResumeStoryboard.cs
- SafeEventLogWriteHandle.cs
- GeometryDrawing.cs
- RequiredAttributeAttribute.cs
- UserInitiatedRoutedEventPermission.cs
- BlockingCollection.cs
- NamedPermissionSet.cs
- UrlAuthorizationModule.cs
- ConsoleKeyInfo.cs
- UniformGrid.cs
- SqlUdtInfo.cs
- ClientUriBehavior.cs
- PackWebResponse.cs
- HttpPostedFile.cs
- DesignTimeTemplateParser.cs
- DataGridViewAdvancedBorderStyle.cs
- CaretElement.cs
- DataGridViewLinkColumn.cs
- GestureRecognizer.cs
- QilLoop.cs
- DragEvent.cs
- SByte.cs
- ExtractorMetadata.cs
- RowToFieldTransformer.cs
- OleDbRowUpdatingEvent.cs
- WorkerRequest.cs
- HMACSHA384.cs
- ParallelDesigner.xaml.cs
- IFlowDocumentViewer.cs
- UnaryExpressionHelper.cs
- XDRSchema.cs
- HtmlInputFile.cs
- FontDialog.cs
- XmlElementAttribute.cs
- _emptywebproxy.cs
- ApplicationHost.cs
- SymbolEqualComparer.cs
- TokenBasedSet.cs
- ToolZone.cs
- Font.cs
- CleanUpVirtualizedItemEventArgs.cs
- NativeMethods.cs
- ListBindableAttribute.cs
- FileClassifier.cs
- LateBoundChannelParameterCollection.cs
- StateItem.cs
- TdsValueSetter.cs
- ExtendedPropertyDescriptor.cs
- LineProperties.cs
- Avt.cs
- QueryNode.cs
- DataControlButton.cs
- FeatureSupport.cs
- ListViewTableRow.cs
- Cursor.cs
- XPathNavigatorKeyComparer.cs
- _IPv4Address.cs
- COM2IProvidePropertyBuilderHandler.cs
- DataFormat.cs
- SyndicationFeed.cs
- TdsRecordBufferSetter.cs
- RequiredAttributeAttribute.cs
- PropertyChangingEventArgs.cs
- Rect3DConverter.cs
- SystemEvents.cs
- CellQuery.cs
- PropertyMetadata.cs
- DirectoryGroupQuery.cs
- CharacterMetricsDictionary.cs
- WorkflowCommandExtensionItem.cs
- Common.cs
- ExponentialEase.cs
- OdbcConnection.cs
- CallbackException.cs
- DispatcherSynchronizationContext.cs
- Grammar.cs
- BindStream.cs
- CatalogPart.cs
- IResourceProvider.cs
- TryExpression.cs
- CodeBlockBuilder.cs
- OdbcReferenceCollection.cs
- SerializationException.cs
- UInt32Converter.cs