⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video.c

📁 Dos6.0
💻 C
📖 第 1 页 / 共 2 页
字号:
/*********************************************************************
 * Microsoft Diagnostics Version 2.0
 *
 * A diagnostic utility to detect as much useful information about a
 *   customer's computer system as is possible.
 *
 * Microsoft Diagnostics:  We detect the World.
 *
 * VIDEO.C - Source file for determing video adapter information.
 ********************************************************************/


/* Include Files */

#include "msd.h"


/* Video Display Types */

PSZ  ppszDisplayName[] =
  {
    "",
    "TTL Monochrome",
    "CGA Monitor",
    "EGA Monitor",
    "VGA Monochrome",
    "VGA Color",
    "8514/A Display"
  };


/* Adapter Types (IBM) */

PSZ  ppszIbmName[] =
  {
    "None",
    "MDA",
    "CGA",
    "EGA",
    "MCGA",
    "VGA",
    "8514/A",
    "XGA",
    "TIGA"
  };

#define VIDEO_TYPE_CGA  2
#define VIDEO_TYPE_TIGA 8


/* Adapter Types (Hercules) */

PSZ  ppszHercName[] =
  {
    "Hercules or Compatible",
    "Hercules Graphics Card +",
    "Hercules InColor"
  };


/* List of Adapter Names */

PSZ  ppszAdapterNames[] =
  {
    "Unknown",
    "Hercules", "Cirrus", "Zenith", "Quadram", "Radius", "Mitsubishi",
    "Emerson", "Ogivar", "Tandy", "Olivetti", "US Video", "Persyst",
    "ALR ", "ATI ", "BTC ", "Boca", "Cardinal", "Chicony", "CompuAdd",
    "DFI ", "DTK ", "Focus", "GBM ", "Hewlett-Packard", "Hewlett Packard",
    "Leading Tech", "Lava", "Logos", "LSI ", "Matrox", "NEC ", "Orchid",
    "Packard Bell", "PC Brand", "PC Craft", "PC Tech", "Prism", "QDI",
    "RasterOps", "Sigma", "STB ", "Swan", "ViewSonic", "Wyse", "Wang",
    "Dieco", "Metheus", "Monolithic", "Packard Bell", "Bell",
    "Colorgraphics", "AST ",

    /* Chipset makers */
    "Ahead", "Appian", "Oak ", "Sigma", "Video Seven", "Video-7", "Genoa",
    "Chips and Tech", "Tseng", "Tecmar", "Paradise", "NEC ", "ATI ",
    "Everex", "Phoenix", "Award", "Compaq", "Quadtel", "Headland",
    "Trident", "Western Digital", "MaxLogic", "Diamond", "AMI ", "PCG ",
    "Tatung", "Amdek", "AST ",
    NULL
  };



#define VID_NAME_HERCULES   1


/* List of Adapter Models */

PSZ  ppszAdapterModels[] =
  {
    "",
    "FastWrite", "V-RAM", "Z449", "Z549", "Workstation", "QuadVGA",
    "Wizard", "Enhancer", "Integra", "VGAudio", "VideoFlex", "SpeedSTAR",
    "Viewpoint TC", "Viewpoint", "Vision", "2theMax", "Mirage",
    "Splitword", "Graphics Station", "Ultra", "MaxVGA", "Ultimate",
    "UltraVGA", "MicroPAQ", "ProDesigner IIs", "ProDesigner II", "Photon",
    "Plus", "Supra", "Basic", "Elite", "Legend", "PowerGraph",
    "PowerView", "Spectrum", "VGA Professional", "Paradise",
    "VRAM II", "VRAM", "Hi-Rez",
    "Super VGA+", "SuperVGA", "Super VGA", "1024i", "Vega VGA", "VEGA",
    "OVGA", "PVGA", "RVGA", "SVGA", "TVGA", "EGA2 ", "VGA2 ",
    "VGA+", "SVGA", "8514/A", "8514A", "8514", "DVGA ", "MVGA",
    "VGA III", "VGA II", "MEGA", "PEGA", "SEGA", "VEGA Deluxe",
    "VEGA",
    NULL
  };


/*********************************************************************
 * GetVideoInfo - Gets the video adapter information.
 *
 * Returns:  TRUE if an error occured.
 *********************************************************************/

