Some dumb fixes.
This commit is contained in:
parent
50f7bc5af5
commit
f19887971a
|
@ -320,7 +320,7 @@ static int dump_cv_sst_align_sym(OMFDirEntry* omfde)
|
||||||
|
|
||||||
static void dump_codeview_all_modules(OMFDirHeader *omfdh)
|
static void dump_codeview_all_modules(OMFDirHeader *omfdh)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
OMFDirEntry *dirEntry;
|
OMFDirEntry *dirEntry;
|
||||||
const char* str;
|
const char* str;
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ static void dump_codeview_headers(unsigned long base, unsigned long len)
|
||||||
OMFDirHeader *dirHeader;
|
OMFDirHeader *dirHeader;
|
||||||
OMFSignature *signature;
|
OMFSignature *signature;
|
||||||
OMFDirEntry *dirEntry;
|
OMFDirEntry *dirEntry;
|
||||||
int i;
|
unsigned i;
|
||||||
int modulecount = 0, alignsymcount = 0, srcmodulecount = 0, librariescount = 0;
|
int modulecount = 0, alignsymcount = 0, srcmodulecount = 0, librariescount = 0;
|
||||||
int globalsymcount = 0, globalpubcount = 0, globaltypescount = 0;
|
int globalsymcount = 0, globalpubcount = 0, globaltypescount = 0;
|
||||||
int segmapcount = 0, fileindexcount = 0, staticsymcount = 0;
|
int segmapcount = 0, fileindexcount = 0, staticsymcount = 0;
|
||||||
|
|
|
@ -273,7 +273,7 @@ int main (int argc, char *argv[])
|
||||||
VERBOSE = 1;
|
VERBOSE = 1;
|
||||||
|
|
||||||
symbol_init (&symbol, globals.input_name);
|
symbol_init (&symbol, globals.input_name);
|
||||||
if (symbol_demangle (&symbol) == -1);
|
if (symbol_demangle (&symbol) == -1)
|
||||||
fatal( "Symbol hasn't got a mangled name\n");
|
fatal( "Symbol hasn't got a mangled name\n");
|
||||||
if (symbol.flags & SYM_DATA)
|
if (symbol.flags & SYM_DATA)
|
||||||
printf (symbol.arg_text[0]);
|
printf (symbol.arg_text[0]);
|
||||||
|
|
|
@ -487,7 +487,7 @@ static char *demangle_datatype (char **str, compound_type *ct,
|
||||||
/* FIXME: P6 = Function pointer, others who knows.. */
|
/* FIXME: P6 = Function pointer, others who knows.. */
|
||||||
if (isdigit (*iter))
|
if (isdigit (*iter))
|
||||||
{
|
{
|
||||||
if (*iter == 6) printf("Function pointer in argument list is not handled yet\n");
|
if (*iter == '6') printf("Function pointer in argument list is not handled yet\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "pe.h"
|
#include "pe.h"
|
||||||
|
|
||||||
static void* base;
|
static void* base;
|
||||||
static long total_len;
|
static unsigned long total_len;
|
||||||
static IMAGE_NT_HEADERS* nt_headers;
|
static IMAGE_NT_HEADERS* nt_headers;
|
||||||
|
|
||||||
enum FileSig {SIG_UNKNOWN, SIG_DOS, SIG_PE, SIG_DBG};
|
enum FileSig {SIG_UNKNOWN, SIG_DOS, SIG_PE, SIG_DBG};
|
||||||
|
@ -114,7 +114,7 @@ static void dump_pe_header(void)
|
||||||
char *str;
|
char *str;
|
||||||
IMAGE_FILE_HEADER *fileHeader;
|
IMAGE_FILE_HEADER *fileHeader;
|
||||||
IMAGE_OPTIONAL_HEADER *optionalHeader;
|
IMAGE_OPTIONAL_HEADER *optionalHeader;
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
printf("File Header\n");
|
printf("File Header\n");
|
||||||
fileHeader = &nt_headers->FileHeader;
|
fileHeader = &nt_headers->FileHeader;
|
||||||
|
@ -220,7 +220,7 @@ static void dump_pe_header(void)
|
||||||
static void dump_sections(void* addr, unsigned num_sect)
|
static void dump_sections(void* addr, unsigned num_sect)
|
||||||
{
|
{
|
||||||
IMAGE_SECTION_HEADER* sectHead = addr;
|
IMAGE_SECTION_HEADER* sectHead = addr;
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
printf("Section Table\n");
|
printf("Section Table\n");
|
||||||
for (i = 0; i < num_sect; i++, sectHead++)
|
for (i = 0; i < num_sect; i++, sectHead++)
|
||||||
|
@ -655,14 +655,15 @@ int pe_analysis(const char* name, void (*fn)(void), enum FileSig wanted_sig)
|
||||||
int fd;
|
int fd;
|
||||||
enum FileSig effective_sig;
|
enum FileSig effective_sig;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
struct stat s;
|
||||||
|
|
||||||
setbuf(stdout, NULL);
|
setbuf(stdout, NULL);
|
||||||
|
|
||||||
fd = open(name, O_RDONLY);
|
fd = open(name, O_RDONLY);
|
||||||
if (fd == -1) fatal("Can't open file");
|
if (fd == -1) fatal("Can't open file");
|
||||||
|
|
||||||
total_len = lseek(fd, 0, SEEK_END);
|
if (fstat(fd, &s) < 0) fatal("Can't get size");
|
||||||
if (total_len < 0) fatal("Can't get size");
|
total_len = s.st_size;
|
||||||
|
|
||||||
base = mmap(NULL, total_len, PROT_READ, MAP_PRIVATE, fd, 0);
|
base = mmap(NULL, total_len, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
if (base == (void*)-1) fatal("Can't map file");
|
if (base == (void*)-1) fatal("Can't map file");
|
||||||
|
@ -682,7 +683,7 @@ int pe_analysis(const char* name, void (*fn)(void), enum FileSig wanted_sig)
|
||||||
ret = 0; break;
|
ret = 0; break;
|
||||||
case SIG_PE:
|
case SIG_PE:
|
||||||
printf("Contents of \"%s\": %ld bytes\n\n", name, total_len);
|
printf("Contents of \"%s\": %ld bytes\n\n", name, total_len);
|
||||||
do_dump();
|
(*fn)();
|
||||||
break;
|
break;
|
||||||
case SIG_DBG:
|
case SIG_DBG:
|
||||||
dump_separate_dbg();
|
dump_separate_dbg();
|
||||||
|
|
Loading…
Reference in New Issue