Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- EmptyStringExpandableObjectConverter.cs
- FigureParagraph.cs
- FileVersionInfo.cs
- ColorConvertedBitmapExtension.cs
- CodeDelegateCreateExpression.cs
- DefinitionBase.cs
- TextPenaltyModule.cs
- PixelShader.cs
- XmlReflectionImporter.cs
- CompositeTypefaceMetrics.cs
- TabControlCancelEvent.cs
- EventSetterHandlerConverter.cs
- DayRenderEvent.cs
- ListBox.cs
- WaitHandle.cs
- COM2PropertyBuilderUITypeEditor.cs
- UnsafeNativeMethods.cs
- WindowsEditBoxRange.cs
- Misc.cs
- DocumentXmlWriter.cs
- QuaternionValueSerializer.cs
- StringInfo.cs
- EmptyReadOnlyDictionaryInternal.cs
- Stack.cs
- DocumentCollection.cs
- SqlConnectionPoolProviderInfo.cs
- DiffuseMaterial.cs
- LocatorPart.cs
- ButtonFlatAdapter.cs
- DropSource.cs
- unitconverter.cs
- StaticExtension.cs
- StrokeNodeEnumerator.cs
- DataMemberFieldEditor.cs
- StrongName.cs
- EpmCustomContentSerializer.cs
- ProfileSettings.cs
- JsonDeserializer.cs
- MethodCallTranslator.cs
- precedingsibling.cs
- UIElement3DAutomationPeer.cs
- ImportContext.cs
- MemberMemberBinding.cs
- BasicExpandProvider.cs
- ItemsPanelTemplate.cs
- SplineKeyFrames.cs
- SqlComparer.cs
- MeshGeometry3D.cs
- FixedPage.cs
- CompilerGeneratedAttribute.cs
- RegisteredHiddenField.cs
- DataGridViewSelectedColumnCollection.cs
- DesignRelation.cs
- FrameSecurityDescriptor.cs
- PostBackOptions.cs
- PageAdapter.cs
- KeyMatchBuilder.cs
- TextProviderWrapper.cs
- ProfileBuildProvider.cs
- TableRow.cs
- NominalTypeEliminator.cs
- NumberSubstitution.cs
- PagerSettings.cs
- SchemaTypeEmitter.cs
- IgnoreDataMemberAttribute.cs
- BamlResourceDeserializer.cs
- IssuedSecurityTokenParameters.cs
- FieldValue.cs
- TextElement.cs
- Regex.cs
- DispatcherExceptionFilterEventArgs.cs
- EdmMember.cs
- RTTypeWrapper.cs
- SystemWebExtensionsSectionGroup.cs
- VisualProxy.cs
- RegistryExceptionHelper.cs
- _LocalDataStore.cs
- HelpInfo.cs
- Rectangle.cs
- FreezableOperations.cs
- WebServiceErrorEvent.cs
- DrawItemEvent.cs
- CustomAttributeFormatException.cs
- TraceHandlerErrorFormatter.cs
- CustomCategoryAttribute.cs
- String.cs
- DisplayNameAttribute.cs
- UInt16Storage.cs
- ObjectDataSourceDisposingEventArgs.cs
- NestedContainer.cs
- UrlEncodedParameterWriter.cs
- MetadataItemSerializer.cs
- DecimalAnimationBase.cs
- DesignerForm.cs
- GridEntryCollection.cs
- FixedPageAutomationPeer.cs
- FragmentNavigationEventArgs.cs
- DynamicResourceExtensionConverter.cs
- EntityKey.cs
- FileDetails.cs