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
- DesignConnectionCollection.cs
- NoneExcludedImageIndexConverter.cs
- RepeaterItemCollection.cs
- ControlIdConverter.cs
- CaseStatement.cs
- StandardBindingCollectionElement.cs
- ButtonBaseAdapter.cs
- XsdValidatingReader.cs
- WebPageTraceListener.cs
- CryptographicAttribute.cs
- TypeExtension.cs
- SqlGatherConsumedAliases.cs
- ResourceDictionary.cs
- CharacterHit.cs
- TemplateColumn.cs
- WebControlAdapter.cs
- TraceLevelStore.cs
- PresentationAppDomainManager.cs
- XPathAxisIterator.cs
- CompilerHelpers.cs
- ErrorRuntimeConfig.cs
- NonSerializedAttribute.cs
- SequentialOutput.cs
- RightsManagementProvider.cs
- MinimizableAttributeTypeConverter.cs
- QilValidationVisitor.cs
- RenderCapability.cs
- UnsignedPublishLicense.cs
- QueryExtender.cs
- CatalogPart.cs
- WebPartsSection.cs
- Token.cs
- Vector3DIndependentAnimationStorage.cs
- MatrixCamera.cs
- AuthenticatedStream.cs
- SmiRecordBuffer.cs
- TypeElementCollection.cs
- DomNameTable.cs
- columnmapfactory.cs
- FontCacheUtil.cs
- ToolbarAUtomationPeer.cs
- HttpProfileBase.cs
- ScriptManager.cs
- DataServiceProcessingPipeline.cs
- SqlDataSourceParameterParser.cs
- PersistencePipeline.cs
- SelectionEditingBehavior.cs
- SQLByteStorage.cs
- EventLog.cs
- securestring.cs
- LayoutTableCell.cs
- SuppressMergeCheckAttribute.cs
- DecoderFallback.cs
- HttpStreamXmlDictionaryReader.cs
- SimpleBitVector32.cs
- FamilyTypefaceCollection.cs
- DataColumnMappingCollection.cs
- CDSsyncETWBCLProvider.cs
- WebPartTracker.cs
- MemoryResponseElement.cs
- SafeFileHandle.cs
- CreatingCookieEventArgs.cs
- UDPClient.cs
- EdmItemCollection.cs
- GroupByQueryOperator.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- WindowsSysHeader.cs
- WebPartCatalogCloseVerb.cs
- BindingsCollection.cs
- _DomainName.cs
- TemplateManager.cs
- NetworkInterface.cs
- TypeUnloadedException.cs
- OrderedDictionaryStateHelper.cs
- WinEventHandler.cs
- TableCellCollection.cs
- TreeViewAutomationPeer.cs
- TypeToArgumentTypeConverter.cs
- _NativeSSPI.cs
- FlowLayout.cs
- SpellerStatusTable.cs
- ProcessInputEventArgs.cs
- GacUtil.cs
- EventLogReader.cs
- EntityProviderFactory.cs
- PerformanceCounterPermissionEntryCollection.cs
- CipherData.cs
- QuaternionKeyFrameCollection.cs
- sqlnorm.cs
- CultureInfo.cs
- SimpleRecyclingCache.cs
- SafeCryptoHandles.cs
- XmlSchemaAll.cs
- Section.cs
- WindowInteractionStateTracker.cs
- WebWorkflowRole.cs
- EditorBrowsableAttribute.cs
- ByteFacetDescriptionElement.cs
- WindowsStreamSecurityElement.cs
- ColumnResizeAdorner.cs