Uniface on GitHub
Product (releases and patches)
Fixes and Updates
How to get the file version info out of a DLL ? I create a signature OS_DLL_VERSION for the windows DLL version.DLLThen there are a least to entitiesOS_LPVOID: Only one field defined as R1024OS_VS_FIXEDFILEINFO: Defined with the layout of VS_FIXEDFILEINFO
Now I call:activate "OS_DLL_VERSION"."GetFileVersionInfoA"("<dllname>",0,1024,"OS_LPVOID")and got the raw file version info
This looks good but then it goes worse:
1) activate "OS_DLL_VERSION"."VerQueryValue_FIX"("OS_LPVOID","\","OS_VS_FIXEDFILEINFO",v_NUM2) v_NUM2 yields to 52, which is the size of VS_FIXEDFILEINFO
2) activate "OS_DLL_VERSION"."VerQueryValueA"("OS_LPVOID","\",v_NUM1,v_NUM2) v_NUM2 still 52 and v_NUM1 is a pointer
Copy the content into "OS_VS_FIXEDFILEINFO" activate $INST_KERNEL32$."lstrcpy_VS"("OS_VS_FIXEDFILEINFO",v_NUM1)
DWSIGNATURE.OS_VS_FIXEDFILEINFO in both cases is 0xfeef04bd, that is okay.But all other fields are 0 (null)
Any idea to get the info?Without a C wrapperThis should be possible, as UnifAce is programm language to solve all other problemsIngo
I got a solution. Not straight like C but working
First of all, the buffer had to be set to a size >1024, now its 65335.Second, I use activate "OS_DLL_VERSION"."VerQueryValueA"("OS_LPVOID","\VarFileInfo\Translation",v_PTR1,v_NUM2)Now in v_PTR1 is a pointer to a language and codepage structLoad the memory as LONG into UnifAce and I can separat language and codepageFormat this to a hex stringv_Subkey1 = $concat(LF_NUM2HEX(language,4)+LF_NUM2HEX(codepage,4)
With this infoactivate "OS_DLL_VERSION"."VerQueryValueA"("OS_LPVOID","\StringFileInfo\%%v_SUBKEY1%%%\CompanyName",v_PTR1,v_NUM2)Load the memory at pointer v_PTR1 into UnifAce and you got the company name iI't it easy with UnifAce to get all nesaccary information grins Ingo
Thanks Freak. Nice sample.
If you call GetFileVersionInfoSizeA before calling GetFileVersionInfoA then you'll know how big the buffer is/should be.
Hi DanielNope, doesn't help In UnifAce, you have declare a signature with an oocurrence as parameterIn this helper-entity there you have to create on field as raw data.And this field has a defined length.So your signature is also .limited in length.This max length you have to consider.It would be nice, if at runtime you can change this sizes (allocate/reallocate)But with UnifAce ....Ingo
I would not agree. If you would have done the check then you would have realized immediately that the defined parameter is too small.
And it would of course be nice if the parameters of a C Call-Out could be resized at runtime. Currently a developer needs to use his grey cells a bit more.
Can you use powershell ?
Create a .bat file, replace yourDllPath by your dll file path:
@echo offfor /f "delims=" %%i in ('powershell.exe "(dir yourDllPath).VersionInfo.FileVersion"') do Set versionFile=%%iecho %versionFile%
Call the .bat file from Uniface :
Variablesstring resultEndVariablesactivate "oscommand".commandout("test.bat",result)
Hi GillesAs this components are running at customer site, part of them at a workstation part of them on a server. I'm not sure what environment I got.So this acquire of information should be very basic At it's best, UnifAce should do this job *needling*Ingo
© 2019 Uniface Privacy & Cookies | Privacy Statement | Legal