Commit 43598133 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Remove unneeded parameter to pe_map_file.

parent d4104e85
......@@ -197,7 +197,7 @@ BOOL image_check_alternate(struct image_file_map* fmap, const struct module* mod
struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, struct module* module) DECLSPEC_HIDDEN;
BOOL elf_map_handle(HANDLE handle, struct image_file_map* fmap) DECLSPEC_HIDDEN;
BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_type mt) DECLSPEC_HIDDEN;
BOOL pe_map_file(HANDLE file, struct image_file_map* fmap) DECLSPEC_HIDDEN;
struct image_file_map_ops
{
......
......@@ -497,7 +497,7 @@ static BOOL image_check_debug_link_crc(const WCHAR* file, struct image_file_map*
SetFilePointer(handle, 0, 0, FILE_BEGIN);
if (ReadFile(handle, &magic, sizeof(magic), &read_bytes, NULL) && magic == IMAGE_DOS_SIGNATURE)
ret = pe_map_file(handle, fmap, DMT_PE);
ret = pe_map_file(handle, fmap);
else
ret = elf_map_handle(handle, fmap);
CloseHandle(handle);
......@@ -521,7 +521,7 @@ static BOOL image_check_debug_link_gnu_id(const WCHAR* file, struct image_file_m
TRACE("Located debug information file at %s\n", debugstr_w(file));
if (ReadFile(handle, &magic, sizeof(magic), &read_bytes, NULL) && magic == IMAGE_DOS_SIGNATURE)
ret = pe_map_file(handle, fmap, DMT_PE);
ret = pe_map_file(handle, fmap);
else
ret = elf_map_handle(handle, fmap);
CloseHandle(handle);
......
......@@ -243,11 +243,14 @@ static BOOL pe_is_valid_pointer_table(const IMAGE_NT_HEADERS* nthdr, const void*
*
* Maps an PE file into memory (and checks it's a real PE file)
*/
BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_type mt)
BOOL pe_map_file(HANDLE file, struct image_file_map* fmap)
{
void* mapping;
IMAGE_NT_HEADERS* nthdr;
IMAGE_SECTION_HEADER* section;
unsigned i;
fmap->modtype = mt;
fmap->modtype = DMT_PE;
fmap->ops = &pe_file_map_ops;
fmap->alternate = NULL;
fmap->u.pe.hMap = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
......@@ -256,14 +259,6 @@ BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_type mt)
fmap->u.pe.full_map = NULL;
if (!(mapping = pe_map_full(fmap, NULL))) goto error;
switch (mt)
{
case DMT_PE:
{
IMAGE_NT_HEADERS* nthdr;
IMAGE_SECTION_HEADER* section;
unsigned i;
if (!(nthdr = RtlImageNtHeader(mapping))) goto error;
memcpy(&fmap->u.pe.file_header, &nthdr->FileHeader, sizeof(fmap->u.pe.file_header));
switch (nthdr->OptionalHeader.Magic)
......@@ -318,10 +313,7 @@ BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_type mt)
}
}
else fmap->u.pe.strtable = NULL;
}
break;
default: assert(0); goto error;
}
pe_unmap_full(fmap);
return TRUE;
......@@ -757,7 +749,7 @@ static BOOL search_builtin_pe(void *param, HANDLE handle, const WCHAR *path)
{
struct builtin_search *search = param;
if (!pe_map_file(handle, &search->fmap, DMT_PE)) return FALSE;
if (!pe_map_file(handle, &search->fmap)) return FALSE;
search->path = wcsdup(path);
return TRUE;
......@@ -815,7 +807,7 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name,
if ((modfmt = HeapAlloc(GetProcessHeap(), 0, sizeof(struct module_format) + sizeof(struct pe_module_info))))
{
modfmt->u.pe_info = (struct pe_module_info*)(modfmt + 1);
if (pe_map_file(hFile, &modfmt->u.pe_info->fmap, DMT_PE))
if (pe_map_file(hFile, &modfmt->u.pe_info->fmap))
{
struct builtin_search builtin = { NULL };
if (opened && modfmt->u.pe_info->fmap.u.pe.builtin &&
......
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