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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tchstub.cpp

?? 觸摸屏驅(qū)動(dòng)的程序
?? 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)
	{
        BOOL fDone = FALSE;
		WaitForSingleObject(g_hInnerEvent, INFINITE); //2000);
		ResetEvent(g_hInnerEvent);

		// process all touch queue points
		EnterCriticalSection(&Q2CritSect);
		while(!fDone) 
		{
	    		i = pTouchQ->iGet;
	    		if(i == pTouchQ->iPut) 
	    		{
	    		 	// no more points
	    			fDone = TRUE;
	    		} 
	    		else 
	    		{
	    			int iNext;
	    			// copy the data out of the critical section so that we can release it
	    			DWORD flags = pTouchQ->elems[i][0];
	    			short x = ((pTouchQ->elems[i][1])>>16);
	    			short y = ((pTouchQ->elems[i][1])&0x0FFFF);

	                     // don't hold the critical section during the callback
	                     //  (priority inversion can fail here)
	        		LeaveCriticalSection(&Q2CritSect);

	        		// handle the point data
	    			StubCallback2(GetTickCount(), flags, x, y);

				// update the queue pointer
	    			iNext = i+1;
	    			if(iNext>=MAX_TOUCHQUEUE) 
	    			{
	    				iNext=0;
	    			}

	              	// re-enter the critical section to update the read pointer
	              	// and go back to the top of the loop.
	    			EnterCriticalSection(&Q2CritSect);
	    			pTouchQ->iGet = iNext;
	    		}
		}

		// no more points, release the critical section
		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)

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av中文字幕不卡| 欧美视频一区在线| 日韩av中文字幕一区二区| 久久久精品2019中文字幕之3| 91久久精品一区二区三| 国产一区二区三区综合| 亚洲精品成a人| 久久综合久久综合九色| 欧美性猛交xxxx乱大交退制版 | 国产婷婷色一区二区三区| 欧美亚洲综合另类| 成人h动漫精品| 加勒比av一区二区| 视频一区视频二区中文字幕| 亚洲欧美偷拍另类a∨色屁股| 日韩一区二区三区四区| 在线观看国产91| 成人国产亚洲欧美成人综合网| 蜜桃精品视频在线| 水蜜桃久久夜色精品一区的特点| 国产精品久久久久久户外露出 | 在线观看日韩av先锋影音电影院| 国产一区 二区 三区一级| 天堂久久一区二区三区| 亚洲视频1区2区| 国产午夜精品久久久久久免费视| 日韩三级精品电影久久久| 欧美亚洲动漫另类| 在线观看亚洲专区| 99国产精品国产精品久久| 国产成人免费视| 国产精品99久久久久久久vr| 久久国产日韩欧美精品| 免费观看91视频大全| 丝袜脚交一区二区| 丝袜亚洲另类丝袜在线| 亚洲成人av在线电影| 亚洲国产精品自拍| 亚洲自拍与偷拍| 亚洲五码中文字幕| 亚洲国产成人va在线观看天堂| 亚洲九九爱视频| 亚洲综合免费观看高清完整版| 亚洲免费观看高清完整版在线 | 一区二区三区波多野结衣在线观看 | 成人美女在线视频| 国产福利精品一区| 岛国精品在线观看| 99久久婷婷国产综合精品| 成人ar影院免费观看视频| 成人精品小蝌蚪| 99久久夜色精品国产网站| 一本一道久久a久久精品| 91国偷自产一区二区开放时间 | 国产一区二区三区电影在线观看 | 亚欧色一区w666天堂| 五月开心婷婷久久| 久久精品理论片| 国产精品一区免费视频| 不卡的av网站| 欧美亚一区二区| 日韩一区二区在线观看| 精品国产91乱码一区二区三区 | 国产精品色在线| 亚洲美女免费视频| 五月天精品一区二区三区| 六月婷婷色综合| 国产a精品视频| 在线观看一区二区视频| 日韩你懂的在线观看| 国产欧美视频一区二区| 亚洲另类在线制服丝袜| 男男gaygay亚洲| 国产91在线观看丝袜| 欧美日韩综合不卡| 久久久久亚洲蜜桃| 亚洲最新在线观看| 裸体一区二区三区| 91亚洲精华国产精华精华液| 欧美日产国产精品| 国产偷国产偷亚洲高清人白洁| 亚洲另类春色校园小说| 激情小说亚洲一区| 色欲综合视频天天天| www国产精品av| 一区二区三区四区不卡视频| 久久国内精品自在自线400部| fc2成人免费人成在线观看播放| 欧美日韩久久一区二区| 国产亚洲综合av| 亚洲一线二线三线视频| 国产精品一区二区男女羞羞无遮挡| 99久久精品免费看国产| 日韩欧美视频一区| 亚洲视频 欧洲视频| 国产又粗又猛又爽又黄91精品| 色噜噜夜夜夜综合网| 久久婷婷成人综合色| 亚洲国产另类av| 成人av网站在线| 欧美tickling网站挠脚心| 一区二区三区在线免费视频 | 国产成人在线免费| 欧美人牲a欧美精品| 中文字幕亚洲在| 狠狠色丁香久久婷婷综合_中| 欧美亚洲综合久久| 中文字幕av一区二区三区高 | 日韩三级av在线播放| 日韩伦理免费电影| 国产精品一品二品| 91麻豆精品国产91久久久久久久久| 亚洲欧美一区二区不卡| 国产 日韩 欧美大片| 日韩欧美高清dvd碟片| 亚洲一区二区视频在线| 91视频在线观看免费| 国产无遮挡一区二区三区毛片日本| 日本大胆欧美人术艺术动态| 色婷婷久久久久swag精品| 国产欧美日韩激情| 国产综合一区二区| 日韩你懂的在线观看| 青青草97国产精品免费观看无弹窗版| 欧美视频在线一区| 亚洲国产美女搞黄色| 在线精品视频一区二区| 一区二区三区四区av| 99国产精品国产精品久久| 中文字幕日本不卡| a在线播放不卡| 国产精品久久久久永久免费观看| 国产精品影视在线| 久久免费国产精品| 国产精品综合一区二区三区| 亚洲精品在线免费播放| 蜜桃精品在线观看| 欧美精品一区二区三区四区| 久久99精品视频| 日韩一级免费一区| 裸体歌舞表演一区二区| 欧美精品一区二区蜜臀亚洲| 国内外精品视频| 久久精品一区二区三区不卡牛牛| 色先锋资源久久综合| 亚洲少妇最新在线视频| 在线观看91视频| 五月天视频一区| 精品国产乱码久久久久久1区2区| 狠狠色丁香久久婷婷综合_中| 国产人伦精品一区二区| av不卡在线播放| 亚洲一二三四久久| 777久久久精品| 国产在线不卡一区| 成人欧美一区二区三区白人| 色婷婷精品久久二区二区蜜臀av | 2020日本不卡一区二区视频| 国产综合色精品一区二区三区| 欧美激情中文不卡| 一本久久a久久免费精品不卡| 一区二区三区免费在线观看| 欧美三区在线视频| 久久国产精品99久久人人澡| 久久综合久久综合亚洲| av男人天堂一区| 午夜视频在线观看一区二区三区| 欧美一区二区三区四区在线观看| 精品一区二区三区欧美| 国产精品第13页| 欧美美女激情18p| 国产麻豆视频一区二区| 亚洲欧美韩国综合色| 欧美精品99久久久**| 丰满白嫩尤物一区二区| 亚洲国产aⅴ天堂久久| 26uuu另类欧美亚洲曰本| 91浏览器在线视频| 男人的j进女人的j一区| 国产精品丝袜久久久久久app| 欧美色精品天天在线观看视频| 国产精品一区二区久久精品爱涩| 亚洲精品第1页| 久久久久国产免费免费| 欧美影视一区在线| 国产九九视频一区二区三区| 一区二区三区电影在线播| 久久久亚洲精华液精华液精华液| 色综合亚洲欧洲| 精品系列免费在线观看| 夜夜嗨av一区二区三区四季av| 久久综合久久99| 欧美老人xxxx18| 99国产精品视频免费观看| 久久99九九99精品| 亚洲影院理伦片| 中文字幕佐山爱一区二区免费| 日韩女优av电影| 欧美日韩国产一二三| 99精品视频一区|