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
- DaylightTime.cs
- ComponentCommands.cs
- RMPublishingDialog.cs
- SecureUICommand.cs
- DialogResultConverter.cs
- VisemeEventArgs.cs
- COM2EnumConverter.cs
- SplitterCancelEvent.cs
- UnauthorizedWebPart.cs
- PasswordDeriveBytes.cs
- WebPartVerb.cs
- ByteStack.cs
- QueryOperationResponseOfT.cs
- DataSourceControlBuilder.cs
- OpCodes.cs
- HttpWebResponse.cs
- _MultipleConnectAsync.cs
- RectangleGeometry.cs
- BitmapSizeOptions.cs
- TextPointerBase.cs
- FileChangesMonitor.cs
- CodeTypeReferenceSerializer.cs
- UIElement3D.cs
- Token.cs
- RelationshipConverter.cs
- EntityReference.cs
- COM2AboutBoxPropertyDescriptor.cs
- SecurityContext.cs
- ExpressionEditor.cs
- EntityDataSource.cs
- documentsequencetextpointer.cs
- DefaultMemberAttribute.cs
- X509ChainPolicy.cs
- DataError.cs
- ArrayConverter.cs
- ArrayList.cs
- UnauthorizedWebPart.cs
- SymmetricCryptoHandle.cs
- CodeTryCatchFinallyStatement.cs
- IdleTimeoutMonitor.cs
- BufferedStream2.cs
- SortAction.cs
- HtmlToClrEventProxy.cs
- SchemaSetCompiler.cs
- RootBuilder.cs
- XmlSchemaGroupRef.cs
- WebBrowser.cs
- IsolatedStorageFilePermission.cs
- XmlQualifiedName.cs
- AnnotationHighlightLayer.cs
- GlyphTypeface.cs
- EdgeProfileValidation.cs
- GridViewSortEventArgs.cs
- HtmlWindow.cs
- PackageRelationshipCollection.cs
- ComponentSerializationService.cs
- RelatedEnd.cs
- ProcessModelInfo.cs
- Constants.cs
- XmlByteStreamReader.cs
- AutoSizeToolBoxItem.cs
- Matrix3D.cs
- X509ClientCertificateAuthenticationElement.cs
- StrokeDescriptor.cs
- LocalFileSettingsProvider.cs
- ListViewItem.cs
- QilCloneVisitor.cs
- FastEncoder.cs
- WebCategoryAttribute.cs
- XmlUtil.cs
- ContractHandle.cs
- HeaderLabel.cs
- PointConverter.cs
- ResXDataNode.cs
- _ScatterGatherBuffers.cs
- PenCursorManager.cs
- ToolStripDesignerAvailabilityAttribute.cs
- CompilerCollection.cs
- Int32AnimationBase.cs
- WebPartVerb.cs
- VectorAnimationUsingKeyFrames.cs
- LayoutEvent.cs
- GetChildSubtree.cs
- HotSpotCollection.cs
- TreeNodeStyleCollection.cs
- CompleteWizardStep.cs
- DesignerCatalogPartChrome.cs
- Item.cs
- DocumentReference.cs
- SafeLibraryHandle.cs
- SizeKeyFrameCollection.cs
- TaskHelper.cs
- _NestedSingleAsyncResult.cs
- ApplicationFileCodeDomTreeGenerator.cs
- X509KeyIdentifierClauseType.cs
- DynamicDocumentPaginator.cs
- HttpGetClientProtocol.cs
- PerformanceCounterManager.cs
- ControlBindingsCollection.cs
- CodeTypeParameterCollection.cs