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
- CallbackDebugElement.cs
- ToolZone.cs
- TypeToken.cs
- BindableTemplateBuilder.cs
- MatrixConverter.cs
- WebHttpBehavior.cs
- LinqTreeNodeEvaluator.cs
- Tokenizer.cs
- TagNameToTypeMapper.cs
- ToolStripProgressBar.cs
- DataColumn.cs
- GeneratedCodeAttribute.cs
- MsmqElementBase.cs
- CopyOfAction.cs
- WebPartCatalogAddVerb.cs
- ArrayListCollectionBase.cs
- Compensate.cs
- ConsumerConnectionPoint.cs
- activationcontext.cs
- XamlTemplateSerializer.cs
- FullTextLine.cs
- StyleCollectionEditor.cs
- SystemIPGlobalStatistics.cs
- TypedDataSetSchemaImporterExtension.cs
- DelegateTypeInfo.cs
- SpecularMaterial.cs
- HttpCapabilitiesSectionHandler.cs
- NumericPagerField.cs
- TransformCryptoHandle.cs
- Window.cs
- InputProcessorProfilesLoader.cs
- EdgeModeValidation.cs
- DefinitionBase.cs
- XamlTreeBuilderBamlRecordWriter.cs
- MessageSecurityTokenVersion.cs
- ProcessHostServerConfig.cs
- XmlNotation.cs
- CollectionViewGroupRoot.cs
- DynamicPropertyHolder.cs
- SourceFileBuildProvider.cs
- ConnectionProviderAttribute.cs
- EventlogProvider.cs
- MessagePropertyAttribute.cs
- SchemaComplexType.cs
- XamlInterfaces.cs
- FieldNameLookup.cs
- InternalMappingException.cs
- SqlTypeSystemProvider.cs
- SpellCheck.cs
- CodeCommentStatement.cs
- UnmanagedMarshal.cs
- CompositeTypefaceMetrics.cs
- SubqueryRules.cs
- ToolStripProgressBar.cs
- DataSet.cs
- WorkflowMessageEventArgs.cs
- RectangleHotSpot.cs
- NavigationPropertyAccessor.cs
- MimeBasePart.cs
- HierarchicalDataSourceControl.cs
- ToolBarPanel.cs
- RequestQueue.cs
- ColorConverter.cs
- ValidatedControlConverter.cs
- BamlLocalizableResource.cs
- Pool.cs
- EncoderExceptionFallback.cs
- ElementProxy.cs
- OdbcError.cs
- AsyncResult.cs
- PreviewKeyDownEventArgs.cs
- ConditionChanges.cs
- UTF7Encoding.cs
- PackWebResponse.cs
- PageScaling.cs
- EncoderFallback.cs
- StrongNameMembershipCondition.cs
- ExpressionNode.cs
- DocumentReference.cs
- ImageMapEventArgs.cs
- PersistenceParticipant.cs
- ResXBuildProvider.cs
- mediapermission.cs
- FlatButtonAppearance.cs
- ClientConfigPaths.cs
- NavigationPropertyEmitter.cs
- ButtonChrome.cs
- ScopeCompiler.cs
- ProcessModuleCollection.cs
- DataGridViewCell.cs
- DesignerAdapterUtil.cs
- TraceInternal.cs
- ElapsedEventArgs.cs
- ModifierKeysConverter.cs
- FlowDocumentPageViewerAutomationPeer.cs
- UnlockCardRequest.cs
- BitmapDownload.cs
- ListDictionaryInternal.cs
- DataObjectMethodAttribute.cs
- EndpointNotFoundException.cs