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
- WindowsTreeView.cs
- RightsManagementInformation.cs
- CroppedBitmap.cs
- SetterBase.cs
- ApplicationDirectoryMembershipCondition.cs
- SQLCharsStorage.cs
- WebControlParameterProxy.cs
- RecognizerBase.cs
- InputElement.cs
- RenderDataDrawingContext.cs
- GregorianCalendarHelper.cs
- Tool.cs
- XmlBufferReader.cs
- PersonalizationState.cs
- QueryStringHandler.cs
- ClientClassGenerator.cs
- DataKeyCollection.cs
- ThousandthOfEmRealDoubles.cs
- Bitmap.cs
- SystemThemeKey.cs
- ImageAttributes.cs
- oledbconnectionstring.cs
- InternalConfigRoot.cs
- XamlToRtfParser.cs
- XmlQueryContext.cs
- BamlBinaryReader.cs
- HttpFileCollection.cs
- EmptyImpersonationContext.cs
- autovalidator.cs
- configsystem.cs
- RectConverter.cs
- RemotingClientProxy.cs
- CursorInteropHelper.cs
- BamlLocalizableResource.cs
- UDPClient.cs
- TextTabProperties.cs
- CompositionDesigner.cs
- Visual3DCollection.cs
- ProfileInfo.cs
- Int32Converter.cs
- VarRemapper.cs
- InsufficientMemoryException.cs
- NativeActivityTransactionContext.cs
- bindurihelper.cs
- IChannel.cs
- FontWeightConverter.cs
- HasCopySemanticsAttribute.cs
- SessionEndingEventArgs.cs
- SyntaxCheck.cs
- ListViewInsertedEventArgs.cs
- TransformPattern.cs
- Clock.cs
- HandlerBase.cs
- GridViewDeleteEventArgs.cs
- WindowsSlider.cs
- Section.cs
- Object.cs
- LineInfo.cs
- FunctionImportMapping.cs
- ClientSideQueueItem.cs
- CatalogZoneDesigner.cs
- ComponentGuaranteesAttribute.cs
- oledbmetadatacollectionnames.cs
- Stack.cs
- ErrorFormatter.cs
- SqlProcedureAttribute.cs
- AssertFilter.cs
- XmlIncludeAttribute.cs
- TwoPhaseCommitProxy.cs
- BitmapSourceSafeMILHandle.cs
- TimerEventSubscription.cs
- TouchFrameEventArgs.cs
- DrawingDrawingContext.cs
- LoginView.cs
- HostedTransportConfigurationManager.cs
- ConfigurationValues.cs
- CellTreeNodeVisitors.cs
- EventToken.cs
- CustomErrorsSection.cs
- DataGridCell.cs
- SQLByteStorage.cs
- AccessDataSourceDesigner.cs
- ImageSource.cs
- _NtlmClient.cs
- PerformanceCounterTraceRecord.cs
- IPEndPoint.cs
- ComponentEvent.cs
- FileDialogCustomPlacesCollection.cs
- DateTimeParse.cs
- CompoundFileStreamReference.cs
- SQLMoney.cs
- NumberFunctions.cs
- AdvancedBindingPropertyDescriptor.cs
- RequestQueue.cs
- HttpListener.cs
- ObjectDataSourceEventArgs.cs
- Size3DConverter.cs
- IndexExpression.cs
- SafeFileMappingHandle.cs
- ImageListImage.cs