Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Input / RawKeyboardInputReport.cs / 1 / RawKeyboardInputReport.cs
using System;
using System.Security;
using System.Security.Permissions;
using MS.Internal;
using MS.Win32;
using System.Windows;
namespace System.Windows.Input
{
///
/// The RawKeyboardInputReport class encapsulates the raw input
/// provided from a keyboard.
///
///
/// It is important to note that the InputReport class only contains
/// blittable types. This is required so that the report can be
/// marshalled across application domains.
///
internal class RawKeyboardInputReport : InputReport
{
///
/// Constructs ad instance of the RawKeyboardInputReport class.
///
///
/// The input source that provided this input.
///
///
/// The mode in which the input is being provided.
///
///
/// The time when the input occured.
///
///
/// The set of actions being reported.
///
///
/// The scan code if a key is being reported.
///
///
/// The true if a key is an extended key.
///
///
/// The true if a key is a system key.
///
///
/// The Win32 virtual key code if a key is being reported.
///
///
/// Any extra information being provided along with the input.
///
///
/// Critical:This handles critical data in the form of PresentationSource and
/// ExtraInformation
/// TreatAsSafe:The data has demands on the property when someone tries to access it.
///
[SecurityCritical,SecurityTreatAsSafe]
public RawKeyboardInputReport(
PresentationSource inputSource,
InputMode mode,
int timestamp,
RawKeyboardActions actions,
int scanCode,
bool isExtendedKey,
bool isSystemKey,
int virtualKey,
IntPtr extraInformation) : base(inputSource, InputType.Keyboard, mode, timestamp)
{
if (!IsValidRawKeyboardActions(actions))
throw new System.ComponentModel.InvalidEnumArgumentException("actions", (int)actions, typeof(RawKeyboardActions));
_actions = actions;
_scanCode = scanCode;
_isExtendedKey = isExtendedKey;
_isSystemKey = isSystemKey;
_virtualKey = virtualKey;
_extraInformation = new SecurityCriticalData(extraInformation);
}
///
/// Read-only access to the set of actions that were reported.
///
public RawKeyboardActions Actions {get {return _actions;}}
///
/// Read-only access to the scan code that was reported.
///
public int ScanCode {get {return _scanCode;}}
///
/// Read-only access to the flag of an extended key.
///
public bool IsExtendedKey {get {return _isExtendedKey;}}
///
/// Read-only access to the flag of a system key.
///
public bool IsSystemKey {get {return _isSystemKey;}}
///
/// Read-only access to the virtual key that was reported.
///
public int VirtualKey {get {return _virtualKey;}}
///
/// Read-only access to the extra information was provided along
/// with the input.
///
///
/// Critical: This data was got under an elevation and is not safe to expose
///
public IntPtr ExtraInformation
{
[SecurityCritical]
get
{
return _extraInformation.Value;
}
}
// IsValid Method for RawKeyboardActions. Relies on the enum being flags.
internal static bool IsValidRawKeyboardActions(RawKeyboardActions actions)
{
if (((RawKeyboardActions.AttributesChanged | RawKeyboardActions.Activate | RawKeyboardActions.Deactivate |
RawKeyboardActions.KeyDown | RawKeyboardActions.KeyUp) & actions) == actions)
{
if (!((((RawKeyboardActions.KeyUp | RawKeyboardActions.KeyDown) & actions) == (RawKeyboardActions.KeyUp | RawKeyboardActions.KeyDown)) ||
((RawKeyboardActions.Deactivate & actions) == actions && RawKeyboardActions.Deactivate != actions)))
{
return true;
}
}
return false;
}
private RawKeyboardActions _actions;
private int _scanCode;
private bool _isExtendedKey;
private bool _isSystemKey;
private int _virtualKey;
///
/// Critical: This information is got under an elevation and can latch onto
/// any arbitrary data
///
private SecurityCriticalData _extraInformation;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Security;
using System.Security.Permissions;
using MS.Internal;
using MS.Win32;
using System.Windows;
namespace System.Windows.Input
{
///
/// The RawKeyboardInputReport class encapsulates the raw input
/// provided from a keyboard.
///
///
/// It is important to note that the InputReport class only contains
/// blittable types. This is required so that the report can be
/// marshalled across application domains.
///
internal class RawKeyboardInputReport : InputReport
{
///
/// Constructs ad instance of the RawKeyboardInputReport class.
///
///
/// The input source that provided this input.
///
///
/// The mode in which the input is being provided.
///
///
/// The time when the input occured.
///
///
/// The set of actions being reported.
///
///
/// The scan code if a key is being reported.
///
///
/// The true if a key is an extended key.
///
///
/// The true if a key is a system key.
///
///
/// The Win32 virtual key code if a key is being reported.
///
///
/// Any extra information being provided along with the input.
///
///
/// Critical:This handles critical data in the form of PresentationSource and
/// ExtraInformation
/// TreatAsSafe:The data has demands on the property when someone tries to access it.
///
[SecurityCritical,SecurityTreatAsSafe]
public RawKeyboardInputReport(
PresentationSource inputSource,
InputMode mode,
int timestamp,
RawKeyboardActions actions,
int scanCode,
bool isExtendedKey,
bool isSystemKey,
int virtualKey,
IntPtr extraInformation) : base(inputSource, InputType.Keyboard, mode, timestamp)
{
if (!IsValidRawKeyboardActions(actions))
throw new System.ComponentModel.InvalidEnumArgumentException("actions", (int)actions, typeof(RawKeyboardActions));
_actions = actions;
_scanCode = scanCode;
_isExtendedKey = isExtendedKey;
_isSystemKey = isSystemKey;
_virtualKey = virtualKey;
_extraInformation = new SecurityCriticalData(extraInformation);
}
///
/// Read-only access to the set of actions that were reported.
///
public RawKeyboardActions Actions {get {return _actions;}}
///
/// Read-only access to the scan code that was reported.
///
public int ScanCode {get {return _scanCode;}}
///
/// Read-only access to the flag of an extended key.
///
public bool IsExtendedKey {get {return _isExtendedKey;}}
///
/// Read-only access to the flag of a system key.
///
public bool IsSystemKey {get {return _isSystemKey;}}
///
/// Read-only access to the virtual key that was reported.
///
public int VirtualKey {get {return _virtualKey;}}
///
/// Read-only access to the extra information was provided along
/// with the input.
///
///
/// Critical: This data was got under an elevation and is not safe to expose
///
public IntPtr ExtraInformation
{
[SecurityCritical]
get
{
return _extraInformation.Value;
}
}
// IsValid Method for RawKeyboardActions. Relies on the enum being flags.
internal static bool IsValidRawKeyboardActions(RawKeyboardActions actions)
{
if (((RawKeyboardActions.AttributesChanged | RawKeyboardActions.Activate | RawKeyboardActions.Deactivate |
RawKeyboardActions.KeyDown | RawKeyboardActions.KeyUp) & actions) == actions)
{
if (!((((RawKeyboardActions.KeyUp | RawKeyboardActions.KeyDown) & actions) == (RawKeyboardActions.KeyUp | RawKeyboardActions.KeyDown)) ||
((RawKeyboardActions.Deactivate & actions) == actions && RawKeyboardActions.Deactivate != actions)))
{
return true;
}
}
return false;
}
private RawKeyboardActions _actions;
private int _scanCode;
private bool _isExtendedKey;
private bool _isSystemKey;
private int _virtualKey;
///
/// Critical: This information is got under an elevation and can latch onto
/// any arbitrary data
///
private SecurityCriticalData _extraInformation;
}
}
// 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
- DateTimeValueSerializerContext.cs
- BypassElementCollection.cs
- ControllableStoryboardAction.cs
- TagPrefixCollection.cs
- ElapsedEventArgs.cs
- RemoteWebConfigurationHostServer.cs
- AuthorizationSection.cs
- HwndKeyboardInputProvider.cs
- IssuedTokenClientBehaviorsElementCollection.cs
- ToolStripSeparatorRenderEventArgs.cs
- ChannelManager.cs
- Int32Converter.cs
- _SingleItemRequestCache.cs
- LocatorManager.cs
- GeometryModel3D.cs
- SqlDataSourceCache.cs
- TextTreeTextNode.cs
- XNodeValidator.cs
- GradientSpreadMethodValidation.cs
- WrapPanel.cs
- IncomingWebResponseContext.cs
- PropVariant.cs
- PixelFormatConverter.cs
- WorkflowInstanceExtensionCollection.cs
- InstanceData.cs
- UrlMapping.cs
- MembershipValidatePasswordEventArgs.cs
- ProfileServiceManager.cs
- PenContexts.cs
- TransactionState.cs
- CatalogPart.cs
- EncryptRequest.cs
- ImportOptions.cs
- SignedXml.cs
- Identifier.cs
- DateTimeFormatInfo.cs
- userdatakeys.cs
- HyperlinkAutomationPeer.cs
- ExpressionParser.cs
- ListViewCommandEventArgs.cs
- WebPartEditorApplyVerb.cs
- XmlSchemaDatatype.cs
- RoleService.cs
- XmlDataImplementation.cs
- ProviderBase.cs
- FlowNode.cs
- TextBoxBase.cs
- PartitionResolver.cs
- TraceContextEventArgs.cs
- TableParagraph.cs
- DataGridViewRow.cs
- WebControl.cs
- ListViewItemEventArgs.cs
- HttpRequestCacheValidator.cs
- Compilation.cs
- Double.cs
- SafeFileHandle.cs
- MimeMapping.cs
- Peer.cs
- TraceSection.cs
- SqlFileStream.cs
- PermissionSetTriple.cs
- SqlLiftIndependentRowExpressions.cs
- CachedFontFamily.cs
- XmlILAnnotation.cs
- DataGridHeaderBorder.cs
- XmlAutoDetectWriter.cs
- ZipIOFileItemStream.cs
- Point3D.cs
- DocumentViewerBaseAutomationPeer.cs
- Error.cs
- LogoValidationException.cs
- Automation.cs
- ManipulationDeltaEventArgs.cs
- Rules.cs
- RegionInfo.cs
- SqlException.cs
- LayoutUtils.cs
- BitStack.cs
- DbExpressionVisitor_TResultType.cs
- ServerValidateEventArgs.cs
- JoinTreeSlot.cs
- BinaryObjectReader.cs
- DesignerCommandAdapter.cs
- RectangleF.cs
- Binding.cs
- FrameAutomationPeer.cs
- HorizontalAlignConverter.cs
- ReadOnlyObservableCollection.cs
- DataGridColumnDropSeparator.cs
- Parser.cs
- Lazy.cs
- DataGridViewCheckBoxColumn.cs
- BatchWriter.cs
- DrawListViewSubItemEventArgs.cs
- UndoUnit.cs
- DataGridCell.cs
- HyperLinkStyle.cs
- BasicCellRelation.cs
- PrimitiveSchema.cs