DLL version number

Thomas Heller theller at python.net
Tue Mar 9 15:29:10 EST 2004


hungjunglu at yahoo.com (Hung Jung Lu) writes:

> "Roger Upole" <rupole at hotmail.com> wrote in message news:<404d1159_5 at 127.0.0.1>...
>> You can use win32api.GetFileVersionInfo.
>> See /demos/getfilever.py for an example of how to use it.
>>        Roger
>> 
>> "Hung Jung Lu" <hungjunglu at yahoo.com> wrote in message
>> news:8ef9bea6.0403081509.31b3f9e at posting.google.com...
>> >
>> > If I have a Windows DLL file, how can I retrieve its version number
>> > (e.g.: 2.40.4275.1)? Does Win32 extensions, ctypes or related modules
>> > provide such a utility?
>
> Thanks. However, I still have problems. What I need are the 4-part
> version numbers, which GetFileVersionInfo() does not provide.

Versioninfo resources are very complex beasts. They normally contain
strings, and numerical values as well.  I believe what you want are the
numeric version numbers in the VS_FIXEDFILEINFO structure.  There are 4
16-bit fields encoded as 2 32 bit fields, named dwFileVersionMS and
dwFileVersionLS.

The ctypes source distribution has a sample script (slightly outdated,
but it still works) in the samples/Windows/VersionInfo.py file.

Thomas





More information about the Python-list mailing list