Only sort the number of symbols actually found.

This commit is contained in:
Jon Griffiths 2003-03-15 19:36:31 +00:00 committed by Alexandre Julliard
parent 272d240402
commit 59182a92c1

View file

@ -621,7 +621,7 @@ static void dump_unicode_str( const WCHAR *str, int len )
printf( "\"" ); printf( "\"" );
} }
static const char *get_resource_type( int id ) static const char *get_resource_type( unsigned int id )
{ {
static const char *types[] = static const char *types[] =
{ {
@ -851,7 +851,7 @@ int pe_analysis(const char* name, void (*fn)(enum FileSig), enum FileSig wanted_
#endif #endif
{ {
if (!(PE_base = malloc( PE_total_len ))) fatal( "Out of memory" ); if (!(PE_base = malloc( PE_total_len ))) fatal( "Out of memory" );
if (read( fd, PE_base, PE_total_len ) != PE_total_len) fatal( "Cannot read file" ); if (read( fd, PE_base, PE_total_len ) != (int)PE_total_len) fatal( "Cannot read file" );
} }
effective_sig = check_headers(); effective_sig = check_headers();
@ -979,7 +979,7 @@ static void do_grab_sym( enum FileSig sig )
ptr = RVA(*pName++, sizeof(DWORD)); ptr = RVA(*pName++, sizeof(DWORD));
if (!ptr) ptr = "cant_get_function"; if (!ptr) ptr = "cant_get_function";
dll_symbols[j].symbol = strdup(ptr); dll_symbols[j].symbol = strdup(ptr);
dll_symbols[j].ordinal = -1; /* indicate non-ordinal symbol */ dll_symbols[j].ordinal = exportDir->Base + *pOrdl;
assert(dll_symbols[j].symbol); assert(dll_symbols[j].symbol);
} }
pFunc = RVA(exportDir->AddressOfFunctions, exportDir->NumberOfFunctions * sizeof(DWORD)); pFunc = RVA(exportDir->AddressOfFunctions, exportDir->NumberOfFunctions * sizeof(DWORD));
@ -1005,12 +1005,12 @@ static void do_grab_sym( enum FileSig sig )
free(map); free(map);
if (NORMAL) if (NORMAL)
printf("%lu named symbols in DLL, %lu total\n", printf("%lu named symbols in DLL, %lu total, %d unique (ordinal base = %ld)\n",
exportDir->NumberOfNames, exportDir->NumberOfFunctions); exportDir->NumberOfNames, exportDir->NumberOfFunctions, j, exportDir->Base);
qsort( dll_symbols, exportDir->NumberOfFunctions, sizeof(dll_symbol), symbol_cmp ); qsort( dll_symbols, j, sizeof(dll_symbol), symbol_cmp );
dll_symbols[exportDir->NumberOfFunctions].symbol = NULL; dll_symbols[j].symbol = NULL;
dll_current_symbol = dll_symbols; dll_current_symbol = dll_symbols;
} }