RT
解决方案 »
- 可换肤的无损wav格式音乐播放器源码v1.0.2.1
- VC 动态画直线
- 如何让CEdit在获得焦点时字体为红色,且可设置字体,使光标最后并不闪烁,只响应数字与V、P、M键,失去焦点时,文本颜色为白色,字体可设置
- 透明设置的问题!~~~~在线等
- 安装了某程序A的鼠标线程钩子,可以捕获A的弹出窗口的消息,却不能模拟这个事件。郁闷!!
- VC中使用SQL语句的时候如何使用变量?高分!
- 画图程序的小麻烦,大家给点意见吧
- 我终于明白了,学计算机必须编程
- vc6写的程序,运行提示内存不足
- 有关ReverseFind的问题。。。。。。。
- AcceptEx做服务端,ConnectEx做客户端,收不到断开信息?
- VC控件 在对话框内绘图?
//Dll部分#include <windows.h>
#include "detours.h"
#pragma comment(lib,"detoured.lib")
#pragma comment(lib,"detours.lib")
int (WINAPI *pMessageBoxW)(HWND hWnd ,
LPCWSTR lpText,
LPCWSTR lpCaption,
UINT uType) = MessageBoxW;int WINAPI MyMessageBoxW(HWND hWnd ,
LPCWSTR lpText,
LPCWSTR lpCaption,
UINT uType)
{
MessageBox(NULL,"MessageBox被拦截","API",MB_OK);
return pMessageBoxW(hWnd,lpText,lpCaption,uType);
}void _stdcall myTest()
{
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
int error;
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)pMessageBoxW, MyMessageBoxW);
error = DetourTransactionCommit();
if(NO_ERROR!=error)
OutputDebugString("错误");
else
OutputDebugString("正确");
}
break;
case DLL_PROCESS_DETACH:
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)pMessageBoxW, MyMessageBoxW);
DetourTransactionCommit();
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}//EXE部分void CTestDlg::OnButton1()
{
// TODO: Add your control notification handler code here
STARTUPINFO si;
PROCESS_INFORMATION pi;
char szpath[MAX_PATH];
CString str,str1,path;
ZeroMemory(&si, sizeof(STARTUPINFO));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
GetCurrentDirectory(MAX_PATH, szpath);
path.Format("%s",szpath);
str = path + "\\" + "testdll.dll";
str1 = path + "\\" + "detoured.dll";
MessageBox(str,"",MB_OK);
if (DetourCreateProcessWithDll(NULL, "C:\\windows\\notepad.exe", NULL,
NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
&si, &pi, str1, str, NULL))
{
MessageBox("","Success",MB_OK);
}
}
LIBRARY "testDll.DLL"
EXPORTS
myTest
我现在库老是加载失败 是怎么了啊http://topic.csdn.net/u/20100727/10/a5a038f8-791e-4352-a098-2254cf6d73e4.html?78497
谢9999辈子
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags);
int (WINAPI *pRecv)(SOCKET s, char* buf, int len, int flags) = recv;
int WINAPI MyRecv(SOCKET s, char* buf, int len, int flags);
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags)
{
fopen_s(&pSendLogFile, "C:\\SendLog.txt", "a+");
fprintf(pSendLogFile, "%s\n", buf);
fclose(pSendLogFile);
return pSend(s, buf, len, flags);
}
int WINAPI MyRecv(SOCKET s, char* buf, int len, int flags)
{
fopen_s(&pRecvLogFile, "C:\\RecvLog.txt", "a+");
fprintf(pRecvLogFile, "%s\n", buf);
fclose(pRecvLogFile);
return pRecv(s, buf, len, flags);
}
然后照着上面的替换,最后自己在注入.
VC6直接建一个记事本文件 最后保存成def文件
def 文件的作用呢? 可以不要这个文件吗?
DetourCreateProcessWithDll
是什么用处能细说下吗
http://topic.csdn.net/u/20100720/11/fa232f73-f18a-4dac-8338-9aaa3fc75586.html?seed=483682191&r=67200041#r_67200041
这个帖子是怎么 ?好像里面没用到上面的函数啊?
奥 这次问题多?回答完结贴了,楼高了
的作用是新建一个进程并把指定的Dll注入。至于你说的那个帖子 也是一种注入的方法,你可以看下windows核心编成 第22章 就明白很多。呵呵 共同学习
NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
&si, &pi, str1, str, NULL))第2个参数是干啥用的,是导入的程序的名字?还是别的什么?
另外 导出函数 一定要def 吗?我记得有个__declspec(dllexport)
区别是什么啊
__declspec(dllexport)和def的区别看下面的连接,我感觉一般情况下用哪个也行
http://dev.firnow.com/course/3_program/c++/cppxl/2008105/147591.html
是用explore.exe 还是Internet Explorer.exe 还是 ?好复杂啊
要IE的全路径 只写一个iexplore.exe不行
会不会2个进程同名?DetourCreateProcessWithDll(NULL, "C:\\windows\\notepad.exe",
那参数 到底是进程名字 还是程序 名字,看路径 应该是程序吧
到底是注入程序 还是注入进程
#pragma comment(lib,"detoured.lib")
#pragma comment(lib,"detours.lib")
顺便把你的正确代码发给我啊,谢谢!!!