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
- AvTraceFormat.cs
- VScrollProperties.cs
- ViewSimplifier.cs
- CustomTypeDescriptor.cs
- ResourceDescriptionAttribute.cs
- SqlAliaser.cs
- ListControl.cs
- WebPartTracker.cs
- AdRotatorDesigner.cs
- mediapermission.cs
- Brushes.cs
- IntSecurity.cs
- RadialGradientBrush.cs
- SQLChars.cs
- TypeExtensionConverter.cs
- LogExtent.cs
- DataGridItemAutomationPeer.cs
- RegisteredDisposeScript.cs
- ProfileManager.cs
- UnmanagedMemoryStreamWrapper.cs
- CaseInsensitiveHashCodeProvider.cs
- HtmlString.cs
- FileDialogCustomPlace.cs
- AncestorChangedEventArgs.cs
- SelectionHighlightInfo.cs
- FormatSettings.cs
- ReaderWriterLockWrapper.cs
- BindValidator.cs
- QueryOpcode.cs
- TextOnlyOutput.cs
- FormsAuthenticationConfiguration.cs
- HostingEnvironment.cs
- ThreadAbortException.cs
- Int64.cs
- ThreadExceptionDialog.cs
- LabelEditEvent.cs
- CalendarModeChangedEventArgs.cs
- ZipIOBlockManager.cs
- CachingHintValidation.cs
- WebZone.cs
- ResourceType.cs
- FileClassifier.cs
- AspNetPartialTrustHelpers.cs
- HttpListenerPrefixCollection.cs
- ChangeConflicts.cs
- DataGridTableStyleMappingNameEditor.cs
- ConversionContext.cs
- _ProxyChain.cs
- Registry.cs
- CodeFieldReferenceExpression.cs
- PropertyConverter.cs
- StrokeNode.cs
- QuaternionAnimation.cs
- WsatAdminException.cs
- OdbcReferenceCollection.cs
- Track.cs
- CopyOnWriteList.cs
- ToolStripDropDown.cs
- EventEntry.cs
- Vector3DCollection.cs
- DrawingVisualDrawingContext.cs
- XamlSerializer.cs
- ListItemConverter.cs
- EdmSchemaError.cs
- ProtocolInformationReader.cs
- elementinformation.cs
- InfoCardMetadataExchangeClient.cs
- StrongName.cs
- MediaScriptCommandRoutedEventArgs.cs
- ManualResetEvent.cs
- AttachedPropertyDescriptor.cs
- FamilyTypefaceCollection.cs
- SimpleTypeResolver.cs
- LogicalExpr.cs
- AnimationException.cs
- assertwrapper.cs
- DataServices.cs
- RepeaterItemEventArgs.cs
- FloatSumAggregationOperator.cs
- XmlCharacterData.cs
- Oid.cs
- StandardMenuStripVerb.cs
- ProtocolElement.cs
- DataPagerFieldCommandEventArgs.cs
- LabelLiteral.cs
- CompareValidator.cs
- CompoundFileDeflateTransform.cs
- fixedPageContentExtractor.cs
- DataGridViewRowPostPaintEventArgs.cs
- Scanner.cs
- SystemKeyConverter.cs
- OracleParameter.cs
- ModuleConfigurationInfo.cs
- StateChangeEvent.cs
- PathTooLongException.cs
- IDispatchConstantAttribute.cs
- RemotingAttributes.cs
- DesignerTransaction.cs
- RotationValidation.cs
- InvalidProgramException.cs