Как в ДОС-программе определить, что она запущена из-под NT?

From
Sergei Shumakov (2:5005/47)
To
Peter Korotkov ()
Date
2001-11-08T18:26:18Z
Area
SU.WINDOWS.NT.PROG
Hello Peter!

Tuesday November 06 2001 16:17, Peter Korotkov wrote to All:

 PK> Почитал FAQ, эху chainik, но что-то нигде не обнаружил
 PK> ответа на этот вопрос.

=== Cut ===
= Requested from 2:5020/1381 (2:5005/47) ================= SU.WINDOWS.NT.PROG =
 Msg  : 4102 of 4333
 From : Andrey Kochin                       2:5026/23.45    Fri 10 Aug 01 21:09
 To   : Ruslan Radvansky                                    Sat 11 Aug 01 19:29
 Subj : Вопрос, не совсем в тему.
===============================================================================
Пpивет, Ruslan !

Четвеpг Август 09 2001, Ruslan Radvansky пишет к All:

 RR>   У меня задача - узнать, что моя дос-задача выполняется под
 RR> WindowsNT.

Detecting Windows NT from an MS-DOS-Based Application
Article ID: Q100290

...

Interrupt 21h, function 3306h can be used by MS-DOS-based applications to
detect whether or not they are running under Windows NT. On return, registers
BL
and BH will contain the operating system major and minor numbers, respectively.
If your application is running under Windows NT, the return will be:


   BL = 5
   BH = 50

Note that it is important to check both BL and BH, because MS-DOS 5.0 will also
return a 5 in BL.

The following code demonstrates how to detect the operating system version from
an MS-DOS-based application:


Sample Code


#include <stdio.h> #include <stdlib.h> #include <io.h>

void main() {

   unsigned char cbh = 0;
   unsigned char cbl = 0;

   _asm {
      mov ax, 3306h
      int 21h
      mov cbh, bh
      mov cbl, bl
   }
   printf( "After int 21h\n" );
   printf( "%u, %u (bh, bl)\n", cbh, cbl );

}

Довольно древняя статья, но, думаю, должно работать.


Пока!
Andrey

-+-
 + Origin:  Бытие обременяет сознание.  (FidoNet 2:5026/23.45)
=== Cut ===

Sergei                            e-mail: sergei.shumakov@altavista.net
                                     ICQ: 14192519

--- GoldED+/W32 snapshot-2000.12.24
 * Origin: Visual Systems. Tomsk. Russia. (2:5005/47)