1. Windows version number
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM> Apr 11, 1999
- 357 views
- Last edited Apr 12, 1999
Hi, here is some code to print what version of windows you are running: -- winver.ex include machine.e sequence regs regs = repeat(0,10) regs[REG_AX] = #1600 regs = dos_interrupt(#2F, regs) printf(1, "Windows version: %d.%d\n", and_bits(regs[REG_AX]/{1,#100},#FF)) -- code ends Now could someone run this under Windows NT and tell me what numbers it prints out? Thanks, _______ ______ _______ ______ [ _ \[ _ ][ _ _ ][ _ ] [/| [_] |[/| [_\][/ | | \][/| [_\] | ___/ | _] | | | _] [\| [/] [\| [_/] [\| |/] [\| [_/] [_____] [______] [_____] [______] xseal at harborside.com ICQ:13466657 http://www.harborside.com/home/x/xseal/euphoria/
2. Re: Windows version number
- Posted by Nick <metcalfn at ALPHALINK.COM.AU> Apr 12, 1999
- 382 views
- Last edited Apr 13, 1999
Hi, Pete. Under NT 3.50 it tells me I have windows version 0.22 --Nick Pete Eberlein wrote: > Hi, > > here is some code to print what version of windows you are running: > > -- winver.ex > > include machine.e > > sequence regs > regs = repeat(0,10) > regs[REG_AX] = #1600 > regs = dos_interrupt(#2F, regs) > > printf(1, "Windows version: %d.%d\n", and_bits(regs[REG_AX]/{1,#100},#FF)) > > -- code ends > > Now could someone run this under Windows NT and tell me what numbers it > prints out? > > Thanks, > _______ ______ _______ ______ > [ _ \[ _ ][ _ _ ][ _ ] > [/| [_] |[/| [_\][/ | | \][/| [_\] > | ___/ | _] | | | _] > [\| [/] [\| [_/] [\| |/] [\| [_/] > [_____] [______] [_____] [______] > xseal at harborside.com ICQ:13466657 > http://www.harborside.com/home/x/xseal/euphoria/
3. Re: Windows version number
- Posted by "C. K. Lester" <cklester at TICNET.COM> Apr 12, 1999
- 343 views
Pete, I got this: Windows version: 0.22 Weird. HTH, ck At 11:49 PM 4/11/99 -0700, you wrote: >Hi, > >here is some code to print what version of windows you are running:
4. Re: Windows version number
- Posted by "M. Schut" <m.schut at TWI.TUDELFT.NL> Apr 13, 1999
- 358 views
- Last edited Apr 14, 1999
>Hi, > >here is some code to print what version of windows you are running: > >-- winver.ex > >include machine.e > >sequence regs >regs = repeat(0,10) >regs[REG_AX] = #1600 >regs = dos_interrupt(#2F, regs) > >printf(1, "Windows version: %d.%d\n", and_bits(regs[REG_AX]/{1,#100},#FF)) > >-- code ends > >Now could someone run this under Windows NT and tell me what numbers it >prints out? This source is as complete as I know to detect the windows-version (including ver. 2.x and I think 1.x will return ver 0.0) and the mode (real/standard/enhanced) it is running in. Unfortunatly the only method I know to detect the presence of Windows NT, is reading the environment-variable 'OS' which seems to be always present on Win NT machines. ( At least at the machines at my university :) I don't know how to get the version of Win NT, anybody else does? Maybe with the Windows API? Martin Schut P.S. Sorry but the source is currently in Pascal. I will translate it into Euphoria someday. However I think Pascal is easy enough to understand what it is doing, so you can translate it by yourself. P.P.S. Note that Pascal passes parameters BY REFERENCE so the function returns the mode and put the major and minor version in the variables bound to major and minor. I know this is not a 'clean' way, but it is the quickest to get all win-version info. Euphoria sequences would have been nice here (or a Pascal-type) Unit WinVer; Interface Function WindowsMode(Var major, minor: Integer): Integer; Const NO_WIN = $00; Const W_386_X = $01; Const W_REAL = $81; Const W_STANDARD = $82; Const W_ENHANCED = $83; Const W_NT = $FF; Implementation Uses Dos; Const MULTIPLEX = $2F; {*** WindowsVersion *** F *************************************************} Function WindowsMode(Var major, minor: Integer): Integer; Var regs: Registers; Var mode: Integer; Begin major := 0; minor := 0; regs.ax := $1600; Intr(MULTIPLEX,regs); mode := regs.ax; Case (Lo(mode)) Of $01, $FF: Begin major := 2; minor := 0; WindowsMode:= W_386_X; End; $00, $80: Begin regs.ax := $4680; Intr(MULTIPLEX, regs); If (regs.al = $80) Then WindowsMode := NO_WIN Else Begin regs.ax := $1605; regs.bx := $0000; regs.si := $0000; regs.cx := $0000; regs.es := $0000; regs.ds := $0000; regs.dx := $0001; Intr(MULTIPLEX, regs); If (regs.cx = $0000) Then Begin regs.ax := $1606; Intr(MULTIPLEX, regs); WindowsMode := W_REAL; End Else WindowsMode := W_STANDARD; End; End; Else Begin major := Lo(mode); minor := Hi(mode); WindowsMode := W_ENHANCED; End; End; If GetEnv('OS') = 'Windows_NT' Then WindowsMode := W_NT; End; End.
5. Re: Windows version number
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM> Apr 13, 1999
- 378 views
> This source is as complete as I know to detect the windows-version > (including ver. 2.x and I think 1.x will return ver 0.0) and the mode > (real/standard/enhanced) it is running in. Unfortunatly the only method > I know to detect the presence of Windows NT, is reading the > environment-variable 'OS' which seems to be always present on Win NT > machines. ( At least at the machines at my university :) > I don't know how to get the version of Win NT, anybody else does? Maybe > with the Windows API? > > Martin Schut Thanks for the Pascal code, Martin. I converted it to Euphoria: ----------------------------------------------------------------- -- winmode.ex constant NO_WIN = #00 constant W_386_X = #01 constant W_REAL = #81 constant W_STANDARD = #82 constant W_ENHANCED = #83 constant W_NT = #FF include machine.e constant MULTIPLEX = #2F function WindowsMode() -- returns {mode, major, minor} sequence regs integer mode, major, minor major = 0 minor = 0 regs = repeat(0, 10) regs[REG_AX] = #1600 regs = dos_interrupt(MULTIPLEX,regs) mode = regs[REG_AX] if and_bits(mode,255) = #01 or and_bits(mode,255) = #FF then major = 2 minor = 0 mode = W_386_X elsif and_bits(mode,255) = #00 or and_bits(mode,255) = #80 then regs[REG_AX] = #4680 regs = dos_interrupt(MULTIPLEX,regs) if and_bits(regs[REG_AX],255) = #80 then mode = NO_WIN else regs[REG_AX] = #1605 regs[REG_BX] = #0000 regs[REG_SI] = #0000 regs[REG_CX] = #0000 regs[REG_ES] = #0000 regs[REG_DI] = #0000 regs[REG_DX] = #0001 regs = dos_interrupt(MULTIPLEX,regs) if regs[REG_CX] = #0000 then regs[REG_AX] = #1606 regs = dos_interrupt(MULTIPLEX,regs) mode = W_REAL else mode = W_STANDARD end if end if else major = and_bits(mode,255) minor = floor(mode / 256) mode = W_ENHANCED end if if equal(getenv("OS"), "Windows_NT") then mode = W_NT end if return {mode, major, minor} end function ? WindowsMode() ----------------------------------------------------------------- I didn't really need to know the version number for NT, just whether or not it is running. The OS environment variable should do the trick then. So now I have to figure out exactly what is causing Neil programs to quietly terminate under NT, and not do that when NT is detected. Later, _______ ______ _______ ______ [ _ \[ _ ][ _ _ ][ _ ] [/| [_] |[/| [_\][/ | | \][/| [_\] | ___/ | _] | | | _] [\| [/] [\| [_/] [\| |/] [\| [_/] [_____] [______] [_____] [______] xseal at harborside.com ICQ:13466657 http://www.harborside.com/home/x/xseal/euphoria/