Message-Id: <3.0.1.16.19970818090815.21c702ee@mailhost.sm.ic.ac.uk> Date: Mon, 18 Aug 1997 09:08:15 To: djgpp AT delorie DOT com From: Paul Dixon

Subject: Re: Detecting NT Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk The following code is tested and works as expected on all of vanilla DOS, Win3x, Win95, WinNT351, WinNT4 (ie _get_win_version returns non-zero for Win3x and Win95, _detect_NT returns 0 for all others, non-zero for both NT flavours). The call to _get_win_version() in _detect_NT is actually superfluous but is in the code as used and tested (the project that it was snipped from tests absolutely _everything_ it can in case it needs to crash-dump!) I have NOT yet identified a way of distinguishing between the two versions of NT - any ideas? Paul ------------------------------------------------------------------------------ #include #include /* Return windows version number, or 0 if not returned */ unsigned short _get_win_version() { __dpmi_regs regs; regs.x.ax = 0x160a; __dpmi_int(0x2f, ®s); if (regs.x.ax) return 0; else return regs.x.bx; } /* Recognise NT - works for both NT3.51 and NT4.0 */ int _detect_NT() { return (_get_win_version() == 0 && _get_dos_version(1) == 0x532); }