home *** CD-ROM | disk | FTP | other *** search
/ Computer Installation Guide - Dragon Clan Series / CD2.iso / DOSTOOLS / PMODEW / EXAMPLES.ZIP / EXAMPLE5.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-06  |  1.5 KB  |  54 lines

  1. /*****************************************************************************
  2.  
  3.   This is a simple example of how to use INT 31h/AX=EEFFh to get information
  4. about the DOS extender and the protected mode system. DOS extender developers
  5. are encouraged to support this call as a standard detection method.
  6.  
  7. *****************************************************************************/
  8.  
  9. #include <stdio.h>
  10. #include <i86.h>
  11.  
  12. main (void)
  13. {
  14.     union REGS r;
  15.     struct SREGS sr;
  16.     char far *copyright;
  17.     char *systems[] = {"Raw", "XMS", "VCPI", "DPMI"};
  18.     char *processor[] = {"80386", "80486", "80586","Unknown"};
  19.  
  20.     r.x.eax = 3;
  21.     int386 (0x10, &r, &r);
  22.  
  23.     segread (&sr);
  24.     r.w.ax = 0xEEFF;
  25.     int386x (0x31, &r, &r, &sr);
  26.  
  27.     if (r.x.cflag) {
  28.         printf ("Extender Info Function Not Present!\n");
  29.         exit (1);
  30.     }
  31.  
  32.     copyright = MK_FP (sr.es, r.x.ebx);
  33.  
  34.     printf ("Copyright String:\n");
  35.     printf ("-----------------\n");
  36.     printf ("%s\n\n", copyright);
  37.  
  38.     printf ("System Information:\n");
  39.     printf ("-------------------\n");
  40.  
  41.     printf ("Extender Code      : %.6Xh ", r.x.eax);
  42.     printf ("(%c%c%c%c)\n", r.x.eax >> 24, r.x.eax >> 16, r.x.eax >> 8,
  43.             r.x.eax);
  44.     printf ("Extender Version   : v%d.%d\n", r.h.dh, r.h.dl);
  45.  
  46.     printf ("System Type        : %s\n", systems[r.h.ch]);
  47.  
  48.     if (r.h.cl > 5) r.h.cl = 6;
  49.     printf ("Processor          : %s\n", processor[r.h.cl-3]);
  50.  
  51.     return 0;
  52. }
  53.  
  54.