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
- AttributeCollection.cs
- DataGridRowAutomationPeer.cs
- XmlSchemaGroup.cs
- PieceNameHelper.cs
- ConfigurationPropertyAttribute.cs
- X509ChainElement.cs
- FixedSchema.cs
- ApplicationHost.cs
- XmlDocument.cs
- __TransparentProxy.cs
- AnonymousIdentificationModule.cs
- DataViewListener.cs
- XmlArrayAttribute.cs
- TemplateInstanceAttribute.cs
- UnicodeEncoding.cs
- SHA384Managed.cs
- IdentityManager.cs
- RangeValueProviderWrapper.cs
- GradientStop.cs
- CmsUtils.cs
- DriveNotFoundException.cs
- SafeFileMapViewHandle.cs
- HttpInputStream.cs
- ResXResourceSet.cs
- BStrWrapper.cs
- SecurityChannelListener.cs
- InputProcessorProfiles.cs
- XmlSchemaValidationException.cs
- sapiproxy.cs
- LookupNode.cs
- LabelAutomationPeer.cs
- MdbDataFileEditor.cs
- TaskHelper.cs
- ControlBuilderAttribute.cs
- InkCanvasSelection.cs
- BuilderPropertyEntry.cs
- IssuanceLicense.cs
- TypeHelpers.cs
- CallSiteBinder.cs
- TablePatternIdentifiers.cs
- DataGridViewTopRowAccessibleObject.cs
- ProtectedConfiguration.cs
- NullableBoolConverter.cs
- RelationshipType.cs
- NegotiateStream.cs
- EnumBuilder.cs
- AssertSection.cs
- Stack.cs
- DataControlImageButton.cs
- SqlReferenceCollection.cs
- ListComponentEditorPage.cs
- _BufferOffsetSize.cs
- Compilation.cs
- DataRelation.cs
- Int64Storage.cs
- ObjectDataSourceStatusEventArgs.cs
- RenderingEventArgs.cs
- FastEncoder.cs
- IndicShape.cs
- BinaryUtilClasses.cs
- HostingPreferredMapPath.cs
- MultipartContentParser.cs
- HttpRequestCacheValidator.cs
- WSHttpSecurity.cs
- FactoryGenerator.cs
- EmptyElement.cs
- Adorner.cs
- UrlMappingsSection.cs
- EndPoint.cs
- SQLInt32Storage.cs
- IndexedWhereQueryOperator.cs
- StickyNoteContentControl.cs
- FontEmbeddingManager.cs
- CompositeFontInfo.cs
- LicenseContext.cs
- XmlEnumAttribute.cs
- ServiceModelSectionGroup.cs
- HttpResponseInternalWrapper.cs
- xmlsaver.cs
- WindowsUpDown.cs
- MutexSecurity.cs
- StorageComplexPropertyMapping.cs
- DES.cs
- PointLightBase.cs
- ScrollBarAutomationPeer.cs
- DesignerCategoryAttribute.cs
- Group.cs
- UnmanagedMemoryStream.cs
- SendKeys.cs
- GridViewRowPresenter.cs
- PasswordRecovery.cs
- QilBinary.cs
- FileUtil.cs
- SafeNativeMethods.cs
- SecurityCapabilities.cs
- TypeBuilderInstantiation.cs
- IPipelineRuntime.cs
- AnimatedTypeHelpers.cs
- EdmPropertyAttribute.cs
- Int32.cs