亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tchstub.cpp

?? The touch screen driver reads input from touch screen hardware and converts it to touch events that
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
   tchstub.c   Created April 7 1997
--*/


// Debug guide:  These are the debugging switches used in this driver code.
//
// DEBUG1 - This is used to see which points are sent to which destination.  It prints out every point and
//   the point's desitnation to the debug output, so this is kind of slow.
//
// DEBUG2 - this is a different way to see where the points are going. Warns if any points take 
//   uncommon branches in the code.
//
// WRITE_STATISTICSXXX - these functions collect points, and every so often they write them to a log file
//  This is a good way to find point leaks in case the driver does not sync with the Transriber application
//
// DEBUGTOUCH - This is used to debug the touch screen code.  It provides warnings if there are many
//   long lags with no points while the pen is down, or if there is a poor average point rate.
//   This is on by default in debug builds.
// 


// Basic architecture:
// The points come in through CgrCallback.  
//  If Transcriber is not running, then the points are sent back to the normal touch driver path.
//  Otherwise are then placed on the inner (internal to the touch driver) queue (Q2) by SendPtToSelf.
//
// Points are removed from Q2 by the touch driver thread (TchInnerThread), which passes them to
//  StubCallback2.
//
// StubCallback2 checks to see where the point is, checks with Transcriber about whether the point should
//  be returned to the system.  If so, the point is re-generated and sent via the normal touch driver path.
//  If Transcriber.exe wants the point, it is placed on an external queue (Q1) which is in MemoryMappedFile
//  for interprocess communication with Transcriber.exe

// Transcriber.exe then retrieves points from this queue, paints them on the screen, and sends them
//  to the recognizer.

#include    <windows.h>
#include    <types.h>
#include    <memory.h>
#include    <nkintr.h>
#include    <tchddi.h>
#include    <tchddsi.h>

#include	 "pegc_def.h"  // From main application folder (APP)

