Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Input / Stylus / PenThread.cs / 2 / PenThread.cs
//#define TRACE
using System;
using System.Diagnostics;
using System.Collections;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using System.Windows.Threading;
using System.Threading;
using System.Security;
using System.Security.Permissions;
using MS.Internal;
using MS.Internal.PresentationCore; // SecurityHelper
using MS.Win32.Penimc;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Input
{
/////////////////////////////////////////////////////////////////////////
internal sealed class PenThread
{
private PenThreadWorker _penThreadWorker;
///
/// Critical - Calls SecurityCritical code PenThreadWorker constructor.
/// Called by PenThreadPool.RegisterPenContextHelper.
/// TreatAsSafe boundry is Stylus.EnableCore, Stylus.RegisterHwndForInput
/// and HwndWrapperHook class (via HwndSource.InputFilterMessage).
///
[SecurityCritical]
internal PenThread()
{
_penThreadWorker = new PenThreadWorker();
}
///
/// Dispose
///
internal void Dispose()
{
DisposeHelper();
}
/////////////////////////////////////////////////////////////////////
~PenThread()
{
DisposeHelper();
}
/////////////////////////////////////////////////////////////////////
///
/// Critical - Call security critical method PenThreadWorker.Dispose().
/// TreatAsSafe - Safe since it only frees internal private handle
/// on an object that is going to be also marked as disposed and
/// start failing all calls after return.
///
[SecurityCritical, SecurityTreatAsSafe]
void DisposeHelper()
{
// NOTE: PenThreadWorker deals with already being disposed logic.
_penThreadWorker.Dispose();
GC.KeepAlive(this);
}
/////////////////////////////////////////////////////////////////////
///
/// Critical - Calls SecurityCritical code PenThreadWorker.WorkerAddPenContext.
/// Called by PenThreadPool.RegisterPenContextHelper.
/// TreatAsSafe boundry is Stylus.EnableCore, Stylus.RegisterHwndForInput
/// and HwndWrapperHook class (via HwndSource.InputFilterMessage).
///
[SecurityCritical]
internal bool AddPenContext(PenContext penContext)
{
return _penThreadWorker.WorkerAddPenContext(penContext);
}
///
/// Critical - Calls SecurityCritical code PenThreadWorker.WorkerRemovePenContext.
/// Called by PenContext.Disable.
/// TreatAsSafe boundry is PenContext.Dispose, Stylus.ProcessDisplayChange
/// and HwndWrapperHook class (via HwndSource.InputFilterMessage).
///
[SecurityCritical]
internal bool RemovePenContext(PenContext penContext)
{
return _penThreadWorker.WorkerRemovePenContext(penContext);
}
/////////////////////////////////////////////////////////////////////
///
/// Critical - Calls SecurityCritical code PenThreadWorker.WorkerGetTabletsInfo.
/// Called by PenThreadPool.WorkerGetTabletsInfo.
///
[SecurityCritical]
internal TabletDeviceInfo[] WorkerGetTabletsInfo()
{
return _penThreadWorker.WorkerGetTabletsInfo();
}
///
/// Critical - Calls SecurityCritical code PenThreadWorker.WorkerCreateContext.
/// Called by PenThreadPool.WorkerCreateContext.
/// TreatAsSafe boundry is Stylus.EnableCore and HwndWrapperHook class
/// (via HwndSource.InputFilterMessage).
///
[SecurityCritical]
internal PenContextInfo WorkerCreateContext(IntPtr hwnd, IPimcTablet pimcTablet)
{
return _penThreadWorker.WorkerCreateContext(hwnd, pimcTablet);
}
///
/// Critical - Calls SecurityCritical code PenThreadWorker.WorkerRefreshCursorInfo.
/// Called by PenThreadPool.WorkerRefreshCursorInfo.
///
[SecurityCritical]
internal StylusDeviceInfo[] WorkerRefreshCursorInfo(IPimcTablet pimcTablet)
{
return _penThreadWorker.WorkerRefreshCursorInfo(pimcTablet);
}
///
/// Critical - Calls SecurityCritical code PenThreadWorker.WorkerGetTabletInfo.
/// Called by PenThreadPool.WorkerGetTabletInfo.
///
[SecurityCritical]
internal TabletDeviceInfo WorkerGetTabletInfo(uint index)
{
return _penThreadWorker.WorkerGetTabletInfo(index);
}
///
/// Critical - Calls SecurityCritical code PenThreadWorker.WorkerGetUpdatedSizes.
/// Called by PenThreadPool.WorkerGetUpdatedTabletRect.
///
[SecurityCritical]
internal TabletDeviceSizeInfo WorkerGetUpdatedSizes(IPimcTablet pimcTablet)
{
return _penThreadWorker.WorkerGetUpdatedSizes(pimcTablet);
}
}
}
// 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
- ChannelPool.cs
- ThrowHelper.cs
- DictionaryManager.cs
- WebPartDescriptionCollection.cs
- DefaultAssemblyResolver.cs
- CompilerWrapper.cs
- WebControlAdapter.cs
- DbResourceAllocator.cs
- DataGridViewMethods.cs
- RouteUrlExpressionBuilder.cs
- DelegateSerializationHolder.cs
- SqlParameterizer.cs
- InstallerTypeAttribute.cs
- OrderPreservingSpoolingTask.cs
- DocumentScope.cs
- RuntimeResourceSet.cs
- StringKeyFrameCollection.cs
- AutomationIdentifier.cs
- SubMenuStyle.cs
- Light.cs
- XmlSerializerSection.cs
- PhoneCall.cs
- MailDefinition.cs
- MenuItemStyle.cs
- StorageAssociationSetMapping.cs
- VisualStyleRenderer.cs
- MsmqProcessProtocolHandler.cs
- IPipelineRuntime.cs
- HttpBrowserCapabilitiesBase.cs
- WebPartsPersonalizationAuthorization.cs
- XLinq.cs
- SchemaComplexType.cs
- StackBuilderSink.cs
- SqlReferenceCollection.cs
- OdbcCommand.cs
- RoutedEventHandlerInfo.cs
- ContentDisposition.cs
- UnicastIPAddressInformationCollection.cs
- ToolBarButtonClickEvent.cs
- Stack.cs
- handlecollector.cs
- Point4D.cs
- DataColumnChangeEvent.cs
- ShapingEngine.cs
- RegexReplacement.cs
- WebServiceTypeData.cs
- SqlPersonalizationProvider.cs
- DefaultIfEmptyQueryOperator.cs
- DbMetaDataCollectionNames.cs
- _ListenerResponseStream.cs
- ImageListUtils.cs
- COM2AboutBoxPropertyDescriptor.cs
- SchemaCollectionPreprocessor.cs
- TextChange.cs
- EmptyEnumerator.cs
- HwndTarget.cs
- Latin1Encoding.cs
- WindowsProgressbar.cs
- Color.cs
- SelectionChangedEventArgs.cs
- wmiutil.cs
- ConnectionManagementSection.cs
- ToolStripItemTextRenderEventArgs.cs
- ObjectItemCollection.cs
- XmlRawWriter.cs
- GroupQuery.cs
- DesignerCategoryAttribute.cs
- HttpHandlerActionCollection.cs
- MultiBinding.cs
- SiblingIterators.cs
- X509SubjectKeyIdentifierClause.cs
- ClientSideQueueItem.cs
- OdbcReferenceCollection.cs
- AssociatedControlConverter.cs
- XmlMapping.cs
- XamlRtfConverter.cs
- ExtenderProvidedPropertyAttribute.cs
- MissingFieldException.cs
- ByteArrayHelperWithString.cs
- HttpResponseHeader.cs
- GC.cs
- Int64Converter.cs
- GeometryValueSerializer.cs
- PackageStore.cs
- WebPartExportVerb.cs
- StickyNote.cs
- SchemaDeclBase.cs
- ParsedAttributeCollection.cs
- AtomicFile.cs
- Preprocessor.cs
- FormDocumentDesigner.cs
- ChangeInterceptorAttribute.cs
- AmbientLight.cs
- GeneralTransform3DTo2D.cs
- HandlerFactoryWrapper.cs
- ObjectComplexPropertyMapping.cs
- FontNamesConverter.cs
- MetaDataInfo.cs
- TimeoutHelper.cs
- DesignTimeResourceProviderFactoryAttribute.cs