Re: Windows version number
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM> Apr 13, 1999
- 514 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/