BOOL GetVideoInfo (VIDEO_STRUCT *pVideo, BOOL fMinimumInfo)
{
  union  REGS inregs, outregs;  /* Register structures for int86()   */
  struct SREGS sregs;           /* Segment register structure        */
  WORD   i;                     /* Local WORD variable               */


  {
    /* Get Adapter Type */

    /* Detect video subsystems using videoid.asm. After this call    */
    /*   the fields Subsystem and Display in the structure pointed   */
    /*   to by pVideo are set to reflect the video type of a primary */
    /*   and secondary video adapter                                 */

    /* VIDEOID.ASM from Programmer's Library, page 511 of   */
    /*   Programmer's Guide to PC and PS/2 Video Systems by */
    /*   Richard Wilton                                     */

    VideoID ((VIDEO_STRUCT FAR *) pVideo);

    /* Put the higher end display first */
    if (pVideo->bSubsystem0 < 80 && pVideo->bSubsystem1 < 80)
      if (pVideo->bSubsystem0 < pVideo->bSubsystem1)
        {
          BYTE bHold;   /* Hold value for swapping */

          bHold               = pVideo->bSubsystem0;
          pVideo->bSubsystem0 = pVideo->bSubsystem1;
          pVideo->bSubsystem1 = bHold;
        }


    /* TIGA detection */
    GetTigaInfo (pVideo);

    strcpy (pVideo->szAdapterType, SubsystemName(pVideo->bSubsystem0));
  }

  {
    /* Get Adapter Name */

    i = GetRomName (GET_VIDEO_NAME, ppszAdapterNames);
    strcpy (pVideo->szAdapterName, ppszAdapterNames[i]);
    pVideo->wAdapterName = i;

    /* If this was a Hercules Graphics Card + or a Hercules InColor card */
    /*   set the Manufacturer Name to "Hercules"                         */

    if (i == 0 && (pVideo->bSubsystem0 == 0x81 ||
        pVideo->bSubsystem0 == 0x82))
      {
        strcpy (pVideo->szAdapterName, ppszAdapterNames[VID_NAME_HERCULES]);
        pVideo->wAdapterName = VID_NAME_HERCULES;
      }
  }

  {
    /* Get Adapter Model */

    i = GetRomName (GET_VIDEO_MODEL, ppszAdapterModels);
    strcpy (pVideo->szAdapterModel, ppszAdapterModels[i]);
    pVideo->wAdapterModel = i;
  }

  {
    /* Get VESA version information */

    BYTE  bBuffer[256];          /* 256 byte buffer for VESA information */
    BYTE  FAR *fbByte = NULL;    /* Pointer to the BYTE buffer           */
    CHAR  FAR *fpChar = NULL;    /* Far CHAR pointer (to get OEM name)   */
    DWORD FAR *fpdwDword = NULL; /* Far DWORD pointer (to get OEM name)  */


    fbByte = (BYTE FAR *) bBuffer;

    /* Clear out the VESA OEM Name */

    pVideo->szVesaOemName[0] = '\0';


    /* Call the VESA "Get Information" call */

    inregs.x.ax = 0x4F00;
    sregs.es    = FP_SEG (fbByte);
    inregs.x.di = FP_OFF (fbByte);

    int86x (0x10, &inregs, &outregs, &sregs);

    /* Determine if this card is a VESA card */

    if (memcmp ((CHAR *) bBuffer, "VESA", 4) == 0)
      {
        pVideo->bVesaVersionMajor = bBuffer[5];
        pVideo->bVesaVersionMinor = bBuffer[4];

        /* Point to the OEM name */
        fpdwDword = (DWORD FAR *) &bBuffer[6];
        fpChar    = (CHAR FAR *) *fpdwDword;

        /* Copy the OEM name into the structure */
        if (fpChar != NULL)
          {
            for (i = 0; i < MAX_VESA_OEM_NAME - 1 &&
                        fpChar[i] >= ' ' && fpChar[i] <= 127; ++i)
              pVideo->szVesaOemName[i] = fpChar[i];

            pVideo->szVesaOemName[i] = '\0';
          }
      }
    else
      {
        pVideo->bVesaVersionMajor = 0;
        pVideo->bVesaVersionMinor = 0;
      }
  }

  {
    /* If mimimum information requested, return now */

    if (fMinimumInfo)
      return (FALSE);
  }

  {
    /* Get the display type */

    strcpy (pVideo->szDisplayType, DisplayName(pVideo->bDisplay0));
  }

  {
    /* Get the secondary adapter type */

    strcpy (pVideo->sz2ndAdapterType, SubsystemName(pVideo->bSubsystem1));
  }

  {
    /* The following interrupt gets the display mode in AL, the     */
    /*   number of columns in AH, and the active video display page */
    /*   in BH as mentioned on pg 196 of the PC SourceBook -- for   */
    /*   ALL monitor types                                          */

    inregs.h.ah=0x0F;
    int86(0x10,&inregs,&outregs);
    pVideo->bMode0 = outregs.h.al;
    pVideo->bNmbrCols0 = outregs.h.ah;
  }

  {
    /* The following interrupt gets the active video display page as   */
    /*   mentioned on pg 525 of Advanced MSDOS -- for EGA and VGA ONLY */

    inregs.h.ah=0x12;
    inregs.h.bl=0x10;
    int86(0x10,&inregs,&outregs);
    pVideo->wMemory0 = outregs.h.bl;
  }

  {
    /* Set the the number of rows on the display */

    BYTE FAR * fbByte = NULL;  /* Far pointer to a byte */

    /* Point to the location of the number of rows on the display */
    fbByte = (BYTE FAR *) 0x00400084;

    if (pVideo->bSubsystem0 > VIDEO_TYPE_CGA && pVideo->bSubsystem0 < 0x80)
      pVideo->bNmbrRows = fbByte[0] + (BYTE) 1;
    else
      pVideo->bNmbrRows = 25;
  }

  {
    /* Get the Video BIOS Date and Version, if it exists */

    BYTE FAR * fbRomSignature = NULL;  /* Location of the ROM Signature */


    /* Set the location for the video card's ROM BIOS */

    fbRomSignature = (BYTE FAR *) 0xC0000000;


    /* 55H AAH are the ROM signature bytes, followed by the ROM */
    /*   length / 512                                           */

    if (fbRomSignature[0] != 0x55 || fbRomSignature[1] != 0xAA)
      {
        fbRomSignature = (BYTE FAR *) 0xE0000000;

        if (fbRomSignature[0] != 0x55 && fbRomSignature[1] != 0xAA)
          fbRomSignature = (BYTE FAR *) 0x00000000;
      }

    if (fbRomSignature)
      {
        /* Get Video ROM Date */

        GetRomDate (fbRomSignature, ((WORD) fbRomSignature[2]) << 9,
                    pVideo->szVideoBiosDate);

        /* Get Video ROM Version */

        GetRomVersion (pVideo->aszVideoBiosVersion,
                       fbRomSignature, ((WORD) fbRomSignature[2]) << 9);
      }
    else
      {
        /* Clear out the BIOS date and version strings */

        pVideo->szVideoBiosDate[0] = '\0';

        for (i = 0; i < MAX_BIOS_VERSION_STRINGS; ++i)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -