Commit 2ed8b9f6 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Added helper to image_file_map to map also directory out of PE executables.

parent 3428b94a
......@@ -570,6 +570,9 @@ extern struct module*
DWORD64 base, DWORD64 size);
extern BOOL pe_load_debug_info(const struct process* pcs,
struct module* module);
extern const char* pe_map_directory(struct module* module, int dirno, DWORD* size);
extern void pe_unmap_directoy(struct module* module, int dirno);
/* source.c */
extern unsigned source_new(struct module* module, const char* basedir, const char* source);
extern const char* source_get(const struct module* module, unsigned idx);
......
......@@ -257,6 +257,35 @@ static void pe_unmap_file(struct image_file_map* fmap)
}
}
/******************************************************************
* pe_map_directory
*
* Maps a directory content out of a PE file
*/
const char* pe_map_directory(struct module* module, int dirno, DWORD* size)
{
IMAGE_NT_HEADERS* nth;
void* mapping;
if (module->type != DMT_PE || !module->format_info[DFI_PE]) return NULL;
if (dirno >= IMAGE_NUMBEROF_DIRECTORY_ENTRIES ||
!(mapping = pe_map_full(&module->format_info[DFI_PE]->u.pe_info->fmap, &nth)))
return NULL;
if (size) *size = nth->OptionalHeader.DataDirectory[dirno].Size;
return RtlImageRvaToVa(nth, mapping,
nth->OptionalHeader.DataDirectory[dirno].VirtualAddress, NULL);
}
/******************************************************************
* pe_unmap_directory
*
* Unmaps a directory content
*/
void pe_unmap_directory(struct image_file_map* fmap, int dirno)
{
pe_unmap_full(fmap);
}
static void pe_module_remove(struct process* pcs, struct module_format* modfmt)
{
pe_unmap_file(&modfmt->u.pe_info->fmap);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment