Reputation: 359
I have been playing with the {$IMAGEBASE}
directive in Delphi but I can see that I can only put a value lower than $FFFFFFFF
(32-bit).
I'm compiling as x64 and I need to set an image base bigger than 32-bit but Delphi ignores the higher 32-bit DWORD in my 64-bit ImageBase.
Has anyone managed to set a value higher than $FFFFFFFF
as ImageBase for Delphi?
I need it because I need to test my application in "high" ImageBase (due to some hook tests, etc)
Thanks!
Upvotes: 4
Views: 607
Reputation: 613163
The Delphi linker does not support large image base, although there are new PE optional headers that allow large image base values to be specified.
So I think that until Embarcadero introduce any such functionality, you would need to use a third party tool to rebase the executable file after it has been built. For instance EDITBIN with the /REBASE option from the MS toolchain.
I took a simple 64 bit VCL program, built with XE7, and rebased it like this:
editbin /rebase:base=0xffffff0000 Project1.exe
I confirmed using Process Hacker that the image base was indeed as specified.
Upvotes: 8