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
- PaperSize.cs
- CompiledQuery.cs
- ChannelDispatcherCollection.cs
- RoutedEventConverter.cs
- ExceptionValidationRule.cs
- WsatAdminException.cs
- UTF8Encoding.cs
- unitconverter.cs
- EntityFrameworkVersions.cs
- FillErrorEventArgs.cs
- SystemUdpStatistics.cs
- HMACSHA512.cs
- GlyphTypeface.cs
- SetStoryboardSpeedRatio.cs
- OrderedDictionaryStateHelper.cs
- ActionItem.cs
- SecureStringHasher.cs
- WindowInteropHelper.cs
- RegistryKey.cs
- Brushes.cs
- UserControl.cs
- XmlQueryOutput.cs
- BindingExpressionBase.cs
- ExpressionPrefixAttribute.cs
- DefaultValueConverter.cs
- XmlILTrace.cs
- EpmSourcePathSegment.cs
- RuntimeWrappedException.cs
- FrameworkElement.cs
- ConstrainedGroup.cs
- TextElementEnumerator.cs
- Table.cs
- PeerApplication.cs
- DocumentsTrace.cs
- AppSecurityManager.cs
- CreateUserWizard.cs
- EntityTypeBase.cs
- RuntimeConfigurationRecord.cs
- GradientStop.cs
- DataGridLinkButton.cs
- DataErrorValidationRule.cs
- embossbitmapeffect.cs
- TableRowGroupCollection.cs
- XmlUtil.cs
- Bidi.cs
- InlineObject.cs
- ObjectResult.cs
- CompiledRegexRunnerFactory.cs
- Sentence.cs
- SerializationBinder.cs
- RegexInterpreter.cs
- SoapSchemaImporter.cs
- TransportOutputChannel.cs
- SrgsItemList.cs
- GridViewRow.cs
- RecordsAffectedEventArgs.cs
- ConfigurationSettings.cs
- KeyValueInternalCollection.cs
- AsymmetricSecurityBindingElement.cs
- CancellationTokenRegistration.cs
- Table.cs
- ExceptionList.cs
- NameService.cs
- TemplateField.cs
- ExpandCollapseProviderWrapper.cs
- TdsParser.cs
- ScrollBarAutomationPeer.cs
- webproxy.cs
- TaskHelper.cs
- WebConvert.cs
- EditorPartChrome.cs
- GlyphInfoList.cs
- ListViewPagedDataSource.cs
- ToolStripSplitStackLayout.cs
- OpCopier.cs
- IntAverageAggregationOperator.cs
- TabOrder.cs
- ProfileProvider.cs
- IriParsingElement.cs
- DataGridTextBoxColumn.cs
- CodeGen.cs
- RuleSettingsCollection.cs
- MulticastDelegate.cs
- XmlAttributes.cs
- ListManagerBindingsCollection.cs
- ComponentConverter.cs
- SessionParameter.cs
- PeerContact.cs
- HttpConfigurationContext.cs
- ListViewDeleteEventArgs.cs
- BinHexDecoder.cs
- WebMethodAttribute.cs
- ThreadStaticAttribute.cs
- StylusPointProperty.cs
- InstallerTypeAttribute.cs
- DefaultValueConverter.cs
- RemotingException.cs
- AjaxFrameworkAssemblyAttribute.cs
- MenuAdapter.cs
- SoapFormatterSinks.cs