www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/21/03:06:26

From: Richard Dawe <richdawe AT bigfoot DOT com>
Newsgroups: comp.os.msdos.programmer,comp.os.msdos.djgpp
Subject: Re: Is DOS dead?
Date: Mon, 20 Mar 2000 22:13:40 +0000
Organization: Customer of Planet Online
Lines: 57
Message-ID: <38D6A294.670F7954@bigfoot.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000314094608 DOT 4527E-100000 AT is> <38CE19B2 DOT 69C7 AT gmx DOT net> <Pine DOT SUN DOT 3 DOT 91 DOT 1000315104128 DOT 17230G-100000 AT is> <38CF7CED DOT 505A AT gmx DOT net> <Pine DOT SUN DOT 3 DOT 91 DOT 1000315185511 DOT 20407P-100000 AT is> <38D0B4D1 DOT 380F AT gmx DOT net> <Pine DOT SUN DOT 3 DOT 91 DOT 1000316172141 DOT 5735H-100000 AT is> <38D11897 DOT 2ED0 AT gmx DOT net> <Pine DOT SUN DOT 3 DOT 91 DOT 1000319103934 DOT 13691A-100000 AT is> <38D4BCD3 DOT 767ACF49 AT gmx DOT net> <Pine DOT SUN DOT 3 DOT 91 DOT 1000319161058 DOT 15795B-100000 AT is> <38D508CC DOT 5F3EA970 AT gmx DOT net> <Pine DOT SUN DOT 3 DOT 91 DOT 1000320114850 DOT 24837F-100000 AT is> <fm1ddsc2vpue4j23lroq83rhghn628a26t AT 4ax DOT com>
NNTP-Posting-Host: modem-211.jewel-puffer.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news7.svr.pol.co.uk 953590593 31463 62.137.33.211 (20 Mar 2000 22:16:33 GMT)
NNTP-Posting-Date: 20 Mar 2000 22:16:33 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Damian Yerrick wrote:
> Isn't there a "Get version of Windows" interrupt call?  Wouldn't it
> return 4.x for NT 4.x and 5.x for 2000?  Allegro seems to be able to
> get the version number of the running GUI quite nicely.  Or is it
> implemented on the 3.1/9x fork only?

Well, here's the code (for DJGPP) I have in libsocket:

int __get_windows_version (void)
{
        union REGS r;
        int win_version;
    
        /* Get the windows version with INT 0x2F sub-function 0x160A,
         * Windows 3.1+ installation check. This version check isn't
         * amazing, but is probably enough because if the version isn't
         * right then the VxDs will fail to load anyway. */
        bzero ((void *) &r, sizeof (r));

        r.x.ax = 0x160A;
        int86(0x2F, &r, &r);
        
        if (r.h.bh == 3) {
                win_version = WIN_311;
        } else if (r.h.bh > 3) {
                /* TODO: Distinguish between '95, '98? */
                /* Windows '95 or '98 */
                win_version = WIN_95;
        } else {
                win_version = WIN_NONE;
        }

        /* If win_version is WIN_NONE, then we need to use the DOS version
         * to determine if this is Windows NT. Thanks to Allegro (Shawn
         * Hargreaves et al) for this method. It's also in Ralph Brown's
         * Interrupt list,
         * INT 0x21, AX = 0x3306. */
        if (win_version == WIN_NONE) {
                if (_get_dos_version(1) == 0x532) {
                        win_version = WIN_NT;
                }
        }
        
        return(win_version);
}

WIN_* are in an enum. BTW I haven't tried this under Windows NT, but I
think it'll work. I don't know what Win2k will return for
_get_dos_version().

HTH, bye,

-- 
Richard Dawe
richdawe AT bigfoot DOT com ICQ 47595498 http://www.bigfoot.com/~richdawe/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019