• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extract DLL version in Java/Linux environment

 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know a technique for retrieving the version of a DLL file in Java? I'm willing to consider solutions that drop to command line to execute an external program, although it needs to run on a Linux (no Windows!) environment.

I'm also wondering if it's possible to extract the version from reading the raw DLL bytes into an array, but I have not seen a DLL byte diagram that might assist in doing so.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's been some time since I've meddled with DLLs, and it is possible that the file format has been extended significantly. But it should still be documented on MSDN. Try to look for Portable Executable File Format, there is a page on MSDN and some other Google hits.

The PE/COFF format consists of blocks and it should be possible to traverse and process them. It's gonna be a messy stuff, though. Some inspiration could probably be gleaned from Wine, which naturally deals with Windows executables.

I believe there are no significant differences in the format between 16/32/64 bit versions of the DLLs, but I'm not sure.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then there is PE/COFF 4J. Probably too embryonic to provide what you need, but might be a good starting point. Apparently it can process the basic structure of the DLL.
 
Tim Holloway
Saloon Keeper
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Microsoft PE and COFF Specification"

http://msdn.microsoft.com/en-us/windows/hardware/gg463119.aspx

I see Martin found it as well.

Linux doesn't use DLL or MS executable binary file formats itself. You'd either have to install Wine or scan the file. I used to have some C code to parse DLLs, but that was so long ago that DLLs weren't versionable, and I don't even know where the code is anymore (probably on a floppy).

Speaking of Wine, you might want to do a quick perusal of its source code and see if there's something you can hijack.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic