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
- SchemaReference.cs
- ObjectViewFactory.cs
- SecuritySessionFilter.cs
- CustomAttribute.cs
- OverflowException.cs
- ToolStripTextBox.cs
- DbMetaDataCollectionNames.cs
- SoapTransportImporter.cs
- CqlIdentifiers.cs
- ToolStripRenderEventArgs.cs
- WebControlParameterProxy.cs
- PopOutPanel.cs
- ClientScriptItemCollection.cs
- SecurityKeyIdentifier.cs
- SmiMetaData.cs
- DateTimeOffsetConverter.cs
- XmlDataSourceDesigner.cs
- ErrorInfoXmlDocument.cs
- COM2PropertyBuilderUITypeEditor.cs
- HtmlForm.cs
- BlurEffect.cs
- TableLayout.cs
- VectorCollectionConverter.cs
- ViewStateModeByIdAttribute.cs
- Padding.cs
- DataGridViewColumnCollectionDialog.cs
- Color.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- _Events.cs
- PageRequestManager.cs
- BitmapEffectInputConnector.cs
- DbConnectionFactory.cs
- SmiEventSink_Default.cs
- XmlReflectionImporter.cs
- DescendantBaseQuery.cs
- BasePattern.cs
- x509utils.cs
- LeafCellTreeNode.cs
- QuaternionAnimation.cs
- BufferBuilder.cs
- TemplateControl.cs
- Operand.cs
- HandleCollector.cs
- ProfileManager.cs
- Int16Animation.cs
- hebrewshape.cs
- MethodBuilderInstantiation.cs
- RotateTransform.cs
- AuthenticationSection.cs
- PrimaryKeyTypeConverter.cs
- Application.cs
- XappLauncher.cs
- FieldNameLookup.cs
- LazyTextWriterCreator.cs
- EventHandlersStore.cs
- XpsImageSerializationService.cs
- PropertySourceInfo.cs
- ServiceManager.cs
- EndpointReference.cs
- ClientRoleProvider.cs
- FullTextLine.cs
- Normalizer.cs
- TextEditorSpelling.cs
- TransformerInfoCollection.cs
- Item.cs
- TimeSpanFormat.cs
- ModifierKeysConverter.cs
- VisualTreeUtils.cs
- DropShadowBitmapEffect.cs
- PropertyInfoSet.cs
- BaseTemplateBuildProvider.cs
- AdRotator.cs
- DocumentPageViewAutomationPeer.cs
- RtfControlWordInfo.cs
- ConfigXmlAttribute.cs
- ExpressionSelection.cs
- Encoder.cs
- DependencyPropertyChangedEventArgs.cs
- EntityDataSourceChangedEventArgs.cs
- StringValidatorAttribute.cs
- PolyQuadraticBezierSegment.cs
- PointLightBase.cs
- ProvideValueServiceProvider.cs
- ParallelTimeline.cs
- ToolstripProfessionalRenderer.cs
- FontDialog.cs
- FacetDescriptionElement.cs
- XmlILAnnotation.cs
- EditorServiceContext.cs
- SqlProviderManifest.cs
- EnumDataContract.cs
- Camera.cs
- PreviewKeyDownEventArgs.cs
- PeerSecurityHelpers.cs
- OrderByBuilder.cs
- IERequestCache.cs
- JsonSerializer.cs
- ExcludePathInfo.cs
- Array.cs
- QueueAccessMode.cs