I'm wondering if it's possible to turn off this position-independent code thing to change the assembly call
instruction from something like
call [rip+0x1234] // this address is relative to the current code position
to something like
call qword ptr[0x12345678] // this address is absolute and doesn't crash the program
The reason for this is that I create a remote thread by calling CreateRemoteThread
from WinAPI and I want to be able to call other WinAPI functions inside by just typing normal code, but now as the PIC is on, every time I call any function inside the remote thread I get an access violation and the process crashes. It's also worth mentioning that I know every process has different imported functions addresses, but I'm only calling functions from kernel32.dll
which is loaded at the same absolute address in every process as far as I know, so this isn't a problem.
Is there some macro or compiler option for this? I would also like to change that behaviour only for compilation of one file, not all in the solution.
Of course my CPU architecture is amd64
but I thinks that's irrelevant.
Thanks in advance!