Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Shared / MS / Internal / safesecurityhelperavalon.cs / 1305600 / safesecurityhelperavalon.cs
/****************************************************************************\
*
* File: SafeSecurityHelper.cs
*
* Purpose: Helper functions for avalon code that require elevation but are safe to use.
*
* History:
* 12/09/04: marka Created
*
* Copyright (C) 2004 by Microsoft Corporation. All rights reserved.
*
\***************************************************************************/
using System;
using System.Globalization;
using System.Security;
using System.Security.Permissions;
using System.Reflection;
using System.Windows.Media ;
using System.Windows;
//****************
//
// this class is for helpers that require avalon.
// done this way so that Compiler doesn't build this file to minimize dependencies compiler has.
//
//****************
#if WINDOWS_BASE
namespace MS.Internal.WindowsBase
#elif PRESENTATION_CORE
namespace MS.Internal.PresentationCore
#elif PRESENTATIONFRAMEWORK
namespace MS.Internal.PresentationFramework
#elif DRT
namespace MS.Internal.Drt
#else
#error Attempting to use this class from an unknown assembly.
#endif
{
internal static partial class SafeSecurityHelper
{
///
/// is this visual connected to presentation source ?
/// i.e. is it "renderable" ?
///
///
/// Critical - extracts presentationsource
/// TreatAsSafe - Knowing whether you're connected to presentation source is ok.
///
[SecurityCritical, SecurityTreatAsSafe]
internal static bool IsConnectedToPresentationSource( Visual visual )
{
bool isConnected = false;
isConnected = PresentationSource.CriticalFromVisual(visual ) != null;
return isConnected ;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
/****************************************************************************\
*
* File: SafeSecurityHelper.cs
*
* Purpose: Helper functions for avalon code that require elevation but are safe to use.
*
* History:
* 12/09/04: marka Created
*
* Copyright (C) 2004 by Microsoft Corporation. All rights reserved.
*
\***************************************************************************/
using System;
using System.Globalization;
using System.Security;
using System.Security.Permissions;
using System.Reflection;
using System.Windows.Media ;
using System.Windows;
//****************
//
// this class is for helpers that require avalon.
// done this way so that Compiler doesn't build this file to minimize dependencies compiler has.
//
//****************
#if WINDOWS_BASE
namespace MS.Internal.WindowsBase
#elif PRESENTATION_CORE
namespace MS.Internal.PresentationCore
#elif PRESENTATIONFRAMEWORK
namespace MS.Internal.PresentationFramework
#elif DRT
namespace MS.Internal.Drt
#else
#error Attempting to use this class from an unknown assembly.
#endif
{
internal static partial class SafeSecurityHelper
{
///
/// is this visual connected to presentation source ?
/// i.e. is it "renderable" ?
///
///
/// Critical - extracts presentationsource
/// TreatAsSafe - Knowing whether you're connected to presentation source is ok.
///
[SecurityCritical, SecurityTreatAsSafe]
internal static bool IsConnectedToPresentationSource( Visual visual )
{
bool isConnected = false;
isConnected = PresentationSource.CriticalFromVisual(visual ) != null;
return isConnected ;
}
}
}
// 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
- PixelFormats.cs
- ToolStripRenderEventArgs.cs
- ClickablePoint.cs
- DataControlImageButton.cs
- XsdDateTime.cs
- TypeContext.cs
- RegexTree.cs
- GeneralTransformGroup.cs
- DataGridViewImageColumn.cs
- ColumnCollection.cs
- ImageKeyConverter.cs
- QilVisitor.cs
- EntitySetBase.cs
- NativeActivity.cs
- ListMarkerSourceInfo.cs
- SqlCacheDependencyDatabaseCollection.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- TraceSection.cs
- IODescriptionAttribute.cs
- MembershipAdapter.cs
- PhysicalAddress.cs
- StylusCollection.cs
- MDIWindowDialog.cs
- CodeConditionStatement.cs
- SystemInfo.cs
- QilName.cs
- CellCreator.cs
- BitmapEffectrendercontext.cs
- FlowSwitchDesigner.xaml.cs
- ObservableCollection.cs
- WindowsTitleBar.cs
- BackgroundFormatInfo.cs
- WebMessageBodyStyleHelper.cs
- RoutedEventHandlerInfo.cs
- TextCompositionEventArgs.cs
- GenericTextProperties.cs
- ServiceManagerHandle.cs
- InternalRelationshipCollection.cs
- UnsafeNativeMethods.cs
- ShaderEffect.cs
- LocationReferenceValue.cs
- WinFormsSecurity.cs
- FigureParagraph.cs
- PeerInvitationResponse.cs
- GraphicsPath.cs
- DetailsViewInsertEventArgs.cs
- ApplicationCommands.cs
- CodeObject.cs
- GlyphTypeface.cs
- TextBoxAutomationPeer.cs
- Point4DConverter.cs
- DiscoveryClientReferences.cs
- ActivityDesignerAccessibleObject.cs
- ImageKeyConverter.cs
- Resources.Designer.cs
- CommandID.cs
- ToolStrip.cs
- InputLanguage.cs
- _ScatterGatherBuffers.cs
- VirtualPathUtility.cs
- EntityDataSourceEntitySetNameItem.cs
- HostingEnvironmentSection.cs
- MemberMemberBinding.cs
- XmlElementAttributes.cs
- ImageAttributes.cs
- _NegotiateClient.cs
- CacheChildrenQuery.cs
- CacheDependency.cs
- WorkflowDesignerColors.cs
- ContainerVisual.cs
- SessionPageStateSection.cs
- ButtonFieldBase.cs
- MouseWheelEventArgs.cs
- ReadOnlyCollection.cs
- DrawListViewColumnHeaderEventArgs.cs
- SQLMoney.cs
- LowerCaseStringConverter.cs
- RecordBuilder.cs
- ToolboxItemAttribute.cs
- CookieProtection.cs
- ProcessHostServerConfig.cs
- SafeFileMappingHandle.cs
- ProxyWebPartManager.cs
- PtsHelper.cs
- TextPointerBase.cs
- ListViewContainer.cs
- SearchForVirtualItemEventArgs.cs
- XMLSyntaxException.cs
- DataSetMappper.cs
- OptimalTextSource.cs
- ProgressiveCrcCalculatingStream.cs
- CompensationHandlingFilter.cs
- DataGridCellAutomationPeer.cs
- GlyphRun.cs
- QueryAccessibilityHelpEvent.cs
- HMACSHA384.cs
- ObjectDataSourceSelectingEventArgs.cs
- ControlDesignerState.cs
- EditorZoneBase.cs
- OleDbParameter.cs