Category : System Diagnostics for your computer
Archive   : PCCONFIG.ZIP
Filename : DISKLIST.C

 
Output of file : DISKLIST.C contained in archive : PCCONFIG.ZIP
#include
#include
#include
#include
#include

#include "systables.h"

#define FALSE 0

void drvinfo (char); /* Declared in DRVINFO.C */
void dev_chain (void far *cvt); /* Declared in DEVCHAIN.C */
int critical_error_handler (int, int, int, int);

int dpb_report (struct DPB *dpb, struct LDT *ldt, int floppies)

{
extern unsigned critical_error_flag;
char driver[9];
void interrupt (*int_24)();

struct devhdr far *dev_info;
struct dfree freeinfo;
struct fatinfo fat;
struct MPT *mpt;
union REGS inregs;
union REGS outregs;
struct SREGS segregs;
char path[MAXPATH];
int i;
unsigned long int capacity;
unsigned long int Free_cap, Total_cap;
char drivetype[35];

if ((ldt->drive[0] == 'B') & (floppies == 1))
{
return (0);
}

if (ldt->status.LDT_status_subst)
{
printf ("\nÕÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸"
"\n³ %c: ³ This is a SUBSTITUTED drive mapped to the following physical path: ³"
"\n³±±±±ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´"
"\n³±±±±³ %-70s ³"
"\nÔÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;",
dpb->drive + 'A',
ldt->drive);
}
else if (dpb->drive + 1 <= floppies)
{
inregs.h.ah = 0x08; /* Return disk drive params */
inregs.h.dl = dpb->drive;
int86x (0x13, &inregs, &outregs, &segregs);
if (outregs.x.cflag == 0)
{
mpt = MK_FP(segregs.es, outregs.x.di); /* Point to MPT */
switch (mpt->specify_2)
{
case 1: strcpy (drivetype, "5-¬\" 360Kb Floppy Disk ");
break;
case 2: strcpy (drivetype, "5-¬\" 1.2MB Floppy Disk ");
break;
case 3: strcpy (drivetype, "3-«\" 720KB Floppy Disk ");
break;
case 4: strcpy (drivetype, "3-«\" 1.44MB Floppy Disk");
break;
default: strcpy (drivetype, "5-¬\" 360Kb Floppy Disk ");
i = 512;
break;
}
switch (mpt->bytes_sector)
{
case 0: i = 128;
break;
case 1: i = 256;
break;
case 2: i = 512;
break;
case 3: i = 1024;
break;
default: i = 512;
break;
}
printf ("\nÕÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸"
"\n³ %c: ³ %s %4d Bytes per Sector, %3d Sectors per Track ³"
"\n³±±±±ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´"
"\n³±±±±³ Unit #%2d of Driver at Address: %p ³"
"\nÔÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;",
dpb->drive + 'A',
drivetype,
i,
mpt->sectors_track,
dpb->unit,
dpb->devadr);
}
else
{
printf ("\nÕÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸"
"\n³ %c: ³ 5-¬\" 360Kb Floppy Disk 512 Bytes per Sector, 9 Sectors per Track ³"
"\n³±±±±ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´"
"\n³±±±±³ Unit #%2d of Driver at Address: %p ³"
"\nÔÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;",
dpb->drive + 'A',
dpb->unit,
dpb->devadr);
}
}
else
{
int_24 = getvect (24);
harderr (critical_error_handler);

dev_info = dpb->devadr;
critical_error_flag = FALSE;
getcurdir (dpb->drive + 1, path);
if (!critical_error_flag)
{
getfat (dpb->drive + 1, &fat);
capacity = (unsigned long)fat.fi_sclus *
(unsigned long)fat.fi_nclus *
(unsigned long)fat.fi_bysec;
Total_cap = capacity / 1024;
switch ((unsigned char)fat.fi_fatid)
{
case 0xFF:
case 0xFE:
case 0xFD:
case 0xFC:
case 0xF9: strcpy (drivetype, "RAM Disk");
break;
case 0xF8: strcpy (drivetype, "Hard Disk");
break;
default: strcpy (drivetype, "Unknown");
break;
}

getdfree (dpb->drive + 1, &freeinfo);
capacity = (unsigned long)freeinfo.df_avail *
(unsigned long)freeinfo.df_sclus *
(unsigned long)freeinfo.df_bsec;
Free_cap = capacity / 1024;

printf ("\nÕÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸"
"\n³ %c: ³ FAT ID: %X -%10s ³ Total Space: %6ldKB ³ Free Space: %6ldKB ³"
"\n³±±±±ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´"
"\n³±±±±³ Unit #%2d of Driver at Address: %p ³"
"\n³±±±±ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´"
"\n³±±±±³ Total FATs %4d ³ Root Sector #1: %6d ³ Bytes/Sector: %4d ³"
"\n³±±±±³ Sectors/FAT %4d ³ Data Sector #1: %6d ³ Sectors/Cluster: %4d ³"
"\n³±±±±³ Bits/Entry %2d ³ Last Used Sector: %6d ³ Total Clusters: %6d ³"
"\nÔÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ;",
ldt->drive[0],
(unsigned char)fat.fi_fatid,
drivetype,
Total_cap,
Free_cap,
dpb->unit,
dpb->devadr,
dpb->fats,
dpb->root1,
fat.fi_bysec,
dpb->spf,
dpb->sector1,
fat.fi_sclus,
(dpb->sectorn > 0xFFC?16:12),
dpb->lclust,
fat.fi_nclus);
}

setvect (24, int_24);
}
return (0);
};

