首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

拦截api失败,找不到原因解决方法

2012-04-21 
拦截api失败,找不到原因我《在windows核心编程》代码例子的基础上,添加了hook函数GetFileAttributesW的代码,

拦截api失败,找不到原因
我《在windows核心编程》代码例子的基础上,添加了hook函数GetFileAttributesW的代码,可是运行就出问题,一直没有找到原因。

hook其他的api就没有问题,hook这个GetFileAttributesW就不能成功。

在LastMsgBoxInfoLib.cpp里添加的代码:

C/C++ code
typedef DWORD (WINAPI *PENGetFileAttributesW)(            LPCWSTR lpFileName);//......extern CAPIHook g_GetFileAttributesW;//...... DWORD Hook_GetFileAttributesW(LPCWSTR lpFileName) {    DWORD nResult=0;    nResult = ((PENGetFileAttributesW)(PROC)g_GetFileAttributesW)(lpFileName);    return(nResult); }//......CAPIHook g_GetFileAttributesW("Kernel32.dll", "GetFileAttributesW", (PROC) Hook_GetFileAttributesW);


[解决办法]
DWORD WINAPI Hook_GetFileAttributesW(LPCWSTR lpFileName)

热点排行