get version off dll
Posted: Mon Sep 18, 2017 1:27 pm
hello,
i find some old way to have the version of dll or exe :
http://www.purebasic.fr/english/viewtop ... 85&p=66018
but it doesn't work on a w10 x64.
i try with a 5.20, but it's not working either.
Anyone have a solution ?
i find some old way to have the version of dll or exe :
http://www.purebasic.fr/english/viewtop ... 85&p=66018
Code: Select all
;- get version of specified file as string
Procedure.s GetFileVersion(FileSpec.s)
VerBuffer.VS_FIXEDFILEINFO
FileVersion.s
If OpenLibrary(0, "version.dll")
*GFI_Size = GetFunction(0, "GetFileVersionInfoSizeA")
*GFI_Info = GetFunction(0, "GetFileVersionInfoA")
*GFI_Value = GetFunction(0, "VerQueryValueA")
If *GFI_Size And *GFI_Info And *GFI_Value
; get size of version information buffer
BufferLen = CallFunctionFast(*GFI_Size, @FileSpec, @Dummy)
If BufferLen
; allocate buffer and get version information
*Buffer = AllocateMemory(BufferLen)
CallFunctionFast(*GFI_Info, @FileSpec, 0, BufferLen, *Buffer)
; find file version and copy into structure
CallFunctionFast(*GFI_Value, *Buffer, @"\", @VerPointer, @VerBufferLen)
CopyMemory(VerPointer, VerBuffer, VerBufferLen)
; build file version string "x.x.x.x"
FileVersion = Str((VerBuffer\dwFileVersionMS & $FFFF0000) >> 16) + "." + Str(VerBuffer\dwFileVersionMS & $0000FFFF) + "." + Str((VerBuffer\dwFileVersionLS & $FFFF0000) >> 16) + "." + Str(VerBuffer\dwFileVersionLS & $0000FFFF)
EndIf
EndIf
CloseLibrary(0)
EndIf
; return file version string
ProcedureReturn FileVersion
EndProcedure
Debug ( GetFileVersion("c:\windows\notepad.exe") )
i try with a 5.20, but it's not working either.
Anyone have a solution ?