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
- CapabilitiesSection.cs
- MessageEncodingBindingElement.cs
- XmlSchemaGroup.cs
- CompressedStack.cs
- CommentEmitter.cs
- ObjectContext.cs
- SerializationAttributes.cs
- DialogWindow.cs
- CalculatedColumn.cs
- RuntimeConfig.cs
- SectionVisual.cs
- ModuleConfigurationInfo.cs
- SkewTransform.cs
- RuleSettings.cs
- ImageSource.cs
- Number.cs
- ByteViewer.cs
- XamlValidatingReader.cs
- ObjectDataSourceFilteringEventArgs.cs
- RemotingHelper.cs
- GroupItemAutomationPeer.cs
- KeyGestureValueSerializer.cs
- OleServicesContext.cs
- BitmapEffectDrawingContextWalker.cs
- XmlBinaryReader.cs
- ModelChangedEventArgsImpl.cs
- InternalConfigEventArgs.cs
- ScriptingSectionGroup.cs
- DeviceContext.cs
- PageFunction.cs
- ContextStaticAttribute.cs
- AttributeUsageAttribute.cs
- AggregateNode.cs
- RecognitionEventArgs.cs
- RawAppCommandInputReport.cs
- HtmlInputPassword.cs
- StartUpEventArgs.cs
- SpAudioStreamWrapper.cs
- ListDictionaryInternal.cs
- TableLayoutCellPaintEventArgs.cs
- SQLSingleStorage.cs
- NominalTypeEliminator.cs
- Scanner.cs
- Soap12ServerProtocol.cs
- PeerApplication.cs
- ObjectIDGenerator.cs
- ManagedIStream.cs
- PeerNameRecord.cs
- WaitHandle.cs
- TextSelection.cs
- wgx_sdk_version.cs
- EventProviderWriter.cs
- StdRegProviderWrapper.cs
- DataServices.cs
- DataSource.cs
- SqlBulkCopy.cs
- LineUtil.cs
- FontFamily.cs
- JavaScriptSerializer.cs
- Timer.cs
- XamlTypeMapper.cs
- WpfXamlLoader.cs
- FilterElement.cs
- DashStyle.cs
- EventToken.cs
- FixedSOMElement.cs
- SpellerError.cs
- RNGCryptoServiceProvider.cs
- PtsContext.cs
- DependencyPropertyAttribute.cs
- NonBatchDirectoryCompiler.cs
- PersistenceTypeAttribute.cs
- AnonymousIdentificationModule.cs
- COM2PropertyDescriptor.cs
- UidManager.cs
- EditModeSwitchButton.cs
- UserControlAutomationPeer.cs
- ContainerParagraph.cs
- SqlDataSourceQueryEditorForm.cs
- RepeatButtonAutomationPeer.cs
- SemaphoreSecurity.cs
- HTTPNotFoundHandler.cs
- QilGeneratorEnv.cs
- SqlCommand.cs
- DES.cs
- LoginUtil.cs
- ServiceContractGenerator.cs
- EUCJPEncoding.cs
- TemplateField.cs
- TabItem.cs
- DocumentPageViewAutomationPeer.cs
- Material.cs
- DeviceSpecificChoiceCollection.cs
- ScriptModule.cs
- DataObjectEventArgs.cs
- BaseCollection.cs
- InternalPermissions.cs
- List.cs
- CacheMemory.cs
- Solver.cs