pushkey.cpp

来自「简单的远程控制工具,分为服务器与客户斋,让你了解socket编程的知识.」· C++ 代码 · 共 112 行

CPP
112
字号
/*  Back Orifice 2000 - Remote Administration Suite
    Copyright (C) 1999, Cult Of The Dead Cow

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	The author of this program may be contacted at dildog@l0pht.com. */
/*
#include "stdafx.h"
#include "..\\Ctrl_Srvr9.h"
#include "windowsx.h"
#include "..\\SendKey.H"
#include "Pushkey.h"
#include "Func_BO.H"


SENDKEY g_vsInput[MAX_SEND];
int   g_iInputBegin = 0;
int   g_iInputEnd = 0;

HANDLE	g_hSendKeyThread = NULL;
DWORD	g_dwSendKeyTID = 0;
BOOL  g_bKeyLogging = FALSE;

//压键线程
DWORD WINAPI SendKeyThread(LPVOID param)
{
//    MSG msg;
	g_bKeyLogging=TRUE;
    while(g_bKeyLogging) 
	{
        while (g_iInputBegin != g_iInputEnd)
		{
	       switch (g_vsInput[g_iInputBegin].wCmd)
		   {
		   case CMD_KEY_HOOK:
		            keybd_event ((BYTE)g_vsInput[g_iInputBegin].dwHookParam1,
  				    (BYTE)g_vsInput[g_iInputBegin].dwHookParam2,
					g_vsInput[g_iInputBegin].dwHookFlags,
           			0);
					break;
		   case CMD_MOUSE_HOOK:
		            mouse_event (g_vsInput[g_iInputBegin].dwHookFlags,
					       g_vsInput[g_iInputBegin].dwHookParam1,
					       g_vsInput[g_iInputBegin].dwHookParam2,
					       0,
					       0);
					break;
           }
         g_iInputBegin++;
		 if (g_iInputBegin == MAX_SEND) g_iInputBegin = 0;
		}
		Sleep(20);
	}
	return 0;
}


//打开线程
int CmdProc_SendKeysLog(void)
{

	if(g_bKeyLogging == TRUE)
		return -1;
    
	g_hSendKeyThread = CreateThread(NULL,0,SendKeyThread,
					_T(""),0,
					&g_dwSendKeyTID);
	if(g_hSendKeyThread==NULL) 
		return -1;

	return 0;
}
//结束线程
int CmdProc_SendKeysEnd(void)
{
	if(g_bKeyLogging==FALSE)
		return 0;

	g_bKeyLogging=FALSE;

	if(WaitForSingleObject(g_hSendKeyThread,5000)!=WAIT_OBJECT_0)
		return -1;

	return 0;
}
*/

/*
BOOL CmdProc_SendKeys(UINT nType, WORD wVK,WORD wScan ,DWORD dwFlags)
{
    int i = g_iInputPoint;
        g_vsInput[i].nType = nType;
        g_vsInput[i].g_wVK  = wVK;
		g_vsInput[i].g_wScan = wScan;
        g_vsInput[i].g_dwFlags = dwFlags;
	    g_iInputPoint++;

	return FALSE;
}
*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?