阅读:863回复:0
Detours 怎样使用?
HRESULT (*pfIDirectSoundBufferPlay_t)
(IDirectSoundBuffer * This, DWORD dwReserved1, DWORD dwPriority,DWORD dwFlags); HRESULT IDirectSoundBufferPlay (IDirectSoundBuffer * This, DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags) { MessageBoxA(NULL,\"bingo in com\",\"ok\",MB_OK); return 0;//DS_OK } void BeginDetoursPlay(IDirectSoundBuffer *pi) {//开始拦截 (*(PBYTE*)pfIDirectSoundBufferPlay_t) = DetourFunction(//开始拦截 (PBYTE) pi->Play,//出错 (PBYTE)IDirectSoundBufferPlay);//这是我的函数 } int CancelDetoursPlay() {//关闭拦截 DWORD dwErrorCode; dwErrorCode=DetourRemove((PBYTE)pfIDirectSoundBufferPlay_t, (PBYTE)IDirectSoundBufferPlay); if (dwErrorCode=true) return 0; else return 1; } 编译时在pi->Play出错,不能将函数指针转换成字节指针,我非常奇怪,其它的差数都转换了,为什么偏偏这个不行,就因为它是COM组建接口中的函数?哪位大侠帮帮忙。 |
|
|