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
- DataGridColumnHeaderCollection.cs
- RecoverInstanceLocksCommand.cs
- PlanCompilerUtil.cs
- SmtpClient.cs
- ObjectItemAttributeAssemblyLoader.cs
- InvalidAsynchronousStateException.cs
- SqlUtils.cs
- WmlImageAdapter.cs
- DataTable.cs
- NameValuePermission.cs
- PropertyChangedEventArgs.cs
- QueryableFilterRepeater.cs
- HttpRequestCacheValidator.cs
- FixedPageProcessor.cs
- BitmapDecoder.cs
- RuntimeCompatibilityAttribute.cs
- PreviewPageInfo.cs
- AdobeCFFWrapper.cs
- BamlTreeMap.cs
- CacheOutputQuery.cs
- FontCacheLogic.cs
- AsyncOperationManager.cs
- CoreSwitches.cs
- XmlElementCollection.cs
- HttpWebResponse.cs
- _UriSyntax.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- PeerNearMe.cs
- TableLayout.cs
- BridgeDataRecord.cs
- ValidatorUtils.cs
- ExecutorLocksHeldException.cs
- SspiHelper.cs
- MediaScriptCommandRoutedEventArgs.cs
- Brushes.cs
- WebResourceUtil.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- DataControlButton.cs
- TemplateBamlRecordReader.cs
- FileSystemInfo.cs
- CTreeGenerator.cs
- CellConstant.cs
- AnalyzedTree.cs
- DBCommand.cs
- VideoDrawing.cs
- PolicyVersionConverter.cs
- GestureRecognizer.cs
- ContractDescription.cs
- DesignerContextDescriptor.cs
- HeaderedContentControl.cs
- TemplateBuilder.cs
- WindowsListView.cs
- CodeArrayCreateExpression.cs
- PtsContext.cs
- TextEditor.cs
- EventLogInternal.cs
- PTConverter.cs
- ChangeNode.cs
- MissingMethodException.cs
- QueryOutputWriter.cs
- Stack.cs
- XmlDataProvider.cs
- TextBlockAutomationPeer.cs
- CompilerWrapper.cs
- CqlLexer.cs
- LoadedOrUnloadedOperation.cs
- ALinqExpressionVisitor.cs
- CredentialManagerDialog.cs
- BindingsCollection.cs
- RepeaterItemCollection.cs
- Parser.cs
- UserControlBuildProvider.cs
- Matrix3DStack.cs
- COM2ExtendedBrowsingHandler.cs
- ExpressionBuilderCollection.cs
- LocalClientSecuritySettingsElement.cs
- CreateUserWizard.cs
- ParameterToken.cs
- SessionEndingEventArgs.cs
- ReflectEventDescriptor.cs
- EventWaitHandle.cs
- SHA1CryptoServiceProvider.cs
- DataSourceSelectArguments.cs
- SerializationStore.cs
- DatatypeImplementation.cs
- XmlSerializerOperationBehavior.cs
- AnimationClock.cs
- SchemaElementDecl.cs
- SettingsPropertyWrongTypeException.cs
- WebPartConnectionsCancelEventArgs.cs
- ChannelDispatcherBase.cs
- TimeoutException.cs
- TablePatternIdentifiers.cs
- WebConfigurationManager.cs
- CodeArrayIndexerExpression.cs
- sqlinternaltransaction.cs
- TransactedBatchingElement.cs
- Line.cs
- AuthenticateEventArgs.cs
- ChannelTracker.cs