Implemented detection of DESQview, 4DOS, NDOS, Windows and OS/2.

This commit is contained in:
2000-08-06 18:16:10 +01:00
parent bb72d524eb
commit a2327c05d5
3 changed files with 183 additions and 16 deletions

View File

@@ -3,7 +3,7 @@
------------------------------------------------------------------------ ------------------------------------------------------------------------
Filename : int21h.c Filename : int21h.c
Version : 0.03 Version : 0.04
Author(s) : Natalia Portillo Author(s) : Natalia Portillo
Component : OWP DOS subsystem - VER command Component : OWP DOS subsystem - VER command
@@ -35,6 +35,10 @@
DOS version information. DOS version information.
All detect stuff moved to int21h.c. All detect stuff moved to int21h.c.
All defines moved to ver.h All defines moved to ver.h
0.04: Implemented detection of DESQview, 4DOS and NDOS.
Implemented detection of the Windows version.
Implemented detection of OS/2.
Implemented detection of Windows Millenium (tested with beta 3).
--[ How to compile ]---------------------------------------------------- --[ How to compile ]----------------------------------------------------
@@ -43,7 +47,7 @@
--[ Where to get help/information ]------------------------------------- --[ Where to get help/information ]-------------------------------------
This archaic and abandoned software is opensource with no warranty This archaic and abandoned software is opensource with no warranty
or help of any kind. or help of any kind.
For inquiries contact claunia@claunia.com. For inquiries contact claunia@claunia.com.
@@ -69,7 +73,7 @@
#include <dos.h> #include <dos.h>
void getdosver (int *DOS_FLAVOR, int *major, int *minor, int *sim_major, int *sim_minor, int *dos_oem) void getdosver (int *DOS_FLAVOR, int *major, int *minor, int *sim_major, int *sim_minor, int *dos_oem, int *desq_ma, int *desq_mi, int *_4dos_ma, int *_4dos_mi, int *ndos_ma, int *ndos_mi, int *win_ma, int *win_mi, int *win_mode)
{ {
union REGS regs; union REGS regs;
int dos_temp, nt_flag; int dos_temp, nt_flag;
@@ -120,6 +124,10 @@ void getdosver (int *DOS_FLAVOR, int *major, int *minor, int *sim_major, int *si
{ {
*DOS_FLAVOR=2; *DOS_FLAVOR=2;
} }
if(dos_temp == 0 && *major >= 10)
{
*DOS_FLAVOR=7;
}
if(dos_temp == 0xff && *major <= 6) if(dos_temp == 0xff && *major <= 6)
{ {
*DOS_FLAVOR=1; *DOS_FLAVOR=1;
@@ -135,6 +143,10 @@ void getdosver (int *DOS_FLAVOR, int *major, int *minor, int *sim_major, int *si
*DOS_FLAVOR=13; *DOS_FLAVOR=13;
} }
} }
if(dos_temp == 0xff && *major == 8)
{
*DOS_FLAVOR=14;
}
if(dos_temp == 253) if(dos_temp == 253)
{ {
*DOS_FLAVOR=4; *DOS_FLAVOR=4;
@@ -258,4 +270,66 @@ void getdosver (int *DOS_FLAVOR, int *major, int *minor, int *sim_major, int *si
} }
/* End of check for DR-DOS_FLAVOR versions */ /* End of check for DR-DOS_FLAVOR versions */
*dos_oem=dos_temp; *dos_oem=dos_temp;
*desq_ma=0;
*desq_mi=0;
regs.h.ah = 0x2b; /* Set function */
regs.x.cx = 0x4445; /* Set function */
regs.x.dx = 0x5351; /* Set function */
regs.h.al = 0x01; /* Set function */
int86 (0x21,&regs,&regs); /* Call INT 21h */
if(regs.h.al!=0xFF)
{
*desq_ma=regs.h.bh;
*desq_mi=regs.h.bl;
}
*_4dos_ma=0;
*_4dos_mi=0;
regs.h.bh = 0x00; /* Set function */
regs.x.ax = 0xD44D; /* Set 4DOS API */
int86 (0x2F,&regs,&regs); /* Call INT 2Fh */
if(regs.x.ax==0x44DD)
{
*_4dos_ma=regs.h.bl;
*_4dos_mi=regs.h.bh;
}
*ndos_ma=0;
*ndos_mi=0;
regs.h.bh = 0x00; /* Set function */
regs.x.ax = 0xE44D; /* Set 4DOS API (Well, NDOS is the Norton version of 4DOS */
int86 (0x2F,&regs,&regs); /* Call INT 2Fh */
if(regs.x.ax==0x44EE)
{
*ndos_ma=regs.h.bl;
*ndos_mi=regs.h.bh;
}
*win_ma=0;
*win_mi=0;
*win_mode=0;
regs.x.ax = 0x160A; /* Set function (Windows 3.1 or upper) */
int86 (0x2F,&regs,&regs); /* Call INT 2Fh */
if(regs.x.ax==0x0000)
{
*win_ma=regs.h.bh;
*win_mi=regs.h.bl;
*win_mode=regs.x.cx;
}
else
{
regs.x.ax = 0x1600; /* Set function (Windows/386 or upper in enhanced mode)*/
int86 (0x2F,&regs,&regs); /* Call INT 2Fh */
if(regs.h.al==0x01 || regs.h.al==0xFF)
{
*win_ma=2;
*win_mi=regs.h.ah;
*win_mode=3;
}
else if(regs.h.al >= 3)
{
*win_ma=regs.h.al;
*win_mi=regs.h.ah;
*win_mode=3;
}
else
*win_ma=*win_mi=0;
}
} }

102
ver.c
View File

@@ -3,7 +3,7 @@
------------------------------------------------------------------------ ------------------------------------------------------------------------
Filename : ver.c Filename : ver.c
Version : 0.03 Version : 0.04
Author(s) : Natalia Portillo Author(s) : Natalia Portillo
Component : OWP DOS subsystem - VER command Component : OWP DOS subsystem - VER command
@@ -35,6 +35,10 @@
DOS version information. DOS version information.
All detect stuff moved to int21h.c. All detect stuff moved to int21h.c.
All defines moved to ver.h All defines moved to ver.h
0.04: Implemented detection of DESQview, 4DOS and NDOS.
Implemented detection of the Windows version.
Implemented detection of OS/2.
Implemented detection of Windows Millenium (tested with beta 3).
--[ How to compile ]---------------------------------------------------- --[ How to compile ]----------------------------------------------------
@@ -43,7 +47,7 @@
--[ Where to get help/information ]------------------------------------- --[ Where to get help/information ]-------------------------------------
This archaic and abandoned software is opensource with no warranty This archaic and abandoned software is opensource with no warranty
or help of any kind. or help of any kind.
For inquiries contact claunia@claunia.com. For inquiries contact claunia@claunia.com.
@@ -70,24 +74,25 @@
#include <stdio.h> #include <stdio.h>
#include "ver.h" /* Include definitions */ #include "ver.h" /* Include definitions */
main() int main()
{ {
/* Declare variables */ /* Declare variables */
int dos_major,dos_minor,dostype,dos_sim_major,dos_sim_minor,dos_oem; int dos_major,dos_minor,dostype,dos_sim_major,dos_sim_minor,dos_oem,desq_ma,desq_mi,_4dos_ma,_4dos_mi,ndos_ma,ndos_mi,win_ma,win_mi,win_mode;
/* Put copyright info */ /* Put copyright info */
printf("%s %s %d.%s%s",SYSTEM,PROGRAM,MAJOR_VERSION,MINOR_VERSION_STRING,SUB_VERSION_STRING); printf("%s %s %d.%s%s",SYSTEM,PROGRAM,MAJOR_VERSION,MINOR_VERSION_STRING,SUB_VERSION_STRING);
printf("\nCopyright (c) %s\n\n",COPYRIGHT); printf("\nCopyright (c) %s\n\n",COPYRIGHT);
/* Get DOS version stuff */ /* Get DOS version stuff */
getdosver(&dostype, &dos_major, &dos_minor, &dos_sim_major, &dos_sim_minor, &dos_oem); getdosver(&dostype, &dos_major, &dos_minor, &dos_sim_major, &dos_sim_minor, &dos_oem, &desq_ma, &desq_mi, &_4dos_ma, &_4dos_mi, &ndos_ma, &ndos_mi, &win_ma, &win_mi, &win_mode);
/* Put version info */ /* Put version info */
if(dostype == 0) if(dostype == 0)
{ {
printf("\nUnknown DOS version %d.%d, that is simulating DOS %d.%d",dos_major,dos_minor,dos_sim_major,dos_sim_minor); printf("\nUnknown DOS version %d.%d, that is simulating DOS %d.%d",dos_major,dos_minor,dos_sim_major,dos_sim_minor);
printf("\nDOS OEM code %x",dos_oem); printf("\nDOS OEM code %x",dos_oem);
printf("\nPlease send this info and the O.S. name and version to\niosglpgc@teleline.es"); printf("\nPlease send this info and the O.S. name and version to\niosglpgc@teleline.es");
return(1);
} }
if(dostype == 1) if(dostype == 1)
{ {
@@ -134,6 +139,31 @@ main()
printf("simulating DOS version %d.%d\n",dos_sim_major,dos_sim_minor); printf("simulating DOS version %d.%d\n",dos_sim_major,dos_sim_minor);
} }
} }
if(dostype == 7)
{
printf("\nOS/2 ");
if(dos_major == 10)
{
printf("1.0\n");
}
else if(dos_major == 20 && dos_minor < 30)
{
printf("2.0\n");
}
else if(dos_major == 20 && dos_minor == 30)
{
printf("Warp 3\n");
}
else if(dos_major == 20 && dos_minor == 40)
{
printf("Warp 4\n");
}
else{printf("unknown version\n");}
if(dos_major != dos_sim_major || dos_minor != dos_sim_minor)
{
printf("simulating DOS version %d.%d\n",dos_sim_major,dos_sim_minor);
}
}
if(dostype == 8) if(dostype == 8)
{ {
printf("\nPTS-DOS, unknown version\n"); printf("\nPTS-DOS, unknown version\n");
@@ -169,10 +199,68 @@ main()
} }
if(dostype == 13) if(dostype == 13)
{ {
printf("\nWindows 95 OSR 2 or upper\n"); if(win_mi < 10)
{
printf("\nWindows 95 OSR 2 or OSR 3\n");
}
else if(win_mi >= 10)
{
printf("\nWindows 98 or 98 S.E.\n");
}
else
{
printf("\nWindows 95 OSR 2 or upper\n");
}
if(dos_major!=dos_sim_major || dos_minor!=dos_sim_minor) if(dos_major!=dos_sim_major || dos_minor!=dos_sim_minor)
{ {
printf("simulating DOS version %d.%d\n",dos_sim_major,dos_sim_minor); printf("simulating DOS version %d.%d\n",dos_sim_major,dos_sim_minor);
} }
} }
if(dostype == 14)
{
printf("\nWindows Millenium\n",dos_major,dos_minor);
if(dos_major != dos_sim_major || dos_minor != dos_sim_minor)
{
printf("simulating DOS version %d.%d\n",dos_sim_major,dos_sim_minor);
}
}
if(desq_ma >= 2)
{
printf("Running under DESQview %d.%d\n",desq_ma,desq_mi);
}
if(_4dos_ma >= 2)
{
if(_4dos_mi < 10)
printf("Running under 4DOS %d.0%d\n",_4dos_ma,_4dos_mi);
else
printf("Running under 4DOS %d.%d\n",_4dos_ma,_4dos_mi);
}
if(ndos_ma > 0)
{
printf("Running under NDOS %d.%d\n",ndos_ma,ndos_mi);
}
if(win_ma == 3 && win_mi < 10 && win_mode == 3)
{
printf("Running under Windows %d.%d in enhanced mode\n",win_ma,win_mi);
}
if(win_ma == 3 && win_mi >= 10)
{
if(win_mode == 2)
{
printf("Running under Windows %d.%d in standard mode\n",win_ma,win_mi);
}
else if(win_mode == 3)
{
printf("Running under Windows %d.%d in enhanced mode\n",win_ma,win_mi);
}
else
{
printf("Running under Windows %d.%d\n",win_ma,win_mi);
}
}
if(win_ma == 2 && win_mode == 3)
{
printf("Running under Windows/386 %d.%d\n",win_ma,win_mi);
}
return(0);
} }