#ifdef __cplusplus
extern "C"{
#endif 
#include    <tchstub.h>


//#define  WRITE_STATISTICSLOG   0 // just for experimnents
//#define  WRITE_STATISTICSINNER 0 // for debugging only
//#define  WRITE_STATISTICSSNDPT 0 // for debugging only

#if defined (WRITE_STATISTICSLOG) || defined (WRITE_STATISTICS_INNER) || defined (WRITE_STATISTICSSNDPT)
   #define  MAX_WRITES       20
   #define  MAX_STATS        200
#endif

const TCHAR* const szOldDriverNameValueName		= TEXT("OldDriverName");
#define VADEM_TOUCH_DRIVER_NAME	   TEXT("touchpdd.dll")
#define DEFAULT_TOUCH_DRIVER_NAME	TEXT("touch.dll")

#pragma data_seg(".TOUCHD")
PFN_TOUCH_PANEL_CALLBACK	v_pfnCgrPointCallback = NULL;
HWND  _hClientWnd    = NULL;
HWND  _hLastTouchFocusWnd    = NULL;
short _iClientFlags  = TABLET_ALL_TO_SYSTEM;
DWORD _dwLastSendedTick  = 0;
DWORD _dwLastPostedToClient = 0;
static TOUCH_QUEUE tq2 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static TOUCH_QUEUE* ptq = NULL;
CRITICAL_SECTION Q2CritSect;		// protect the inner queue within the cgrtouch driver
HANDLE	hQ1Mutex;					// protect the outer queue between cgrtouch and app
int		_cProcessNumb = 0;
HANDLE  _hFileMapping = NULL;
LPVOID	_pView = NULL;
HWND*	_phStubWnd = NULL;
HANDLE* _phinstDll = NULL;

static int ints[10] = {0};

static BOOL  bClick=0, bDelay=0; 
static INT   _begX=0, _begY=0;
static DWORD begTick=0;
static bNear = FALSE;
static int   iLastDelayX=0, iLastDelayY=0;
static DWORD dwLastDelayTick=0;

static int _iLastProceedX=0, _iLastProceedY=0, _iLastProceedFlags=0;
static int _iLastPostedX=0, _iLastPostedY=0;
static int _iLastSelfX=-1, _iLastSelfY=-1;
static int _iInRow = 0;
static int _iMinDist = 0;
static int _iMaxDist = 24;
HANDLE g_hTabletEvent = NULL;
HANDLE g_hInnerEvent = NULL;
BOOL _bDeferedDelay = FALSE;
// To track if we are in OOM state.
extern BOOL _bTchThreadHighPriority;

#ifdef DEBUGTOUCH
const int SKIP_THRESHOLD = 40;  		// digitizer resolution is 4x pixel resolution => 10 pixels.
const int LATENCY_THRESHOLD = 30;		// after how many milliseconds is a point considered "overdue"
const int POINT_RATE_THRESHOLD = 100;   // how many points per second minimum do we need? 
                                        //  (200 is better, but 100 should be good enough)
const int SMALL_STROKE_THRESHOLD = 500; // demand that a stroke be at least this many milliseconds 
                                        //  long to measure skips, etc.

CRITICAL_SECTION csErrMsg;              // protect the global error message buffer.

static TCHAR _szErrorMsg[2 * MAX_PATH]; // Buffer for debug error message

const TCHAR* const _tszTranscriberKey   = TEXT("Software\\Microsoft\\Transcriber");
const TCHAR* const _tszNoDbgMsg         = TEXT("TouchNoDebugMesssage");

// Flag to show the touch driver debug message only once per transcriber session.
BOOL _bNoDbgMsg = FALSE;
#endif // DEBUGTOUCH

#pragma data_seg()

DWORD    dwMinPauseBeforeClick         =  1500;
int      iMaxClickDist                 =  23;
int      iMaxDelayDist                 =  18;
DWORD    dwMaxClickTime                =  480;
DWORD    dwMinStartDelayTime           =  480;
DWORD    dwMinInterDelayTime           =  800;
BOOL     _bIgnoreStroke = FALSE;
BOOL     _bIgnoreStroke2 = FALSE;

unsigned char _footprint[12] =
 { 0x40, 0x89, 0x96, 0x19, 0x10, 0x2B, 0x25, 0xF4,
#if CGRTOUCH_ROM_VERSION
   (CGRTOUCH_MAJOR_VERSION|0xC0), (CGRTOUCH_MINOR_VERSION|0x80), CGRTOUCH_RELEASE, 0x80};
#else
   (CGRTOUCH_MAJOR_VERSION|0xC0), (CGRTOUCH_MINOR_VERSION|0x80), CGRTOUCH_RELEASE, 0x4F};
#endif

BOOL IsCgrTouchFile(TCHAR *szFileName);
BOOL IsStubWndExist();
DWORD WINAPI TchWindowThread(DWORD dwParameter);
void StubCallback2(DWORD dwtick0, TOUCH_PANEL_SAMPLE_FLAGS Flags, INT X, INT Y);
BOOL MddTouchPanelEnable(PFN_TOUCH_PANEL_CALLBACK pfnCallback);

#ifdef DEBUGTOUCH
// Thread proc for displaying an error message box, without stopping the touch driver thread,
// If the touch driver thread is blocked, touch driver will not work and user will not be able
// to respond to the error message without a hard keyboard.
DWORD WINAPI TchMessageBoxThread(LPVOID lpParameter)
{
    EnterCriticalSection(&csErrMsg);

	MessageBox(GetForegroundWindow(), _szErrorMsg, TEXT("Transcriber Touch Driver Error"), MB_OK | MB_ICONERROR);

    LeaveCriticalSection(&csErrMsg);

    return 0;
}
#endif // DEBUGTOUCH

