I tried it the following way but well suppose i kinda suck ;)
Also i?m not sure if i must get the language Identifier before i can get
the info i would like to have.
Any Idea how to get the FileVersion, CompanyName and / or the other predefined version information
from an dll ?



.data
szfilename db "test.dll",0
szRoot db "\",0
.data?
lpdwHandle dd ?
Filesize dd ?
VersionBuffer db dup 30(?)
FileInfo dd ?
outputBuffer db dup 20 (?)



INVOKE GetFileVersionInfoSize,addr szfilename,addr lpdwHandle
mov Filesize,eax
INVOKE GetFileVersionInfo,addr szfilename,0,Filesize,addr VersionBuffer
INVOKE VerQueryValue,addr VersionBuffer,addr szRoot,addr FileInfo,addr outputBuffer

;probably totally crap now :/

mov edi,FileInfo
assume edi:ptr VS_FIXEDFILEINFO

Posted on 2002-05-27 13:25:23 by Allanon
To get this info, basically you have to wade thru the resource portion of the dll (or exe).

Here's a particularly interesting version info section of something in my MSVC toybox. It's interesting cause it supports two languages (both english and japanese).

Here's what it looked like coppied from qeditor:



/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,0,0
PRODUCTVERSION 4,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0xbL
#else
FILEFLAGS 0xaL
#endif
FILEOS 0x10001L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Microsoft Corporation\0"
VALUE "FileDescription", "ClipText Example Application\0"
VALUE "FileVersion", "Version 4.0\0"
VALUE "InternalName", "ClipText\0"
VALUE "LegalCopyright", "Copyright (C) Microsoft Corp. 1990-1995\0"
VALUE "LegalTrademarks", "Microsoft(R) is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0"
VALUE "ProductName", "ClipText\0"
VALUE "ProductVersion", "Version 4.0\0"
END
BLOCK "041104E4"
BEGIN
VALUE "CompanyName", "Microsoft Corporation\0"
VALUE "FileDescription", "ClipText Example Application\0"
VALUE "FileVersion", "Version 4.0\0"
VALUE "InternalName", "ClipText\0"
VALUE "LegalCopyright", "Copyright (C) Microsoft Corp. 1990-1995\0"
VALUE "LegalTrademarks", "Microsoft(R) is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation\0"
VALUE "ProductName", "ClipText\0"
VALUE "ProductVersion", "Version 4.0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252, 0x411, 1252
END
END

#ifdef JAPAN
LANGUAGE LANG_JAPANESE, SUBLANG_NEUTRAL

showdib MENU
BEGIN
POPUP "?t?@?C??(&F)"
BEGIN
MENUITEM "?J??(&O)...", IDM_OPEN
MENUITEM "???(&S)...", IDM_SAVE
MENUITEM "????(&P)", IDM_PRINT
MENUITEM SEPARATOR
MENUITEM "?I??(&X)", IDM_EXIT
MENUITEM SEPARATOR
MENUITEM "?o?[?W????????(&A)...", IDM_ABOUT
END
POPUP "?I?v?V????(&O)"
BEGIN
MENUITEM "?F???X?V(&U)", IDM_UPDATECOL
MENUITEM "???X?_??\??(&H)", IDM_NOUGLY
MENUITEM "DIB?\??(&D)", IDM_DIBSCREEN
MENUITEM "DIBs??????(&M)", IDM_MEMORYDIB
MENUITEM "????(&T)", IDM_TRANSPARENT

MENUITEM SEPARATOR
MENUITEM "DIB??\???t??(&A)", IDM_PASTEDIB
MENUITEM "DDB??\???t??(&S)", IDM_PASTEDDB
MENUITEM "?p???b?g??\???t??(&E)",IDM_PASTEPAL
MENUITEM "?R?s?[(&C)", IDM_COPY
END

POPUP "?A?j???[?V????(&A)"
BEGIN
MENUITEM "?X?`?[?? ?J???[", IDM_STEALCOL
MENUITEM "?n?e?e", IDM_ANIMATE0
MENUITEM "5", IDM_ANIMATE5
MENUITEM "50", IDM_ANIMATE50
MENUITEM "100", IDM_ANIMATE100
MENUITEM "200", IDM_ANIMATE200
MENUITEM "??????", IDM_ANIMATE201
END
END

STRINGTABLE
BEGIN
IDS_MEMLOW "<WM_CREATE> ?p???b?g???????????????????????B"
IDS_NOMEM "??????????????????I"
IDS_OPENDIBPROMPT "?\?????? DIB ??I??"
IDS_SAVEDIBPROMPT "DIB ??????????t?@?C????I??"
IDS_CANTSAVEFILE "?w?????t?@?C?????????????????D"
IDS_CANTOPENFILE "?t?@?C?????I?|?v???????????D '%ls'"
IDS_BADDIBFILE "%s ?????????c?h?a?`????t?@?C??????????????I"
IDS_CREATEPALFAIL "CreatePalette() ????s????????D"
IDS_CANTLOADRLE "?q?k?d?t?@?C?????????????????????????I"
IDS_CANTCREATEBMP "?r?b?g?}?b?v??????????????????????I"
IDS_CANTDRAWSCANS "DIB ???f?o?C?X??`???????!"
IDS_CANTDRAWMAP "?r?b?g?}?b?v???X?N???[????R?s?[????????!"
IDS_SAVESTR "???(&S)"
IDS_OPENSTR "?J??(&O)"
END
#endif


Just have a go at the file with FindResource, LoadResource, LockResource, SizeofResource, and anything else you might want to use there.
Posted on 2002-05-27 21:13:46 by Ernie
thanx Ernie, didn?t even thought about that
Posted on 2002-05-27 23:55:53 by Allanon