home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / hpfsut02.zip / source.zip / DisplayFunctions.c < prev    next >
C/C++ Source or Header  |  1999-11-26  |  36KB  |  1,051 lines

  1. #include <os2.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <time.h>
  6.  
  7. #include "Defines.h"
  8. #include "Structures.h"
  9. #include "SupportFunctions.h"
  10. #include "DisplayFunctions.h"
  11.  
  12. void Usage(PUCHAR probString)
  13. {
  14.     printf("\nHPFSUtil v%u.%02u by Mike Ruskai <%s>\n\n", VER_MAJOR, VER_MINOR, EMAIL_ADDRESS);
  15.     printf("This software is released to the public domain.  Use at your own risk.\n\n");
  16.     printf("Usage: hpfsutil.exe <drive letter> <options>\n\n");
  17.     printf("<drive letter> - letter of HPFS drive to process\n\n");
  18.     printf("Options:\n\n");
  19.     printf("/GD - report current dirty bit status\n");
  20.     printf("/DT - toggle dirty bit\n");
  21.     printf("/SD:<T/F> - set dirty status to True or False\n");
  22.     printf("/FS - compare actual and reported free space\n");
  23.     printf("/SU - show HPFS system space usage\n");
  24.     printf("/BS - show bad sector count\n");
  25.     printf("/SHSU - display contents of SuperBlock\n");
  26.     printf("/SHSP - display contents of SpareBlock\n");
  27.     printf("/SHSPFD - display SpareBlock with full spare DirBlk list\n");
  28.     printf("/DS:<sect>[-<sect>] - dump sector(s) to file\n");
  29.     printf("/FN:<filename> - filename to dump sectors to; default sectdata.dat\n");
  30.     printf("/NL - don't use IBM linedraw characters\n");
  31.     printf("\nArgument order is unimportant.\n");
  32.     if (probString!=NULL)
  33.         {
  34.         printf("\n%s\n", probString);
  35.         }
  36.  
  37.     return;
  38. }
  39.  
  40. void ReportError(PFUNCRETURN pfr)
  41. {
  42.     BOOL printErrorLoc=TRUE;
  43.  
  44.     if (!strcmp(pfr->errorFunc, "badbitmapsexist"))
  45.         {
  46.         printf("\nAt least one bad bitmap sector exists on your drive.\n");
  47.         printf("\nThis program does not yet know how to deal with that.\n");
  48.         printErrorLoc=FALSE;
  49.         }
  50.     else if (!strcmp(pfr->errorFunc, "endpastend"))
  51.         {
  52.         printf("\nGiven end sector exceeds sectors on drive.\n");
  53.         printErrorLoc=FALSE;
  54.         }
  55.     else if (!strcmp(pfr->errorFunc, "malloc"))
  56.         {
  57.         printf("\nThere was a memory allocation failure.\n");
  58.         }
  59.     else if (!strcmp(pfr->errorFunc, "nolockdrive"))
  60.         {
  61.         printf("\nThe program was unable to lock the drive.\n");
  62.         printf("\nDosDevIOCtl() returned %u.\n", pfr->errorCode);
  63.         printErrorLoc=FALSE;
  64.         }
  65.     else
  66.         {
  67.         printf("\nThe function %s() failed with error %u.\n", pfr->errorFunc, pfr->errorCode);
  68.         }
  69.     if (printErrorLoc)
  70.         printf("\nThe error occurred inside the %s() function.\n", pfr->errorHome);
  71.  
  72.     return;
  73. }
  74.  
  75. void ShowSuperBlock(PSUPERBLOCK sub, ULONG sectorSize, UCHAR driveLetter, BOOL noLineChars)
  76. {
  77.     UCHAR lineBuff[81], obuf[7], hbuf[9], dbuf[27], lbuf[33], tbuf[81];
  78.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  79.           botLeftCorner=192, topRightCorner=191,
  80.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  81.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  82.     ULONG offset, i;
  83.  
  84.     if (noLineChars)
  85.         {
  86.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  87.         botLeftCorner='\\'; topRightCorner='\\';
  88.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  89.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  90.         }
  91.  
  92.     PrintSPTopBorder(noLineChars);
  93.  
  94.     memset(lineBuff, 0, sizeof(lineBuff));
  95.     memset(tbuf, 0, sizeof(tbuf));
  96.     lineBuff[0]=vertBar;
  97.  
  98.     memset(lineBuff+1, ' ', 15);
  99.  
  100.     sprintf(tbuf, "HPFS SuperBlock for drive %c: - %s bytes/sector", driveLetter, iCodel(sectorSize));
  101.     strcat(lineBuff, tbuf);
  102.  
  103.     memset(lineBuff+strlen(lineBuff), ' ', 78-strlen(lineBuff));
  104.  
  105.     lineBuff[78]=vertBar;
  106.     printf("%s\n", lineBuff);
  107.  
  108.     PrintSPTMiddleBorder(noLineChars);
  109.  
  110.     memset(obuf, 0, sizeof(obuf));
  111.     memset(hbuf, 0, sizeof(hbuf));
  112.     memset(dbuf, 0, sizeof(dbuf));
  113.     memset(lbuf, 0, sizeof(lbuf));
  114.     strcpy(obuf, "Offset");
  115.     strcpy(hbuf, "   Hex  ");
  116.     strcpy(dbuf, " Formatted/Decimal Value  ");
  117.     strcpy(lbuf, "         Value Info         ");
  118.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  119.     PrintSPMiddleBorder(noLineChars);
  120.  
  121.     offset=0;
  122.  
  123.     memset(obuf, 0, sizeof(obuf));
  124.     memset(hbuf, 0, sizeof(hbuf));
  125.     memset(dbuf, 0, sizeof(dbuf));
  126.     memset(lbuf, 0, sizeof(lbuf));
  127.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  128.     sprintf(hbuf, "%08X", sub->signature[0]);
  129.     sprintf(dbuf, "%s", iCodel(sub->signature[0]));
  130.     strcpy(lbuf, "64-bit SuperBlock signature");
  131.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  132.     offset+=sizeof(sub->signature[0]);
  133.     memset(hbuf, 0, sizeof(hbuf));
  134.     memset(dbuf, 0, sizeof(dbuf));
  135.     memset(lbuf, 0, sizeof(lbuf));
  136.     memset(obuf, 0, sizeof(obuf));
  137.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  138.     sprintf(hbuf, "%08X", sub->signature[1]);
  139.     sprintf(dbuf, "%s", iCodel(sub->signature[1]));
  140.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  141.     offset+=sizeof(sub->signature[1]);
  142.     PrintSPMiddleBorder(noLineChars);
  143.  
  144.     memset(obuf, 0, sizeof(obuf));
  145.     memset(hbuf, 0, sizeof(hbuf));
  146.     memset(dbuf, 0, sizeof(dbuf));
  147.     memset(lbuf, 0, sizeof(lbuf));
  148.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  149.     sprintf(hbuf, "%02X", sub->version);
  150.     sprintf(dbuf, "%s", iCodel((ULONG)sub->version));
  151.     strcpy(lbuf, "HPFS version");
  152.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  153.     offset+=sizeof(sub->version);
  154.     PrintSPMiddleBorder(noLineChars);
  155.  
  156.     memset(obuf, 0, sizeof(obuf));
  157.     memset(hbuf, 0, sizeof(hbuf));
  158.     memset(dbuf, 0, sizeof(dbuf));
  159.     memset(lbuf, 0, sizeof(lbuf));
  160.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  161.     sprintf(hbuf, "%02X", sub->funcVersion);
  162.     sprintf(dbuf, "%s", iCodel((ULONG)sub->funcVersion));
  163.     strcpy(lbuf, "Vol size (2:<=4GB; 3:>4GB)");
  164.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  165.     offset+=sizeof(sub->funcVersion)+2;
  166.     PrintSPMiddleBorder(noLineChars);
  167.  
  168.     memset(obuf, 0, sizeof(obuf));
  169.     memset(hbuf, 0, sizeof(hbuf));
  170.     memset(dbuf, 0, sizeof(dbuf));
  171.     memset(lbuf, 0, sizeof(lbuf));
  172.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  173.     sprintf(hbuf, "%08X", sub->rootFNode);
  174.     sprintf(dbuf, "%s", iCodel((ULONG)sub->rootFNode));
  175.     strcpy(lbuf, "Root dir FNode location");
  176.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  177.     offset+=sizeof(sub->rootFNode);
  178.     PrintSPMiddleBorder(noLineChars);
  179.  
  180.     memset(obuf, 0, sizeof(obuf));
  181.     memset(hbuf, 0, sizeof(hbuf));
  182.     memset(dbuf, 0, sizeof(dbuf));
  183.     memset(lbuf, 0, sizeof(lbuf));
  184.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  185.     sprintf(hbuf, "%08X", sub->sectorCount);
  186.     sprintf(dbuf, "%s", iCodel((ULONG)sub->sectorCount));
  187.     strcpy(lbuf, "Total sector count");
  188.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  189.     offset+=sizeof(sub->sectorCount);
  190.     PrintSPMiddleBorder(noLineChars);
  191.  
  192.     memset(obuf, 0, sizeof(obuf));
  193.     memset(hbuf, 0, sizeof(hbuf));
  194.     memset(dbuf, 0, sizeof(dbuf));
  195.     memset(lbuf, 0, sizeof(lbuf));
  196.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  197.     sprintf(hbuf, "%08X", sub->badSectorCount);
  198.     sprintf(dbuf, "%s", iCodel((ULONG)sub->badSectorCount));
  199.     strcpy(lbuf, "Bad sector count");
  200.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  201.     offset+=sizeof(sub->badSectorCount);
  202.     PrintSPMiddleBorder(noLineChars);
  203.  
  204.     memset(obuf, 0, sizeof(obuf));
  205.     memset(hbuf, 0, sizeof(hbuf));
  206.     memset(dbuf, 0, sizeof(dbuf));
  207.     memset(lbuf, 0, sizeof(lbuf));
  208.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  209.     sprintf(hbuf, "%08X", sub->bitmapList);
  210.     sprintf(dbuf, "%s", iCodel((ULONG)sub->bitmapList));
  211.     strcpy(lbuf, "Free space bitmap list");
  212.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  213.     offset+=sizeof(sub->bitmapList);
  214.     PrintSPMiddleBorder(noLineChars);
  215.  
  216.     memset(obuf, 0, sizeof(obuf));
  217.     memset(hbuf, 0, sizeof(hbuf));
  218.     memset(dbuf, 0, sizeof(dbuf));
  219.     memset(lbuf, 0, sizeof(lbuf));
  220.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  221.     sprintf(hbuf, "%08X", sub->spareBitmapList);
  222.     sprintf(dbuf, "%s", iCodel((ULONG)sub->spareBitmapList));
  223.     strcpy(lbuf, "Spare bitmap list");
  224.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  225.     offset+=sizeof(sub->spareBitmapList);
  226.     PrintSPMiddleBorder(noLineChars);
  227.  
  228.     memset(obuf, 0, sizeof(obuf));
  229.     memset(hbuf, 0, sizeof(hbuf));
  230.     memset(dbuf, 0, sizeof(dbuf));
  231.     memset(lbuf, 0, sizeof(lbuf));
  232.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  233.     sprintf(hbuf, "%08X", sub->badSectorList);
  234.     sprintf(dbuf, "%s", iCodel((ULONG)sub->badSectorList));
  235.     strcpy(lbuf, "Bad sector list");
  236.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  237.     offset+=sizeof(sub->badSectorList);
  238.     PrintSPMiddleBorder(noLineChars);
  239.  
  240.     memset(obuf, 0, sizeof(obuf));
  241.     memset(hbuf, 0, sizeof(hbuf));
  242.     memset(dbuf, 0, sizeof(dbuf));
  243.     memset(lbuf, 0, sizeof(lbuf));
  244.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  245.     sprintf(hbuf, "%08X", sub->spareBadSectorList);
  246.     sprintf(dbuf, "%s", iCodel((ULONG)sub->spareBadSectorList));
  247.     strcpy(lbuf, "Spare bad sector list");
  248.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  249.     offset+=sizeof(sub->spareBadSectorList);
  250.     PrintSPMiddleBorder(noLineChars);
  251.  
  252.     memset(obuf, 0, sizeof(obuf));
  253.     memset(hbuf, 0, sizeof(hbuf));
  254.     memset(dbuf, 0, sizeof(dbuf));
  255.     memset(lbuf, 0, sizeof(lbuf));
  256.     memset(tbuf, 0, sizeof(tbuf));
  257.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  258.     sprintf(hbuf, "%08X", sub->lastCheckDate);
  259.     if (sub->lastCheckDate>0)
  260.         sprintf(dbuf, "%s", StrLeft(ctime((time_t*)&sub->lastCheckDate), 24, tbuf));
  261.     else
  262.         strcpy(dbuf, "Never");
  263.     strcpy(lbuf, "Date CHKDSK /F last run");
  264.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  265.     offset+=sizeof(sub->lastCheckDate);
  266.     PrintSPMiddleBorder(noLineChars);
  267.  
  268.     memset(obuf, 0, sizeof(obuf));
  269.     memset(hbuf, 0, sizeof(hbuf));
  270.     memset(dbuf, 0, sizeof(dbuf));
  271.     memset(lbuf, 0, sizeof(lbuf));
  272.     memset(tbuf, 0, sizeof(tbuf));
  273.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  274.     sprintf(hbuf, "%08X", sub->lastOptimizedDate);
  275.     if (sub->lastOptimizedDate>0)
  276.         sprintf(dbuf, "%s", StrLeft(ctime((time_t*)&sub->lastOptimizedDate), 24, tbuf));
  277.     else
  278.         strcpy(dbuf, "Never");
  279.     strcpy(lbuf, "Date last optimized");
  280.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  281.     offset+=sizeof(sub->lastOptimizedDate);
  282.     PrintSPMiddleBorder(noLineChars);
  283.  
  284.     memset(obuf, 0, sizeof(obuf));
  285.     memset(hbuf, 0, sizeof(hbuf));
  286.     memset(dbuf, 0, sizeof(dbuf));
  287.     memset(lbuf, 0, sizeof(lbuf));
  288.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  289.     sprintf(hbuf, "%08X", sub->dirBandSectorCount);
  290.     sprintf(dbuf, "%s", iCodel((ULONG)sub->dirBandSectorCount));
  291.     strcpy(lbuf, "Dir band sector count");
  292.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  293.     offset+=sizeof(sub->dirBandSectorCount);
  294.     PrintSPMiddleBorder(noLineChars);
  295.  
  296.     memset(obuf, 0, sizeof(obuf));
  297.     memset(hbuf, 0, sizeof(hbuf));
  298.     memset(dbuf, 0, sizeof(dbuf));
  299.     memset(lbuf, 0, sizeof(lbuf));
  300.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  301.     sprintf(hbuf, "%08X", sub->dirBandStart);
  302.     sprintf(dbuf, "%s", iCodel((ULONG)sub->dirBandStart));
  303.     strcpy(lbuf, "Directory band start");
  304.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  305.     offset+=sizeof(sub->dirBandStart);
  306.     PrintSPMiddleBorder(noLineChars);
  307.  
  308.     memset(obuf, 0, sizeof(obuf));
  309.     memset(hbuf, 0, sizeof(hbuf));
  310.     memset(dbuf, 0, sizeof(dbuf));
  311.     memset(lbuf, 0, sizeof(lbuf));
  312.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  313.     sprintf(hbuf, "%08X", sub->dirBandEnd);
  314.     sprintf(dbuf, "%s", iCodel((ULONG)sub->dirBandEnd));
  315.     strcpy(lbuf, "Directory band end");
  316.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  317.     offset+=sizeof(sub->dirBandEnd);
  318.     PrintSPMiddleBorder(noLineChars);
  319.  
  320.     memset(obuf, 0, sizeof(obuf));
  321.     memset(hbuf, 0, sizeof(hbuf));
  322.     memset(dbuf, 0, sizeof(dbuf));
  323.     memset(lbuf, 0, sizeof(lbuf));
  324.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  325.     sprintf(hbuf, "%08X", sub->dirBandBitmap);
  326.     sprintf(dbuf, "%s", iCodel((ULONG)sub->dirBandBitmap));
  327.     strcpy(lbuf, "Directory band bitmap");
  328.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  329.     offset+=sizeof(sub->dirBandBitmap)+32;
  330.     PrintSPMiddleBorder(noLineChars);
  331.  
  332.     memset(obuf, 0, sizeof(obuf));
  333.     memset(hbuf, 0, sizeof(hbuf));
  334.     memset(dbuf, 0, sizeof(dbuf));
  335.     memset(lbuf, 0, sizeof(lbuf));
  336.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  337.     sprintf(hbuf, "%08X", sub->securityBlock);
  338.     sprintf(dbuf, "%s", iCodel((ULONG)sub->securityBlock));
  339.     strcpy(lbuf, "First ACL block location");
  340.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  341.  
  342.     PrintSPBottomBorder(noLineChars);
  343.  
  344.     return;
  345. }
  346.  
  347. void ShowSpareBlock(PSPAREBLOCK spb, ULONG sectorSize, UCHAR driveLetter, BOOL fullDBList, BOOL noLineChars)
  348. {
  349.     UCHAR lineBuff[81], obuf[7], hbuf[9], dbuf[27], lbuf[33], tbuf[81];
  350.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  351.           botLeftCorner=192, topRightCorner=191,
  352.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  353.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  354.     ULONG offset, i;
  355.  
  356.     if (noLineChars)
  357.         {
  358.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  359.         botLeftCorner='\\'; topRightCorner='\\';
  360.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  361.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  362.         }
  363.  
  364.     PrintSPTopBorder(noLineChars);
  365.  
  366.     memset(lineBuff, 0, sizeof(lineBuff));
  367.     memset(tbuf, 0, sizeof(tbuf));
  368.     lineBuff[0]=vertBar;
  369.  
  370.     memset(lineBuff+1, ' ', 15);
  371.  
  372.     sprintf(tbuf, "HPFS SpareBlock drive %c: - %s bytes/sector", driveLetter, iCodel(sectorSize));
  373.     strcat(lineBuff, tbuf);
  374.  
  375.     memset(lineBuff+strlen(lineBuff), ' ', 78-strlen(lineBuff));
  376.  
  377.     lineBuff[78]=vertBar;
  378.     printf("%s\n", lineBuff);
  379.  
  380.     PrintSPTMiddleBorder(noLineChars);
  381.  
  382.     memset(obuf, 0, sizeof(obuf));
  383.     memset(hbuf, 0, sizeof(hbuf));
  384.     memset(dbuf, 0, sizeof(dbuf));
  385.     memset(lbuf, 0, sizeof(lbuf));
  386.     strcpy(obuf, "Offset");
  387.     strcpy(hbuf, "   Hex  ");
  388.     strcpy(dbuf, " Formatted/Decimal Value  ");
  389.     strcpy(lbuf, "         Value Info         ");
  390.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  391.     PrintSPMiddleBorder(noLineChars);
  392.  
  393.     offset=0;
  394.  
  395.     memset(obuf, 0, sizeof(obuf));
  396.     memset(hbuf, 0, sizeof(hbuf));
  397.     memset(dbuf, 0, sizeof(dbuf));
  398.     memset(lbuf, 0, sizeof(lbuf));
  399.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  400.     sprintf(hbuf, "%08X", spb->signature[0]);
  401.     sprintf(dbuf, "%s", iCodel(spb->signature[0]));
  402.     strcpy(lbuf, "64-bit SpareBlock signature");
  403.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  404.     offset+=sizeof(spb->signature[0]);
  405.     memset(hbuf, 0, sizeof(hbuf));
  406.     memset(dbuf, 0, sizeof(dbuf));
  407.     memset(lbuf, 0, sizeof(lbuf));
  408.     memset(obuf, 0, sizeof(obuf));
  409.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  410.     sprintf(hbuf, "%08X", spb->signature[1]);
  411.     sprintf(dbuf, "%s", iCodel(spb->signature[1]));
  412.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  413.     offset+=sizeof(spb->signature[1]);
  414.     PrintSPMiddleBorder(noLineChars);
  415.  
  416.     memset(obuf, 0, sizeof(obuf));
  417.     memset(hbuf, 0, sizeof(hbuf));
  418.     memset(dbuf, 0, sizeof(dbuf));
  419.     memset(lbuf, 0, sizeof(lbuf));
  420.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  421.     sprintf(hbuf, "%02X", spb->partStatus);
  422.     sprintf(dbuf, "%s", BitString(spb->partStatus));
  423.     strcpy(lbuf, "Partition status byte");
  424.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  425.     offset+=sizeof(spb->partStatus)+3;
  426.     memset(obuf, 0, sizeof(obuf));
  427.     memset(hbuf, 0, sizeof(hbuf));
  428.     memset(dbuf, 0, sizeof(dbuf));
  429.     memset(lbuf, 0, sizeof(lbuf));
  430.     strcpy(dbuf, "^ ^ ^ ^ ^ ^ ^ ^ ");
  431.     strcpy(lbuf, "    0: Dirty flag");
  432.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  433.     memset(dbuf, 0, sizeof(dbuf));
  434.     memset(lbuf, 0, sizeof(lbuf));
  435.     strcpy(dbuf, "7 6 5 4 3 2 1 0 ");
  436.     strcpy(lbuf, "    1: Spare DirBlk's used");
  437.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  438.     memset(dbuf, 0, sizeof(dbuf));
  439.     memset(lbuf, 0, sizeof(lbuf));
  440.     strcpy(lbuf, "    2: Hotfix sectors used");
  441.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  442.     memset(lbuf, 0, sizeof(lbuf));
  443.     strcpy(lbuf, "    3: Bad sectors exist");
  444.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  445.     memset(lbuf, 0, sizeof(lbuf));
  446.     strcpy(lbuf, "    4: Bad bitmaps exist");
  447.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  448.     memset(lbuf, 0, sizeof(lbuf));
  449.     strcpy(lbuf, "    5: Fast formatted");
  450.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  451.     memset(lbuf, 0, sizeof(lbuf));
  452.     strcpy(lbuf, "    6: Unknown");
  453.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  454.     memset(lbuf, 0, sizeof(lbuf));
  455.     strcpy(lbuf, "    7: Written by old IFS");
  456.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  457.     PrintSPMiddleBorder(noLineChars);
  458.  
  459.     memset(obuf, 0, sizeof(obuf));
  460.     memset(hbuf, 0, sizeof(hbuf));
  461.     memset(dbuf, 0, sizeof(dbuf));
  462.     memset(lbuf, 0, sizeof(lbuf));
  463.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  464.     sprintf(hbuf, "%08X", spb->hotfixList);
  465.     sprintf(dbuf, "%s", iCodel((ULONG)spb->hotfixList));
  466.     strcpy(lbuf, "Hotfix list location");
  467.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  468.     offset+=sizeof(spb->hotfixList);
  469.     PrintSPMiddleBorder(noLineChars);
  470.  
  471.     memset(obuf, 0, sizeof(obuf));
  472.     memset(hbuf, 0, sizeof(hbuf));
  473.     memset(dbuf, 0, sizeof(dbuf));
  474.     memset(lbuf, 0, sizeof(lbuf));
  475.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  476.     sprintf(hbuf, "%08X", spb->hotfixUsed);
  477.     sprintf(dbuf, "%s", iCodel((ULONG)spb->hotfixUsed));
  478.     strcpy(lbuf, "Hotfix sectors in use");
  479.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  480.     offset+=sizeof(spb->hotfixUsed);
  481.     PrintSPMiddleBorder(noLineChars);
  482.  
  483.     memset(obuf, 0, sizeof(obuf));
  484.     memset(hbuf, 0, sizeof(hbuf));
  485.     memset(dbuf, 0, sizeof(dbuf));
  486.     memset(lbuf, 0, sizeof(lbuf));
  487.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  488.     sprintf(hbuf, "%08X", spb->hotfixTotal);
  489.     sprintf(dbuf, "%s", iCodel((ULONG)spb->hotfixTotal));
  490.     strcpy(lbuf, "Total hotfix sectors");
  491.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  492.     offset+=sizeof(spb->hotfixTotal);
  493.     PrintSPMiddleBorder(noLineChars);
  494.  
  495.     memset(obuf, 0, sizeof(obuf));
  496.     memset(hbuf, 0, sizeof(hbuf));
  497.     memset(dbuf, 0, sizeof(dbuf));
  498.     memset(lbuf, 0, sizeof(lbuf));
  499.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  500.     sprintf(hbuf, "%08X", spb->spareDirBlockCount);
  501.     sprintf(dbuf, "%s", iCodel((ULONG)spb->spareDirBlockCount));
  502.     strcpy(lbuf, "Spare DirBlk count");
  503.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  504.     offset+=sizeof(spb->spareDirBlockCount);
  505.     PrintSPMiddleBorder(noLineChars);
  506.  
  507.     memset(obuf, 0, sizeof(obuf));
  508.     memset(hbuf, 0, sizeof(hbuf));
  509.     memset(dbuf, 0, sizeof(dbuf));
  510.     memset(lbuf, 0, sizeof(lbuf));
  511.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  512.     sprintf(hbuf, "%08X", spb->spareDirBlockFree);
  513.     sprintf(dbuf, "%s", iCodel((ULONG)spb->spareDirBlockFree));
  514.     strcpy(lbuf, "Free spare DirBlk's");
  515.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  516.     offset+=sizeof(spb->spareDirBlockFree);
  517.     PrintSPMiddleBorder(noLineChars);
  518.  
  519.     memset(obuf, 0, sizeof(obuf));
  520.     memset(hbuf, 0, sizeof(hbuf));
  521.     memset(dbuf, 0, sizeof(dbuf));
  522.     memset(lbuf, 0, sizeof(lbuf));
  523.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  524.     sprintf(hbuf, "%08X", spb->codePageSector);
  525.     sprintf(dbuf, "%s", iCodel((ULONG)spb->codePageSector));
  526.     strcpy(lbuf, "Code page list location");
  527.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  528.     offset+=sizeof(spb->codePageSector);
  529.     PrintSPMiddleBorder(noLineChars);
  530.  
  531.     memset(obuf, 0, sizeof(obuf));
  532.     memset(hbuf, 0, sizeof(hbuf));
  533.     memset(dbuf, 0, sizeof(dbuf));
  534.     memset(lbuf, 0, sizeof(lbuf));
  535.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  536.     sprintf(hbuf, "%08X", spb->codePageCount);
  537.     sprintf(dbuf, "%s", iCodel((ULONG)spb->codePageCount));
  538.     strcpy(lbuf, "Number of code pages");
  539.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  540.     offset+=sizeof(spb->codePageCount);
  541.     PrintSPMiddleBorder(noLineChars);
  542.  
  543.     memset(obuf, 0, sizeof(obuf));
  544.     memset(hbuf, 0, sizeof(hbuf));
  545.     memset(dbuf, 0, sizeof(dbuf));
  546.     memset(lbuf, 0, sizeof(lbuf));
  547.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  548.     sprintf(hbuf, "%08X", spb->superBlockCRC);
  549.     sprintf(dbuf, "%s", iCodel((ULONG)spb->superBlockCRC));
  550.     strcpy(lbuf, "HPFS SuperBlock 32-bit CRC");
  551.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  552.     offset+=sizeof(spb->superBlockCRC);
  553.     PrintSPMiddleBorder(noLineChars);
  554.  
  555.     memset(obuf, 0, sizeof(obuf));
  556.     memset(hbuf, 0, sizeof(hbuf));
  557.     memset(dbuf, 0, sizeof(dbuf));
  558.     memset(lbuf, 0, sizeof(lbuf));
  559.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  560.     sprintf(hbuf, "%08X", spb->spareBlockCRC);
  561.     sprintf(dbuf, "%s", iCodel((ULONG)spb->spareBlockCRC));
  562.     strcpy(lbuf, "HPFS SpareBlock 32-bit CRC");
  563.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  564.     offset+=sizeof(spb->spareBlockCRC)+60;
  565.     PrintSPMiddleBorder(noLineChars);
  566.  
  567.     memset(obuf, 0, sizeof(obuf));
  568.     memset(hbuf, 0, sizeof(hbuf));
  569.     memset(dbuf, 0, sizeof(dbuf));
  570.     memset(lbuf, 0, sizeof(lbuf));
  571.     sprintf(obuf, "%02X/%03u", offset, offset+1);
  572.     sprintf(hbuf, "%08X", spb->firstSpareDirBlock[0]);
  573.     sprintf(dbuf, "%s", iCodel(spb->firstSpareDirBlock[0]));
  574.     strcpy(lbuf, "Spare DirBlk #1 location");
  575.     PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  576.     offset+=sizeof(spb->firstSpareDirBlock[0]);
  577.     if (fullDBList)
  578.         {
  579.         for (i=1; i<spb->spareDirBlockCount; i++)
  580.             {
  581.             memset(obuf, 0, sizeof(obuf));
  582.             memset(hbuf, 0, sizeof(hbuf));
  583.             memset(dbuf, 0, sizeof(dbuf));
  584.             memset(lbuf, 0, sizeof(lbuf));
  585.             sprintf(obuf, "%02X/%03u", offset, offset+1);
  586.             sprintf(hbuf, "%08X", spb->firstSpareDirBlock[i]);
  587.             sprintf(dbuf, "%s", iCodel(spb->firstSpareDirBlock[i]));
  588.             sprintf(lbuf, "Spare DirBlk #%u location", i+1);
  589.             PrintSPDataLine(obuf, hbuf, dbuf, lbuf, noLineChars);
  590.             offset+=sizeof(spb->firstSpareDirBlock[i]);
  591.             }
  592.         }
  593.  
  594.     PrintSPBottomBorder(noLineChars);
  595.  
  596.     return;
  597. }
  598.  
  599. void ShowSystemUsage(UCHAR driveLetter, PSYSTEMUSAGE su, BOOL noLineChars)
  600. {
  601.     ULONG i;
  602.     UCHAR horzBar=196;
  603.     UCHAR lineBuff[81];
  604.  
  605.     if (noLineChars)
  606.         {
  607.         horzBar='-';
  608.         }
  609.  
  610.     printf("\n    Drive %c: - %s bytes - %s bytes/sector\n", driveLetter,
  611.            fCodel((double)su->sectorSize*(double)su->totalSectors),
  612.            iCodel(su->sectorSize));
  613.  
  614.     printf(" ");
  615.     memset(lineBuff, 0, sizeof(lineBuff));
  616.  
  617.     memset(lineBuff, horzBar, 77);
  618.  
  619.     printf("%s", lineBuff);
  620.  
  621.     printf("\n%12s - Directory band sectors\n",
  622.            fCodel((double)su->dirBandSectors*(double)su->sectorSize));
  623.     printf("%12s - Free space bitmaps\n",
  624.            fCodel((double)su->bitmapSectors*(double)su->sectorSize));
  625.     printf("%12s - Hotfix sectors (not necessarily in use)\n",
  626.            fCodel((double)su->hotfixSectors*(double)su->sectorSize));
  627.     printf("%12s - Spare directory blocks (4 sectors per block)\n",
  628.            fCodel((double)su->spareDirBlockSectors*(double)su->sectorSize));
  629.     printf("%12s - Front structures (BootBlock, mini-FSD, etc.)\n",
  630.            fCodel((double)su->frontStructures*(double)su->sectorSize));
  631.     printf("%12s - Initial security ACL block\n",
  632.            fCodel((double)su->securityBlockSectors*(double)su->sectorSize));
  633.     printf("%12s - Free space bitmap list sectors (shows location of bitmaps)\n",
  634.            fCodel((double)su->bitmapListSectors*(double)su->sectorSize));
  635.     printf("%12s - Directory band bitmap sectors\n",
  636.            fCodel((double)su->dirBandBitmapSectors*(double)su->sectorSize));
  637.     printf("%12s - Bad sector list (even if there are none)\n",
  638.            fCodel((double)su->badSectorListSectors*(double)su->sectorSize));
  639.     printf("%12s - Hot fix list sectors (location pointers)\n",
  640.            fCodel((double)su->hotfixListSectors*(double)su->sectorSize));
  641.     printf("%12s - Root directory DirBlock\n",
  642.            fCodel((double)su->rootDirBlock*(double)su->sectorSize));
  643.     printf("%12s - Code page sectors\n",
  644.            fCodel((double)su->codePageSectors*(double)su->sectorSize));
  645.     printf("%12s - Root directory FNode\n",
  646.            fCodel((double)su->rootFNode*(double)su->sectorSize));
  647.  
  648.     printf(" ");
  649.     memset(lineBuff, 0, sizeof(lineBuff));
  650.  
  651.     memset(lineBuff, horzBar, 77);
  652.  
  653.     printf("%s", lineBuff);
  654.  
  655.     printf("\n");
  656.  
  657.     printf("%12s - Total system usage\n",
  658.            fCodel((double)su->totalSystemSectors*(double)su->sectorSize));
  659.  
  660.     return;
  661. }
  662.  
  663. void ShowFreeSpaceInfo(PFREESPACEINFO fsi, UCHAR driveLetter, BOOL noLineChars)
  664. {
  665.     ULONG i;
  666.     UCHAR lineBuff[81], secBuff[14], byteBuff[18];
  667.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  668.           botLeftCorner=192, topRightCorner=191,
  669.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  670.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  671.  
  672.     if (noLineChars)
  673.         {
  674.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  675.         botLeftCorner='\\'; topRightCorner='\\';
  676.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  677.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  678.         }
  679.  
  680.     PrintFSTopBorder(noLineChars);
  681.  
  682.     memset(lineBuff, 0, sizeof(lineBuff));
  683.     lineBuff[0]=vertBar;
  684.     strcat(lineBuff, "    Drive ");
  685.     lineBuff[11]=driveLetter;
  686.     strcat(lineBuff, ": ");
  687.     lineBuff[14]=vertBar;
  688.     strcat(lineBuff, " Free Sectors ");
  689.     lineBuff[29]=vertBar;
  690.     strcat(lineBuff, "      Free Bytes ");
  691.     lineBuff[47]=vertBar;
  692.     printf("%s\n", lineBuff);
  693.  
  694.     PrintFSMiddleBorder(noLineChars);
  695.  
  696.     memset(lineBuff, 0, sizeof(lineBuff));
  697.     lineBuff[0]=vertBar;
  698.     strcat(lineBuff, "    Reported ");
  699.     lineBuff[14]=vertBar;
  700.     memset(secBuff, 0, sizeof(secBuff));
  701.     sprintf(secBuff, "%13s", iCodel(fsi->reportedFreeSectors));
  702.     strcat(lineBuff, secBuff);
  703.     lineBuff[28]=' ';
  704.     lineBuff[29]=vertBar;
  705.     memset(byteBuff, 0, sizeof(byteBuff));
  706.     sprintf(byteBuff, "%16s", fCodel((double)fsi->reportedFreeSectors*(double)fsi->sectorSize));
  707.     strcat(lineBuff, byteBuff);
  708.     lineBuff[46]=' ';
  709.     lineBuff[47]=vertBar;
  710.     printf("%s\n", lineBuff);
  711.  
  712.     PrintFSMiddleBorder(noLineChars);
  713.  
  714.     memset(lineBuff, 0, sizeof(lineBuff));
  715.     lineBuff[0]=vertBar;
  716.     strcat(lineBuff, "      Actual ");
  717.     lineBuff[14]=vertBar;
  718.     memset(secBuff, 0, sizeof(secBuff));
  719.     sprintf(secBuff, "%13s", iCodel(fsi->actualFreeSectors));
  720.     strcat(lineBuff, secBuff);
  721.     lineBuff[28]=' ';
  722.     lineBuff[29]=vertBar;
  723.     memset(byteBuff, 0, sizeof(byteBuff));
  724.     sprintf(byteBuff, "%16s", fCodel((double)fsi->actualFreeSectors*(double)fsi->sectorSize));
  725.     strcat(lineBuff, byteBuff);
  726.     lineBuff[46]=' ';
  727.     lineBuff[47]=vertBar;
  728.     printf("%s\n", lineBuff);
  729.  
  730.     PrintFSMiddleBorder(noLineChars);
  731.  
  732.     memset(lineBuff, 0, sizeof(lineBuff));
  733.     lineBuff[0]=vertBar;
  734.     strcat(lineBuff, " Discrepancy ");
  735.     lineBuff[14]=vertBar;
  736.     memset(secBuff, 0, sizeof(secBuff));
  737.     sprintf(secBuff, "%13s", iCodel(fsi->actualFreeSectors-fsi->reportedFreeSectors));
  738.     strcat(lineBuff, secBuff);
  739.     lineBuff[28]=' ';
  740.     lineBuff[29]=vertBar;
  741.     memset(byteBuff, 0, sizeof(byteBuff));
  742.     sprintf(byteBuff, "%16s", fCodel((double)fsi->actualFreeSectors*(double)fsi->sectorSize-
  743.                                      (double)fsi->reportedFreeSectors*(double)fsi->sectorSize));
  744.     strcat(lineBuff, byteBuff);
  745.     lineBuff[46]=' ';
  746.     lineBuff[47]=vertBar;
  747.     printf("%s\n", lineBuff);
  748.  
  749.     PrintFSBottomBorder(noLineChars);
  750.  
  751.     return;
  752. }
  753.  
  754. void PrintFSTopBorder(BOOL noLineChars)
  755. {
  756.     ULONG i;
  757.     UCHAR lineBuff[81];
  758.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  759.           botLeftCorner=192, topRightCorner=191,
  760.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  761.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  762.  
  763.     if (noLineChars)
  764.         {
  765.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  766.         botLeftCorner='\\'; topRightCorner='\\';
  767.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  768.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  769.         }
  770.  
  771.     memset(lineBuff, 0, sizeof(lineBuff));
  772.     lineBuff[0]=topLeftCorner;
  773.  
  774.     memset(lineBuff+1, horzBar, 13);
  775.  
  776.     lineBuff[14]=teeBarTop;
  777.  
  778.     memset(lineBuff+15, horzBar, 14);
  779.  
  780.     lineBuff[29]=teeBarTop;
  781.  
  782.     memset(lineBuff+30, horzBar, 17);
  783.  
  784.     lineBuff[47]=topRightCorner;
  785.     printf("\n%s\n", lineBuff);
  786.  
  787.     return;
  788. }
  789.  
  790. void PrintFSMiddleBorder(BOOL noLineChars)
  791. {
  792.     ULONG i;
  793.     UCHAR lineBuff[81];
  794.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  795.           botLeftCorner=192, topRightCorner=191,
  796.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  797.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  798.  
  799.     if (noLineChars)
  800.         {
  801.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  802.         botLeftCorner='\\'; topRightCorner='\\';
  803.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  804.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  805.         }
  806.  
  807.     memset(lineBuff, 0, sizeof(lineBuff));
  808.     lineBuff[0]=teeBarLeft;
  809.  
  810.     memset(lineBuff+1, horzBar, 13);
  811.  
  812.     lineBuff[14]=crossBar;
  813.  
  814.     memset(lineBuff+15, horzBar, 14);
  815.  
  816.     lineBuff[29]=crossBar;
  817.  
  818.     memset(lineBuff+30, horzBar, 17);
  819.  
  820.     lineBuff[47]=teeBarRight;
  821.     printf("%s\n", lineBuff);
  822.  
  823.     return;
  824. }
  825.  
  826. void PrintFSBottomBorder(BOOL noLineChars)
  827. {
  828.     ULONG i;
  829.     UCHAR lineBuff[81];
  830.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  831.           botLeftCorner=192, topRightCorner=191,
  832.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  833.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  834.  
  835.     if (noLineChars)
  836.         {
  837.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  838.         botLeftCorner='\\'; topRightCorner='\\';
  839.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  840.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  841.         }
  842.  
  843.     memset(lineBuff, 0, sizeof(lineBuff));
  844.     lineBuff[0]=botLeftCorner;
  845.  
  846.     memset(lineBuff+1, horzBar, 13);
  847.  
  848.     lineBuff[14]=teeBarBot;
  849.  
  850.     memset(lineBuff+15, horzBar, 14);
  851.  
  852.     lineBuff[29]=teeBarBot;
  853.  
  854.     memset(lineBuff+30, horzBar, 17);
  855.  
  856.     lineBuff[47]=botRightCorner;
  857.     printf("%s\n", lineBuff);
  858.  
  859.     return;
  860. }
  861.  
  862. void PrintSPTopBorder(BOOL noLineChars)
  863. {
  864.     ULONG i;
  865.     UCHAR lineBuff[81];
  866.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  867.           botLeftCorner=192, topRightCorner=191,
  868.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  869.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  870.  
  871.     if (noLineChars)
  872.         {
  873.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  874.         botLeftCorner='\\'; topRightCorner='\\';
  875.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  876.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  877.         }
  878.  
  879.     memset(lineBuff, 0, sizeof(lineBuff));
  880.     lineBuff[0]=topLeftCorner;
  881.  
  882.     memset(lineBuff+1, horzBar, 77);
  883.  
  884.     lineBuff[78]=topRightCorner;
  885.  
  886.     printf("\n%s\n", lineBuff);
  887.  
  888.     return;
  889. }
  890.  
  891. void PrintSPTMiddleBorder(BOOL noLineChars)
  892. {
  893.     ULONG i;
  894.     UCHAR lineBuff[81];
  895.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  896.           botLeftCorner=192, topRightCorner=191,
  897.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  898.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  899.  
  900.     if (noLineChars)
  901.         {
  902.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  903.         botLeftCorner='\\'; topRightCorner='\\';
  904.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  905.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  906.         }
  907.  
  908.     memset(lineBuff, 0, sizeof(lineBuff));
  909.     lineBuff[0]=teeBarLeft;
  910.  
  911.     memset(lineBuff+1, horzBar, 8);
  912.  
  913.     lineBuff[9]=teeBarTop;
  914.  
  915.     memset(lineBuff+10, horzBar, 10);
  916.  
  917.     lineBuff[20]=teeBarTop;
  918.  
  919.     memset(lineBuff+21, horzBar, 26);
  920.  
  921.     lineBuff[47]=teeBarTop;
  922.  
  923.     memset(lineBuff+48, horzBar, 30);
  924.  
  925.     lineBuff[78]=teeBarRight;
  926.     printf("%s\n", lineBuff);
  927.  
  928.     return;
  929. }
  930.  
  931. void PrintSPMiddleBorder(BOOL noLineChars)
  932. {
  933.     ULONG i;
  934.     UCHAR lineBuff[81];
  935.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  936.           botLeftCorner=192, topRightCorner=191,
  937.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  938.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  939.  
  940.     if (noLineChars)
  941.         {
  942.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  943.         botLeftCorner='\\'; topRightCorner='\\';
  944.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  945.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  946.         }
  947.  
  948.     memset(lineBuff, 0, sizeof(lineBuff));
  949.     lineBuff[0]=teeBarLeft;
  950.  
  951.     memset(lineBuff+1, horzBar, 8);
  952.  
  953.     lineBuff[9]=crossBar;
  954.  
  955.     memset(lineBuff+10, horzBar, 10);
  956.  
  957.     lineBuff[20]=crossBar;
  958.  
  959.     memset(lineBuff+21, horzBar, 26);
  960.  
  961.     lineBuff[47]=crossBar;
  962.  
  963.     memset(lineBuff+48, horzBar, 30);
  964.  
  965.     lineBuff[78]=teeBarRight;
  966.     printf("%s\n", lineBuff);
  967.  
  968.     return;
  969. }
  970.  
  971. void PrintSPBottomBorder(BOOL noLineChars)
  972. {
  973.     ULONG i;
  974.     UCHAR lineBuff[81];
  975.     UCHAR vertBar=179, horzBar=196, topLeftCorner=218,
  976.           botLeftCorner=192, topRightCorner=191,
  977.           botRightCorner=217, teeBarTop=194, teeBarBot=193,
  978.           teeBarRight=180, teeBarLeft=195, crossBar=197;
  979.  
  980.     if (noLineChars)
  981.         {
  982.         vertBar='|'; horzBar='-'; topLeftCorner='/';
  983.         botLeftCorner='\\'; topRightCorner='\\';
  984.         botRightCorner='/'; teeBarTop='-'; teeBarBot='-';
  985.         teeBarRight='|'; teeBarLeft='|'; crossBar='|';
  986.         }
  987.  
  988.     memset(lineBuff, 0, sizeof(lineBuff));
  989.     lineBuff[0]=botLeftCorner;
  990.  
  991.     memset(lineBuff+1, horzBar, 8);
  992.  
  993.     lineBuff[9]=teeBarBot;
  994.  
  995.     memset(lineBuff+10, horzBar, 10);
  996.  
  997.     lineBuff[20]=teeBarBot;
  998.  
  999.     memset(lineBuff+21, horzBar, 26);
  1000.  
  1001.     lineBuff[47]=teeBarBot;
  1002.  
  1003.     memset(lineBuff+48, horzBar, 30);
  1004.  
  1005.     lineBuff[78]=botRightCorner;
  1006.     printf("%s\n", lineBuff);
  1007.  
  1008.     return;
  1009. }
  1010.  
  1011. void PrintSPDataLine(PUCHAR off, PUCHAR hex, PUCHAR dec, PUCHAR label, BOOL noLineChars)
  1012. {
  1013.     UCHAR lineBuff[81], tbuf[81];
  1014.     UCHAR vertBar=179;
  1015.  
  1016.     if (noLineChars)
  1017.         {
  1018.         vertBar='|';
  1019.         }
  1020.  
  1021.     memset(lineBuff, 0, sizeof(lineBuff));
  1022.     lineBuff[0]=vertBar;
  1023.     lineBuff[1]=' ';
  1024.     memset(tbuf, 0, sizeof(tbuf));
  1025.     sprintf(tbuf, "%6s", off);
  1026.     strcat(lineBuff, tbuf);
  1027.     lineBuff[8]=' ';
  1028.     lineBuff[9]=vertBar;
  1029.     lineBuff[10]=' ';
  1030.     memset(tbuf, 0, sizeof(tbuf));
  1031.     sprintf(tbuf, "%8s", hex);
  1032.     strcat(lineBuff, tbuf);
  1033.     lineBuff[19]=' ';
  1034.     lineBuff[20]=vertBar;
  1035.     lineBuff[21]=' ';
  1036.     memset(tbuf, 0, sizeof(tbuf));
  1037.     sprintf(tbuf, "%24s", dec);
  1038.     strcat(lineBuff, tbuf);
  1039.     lineBuff[46]=' ';
  1040.     lineBuff[47]=vertBar;
  1041.     lineBuff[48]=' ';
  1042.     memset(tbuf, 0, sizeof(tbuf));
  1043.     sprintf(tbuf, "%-30s", label);
  1044.     strcat(lineBuff, tbuf);
  1045.     lineBuff[77]=' ';
  1046.     lineBuff[78]=vertBar;
  1047.     printf("%s\n", lineBuff);
  1048.  
  1049.     return;
  1050. }
  1051.