高手帮帮忙~~~关于远程线程注入(vc中)~~~

来源:百度知道 编辑:UC知道 时间:2024/05/23 00:00:53
远程线程注入,是用的非DLL方法,在注入的线程里是
// 远程线程执行体
DWORD __stdcall ThreadProc(RemotePara *Para)
{
typedef int (__stdcall *PMessageBox) ( HWND , LPCTSTR , LPCTSTR , UINT );
PMessageBox MessageBoxFunc = (PMessageBox)Para->dwMessageBox;
MessageBoxFunc(NULL, Para->strMessageBox, NULL, MB_OK);
}//如果远程线程启动,便以注入的进程弹出对话框
可以在运行要注入的进程时,弹出确认对话框
但是为什么我在注入的线程里再加上
ofstream outfile("e://testout.txt");
int i = 100;
while(i>0)
{
i--;
outfile<<"test"<<endl;
}//如果远程线程启动,便在testout.txt里面输入test,100个
就会报错啊,编译通过,一运行就出错,为什么哦?

CreateRemoteThread里不要用任何类。只能用char,int之类的基本数据类型。
ofstream是不可以用的。

1。CreateFile创建或打开e:\\testout.txt
2。WriteFile写入char cVar[] = "test"
3。CloseHandle关闭打开的文件

这样就可以实现你的目的了。当然这3个函数你也必须仿造MessageBox手工调用。