OBJXREF - anything like it for MASM? I want to inspect .LIB files.

Started by obscurite, March 14, 2005, 02:13:20 AM

Previous topic - Next topic

obscurite

Great forum you guys got here.  :U

I've been looking for a MASM equivalent of Borland's OBJXREF utility. I want to use it to see what's in a .LIB file.

From the Borland 3.1 docs: "OBJXREF examines a list of object files and library files and produces reports on their contents. One type of report lists definitions of public names and references to them. The other type lists the segment sizes defined by object modules."

If there's no utility like this, is it feasible to do it myself (maybe using a perl script)? If I could figure out what format a binary .LIB is in, I suppose I could figure out how to parse it (as an assembler would). How do you go about seeing if it's PE, COFF, etc. Once you know the format, how do you parse it? Your advice and ideas are welcome!

Vortex

Hi obscurite,

Welcome to the forum.

To inspect static libraries, you need polib ( which can be found in the masm32 package )  to extract object files, and obj2asm ( from Digital Mars ) to disassemble object files.

hutch--

You can also use dumpbin which is hard wired into LINK.EXE the Microsoft version that comes with MASM32. With Pelle's lib tool and dumpbin you should be easily able to read the contents of libraries.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

obscurite

Thanks guys, I've been trying both polib and dumpbin, which both seem to work with masm32 library files. I suppose this is a format compatibility problem, because when I try to run polib and dumpbin on specific .lib files, they give 'Corrupt library' and 'Invalid file format' errors respectively and die.

As a test, I ran the tools on irvine.lib, irvine16.lib, and irvine32.lib, various versions of the notorious Kip Irvine libraries. Only the irvine32.lib library succeeded. I have also confirmed that the libraries are in tact and working (by reassembling/relinking programs against them via ml.exe).

If these libs were produced with Masm 5.x and 6.x, is there a possibility dumpbin and polib can't read them? I've been looking at the headers of the files, comparing them against the COFF/PE, and OMF formats, and can't make heads or tail of it! Here are the first 60 bytes in hex - can you make anything of them?

F0 0D 00 00 22 00 00 02 00 00
00 00 00 00 00 00 80 2A 00 28
47 3A 5C 44 61 74 61 5C 4B 69
70 5C 41 73 6D 42 6F 6F 6B 33
5C 4C 69 62 72 61 72 79 5C 53
54 52 49 4E 47 53 2E 41 53 4D
56 88 0B 00 00 A3 07 73 74 72

Thanks again!

hutch--

Both of these tools work for 32 bit PE files so you would have to look for some ancient stuff to do DOS or 16 bit Windows.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

obscurite

Thanks hutch. Always good to know I'm not crazy!

Any ancient folks out there have any ancient MASM library inspection tools or tricks? I won't tell anyone your age I promise. hehehe.

There's still a huge body of 8/16 bit stuff out there, so it'd good to have laying around.

pbrennick

obscurite,
I guess you could use cref.exe to get a list of symbols and cv.exe (CodeView) to look inside.
Paul

obscurite

I did finally find out how to look at old files (which it turns out are in OMF format). There are at least two publically available tools for looking at microsoft OMF files:

PROGRAM: OMF Object File Dumper V2.00
AUTHOR(S): Sven B. Schreiber sbs@psbs.franken.de
URL(S): http://webster.cs.ucr.edu/Page_TechDocs/odu200.zip
A zip file is available that includes a binary, and ASM source code. The program dumps out
Microsoft OMF format files in a more human readable format.

PROGRAM: READOBJ
AUTHOR(S): Originally Kip Davidson, modified by Dave Cortesi
URL(S): Many places including the Simtel Archive (http://www.simtel.net/product.php%
5Burl_fb_product_page%5D40299)
A zip file is available that includes a binary, and C source code. The program dumps out Microsoft
OMF format files in a more human readable format.

If you're looking at stuff compiled with Visual Studio, then you're going to be seeing PE format (a version of COFF specific to microsoft) which is what dumpbin works with. If you're working with MASM (the official MS one) or older MS compilers, you may see OMF format.

Thanks for all your help.