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
- SemanticBasicElement.cs
- NativeMethods.cs
- MultiAsyncResult.cs
- DynamicRouteExpression.cs
- FixedSOMLineCollection.cs
- SettingsSection.cs
- PersistenceTypeAttribute.cs
- CompositeControlDesigner.cs
- AddInDeploymentState.cs
- Set.cs
- EnvironmentPermission.cs
- GcSettings.cs
- ContextConfiguration.cs
- RegexGroupCollection.cs
- ParserStreamGeometryContext.cs
- MappingMetadataHelper.cs
- OleDbParameter.cs
- NameTable.cs
- WebZone.cs
- ForEachAction.cs
- VariantWrapper.cs
- LocationSectionRecord.cs
- CaseInsensitiveOrdinalStringComparer.cs
- AddInContractAttribute.cs
- CompiledQueryCacheKey.cs
- TransactionOptions.cs
- DataViewListener.cs
- InputScopeConverter.cs
- StandardBindingOptionalReliableSessionElement.cs
- AppDomainShutdownMonitor.cs
- ToolboxCategoryItems.cs
- Dynamic.cs
- Authorization.cs
- Script.cs
- PropertyMetadata.cs
- FtpRequestCacheValidator.cs
- SendAgentStatusRequest.cs
- TableParaClient.cs
- TaskSchedulerException.cs
- DataGridViewSelectedCellCollection.cs
- ProcessingInstructionAction.cs
- SamlAuthenticationClaimResource.cs
- DecimalAnimationBase.cs
- TransformedBitmap.cs
- DrawTreeNodeEventArgs.cs
- RSAPKCS1KeyExchangeFormatter.cs
- SqlInternalConnection.cs
- FontConverter.cs
- ToolStripOverflowButton.cs
- DataContract.cs
- MinimizableAttributeTypeConverter.cs
- DesignerActionMethodItem.cs
- UriTemplateMatchException.cs
- NaturalLanguageHyphenator.cs
- SoapReflectionImporter.cs
- SymLanguageVendor.cs
- PerspectiveCamera.cs
- LassoHelper.cs
- ExtensibleClassFactory.cs
- DataGridBoundColumn.cs
- VerificationAttribute.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- PublisherMembershipCondition.cs
- WebResourceUtil.cs
- DelegateSerializationHolder.cs
- EvidenceTypeDescriptor.cs
- PartialCachingControl.cs
- jithelpers.cs
- PropertyDescriptor.cs
- ChangeProcessor.cs
- RecognitionEventArgs.cs
- PreProcessInputEventArgs.cs
- HttpResponse.cs
- ServiceBusyException.cs
- ForeignKeyConstraint.cs
- PersianCalendar.cs
- ActivityDesignerAccessibleObject.cs
- ZipIOLocalFileBlock.cs
- SynchronizationLockException.cs
- OperationCanceledException.cs
- _AutoWebProxyScriptEngine.cs
- HostedBindingBehavior.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- ServiceBuildProvider.cs
- InputMethod.cs
- XmlWhitespace.cs
- ExternalFile.cs
- WeakReferenceList.cs
- shaperfactoryquerycacheentry.cs
- DocumentProperties.cs
- Path.cs
- TaskHelper.cs
- SafeEventLogWriteHandle.cs
- TypeUsageBuilder.cs
- _Semaphore.cs
- VersionedStreamOwner.cs
- ReflectionTypeLoadException.cs
- XmlBoundElement.cs
- COM2PropertyPageUITypeConverter.cs
- DSASignatureFormatter.cs