home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Archive
/
OS2_Archive_CD-ROM_Walnut_Creek_May_1992.iso
/
novell
/
progrmng
/
indent.zoo
/
sysinfo.c
< prev
next >
Wrap
Text File
|
1990-07-16
|
5KB
|
187 lines
/**************************** SYSTEM INFORMATION **********************/
#define INCL_BASE
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main(void);
void main(void)
{
VIOCONFIGINFO vioinfo;
KBDTYPE kbdtype;
BYTE bDevinfo;
CHAR chDrives;
CHAR ch;
HKBD hkbd;
HMOU hmou;
ULONG ulDrives;
USHORT uDevinfo;
USHORT usDisk;
USHORT usVersion;
USHORT usBCount;
char output[64];
VioWrtTTY("\r\n", 2, 0);
VioWrtTTY("System information. Copyright Colin Goldstein (c) 1989", 54, 0);
VioWrtTTY("\r\n\n", 3, 0);
uDevinfo = 0;
DosDevConfig(&uDevinfo, DEVINFO_MODEL, 0);
VioWrtTTY("PC model type is ", 17, 0);
itoa((int)uDevinfo, output, 10);
VioWrtTTY(output, strlen(output), 0);
DosDevConfig(&bDevinfo, DEVINFO_SUBMODEL, 0);
itoa((int)bDevinfo, output, 10);
VioWrtTTY(": Submodel type is ", 20, 0);
VioWrtTTY(output, strlen(output), 0);
VioWrtTTY("\r\n", 2, 0);
DosDevConfig(&bDevinfo, DEVINFO_COPROCESSOR, 0);
VioWrtTTY("Math coprocessor is ", 20, 0);
if (!bDevinfo) {
VioWrtTTY("not ", 4, 0);
}
VioWrtTTY("installed\r\n\n", 12, 0);
VioWrtTTY("Operating system is ", 20, 0);
DosGetVersion(&usVersion);
if ((int)(HIBYTE(usVersion)) > 9) {
VioWrtTTY("OS/2 version ", 13, 0);
ch = (HIBYTE(usVersion) / 10) + '0';
VioWrtTTY(&ch, 1, 0);
VioWrtTTY(".", 1, 0);
itoa((int)(LOBYTE(usVersion)), output, 10);
VioWrtTTY(output, strlen(output), 0);
} else {
VioWrtTTY("DOS version ", 12, 0);
ch = (HIBYTE(usVersion)) + '0';
VioWrtTTY(&ch, 1, 0);
VioWrtTTY(".", 1, 0);
itoa((int)(LOBYTE(usVersion)), output, 10);
VioWrtTTY(output, strlen(output), 0);
}
VioWrtTTY("\r\n\n", 3, 0);
uDevinfo = 0;
DosDevConfig(&uDevinfo, DEVINFO_PRINTER, 0);
itoa(uDevinfo, output, 10);
VioWrtTTY(output, strlen(output), 0);
VioWrtTTY(" parallel adapter(s) attached", 29, 0);
VioWrtTTY("\r\n", 2, 0);
uDevinfo = 0;
DosDevConfig(&uDevinfo, DEVINFO_RS232, 0);
itoa(uDevinfo, output, 10);
VioWrtTTY(output, strlen(output), 0);
VioWrtTTY(" serial adapter(s) attached", 27, 0);
VioWrtTTY("\r\n\n", 3, 0);
uDevinfo = 0;
DosDevConfig(&bDevinfo , DEVINFO_FLOPPY, 0);
itoa((int)bDevinfo, output, 10);
VioWrtTTY(output, strlen(output), 0);
VioWrtTTY(" removable-disk drive(s) installed", 35, 0);
VioWrtTTY("\r\n", 2, 0);
VioWrtTTY("Current disk drives ", 20, 0);
DosQCurDisk(&usDisk, &ulDrives); /* gets current drive */
for (chDrives = 'A'; chDrives <= 'Z'; chDrives++) {
if (ulDrives & 1) { /* if the drive bit is set, */
VioWrtTTY(&chDrives, 1, 0); /* displays the drive letter */
VioWrtTTY(": ", 2, 0);
}
ulDrives >>= 1;
}
VioWrtTTY("\n\n\r", 3, 0);
kbdtype.usType = 0;
kbdtype.reserved1 = 0;
kbdtype.reserved2 = 0;
KbdOpen(&hkbd);
DosDevIOCtl(&kbdtype, 0L, 0x0077, 0x0004, hkbd);
KbdClose(hkbd);
VioWrtTTY("Keyboard type is ", 17, 0);
if (kbdtype.usType == 0) {
VioWrtTTY("a PC/AT keyboard", 16, 0);
} else if (kbdtype.usType = 1) {
VioWrtTTY("an enhanced keyboard", 20, 0);
} else if (kbdtype.usType < 8) {
VioWrtTTY("a Japanese keyboard", 19, 0);
} else {
VioWrtTTY("unknown", 7, 0);
}
VioWrtTTY("\n\r", 2, 0);
MouOpen(NULL, &hmou);
MouGetNumButtons(&usBCount, hmou);
MouClose(hmou);
itoa((int)usBCount, output, 10);
strcat(output, " Button mouse is attached");
VioWrtTTY(output, strlen(output), 0);
VioWrtTTY("\n\n\r", 3, 0);
vioinfo.cb = sizeof(vioinfo);
VioGetConfig(0, &vioinfo, 0);
switch (vioinfo.adapter) {
case DISPLAY_MONOCHROME:
VioWrtTTY("Monochrome", 10, 0);
break;
case DISPLAY_CGA:
VioWrtTTY("Color graphics", 14, 0);
break;
case DISPLAY_EGA:
VioWrtTTY("Enhanced graphics", 17, 0);
break;
case DISPLAY_VGA:
VioWrtTTY("VGA", 3, 0);
break;
case DISPLAY_8514A:
VioWrtTTY("8514A", 5, 0);
break;
default:
VioWrtTTY("Unknown", 7, 0);
break;
}
VioWrtTTY(" video adapter detected", 23, 0);
VioWrtTTY("\r\n", 2, 0);
switch (vioinfo.display) {
case MONITOR_MONOCHROME:
VioWrtTTY("Monochrome", 10, 0);
break;
case MONITOR_COLOR:
VioWrtTTY("Color", 5, 0);
break;
case MONITOR_ENHANCED:
VioWrtTTY("Enhanced", 8, 0);
break;
case MONITOR_8503:
VioWrtTTY("8503 monochrome", 15, 0);
break;
case MONITOR_851X_COLOR:
VioWrtTTY("851x color", 10, 0);
break;
case MONITOR_8514:
VioWrtTTY("8514", 4, 0);
break;
default:
VioWrtTTY("Unknown", 7, 0);
break;
}
VioWrtTTY(" monitor detected", 17, 0);
VioWrtTTY("\r\n", 2, 0);
ltoa((vioinfo.cbMemory/1024), output, 10);
VioWrtTTY("Video adapter has ", 18, 0);
VioWrtTTY(output, strlen(output), 0);
VioWrtTTY(" Kbytes of memory", 17, 0);
VioWrtTTY("\r\n", 2, 0);
DosExit(EXIT_PROCESS, 0);
}