This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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.
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.
An IDE is no substitute for an Intelligent Developer.