Page 1 of 1 1
Topic Options
#212357 - 2017-03-22 07:49 AM False file version using GetFileVersion
Schavuit Offline
Fresh Scripter

Registered: 2016-09-30
Posts: 14
Loc: South Korea
When using GetFileVersion on a windows 10 system and using Kixtart version 4.66 or 4.67 I get a false file version back. Below is a script I am using.

 PHP:
? '------ Entering Testscript.kix ------' ;************************************************************************ $RC=setoption("WOW64AlternateRegView","On") $RC=setoption("Wow64FileRedirection","on") $RC=setoption("WrapATEOL","on") $RC=setoption("NoVarsinStrings","on") $RC=setoption("NoMacrosinstrings","on") ? ? "Kix Version - " @kix ? "Windows OS - " @producttype + " " + iif(@onwow64,"64bit","32bit") $SCRIPTPATH = "\\mycomputer123\C$\Users\me123\Desktop\myscript\Scripts" ;************************************************************************ ;***** Call Functions.kix to load all custom functions ***** ;************************************************************************ Call $SCRIPTPATH + "\Functions.kix" ;************************************************************************ ;***** Windows 10 test ***** ;************************************************************************ $GoodVersionNum = "10.0.10586.17" $FilePath = "%windir%\System32\Mssign32.dll" ;************************************************************************ $FileVersion = GetFileVersion($FilePath, "BinFileVersion") ;************************************************************************ If $FileVersion <> "" AND instr($FileVersion_C, "Good") $Patch = "Good" Else $Patch = "Bad" EndIf ;************************************************************************ $Patch_T1 = " Patch 1 Installed version: " + $FileVersion + " Required version is: " + $GoodVersionNum ? ? "File path we are looking into" ? $FilePath ? ? "File's version that Kixtart can see" ? $FileVersion ? ? "File version and what it needs to be at." ? $Patch_T1 ? ;************************************************************************ ? '------ End of Testscript.kix ------' ?


This is what it returns after running the script

 PHP:
------ Entering Testscript.kix ------ Kix Version - 4.67 Windows OS - Windows 10 Enterprise 64bit File path we are looking into C:windowsSystem32Mssign32.dll Files version that Kixtart can see 6.2.10586.17 File version and what it needs to be at. Patch 1 Installed version: 6.2.10586.17 Required version is: 10.0.10586.17 ------ End of Testscript.kix ------


* there are backslashes in the file path

The real file version for this .dll file is 10.0.10586.17

Top
#212360 - 2017-03-22 02:07 PM Re: False file version using GetFileVersion [Re: Schavuit]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
It is likely you are looking for a 32bit file. On a 64bit OS, System32 is the 64bit location of the file. Look in SysWow64 and see if you get better results.

%systemroot%\syswow64


I use the following UDF to avoid this problem.
 Code:
function System32()
  $System32="%systemroot%\" + iif(@onwow64,"syswow64","system32") 
endfunction
 

Top
#212362 - 2017-03-23 12:26 AM Re: False file version using GetFileVersion [Re: Allen]
Schavuit Offline
Fresh Scripter

Registered: 2016-09-30
Posts: 14
Loc: South Korea
Even with me looking into the file under syswow64 I still get a file version that is wrong
Top
#212364 - 2017-03-23 01:15 AM Re: False file version using GetFileVersion [Re: Schavuit]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Try this an another option

GetExtFileProperties() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=160880#Post160880

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1

Top
#212365 - 2017-03-23 03:34 AM Re: False file version using GetFileVersion [Re: Allen]
Schavuit Offline
Fresh Scripter

Registered: 2016-09-30
Posts: 14
Loc: South Korea
I added in that function and it still sees it as the wrong file version

*note I added in the function into my function.kix script.*

 PHP:
