PDA

View Full Version : Modules Functions


Deadbeef
December 30th, 2004, 07:41
Hi,

I want to save the list of the modules currently loaded by the MainFile. I have read the Plugins.hlp with the PDK and I see :
**********************************************************
Module is an executable file (ususlly EXE or DLL) loaded into memory. OllyDbg keeps list of loaded modules in a table of sorted data consisting of elements of type t_module. You can receive pointer to table of modules by calling Plugingetvalue(VAL_MODULES) and casting result to (t_table *).
**********************************************************

But where is the pointer to t_module ? I am not sure use of this two function : t_module* Findmodule(ulong addr); and Plugingetvalue(VAL_MODULES)

Especially for FindModule.

Greets

focht
December 31st, 2004, 03:53
Hi,

you should cast the table/sorted table data value.

Example after reading plugin.h (straight off my mind):


t_table* table = (t_table*) Plugingetvalue( VAL_MODULES);
if( table != 0)
{
t_sorted& sorted = table->data;
// for all valid items
for( int index=0; index<sorted.n; index++)
{
t_module* module = (t_module*)( (int)sorted.data+(index*sorted.itemsize));
// use module members whatever
strncpy( buf, module->name, SHORTLEN);
// ...
}
}


Hope you get the idea...
If not, post your questions.

Regards

PS: anyone knows how to preserve spaces and/or tabs? This minibb makes posting snippets almost unreadable...