Re: Need an other phix explanation please
- Posted by begin Feb 24, 2018
- 2334 views
global function getWinVersion() sequence lResult atom lOV atom lResp lOV = w32to_memory(0,ID_OSVERSIONINFOEX,0) lResp = w32Func(xGetVersionEx, {lOV}) lResult = repeat(0,9) if lResp=0 then w32store(lOV, dwOSVersionInfoSize, SIZEOF_OSVERSIONINFO) lResp = w32Func(xGetVersionEx, {lOV}) end if lResult[1..4] = peek4s({lOV+4, 4}) lResult[5] = w32peek_string(lOV+20) <======================= 954 lResult[6] = w32fetch(lOV,wServicePackMajor) lResult[7] = w32fetch(lOV,wServicePackMinor) lResult[8] = w32fetch(lOV,wSuiteMask) lResult[9] = w32fetch(lOV,wProductType) w32release_mem(lOV) if lResult[1]=6 then lResult[1] = WIN_VISTA elsif lResult[4]=0 then lResult[1] = WIN_3_1 elsif lResult[4]=1 then if lResult[2]=0 then if equal(lResult[5], " C") then lResult[1] = WIN_95_OSR2 else lResult[1] = WIN_95 end if elsif lResult[2]=10 then if equal(lResult[5], " A") then lResult[1] = WIN_98SE else lResult[1] = WIN_98 end if else lResult[1] = WIN_ME end if lResult[3] = and_bits(#FFFF, lResult[3]) else if lResult[2]=51 then lResult[1] = WIN_NT_3_51 elsif lResult[2]=0 then if lResult[1]=4 then lResult[1] = WIN_NT_4 else lResult[1] = WIN_2000 end if elsif lResult[2]=1 then lResult[1] = WIN_XP else lResult[1] = WIN_UNKNOWN end if end if lResult[2] = lResult[5] if lResult[6]=0 then lResult = lResult[1..3] else lResult = lResult[1..3] & lResult[6..9] end if return lResult end function