Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Shared / MS / Win32 / SafeSystemMetrics.cs / 1 / SafeSystemMetrics.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2004 // // File: SafeSystemMetrics.cs // This class is copied from the system metrics class in frameworks. The // reason it exists is to consolidate all system metric calls through one layer // so that maintenance from a security stand point gets easier. We will add // mertrics on a need basis. The caching code is removed since the original calls // that were moved here do not rely on caching. If there is a percieved perf. problem // we can work on enabling this. //----------------------------------------------------------------------------- using System; using System.Collections; using System.Runtime.InteropServices; using System.Windows.Media; using Microsoft.Win32; using System.Security; using System.Security.Permissions; using MS.Win32; using MS.Internal; using MS.Internal.PresentationCore; namespace MS.Win32 { ////// Contains properties that are queries into the system's various settings. /// [FriendAccessAllowed] // Built into Core, also used by Framework. internal sealed class SafeSystemMetrics { private SafeSystemMetrics() { } #if !PRESENTATION_CORE ////// Maps to SM_CXVIRTUALSCREEN /// ////// TreatAsSafe --There exists a demand /// Security Critical -- Calling UnsafeNativeMethods /// internal static int VirtualScreenWidth { [SecurityCritical,SecurityTreatAsSafe] get { SecurityHelper.DemandUnmanagedCode(); return UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CXVIRTUALSCREEN); } } ////// Maps to SM_CYVIRTUALSCREEN /// ////// TreatAsSafe --There exists a demand /// Security Critical -- Calling UnsafeNativeMethods /// internal static int VirtualScreenHeight { [SecurityCritical,SecurityTreatAsSafe] get { SecurityHelper.DemandUnmanagedCode(); return UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CYVIRTUALSCREEN); } } #endif //end !PRESENTATIONCORE ////// Maps to SM_CXDOUBLECLK /// ////// TreatAsSafe --This data is safe to expose /// Security Critical -- Calling UnsafeNativeMethods /// internal static int DoubleClickDeltaX { [SecurityCritical, SecurityTreatAsSafe] get { return UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CXDOUBLECLK); } } ////// Maps to SM_CYDOUBLECLK /// ////// TreatAsSafe --This data is safe to expose /// Security Critical -- Calling UnsafeNativeMethods /// internal static int DoubleClickDeltaY { [SecurityCritical, SecurityTreatAsSafe] get { return UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CYDOUBLECLK); } } ////// Maps to SM_CXDRAG /// ////// TreatAsSafe --This data is safe to expose /// Security Critical -- Calling UnsafeNativeMethods /// internal static int DragDeltaX { [SecurityCritical, SecurityTreatAsSafe] get { return UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CXDRAG); } } ////// Maps to SM_CYDRAG /// ////// TreatAsSafe --This data is safe to expose /// Security Critical -- Calling UnsafeNativeMethods /// internal static int DragDeltaY { [SecurityCritical, SecurityTreatAsSafe] get { return UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_CYDRAG); } } ////// Is an IMM enabled ? Maps to SM_IMMENABLED /// //////Critical - calls a method that performs an elevation. /// TreatAsSafe - data is considered safe to expose. /// internal static bool IsImmEnabled { [SecurityCritical, SecurityTreatAsSafe] get { return (UnsafeNativeMethods.GetSystemMetrics(NativeMethods.SM_IMMENABLED) != 0); } } } } // 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
- Trace.cs
- ApplyImportsAction.cs
- SessionStateContainer.cs
- XsltCompileContext.cs
- AttachedPropertyMethodSelector.cs
- PointHitTestResult.cs
- ToolStripSeparatorRenderEventArgs.cs
- EntryIndex.cs
- TreeNodeStyle.cs
- MenuTracker.cs
- JpegBitmapEncoder.cs
- pingexception.cs
- ToolStripMenuItem.cs
- IntSecurity.cs
- MenuItem.cs
- SplitterEvent.cs
- LabelEditEvent.cs
- BaseParser.cs
- Model3D.cs
- OracleException.cs
- MetaDataInfo.cs
- DeviceContext.cs
- SqlParameterizer.cs
- DataStreams.cs
- EncodedStreamFactory.cs
- IUnknownConstantAttribute.cs
- GroupItem.cs
- EnumerableCollectionView.cs
- WebPartChrome.cs
- MultipleViewProviderWrapper.cs
- AppDomainManager.cs
- CultureInfoConverter.cs
- Stylesheet.cs
- HelpFileFileNameEditor.cs
- XmlEncoding.cs
- Source.cs
- DiagnosticStrings.cs
- Int64KeyFrameCollection.cs
- WindowsScrollBar.cs
- DocumentSequence.cs
- EmptyElement.cs
- ClientRoleProvider.cs
- EmbossBitmapEffect.cs
- SchemaTypeEmitter.cs
- Soap12ProtocolReflector.cs
- IPCCacheManager.cs
- StoreAnnotationsMap.cs
- ResolveMatchesCD1.cs
- ComPlusThreadInitializer.cs
- FocusTracker.cs
- ZipIOFileItemStream.cs
- ImageProxy.cs
- DisplayMemberTemplateSelector.cs
- MultiBindingExpression.cs
- ObjectPersistData.cs
- TriState.cs
- ColumnHeaderConverter.cs
- BindingContext.cs
- RealProxy.cs
- DbConnectionStringCommon.cs
- IMembershipProvider.cs
- StickyNoteHelper.cs
- ScriptManagerProxy.cs
- SqlProviderServices.cs
- IconBitmapDecoder.cs
- CustomCredentialPolicy.cs
- Screen.cs
- ListViewItemMouseHoverEvent.cs
- ControlCommandSet.cs
- BindingListCollectionView.cs
- SpeakInfo.cs
- Publisher.cs
- NumericUpDown.cs
- Vector3dCollection.cs
- MimeMapping.cs
- ProcessHostServerConfig.cs
- EntitySqlException.cs
- InternalUserCancelledException.cs
- TypeAccessException.cs
- RectangleConverter.cs
- EmptyArray.cs
- ConfigurationValue.cs
- StrokeNodeData.cs
- ProjectedWrapper.cs
- TextSelectionProcessor.cs
- IncrementalCompileAnalyzer.cs
- TouchEventArgs.cs
- ModelService.cs
- VScrollBar.cs
- LogEntry.cs
- BinaryConverter.cs
- PropertyInformation.cs
- ProfileElement.cs
- AmbientProperties.cs
- UnsafeNativeMethods.cs
- NetTcpBindingCollectionElement.cs
- TextElement.cs
- DynamicResourceExtension.cs
- StrokeFIndices.cs
- SchemaTableOptionalColumn.cs