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
- EntityContainerAssociationSetEnd.cs
- PrivateFontCollection.cs
- ISAPIRuntime.cs
- MenuItemBinding.cs
- EnumMemberAttribute.cs
- GridPattern.cs
- ExtensibleClassFactory.cs
- TraceHandler.cs
- XmlDomTextWriter.cs
- Pair.cs
- DataTemplateSelector.cs
- SettingsSavedEventArgs.cs
- CreateUserWizard.cs
- BaseCodePageEncoding.cs
- XmlDictionaryReaderQuotas.cs
- WebPartTransformer.cs
- IncrementalHitTester.cs
- smtpconnection.cs
- SafeUserTokenHandle.cs
- BoundingRectTracker.cs
- ErrorItem.cs
- ExpandableObjectConverter.cs
- CaseExpr.cs
- IdentifierService.cs
- ContractMapping.cs
- InOutArgument.cs
- FileDialog.cs
- MouseGestureValueSerializer.cs
- XmlReflectionMember.cs
- SqlBulkCopy.cs
- MediaContext.cs
- EntityDataSourceEntitySetNameItem.cs
- CryptoConfig.cs
- Span.cs
- StringUtil.cs
- DiscoveryInnerClientAdhocCD1.cs
- ValueType.cs
- ChtmlTextBoxAdapter.cs
- Polygon.cs
- SqlConnectionStringBuilder.cs
- LayoutSettings.cs
- Errors.cs
- KeySpline.cs
- SqlCacheDependency.cs
- HashHelper.cs
- ServiceX509SecurityTokenProvider.cs
- Image.cs
- CodePageUtils.cs
- AsymmetricAlgorithm.cs
- TemplateControlBuildProvider.cs
- XmlEncodedRawTextWriter.cs
- ObjectDataSourceView.cs
- CodeDomSerializerException.cs
- CanonicalFormWriter.cs
- HWStack.cs
- WebServiceTypeData.cs
- XmlSerializerSection.cs
- Enum.cs
- XPathNodeList.cs
- NativeMethods.cs
- TableCellCollection.cs
- SystemTcpStatistics.cs
- MaterialCollection.cs
- DispatcherTimer.cs
- metadatamappinghashervisitor.cs
- CodeGroup.cs
- EventListener.cs
- ipaddressinformationcollection.cs
- NavigationPropertyEmitter.cs
- DefaultHttpHandler.cs
- Attributes.cs
- SHA384Managed.cs
- FormsAuthenticationUser.cs
- ISAPIRuntime.cs
- XPathDocumentBuilder.cs
- Formatter.cs
- Logging.cs
- HyperlinkAutomationPeer.cs
- DataGridViewRowsAddedEventArgs.cs
- MimePart.cs
- GlyphsSerializer.cs
- ShaderEffect.cs
- odbcmetadatafactory.cs
- printdlgexmarshaler.cs
- AuthorizationRuleCollection.cs
- ObservableDictionary.cs
- PropertyExpression.cs
- FocusManager.cs
- NonNullItemCollection.cs
- Separator.cs
- SchemaTableOptionalColumn.cs
- StylusCollection.cs
- DynamicScriptObject.cs
- RegistryDataKey.cs
- EmbeddedMailObjectsCollection.cs
- X509ImageLogo.cs
- TypeTypeConverter.cs
- BinaryObjectWriter.cs
- UnsafeNativeMethodsPenimc.cs
- EntityException.cs