Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- ConnectionsZone.cs
- SqlDataReader.cs
- ExtendedProtectionPolicy.cs
- PrivilegeNotHeldException.cs
- PersonalizablePropertyEntry.cs
- ExplicitDiscriminatorMap.cs
- SingleAnimationUsingKeyFrames.cs
- BindToObject.cs
- DatasetMethodGenerator.cs
- FileLevelControlBuilderAttribute.cs
- PrintDialogDesigner.cs
- Error.cs
- PageAsyncTaskManager.cs
- SQLMoneyStorage.cs
- InputLanguage.cs
- GeneratedView.cs
- ProcessHost.cs
- CompilationUtil.cs
- WebSysDisplayNameAttribute.cs
- Guid.cs
- WindowsProgressbar.cs
- MethodInfo.cs
- Compiler.cs
- SignatureHelper.cs
- ValueSerializerAttribute.cs
- BuildProviderCollection.cs
- SQLBinary.cs
- DataControlFieldHeaderCell.cs
- RayHitTestParameters.cs
- CodeBinaryOperatorExpression.cs
- HtmlHistory.cs
- ConfigUtil.cs
- DataComponentMethodGenerator.cs
- SizeKeyFrameCollection.cs
- AvtEvent.cs
- HeaderUtility.cs
- PersonalizationProvider.cs
- Thread.cs
- XmlBinaryWriter.cs
- _Win32.cs
- EventsTab.cs
- CollectionDataContractAttribute.cs
- GridViewColumnCollection.cs
- ArrangedElementCollection.cs
- FilePrompt.cs
- DispatcherFrame.cs
- RequestQueryParser.cs
- ProfilePropertyMetadata.cs
- EventProxy.cs
- BinaryMessageEncodingBindingElement.cs
- HostAdapter.cs
- LineGeometry.cs
- BlurBitmapEffect.cs
- _CacheStreams.cs
- InputLanguageCollection.cs
- TableRowCollection.cs
- Group.cs
- CharacterString.cs
- processwaithandle.cs
- Int32EqualityComparer.cs
- X509ChainPolicy.cs
- DeclarativeCatalogPart.cs
- ButtonChrome.cs
- RawTextInputReport.cs
- PropertyKey.cs
- RequestResizeEvent.cs
- InvalidOperationException.cs
- _CacheStreams.cs
- LineSegment.cs
- MgmtConfigurationRecord.cs
- TableDetailsRow.cs
- ExpressionDumper.cs
- Utils.cs
- UniqueIdentifierService.cs
- datacache.cs
- CheckBox.cs
- RightsManagementLicense.cs
- _LocalDataStoreMgr.cs
- SymmetricCryptoHandle.cs
- RectangleGeometry.cs
- JsonClassDataContract.cs
- Image.cs
- FormViewPagerRow.cs
- DrawingAttributes.cs
- SamlDelegatingWriter.cs
- Property.cs
- Documentation.cs
- ResXResourceWriter.cs
- SQLDouble.cs
- AxWrapperGen.cs
- SqlNodeAnnotation.cs
- WindowAutomationPeer.cs
- DataMemberAttribute.cs
- WebDescriptionAttribute.cs
- WindowsFormsDesignerOptionService.cs
- TableRowCollection.cs
- CoTaskMemSafeHandle.cs
- BasicHttpSecurityElement.cs
- PointLight.cs
- ConfigurationElementCollection.cs