C ++ How to manage LoadLibrary API image database

After rebooting, the main program is very high in its own database.

How can I guarantee that a loadable DLL will load in 0x400000

dllImageBase = LoadLibrary("test.dll");
printf("imagebase = 0x%x", dllImageBase);

I always get 0x460000 instead of 0x400000

I need the first dll instruction to start with 0x401000, it started from 0x600000 before rebooting

Linker command for rebase

#pragma comment( linker, "/BASE:8000000") 

So, 0x400000 is actually free right now, but it does not use it by default .. so that I can control it where it should move. Perhaps some kind of WIN32API?

+5
source share
2 answers

, DLL , . , , . /DYNAMICBASE. 0x400000 , .

+5

DLL . DLL , .

, , . GetProcAddress , DLL. , , DLL DLL.

+2

All Articles