0

タイトルにあるように、Dev-C++ で Detours を使用して単純な DLL をコンパイルしようとしていますが、次のエラーが発生します。

syntax error before token '&'

この行で:

DetourAttach(&(PVOID &)trueMessageBox, hookedMessageBox)
DetourDetach(&(PVOID &)trueMessageBox, hookedMessageBox)

完全なコードは

#include <windows.h>
#include <detours.h>

#pragma comment( lib, "Ws2_32.lib" )
#pragma comment( lib, "detours.lib" )
#pragma comment( lib, "detoured.lib" )


int (WINAPI * trueMessageBox)(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType) = MessageBox;
int WINAPI hookedMessageBox(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType)
{
    LPCSTR lpNewCaption = "You've been hijacked";
    int iReturn = trueMessageBox(hWnd, lpText, lpNewCaption, uType);
    return  iReturn;
}

BOOL WINAPI DllMain( HINSTANCE, DWORD dwReason, LPVOID ) {
    switch ( dwReason ) {
        case DLL_PROCESS_ATTACH:           
                DetourTransactionBegin();
                DetourUpdateThread( GetCurrentThread() );
                DetourAttach(&(PVOID &)trueMessageBox, hookedMessageBox)
                DetourTransactionCommit();
                break;

        case DLL_PROCESS_DETACH:
                DetourTransactionBegin();
                DetourUpdateThread( GetCurrentThread() );
                DetourDetach(&(PVOID &)trueMessageBox, hookedMessageBox)
                DetourTransactionCommit(); 
                break;
    }

    return TRUE;
}
4

2 に答える 2

0

LPVOID代わりにすべきではありませんPVOIDか?

于 2010-06-05T16:58:28.850 に答える
0

これらの行にはセミコロンがありません。

回り道について知らなかったので、型キャスト to をクエリしようとしましたがPVOID &、これは奇妙に見えますが、ネット上にはその例がいくつかあるので、もっともらしいと思われます。

于 2010-06-05T15:34:29.723 に答える