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
- PersonalizationStateInfoCollection.cs
- PolicyValidationException.cs
- HtmlInputReset.cs
- TransactionInterop.cs
- TypeHelpers.cs
- SspiNegotiationTokenAuthenticator.cs
- BlurEffect.cs
- SystemColorTracker.cs
- IChannel.cs
- CssStyleCollection.cs
- WindowsListViewSubItem.cs
- SqlMethods.cs
- StyleHelper.cs
- TagMapCollection.cs
- Schedule.cs
- control.ime.cs
- IPGlobalProperties.cs
- WindowsProgressbar.cs
- JumpList.cs
- QuaternionAnimation.cs
- OptimisticConcurrencyException.cs
- ListViewGroup.cs
- IisTraceWebEventProvider.cs
- SrgsItemList.cs
- MapPathBasedVirtualPathProvider.cs
- CharAnimationUsingKeyFrames.cs
- CapabilitiesRule.cs
- FontWeights.cs
- EnumerableRowCollectionExtensions.cs
- BitmapFrameDecode.cs
- FrugalList.cs
- ReaderWriterLock.cs
- ProgressBarBrushConverter.cs
- BamlTreeUpdater.cs
- DataGridColumnCollectionEditor.cs
- NumericUpDownAccelerationCollection.cs
- ListItemCollection.cs
- DocumentOrderComparer.cs
- ImageCollectionCodeDomSerializer.cs
- RuntimeIdentifierPropertyAttribute.cs
- DataFormats.cs
- OracleCommandSet.cs
- RectangleConverter.cs
- RegexCapture.cs
- odbcmetadatacolumnnames.cs
- ZipFileInfo.cs
- OutputCacheModule.cs
- AudioBase.cs
- HostingEnvironmentSection.cs
- VisualBrush.cs
- SchemaSetCompiler.cs
- WsatStrings.cs
- PagedControl.cs
- _FixedSizeReader.cs
- Pool.cs
- GcSettings.cs
- SqlUserDefinedTypeAttribute.cs
- NonSerializedAttribute.cs
- MediaScriptCommandRoutedEventArgs.cs
- PropertyRecord.cs
- FontStretchConverter.cs
- ZipIOBlockManager.cs
- StateWorkerRequest.cs
- DbConnectionFactory.cs
- SelectionProcessor.cs
- PolyLineSegmentFigureLogic.cs
- CompositeCollection.cs
- WpfKnownType.cs
- SafeArchiveContext.cs
- PriorityBinding.cs
- XmlImplementation.cs
- SqlProfileProvider.cs
- DataRowExtensions.cs
- TextViewBase.cs
- Single.cs
- AttributeInfo.cs
- AdornedElementPlaceholder.cs
- PropertyFilter.cs
- SafeEventLogWriteHandle.cs
- DataTrigger.cs
- UpWmlPageAdapter.cs
- XhtmlBasicLabelAdapter.cs
- FixedDocumentPaginator.cs
- TextBlock.cs
- ISAPIApplicationHost.cs
- AlgoModule.cs
- WmlPhoneCallAdapter.cs
- CustomErrorsSection.cs
- BaseCodeDomTreeGenerator.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- DataFieldEditor.cs
- OwnerDrawPropertyBag.cs
- PeerObject.cs
- SafeCertificateStore.cs
- ChannelBinding.cs
- CodeFieldReferenceExpression.cs
- TreeViewImageKeyConverter.cs
- Rotation3D.cs
- Converter.cs
- WebPartTracker.cs