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

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

?? tramousestub.cpp

?? 這是一個ce5.0下usb hid的驅動源代碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
//
// 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.
//
/*++
   TraMouseStub.cpp   Created April 7 1997 (as tchstub.c)
   Modified for use with the mouse driver Aug 15 2003
--*/

// NOTE - this code was ported from the touch driver code, thus it may say "touch" in places where we 
//  really mean "mouse". 

// Debug guide:  These are the debugging switches used in this driver 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
//



// Basic architecture:
// The points come in through CgrCallback.  
//  If Transcriber is not running, then the points are returned to the mouse driver.
//  Otherwise are then placed on the inner (internal to the mouse driver) queue (Q2) by SendPtToSelf.
//
// Points are removed from Q2 by the mouse driver thread (MouseInnerThread), 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 turned back into a mouse_event.
//  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 "TraMouseStub.h"
#include "tchddi.h"
#include "pegc_def.h"  // Local copy, main file is in the transcriber sources

#ifdef __cplusplus
extern "C"{
#endif 

//#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

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;

// #pragma data_seg() - @todo needed?  what arg should go here?

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,
   (CGRTOUCH_MAJOR_VERSION|0xC0), (CGRTOUCH_MINOR_VERSION|0x80), CGRTOUCH_RELEASE, 0x80};


BOOL IsCgrTouchFile(TCHAR *szFileName);
BOOL IsStubWndExist();
DWORD WINAPI MouseWindowThread(DWORD dwParameter);
void StubCallback2(DWORD dwtick0, TOUCH_PANEL_SAMPLE_FLAGS Flags, INT X, INT Y);
BOOL MddTouchPanelEnable(PFN_TOUCH_PANEL_CALLBACK pfnCallback);
void CgrMouseStubInitialize(HANDLE  hinstDll);
BOOL CgrCallback(TOUCH_PANEL_SAMPLE_FLAGS Flags, INT X, INT Y, UINT evfMouse);

// returning true indicates that we want the caller to call DriverMouseHook
BOOL DriverMouseHookInitialize(HANDLE hInstDll)
{
    CgrMouseStubInitialize(hInstDll);
    return TRUE;
}

// if this driver stub wants the point, return TRUE, and send the point.
//  otherwise return FALSE.
// The basic version in the driver will always return false, link with
//  TraMouse to get this version.  This way, we don't interfere with
//  the mouse driver if SYSGEN_TRANSCRIBER is not enabled.
BOOL DriverMouseHook(DWORD dwFlags, DWORD dx, DWORD dy, DWORD dwData)
{
    // TRANSCRIBER - if SYSGEN_TRANSCRIBER is turned on, give transcriber a chance here to 
    //    snag the mouse point.  (transcriber.exe must check for the kbdmouse.dll if touch.dll is not available.)

    // variables needed by transcriber
    static BOOL     bLeftMouseButtonDown = FALSE;
    DWORD           tchFlags = 0;
    BOOL            bTranscriberWantsThisPoint = FALSE;
    // transcriber does not use dwData, so avoid warnings that the varaible is unused
    dwData = dwData;

    bTranscriberWantsThisPoint = FALSE;	
				
    // mouse button goes down, tell transcriber
    if (dwFlags & MOUSEEVENTF_LEFTDOWN)
    {
        tchFlags = TouchSampleIsCalibratedFlag | TouchSampleValidFlag | TouchSampleDownFlag;
        bLeftMouseButtonDown = TRUE;
    }

    // moves while the mouse button is down, send all points
    else if (bLeftMouseButtonDown)
    {
        tchFlags = TouchSampleIsCalibratedFlag | TouchSampleValidFlag | TouchSampleDownFlag | TouchSamplePreviousDownFlag;
    }

    // mouse button goes up, send a prev down flag to tell transcriber that the pen is up.
    if (dwFlags & MOUSEEVENTF_LEFTUP)
    {
        tchFlags = TouchSampleIsCalibratedFlag | TouchSampleValidFlag | TouchSamplePreviousDownFlag;	
        bLeftMouseButtonDown = FALSE;
    }

    // ask transcriber if "pen" is now down, or just came back up
    if (TouchSamplePreviousDownFlag & tchFlags || TouchSampleDownFlag & tchFlags )
    {
        bTranscriberWantsThisPoint = CgrCallback(tchFlags, dx, dy, dwFlags);    	
    }

    // Tell the mouse driver whether or not to process the point
    //  if transcriber does not want the point, it is sent back to mouse_event()
     return bTranscriberWantsThisPoint; 
}


