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
- ProjectionPruner.cs
- UnsafeNativeMethodsCLR.cs
- SwitchCase.cs
- TableFieldsEditor.cs
- SaveLedgerEntryRequest.cs
- WrappedIUnknown.cs
- IDispatchConstantAttribute.cs
- ProxyWebPart.cs
- TypeSystem.cs
- RefreshPropertiesAttribute.cs
- RegistryPermission.cs
- RequestResizeEvent.cs
- BasePropertyDescriptor.cs
- ScrollProviderWrapper.cs
- TextLineResult.cs
- DataServiceQueryProvider.cs
- SHA1.cs
- EntityDataSourceContainerNameConverter.cs
- DataGridViewComponentPropertyGridSite.cs
- PlatformNotSupportedException.cs
- TransactionsSectionGroup.cs
- MimeParameters.cs
- GridViewColumn.cs
- CursorEditor.cs
- GeometryModel3D.cs
- RuntimeHandles.cs
- CodeCompileUnit.cs
- SoapConverter.cs
- Interfaces.cs
- PropertyChangedEventManager.cs
- HttpMethodConstraint.cs
- LicenseContext.cs
- SmtpDateTime.cs
- InternalCache.cs
- SortDescription.cs
- HostingEnvironmentException.cs
- MimePart.cs
- CrossAppDomainChannel.cs
- GACIdentityPermission.cs
- UnicodeEncoding.cs
- TextWriterTraceListener.cs
- SaveFileDialog.cs
- PartManifestEntry.cs
- DataRecordInternal.cs
- StoreContentChangedEventArgs.cs
- WebPartCancelEventArgs.cs
- FixedSOMPageConstructor.cs
- SpotLight.cs
- GetReadStreamResult.cs
- RenderingBiasValidation.cs
- ResourceDisplayNameAttribute.cs
- ProfileSettings.cs
- DesignerWebPartChrome.cs
- FindCriteria11.cs
- coordinatorscratchpad.cs
- SortQuery.cs
- WriteFileContext.cs
- MimeFormImporter.cs
- Style.cs
- ProviderConnectionPoint.cs
- QueryOperationResponseOfT.cs
- AutoGeneratedField.cs
- Exceptions.cs
- UserValidatedEventArgs.cs
- ReadOnlyObservableCollection.cs
- InputBuffer.cs
- WebServiceTypeData.cs
- BitmapInitialize.cs
- EncryptedKey.cs
- SqlPersonalizationProvider.cs
- _ListenerAsyncResult.cs
- RoleManagerSection.cs
- ImageConverter.cs
- brushes.cs
- EntityDataSourceColumn.cs
- AnnotationHelper.cs
- DataGridViewSortCompareEventArgs.cs
- ScriptIgnoreAttribute.cs
- ICollection.cs
- HtmlShim.cs
- HtmlFormParameterReader.cs
- VersionedStreamOwner.cs
- DateTimeFormatInfo.cs
- Page.cs
- MailSettingsSection.cs
- CorePropertiesFilter.cs
- VectorAnimationUsingKeyFrames.cs
- SafeLibraryHandle.cs
- Header.cs
- ObservableDictionary.cs
- AssociationSetMetadata.cs
- FontNamesConverter.cs
- TransformerTypeCollection.cs
- ResourceExpressionEditorSheet.cs
- Rotation3D.cs
- CodeMethodMap.cs
- WebPartDescriptionCollection.cs
- RtfNavigator.cs
- Page.cs
- ObjectDataSourceStatusEventArgs.cs