From: Jos v.d.V. <jo...@us...> - 2015-08-19 10:53:24
|
Update of /cvsroot/win32forth/win32forth/src In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16376 Modified Files: Extend.f Utils.f Winversion.f Log Message: Jos: Adapted for Windows 10. Index: Utils.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/Utils.f,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Utils.f 9 Dec 2013 21:25:16 -0000 1.32 --- Utils.f 19 Aug 2015 10:53:22 -0000 1.33 *************** *** 52,59 **** \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ : .platform ( -- ) \ W32F Tools extra in-system \ *G Display the Windows platform the system is running on. ! cr ." Platform: Windows " ! winver case [ version# ((version)) 0. 2swap >number 3drop 7 < ] [if] \ For V6.xx.xx suporting older OSs WIN95 of ." 95" endof --- 52,73 ---- \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ + also hidden + + : .reg_WNT\Version ( key$ len -- ) \ W32F Tools extra in-system + \ *G Display the string of the specified registry key in + \ ** HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion + WNT\Version GetRegistryEntry 1- dup 0> + if type else 2drop then ; + previous + + : .platform-nt ( -- ) \ W32F Tools extra in-system + \ *G Display the Windows-NT platform the system is running on. + s" ProductName" .reg_WNT\Version ; + : .platform ( -- ) \ W32F Tools extra in-system \ *G Display the Windows platform the system is running on. ! winver cr ." Platform: " dup WIN2K < ! if ." Windows " then ! case [ version# ((version)) 0. 2swap >number 3drop 7 < ] [if] \ For V6.xx.xx suporting older OSs WIN95 of ." 95" endof *************** *** 62,74 **** WINNT351 of ." NT3.51" endof WINNT4 of ." NT4" endof ! [then] WIN2K of ." 2000" endof ! WINXP of ." XP" endof ! WIN2003 of ." SERVER 2003 R2" endof ! WINVISTA of ." VISTA" endof ! WIN2008 of ." SERVER 2008" endof ! WIN2008R2 of ." SERVER 2008 R2" endof ! WIN7 of ." WIN7" endof ! WIN8 of ." WIN8" endof ! endcase ; \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ --- 76,85 ---- WINNT351 of ." NT3.51" endof WINNT4 of ." NT4" endof ! [then] ! WIN2008 of ." Windows SERVER 2008" endof ! WIN2008R2 of ." Windows SERVER 2008 R2" endof ! WIN2K >= true ! of .platform-nt endof ! endcase ; \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Index: Extend.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/Extend.f,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Extend.f 16 Feb 2015 15:39:23 -0000 1.34 --- Extend.f 19 Aug 2015 10:53:22 -0000 1.35 *************** *** 14,17 **** --- 14,19 ---- sys-FLOAD src\module.f \ scoping support for modules sys-FLOAD src\interpif.f \ interpretive conditionals + FLOAD src\pointer.f + FLOAD src\registry.f \ Win32 Registry support FLOAD src\WinVersion.f \ Windows Versioning *************** *** 22,26 **** sys-FLOAD src\asmwin32.f \ NEXT for Win32forth - FLOAD src\pointer.f FLOAD src\callback.f \ windows callback support FLOAD src\primhash.f \ primitive hash functions for OOP later --- 24,27 ---- *************** *** 42,46 **** \ FLOAD src\scrnctrl.f \ screen control words - FLOAD src\registry.f \ Win32 Registry support FLOAD src\ansfile.f \ ansi file words FLOAD src\keyboard.f \ function and special key constants --- 43,46 ---- *************** *** 137,140 **** s" Win32for.exe" prepend<home>\ (AddCheckSum) ! 1 pause-seconds --- 137,140 ---- s" Win32for.exe" prepend<home>\ (AddCheckSum) ! 2 pause-seconds Index: Winversion.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/Winversion.f,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Winversion.f 17 Dec 2013 20:35:23 -0000 1.1 --- Winversion.f 19 Aug 2015 10:53:22 -0000 1.2 *************** *** 1,8 **** \ $Id$ ! \ ---------------- Operating System Checking -------------------------- ! \ Moved here from PrimUtil.f 1 PROC GetVersionEx --- 1,15 ---- \ $Id$ ! \ *D doc ! \ *! p-winversion W32F winversion ! \ *T Operating System Checking ! \ *P Untill windows 8 a call to GetVersionEx could be used to get the version information. \n ! \ ** To check for a version, say Win2K or greater, try WINVER WIN2K >= \n ! \ ** NOTE: The future V7.xx.xx and later will only support WIN2K or greater anyway. ! ! \ *S Glossary + \ Moved here from PrimUtil.f 1 PROC GetVersionEx *************** *** 13,17 **** --- 20,26 ---- 4 constant winnt351 5 constant winnt4 + [then] + 6 constant win2k 7 constant winxp *************** *** 22,32 **** 12 constant win7 \ Windows 7 13 constant win8 \ Windows 8 ! \ To check for a version, say Win2K or greater, try WINVER WIN2K >= ! \ NOTE The future V7.xx.xx and later will only support WIN2K or greaeter anyway. 0 value winver ! : winver-init ( -- ) \ get windows version 156 dup _localalloc dup>r ! \ set length of OSVERSIONINFOEX structure r@ call GetVersionEx \ call os for version --- 31,78 ---- 12 constant win7 \ Windows 7 13 constant win8 \ Windows 8 + 14 constant win10 \ Windows 10 ! also hidden ! ! : GetRegistryEntry ( vadr vlen root-key Zsection samDesired -- dadr dlen|0 ) ! \ *G Retrieves the data of any registry key. ! \ ** Parameters: ! \ ** vadr,vlen = the registry key value string to read. ! \ ** root-key = One of the first predefined keys EG: HKEY_CLASSES_ROOT ! \ ** Zsection = 0 terminated registry key section string. ! \ ** samDesired = security access mask. ! \ ** dadr,dlen = returns the data and size. ! 0 0 locals| reglen regtype | ReturnedKey$ off ! (RegCreateKey) dup -1 = ! if drop ReturnedKey$ count exit \ return on error, empty data ! then >r drop >r ! MAXCOUNTED to reglen \ init max length of string ! &of reglen ! ReturnedKey$ 1+ ! &of regtype ! 0 ! r> ! r@ ! Call RegQueryValueEx ! if ReturnedKey$ off \ Can not access the registry-key ! else reglen 0max ReturnedKey$ c! \ Includes the 0 for REG_SZ types ! then ! ReturnedKey$ count r> Call RegCloseKey drop ; ! ! previous internal ! ! : WNT\Version ( - hklm Zsection samDesired ) ! HKEY_LOCAL_MACHINE z" SOFTWARE\Microsoft\Windows NT\CurrentVersion" KEY_EXECUTE ; ! ! : GetVersionWin8+ ( -- winver ) ! s" CurrentMajorVersionNumber" WNT\Version ! GetRegistryEntry 0> if @ 4 + else drop -2 then ; ! ! external 0 value winver ! : winver-init ( -- ) ! \ *G Gets the windows version and stores it in winver. 156 dup _localalloc dup>r ! \ set length of OSVERSIONINFOEX structure r@ call GetVersionEx \ call os for version *************** *** 64,79 **** case 0 of r@ 154 + c@ \ Product Type ! VER_NT_WORKSTATION = if winvista \ Windows Vista ! else win2008 \ Windows Server 2008 then endof 1 of r@ 154 + c@ \ Product Type ! VER_NT_WORKSTATION = if win7 \ Windows 7 else win2008r2 \ Windows Server 2008 R2 then endof 2 of r@ 154 + c@ \ Product Type ! VER_NT_WORKSTATION = if win8 \ Windows 8 ! else win2008r2 \ Windows Server 2008 R2 then endof --- 110,126 ---- case 0 of r@ 154 + c@ \ Product Type ! VER_NT_WORKSTATION = if winvista \ Windows Vista ! else win2008 \ Windows Server 2008 then endof 1 of r@ 154 + c@ \ Product Type ! VER_NT_WORKSTATION = if win7 \ Windows 7 else win2008r2 \ Windows Server 2008 R2 then endof + 2 of r@ 154 + c@ \ Product Type ! VER_NT_WORKSTATION = if GetVersionWin8+ \ Windows 8 or better ! else win2008r2 \ Windows Server 2008 R2 then endof *************** *** 88,92 **** --- 135,142 ---- ; + previous initialization-chain chain-add winver-init winver-init + \S + \ *Z |