Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / safemediahandle.cs / 1305600 / 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
- FontConverter.cs
- XmlSchemaComplexType.cs
- AuthenticatingEventArgs.cs
- FromReply.cs
- PerformanceCounterCategory.cs
- HandleCollector.cs
- TreeViewItem.cs
- MbpInfo.cs
- ValuePatternIdentifiers.cs
- ToolboxItemFilterAttribute.cs
- SendKeys.cs
- DataService.cs
- AttachmentCollection.cs
- RequestChannelBinder.cs
- RenderCapability.cs
- UserControlBuildProvider.cs
- LocalValueEnumerator.cs
- ProgressChangedEventArgs.cs
- TimelineCollection.cs
- SByte.cs
- InkCanvasFeedbackAdorner.cs
- StylusLogic.cs
- AutoResizedEvent.cs
- TransformDescriptor.cs
- ByeMessage11.cs
- PassportPrincipal.cs
- TextSelectionHelper.cs
- InputBuffer.cs
- ResourceSet.cs
- ScrollChrome.cs
- QilFunction.cs
- DataRelationPropertyDescriptor.cs
- SymbolDocumentInfo.cs
- GetKeyedHashRequest.cs
- CodeRemoveEventStatement.cs
- ExpressionVisitor.cs
- HostingEnvironment.cs
- TargetConverter.cs
- TakeOrSkipQueryOperator.cs
- _OverlappedAsyncResult.cs
- StopStoryboard.cs
- OrCondition.cs
- LoginAutoFormat.cs
- Identity.cs
- SqlResolver.cs
- SequenceNumber.cs
- DiagnosticTrace.cs
- CustomAttribute.cs
- NativeMethods.cs
- FieldBuilder.cs
- ProtocolsConfigurationEntry.cs
- BuildProviderCollection.cs
- StateWorkerRequest.cs
- TokenizerHelper.cs
- DragAssistanceManager.cs
- UnsafeNativeMethodsTablet.cs
- BitmapImage.cs
- DataGridViewToolTip.cs
- EditorZone.cs
- InputElement.cs
- BitmapScalingModeValidation.cs
- DockAndAnchorLayout.cs
- _KerberosClient.cs
- IncomingWebResponseContext.cs
- GlobalizationAssembly.cs
- ResourceWriter.cs
- TriggerAction.cs
- DeclarativeCatalogPartDesigner.cs
- InternalConfigEventArgs.cs
- PackWebRequestFactory.cs
- SiteMapDataSource.cs
- SimpleTextLine.cs
- TreeChangeInfo.cs
- CommandLibraryHelper.cs
- XmlSchemaValidationException.cs
- CodeExpressionStatement.cs
- ComboBoxAutomationPeer.cs
- DefaultProxySection.cs
- SelectionItemProviderWrapper.cs
- ChannelManagerService.cs
- SqlCommandSet.cs
- SourceLineInfo.cs
- OutputWindow.cs
- TreeNodeStyle.cs
- followingquery.cs
- CompositionAdorner.cs
- XmlSerializationGeneratedCode.cs
- Win32Exception.cs
- XamlBuildTaskServices.cs
- PageSetupDialog.cs
- GlobalAllocSafeHandle.cs
- ObjectStorage.cs
- counter.cs
- IndentedWriter.cs
- BoundPropertyEntry.cs
- LicenseManager.cs
- EntityContainerEntitySet.cs
- SupportsPreviewControlAttribute.cs
- AssemblyFilter.cs
- ToolboxComponentsCreatedEventArgs.cs