Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / InputProviderSite.cs / 1305600 / InputProviderSite.cs
using System; using System.Security; using System.Security.Permissions; using MS.Internal; using MS.Internal.PresentationCore; // SecurityHelper using MS.Win32; using System.Windows.Threading; using SR=MS.Internal.PresentationCore.SR; using SRID=MS.Internal.PresentationCore.SRID; namespace System.Windows.Input { ////// The object which input providers use to report input to the input /// manager. /// internal class InputProviderSite : IDisposable { ////// Critical: This code creates critical data in the form of InputManager and InputProvider /// [SecurityCritical] internal InputProviderSite(InputManager inputManager, IInputProvider inputProvider) { _inputManager = new SecurityCriticalDataClass(inputManager); _inputProvider = new SecurityCriticalDataClass (inputProvider); } /// /// Returns the input manager that this site is attached to. /// ////// Critical: We do not want to expose the Input manager in the SEE /// TreatAsSafe: This code has a demand in it /// public InputManager InputManager { [SecurityCritical,SecurityTreatAsSafe] get { SecurityHelper.DemandUnrestrictedUIPermission(); return CriticalInputManager; } } ////// Returns the input manager that this site is attached to. /// ////// Critical: We do not want to expose the Input manager in the SEE /// internal InputManager CriticalInputManager { [SecurityCritical] get { return _inputManager.Value; } } ////// Unregisters this input provider. /// ////// Critical: This code accesses critical data (InputManager and InputProvider). /// TreatAsSafe: The critical data is not exposed outside this call /// [SecurityCritical,SecurityTreatAsSafe] public void Dispose() { GC.SuppressFinalize(this); if (!_isDisposed) { _isDisposed = true; if (_inputManager != null && _inputProvider != null) { _inputManager.Value.UnregisterInputProvider(_inputProvider.Value); } _inputManager = null; _inputProvider = null; } } ////// Returns true if the CompositionTarget is disposed. /// public bool IsDisposed { get { return _isDisposed; } } ////// Reports input to the input manager. /// ////// Whether or not any event generated as a consequence of this /// event was handled. /// ////// Critical:This code is critical and can be used in event spoofing. It also accesses /// InputManager and calls into ProcessInput which is critical. /// // [SecurityCritical ] [UIPermissionAttribute(SecurityAction.LinkDemand,Unrestricted = true)] public bool ReportInput(InputReport inputReport) { if(IsDisposed) { throw new ObjectDisposedException(SR.Get(SRID.InputProviderSiteDisposed)); } bool handled = false; InputReportEventArgs input = new InputReportEventArgs(null, inputReport); input.RoutedEvent=InputManager.PreviewInputReportEvent; if(_inputManager != null) { handled = _inputManager.Value.ProcessInput(input); } return handled; } private bool _isDisposed; ////// Critical: This object should not be exposed in the SEE as it can be /// used for input spoofing /// private SecurityCriticalDataClass_inputManager; /// /// Critical: This object should not be exposed in the SEE as it can be /// used for input spoofing /// private SecurityCriticalDataClass_inputProvider; } } // 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
- TableCell.cs
- ReliableMessagingVersionConverter.cs
- UInt32Storage.cs
- ServiceReference.cs
- ZipIOExtraField.cs
- Span.cs
- WebPartZoneDesigner.cs
- ListBindingHelper.cs
- Asn1IntegerConverter.cs
- AffineTransform3D.cs
- BorderGapMaskConverter.cs
- HttpModuleCollection.cs
- EdmSchemaError.cs
- TagMapCollection.cs
- WebBaseEventKeyComparer.cs
- DeferredTextReference.cs
- LinqDataSourceStatusEventArgs.cs
- ExpressionNode.cs
- MultiDataTrigger.cs
- CountdownEvent.cs
- GuidelineSet.cs
- PasswordBoxAutomationPeer.cs
- EntityStoreSchemaGenerator.cs
- HwndSourceKeyboardInputSite.cs
- DbgUtil.cs
- SimpleColumnProvider.cs
- ValueTypeFixupInfo.cs
- BooleanSwitch.cs
- WebPartZoneBase.cs
- LinqToSqlWrapper.cs
- WebControlsSection.cs
- DurableInstance.cs
- OperandQuery.cs
- BrushConverter.cs
- DbConnectionOptions.cs
- DocumentGrid.cs
- LinqDataSource.cs
- Queue.cs
- EventSourceCreationData.cs
- codemethodreferenceexpression.cs
- HandledEventArgs.cs
- ArgumentsParser.cs
- XmlElement.cs
- VScrollBar.cs
- SQLMoney.cs
- DesignerCategoryAttribute.cs
- SHA384.cs
- TreeWalker.cs
- DataFormats.cs
- IsolatedStorage.cs
- DecimalConstantAttribute.cs
- ModelServiceImpl.cs
- WindowsStartMenu.cs
- CardSpaceException.cs
- PointLightBase.cs
- PinProtectionHelper.cs
- MULTI_QI.cs
- CompiledIdentityConstraint.cs
- VariableDesigner.xaml.cs
- TTSEngineProxy.cs
- DataTemplateKey.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- ContentElementAutomationPeer.cs
- DSASignatureDeformatter.cs
- Material.cs
- Error.cs
- PropertySet.cs
- ApplicationFileParser.cs
- Attributes.cs
- DataGridViewElement.cs
- CharEnumerator.cs
- StringUtil.cs
- RequestQueue.cs
- Substitution.cs
- KeyValuePairs.cs
- HttpResponseBase.cs
- Latin1Encoding.cs
- FrameworkElement.cs
- LifetimeServices.cs
- DocumentEventArgs.cs
- DispatcherExceptionEventArgs.cs
- XamlGridLengthSerializer.cs
- SecureStringHasher.cs
- QualificationDataItem.cs
- DbDataSourceEnumerator.cs
- TdsParserSessionPool.cs
- EmbeddedMailObjectsCollection.cs
- XmlWellformedWriterHelpers.cs
- DetailsViewRow.cs
- Pens.cs
- CompilationSection.cs
- InfoCardSymmetricAlgorithm.cs
- EventLogPermissionEntryCollection.cs
- RegexMatch.cs
- DataRowChangeEvent.cs
- Lease.cs
- SchemaEntity.cs
- Pick.cs
- Site.cs
- RubberbandSelector.cs