Base Address einer DLL
-
Weiß jemand wie man die Base Address einer DLL unter windows herausbekommt? Muss keine fertige Lösung sein, ein Denkanstoss würde mir bereits helfen^^
-
Ist nur eine Vermutung, aber ist nicht das HMODULE, dass du von LoadLibrary bekommst die Base-Address, denn bei DllMain steht dazu:
Handle to the DLL module. The value is the base address of the DLL. The HINSTANCE of a DLL is the same as the HMODULE of the DLL, so hinstDLL can be used in calls to functions that require a module handle.
Oder willst du direkt (ohne die DLL zu laden) die Base-Address auslesen?
-
Mein Problem ist das ich die Base Address einer DLL brauche die von einem anderen Programm geladen wurde.
Aber ich gehe deinen Vorschlag mal nach ^^
-
Dann solltest (musst?) du das direkt im Ziel-Prozess in Erfahrung bringen, denn die in der DLL angegebene Base-Address wird ja nicht unbedingt vom Loader so übernommen:
The base address of a DLL is the location in virtual memory where the loader attempts to place the DLL. It is generally specified at link time. If a DLL cannot load at its base address because the memory is already occupied, the loader places the DLL elsewhere in virtual memory, then updates all calls into the DLL to reflect the new base address.
-
Diese Antwort hilft dir zwar nicht, aber das Programm "Process Explorer" kann das.

-
Ein kleines VB Programm das ich habe kann das auch, nur ist es halt immer umständlich zuerst das VB Programm auszuführen und anschließend die Base Address ins eigene Programm einzugeben
-
Mit CreateToolhelp32Snapshot/Module32First/Module32Next bzw. EnumProcessModules die ganzen Modules durchgehen und vergleichen - was besseres fällt mir nicht ein.
Wie du generell vorzugehen hast, kannst du dir an diesen Beispiel anschauen - musst du natürlich noch abspecken
