[fpc-pascal]Detecting windows version within plain DOS Pascal command.com win dow
MPDJ
MPDJ at btinternet.com
Fri Mar 1 12:56:06 CET 2002
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 :-
-------------
> 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
> 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
More information about the fpc-pascal
mailing list