File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Extract DLL version in Java/Linux environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Extract DLL version in Java/Linux environment" Watch "Extract DLL version in Java/Linux environment" New topic
Author

Extract DLL version in Java/Linux environment

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

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.


My Blog: Down Home Country Coding with Scott Selikoff
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

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

Joined: Aug 22, 2010
Posts: 3606
    
  60

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

Joined: Jun 25, 2001
Posts: 15957
    
  19

"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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Extract DLL version in Java/Linux environment
 
Similar Threads
ajax and java
how to extract tagged version of java code in build.xml
Servlets exception thrown
.bin files????
Shell Extension