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
- ConfigurationStrings.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- RbTree.cs
- SessionStateContainer.cs
- _NetRes.cs
- DataViewSetting.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- TreeViewCancelEvent.cs
- NegationPusher.cs
- TextComposition.cs
- SliderAutomationPeer.cs
- ResponseStream.cs
- XmlUnspecifiedAttribute.cs
- FormViewUpdateEventArgs.cs
- MultiPartWriter.cs
- StaticDataManager.cs
- XmlCharCheckingReader.cs
- CornerRadius.cs
- XPathNodeList.cs
- RawAppCommandInputReport.cs
- CodeGenerator.cs
- AssemblyHash.cs
- HttpDictionary.cs
- versioninfo.cs
- BitConverter.cs
- RequestContextBase.cs
- Confirm.cs
- WinFormsComponentEditor.cs
- StorageBasedPackageProperties.cs
- WindowsEditBox.cs
- DriveNotFoundException.cs
- ModifierKeysConverter.cs
- XPathAncestorQuery.cs
- AsymmetricSignatureFormatter.cs
- ObjectListItemCollection.cs
- OleDbPermission.cs
- CompareValidator.cs
- Util.cs
- exports.cs
- WindowsUpDown.cs
- InputLanguageSource.cs
- XmlSchemaInclude.cs
- MarkedHighlightComponent.cs
- FieldDescriptor.cs
- ConnectorSelectionGlyph.cs
- SingleQueryOperator.cs
- SecurityUtils.cs
- ListViewContainer.cs
- EventMappingSettingsCollection.cs
- StateItem.cs
- SMSvcHost.cs
- Span.cs
- NoneExcludedImageIndexConverter.cs
- HtmlValidationSummaryAdapter.cs
- MergeFilterQuery.cs
- ManagedWndProcTracker.cs
- ValueQuery.cs
- GridEntry.cs
- AssociationEndMember.cs
- DataPointer.cs
- AsymmetricKeyExchangeDeformatter.cs
- CodeCompileUnit.cs
- ViewCellSlot.cs
- WebPartMenuStyle.cs
- BuildProviderAppliesToAttribute.cs
- CachedFontFamily.cs
- GeneralEndpointIdentity.cs
- ArglessEventHandlerProxy.cs
- Errors.cs
- StorageAssociationTypeMapping.cs
- WebControlsSection.cs
- HwndHost.cs
- GC.cs
- EventRouteFactory.cs
- WaveHeader.cs
- LocalizeDesigner.cs
- WindowHideOrCloseTracker.cs
- DefaultTextStore.cs
- ComAdminInterfaces.cs
- LayoutEvent.cs
- Partitioner.cs
- AssemblyAttributes.cs
- HttpCachePolicyElement.cs
- ItemCollection.cs
- UIElement.cs
- OutKeywords.cs
- WebPartZoneBase.cs
- DataGridLinkButton.cs
- ErrorInfoXmlDocument.cs
- HtmlTernaryTree.cs
- Italic.cs
- TextTreeUndoUnit.cs
- ManagementClass.cs
- MetadataFile.cs
- ReflectionUtil.cs
- HttpCookieCollection.cs
- FormattedText.cs
- IntSecurity.cs
- QueryConverter.cs
- SupportsEventValidationAttribute.cs