// Look at the queue internal to the touch driver, and send the points to StubCallback2
DWORD WINAPI MouseInnerThread(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

					// The ARM compiler optimization appears to be broken on the next 3 lines
	    			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)
           iPut = 0;

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

   ReleaseMutex(hQ1Mutex);

}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av午夜电影| 欧美日韩精品欧美日韩精品一 | 国产宾馆实践打屁股91| 日本乱人伦aⅴ精品| 久久欧美一区二区| 麻豆久久久久久| 欧美群妇大交群中文字幕| 中文字幕人成不卡一区| 国模无码大尺度一区二区三区| 欧美亚洲国产怡红院影院| 国产精品网站导航| 寂寞少妇一区二区三区| 欧美丰满少妇xxxbbb| 亚洲一区二区欧美激情| 色综合色综合色综合| 中文字幕五月欧美| 懂色av一区二区三区免费观看 | 风间由美一区二区av101| 日韩美女在线视频| 午夜欧美2019年伦理| 99re视频这里只有精品| 26uuu久久综合| 精彩视频一区二区| wwww国产精品欧美| 国产麻豆午夜三级精品| 久久久久久影视| 国产高清不卡一区| 日本一区二区三区久久久久久久久不| 精品在线视频一区| 欧美精品一区二区三区久久久| 青草国产精品久久久久久| 色婷婷综合久久久中文一区二区 | 日韩视频在线观看一区二区| 首页国产欧美日韩丝袜| 欧美日韩国产一二三| 亚洲成av人片在线| 日韩午夜精品电影| 国产乱理伦片在线观看夜一区| 久久精品在这里| 99国产欧美久久久精品| 亚洲猫色日本管| 欧美日韩在线播| 麻豆久久久久久久| 亚洲国产精品t66y| 91麻豆视频网站| 视频一区二区不卡| 精品国产a毛片| av一本久道久久综合久久鬼色| 亚洲欧美一区二区三区极速播放| 欧美在线观看视频一区二区三区 | 日韩欧美亚洲一区二区| 国模一区二区三区白浆| 中文字幕在线播放不卡一区| 欧美私人免费视频| 精品一区二区在线看| 国产精品美女视频| 精品视频全国免费看| 毛片基地黄久久久久久天堂| 国产精品私人影院| 欧美日韩日日摸| 国产99久久久国产精品潘金| 亚洲欧美日韩电影| 精品久久久久99| 91视频.com| 久久av中文字幕片| 自拍偷拍欧美精品| 欧美videofree性高清杂交| 99re在线精品| 久久66热偷产精品| 一区二区欧美在线观看| 精品国产亚洲一区二区三区在线观看| 成人性生交大片免费看中文| 蜜臀av国产精品久久久久| 国产欧美一区二区精品仙草咪| 色综合天天综合| 激情都市一区二区| 一区二区三区日韩在线观看| 国产日产欧美一区| 欧美高清一级片在线| 99久久99久久久精品齐齐| 久久精品国产99久久6| 亚洲v精品v日韩v欧美v专区| 日本一区二区在线不卡| 欧美一级一级性生活免费录像| 99精品一区二区三区| 国产一区二区导航在线播放| 丝袜亚洲另类丝袜在线| 亚洲激情图片一区| 欧美国产精品久久| 精品国产区一区| 欧美高清激情brazzers| 91色.com| 99re热这里只有精品免费视频| 国产福利91精品一区二区三区| 免费在线观看精品| 亚洲国产日韩一区二区| 亚洲素人一区二区| 久久精品欧美日韩| 久久久久久久综合狠狠综合| 日韩亚洲欧美高清| 日韩欧美国产午夜精品| 欧美乱妇20p| 在线成人免费观看| 欧美日本在线视频| 欧美日本一道本| 欧美日韩黄色一区二区| 欧美日韩成人高清| 欧美精品久久久久久久久老牛影院| av高清不卡在线| 成人短视频下载| 99综合电影在线视频| zzijzzij亚洲日本少妇熟睡| 国产成人亚洲综合a∨婷婷图片| 国产精品综合在线视频| 国产高清亚洲一区| 成人激情av网| 91美女片黄在线观看91美女| 在线视频你懂得一区| 欧美午夜在线一二页| 精品国产3级a| 精品久久国产字幕高潮| 日本一区免费视频| 亚洲素人一区二区| 五月天国产精品| 日本成人在线电影网| 韩国成人精品a∨在线观看| 国产jizzjizz一区二区| 国产.精品.日韩.另类.中文.在线.播放| 国产成人精品一区二| 成人激情综合网站| 欧美性高清videossexo| 制服丝袜日韩国产| 久久亚洲精华国产精华液| 国产日韩三级在线| 夜夜嗨av一区二区三区中文字幕 | 国产精品伦理在线| 亚洲少妇屁股交4| 午夜激情久久久| 国产尤物一区二区| 91蜜桃免费观看视频| 欧美日韩国产电影| 久久久久国色av免费看影院| 亚洲欧美另类久久久精品| 肉丝袜脚交视频一区二区| 九九在线精品视频| 色婷婷av一区| 精品91自产拍在线观看一区| 国产精品初高中害羞小美女文| 一区二区三区久久久| 六月丁香婷婷久久| 91啪亚洲精品| 精品国产乱码久久| 亚洲激情中文1区| 国产一区久久久| 欧美日韩一区 二区 三区 久久精品| 精品久久人人做人人爱| 一区二区三区国产| 久久99精品久久久久久久久久久久 | 欧美本精品男人aⅴ天堂| 成人免费在线观看入口| 毛片不卡一区二区| 91福利视频网站| 国产性色一区二区| 麻豆精品久久精品色综合| 色婷婷综合五月| 亚洲国产精品成人综合| 美日韩一区二区三区| 欧美中文字幕亚洲一区二区va在线 | 日韩中文字幕区一区有砖一区| 国产99一区视频免费| 欧美大胆人体bbbb| 亚洲高清在线视频| 91在线精品秘密一区二区| 久久久精品欧美丰满| 免费观看30秒视频久久| 欧美日韩中文一区| 国产精品久久久久婷婷| 国产精品123区| 日韩一区二区三区四区五区六区| 亚洲一区在线观看视频| 99久久久久久99| 欧美激情综合五月色丁香| 裸体一区二区三区| 8x8x8国产精品| 亚洲成人精品在线观看| 91成人免费在线视频| 亚洲精品成a人| 91国模大尺度私拍在线视频| 国产精品另类一区| 懂色av一区二区三区免费观看| 久久综合视频网| 精品中文av资源站在线观看| 欧美一区二区成人6969| 日韩av电影天堂| 欧美丰满高潮xxxx喷水动漫| 亚洲成人一区二区| 911精品国产一区二区在线| 午夜精品福利一区二区蜜股av| 这里只有精品电影| 美女视频一区在线观看|