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
- ProtocolInformationReader.cs
- IsolationInterop.cs
- ConfigsHelper.cs
- IntSecurity.cs
- Maps.cs
- ModulesEntry.cs
- TextClipboardData.cs
- HttpCachePolicyWrapper.cs
- HostExecutionContextManager.cs
- ExecutionPropertyManager.cs
- PersonalizationState.cs
- Exception.cs
- UrlPropertyAttribute.cs
- HandlerFactoryCache.cs
- TextServicesCompartmentEventSink.cs
- MultiDataTrigger.cs
- ResourceManager.cs
- TabControlCancelEvent.cs
- GlobalizationSection.cs
- RegionInfo.cs
- OutputCacheProviderCollection.cs
- GetLastErrorDetailsRequest.cs
- UriTemplateLiteralPathSegment.cs
- StringSource.cs
- DispatcherTimer.cs
- TypedElement.cs
- NotifyParentPropertyAttribute.cs
- UrlPath.cs
- JapaneseLunisolarCalendar.cs
- PeerToPeerException.cs
- JsonFormatMapping.cs
- PersonalizationProvider.cs
- XhtmlConformanceSection.cs
- DataFormats.cs
- StateMachineAction.cs
- OracleCommandSet.cs
- DatagridviewDisplayedBandsData.cs
- ExchangeUtilities.cs
- RichTextBoxDesigner.cs
- ChildTable.cs
- MethodImplAttribute.cs
- Timer.cs
- WinFormsSecurity.cs
- Internal.cs
- SapiRecoInterop.cs
- SizeConverter.cs
- BooleanAnimationBase.cs
- TextEditorCopyPaste.cs
- DbTransaction.cs
- GetChildSubtree.cs
- UrlAuthFailedErrorFormatter.cs
- WebExceptionStatus.cs
- DataControlFieldCell.cs
- LinqDataSourceDeleteEventArgs.cs
- MulticastNotSupportedException.cs
- SspiSecurityTokenProvider.cs
- RowToFieldTransformer.cs
- DirectoryNotFoundException.cs
- VariableExpressionConverter.cs
- NamespaceList.cs
- GridView.cs
- XmlnsCache.cs
- RoutedEventArgs.cs
- PipelineDeploymentState.cs
- CreateCardRequest.cs
- BufferAllocator.cs
- EntityDataSourceWrapperCollection.cs
- StatusStrip.cs
- __Filters.cs
- RuntimeHelpers.cs
- SharedStatics.cs
- XmlUtf8RawTextWriter.cs
- PeerNameRecordCollection.cs
- BamlRecordReader.cs
- AppearanceEditorPart.cs
- FullTextBreakpoint.cs
- Condition.cs
- XmlDataSourceView.cs
- SecondaryViewProvider.cs
- QueryStringConverter.cs
- EventQueueState.cs
- ProcessModelInfo.cs
- WebPartMinimizeVerb.cs
- ModelPerspective.cs
- InputReportEventArgs.cs
- MethodBuilder.cs
- HtmlDocument.cs
- MenuItemCollectionEditor.cs
- SocketInformation.cs
- TransportElement.cs
- IteratorDescriptor.cs
- SystemResources.cs
- AuthStoreRoleProvider.cs
- ExpressionPrefixAttribute.cs
- WebException.cs
- ArgumentException.cs
- XmlAttributeAttribute.cs
- Trace.cs
- EditorPartCollection.cs
- CodeCommentStatementCollection.cs