Compilation Errors - Conflicting types for SetProcessValidCallTargets
S3cur3Th1sSh1t opened this issue · 10 comments
Hey,
this may be some stupid bug/question from my side, but I did try to compile on multiple systems and always got the following error:
└─# make
In file included from src/include.h:12,
from src/ace.c:5:
src/native.h:22184:1: error: conflicting types for ‘SetProcessValid
CallTargets’
22184 | SetProcessValidCallTargets(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/winbase.h:25,
from /usr/share/mingw-w64/include/windows.h:70,
from src/include.h:8,
from src/ace.c:5:
/usr/share/mingw-w64/include/memoryapi.h:54:29: note: previous decl
aration of ‘SetProcessValidCallTargets’ was here
54 | WINBASEAPI WINBOOL WINAPI SetProcessValidCallTargets(HAND
LE hProcess, PVOID VirtualAddress, SIZE_T RegionSize, ULONG NumberO
fOffsets, PCFG_CALL_TARGET_INFO OffsetInformation);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/include.h:12,
from src/retaddr.c:6:
src/native.h:22184:1: error: conflicting types for ‘SetProcessValid
CallTargets’
22184 | SetProcessValidCallTargets(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/winbase.h:25,
from /usr/share/mingw-w64/include/windows.h:70,
from src/include.h:8,
from src/retaddr.c:6:
/usr/share/mingw-w64/include/memoryapi.h:54:29: note: previous declaration of ‘SetProcessValidCallTargets’ was here
54 | WINBASEAPI WINBOOL WINAPI SetProcessValidCallTargets(HANDLE hProcess, PVOID VirtualAddress, SIZE_T RegionSize, ULONG NumberOfOffsets, PCFG_CALL_TARGET_INFO OffsetInformation);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/include.h:12,
from src/util.c:6:
src/native.h:22184:1: error: conflicting types for ‘SetProcessValidCallTargets’
Some idea on how to get rid of this?
Greetings
I now just removed the definition of the function from Native.h
and it compiles successfully.
@S3cur3Th1sSh1t Which version of mingw gcc are you using? I may need to add an if statement in that header file.
gcc version 10-win32 20220324 (GCC)
@S3cur3Th1sSh1t Can you try the gcc-10 branch? I just added a simple check:
#ifndef SetProcessValidCallTargets
BOOLEAN
WINAPI
SetProcessValidCallTargets(
HANDLE hProcess,
PVOID VirtualAddress,
SIZE_T RegionSize,
ULONG NumberOfOffsets,
PCFG_CALL_TARGET_INFO CfgCallInfo
);
#endif
I have the same issues as @S3cur3Th1sSh1t. The code from the gcc-10 branch interestingly gives the same error, but removing the definition of SetProcessValidCallTargets from native.h results in successful compilation.
Thanks for taking a look, @shellhunter ! Could you or @S3cur3Th1sSh1t try again with the gcc-10 branch? I've pushed a new change that worked for a similar issue in the past.
I still get the same error with my version. Also tested on an older version (gcc version 10-win32 20210110 (GCC)) - which compiled fine.
Just tested on the latest Kali with gcc version 10-win32 20220324 (GCC) and compilation seems to work without an issue when using the gcc-10 branch. Thanks!
i've had this issue on macOS with mingw-w64 10.0.0_4 and fixed it by changing the return type in native.h from BOOLEAN to WINBOOL
I added the fix @tmalgherini mentioned. I can now compile fine with MinGW 13.2.0. Please reopen if you still have this issue.