// Look at the queue internal to the touch driver, and send the points to StubCallback2
DWORD WINAPI TchInnerThread(DWORD dwParameter)
{
 TOUCH_QUEUE *pTouchQ = &tq2;
 int i;

   while(1)
      {
         WaitForSingleObject(g_hInnerEvent, INFINITE); //2000);
         ResetEvent(g_hInnerEvent);
 
  
         EnterCriticalSection(&Q2CritSect);
		 
		 while((i=pTouchQ->iGet)!=pTouchQ->iPut)
            {
             int iNext = i+1;
         
			 if(iNext>=MAX_TOUCHQUEUE)
                  iNext=0;
             
			 StubCallback2(GetTickCount(), pTouchQ->elems[i][0], 
                      ((pTouchQ->elems[i][1])>>16), ((pTouchQ->elems[i][1])&0x0FFFF));
             
			 pTouchQ->iGet = iNext;
            }

         LeaveCriticalSection(&Q2CritSect);

      }

   return 0; //just avoid of copiler's message
}

/* *********************************************************************************************** */
// post the points on the queue used by the app (outside this DLL boundary, in shared memory)
// send points to the main Transcriber App window
void SendPtToWnd(int iFlags, int iX, int iY)    
{
 int iGet = 0;
 int iPut = 0;
 int i;

   if(_bIgnoreStroke &&
      (iFlags&TouchSamplePreviousDownFlag)!=0)
      {
//        MessageBeep((UINT)-1);
        return; 
      }

   WaitForSingleObject(hQ1Mutex, INFINITE);

   iGet = ptq->iGet;
   iPut = ptq->iPut;



#if WRITE_STATISTICSSNDPT
   {
    static int   _iStat1Writes = 0;
    static int   _iStat1Current = 0;
    static short _iStat1Buf[MAX_STATS][5] = {0};
    static int   count = 0;

if (_iStat1Current > 0 && _iStat1Buf[_iStat1Current-1][4] == iPut) OutputDebugString(L"Got same iPut 2 !!!\n");

      _iStat1Buf[_iStat1Current][0] = (short)iFlags;
      _iStat1Buf[_iStat1Current][1] = (short)iX;
      _iStat1Buf[_iStat1Current][2] = (short)iY;
      _iStat1Buf[_iStat1Current][3] = (short)ptq->iGet;
      _iStat1Buf[_iStat1Current][4] = (short)ptq->iPut;
      _iStat1Current++;
      
	  if(_iStat1Current==MAX_STATS)
         {
          HANDLE hFile = INVALID_HANDLE_VALUE;
          int i;

 
		  
		  _iStat1Current = 0;

             hFile = CreateFile(L"\\tchlogSndPt.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
             if(hFile!=INVALID_HANDLE_VALUE)
                {
                 DWORD dw = 0;
				 int   len;
				 int   j;
      
				 SetFilePointer(hFile, 0, NULL, FILE_END);

				   for (i = 0; i < MAX_STATS; i++)
				   {
				    TCHAR str[64];
					unsigned char str2[64];

                    wsprintf(str, L"%d %d %d %d iGet=%d iPut=%d %c%c", count++, (int)_iStat1Buf[i][1], (int)(3000 - _iStat1Buf[i][2]), (int)_iStat1Buf[i][0], 
						     (int)_iStat1Buf[i][3], (int)_iStat1Buf[i][4], (TCHAR)13, (TCHAR)10); 
  		            
					len = _tcslen(str); 
					if(len > 62) 
						len = 62;

					for (j = 0; j < len; j ++) 
						str2[j] = (unsigned char)str[j]; 
					str2[len] = 0;
					
					WriteFile(hFile, str2, len, &dw, NULL);

				   }

                   CloseHandle(hFile);
                }

         }
   }
#endif



   if((iFlags&TouchSampleDownFlag)!=0)
      i = iGet - 3;
   else
      i = iGet - 2;
   
   // ensure there are at least 2 or 3 empty places to write between 
   //  the write pointer and the read pointer - but why???
   //  presumably we want to always keep 2-3 old points available to read in the queue
   //  We do use one point back in the code to end a trace on a timeout - 
   //  could be that 2 or 3 is a stale number.
   if(iPut<i ||
      (iPut>=iGet && iPut<i+MAX_TOUCHQUEUE))
      {
         _bIgnoreStroke = FALSE;



         ptq->elems[iPut][0]=iFlags;
         ptq->elems[iPut][1]=((iX<<16)|iY);

         iPut++;
         
		 if(iPut>=MAX_TOUCHQUEUE)
           iPut = 0;

         ptq->iPut = iPut;
          
		 SetEvent(g_hTabletEvent);
      }
   else
   {  
	   _bIgnoreStroke = TRUE;
	   DEBUGMSG(1,(TEXT("Outer Queue overrun!\n\r")));
   }

   ReleaseMutex(hQ1Mutex);

#ifdef DEBUG1	// Print an error message if we ever see iPut not incremented 
			    //  (happens in cache problem situations.)
   {
    TCHAR str[128];
	
	// calling wsprintf just for the side effect to attempt a cache flush
	wsprintf(str, L"%s -- %d", L"Hello there!", 123);
   
	
	str[0] = (TCHAR)ptq->iPut;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品自在欧美一区| 一本大道久久a久久综合 | 日本一区二区综合亚洲| 亚洲精品日韩综合观看成人91| 日本欧美韩国一区三区| 成人免费毛片高清视频| 日韩一区二区三区电影| 亚洲综合丝袜美腿| 成年人网站91| 久久久亚洲午夜电影| 亚洲成人激情社区| 91小视频免费观看| 久久久天堂av| 精品一区精品二区高清| 欧美另类一区二区三区| 日韩伦理免费电影| a级精品国产片在线观看| 久久综合一区二区| 精品一区二区在线视频| 7777精品伊人久久久大香线蕉完整版| 亚洲欧洲三级电影| 成人免费福利片| 国产亚洲精品免费| 韩国欧美国产一区| 欧美白人最猛性xxxxx69交| 五月婷婷激情综合| 欧美中文字幕一区二区三区亚洲| 综合电影一区二区三区| 成人av网站在线观看| 久久蜜桃一区二区| 韩国v欧美v亚洲v日本v| 国产精品国产a| 国产传媒一区在线| 国产欧美日韩在线| 成人综合激情网| 中文字幕一区在线观看视频| 91一区二区在线| 亚洲美女免费在线| 欧美无砖专区一中文字| 亚州成人在线电影| 日韩免费福利电影在线观看| 美女视频黄免费的久久| 精品av综合导航| 国产一区二区三区四区五区入口| 久久精品人人爽人人爽| 成人自拍视频在线| 亚洲天堂中文字幕| 欧美在线视频不卡| 麻豆精品一二三| 亚洲国产高清在线观看视频| 99久久精品国产麻豆演员表| 亚洲制服丝袜在线| 日韩一区二区三区av| 国产成a人亚洲精品| 中文字幕在线播放不卡一区| 欧美日韩一区国产| 久久66热偷产精品| 中文字幕制服丝袜一区二区三区| 日本久久精品电影| 美女视频免费一区| 亚洲欧洲精品天堂一级| 欧美三级在线视频| 国产一区二区福利视频| 亚洲男女一区二区三区| 日韩欧美一区二区三区在线| 成人免费观看视频| 日韩在线播放一区二区| 国产亚洲一区二区三区四区 | 日本高清无吗v一区| 免费人成黄页网站在线一区二区| 国产女主播在线一区二区| 一本高清dvd不卡在线观看| 免费成人美女在线观看.| ㊣最新国产の精品bt伙计久久| 欧美日韩国产高清一区二区三区| 国产一区二区电影| 污片在线观看一区二区| 中文一区二区完整视频在线观看| 欧美精选在线播放| www.亚洲国产| 久久精品国产一区二区| 一区二区成人在线视频| 国产亚洲欧美在线| 欧美一区二区三区视频在线观看 | 久久爱另类一区二区小说| 亚洲品质自拍视频网站| 久久久久国产成人精品亚洲午夜| 91福利区一区二区三区| 国产不卡免费视频| 久久精品国产澳门| 午夜国产不卡在线观看视频| 一色桃子久久精品亚洲| 亚洲精品一区二区三区福利| 欧美日韩国产在线观看| 成人性生交大片免费看中文网站| 日本视频中文字幕一区二区三区| 亚洲男帅同性gay1069| 国产视频911| 亚洲精品在线免费播放| 欧美福利视频一区| 欧美色中文字幕| 91免费视频大全| 99re热视频精品| 成人午夜短视频| 国产做a爰片久久毛片| 美女性感视频久久| 天堂影院一区二区| 午夜伦欧美伦电影理论片| 一区二区在线电影| ㊣最新国产の精品bt伙计久久| 国产欧美精品在线观看| 国产欧美精品一区二区色综合朱莉 | 日韩午夜激情免费电影| 欧美福利一区二区| 日韩一区二区三区在线| 欧美电影在哪看比较好| 欧美一区二区三区在线观看| 欧美乱熟臀69xxxxxx| 91精品欧美久久久久久动漫| 日韩一级大片在线观看| 欧美一区二区精美| 精品国产一区二区国模嫣然| 久久人人超碰精品| 中文字幕精品—区二区四季| 国产精品护士白丝一区av| 亚洲免费观看高清完整版在线| 亚洲日本va午夜在线影院| 亚洲一区二区视频在线观看| 亚洲一区二区黄色| 日本大胆欧美人术艺术动态| 精品一区二区三区香蕉蜜桃| 国产在线一区二区| 成人久久18免费网站麻豆| 在线亚洲免费视频| 91麻豆精品国产自产在线观看一区 | 欧美日韩一区二区在线观看| 欧美三级在线视频| 欧美v日韩v国产v| 欧美激情在线免费观看| 一区二区三区四区视频精品免费| 婷婷综合久久一区二区三区| 极品少妇xxxx精品少妇| 成人黄色片在线观看| 色诱视频网站一区| 欧美一区二区福利在线| 亚洲国产精品激情在线观看| 夜夜爽夜夜爽精品视频| 免费成人在线观看| 99久久婷婷国产综合精品电影| 欧美系列一区二区| 26uuu国产电影一区二区| 中文字幕在线观看不卡| 午夜伦欧美伦电影理论片| 国产高清在线观看免费不卡| 欧美专区亚洲专区| 久久奇米777| 亚洲gay无套男同| 成人高清视频免费观看| 欧美日韩在线精品一区二区三区激情| 欧美成人video| 一卡二卡欧美日韩| 国产成人在线视频免费播放| 欧美人狂配大交3d怪物一区| 国产精品狼人久久影院观看方式| 无码av中文一区二区三区桃花岛| 丁香激情综合五月| 日韩午夜激情av| 一区二区三区在线免费观看| 国产不卡视频一区| 欧美一区二区视频观看视频| 亚洲欧美日韩系列| 国产成人免费视频一区| 日韩精品综合一本久道在线视频| 亚洲激情在线激情| 成人动漫一区二区三区| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲一区二区三区四区五区黄| 成人开心网精品视频| 精品久久一二三区| 石原莉奈在线亚洲三区| 欧美偷拍一区二区| 中文字幕在线不卡国产视频| 国产精品 欧美精品| 精品久久国产字幕高潮| 日本v片在线高清不卡在线观看| 色视频一区二区| 亚洲欧美日韩国产一区二区三区| 国产乱码精品一区二区三区五月婷| 欧美一二三四在线| 亚洲电影欧美电影有声小说| 91偷拍与自偷拍精品| 中文字幕精品综合| 高清国产一区二区| 亚洲精品一区二区三区精华液 | av高清久久久| 国产精品激情偷乱一区二区∴| 国产mv日韩mv欧美| 国产欧美精品一区二区色综合 | 久久99最新地址| 日韩三级在线免费观看|