I've been trying to use the rebase utility to rebase some dlls. For
some reason it doesn't seem to work on all dlls, it just does nothing.
I started loking around at the ImageHlp.lib and see that there is a
function ReBaseImage. Clearly this is what the rebase utility is
using.
The docs on ReBaseImage say nothing about why this would fail. The
application I am working with loads a huge number of dlls and letting
the loader decide where everything should go is causing problems as
things are being loaded all over the address space. In particular
there are some Borland specific dlls (vcl50.bpl etc) that are based
directly in the middle of the address space, at 0x40000000. The
rebase utility does nothing to these dlls, though looking at them with
dumpbin /headers everything seems pretty normal.
Anyway, anyone have any idea why ReBaseImage would fail? These dlls
all have .reloc sections, so it seem as though relocations have been
stripped. But I guess I don't understand how all this works.
Thanks in advance,
-Eric
Terrex Inc.
This is the principle reason rebase would fail.
Why do you want to relocate your DLLs? So your address space is not
fragemented? This shouldn't matter
unless you need to allocate very large blocks of memory (or memory map very
large files).
Depending on your exact need I may be able to help you out. I have a Win32
replacement loader for EXE
and DLL files which could possible be adopted to your needs :
http://thinstall.com. I have gotten it to get around problems with the
gcc-linker and relocate those DLLs even though the Windows loader cannot.
"Eric" <zimb...@yahoo.com> wrote in message
news:40a06379.02083...@posting.google.com...
I did some work on the executable (PE) file format. The reason was that
there were a few API functions (to do with loading debug information) that
worked fine on executables and dlls generated by Visual Studio, but failed
on those generated by Borland. Therefore, I wrote my own code to parse the
file format and make the changes. If you're stuck, you could use my code,
but it's probably a last resort since you'd still have to do a lot of
work... the code is at http://www.wischik.com/lu/programmer -- search for
"PE".
--
Lucian Wischik, Queens' College, Cambridge CB3 9ET. www.wischik.com/lu
Hi Lucian,
Thanks for getting back to me on the newsgroup. I downloaded the pe dumper
utility from your website. You indicate in your posting that you wrote your
own code to "parse the file format and make the changes". I assume by this
you mean making the changes required to rebase the image? Where is this
code? It seems actually that pedump itself is something from Matt Pietrek.
Did you modify his code in some way to do this? It would be very helpful at
least to see what you have done, I have never tried to write something that
mucks with the PE format itself. It would take more time than I have to
learn from scratch by reading the spec how to rebase something by modifying
the PE tables directly.
Thanks in advance,
Eric Twietmeyer
Terrain Experts Inc.