17
ver.h
View File

@@ -3,7 +3,7 @@
------------------------------------------------------------------------ ------------------------------------------------------------------------
Filename : ver.h Filename : ver.h
Version : 0.03 Version : 0.04
Author(s) : Natalia Portillo Author(s) : Natalia Portillo
Component : OWP DOS subsystem - VER command Component : OWP DOS subsystem - VER command
@@ -35,6 +35,10 @@
DOS version information. DOS version information.
All detect stuff moved to int21h.c. All detect stuff moved to int21h.c.
All defines moved to ver.h All defines moved to ver.h
0.04: Implemented detection of DESQview, 4DOS and NDOS.
Implemented detection of the Windows version.
Implemented detection of OS/2.
Implemented detection of Windows Millenium (tested with beta 3).
--[ How to compile ]---------------------------------------------------- --[ How to compile ]----------------------------------------------------
@@ -43,7 +47,7 @@
--[ Where to get help/information ]------------------------------------- --[ Where to get help/information ]-------------------------------------
This archaic and abandoned software is opensource with no warranty This archaic and abandoned software is opensource with no warranty
or help of any kind. or help of any kind.
For inquiries contact claunia@claunia.com. For inquiries contact claunia@claunia.com.
@@ -76,7 +80,7 @@
#define SYSTEM "OWP" #define SYSTEM "OWP"
#define PROGRAM "VER" #define PROGRAM "VER"
#define MAJOR_VERSION 0 #define MAJOR_VERSION 0
#define MINOR_VERSION_STRING "03" #define MINOR_VERSION_STRING "04"
#define SUB_VERSION_STRING "" #define SUB_VERSION_STRING ""
#define COPYRIGHT "2000 Open Windows Project" #define COPYRIGHT "2000 Open Windows Project"
@@ -88,11 +92,12 @@
#define FreeDOS 4 #define FreeDOS 4
#define Win95 5 #define Win95 5
#define WinNT 6 #define WinNT 6
#define OS2 7 /* Not tested yet, so not implemented yet */ #define OS2 7
#define PTS_DOS 8 #define PTS_DOS 8
#define RxDOS 9 #define RxDOS 9
#define ConDOS 10 /* Concurrent DOS, not tested yet */ #define ConDOS 10 /* Concurrent DOS, not tested yet */
#define NVDOS 11 /* Novell version of DR_DOS, not tested yet */ #define NVDOS 11 /* Novell version of DR-DOS, tested in Caldera OpenDOS 7.01 */
#define OLD 12 #define OLD 12
#define Win98 13 #define Win98 13 /* Or Windows 95 OSR 2 or upper */
#define WinMe 14
#define ERROR 255 #define ERROR 255