Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / safemediahandle.cs / 1305600 / 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
- XmlDictionaryWriter.cs
- TextCharacters.cs
- ResourceCodeDomSerializer.cs
- SettingsBindableAttribute.cs
- ApplicationInfo.cs
- diagnosticsswitches.cs
- TransportConfigurationTypeElement.cs
- CommandLibraryHelper.cs
- TrackingCondition.cs
- SystemIPGlobalStatistics.cs
- RecordManager.cs
- ReferentialConstraintRoleElement.cs
- WebPartUserCapability.cs
- LinqDataSourceUpdateEventArgs.cs
- HtmlInputFile.cs
- Pkcs7Signer.cs
- DockAndAnchorLayout.cs
- StructuredCompositeActivityDesigner.cs
- EncoderExceptionFallback.cs
- WinEventWrap.cs
- CacheVirtualItemsEvent.cs
- ColumnMap.cs
- UrlPath.cs
- IERequestCache.cs
- SymbolType.cs
- ObjectStateFormatter.cs
- XmlCollation.cs
- LineBreak.cs
- ElapsedEventArgs.cs
- IsolatedStorageException.cs
- TextParagraph.cs
- ObjectDataSourceStatusEventArgs.cs
- DynamicValidatorEventArgs.cs
- NamedObject.cs
- BackgroundFormatInfo.cs
- OutgoingWebResponseContext.cs
- TitleStyle.cs
- SystemIPAddressInformation.cs
- OracleNumber.cs
- UiaCoreProviderApi.cs
- Lease.cs
- Underline.cs
- Privilege.cs
- SqlCacheDependencyDatabaseCollection.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- MessageQuerySet.cs
- CodeIndexerExpression.cs
- Metadata.cs
- CategoryEditor.cs
- WpfXamlMember.cs
- HttpListenerRequest.cs
- MethodToken.cs
- Vector3D.cs
- BitConverter.cs
- _UriTypeConverter.cs
- CodeAttributeDeclaration.cs
- CornerRadiusConverter.cs
- FixedFlowMap.cs
- LinqDataSourceView.cs
- PropertyChangedEventArgs.cs
- RuleSettings.cs
- PreProcessInputEventArgs.cs
- SpoolingTaskBase.cs
- MimeParameters.cs
- GenericTypeParameterBuilder.cs
- MultipleViewPatternIdentifiers.cs
- ArrayList.cs
- SoapParser.cs
- SqlCommandSet.cs
- CookielessHelper.cs
- FormatConvertedBitmap.cs
- CustomErrorsSection.cs
- Timer.cs
- TagPrefixAttribute.cs
- MarshalByRefObject.cs
- SystemThemeKey.cs
- Facet.cs
- FileChangeNotifier.cs
- Translator.cs
- PopupControlService.cs
- StylusPointDescription.cs
- TypeInfo.cs
- ExceptionHelpers.cs
- BindingExpressionBase.cs
- PropertyGridView.cs
- ObjectDataSourceFilteringEventArgs.cs
- DataGridViewButtonColumn.cs
- ValueSerializer.cs
- PreloadedPackages.cs
- CommandSet.cs
- BuildProvider.cs
- VersionConverter.cs
- NumberSubstitution.cs
- TextContainerHelper.cs
- LazyTextWriterCreator.cs
- UniqueConstraint.cs
- AuthenticatedStream.cs
- KeyInstance.cs
- GifBitmapDecoder.cs
- UnaryNode.cs