Hallo ik probeer de volgende code te compilen als Dynamic Linked Library.
code:
dit geeft het volgende:
Ik heb alles gekopieerd en geplakt dus ik snap de fout niet helemaal.
...
code:
Code:
#include <windows.h>
#include "detours.h"
int (__stdcall* HelloFunction)(void);
void HookHelloFunction(void)
{
MessageBox(0, "You called the function : \"Hello\"", "Function Called", MB_OK);
return;
}
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
HelloFunction = (int (__stdcall*)(void))DetourFunction((PBYTE)0x0040108 0, (PBYTE)HookHelloFunction);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
DetourRemove((PBYTE)0x00401080, (PBYTE)HelloFunction); //Remove hook
break;
}
return TRUE;
}
dit geeft het volgende:
Code:
1>------ Build started: Project: main, Configuration: Debug Win32 ------
1>Compiling...
1>main.CPP
1>d:\project's\c++\hooking voorbeeld\hookingfunctionsdetourlibs_headers\main.cpp(15) : error C2143: syntax error : missing ')' before '__stdcall'
1>d:\project's\c++\hooking voorbeeld\hookingfunctionsdetourlibs_headers\main.cpp(15) : error C2059: syntax error : ')'
1>Build log was saved at "file://d:\Project's\C++\Hooking voorbeeld\HookingFunctionsDetourLibs_headers\Debug\BuildLog.htm"
1>main - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Ik heb alles gekopieerd en geplakt dus ik snap de fout niet helemaal.

Laatst bewerkt: