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
- StructuredProperty.cs
- MatrixUtil.cs
- DataGridViewUtilities.cs
- Visual3DCollection.cs
- HttpPostedFileWrapper.cs
- IDQuery.cs
- SystemUnicastIPAddressInformation.cs
- DataGridViewImageColumn.cs
- StorageEntitySetMapping.cs
- ComplexType.cs
- SettingsProviderCollection.cs
- SymbolMethod.cs
- StretchValidation.cs
- DataListItemEventArgs.cs
- ResourcePermissionBaseEntry.cs
- ZipFileInfo.cs
- OrCondition.cs
- SyndicationSerializer.cs
- LicenseException.cs
- cache.cs
- Decoder.cs
- ApplicationDirectory.cs
- DataView.cs
- CacheForPrimitiveTypes.cs
- DataSvcMapFileSerializer.cs
- ISAPIWorkerRequest.cs
- WSIdentityFaultException.cs
- ObjectDataSourceView.cs
- CatalogPartCollection.cs
- PageSetupDialog.cs
- XmlNodeComparer.cs
- UserValidatedEventArgs.cs
- Comparer.cs
- MatrixUtil.cs
- ItemPager.cs
- XmlHierarchicalDataSourceView.cs
- TraceSection.cs
- ExtendedPropertyInfo.cs
- ConsumerConnectionPointCollection.cs
- FileController.cs
- PropertyDescriptor.cs
- Accessors.cs
- XMLSyntaxException.cs
- UriScheme.cs
- WebPageTraceListener.cs
- AttachInfo.cs
- HyperLinkStyle.cs
- KeyedHashAlgorithm.cs
- DialogDivider.cs
- OptimizedTemplateContent.cs
- ColorBuilder.cs
- ECDsa.cs
- FilterableAttribute.cs
- EraserBehavior.cs
- ZipIOCentralDirectoryBlock.cs
- ConfigurationSchemaErrors.cs
- EnumValAlphaComparer.cs
- NavigationExpr.cs
- VisualProxy.cs
- LabelLiteral.cs
- MonthCalendar.cs
- ApplicationContext.cs
- VScrollProperties.cs
- LicFileLicenseProvider.cs
- WebPartDisplayModeCollection.cs
- Types.cs
- SqlComparer.cs
- MimeParameterWriter.cs
- MeasureData.cs
- SQLMoneyStorage.cs
- SystemIPGlobalStatistics.cs
- StorageAssociationSetMapping.cs
- DataGridViewImageColumn.cs
- StateChangeEvent.cs
- DataRelation.cs
- TableItemStyle.cs
- EntityException.cs
- LocalizableResourceBuilder.cs
- TokenFactoryFactory.cs
- webbrowsersite.cs
- DataRelation.cs
- StringFreezingAttribute.cs
- BamlLocalizableResource.cs
- XmlLanguage.cs
- WindowsServiceElement.cs
- SqlUserDefinedAggregateAttribute.cs
- ProxyWebPartManager.cs
- WpfGeneratedKnownProperties.cs
- IResourceProvider.cs
- SqlConnectionFactory.cs
- GetPageCompletedEventArgs.cs
- FactoryMaker.cs
- TypeGeneratedEventArgs.cs
- WindowsRichEditRange.cs
- DbConnectionHelper.cs
- TreeViewImageIndexConverter.cs
- ToolStripControlHost.cs
- WindowsTokenRoleProvider.cs
- WebPartVerb.cs
- ZipIOCentralDirectoryBlock.cs