Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Input / Win32KeyboardDevice.cs / 1 / Win32KeyboardDevice.cs
using System.Collections; using System.Windows; using System.Security; using System.Security.Permissions; using MS.Internal; using MS.Internal.PresentationCore; // SecurityHelper using System.Windows.Media; using MS.Win32; // VK translation. using System; using SR=MS.Internal.PresentationCore.SR; using SRID=MS.Internal.PresentationCore.SRID; namespace System.Windows.Input { ////// The Win32KeyboardDevice class implements the platform specific /// KeyboardDevice features for the Win32 platform /// internal sealed class Win32KeyboardDevice : KeyboardDevice { ////// /// /// /// ////// Critical: This code creates critical data(_tsfManager,_textcompositionManager) and stores critical data (inputManager) /// TreatAsSafe: Although it creates critical data there are demand on the critical data and the constructor is safe /// [SecurityCritical,SecurityTreatAsSafe] internal Win32KeyboardDevice(InputManager inputManager) : base(inputManager) { } ////// Gets the current state of the specified key from the device from the underlying system /// /// /// Key to get the state of /// ////// The state of the specified key /// ////// Critical: Makes calls to UnsafeNativeMethods (GetKeyState) /// TreatAsSafe: Only returns the current state of a specified key /// [SecurityCritical, SecurityTreatAsSafe] protected override KeyStates GetKeyStatesFromSystem(Key key) { KeyStates keyStates = KeyStates.None; // Security Mitigation: do not give out input state if the device is not active. if(IsActive) { int virtualKeyCode = KeyInterop.VirtualKeyFromKey(key); int nativeKeyState; nativeKeyState = UnsafeNativeMethods.GetKeyState(virtualKeyCode); if( (nativeKeyState & 0x00008000) == 0x00008000 ) keyStates |= KeyStates.Down; if( (nativeKeyState & 0x00000001) == 0x00000001 ) keyStates |= KeyStates.Toggled; } return keyStates; } } } // 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
- shaperfactoryquerycacheentry.cs
- XsdValidatingReader.cs
- Privilege.cs
- ZoneMembershipCondition.cs
- InvalidEnumArgumentException.cs
- Trace.cs
- Resources.Designer.cs
- WsdlHelpGeneratorElement.cs
- WindowsPen.cs
- EncodingInfo.cs
- MenuItemStyle.cs
- XmlQueryCardinality.cs
- SmtpReplyReader.cs
- XmlSchemaValidator.cs
- PatternMatchRules.cs
- CoTaskMemSafeHandle.cs
- QilReplaceVisitor.cs
- ToolStripPanelSelectionGlyph.cs
- InstanceDataCollectionCollection.cs
- XmlBinaryReaderSession.cs
- ListViewCancelEventArgs.cs
- BaseParagraph.cs
- xml.cs
- BulletDecorator.cs
- HtmlShim.cs
- DataColumnMappingCollection.cs
- DatatypeImplementation.cs
- PageMediaSize.cs
- ProfessionalColors.cs
- AVElementHelper.cs
- SiteOfOriginContainer.cs
- DbProviderFactory.cs
- DesignTable.cs
- EventProxy.cs
- ClientRuntimeConfig.cs
- EraserBehavior.cs
- TagPrefixInfo.cs
- Frame.cs
- brushes.cs
- TakeQueryOptionExpression.cs
- DifferencingCollection.cs
- StrongNamePublicKeyBlob.cs
- FormatterServices.cs
- DrawListViewSubItemEventArgs.cs
- CheckPair.cs
- SqlPersonalizationProvider.cs
- WebResourceAttribute.cs
- IPPacketInformation.cs
- GeneralTransform3DTo2D.cs
- UIElementPropertyUndoUnit.cs
- WebResourceUtil.cs
- Column.cs
- DataGridViewButtonColumn.cs
- SimpleExpression.cs
- AlternateViewCollection.cs
- Context.cs
- ClientUtils.cs
- ScrollChrome.cs
- InitializerFacet.cs
- Win32SafeHandles.cs
- Selection.cs
- VisualTarget.cs
- FormsAuthentication.cs
- SmiMetaDataProperty.cs
- UnionCqlBlock.cs
- AdvancedBindingEditor.cs
- BamlLocalizationDictionary.cs
- FormViewUpdatedEventArgs.cs
- PathNode.cs
- Label.cs
- ItemCollection.cs
- SystemIPGlobalProperties.cs
- SerializableAttribute.cs
- StyleTypedPropertyAttribute.cs
- ProfileGroupSettingsCollection.cs
- __Error.cs
- filewebresponse.cs
- MouseGesture.cs
- LogSwitch.cs
- XmlAnyAttributeAttribute.cs
- BinarySerializer.cs
- shaper.cs
- QilPatternFactory.cs
- ELinqQueryState.cs
- ParentUndoUnit.cs
- TableLayoutCellPaintEventArgs.cs
- Ray3DHitTestResult.cs
- ListSortDescriptionCollection.cs
- KeyInfo.cs
- ObjectSpanRewriter.cs
- XmlTextReaderImpl.cs
- IPEndPointCollection.cs
- VBIdentifierDesigner.xaml.cs
- FloaterBaseParagraph.cs
- BackStopAuthenticationModule.cs
- WebAdminConfigurationHelper.cs
- EdgeModeValidation.cs
- DataKeyCollection.cs
- ParserExtension.cs
- NativeMethodsCLR.cs