📄 computer.c
字号:
pszString = pszIntel486SX;
}
break;
case 20:
pComputer->wProcessor = _NECV20;
pszString = pszNECV20;
break;
default:
pComputer->wProcessor = 0;
pszString = "";
}
/* Set the string in the structure */
strcpy (pComputer->szProcessor, pszString);
/* Set co-processor type */
switch (wCoProcessor)
{
case 0:
pComputer->wCoProcessor = _NOCOPROCESSOR;
pszString = pszNone;
break;
case 1:
pComputer->wCoProcessor = _8087;
pszString = pszIntel8087;
break;
case 2:
pComputer->wCoProcessor = _80287;
pszString = pszIntel80287;
break;
case 3:
if (wProcessor == 48)
{
pszString = pszInternal;
pComputer->wCoProcessor = _INTERNAL;
}
else
{
pszString = pszIntel80387;
pComputer->wCoProcessor = _80387;
}
break;
default:
pComputer->wCoProcessor = _NOCOPROCESSOR;
pszString = pszUnknown;
}
/* Set the string in the structure */
strcpy (pComputer->szCoProcessor, pszString);
}
return (FALSE);
}
/*********************************************************************
* SprintComputerInfo - Put "Computer" information into a set of
* strings to be printed or displayed.
*
* pComputer - Pointer to computer information structure.
* szSumStrings - Strings to store the summary information.
*
* Returns: NULL if an error occured, or if summary information
* obtained.
*********************************************************************/
QSZ * SprintComputerInfo (COMPUTER_STRUCT *pComputer,
CHAR szSumStrings[][MAX_SUMM_INFO + 5])
{
WORD wNmbrStrings; /* Number of strings */
WORD wNmbrChars; /* Number of characters in the strings */
WORD wIndex; /* Index to the structure of TSR data */
WORD i; /* Looping variable */
QSZ *pqszStrings = NULL; /* Location for storing string pointers */
/* Set the summary info, if required */
if (szSumStrings != NULL)
{
WORD wLength; /* String length */
/* Computer name */
strncpy (szSumStrings[0], pComputer->szComputerName, MAX_SUMM_INFO);
/* Remove trailing spaces */
wLength = strlen (szSumStrings[0]);
while (--wLength > 0 && szSumStrings[0][wLength] == ' ')
szSumStrings[0][wLength] = '\0';
/* Slash */
strncat (szSumStrings[0], "/",
MAX_SUMM_INFO - strlen (szSumStrings[0]));
/* BIOS Manufacturer */
strncat (szSumStrings[0], pComputer->szBiosMfgr,
MAX_SUMM_INFO - strlen (szSumStrings[0]));
/* Processor and Co-Processor */
strncpy (szSumStrings[1], pComputer->szProcessor, MAX_SUMM_INFO);
if (pComputer->wCoProcessor != _NOCOPROCESSOR &&
pComputer->wCoProcessor != _INTERNAL)
{
strncat (szSumStrings[1], "/",
MAX_SUMM_INFO - strlen (szSumStrings[1]));
strncat (szSumStrings[1], pComputer->szCoProcessor,
MAX_SUMM_INFO - strlen (szSumStrings[1]));
}
return (NULL);
}
/* Overestimate the amount of space required for the strings */
wNmbrStrings = 19;
wNmbrChars = sizeof (COMPUTER_STRUCT) +
(wNmbrStrings * MAX_COMPUTER_TITLE_LENGTH) + 50;
/* Allocate space for the pointer area and string area */
pqszStrings = AllocStringSpace (wNmbrStrings, wNmbrChars);
if (pqszStrings == NULL)
return (NULL);
/* Put the information in place */
for (i = 0, wIndex = 0; paszComputerTitles[wIndex] != NULL ; ++i, ++wIndex)
{
WORD wIndent; /* Amount to indent */
CHAR chBuffer[MAX_BIOS_VERSION_LEN]; /* Buffer for string data */
PSZ pszString = NULL; /* String pointer */
/* Title for this line of data */
wIndent = MAX_COMPUTER_TITLE_LENGTH -
strlen (paszComputerTitles[wIndex]);
Qmemset (pqszStrings[i], ' ', wIndent);
Qstrcpy (&pqszStrings[i][wIndent], paszComputerTitles[wIndex]);
/* Place the appropriate information on the line */
switch (wIndex)
{
case COMP_NAME:
pszString = pComputer->szComputerName;
break;
case COMP_BIOS_MFGR:
pszString = pComputer->szBiosMfgr;
break;
case COMP_BIOS_VERSION_1:
pszString = pComputer->aszBiosVersion[0];
/* Skip blank BIOS version lines */
if (pComputer->aszBiosVersion[1][0] == '\0')
wIndex += 2;
break;
case COMP_BIOS_VERSION_2:
pszString = pComputer->aszBiosVersion[1];
/* Skip blank BIOS version lines */
if (pComputer->aszBiosVersion[2][0] == '\0')
++wIndex;
break;
case COMP_BIOS_VERSION_3:
pszString = pComputer->aszBiosVersion[2];
break;
case COMP_BIOS_CATEGORY:
pszString = pComputer->szBiosCategory;
break;
case COMP_BIOS_ID_BYTES:
sprintf (chBuffer, "%02X %02X %02X", pComputer->bComputerType,
pComputer->bSubModel, pComputer->bRevisionLevel);
pszString = chBuffer;
/* Determine if the submodel and revision level */
/* bytes are available */
if (pComputer->fConfigCallSupported == FALSE)
chBuffer[2] = '\0';
break;
case COMP_BIOS_DATE:
pszString = pComputer->szBiosDate;
break;
case COMP_PROCESSOR:
pszString = pComputer->szProcessor;
break;
case COMP_COPROCESSOR:
pszString = pComputer->szCoProcessor;
break;
case COMP_KEYBOARD:
pszString = pComputer->szKeyboardType;
break;
case COMP_BUS_TYPE:
pszString = pComputer->szBusType;
break;
case COMP_DMA_CTLRER:
pszString = (pComputer->fDmaChipPresent) ? pszYes : pszNo;
break;
case COMP_CASCADE_IRQ2:
pszString = (pComputer->fCascadeIntLvl2) ? pszYes : pszNo;
break;
case COMP_BIOS_DATA_SEG:
if (pComputer->wExtAreaSeg)
{
sprintf (chBuffer, "%04X %dk", pComputer->wExtAreaSeg,
pComputer->wExtAreaLen);
pszString = chBuffer;
}
else
pszString = pszNone;
break;
default:
pszString = "";
}
/* Put the information on the line */
Qstrcat (pqszStrings[i], pszString);
/* Set the next pointer */
PrepNextString (pqszStrings, i);
}
/* Set the last pointer to NULL */
pqszStrings[i] = NULL;
/* Return the pointer to ppszStrings */
return (pqszStrings);
}
/*********************************************************************
* GetRomName - Finds a name in the computer/video card's ROM.
*
* fSearchType - Video bios search, or computer name search.
* ppszStrings - List of names to search for.
*
* Returns: String pointer to computer name, and sets wStringNmbr to
* the string number in ppszStrings that was found.
*********************************************************************/
WORD GetRomName (BOOL fSearchType, PSZ *ppszStrings)
{
WORD i, u; /* Looping Variables */
ADDR_LENGTH *pal = NULL; /* Address length structure to use */
/* Addresses to search for computer information*/
static ADDR_LENGTH alComputer[] =
{
{ 0xF0000000, 256 },
{ 0xF0001000, 256 }, /* This was added for Zenith */
{ 0xF00012A0, 32 }, /* This was added for Telex */
{ 0xF0006000, 256 }, /* This was added for Headstart */
{ 0xF0008000, 256 },
{ 0xF0008D00, 256 }, /* This was added for DTK */
{ 0xF000A140, 16 }, /* This was added for Mitac */
{ 0xF000A440, 32 }, /* This was added for Intel */
{ 0xF000AF70, 64 }, /* This was added for Acer */
{ 0xF000B3F0, 256 }, /* This was added for Acer */
{ 0xF000C000, 256 },
{ 0xF000D000, 256 },
{ 0xF000E000, 256 },
{ 0xF000E300, 128 }, /* This was added for Northgate */
{ 0, 0 }
};
/* Addresses to search for video information */
static ADDR_LENGTH alVideoNames[] =
{
{ 0xC0000000, 512 },
{ 0xC0003F90, 17 }, /* Added for Compaq EGA */
{ 0xC0000400, 128 }, /* Added for Genoa Spectra */
{ 0xC0007F00, 64 }, /* Added for Tandy */
{ 0xC0005F00, 512 }, /* Compaq video cards */
{ 0, 0 }
};
static ADDR_LENGTH alVideoModels[] =
{
{ 0xC0000000, 512 },
{ 0xC0000400, 256 }, /* Added for Genoa Spectra */
{ 0xC0000A00, 512 }, /* Added for Video Seven 1024i */
{ 0xC0000C00, 256 }, /* Added for Genoa Super EGA */
{ 0xC0003B00, 128 }, /* Added for Tecmar VGA/AD */
{ 0xC0007A00, 512 }, /* Added for Video Seven FastWrite */
{ 0, 0 }
};
/* Choose the correct search areas */
if (fSearchType == GET_COMPUTER_NAME ||
fSearchType == GET_BIOS_MFGR)
pal = alComputer;
else if (fSearchType == GET_VIDEO_NAME)
pal = alVideoNames;
else
pal = alVideoModels;
/* Search for matches */
for (i = 1; ppszStrings[i] != NULL; ++i)
for (u = 0; pal[u].wLength != 0; ++u)
if (fbiInstr ((CHAR FAR *) pal[u].dwAddress, ppszStrings[i],
pal[u].wLength))
return (i);
return (0);
}
/*********************************************************************
* GetRomVersion - Finds version numbers stored in ROM.
*
* Returns: TRUE if a version was found, FALSE otherwise
*********************************************************************/
BOOL GetRomVersion (CHAR pachVersionStrings[][MAX_BIOS_VERSION_LEN],
CHAR FAR *fpSearchArea,
WORD wSearchLength)
{
BOOL fFoundFlag = TRUE; /* Set to TRUE if the item was found */
WORD wStringSegment; /* Segment of the string that was found */
WORD wStringOffset; /* Offset of the string that was found */
CHAR FAR *fpChars = NULL; /* Far pointer to the string of characters */
CHAR FAR *fpMatch = NULL; /* Used to detect if a match occured */
CHAR chSearchChar = '.'; /* Character to search for */
WORD i, u; /* Looping variables */
WORD iIndex = 0; /* Index to pachVersionStrings */
WORD wRomLength; /* Length of ROM string start to ver number */
/* Version number search strings */
static PSZ paszSearchStrings[] =
{
"Ver",
"Rev",
"Rel",
"v0",
"v1",
"v2",
"v3",
"v4",
"v5",
"v6",
"v7",
"v8",
"v9",
"v 0",
"v 1",
"v 2",
"v 3",
"v 4",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -