dead gunner
dead gunner

Reputation: 35

unresolved external symbols in Detours Library? (Detours::X64::DetourFunction, Direct3DCreate9)

so i was following along an dll injection tutorial on yt, and it gave me some errors when trying to compile.

1.unresolved external symbol "unsigned __int64 __cdecl Detours::X64::DetourFunction(unsigned __int64,unsigned __int64,enum Detours::X64Option)" (?DetourFunction@X64@Detours@@YA_K_K0W4X64Option@2@@Z) referenced in function "unsigned long __cdecl mainThread(void *)"

 CODE TO ERROR:


  DWORD WINAPI mainThread(PVOID base) {
void* d3d9Device[119];

if(GetD3D9Device(d3d9Device, sizeof(d3d9Device))){
    oEndScene = (EndScene)Detours::X64::DetourFunction((uintptr_t)d3d9Device[42], (uintptr_t)hkEndScene);//here
}

while (true) {
    if (GetAsyncKeyState(VK_F10)) {
        CleanUpDeviceD3D();
        FreeLibraryAndExitThread(static_cast<HMODULE>(base),1);
    }
}

FreeLibraryAndExitThread(static_cast<HMODULE>(base), 1);

} 2. unresolved external symbol Direct3DCreate9 referenced in function "bool __cdecl GetD3D9Device(void * *,unsigned __int64)"

CODE TO ERROR:


bool GetD3D9Device(void **pTable, size_t size) {
if (!pTable) {
    return false;
}

g_pD3D = Direct3DCreate9(D3D_SDK_VERSION); //here

on the first error, the tutorial stated you should use the following syntax:

oEndScene = (EndScene)Detours::X64::DetourFunction((Detours::uint8_t*)d3d9Device[42], (Detours::uint8_t*)hkEndScene);

however detours doesnt have uint8_t for me and some forums online said to use uintptr_t. but i still get the error. ive tried looking at my includes for lib and release in detours but it still says unresolved external symbol even after including the folder where Detoursx64.cpp is present.

any help ise appreciated.

Upvotes: 0

Views: 1076

Answers (1)

Joseph Colbert
Joseph Colbert

Reputation: 1

you need to compile Detours as x86 and use the release folder instead of compiling detours as x64

Upvotes: 0

Related Questions