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
- XmlSchemaSubstitutionGroup.cs
- Version.cs
- BooleanStorage.cs
- ExtensionSimplifierMarkupObject.cs
- WebPartManagerDesigner.cs
- HandlerMappingMemo.cs
- MenuItemBindingCollection.cs
- PairComparer.cs
- IisTraceListener.cs
- ObjectDataSourceDesigner.cs
- SQLInt64.cs
- WebPartCollection.cs
- WebContext.cs
- Span.cs
- SID.cs
- UserPreferenceChangingEventArgs.cs
- DataGridViewCellStateChangedEventArgs.cs
- ServicesUtilities.cs
- XamlClipboardData.cs
- BindingEditor.xaml.cs
- QueryContinueDragEventArgs.cs
- Table.cs
- AttachmentService.cs
- SQLBinaryStorage.cs
- EncodedStreamFactory.cs
- IISUnsafeMethods.cs
- SelectingProviderEventArgs.cs
- UniqueIdentifierService.cs
- ContourSegment.cs
- XmlSchemaSequence.cs
- LogPolicy.cs
- Soap12ProtocolReflector.cs
- SchemaElementLookUpTable.cs
- AsymmetricSignatureDeformatter.cs
- InstanceNameConverter.cs
- EllipseGeometry.cs
- FileClassifier.cs
- SubMenuStyleCollection.cs
- LostFocusEventManager.cs
- BitmapFrameEncode.cs
- GridItemPattern.cs
- JulianCalendar.cs
- BrowserCapabilitiesCompiler.cs
- CodeCommentStatement.cs
- CompositionTarget.cs
- ObjectViewListener.cs
- FieldTemplateUserControl.cs
- AddDataControlFieldDialog.cs
- BamlBinaryWriter.cs
- EventManager.cs
- UpdateManifestForBrowserApplication.cs
- IdentityReference.cs
- CommandLibraryHelper.cs
- ObjectIDGenerator.cs
- DataGridViewCellValueEventArgs.cs
- IndexerNameAttribute.cs
- ConnectorDragDropGlyph.cs
- SrgsRule.cs
- HMACSHA384.cs
- WebPartEditVerb.cs
- NavigateEvent.cs
- KnownColorTable.cs
- relpropertyhelper.cs
- ExpressionWriter.cs
- SpellerError.cs
- SmtpClient.cs
- DropShadowEffect.cs
- LocalClientSecuritySettings.cs
- IPEndPoint.cs
- RsaSecurityKey.cs
- ToolStripScrollButton.cs
- ProgressBar.cs
- SiteMapDataSourceView.cs
- SelfIssuedAuthRSAPKCS1SignatureDeformatter.cs
- ContainsRowNumberChecker.cs
- GPPOINTF.cs
- FixedTextPointer.cs
- DesigntimeLicenseContextSerializer.cs
- BaseAppDomainProtocolHandler.cs
- Geometry.cs
- SpellCheck.cs
- CompilerHelpers.cs
- BuildProvider.cs
- MSHTMLHost.cs
- DataTableReader.cs
- InputManager.cs
- HtmlTableRow.cs
- Lasso.cs
- DropDownButton.cs
- SqlFlattener.cs
- DropTarget.cs
- InsufficientMemoryException.cs
- ComponentManagerBroker.cs
- ObjectItemNoOpAssemblyLoader.cs
- XPathNavigator.cs
- SecondaryViewProvider.cs
- DayRenderEvent.cs
- XMLSyntaxException.cs
- hwndwrapper.cs
- RandomNumberGenerator.cs