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
- SystemDropShadowChrome.cs
- DoWhile.cs
- SHA256Managed.cs
- MethodBody.cs
- SchemaImporterExtension.cs
- ColorBlend.cs
- SqlInternalConnectionSmi.cs
- TreeNodeBindingCollection.cs
- WebPartEventArgs.cs
- shaperfactory.cs
- XmlSchemaChoice.cs
- COM2AboutBoxPropertyDescriptor.cs
- DataGridDesigner.cs
- ResolvedKeyFrameEntry.cs
- StringConverter.cs
- CatalogPartCollection.cs
- RoutingEndpointTrait.cs
- EventSourceCreationData.cs
- XmlObjectSerializerWriteContext.cs
- AppDomainEvidenceFactory.cs
- DtrList.cs
- DataControlButton.cs
- BaseContextMenu.cs
- ConstrainedDataObject.cs
- DataObjectCopyingEventArgs.cs
- CompressEmulationStream.cs
- ParameterCollection.cs
- SiteMap.cs
- PlainXmlDeserializer.cs
- ItemChangedEventArgs.cs
- RegexTree.cs
- SignatureDescription.cs
- EnumerableRowCollection.cs
- WebSysDescriptionAttribute.cs
- AppDomainUnloadedException.cs
- DoubleCollectionConverter.cs
- FindProgressChangedEventArgs.cs
- XmlArrayItemAttributes.cs
- RSAOAEPKeyExchangeDeformatter.cs
- SchemaElementLookUpTable.cs
- XmlAutoDetectWriter.cs
- __Filters.cs
- SurrogateEncoder.cs
- StaticFileHandler.cs
- SchemaTypeEmitter.cs
- EventPropertyMap.cs
- ValidationUtility.cs
- SpotLight.cs
- PropertyMapper.cs
- DuplexClientBase.cs
- CodeObjectCreateExpression.cs
- WsatAdminException.cs
- HelpEvent.cs
- Journal.cs
- RuntimeIdentifierPropertyAttribute.cs
- NavigationPropertyEmitter.cs
- _SingleItemRequestCache.cs
- _NegoState.cs
- SystemNetworkInterface.cs
- InternalDispatchObject.cs
- SQLCharsStorage.cs
- COM2IPerPropertyBrowsingHandler.cs
- ManifestResourceInfo.cs
- IPAddress.cs
- DirectionalLight.cs
- VariableExpressionConverter.cs
- DesignerToolStripControlHost.cs
- TextEffect.cs
- GcSettings.cs
- DataTableNameHandler.cs
- UseAttributeSetsAction.cs
- ClassHandlersStore.cs
- SQLBinary.cs
- GroupBoxAutomationPeer.cs
- XmlSchemaAnnotation.cs
- DataControlFieldsEditor.cs
- BamlRecords.cs
- SpanIndex.cs
- InternalDuplexChannelFactory.cs
- dataprotectionpermission.cs
- DocumentPaginator.cs
- SelectorItemAutomationPeer.cs
- MenuRenderer.cs
- RuleInfoComparer.cs
- ListViewItemMouseHoverEvent.cs
- MD5CryptoServiceProvider.cs
- XPathDocument.cs
- Internal.cs
- XmlDictionaryReaderQuotas.cs
- EditorServiceContext.cs
- TrackingCondition.cs
- ProjectionPath.cs
- MouseEvent.cs
- Memoizer.cs
- ObjectSpanRewriter.cs
- HorizontalAlignConverter.cs
- SiteMapNodeItem.cs
- WebServiceReceiveDesigner.cs
- ComponentResourceKey.cs
- ToolStripSettings.cs