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
- GorillaCodec.cs
- DurationConverter.cs
- URIFormatException.cs
- IconConverter.cs
- RequestSecurityTokenResponseCollection.cs
- RelationshipEnd.cs
- StreamInfo.cs
- ActivityMarkupSerializationProvider.cs
- MachineKey.cs
- WindowsFormsHelpers.cs
- FragmentQuery.cs
- XmlSchemaDatatype.cs
- ScrollItemPattern.cs
- DoubleConverter.cs
- LinqDataSourceDeleteEventArgs.cs
- InstanceKey.cs
- WebPartDescriptionCollection.cs
- SectionXmlInfo.cs
- Events.cs
- ComPlusContractBehavior.cs
- CustomTokenProvider.cs
- Pens.cs
- ProviderBase.cs
- ExpressionBinding.cs
- NullableBoolConverter.cs
- TwoPhaseCommit.cs
- FixedSOMPageElement.cs
- ExpressionBuilderContext.cs
- _NestedMultipleAsyncResult.cs
- SamlAction.cs
- Menu.cs
- MultiSelectRootGridEntry.cs
- BitmapCache.cs
- ReadWriteObjectLock.cs
- EmbeddedMailObjectsCollection.cs
- DrawingCollection.cs
- DriveNotFoundException.cs
- ActivityLocationReferenceEnvironment.cs
- PageOutputQuality.cs
- DataBindingHandlerAttribute.cs
- StylusTip.cs
- StreamWriter.cs
- ItemDragEvent.cs
- DatagridviewDisplayedBandsData.cs
- SqlDataSourceFilteringEventArgs.cs
- SafeSystemMetrics.cs
- MenuItemBindingCollection.cs
- VBIdentifierNameEditor.cs
- AbstractSvcMapFileLoader.cs
- IPipelineRuntime.cs
- SiteMapNodeItem.cs
- ExplicitDiscriminatorMap.cs
- XmlSchemaExporter.cs
- CodeSnippetExpression.cs
- ReadOnlyPropertyMetadata.cs
- HttpRequestWrapper.cs
- Exceptions.cs
- DataGridView.cs
- TimeSpan.cs
- CreateUserErrorEventArgs.cs
- DataTableTypeConverter.cs
- TemplateKeyConverter.cs
- KeyValuePairs.cs
- AuthenticationModuleElement.cs
- BindingMemberInfo.cs
- AppSettingsReader.cs
- SqlNotificationEventArgs.cs
- CategoryAttribute.cs
- SqlXmlStorage.cs
- GatewayDefinition.cs
- Cursor.cs
- SectionInformation.cs
- BinaryObjectInfo.cs
- DataControlField.cs
- ScrollViewer.cs
- CoreChannel.cs
- MaskedTextProvider.cs
- DependentList.cs
- KeyGesture.cs
- DataGridViewColumnEventArgs.cs
- DefaultProfileManager.cs
- SwitchLevelAttribute.cs
- AutomationElementCollection.cs
- SerializationInfo.cs
- WindowsSysHeader.cs
- VerticalAlignConverter.cs
- SpotLight.cs
- SecureUICommand.cs
- LinearKeyFrames.cs
- RowVisual.cs
- HttpApplicationStateBase.cs
- AbstractSvcMapFileLoader.cs
- ExpressionConverter.cs
- ValueExpressions.cs
- SizeF.cs
- FunctionCommandText.cs
- UriTemplateTableMatchCandidate.cs
- InvalidOleVariantTypeException.cs
- Range.cs
- WebServiceHandler.cs