You are here

Discovering DLL Version With pefile

A Microsoft KB article claimed that if a specific DLL was at least a certain version that a bug reported by one of my users would be resolved. But the user was using their computer and I dislike interrupting people's work (I know how annoying it is when someone interrupts me). No problem; I can just grab the named DLL off their machine over the network and copy it to my home directory. But I'm not running Windows and all file tells me is that the DLL is a 32-bit PE file. Enter pefile, a Python module that can parse PE headers on any platform.

$ python
Python 2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pefile
>>> pe =  pefile.PE('lhmstscx.dll')
>>> pe.FileInfo[0].StringTable[0].entries['ProductVersion']
u'6.0.6001.18589'

Text 1: Getting the version informtion from lhmstscx.dll

Handy. pefile can tell me lots of other things to, but in this case all I needed to know is that this DLL wasn't at the required version (despite having approved all WSUS updates for that workstation's group... but that's another story).

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer