delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/23/08:30:15

From: "A. Sinan Unur" <sinan DOT unur AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Determining Operating System
Date: Tue, 23 Dec 1997 07:37:09 -0500
Organization: Cornell University (http://www.cornell.edu/)
Lines: 67
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <349FB075.80BEC634@cornell.edu>
References: <B0B1D71B83 AT AKF DOT DK>
NNTP-Posting-Host: cu-dialup-0057.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Finn Kettner wrote:
<snip> 

> PS. We are only using Windows 3.11, W95 and WinNT, and it is the
> destinction between the three operating systems I'd like to make.

here's something i used some time ago, which (i think) distinguishes
between win 3.1x and win95. i think the way to disinguish nt is that it
returns a unique dos version, but i am not sure.

#include <dpmi.h>

int main(void)
{
 _go32_dpmi_registers regs;
	
 memset(&regs, 0, sizeof(regs));
 regs.x.ax = 0x1600;
	
 _go32_dpmi_simulate_int(0x2F, &regs);

 return regs.h.al;
}

batch file:

@echo off
wincheck.exe
if not errorlevel 4 goto WIN3
echo:Windows 95
goto EXIT
:WIN3
if not errorlevel 3 goto OOPS
echo:Windows 3.x
goto EXIT
:OOPS
echo:Windows version less than 3
:EXIT

if you want, you can compile the following asm to a com using nasm (the
resulting executable will be tiny compared to the djgpp version):

	  BITS 16
	  ORG 0x100

	  SECTION .text

start     mov ax, 0x1600
          int 0x2f 
end       mov ah,0x4c
	  int 0x21

details can be found in ralph brown's interrupt list:

int 2f 1600
int 2f 1604
int 21 30

hth.
-- 
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA

mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/

- Raw text -


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