Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / safemediahandle.cs / 1305600 / 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
- ListViewGroupItemCollection.cs
- MetadataSource.cs
- Stroke.cs
- VisualTarget.cs
- GeneralEndpointIdentity.cs
- ToolStripDropDownButton.cs
- DrawingBrush.cs
- XmlSignatureProperties.cs
- cookieexception.cs
- SHA512Cng.cs
- documentsequencetextview.cs
- Point3DAnimationBase.cs
- Attributes.cs
- WebResourceAttribute.cs
- HandleExceptionArgs.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- BindingNavigator.cs
- PropertyGroupDescription.cs
- CompilerTypeWithParams.cs
- Matrix3DValueSerializer.cs
- CookieProtection.cs
- SaveFileDialog.cs
- DropDownList.cs
- XhtmlBasicListAdapter.cs
- GridViewHeaderRowPresenter.cs
- SourceFilter.cs
- ActiveXMessageFormatter.cs
- CodeLinePragma.cs
- Ray3DHitTestResult.cs
- ConfigPathUtility.cs
- GAC.cs
- PerfCounterSection.cs
- SoapAttributeAttribute.cs
- SmtpNetworkElement.cs
- EventArgs.cs
- SplineQuaternionKeyFrame.cs
- ProcessInfo.cs
- TypedTableBaseExtensions.cs
- HttpCookieCollection.cs
- NegotiateStream.cs
- SocketException.cs
- Point3DCollection.cs
- IODescriptionAttribute.cs
- AmbientValueAttribute.cs
- SqlCommandBuilder.cs
- SecurityTokenException.cs
- AudioFormatConverter.cs
- DataServiceResponse.cs
- DataGridViewColumn.cs
- TextTabProperties.cs
- unsafenativemethodsother.cs
- HtmlForm.cs
- DispatchOperationRuntime.cs
- XmlDeclaration.cs
- SecurityPolicySection.cs
- FolderBrowserDialog.cs
- TextMarkerSource.cs
- _HeaderInfoTable.cs
- IPAddressCollection.cs
- DLinqColumnProvider.cs
- MessageEncoderFactory.cs
- SqlDataReader.cs
- TextBoxBase.cs
- OletxTransactionManager.cs
- ScriptHandlerFactory.cs
- DrawListViewColumnHeaderEventArgs.cs
- BamlLocalizableResource.cs
- CompositeTypefaceMetrics.cs
- SqlNodeAnnotations.cs
- XPathSingletonIterator.cs
- AutoResizedEvent.cs
- HttpListenerRequestTraceRecord.cs
- SafeWaitHandle.cs
- EntryPointNotFoundException.cs
- SiteMapDataSource.cs
- PasswordTextContainer.cs
- GradientBrush.cs
- MouseButtonEventArgs.cs
- NotifyCollectionChangedEventArgs.cs
- SectionVisual.cs
- ClientConfigurationHost.cs
- RequestReplyCorrelator.cs
- XNodeValidator.cs
- DisposableCollectionWrapper.cs
- GeometryGroup.cs
- LabelDesigner.cs
- Native.cs
- UriTemplateVariablePathSegment.cs
- LinqDataSourceStatusEventArgs.cs
- ExpressionLexer.cs
- DrawListViewColumnHeaderEventArgs.cs
- ThrowHelper.cs
- SessionStateSection.cs
- EraserBehavior.cs
- LicenseManager.cs
- NativeActivity.cs
- GenericUI.cs
- MobileCategoryAttribute.cs
- PhysicalAddress.cs
- SimpleApplicationHost.cs