1. OScheck
From: C. K. Lester:
>P.S. On the dir95 program, it apparently doesn't work in DOS-16 bit,
>correct? So, how do I determine if a program is running on a 32-bit
>machine or if it's running on a 16-bit machine (whatever DOS/Win3.1 is)?
>I was thinking all I'd have to do is set a variable after checking, then
>have the appropriate dir() called according to that variable.
I haven't used dir95, but this should check for DOS 7.0 (the Windows 95
version). I don't know how to check for Win3.1 with the 32-bit add-on DLL
right off hand, or even whether that lets you use long filenames...
--------begin code-------------------------------------------
include machine.e
function DOS7_Check()
--Checks for presence of DOS 7.00+
--Returns 1 if found, else 0.
sequence registers
registers = repeat( 0, 10 )
registers[REG_AX] = #4A33
registers = dos_interrupt( #2F, registers )
if registers[REG_AX] = 0 then
return( 1 )
else
return( 0 )
end if
end function
---------------end code--------------------------------------
That should be all you need for what you want to do, but if not
this one'll give you more data, including Win95 version and
whether you're running OS2, but it's not always accurate.
--------begin code-------------------------------------------
function DOS_Ver()
--Get DOS version,
--Return { iMajor, iMinor, sProduct, sOEM }
--Note: version number may be that set by SETVER rather than
-- the true one, also Product and OEM will be null strings if
-- not applicable/known. Also, several flavors of DOS report
-- incorrect data.
sequence registers, info
integer OEM
info = { 0, 0, {}, {} }
registers = repeat( 0, 10 )
registers[REG_AX] = #3000
registers = dos_interrupt( #21, registers )
info[1] = and_bits( registers[REG_AX], #00FF )
info[2] = and_bits( registers[REG_AX], #FF00 )/256
if info[1] = #00 then info[1] = #01
elsif info[1] = #0A then info[3] = "OS/2 v1.x"
elsif info[1] = #14 then
if info[2] = #1E then info[3] = "OS/2 Warp 3"
elsif info[2] = #28 then info[3] = "OS/2 Warp 4"
else info[3] = "OS/2 v2.x"
end if
elsif info[1] = #07 then
if info[2] = #00 then info[3] = "Windows 95"
elsif info[2] = #0A then info[3] = "Windows 95 OSR 2"
end if
end if
OEM = and_bits( registers[REG_BX], #FF00 )/256
if OEM = #00 then info[4] = "IBM"
elsif OEM = #01 then info[4] = "Compaq"
elsif OEM = #02 then info[4] = "MS Packaged Product"
elsif OEM = #04 then info[4] = "AT&T"
elsif OEM = #05 then info[4] = "ZDS (Zenith Electronics)"
elsif ((OEM = #06) or
(OEM = #4D)) then info[4] = "Hewlett-Packard"
elsif OEM = #07 then info[4] = "ZDS (Groupe Bull)"
elsif OEM = #0D then info[4] = "Packard-Bell"
elsif OEM = #16 then info[4] = "DEC"
elsif OEM = #23 then info[4] = "Olivetti"
elsif OEM = #28 then info[4] = "Texas Instruments"
elsif OEM = #29 then info[4] = "Toshiba"
elsif OEM = #33 then info[4] = "Novell" --*
elsif ((OEM = #34) or --*
(OEM = #35)) then info[4] = "MS Multimedia Systems"--*
elsif OEM = #5E then info[4] = "RxDOS"
elsif OEM = #66 then info[4] = "PhysTechSoft (PTS-DOS)"
elsif OEM = #99 then info[4] = "General Software's Embedded DOS"
elsif OEM = #EE then info[4] = "DR DOS"
elsif OEM = #EF then info[4] = "Novell DOS"
elsif OEM = #FD then info[4] = "FreeDOS"
elsif OEM = #FF then info[4] = "Microsoft, Phoenix"
end if --* Windows/386 device IDs only for these 3
return( info )
end function
---------------end code--------------------------------------
And this last one checks for the true DOS version, rather than
the one set by SETVER in DOS 5+. Also tells ya if you're running
Windows NT.
--------begin code-------------------------------------------
function DOS_TrueVer()
--Returns {iMajor, iMinor}
--or -1 if true DOS version is < 5.0
--or 0 if a conflict prevented identification
--Note: { 5, 50 } = Windows NT
-- { 20, 10 } = OS/2 v2.1
-- { 7, 0 } = Windows 95
-- { 7, 10 } = Windows 95 OSR 2
sequence registers, info
info = { 0, 0 }
registers = repeat( 0, 10 )
registers[REG_AX] = #3306
registers = dos_interrupt( #21, registers )
if (( and_bits( registers[REG_AX], #00FF ) = #FF ) or
( and_bits( registers[REG_FLAGS], 1 ) and
( registers[REG_AX] = #0001 ) ) ) then
return( -1 )
else
info[1] = and_bits( registers[REG_BX], #00FF )
info[2] = and_bits( registers[REG_BX], #FF00 )/256
end if
if ((info[2] > #64) or (info[1] < #05)) then
return( 0 )
end if
return( info )
end function
---------------end code--------------------------------------
Incidentally, I don't know what the first version of DOS capable of
running 32-bit protected mode was... I'd guess 3.31 on a 286, but I might
be wrong. Euphoria's readme says it runs on at least DOS 4.0 on a 386. It
always runs in 32-bit mode, but DOSes < 7.0 don't have long filename
support, even if they are in 32-bit mode. (as far as I know)
Anyway, those three functions have been tested and work properly on my
PC, but I don't have any other PCs or other DOSes besides 7.10 to test 'em
on.
Falkon