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
- CompilerGeneratedAttribute.cs
- XmlNamespaceManager.cs
- DataControlButton.cs
- MethodRental.cs
- TokenizerHelper.cs
- SystemColorTracker.cs
- OracleInfoMessageEventArgs.cs
- TextBox.cs
- ServiceHttpModule.cs
- CodeParameterDeclarationExpression.cs
- TabControl.cs
- FlowLayoutSettings.cs
- SoapElementAttribute.cs
- BoundColumn.cs
- ComponentChangingEvent.cs
- ExclusiveHandleList.cs
- NotSupportedException.cs
- LocalizationCodeDomSerializer.cs
- DictionaryBase.cs
- SR.cs
- TextProperties.cs
- BindingCollection.cs
- SizeConverter.cs
- AutoResizedEvent.cs
- ListViewItem.cs
- DBDataPermission.cs
- AvTraceDetails.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- Error.cs
- Matrix.cs
- WmlSelectionListAdapter.cs
- RtfNavigator.cs
- BeginEvent.cs
- TraceContext.cs
- ToolStripDropDownButton.cs
- PageParser.cs
- Baml2006ReaderSettings.cs
- EmptyStringExpandableObjectConverter.cs
- OneOfScalarConst.cs
- storagemappingitemcollection.viewdictionary.cs
- RemoveFromCollection.cs
- SettingsBase.cs
- Switch.cs
- ItemContainerGenerator.cs
- TimelineGroup.cs
- GroupBox.cs
- GroupQuery.cs
- ObjectDataSourceSelectingEventArgs.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- QilBinary.cs
- invalidudtexception.cs
- SectionRecord.cs
- DoubleAnimationUsingKeyFrames.cs
- XDeferredAxisSource.cs
- ToolStripSettings.cs
- BuildProviderCollection.cs
- AsymmetricKeyExchangeDeformatter.cs
- EmptyCollection.cs
- Button.cs
- MetadataProperty.cs
- ToolStripDropDown.cs
- WebPartEditorCancelVerb.cs
- DataBoundControlAdapter.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- CustomError.cs
- WorkItem.cs
- ProfilePropertyNameValidator.cs
- HandlerWithFactory.cs
- Point3DAnimation.cs
- PrintDialog.cs
- InputChannel.cs
- IMembershipProvider.cs
- RelationshipConstraintValidator.cs
- TriggerBase.cs
- FormParameter.cs
- DataGridColumn.cs
- EmptyStringExpandableObjectConverter.cs
- cookie.cs
- HttpProtocolReflector.cs
- XmlWrappingReader.cs
- DataGridViewImageCell.cs
- DependencyObjectPropertyDescriptor.cs
- EncodingDataItem.cs
- _ListenerResponseStream.cs
- HyperLinkStyle.cs
- ValidationPropertyAttribute.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- StylusPointPropertyInfoDefaults.cs
- HostProtectionException.cs
- MediaContext.cs
- CustomAttribute.cs
- XmlCharacterData.cs
- TraceSection.cs
- XomlCompilerResults.cs
- PageThemeParser.cs
- DetectRunnableInstancesTask.cs
- SystemWebCachingSectionGroup.cs
- File.cs
- TextProperties.cs
- HttpModuleAction.cs