X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=EuWQ6KaAZjayQyItL64PeJUHjyND1XJzIw/CQGY4Mec=; b=RwP2Ai+z8PZzlRSZZrQ5quUdTv/CSsYAnzI25dJhc5nXjC2v3xk6kRefFPxH3mnC/w wsvONibcmbp8j9YtKPBITZNsvZ21CI5M8crZwLo9upfw2QBC1XBuWQNKiqfMXnfqDqg3 yqf9O+tSCQlv34cgG/P0SNSyBEm1iZSOyveyDxe4tGoBcszulcHLnKQ9vaBtw2qUBQFd ufbkL13TBV8/kG87lpx018m7d9ss6rzJkRdKH3rQRSmaH0rXeC9r3T5GIywYjilABA5g prWtLLagDkJpe/hI7yZ3iyLCh5DirfJneF8gttOKNr1DE5pM5/N08eumcJcKCFh4jO5s xmkg== MIME-Version: 1.0 X-Received: by 10.42.205.132 with SMTP id fq4mr24527666icb.33.1434959432324; Mon, 22 Jun 2015 00:50:32 -0700 (PDT) In-Reply-To: <5587B696.10304@gmail.com> References: <201506091712 DOT t59HCPci004068 AT delorie DOT com> <557739E0 DOT 6070608 AT gmail DOT com> <55775E64 DOT 2090901 AT gmail DOT com> <5579ED42 DOT 6070309 AT gmail DOT com> <5579FE8D DOT 3080501 AT gmail DOT com> <557B436F DOT 1050101 AT gmx DOT de> <779efaf6-8ebf-4f2a-a526-a2773e3909b4 AT googlegroups DOT com> <4131b54f-b34d-4a84-ada6-3443ed9efce9 AT googlegroups DOT com> <20150618-004800 DOT 313 DOT 0 AT Your-Name-Here DOT News> <65ad24c7-0888-4526-9395-e262f348a021 AT googlegroups DOT com> <5584B697 DOT 60303 AT gmail DOT com> <5587B696 DOT 10304 AT gmail DOT com> Date: Mon, 22 Jun 2015 10:50:32 +0300 Message-ID: Subject: Re: Detecting Windows NT in DJGPP From: "Ozkan Sezer (sezeroz AT gmail DOT com)" To: djgpp AT delorie DOT com Content-Type: text/plain; charset=UTF-8 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 6/22/15, Frank Sapone (emoaddict15 AT gmail DOT com) wrote: > Hey everyone, > > Quake 1 has a rather simple test for detecting if it's being run on > Windows 9x: > > __dpmi_regs r; > > r.x.ax = 0x160a; /* Get Windows Version */ > __dpmi_int(0x2f, &r); > > if(r.x.ax || r.h.bh < 4) /* Not windows or earlier than Win95 > */ > > else > > > I'd like to detect if the program is running in NTVDM/Win XP/etc. I > know you can check for WINDIR as an evironment string, but that could be > unreliable > from someone with a bad autoexec.bat. > > Is there any other way to detect if it's in an NT environment? > > Frank The allegro library (allegro-4.2.3.1, http://alleg.sourceforge.net/) has a detect_os() procedure in its src/dos/dsystem.c. Its NT detection is based on environment variable check, though, along with a call to _get_dos_version(). -- O.S.