? '------ Entering Testscript.kix ------' ;************************************************************************ $RC=setoption("WOW64AlternateRegView","on") $RC=setoption("Wow64FileRedirection","on") $RC=setoption("WrapATEOL","on") $RC=setoption("NoVarsinStrings","on") $RC=setoption("NoMacrosinstrings","on") ? ? "Kix Version - " @kix ? "Windows OS - " @producttype + " " + iif(@onwow64,"64bit","32bit") $SCRIPTPATH = "\\mlwxw3-4220ly\C$\Users\1110211712A\Desktop\TCNO_Tracker_Tester\Scripts" ;************************************************************************ ;***** Call Functions.kix to load all custom functions ***** ;************************************************************************ Call $SCRIPTPATH + "\Functions.kix" ;************************************************************************ ;***** Windows 10 test ***** ;************************************************************************ $GoodVersionNum = "10.0.10586.17" $FilePath = System32 + "\Mssign32.dll" ;************************************************************************ $FQFN = $FilePath $attribute = 159 $FileVersion = GetExtFileProperties($FQFN, $attribute) ;************************************************************************ If $FileVersion <> "" AND instr($FileVersion_C, "Good") $Patch = "Good" Else $Patch = "Bad" EndIf ;************************************************************************ $Patch_T1 = " Patch 1 Installed version: " + $FileVersion + " Required version is: " + $GoodVersionNum ? ? "File path we are looking into" ? $FilePath ? ? "File's version that Kixtart can see" ? $FileVersion ? ? "File version and what it needs to be at." ? $Patch_T1 ? ? ? ;************************************************************************


Output...

 PHP:
------ Entering Testscript.kix ------ Kix Version - 4.67 Windows OS - Windows 10 Enterprise 64bit File path we are looking into C:windowssyswow64Mssign32.dll Files version that Kixtart can see 6.2.10586.17 File version and what it needs to be at. Patch 1 Installed version: 6.2.10586.17 Required version is: 10.0.10586.17

Top
#212366 - 2017-03-23 04:50 AM Re: False file version using GetFileVersion [Re: Schavuit]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Don't know what to tell you... done two different ways and get the same result.
Top
#212367 - 2017-03-23 09:02 AM Re: False file version using GetFileVersion [Re: Allen]
Schavuit Offline
Fresh Scripter

Registered: 2016-09-30
Posts: 14
Loc: South Korea
Yea its a pain in the but im going to see about trying some other ways of pulling a version number.. ill let yall know if I come up with a fix.
Top
#212368 - 2017-03-23 10:06 AM Re: False file version using GetFileVersion [Re: Schavuit]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
159 works properly if you copy Mssign32.dll and rename it to Mssign32-Copy.dll or something.
Which make this whole thing weird...

This points it out quicker:
 Code:
? CreateObject("Scripting.FileSystemObject").GetFileVersion("C:\Windows\System32\mssign32 - Copy.dll")
? CreateObject("Scripting.FileSystemObject").GetFileVersion("C:\Windows\System32\mssign32.dll")


But luckily WMI doesn't fail \:\)
 Code:
? GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select * from CIM_Datafile Where Name = 'c:\\windows\\system32\\mssign32.dll'").ItemIndex(0).Version

Top
#212370 - 2017-03-23 02:41 PM Re: False file version using GetFileVersion [Re: Arend_]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
The WMI Code in Function format.

 Code:
function WMIFileVersion($FQFN)
  dim $RC,$NVIS
  $NVIS=setoption("NoVarsinstrings","On")
  if exist($FQFN)
    $RC=execute('$WMIFileVersion=GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select * from CIM_Datafile Where Name =' + "'" + $FQFN + "'" + '").ItemIndex(0).Version')
  endif
  $RC=setoption("NoVarsinstrings",$NVIS)  
endfunction


Didn't look into it very deep, but even this one had trouble determining a version of at least one exe, it came back with nothing. At least there are options here.


Top
#212372 - 2017-03-24 01:09 AM Re: False file version using GetFileVersion [Re: Allen]
Schavuit Offline
Fresh Scripter

Registered: 2016-09-30
Posts: 14
Loc: South Korea
Sweet deal Im now using (see below) in my code and it works!
 Code:
? GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select * from CIM_Datafile Where Name = 'c:\\windows\\system32\\mssign32.dll'").ItemIndex(0).version


Thanks for all the help

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 255 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.047 seconds in which 0.015 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org