Welcome to the new Woodmann RCE Messageboards Regroupment
Please be patient while the rest of the site is restored.

To all Members of the old RCE Forums:
In order to log in, it will be necessary to reset your forum login password ("I forgot my password") using the original email address you registered with. You will be sent an email with a link to reset your password for that member account.

The old vBulletin forum was converted to phpBB format, requiring the passwords to be reset. If this is a problem for some because of a forgotten email address, please feel free to re-register with a new username. We are happy to welcome old and new members back to the forums! Thanks.

All new accounts are manually activated before you can post. Any questions can be PM'ed to Kayaker.

Getting the current module name from the disassembler window?

Plugin related discussions.

For plugins, tools and tutorials see <a href="/collaborative/tools/index.php/Category:OllyDbg_Extensions">OllyStuph</a>
Locked
DeathPum

Getting the current module name from the disassembler window?

Post by DeathPum »

Hey guys, I'm creating a plugin and I wonder if there is any function/structure that returns the name of the current module which the user is working with in the disassembler window?
User avatar
Kayaker
Posts: 4169
Joined: Thu Oct 26, 2000 11:00 am

Post by Kayaker »

I would suspect t_dump->filename for the CPU window
DeathPum

Post by DeathPum »

kayaker, thank you for your answer, it helped me to look better inside t_dump.
I just made a simple function that returns not only the name, but a pointer to the module, in case someone is interested here it is:

Code: Select all

t_module* GetModuleBeingDisassembled()
{
	t_dump *pCPUDASM = (t_dump*)Plugingetvalue(VAL_CPUDASM);
	t_table *pModTable = (t_table*)Plugingetvalue(VAL_MODULES);
	t_module *pModule = 0;
	int i = 0;
	while (i < pModTable->data.n)
	{
		if(!pModule)
			pModule = (t_module*)pModTable->data.data;
		else
		{
			// if module being currently debugged is found then returns it
			if(pModule->codebase == pCPUDASM->base)
			{
				return pModule;
			}
			pModule++;
		}
		i++;
	}
	return NULL;
}
User avatar
Kayaker
Posts: 4169
Joined: Thu Oct 26, 2000 11:00 am

Post by Kayaker »

Thanks, code snippets are always welcome :)
Locked