home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------ */
- /* WINTEST.C */
- /* Test auf aktive Windows-Version */
- /* Rückgabe : 0 -> Windows ist nicht aktiv */
- /* 1 -> Windows läuft im REAL-Modus */
- /* 2 -> Windows läuft im STANDARD-Modus */
- /* 3 -> Windows läuft im ERWEITERTEN-386 Modus */
- /* (c) 1992 Michael Winter & DMV-Verlag */
- /* ------------------------------------------------------ */
-
- #include <stdio.h>
- #include <bios.h>
- #include <stdlib.h>
-
- /* --- Prototypen --------------------------------------- */
-
- int main( void );
-
- /* --- Hauptprogramm ------------------------------------ */
-
- int main( void )
- {
- unsigned int WIN386, WINR_OR_WIN286,
- WIN386_OR_WIN286, ergi;
- unsigned char ergc;
-
- printf("\nWinTest 1.0 - ");
- printf("(c) 1992 Michael Winter & DMV-Verlag\n\n");
-
- _asm
- {
- mov ax, 0x4680;
- int 0x2f;
- mov ergc, ah;
- }
-
- WINR_OR_WIN286 = (ergc == 0x00);
-
- _asm
- {
- mov ax, 0x1600;
- int 0x2F;
- mov ergc, al;
- }
-
- WIN386 = ( (ergc == 0x01) || (ergc == 0xff) );
-
- if (WIN386)
- {
- printf("Windows ist im erweiterten 386-Modus aktiv\n");
- exit(3);
- }
-
- _asm
- {
- push es;
- push ds;
-
- mov ax, 0x1605;
- xor bx, 0x0000;
- mov es, bx;
- xor si, 0x0000;
- mov ds, si;
- xor cx, 0x0000;
- mov dx, 0x0001;
- int 0x2f;
- mov ergi, cx;
-
- pop ds;
- pop es;
- }
-
- WIN386_OR_WIN286 = (ergi == 0xFFFF);
-
- if (ergi == 0x0000)
- _asm
- {
- mov ax, 0x1606;
- int 0x2f;
- }
-
- if ( (!WIN386) && (!WIN386_OR_WIN286) &&
- (!WINR_OR_WIN286) )
- {
- printf("Windows ist nicht aktiv\n");
- exit(0);
- }
-
- if (WIN386_OR_WIN286 && WINR_OR_WIN286)
- {
- printf("Windows ist im Standard-Modus aktiv\n");
- exit(2);
- }
-
- if (WINR_OR_WIN286)
- {
- printf("Windows läuft im Real-Modus\n");
- exit(1);
- }
- }
- /* ------------------------------------------------------ */
- /* Ende von WINTEST.C */
-