void dpb_trace (struct DPB *first_dpb, struct LDT *first_ldt, int floppies)

{
struct DPB *curr_dpb;
struct LDT *curr_ldt;

curr_dpb = first_dpb;
curr_ldt = first_ldt;
while (FP_OFF(curr_dpb) != 0xFFFF)
{
dpb_report (curr_dpb, curr_ldt, floppies);
curr_dpb = curr_dpb->next;
curr_ldt = MK_FP(FP_SEG (curr_ldt), FP_OFF (curr_ldt) + 81);
};
};

void disk_list (int floppies)

{
struct CVT *cvt; /* Configuration variable table */
union REGS inregs;
union REGS outregs;
struct SREGS segregs;

if (_osmajor != 3)
{
printf ("\a\n\tOnly DOS Version 3.x supported.");
return;
};

inregs.h.ah = 0x52; /* Get CVT base address */
intdosx (&inregs, &outregs, &segregs); /* call DOS */
cvt = MK_FP(segregs.es, outregs.x.bx-8); /* make it a far pointer */

dpb_trace (cvt->dpb, cvt->ldt, floppies);
dev_chain (cvt);
}

int critical_error_handler (int errval, int drive, int bp, int si)
{
#define DRIVE_NOT_READY 2
#define NON_DOS_DISK 7
#define IGNORE 0
#define RETRY 1
#define ABORT 2
#define FAIL 3

extern unsigned critical_error_flag;

char *DOSErrors[] =
{
"Disk is write protected",
"Unknown unit (source of error is not known)",
"Drive not ready",
"Unknown command",
"CRC error in data",
"Length of \"Drive Request Structure\" is invalid",
"Seek Error",
"Unknown media type",
"Sector not found",
"Printer out of paper",
"Write fault",
"Read fault",
"General Failure"
};

critical_error_flag = 1;

if (((errval & 0xFF)==DRIVE_NOT_READY)||((errval & 0xFF)==NON_DOS_DISK))
{
hardresume (FAIL);
}
else
{
printf ("\nAn error was encountered while accessing drive %c:."
"\nStatics were not gathered on this device."
"\nError = %s.",
drive + 'A', DOSErrors [errval & 0xFF]);
hardretn (IGNORE);
return (IGNORE);
};
}


  3 Responses to “Category : System Diagnostics for your computer
Archive   : PCCONFIG.ZIP
Filename : DISKLIST.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. 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/