Hallo,
some programm using a dll with Borland style imports crashes if the dll is
loaded a second time. When PE_fixup_imports is called for the first time,
resolving goes fine (_relay,+win32 log, with BON: -line additional, hopefully
selfexplaining output)
trace:win32:PE_LoadLibraryExA BON:D:\wine95\system\netapi32.dll
trace:win32:dump_exports *******EXPORT DATA*******
trace:win32:dump_exports Module name is NETAPI32.dll, 1 functions, 1 names
trace:win32:dump_exports Ord RVA Addr Name
1 00001000 0x7fad1000 Netbios
trace:win32:PE_fixup_imports Dumping imports list
trace:win32:PE_LoadLibraryExA BON:D:\wine95\system\netbios.dll
trace:win32:dump_exports *******EXPORT DATA*******
trace:win32:dump_exports Module name is NETBIOS.dll, 6 functions, 6 names
trace:win32:dump_exports Ord RVA Addr Name
1 00001a37 0x7f6f1a37 NetbiosAddthd
2 000019eb 0x7f6f19eb NetbiosDelete
3 00001a96 0x7f6f1a96 NetbiosDelthd
4 000019b1 0x7f6f19b1 NetbiosInitialize
5 0000186b 0x7f6f186b PostRoutineCaller
6 0000102e 0x7f6f102e _Netbios
trace:win32:PE_fixup_imports Dumping imports list
trace:win32:PE_fixup_imports Borland style imports used
trace:win32:PE_fixup_imports BON:load_addr 7f6f0000
trace:win32:PE_fixup_imports BON:thunk 0x602c
trace:win32:PE_fixup_imports BON:ordinal 6080
^^^^
trace:win32:PE_fixup_imports BON:name KERNEL32.dll
trace:win32:PE_fixup_imports BON:pe_name 0x7f6f6080
trace:win32:PE_fixup_imports BON:pe_name->Hint 94
trace:win32:PE_fixup_imports BON:pe_name->Name 0x7f6f6082
trace:win32:PE_fixup_imports --- EnterCriticalSection KERNEL32.dll.94
Now ordinal is replace by the function pointer in PE_fixup_imports. The second
PE_LoadLibraryExA however goes astray, as it tries to resolve the function
pointer as an ordinal in PE_fixup_imports.
trace:win32:PE_LoadLibraryExA BON:D:\wine95\system\netapi32.dll
trace:win32:dump_exports *******EXPORT DATA*******
trace:win32:dump_exports Module name is NETAPI32.dll, 1 functions, 1 names
trace:win32:dump_exports Ord RVA Addr Name
1 00001000 0x7fad1000 Netbios
trace:win32:PE_fixup_imports Dumping imports list
trace:win32:PE_LoadLibraryExA BON:D:\wine95\system\netbios.dll
trace:win32:dump_exports *******EXPORT DATA*******
trace:win32:dump_exports Module name is NETBIOS.dll, 6 functions, 6 names
trace:win32:dump_exports Ord RVA Addr Name
1 00001a37 0x7f6f1a37 NetbiosAddthd
2 000019eb 0x7f6f19eb NetbiosDelete
3 00001a96 0x7f6f1a96 NetbiosDelthd
4 000019b1 0x7f6f19b1 NetbiosInitialize
5 0000186b 0x7f6f186b PostRoutineCaller
6 0000102e 0x7f6f102e _Netbios
trace:win32:PE_fixup_imports Dumping imports list
trace:win32:PE_fixup_imports Borland style imports used
trace:win32:PE_fixup_imports BON:load_addr 7f6f0000
trace:win32:PE_fixup_imports BON:thunk 0x602c
trace:win32:PE_fixup_imports BON:ordinal 4010d724
^^^^^^^^
trace:win32:PE_fixup_imports BON:name KERNEL32.dll
trace:win32:PE_fixup_imports BON:pe_name 0xbf7fd724
BON: 4010d724
086723f8:Call kernel32.UnhandledExceptionFilter(404b4b00) ret=00454633
What is the right solution? Only treat the value as an ordinal if it is
smaller then 0x10000( I susbpect that an dll may only have 0xffff entries or
the IMAGE_SNAP_BY_ORDINAL wouldn't work)? Or is it an error that we call
PE_fixup_imports for the second time at all for an already resolved dll?
Bye
Uwe Bonnes bon(a)elektron.ikp.physik.tu-darmstadt.de
Free Software: If you contribute nothing, expect nothing
--