ReactOS  0.4.14-dev-608-gd495a4f
pe_module.c
Go to the documentation of this file.
1 /*
2  * File pe_module.c - handle PE module information
3  *
4  * Copyright (C) 1996, Eric Youngdale.
5  * Copyright (C) 1999-2000, Ulrich Weigand.
6  * Copyright (C) 2004-2007, Eric Pouech.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  *
22  */
23 
24 #include "config.h"
25 #include "wine/port.h"
26 
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <string.h>
30 #include <assert.h>
31 
32 #include "dbghelp_private.h"
33 #include "image_private.h"
34 #ifndef DBGHELP_STATIC_LIB
35 #include "winternl.h"
36 #include "wine/debug.h"
37 #endif
38 
40 
42 {
44 };
45 
46 static void* pe_map_full(struct image_file_map* fmap, IMAGE_NT_HEADERS** nth)
47 {
48  if (!fmap->u.pe.full_map)
49  {
50  fmap->u.pe.full_map = MapViewOfFile(fmap->u.pe.hMap, FILE_MAP_READ, 0, 0, 0);
51  }
52  if (fmap->u.pe.full_map)
53  {
54  if (nth) *nth = RtlImageNtHeader(fmap->u.pe.full_map);
55  fmap->u.pe.full_count++;
56  return fmap->u.pe.full_map;
57  }
58  return IMAGE_NO_MAP;
59 }
60 
61 static void pe_unmap_full(struct image_file_map* fmap)
62 {
63  if (fmap->u.pe.full_count && !--fmap->u.pe.full_count)
64  {
65  UnmapViewOfFile(fmap->u.pe.full_map);
66  fmap->u.pe.full_map = NULL;
67  }
68 }
69 
70 /******************************************************************
71  * pe_map_section
72  *
73  * Maps a single section into memory from an PE file
74  */
75 const char* pe_map_section(struct image_section_map* ism)
76 {
77  void* mapping;
78  struct pe_file_map* fmap = &ism->fmap->u.pe;
79 
80  if (ism->sidx >= 0 && ism->sidx < fmap->ntheader.FileHeader.NumberOfSections &&
81  fmap->sect[ism->sidx].mapped == IMAGE_NO_MAP)
82  {
83  IMAGE_NT_HEADERS* nth;
84 
85  if (fmap->sect[ism->sidx].shdr.Misc.VirtualSize > fmap->sect[ism->sidx].shdr.SizeOfRawData)
86  {
87  FIXME("Section %ld: virtual (0x%x) > raw (0x%x) size - not supported\n",
88  ism->sidx, fmap->sect[ism->sidx].shdr.Misc.VirtualSize,
89  fmap->sect[ism->sidx].shdr.SizeOfRawData);
90  return IMAGE_NO_MAP;
91  }
92  /* FIXME: that's rather drastic, but that will do for now
93  * that's ok if the full file map exists, but we could be less aggressive otherwise and
94  * only map the relevant section
95  */
96  if ((mapping = pe_map_full(ism->fmap, &nth)))
97  {
98  fmap->sect[ism->sidx].mapped = RtlImageRvaToVa(nth, mapping,
99  fmap->sect[ism->sidx].shdr.VirtualAddress,
100  NULL);
101  return fmap->sect[ism->sidx].mapped;
102  }
103  }
104  return IMAGE_NO_MAP;
105 }
106 
107 /******************************************************************
108  * pe_find_section
109  *
110  * Finds a section by name (and type) into memory from an PE file
111  * or its alternate if any
112  */
113 BOOL pe_find_section(struct image_file_map* fmap, const char* name,
114  struct image_section_map* ism)
115 {
116  const char* sectname;
117  unsigned i;
118  char tmp[IMAGE_SIZEOF_SHORT_NAME + 1];
119 
120  for (i = 0; i < fmap->u.pe.ntheader.FileHeader.NumberOfSections; i++)
121  {
122  sectname = (const char*)fmap->u.pe.sect[i].shdr.Name;
123  /* long section names start with a '/' (at least on MinGW32) */
124  if (sectname[0] == '/' && fmap->u.pe.strtable)
125  sectname = fmap->u.pe.strtable + atoi(sectname + 1);
126  else
127  {
128  /* the section name may not be null terminated */
129  sectname = memcpy(tmp, sectname, IMAGE_SIZEOF_SHORT_NAME);
130  tmp[IMAGE_SIZEOF_SHORT_NAME] = '\0';
131  }
132  if (!strcasecmp(sectname, name))
133  {
134  ism->fmap = fmap;
135  ism->sidx = i;
136  return TRUE;
137  }
138  }
139  ism->fmap = NULL;
140  ism->sidx = -1;
141 
142  return FALSE;
143 }
144 
145 /******************************************************************
146  * pe_unmap_section
147  *
148  * Unmaps a single section from memory
149  */
151 {
152  if (ism->sidx >= 0 && ism->sidx < ism->fmap->u.pe.ntheader.FileHeader.NumberOfSections &&
153  ism->fmap->u.pe.sect[ism->sidx].mapped != IMAGE_NO_MAP)
154  {
155  pe_unmap_full(ism->fmap);
156  ism->fmap->u.pe.sect[ism->sidx].mapped = IMAGE_NO_MAP;
157  }
158 }
159 
160 /******************************************************************
161  * pe_get_map_rva
162  *
163  * Get the RVA of an PE section
164  */
166 {
167  if (ism->sidx < 0 || ism->sidx >= ism->fmap->u.pe.ntheader.FileHeader.NumberOfSections)
168  return 0;
169  return ism->fmap->u.pe.sect[ism->sidx].shdr.VirtualAddress;
170 }
171 
172 /******************************************************************
173  * pe_get_map_size
174  *
175  * Get the size of a PE section
176  */
177 unsigned pe_get_map_size(const struct image_section_map* ism)
178 {
179  if (ism->sidx < 0 || ism->sidx >= ism->fmap->u.pe.ntheader.FileHeader.NumberOfSections)
180  return 0;
181  return ism->fmap->u.pe.sect[ism->sidx].shdr.Misc.VirtualSize;
182 }
183 
184 /******************************************************************
185  * pe_is_valid_pointer_table
186  *
187  * Checks whether the PointerToSymbolTable and NumberOfSymbols in file_header contain
188  * valid information.
189  */
190 static BOOL pe_is_valid_pointer_table(const IMAGE_NT_HEADERS* nthdr, const void* mapping, DWORD64 sz)
191 {
192  DWORD64 offset;
193 
194  /* is the iSym table inside file size ? (including first DWORD of string table, which is its size) */
197  if (offset + sizeof(DWORD) > sz) return FALSE;
198  /* is string table (following iSym table) inside file size ? */
199  offset += *(DWORD*)((const char*)mapping + offset);
200  return offset <= sz;
201 }
202 
203 /******************************************************************
204  * pe_map_file
205  *
206  * Maps an PE file into memory (and checks it's a real PE file)
207  */
208 static BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_type mt)
209 {
210  void* mapping;
211 
212  fmap->modtype = mt;
213  fmap->u.pe.hMap = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
214  if (fmap->u.pe.hMap == 0) return FALSE;
215  fmap->u.pe.full_count = 0;
216  fmap->u.pe.full_map = NULL;
217  if (!(mapping = pe_map_full(fmap, NULL))) goto error;
218 
219  switch (mt)
220  {
221  case DMT_PE:
222  {
223  IMAGE_NT_HEADERS* nthdr;
225  unsigned i;
226 
227  if (!(nthdr = RtlImageNtHeader(mapping))) goto error;
228  memcpy(&fmap->u.pe.ntheader, nthdr, sizeof(fmap->u.pe.ntheader));
229  switch (nthdr->OptionalHeader.Magic)
230  {
231  case 0x10b: fmap->addr_size = 32; break;
232  case 0x20b: fmap->addr_size = 64; break;
233  default: return FALSE;
234  }
236  ((char*)&nthdr->OptionalHeader + nthdr->FileHeader.SizeOfOptionalHeader);
237  fmap->u.pe.sect = HeapAlloc(GetProcessHeap(), 0,
238  nthdr->FileHeader.NumberOfSections * sizeof(fmap->u.pe.sect[0]));
239  if (!fmap->u.pe.sect) goto error;
240  for (i = 0; i < nthdr->FileHeader.NumberOfSections; i++)
241  {
242  memcpy(&fmap->u.pe.sect[i].shdr, section + i, sizeof(IMAGE_SECTION_HEADER));
243  fmap->u.pe.sect[i].mapped = IMAGE_NO_MAP;
244  }
246  {
247  LARGE_INTEGER li;
248 
250  {
251  /* FIXME ugly: should rather map the relevant content instead of copying it */
252  const char* src = (const char*)mapping +
254  nthdr->FileHeader.NumberOfSymbols * sizeof(IMAGE_SYMBOL);
255  char* dst;
256  DWORD sz = *(DWORD*)src;
257 
258  if ((dst = HeapAlloc(GetProcessHeap(), 0, sz)))
259  memcpy(dst, src, sz);
260  fmap->u.pe.strtable = dst;
261  }
262  else
263  {
264  WARN("Bad coff table... wipping out\n");
265  /* we have bad information here, wipe it out */
266  fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable = 0;
267  fmap->u.pe.ntheader.FileHeader.NumberOfSymbols = 0;
268  fmap->u.pe.strtable = NULL;
269  }
270  }
271  else fmap->u.pe.strtable = NULL;
272  }
273  break;
274  default: assert(0); goto error;
275  }
276  pe_unmap_full(fmap);
277 
278  return TRUE;
279 error:
280  pe_unmap_full(fmap);
281  CloseHandle(fmap->u.pe.hMap);
282  return FALSE;
283 }
284 
285 /******************************************************************
286  * pe_unmap_file
287  *
288  * Unmaps an PE file from memory (previously mapped with pe_map_file)
289  */
290 static void pe_unmap_file(struct image_file_map* fmap)
291 {
292  if (fmap->u.pe.hMap != 0)
293  {
294  struct image_section_map ism;
295  ism.fmap = fmap;
296  for (ism.sidx = 0; ism.sidx < fmap->u.pe.ntheader.FileHeader.NumberOfSections; ism.sidx++)
297  {
298  pe_unmap_section(&ism);
299  }
300  while (fmap->u.pe.full_count) pe_unmap_full(fmap);
301  HeapFree(GetProcessHeap(), 0, fmap->u.pe.sect);
302  HeapFree(GetProcessHeap(), 0, (void*)fmap->u.pe.strtable); /* FIXME ugly (see pe_map_file) */
303  CloseHandle(fmap->u.pe.hMap);
304  fmap->u.pe.hMap = NULL;
305  }
306 }
307 
308 /******************************************************************
309  * pe_map_directory
310  *
311  * Maps a directory content out of a PE file
312  */
313 const char* pe_map_directory(struct module* module, int dirno, DWORD* size)
314 {
315  IMAGE_NT_HEADERS* nth;
316  void* mapping;
317 
318  if (module->type != DMT_PE || !module->format_info[DFI_PE]) return NULL;
319  if (dirno >= IMAGE_NUMBEROF_DIRECTORY_ENTRIES ||
320  !(mapping = pe_map_full(&module->format_info[DFI_PE]->u.pe_info->fmap, &nth)))
321  return NULL;
322  if (size) *size = nth->OptionalHeader.DataDirectory[dirno].Size;
323  return RtlImageRvaToVa(nth, mapping,
325 }
326 
327 static void pe_module_remove(struct process* pcs, struct module_format* modfmt)
328 {
329  pe_unmap_file(&modfmt->u.pe_info->fmap);
330  HeapFree(GetProcessHeap(), 0, modfmt);
331 }
332 
333 /******************************************************************
334  * pe_locate_with_coff_symbol_table
335  *
336  * Use the COFF symbol table (if any) from the IMAGE_FILE_HEADER to set the absolute address
337  * of global symbols.
338  * Mingw32 requires this for stabs debug information as address for global variables isn't filled in
339  * (this is similar to what is done in elf_module.c when using the .symtab ELF section)
340  */
342 {
343  struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
344  const IMAGE_SYMBOL* isym;
345  int i, numsym, naux;
346  char tmp[9];
347  const char* name;
348  struct hash_table_iter hti;
349  void* ptr;
350  struct symt_data* sym;
351  const char* mapping;
352 
353  numsym = fmap->u.pe.ntheader.FileHeader.NumberOfSymbols;
354  if (!fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable || !numsym)
355  return TRUE;
356  if (!(mapping = pe_map_full(fmap, NULL))) return FALSE;
357  isym = (const IMAGE_SYMBOL*)(mapping + fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable);
358 
359  for (i = 0; i < numsym; i+= naux, isym += naux)
360  {
361  if (isym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL &&
362  isym->SectionNumber > 0 && isym->SectionNumber <= fmap->u.pe.ntheader.FileHeader.NumberOfSections)
363  {
364  if (isym->N.Name.Short)
365  {
366  name = memcpy(tmp, isym->N.ShortName, 8);
367  tmp[8] = '\0';
368  }
369  else name = fmap->u.pe.strtable + isym->N.Name.Long;
370  if (name[0] == '_') name++;
372  while ((ptr = hash_table_iter_up(&hti)))
373  {
374  sym = CONTAINING_RECORD(ptr, struct symt_data, hash_elt);
375  if (sym->symt.tag == SymTagData &&
376  (sym->kind == DataIsGlobal || sym->kind == DataIsFileStatic) &&
377  sym->u.var.kind == loc_absolute &&
378  !strcmp(sym->hash_elt.name, name))
379  {
380  TRACE("Changing absolute address for %d.%s: %lx -> %s\n",
381  isym->SectionNumber, name, sym->u.var.offset,
383  fmap->u.pe.sect[isym->SectionNumber - 1].shdr.VirtualAddress +
384  isym->Value));
385  sym->u.var.offset = module->module.BaseOfImage +
386  fmap->u.pe.sect[isym->SectionNumber - 1].shdr.VirtualAddress + isym->Value;
387  break;
388  }
389  }
390  }
391  naux = isym->NumberOfAuxSymbols + 1;
392  }
393  pe_unmap_full(fmap);
394  return TRUE;
395 }
396 
397 /******************************************************************
398  * pe_load_coff_symbol_table
399  *
400  * Load public symbols out of the COFF symbol table (if any).
401  */
403 {
404  struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
405  const IMAGE_SYMBOL* isym;
406  int i, numsym, naux;
407  const char* strtable;
408  char tmp[9];
409  const char* name;
410  const char* lastfilename = NULL;
411  struct symt_compiland* compiland = NULL;
412  const IMAGE_SECTION_HEADER* sect;
413  const char* mapping;
414 
415  numsym = fmap->u.pe.ntheader.FileHeader.NumberOfSymbols;
416  if (!fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable || !numsym)
417  return TRUE;
418  if (!(mapping = pe_map_full(fmap, NULL))) return FALSE;
419  isym = (const IMAGE_SYMBOL*)((const char*)mapping + fmap->u.pe.ntheader.FileHeader.PointerToSymbolTable);
420  /* FIXME: no way to get strtable size */
421  strtable = (const char*)&isym[numsym];
423 
424  for (i = 0; i < numsym; i+= naux, isym += naux)
425  {
426  if (isym->StorageClass == IMAGE_SYM_CLASS_FILE)
427  {
428  lastfilename = (const char*)(isym + 1);
429  compiland = NULL;
430  }
431  if (isym->StorageClass == IMAGE_SYM_CLASS_EXTERNAL &&
432  isym->SectionNumber > 0 && isym->SectionNumber <= fmap->u.pe.ntheader.FileHeader.NumberOfSections)
433  {
434  if (isym->N.Name.Short)
435  {
436  name = memcpy(tmp, isym->N.ShortName, 8);
437  tmp[8] = '\0';
438  }
439  else name = strtable + isym->N.Name.Long;
440  if (name[0] == '_') name++;
441 
442  if (!compiland && lastfilename)
443  compiland = symt_new_compiland(module, 0,
444  source_new(module, NULL, lastfilename));
445 
447  symt_new_public(module, compiland, name, FALSE,
448  module->module.BaseOfImage + sect[isym->SectionNumber - 1].VirtualAddress +
449  isym->Value,
450  1);
451  }
452  naux = isym->NumberOfAuxSymbols + 1;
453  }
460  pe_unmap_full(fmap);
461 
462  return TRUE;
463 }
464 
465 /******************************************************************
466  * pe_load_stabs
467  *
468  * look for stabs information in PE header (it's how the mingw compiler provides
469  * its debugging information)
470  */
471 static BOOL pe_load_stabs(const struct process* pcs, struct module* module)
472 {
473  struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
474  struct image_section_map sect_stabs, sect_stabstr;
475  BOOL ret = FALSE;
476 
477  if (pe_find_section(fmap, ".stab", &sect_stabs) && pe_find_section(fmap, ".stabstr", &sect_stabstr))
478  {
479  const char* stab;
480  const char* stabstr;
481 
482  stab = image_map_section(&sect_stabs);
483  stabstr = image_map_section(&sect_stabstr);
484  if (stab != IMAGE_NO_MAP && stabstr != IMAGE_NO_MAP)
485  {
487  module->module.BaseOfImage - fmap->u.pe.ntheader.OptionalHeader.ImageBase,
488  stab, image_get_map_size(&sect_stabs),
489  stabstr, image_get_map_size(&sect_stabstr),
490  NULL, NULL);
491  }
492  image_unmap_section(&sect_stabs);
493  image_unmap_section(&sect_stabstr);
495  }
496  TRACE("%s the STABS debug info\n", ret ? "successfully loaded" : "failed to load");
497 
498  return ret;
499 }
500 
501 /******************************************************************
502  * pe_load_dwarf
503  *
504  * look for dwarf information in PE header (it's also a way for the mingw compiler
505  * to provide its debugging information)
506  */
508 {
509  struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
510  BOOL ret;
511 
513  module->module.BaseOfImage - fmap->u.pe.ntheader.OptionalHeader.ImageBase,
514  NULL, /* FIXME: some thunks to deal with ? */
515  fmap);
516  TRACE("%s the DWARF debug info\n", ret ? "successfully loaded" : "failed to load");
517 
518  return ret;
519 }
520 
521 #ifndef DBGHELP_STATIC_LIB
522 /******************************************************************
523  * pe_load_rsym
524  *
525  * look for ReactOS's own rsym format
526  */
528 {
529  struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
530  struct image_section_map sect_rsym;
531  BOOL ret = FALSE;
532 
533  if (pe_find_section(fmap, ".rossym", &sect_rsym))
534  {
535  const char* rsym = image_map_section(&sect_rsym);
536  if (rsym != IMAGE_NO_MAP)
537  {
539  rsym, image_get_map_size(&sect_rsym));
540  }
541  image_unmap_section(&sect_rsym);
542  }
543  TRACE("%s the RSYM debug info\n", ret ? "successfully loaded" : "failed to load");
544 
545  return ret;
546 }
547 
548 /******************************************************************
549  * pe_load_dbg_file
550  *
551  * loads a .dbg file
552  */
553 static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
554  const char* dbg_name, DWORD timestamp)
555 {
556  char tmp[MAX_PATH];
557  HANDLE hFile = INVALID_HANDLE_VALUE, hMap = 0;
558  const BYTE* dbg_mapping = NULL;
559  BOOL ret = FALSE;
560 
561  TRACE("Processing DBG file %s\n", debugstr_a(dbg_name));
562 
563  if (path_find_symbol_file(pcs, module, dbg_name, NULL, timestamp, 0, tmp, &module->module.DbgUnmatched) &&
566  ((hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != 0) &&
567  ((dbg_mapping = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL))
568  {
570  const IMAGE_SECTION_HEADER* sectp;
571  const IMAGE_DEBUG_DIRECTORY* dbg;
572 
573  hdr = (const IMAGE_SEPARATE_DEBUG_HEADER*)dbg_mapping;
574  /* section headers come immediately after debug header */
575  sectp = (const IMAGE_SECTION_HEADER*)(hdr + 1);
576  /* and after that and the exported names comes the debug directory */
577  dbg = (const IMAGE_DEBUG_DIRECTORY*)
578  (dbg_mapping + sizeof(*hdr) +
579  hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) +
580  hdr->ExportedNamesSize);
581 
582  ret = pe_load_debug_directory(pcs, module, dbg_mapping, sectp,
583  hdr->NumberOfSections, dbg,
584  hdr->DebugDirectorySize / sizeof(*dbg));
585  }
586  else
587  ERR("Couldn't find .DBG file %s (%s)\n", debugstr_a(dbg_name), debugstr_a(tmp));
588 
589  if (dbg_mapping) UnmapViewOfFile(dbg_mapping);
590  if (hMap) CloseHandle(hMap);
592  return ret;
593 }
594 
595 /******************************************************************
596  * pe_load_msc_debug_info
597  *
598  * Process MSC debug information in PE file.
599  */
600 static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* module)
601 {
602  struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
603  BOOL ret = FALSE;
604  const IMAGE_DATA_DIRECTORY* dir;
605  const IMAGE_DEBUG_DIRECTORY*dbg = NULL;
606  int nDbg;
607  void* mapping;
608  IMAGE_NT_HEADERS* nth;
609 
610  if (!(mapping = pe_map_full(fmap, &nth))) return FALSE;
611  /* Read in debug directory */
613  nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY);
614  if (!nDbg) goto done;
615 
616  dbg = RtlImageRvaToVa(nth, mapping, dir->VirtualAddress, NULL);
617 
618 #ifdef __REACTOS__
619  if (!dbg)
620  {
621  ERR("Debug directory not found in module %s\n",
623  goto done;
624  }
625 #endif
626 
627  /* Parse debug directory */
629  {
630  /* Debug info is stripped to .DBG file */
631  const IMAGE_DEBUG_MISC* misc = (const IMAGE_DEBUG_MISC*)
632  ((const char*)mapping + dbg->PointerToRawData);
633 
634  if (nDbg != 1 || dbg->Type != IMAGE_DEBUG_TYPE_MISC ||
636  {
637  ERR("-Debug info stripped, but no .DBG file in module %s\n",
639  }
640  else
641  {
642  ret = pe_load_dbg_file(pcs, module, (const char*)misc->Data, nth->FileHeader.TimeDateStamp);
643  }
644  }
645  else
646  {
647  const IMAGE_SECTION_HEADER *sectp = (const IMAGE_SECTION_HEADER*)((const char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
648  /* Debug info is embedded into PE module */
649  ret = pe_load_debug_directory(pcs, module, mapping, sectp,
650  nth->FileHeader.NumberOfSections, dbg, nDbg);
651  }
652 done:
653  pe_unmap_full(fmap);
654  return ret;
655 }
656 #endif /* DBGHELP_STATIC_LIB */
657 
658 /***********************************************************************
659  * pe_load_export_debug_info
660  */
661 static BOOL pe_load_export_debug_info(const struct process* pcs, struct module* module)
662 {
663  struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
664  unsigned int i;
665  const IMAGE_EXPORT_DIRECTORY* exports;
667  DWORD size;
668  IMAGE_NT_HEADERS* nth;
669  void* mapping;
670 
671  if (dbghelp_options & SYMOPT_NO_PUBLICS) return TRUE;
672 
673  if (!(mapping = pe_map_full(fmap, &nth))) return FALSE;
674 #if 0
675  /* Add start of DLL (better use the (yet unimplemented) Exe SymTag for this) */
676  /* FIXME: module.ModuleName isn't correctly set yet if it's passed in SymLoadModule */
678 #endif
679 
680  /* Add entry point */
681  symt_new_public(module, NULL, "EntryPoint", FALSE,
683 #if 0
684  /* FIXME: we'd better store addresses linked to sections rather than
685  absolute values */
687  /* Add start of sections */
689  ((char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
690  for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++)
691  {
693  RtlImageRvaToVa(nth, mapping, section->VirtualAddress, NULL), 1);
694  }
695 #endif
696 
697  /* Add exported functions */
700  {
701  const WORD* ordinals = NULL;
702  const DWORD_PTR* functions = NULL;
703  const DWORD* names = NULL;
704  unsigned int j;
705  char buffer[16];
706 
707  functions = RtlImageRvaToVa(nth, mapping, exports->AddressOfFunctions, NULL);
708  ordinals = RtlImageRvaToVa(nth, mapping, exports->AddressOfNameOrdinals, NULL);
709  names = RtlImageRvaToVa(nth, mapping, exports->AddressOfNames, NULL);
710 
711  if (functions && ordinals && names)
712  {
713  for (i = 0; i < exports->NumberOfNames; i++)
714  {
715  if (!names[i]) continue;
718  FALSE,
719  base + functions[ordinals[i]], 1);
720  }
721 
722  for (i = 0; i < exports->NumberOfFunctions; i++)
723  {
724  if (!functions[i]) continue;
725  /* Check if we already added it with a name */
726  for (j = 0; j < exports->NumberOfNames; j++)
727  if ((ordinals[j] == i) && names[j]) break;
728  if (j < exports->NumberOfNames) continue;
729  snprintf(buffer, sizeof(buffer), "%d", i + exports->Base);
730  symt_new_public(module, NULL, buffer, FALSE, base + (DWORD)functions[i], 1);
731  }
732  }
733  }
734  /* no real debug info, only entry points */
737  pe_unmap_full(fmap);
738 
739  return TRUE;
740 }
741 
742 /******************************************************************
743  * pe_load_debug_info
744  *
745  */
746 BOOL pe_load_debug_info(const struct process* pcs, struct module* module)
747 {
748  BOOL ret = FALSE;
749 
751  {
752  ret = pe_load_stabs(pcs, module);
753  ret = pe_load_dwarf(module) || ret;
754  #ifndef DBGHELP_STATIC_LIB
756  ret = pe_load_rsym(module) || ret;
757  #endif
758 
759  ret = ret || pe_load_coff_symbol_table(module); /* FIXME */
760  /* if we still have no debug info (we could only get SymExport at this
761  * point), then do the SymExport except if we have an ELF container,
762  * in which case we'll rely on the export's on the ELF side
763  */
764  }
765  /* FIXME shouldn't we check that? if (!module_get_debug(pcs, module)) */
766  if (pe_load_export_debug_info(pcs, module) && !ret)
767  ret = TRUE;
768 
769  return ret;
770 }
771 
772 /******************************************************************
773  * pe_load_native_module
774  *
775  */
776 struct module* pe_load_native_module(struct process* pcs, const WCHAR* name,
778 {
779  struct module* module = NULL;
780  BOOL opened = FALSE;
781  struct module_format* modfmt;
782  WCHAR loaded_name[MAX_PATH];
783 
784  loaded_name[0] = '\0';
785  if (!hFile)
786  {
787  assert(name);
788 
789  if ((hFile = FindExecutableImageExW(name, pcs->search_path, loaded_name, NULL, NULL)) == NULL)
790  return NULL;
791  opened = TRUE;
792  }
793  else if (name) strcpyW(loaded_name, name);
795  FIXME("Trouble ahead (no module name passed in deferred mode)\n");
796  if (!(modfmt = HeapAlloc(GetProcessHeap(), 0, sizeof(struct module_format) + sizeof(struct pe_module_info))))
797  return NULL;
798  modfmt->u.pe_info = (struct pe_module_info*)(modfmt + 1);
799  if (pe_map_file(hFile, &modfmt->u.pe_info->fmap, DMT_PE))
800  {
801  if (!base) base = modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.ImageBase;
802  if (!size) size = modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.SizeOfImage;
803 
804  module = module_new(pcs, loaded_name, DMT_PE, FALSE, base, size,
805  modfmt->u.pe_info->fmap.u.pe.ntheader.FileHeader.TimeDateStamp,
806  modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.CheckSum);
807  if (module)
808  {
809  modfmt->module = module;
810  modfmt->remove = pe_module_remove;
811  modfmt->loc_compute = NULL;
812 
813  module->format_info[DFI_PE] = modfmt;
816  else
818  module->reloc_delta = base - modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.ImageBase;
819  }
820  else
821  {
822  ERR("could not load the module '%s'\n", debugstr_w(loaded_name));
823  pe_unmap_file(&modfmt->u.pe_info->fmap);
824  }
825  }
826  if (!module) HeapFree(GetProcessHeap(), 0, modfmt);
827 
828  if (opened) CloseHandle(hFile);
829 
830  return module;
831 }
832 
833 /******************************************************************
834  * pe_load_nt_header
835  *
836  */
838 {
840 
841  return ReadProcessMemory(hProc, (char*)(DWORD_PTR)base, &dos, sizeof(dos), NULL) &&
843  ReadProcessMemory(hProc, (char*)(DWORD_PTR)(base + dos.e_lfanew),
844  nth, sizeof(*nth), NULL) &&
846 }
847 
848 /******************************************************************
849  * pe_load_builtin_module
850  *
851  */
852 struct module* pe_load_builtin_module(struct process* pcs, const WCHAR* name,
854 {
855  struct module* module = NULL;
856 
857  if (base && pcs->dbg_hdr_addr)
858  {
859  IMAGE_NT_HEADERS nth;
860 
861  if (pe_load_nt_header(pcs->handle, base, &nth))
862  {
863  if (!size) size = nth.OptionalHeader.SizeOfImage;
867  }
868  }
869  return module;
870 }
871 
872 /***********************************************************************
873  * ImageDirectoryEntryToDataEx (DBGHELP.@)
874  *
875  * Search for specified directory in PE image
876  *
877  * PARAMS
878  *
879  * base [in] Image base address
880  * image [in] TRUE - image has been loaded by loader, FALSE - raw file image
881  * dir [in] Target directory index
882  * size [out] Receives directory size
883  * section [out] Receives pointer to section header of section containing directory data
884  *
885  * RETURNS
886  * Success: pointer to directory data
887  * Failure: NULL
888  *
889  */
891 {
892  const IMAGE_NT_HEADERS *nt;
893  DWORD addr;
894 
895  *size = 0;
896  if (section) *section = NULL;
897 
898  if (!(nt = RtlImageNtHeader( base ))) return NULL;
899  if (dir >= nt->OptionalHeader.NumberOfRvaAndSizes) return NULL;
901 
903  if (image || addr < nt->OptionalHeader.SizeOfHeaders) return (char *)base + addr;
904 
905  return RtlImageRvaToVa( nt, base, addr, section );
906 }
907 
908 /***********************************************************************
909  * ImageDirectoryEntryToData (DBGHELP.@)
910  *
911  * NOTES
912  * See ImageDirectoryEntryToDataEx
913  */
915 {
917 }
void(* remove)(struct process *pcs, struct module_format *modfmt)
unsigned addr_size
Definition: image_private.h:90
static BOOL pe_is_valid_pointer_table(const IMAGE_NT_HEADERS *nthdr, const void *mapping, DWORD64 sz)
Definition: pe_module.c:190
PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID base, BOOLEAN image, USHORT dir, PULONG size, PIMAGE_SECTION_HEADER *section)
Definition: pe_module.c:890
enum module_type modtype
Definition: image_private.h:89
struct module * module_new(struct process *pcs, const WCHAR *name, enum module_type type, BOOL virtual, DWORD64 addr, DWORD64 size, unsigned long stamp, unsigned long checksum) DECLSPEC_HIDDEN
Definition: module.c:163
WCHAR * search_path
BOOL pe_load_debug_directory(const struct process *pcs, struct module *module, const BYTE *mapping, const IMAGE_SECTION_HEADER *sectp, DWORD nsect, const IMAGE_DEBUG_DIRECTORY *dbg, int nDbg) DECLSPEC_HIDDEN
Definition: msc.c:3393
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
HMODULE module
Definition: main.cpp:47
char hdr[14]
Definition: iptest.cpp:33
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178
#define MapViewOfFile
Definition: compat.h:410
#define error(str)
Definition: mkdosfs.c:1605
WCHAR ModuleName[32]
Definition: compat.h:733
#define strcasecmp
Definition: fake.h:9
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES
Definition: ntddk_ex.h:135
const char * pe_map_section(struct image_section_map *ism)
Definition: pe_module.c:75
DWORD64 BaseOfImage
Definition: compat.h:727
struct _IMAGE_DEBUG_DIRECTORY IMAGE_DEBUG_DIRECTORY
union module_format::@363 u
struct _IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER
struct hash_table ht_symbols
#define WARN(fmt,...)
Definition: debug.h:111
#define RtlImageRvaToVa
Definition: compat.h:466
GLintptr offset
Definition: glext.h:5920
struct image_file_map * fmap
#define snprintf
Definition: wintirpc.h:48
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define assert(x)
Definition: debug.h:53
GLuint buffer
Definition: glext.h:5915
static void * pe_map_full(struct image_file_map *fmap, IMAGE_NT_HEADERS **nth)
Definition: pe_module.c:46
enum DataKind kind
#define ReadProcessMemory(a, b, c, d, e)
Definition: compat.h:423
Definition: parser.c:55
struct symt_compiland * symt_new_compiland(struct module *module, unsigned long address, unsigned src_idx) DECLSPEC_HIDDEN
Definition: symbol.c:209
static void pe_unmap_file(struct image_file_map *fmap)
Definition: pe_module.c:290
void pe_unmap_section(struct image_section_map *ism)
Definition: pe_module.c:150
IMAGE_NT_HEADERS nt
Definition: module.c:50
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
#define FILE_SHARE_READ
Definition: compat.h:125
static IMAGE_SECTION_HEADER section
Definition: loader.c:152
DWORD AddressOfNameOrdinals
Definition: compat.h:155
#define SYMOPT_DEFERRED_LOADS
Definition: compat.h:646
enum module_type type
#define IMAGE_NO_MAP
Definition: image_private.h:59
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
GLuint GLuint * names
Definition: glext.h:11545
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct module * pe_load_builtin_module(struct process *pcs, const WCHAR *name, DWORD64 base, DWORD64 size)
Definition: pe_module.c:852
static BOOL pe_load_dwarf(struct module *module)
Definition: pe_module.c:507
DWORD DataType
Definition: compat.h:158
#define IMAGE_FIRST_SECTION(NtHeader)
Definition: ntimage.h:427
union image_file_map::@370 u
unsigned int BOOL
Definition: ntddk_ex.h:94
union symt_data::@361 u
#define debugstr_w
Definition: kernel32.h:32
struct symt_public * symt_new_public(struct module *module, struct symt_compiland *parent, const char *typename, BOOL is_function, unsigned long address, unsigned size) DECLSPEC_HIDDEN
Definition: symbol.c:226
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
BOOL stabs_parse(struct module *module, unsigned long load_offset, const void *stabs, int stablen, const char *strs, int strtablen, stabs_def_cb callback, void *user) DECLSPEC_HIDDEN
Definition: stabs.c:1275
struct module * pe_load_native_module(struct process *pcs, const WCHAR *name, HANDLE hFile, DWORD64 base, DWORD size)
Definition: pe_module.c:776
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
Definition: storage.c:406
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
struct symt symt
WORD SizeOfOptionalHeader
Definition: ntddk_ex.h:127
#define IMAGE_DEBUG_MISC_EXENAME
Definition: compat.h:142
#define FILE_MAP_READ
Definition: compat.h:435
unsigned int dir
Definition: maze.c:112
BOOL pe_load_debug_info(const struct process *pcs, struct module *module)
Definition: pe_module.c:746
#define IMAGE_FILE_DEBUG_STRIPPED
Definition: pedump.c:165
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
#define OPEN_EXISTING
Definition: compat.h:434
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
BOOL rsym_parse(struct module *module, unsigned long load_offset, const void *rsym, int rsymlen) DECLSPEC_HIDDEN
Definition: rsym.c:79
BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS *nth)
Definition: pe_module.c:837
struct _IMAGE_SYMBOL IMAGE_SYMBOL
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
DWORD64 reloc_delta
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD NumberOfSymbols
Definition: ntddk_ex.h:126
if(!(yy_init))
Definition: macro.lex.yy.c:714
static void pe_unmap_full(struct image_file_map *fmap)
Definition: pe_module.c:61
void(* loc_compute)(struct process *pcs, const struct module_format *modfmt, const struct symt_function *func, struct location *loc)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:409
static BOOL pe_map_file(HANDLE file, struct image_file_map *fmap, enum module_type mt)
Definition: pe_module.c:208
static BOOL pe_load_export_debug_info(const struct process *pcs, struct module *module)
Definition: pe_module.c:661
#define FindExecutableImageExW
Definition: compat.h:790
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned dbghelp_options
Definition: dbghelp.c:72
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
static BOOL pe_locate_with_coff_symbol_table(struct module *module)
Definition: pe_module.c:341
static unsigned image_get_map_size(const struct image_section_map *ism)
static BOOL pe_load_dbg_file(const struct process *pcs, struct module *module, const char *dbg_name, DWORD timestamp)
Definition: pe_module.c:553
#define GetFileSizeEx
Definition: compat.h:422
int ret
static void pe_module_remove(struct process *pcs, struct module_format *modfmt)
Definition: pe_module.c:327
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define IMAGE_SYM_CLASS_FILE
Definition: compat.h:139
IMAGE_DOS_HEADER dos
Definition: module.c:49
SYM_TYPE SymType
Definition: compat.h:732
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned long dbg_hdr_addr
struct location var
#define RtlImageDirectoryEntryToData
Definition: compat.h:468
static void image_unmap_section(struct image_section_map *ism)
struct image_file_map fmap
Definition: pe_module.c:43
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:423
#define GENERIC_READ
Definition: compat.h:124
module_type
PVOID WINAPI ImageDirectoryEntryToData(PVOID base, BOOLEAN image, USHORT dir, PULONG size)
Definition: pe_module.c:914
GLenum src
Definition: glext.h:6340
uint32_t DWORD_PTR
Definition: typedefs.h:63
_In_ HANDLE hFile
Definition: mswsock.h:90
static const char * image_map_section(struct image_section_map *ism)
#define IMAGE_DIRECTORY_ENTRY_EXPORT
Definition: compat.h:140
BOOL path_find_symbol_file(const struct process *pcs, const struct module *module, PCSTR full_path, const GUID *guid, DWORD dw1, DWORD dw2, PSTR buffer, BOOL *is_unmatched) DECLSPEC_HIDDEN
Definition: path.c:626
#define ERR(fmt,...)
Definition: debug.h:109
static BOOL pe_load_rsym(struct module *module)
Definition: pe_module.c:527
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
uint64_t DWORD64
Definition: typedefs.h:65
unsigned short USHORT
Definition: pedump.c:61
#define IMAGE_DIRECTORY_ENTRY_DEBUG
Definition: compat.h:141
unsigned pe_get_map_size(const struct image_section_map *ism)
Definition: pe_module.c:177
static BOOL pe_load_msc_debug_info(const struct process *pcs, struct module *module)
Definition: pe_module.c:600
static BOOL pe_load_coff_symbol_table(struct module *module)
Definition: pe_module.c:402
GLenum GLenum dst
Definition: glext.h:6340
DWORD PointerToSymbolTable
Definition: ntddk_ex.h:125
#define IMAGE_SIZEOF_SHORT_NAME
Definition: pedump.c:277
unsigned int * PULONG
Definition: retypes.h:1
#define PAGE_READONLY
Definition: compat.h:127
struct hash_table_elt hash_elt
BOOL dwarf2_parse(struct module *module, unsigned long load_offset, const struct elf_thunk_area *thunks, struct image_file_map *fmap) DECLSPEC_HIDDEN
Definition: dwarf.c:3522
struct module * module
#define RtlImageNtHeader
Definition: compat.h:465
unsigned source_new(struct module *module, const char *basedir, const char *source) DECLSPEC_HIDDEN
Definition: source.c:67
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
Definition: name.c:38
BOOL pe_find_section(struct image_file_map *fmap, const char *name, struct image_section_map *ism)
Definition: pe_module.c:113
#define SYMOPT_PUBLICS_ONLY
Definition: compat.h:649
struct image_file_map::@370::pe_file_map pe
HANDLE handle
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define IMAGE_DEBUG_TYPE_MISC
Definition: compat.h:133
static BOOL pe_load_stabs(const struct process *pcs, struct module *module)
Definition: pe_module.c:471
#define SYMOPT_NO_PUBLICS
Definition: compat.h:650
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
const char * strtable
#define UnmapViewOfFile
Definition: compat.h:411
IMAGEHLP_MODULEW64 module
struct module_format * format_info[DFI_LAST]
#define HeapFree(x, y, z)
Definition: compat.h:402
BYTE Data[1]
Definition: compat.h:162
DWORD_PTR pe_get_map_rva(const struct image_section_map *ism)
Definition: pe_module.c:165
#define IMAGE_SYM_CLASS_EXTERNAL
Definition: compat.h:138
const char * pe_map_directory(struct module *module, int dirno, DWORD *size)
Definition: pe_module.c:313
LONGLONG QuadPart
Definition: typedefs.h:112
struct pe_module_info * pe_info
Definition: fci.c:126
GLuint const GLchar * name
Definition: glext.h:6031