Category : Word Processors
Archive   : HP22D5.ZIP
Filename : INFO.C
#include
#include "extern.h" /* Extensions need these! */
extern PTR pascal near Get52Ptr();
extern PTR pascal near emmptr();
extern DWORD pascal near emmfree();
extern DWORD pascal near emmtotal();
extern BYTE pascal near emmversion();
extern WORD pascal near getmemsize();
extern WORD pascal near getextmemsize();
extern WORD pascal near getequipment();
PTR pascal near pctype()
{
PTR p = (PTR)0xF000FFFEL;
if (*p == 0xff) return("PC");
if (*p == 0xfe) return("PC XT");
if (*p == 0xfd) return("PCjr");
if (*p == 0xfc) return("PC AT");
return("Clone");
}
static DWORD pascal near blocksize(seg)
WORD seg;
{
PTR p;
FP_SEG(p) = seg;
FP_OFF(p) = 0;
return(((DWORD)*(WORD *)(p + 3) * 16L));
}
static PTR pascal near bool(b)
BYTE b;
{
return(b ? "TRUE" : "FALSE");
}
/*
** INFO
**
** This function returns an item delimited list of information about your
** computer. The item list is returned as follows:
**
** item 1 -> path of HyperPAD
** item 2 -> TRUE if DesqView is running, FALSE otherwise
** item 3 -> TRUE if a mouse is installed, FALSE otherwise
** item 4 -> ps type (PC,PC XT,PCjr,PC AT,Clone)
** item 5 -> number of printers
** item 6 -> number of RS-232 ports
** item 7 -> number of disk drives
** item 8 -> TRUE if EMS memory is installed, FALSE otherwise
** item 9 -> EMS version number (empty if no EMS installed)
** item 10 -> EMS memory free
** item 11 -> EMS total number of bytes
** item 12 -> free memory available to run programs
** item 13 -> total system memory (in bytes)
** item 14 -> total extended memory (in bytes)
** item 15 -> first allocated DOS memory block (in hex)
** item 16 -> next load address (format SEG:OFS)
** item 17 -> environment size (in bytes)
**
*/
info()
{
HANDLE hdl;
SHAREDPTR pShared;
DWORD f,t,free;
BYTE b,e;
WORD equip;
char buf[4];
WORD FirstSeg,next;
PTR p,ptr;
pShared = GetSharedArea();
/* allocate the maximum amount of space for the item list text */
hdl = NewHandle(250);
/* get the EMS information */
if (b = !strnicmp(emmptr(),"EMMXXXX0",8)) {
f = emmfree();
t = emmtotal();
e = emmversion();
sprintf(buf,"%c.%c",'0' + (e >> 4),'0' + (e & 0xf));
}
else {
buf[0] = '\0';
f = t = 0L;
}
/* get the equipment flags - each bit means something */
equip = getequipment();
// p = pointer to EXEC memory block
FP_SEG(p) = FP_SEG(pShared) - 0x11;
FP_OFF(p) = 0;
// next = segment address of the HPAD.OVL program
next = FP_SEG(p) += *(WORD *)(p + 3) + 1;
// trace through to end of memory blocks
do {
FP_SEG(ptr) = next;
FP_OFF(ptr) = 0;
if (*ptr == 0x5a) break;
else if (*ptr != 0x4d) break; //corrupt();
next += *(WORD *)(ptr + 3) + 1;
} while (TRUE);
// free = number of bytes free (not including header)
free = (DWORD)(next - FP_SEG(p)) * 16L + blocksize(next) + (DWORD)48;
// first allocated DOS segment (interrupt 21, function 52h is undocumented)
FirstSeg = *(WORD *)(Get52Ptr() - 2);
sprintf(deref(hdl),
"%s,%s,%s,%s,%d,%d,%d,%s,%s,%lu,%lu,%lu,%lu,%lu,%04X,%04X:0000,%d",
pShared -> program_name,
bool(pShared -> flags & 0x20),
bool(pShared -> flags & 0x04),
pctype(),
(equip & 0xC000) >> 14,
(equip & 0x0e00) >> 9,
equip & 1 ? ((equip & 0x00C0) >> 6) + 1 : 0,
bool(b),
buf,
f,
t,
free,
(DWORD)getmemsize() * 1000L,
(DWORD)getextmemsize() * 1000L,
FirstSeg,
FP_SEG(p),
pShared -> EnvSegSz);
// get the exact size of the text
ReAllocHandle(hdl,strlen(deref(hdl)) + 1);
ReturnValue(hdl);
return(STOP);
}
POOL pascal Pool[] = {
{ "info", /* name of the handler */
info, /* pointer to the handler */
0, /* reserved */
FUNCTION}, /* this is a handler, not a function */
{ NULL, /* NULLs signify the end of the table */
NULL,
0,
0} };
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/