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
- Canvas.cs
- MessageSecurityOverHttpElement.cs
- IISUnsafeMethods.cs
- GeometryModel3D.cs
- LabelAutomationPeer.cs
- PhoneCall.cs
- TextRunCacheImp.cs
- DebugViewWriter.cs
- XmlAttributeCollection.cs
- ResourceDescriptionAttribute.cs
- ExpressionPrefixAttribute.cs
- HitTestParameters3D.cs
- Tokenizer.cs
- ManagementOperationWatcher.cs
- BindingNavigator.cs
- Transform.cs
- Setter.cs
- XAMLParseException.cs
- OperandQuery.cs
- RelatedView.cs
- EventManager.cs
- SafeThemeHandle.cs
- PingReply.cs
- TextChange.cs
- NavigationPropertyEmitter.cs
- ADMembershipUser.cs
- XPathConvert.cs
- ValidationEventArgs.cs
- StdValidatorsAndConverters.cs
- NameNode.cs
- QilFunction.cs
- TextRangeSerialization.cs
- HostAdapter.cs
- BitmapMetadataEnumerator.cs
- PolyLineSegment.cs
- PkcsUtils.cs
- Grid.cs
- IDQuery.cs
- oledbmetadatacolumnnames.cs
- ExtendedPropertyDescriptor.cs
- OdbcParameterCollection.cs
- SQLDecimal.cs
- RelatedImageListAttribute.cs
- EntityDataSourceDataSelection.cs
- DuplicateWaitObjectException.cs
- StringCollection.cs
- DataViewManager.cs
- OpacityConverter.cs
- FlowchartDesigner.Helpers.cs
- EntityConnection.cs
- PositiveTimeSpanValidator.cs
- ControlBindingsConverter.cs
- WindowsListViewItem.cs
- SubMenuStyleCollection.cs
- Material.cs
- RealizationContext.cs
- TransactionManager.cs
- ObjectSecurityT.cs
- DocumentsTrace.cs
- SchemaInfo.cs
- TimeoutValidationAttribute.cs
- ControlParameter.cs
- DispatcherSynchronizationContext.cs
- MediaPlayer.cs
- GZipStream.cs
- EntityViewGenerationAttribute.cs
- ErrorFormatterPage.cs
- NavigationCommands.cs
- DetailsViewCommandEventArgs.cs
- TCPClient.cs
- SqlInternalConnectionTds.cs
- ImageButton.cs
- FormViewAutoFormat.cs
- ReflectTypeDescriptionProvider.cs
- WebHttpDispatchOperationSelector.cs
- PictureBox.cs
- ControlCachePolicy.cs
- ConfigurationSectionGroup.cs
- KeyBinding.cs
- OutputCacheModule.cs
- FixedSOMLineCollection.cs
- AuthenticationService.cs
- UpdateException.cs
- ActionFrame.cs
- FilteredXmlReader.cs
- _ListenerResponseStream.cs
- StructuralObject.cs
- GeneralTransform3DTo2D.cs
- BitmapEffect.cs
- SoapInteropTypes.cs
- RIPEMD160.cs
- TextEditorSelection.cs
- ThreadLocal.cs
- ContentValidator.cs
- HostingPreferredMapPath.cs
- Invariant.cs
- Journal.cs
- ZipIOLocalFileDataDescriptor.cs
- ScrollContentPresenter.cs
- XmlPropertyBag.cs