Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Bug: plugins need to be rebased (Read 2173 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Bug: plugins need to be rebased

Hello,

First let me say that I very much enjoy your product.

Code: [Select]
Module Name        Size        Mapping    Timestamp        Working set (p)    Base address    Image base address
--------------------------------------------------------------------------------------------------------------------------
shared.dll        0x2A000        Image    4/19/2008 10:28 AM    20 K        0x10000000    0x10000000
foo_albumlist.dll    0x65000        Image    4/19/2008 10:29 AM    360 K        0xC20000    0x10000000
foo_cdda.dll        0x38000        Image    4/19/2008 10:29 AM    192 K        0xCE0000    0x10000000
foo_converter.dll    0x67000        Image    4/19/2008 10:29 AM    340 K        0xE50000    0x10000000
foo_dsp_std.dll        0x46000        Image    4/19/2008 10:29 AM    224 K        0xED0000    0x10000000
foo_input_std.dll    0x128000    Image    4/19/2008 10:29 AM    972 K        0x1E50000    0x10000000
foo_rgscan.dll        0x5A000        Image    4/19/2008 10:29 AM    316 K        0x1F80000    0x10000000
foo_ui_std.dll        0xD3000        Image    4/19/2008 10:29 AM    708 K        0x21B0000    0x10000000


The above poorly formatted table shows some of the DLLs that are loaded into the foobar2000.exe address space on my machine. It was obtained with Sysinternals Process Explorer. You will notice that in the image base address column, all are linked with a base address of 0x10000000, the default value. We then see that only one of the listed DLLs has an actual base address in foobar2000.exe's address space of 0x10000000, since only one of these DLLs can occupy this location in the process's address space. At load time if the image base address of a DLL is occupied already, the loader must re-base the DLL on the fly, rewriting all the jumps in the code segment to be relative to a new (empty) position in the virtual address space of the process.

You can decrease the startup time of your application by pre-rebasing the DLLs yourself following Microsoft guidelines for choosing the base address of your modules, rather than using 0x10000000 for everything. Certainly you will have no control over 3rd party plugins which are loaded in-process but perhaps you can leave 0x10000000 open for them also.

Here is an article http://msdn.microsoft.com/en-us/library/ms810432.aspx going into some more detail.

Perhaps if the next version of foobar2000 has rebased DLLs the entire world combined will save a kWh per year in energy by not doing the extra math every time foobar2000 loads! Many thanks.