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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataReceivedEventArgs.cs
- DynamicControlParameter.cs
- RuleSettings.cs
- _TransmitFileOverlappedAsyncResult.cs
- ResourceAssociationSet.cs
- QueryExpr.cs
- RightsManagementPermission.cs
- PerformanceCounterPermissionAttribute.cs
- EntitySetBase.cs
- PeerApplicationLaunchInfo.cs
- QueryStringParameter.cs
- Font.cs
- FollowerQueueCreator.cs
- ProfileModule.cs
- BamlMapTable.cs
- WindowsStartMenu.cs
- CannotUnloadAppDomainException.cs
- SqlDataSource.cs
- EntityDataSourceColumn.cs
- PerformanceCountersElement.cs
- MeasureData.cs
- AccessibilityHelperForVista.cs
- SymLanguageVendor.cs
- DataBoundLiteralControl.cs
- CursorEditor.cs
- TextTreePropertyUndoUnit.cs
- ColorKeyFrameCollection.cs
- StylusPointCollection.cs
- FontEmbeddingManager.cs
- OleDbException.cs
- ZipIOExtraFieldElement.cs
- DataControlButton.cs
- CatalogZone.cs
- DataListItemCollection.cs
- XPathAxisIterator.cs
- BindingListCollectionView.cs
- VoiceChangeEventArgs.cs
- Range.cs
- IIS7UserPrincipal.cs
- BlurEffect.cs
- DependencyPropertyDescriptor.cs
- PathGeometry.cs
- RowBinding.cs
- PanelStyle.cs
- GridViewRowEventArgs.cs
- DbMetaDataColumnNames.cs
- TrackingServices.cs
- SchemaEntity.cs
- GeneratedContractType.cs
- ScriptReference.cs
- DataGridViewBand.cs
- SmtpNetworkElement.cs
- EditingMode.cs
- HotSpotCollection.cs
- ConstraintEnumerator.cs
- _SingleItemRequestCache.cs
- uribuilder.cs
- StyleSheet.cs
- ArrayConverter.cs
- StreamGeometryContext.cs
- SimpleHandlerFactory.cs
- XsltSettings.cs
- AuthenticationService.cs
- OverlappedAsyncResult.cs
- Literal.cs
- GuidelineCollection.cs
- AddingNewEventArgs.cs
- ConfigurationManagerHelper.cs
- Timeline.cs
- SafeTokenHandle.cs
- NativeMethods.cs
- MenuItemStyleCollection.cs
- AccessibleObject.cs
- DoubleAnimationBase.cs
- InternalControlCollection.cs
- Vector3dCollection.cs
- ConditionChanges.cs
- GetTokenRequest.cs
- DelayedRegex.cs
- UserControlCodeDomTreeGenerator.cs
- LocalizedNameDescriptionPair.cs
- Size3DConverter.cs
- PropertyEntry.cs
- CssStyleCollection.cs
- ScrollViewerAutomationPeer.cs
- NativeMethods.cs
- StateChangeEvent.cs
- shaperfactoryquerycachekey.cs
- ImageList.cs
- CodeDOMUtility.cs
- ProviderSettingsCollection.cs
- MarkupObject.cs
- ConfigXmlElement.cs
- DbReferenceCollection.cs
- ExpressionEditorAttribute.cs
- BitmapEffectInput.cs
- XmlElement.cs
- DataObjectFieldAttribute.cs
- CheckBoxBaseAdapter.cs
- PeerToPeerException.cs