Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-02

Detecting windows version within plain DOS Pascal command.com win dow

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Cox, Stuart SRM:EX

Is there a code snippet that would allow me to detect the version of windows that my dos box is running within?

I've got NT4 on the machine at work and its NT reports DOS version $0005 and my code doesn't detect windows at all using the SWAG code for detecting Win3.1 or Win3.11. I'm using Turbopower's opDOS for its DOSversion routine.

This OS is the only one that I've had an opportunity to check what my code reports, so far. I've got ME, 3.11 in enhanced mode, DR6.0 and MS6.22 to try it out on.

I'd like to be able to detect all likely combinations and the NT thing that manages to hide itself so well too.

Stuart Cox
Map Generalization Technician, not
Forest Inventory and Monitoring Branch
Ministry of Sustainable Resource Management
······················································ Phone: (250)387-5529
FAX: (250)356-9430
email
View the FMIB Website at:
http://www.for.gov.bc.ca/resinv/homepage.htm

Reply by email

MPDJ
to Cox, Stuart SRM:EX

I asked this question several months ago, and this list was, as usual, very helpful with it's replies.
I still have several snippets of that thread, which I've pasted below to give you a start.

Ralf Quint offered the following information / code :-

-------------

Show quoted text 15 lines
I don't know if it works under GO32, but you can test for Windows with INT 2Fh, AX=160Ah. var t : byte; valu : word; BEGIN {Inline assembler or macro is necessary to make the multiple because Turbo Pascal only *fakes* INTR procedure -- i.e., t work: var regs : registers; ... regs.ax := $1600; intr($2F,regs); valu := regs.al

}
This comment isn't closed

Show quoted text 11 lines
ASM MOV AX, 1600h INT 2Fh MOV valu, AX END; Writeln (lo(valu) ); end. And then the source snippet compiles, and the created program resturns a 4 here on my Win98 machine.

----------

And from Tomas Hajny:-

>AFAIK int2F-detect does not work with Windows NT's DOS-emulator. It >can be detected by checking the environment strings: OS=Windows_NT. >(I have no info how Win2k does this)

WinNT dos box can be detected

thru INT21h/AX=3306h - NT dos box always

returns 3205h in bx (while

other OSs never report this version number)... You might have a look at http://www.volweb.cz/xhajt03/dosver.zip, there's

quite a

comprehensive check for different DOS environments. It's plain 16-bit

assembly, but it should > be enough for learning all the checks.

----------

I personally used Ralfs method successfully. I do not know the result of executing on WinNT as I don't have a copy available and my software is not designed to run on NT.

I hope this helps.

Andy

---
Goddammit people - This email has NO virus in it - OK? Don't believe me - tough !
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.325 / Virus Database: 182 - Release Date: 19/02/02

Reply by email