mgeeky/ThreadStackSpoofer

mingw compile error

l4ckyguy opened this issue · 6 comments

Hi. I apologize very much, but I've been looking for an answer for the second day, but I haven't found it. I cannot compile on linux, using mingw (clang). Tell me in which direction to dig, if not difficult? Sorry for the stupid question)))

main.cpp:37:5: error: no matching function for call to 'fastTrampoline'
    fastTrampoline(false, (BYTE*)::Sleep, &MySleep, &buffers);
    ^~~~~~~~~~~~~~
./header.h:70:6: note: candidate function not viable: no known conversion from 'void (*)(DWORD)' (aka 'void (*)(unsigned long)') to 'LPVOID' (aka 'void *') for 3rd argument
bool fastTrampoline(bool installHook, BYTE* addressToHook, LPVOID jumpAddress, HookTrampolineBuffers* buffers = NULL);

try with -fpermissive and -fno-permissive, trying to change bool to BOOL, void to VOID and many other things, which i embarrassed to name((( Thx

Hi,

Thanks for reaching out!

Can you please try to compile the latest, update version? :)
It has massively changed its guts.

Regards,
Mariusz.

XD but no =)

clang version 12.0.0
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: /usr/llvm-mingw/bin
 "/usr/llvm-mingw/bin/clang-12" -cc1 -triple x86_64-w64-windows-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -mms-bitfields -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v -resource-dir /usr/llvm-mingw/lib/clang/12.0.0 -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/llvm-mingw/x86_64-w64-mingw32/include/c++/v1 -internal-isystem /usr/llvm-mingw/include/c++/v1 -internal-isystem /usr/llvm-mingw/lib/clang/12.0.0/include -internal-isystem /usr/llvm-mingw/x86_64-w64-mingw32/include -internal-isystem /usr/llvm-mingw/include -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/x/ThreadStackSpoofer-master/ThreadStackSpoofer -ferror-limit 19 -fno-use-cxa-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -exception-model=seh -fcolor-diagnostics -faddrsig -o /tmp/main-03921a.o -x c++ main.cpp
clang -cc1 version 12.0.0 based upon LLVM 12.0.0 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/llvm-mingw/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /usr/llvm-mingw/x86_64-w64-mingw32/include/c++/v1
 /usr/llvm-mingw/lib/clang/12.0.0/include
 /usr/llvm-mingw/x86_64-w64-mingw32/include
 /usr/llvm-mingw/include
End of search list.
main.cpp:137:10: error: no matching function for call to 'fastTrampoline'
    if (!fastTrampoline(true, (BYTE*)::Sleep, &MySleep, &buffers))
         ^~~~~~~~~~~~~~
main.cpp:41:6: note: candidate function not viable: no known conversion from 'void (*)(DWORD)' (aka 'void (*)(unsigned long)') to 'LPVOID' (aka 'void *') for 3rd argument
bool fastTrampoline(bool installHook, BYTE* addressToHook, LPVOID jumpAddress, HookTrampolineBuffers* buffers /*= NULL*/)
     ^
1 error generated.

How about simply adding type conversion before third argument? :)

(void*)&MySleep

only pointer to data may implicitly convert to void* according to the standard. msvc accepts this invalid code, gcc (and mingw) doesn't.

@l4ckyguy

Can we close the issue now or is there anything left we can discuss?

M.

sorry, yes =) thx a lot =)