• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Extract DLL version in Java/Linux environment

 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic