/*static char *SCCSID = "@(#)prntstr.c	6.2 91/01/14";*/
#define SCCSID "@(#)prntstr.c	6.2 91/01/14"
/*
 *	IBM/Microsoft Confidential
 *
 *	Copyright (c) IBM Corporation 1987, 1989
 *	Copyright (c) Microsoft Corporation 1987, 1989
 *
 *	All Rights Reserved
 *
 */

/*
 *  PRNTSTR.C
 *
 *    DESCRIPTION
 *    
 *      Displays the different structures and FSD data on the debug screen.
 *      
 *              
 *  REVISION HISTORY (in reverse chronological order)
 *  -----------------------------------------------------------------------
 *  9/17/89     Brian Andrew    PrintMemStatus.
 *  8/28/89     Brian Andrew    Added routines for FindFirst structures.
 *  8/4/89      Brian Andrew    Initial Blank Template.
 *
 *
 *  TO DO
 *  -------------------------------------------------------------------------
 */


#define INCL_DOSERRORS
#define INCL_NOPMAPI
#include <os2.h>
#include <fsd.h>
#include <fsh.h>

#include "cdfs.h"
#include "sem.h"
#include "vol.h"
#include "path.h"
#include "buffer.h"
#include "mem.h"
#include "heap.h"
#include "pr_memin.h"
#include "pr_strng.h"
#include "message.h"

#ifdef STATS_H
#include "stats.h"
#endif

#include "fsdata.h"
#include "file.h"
#include "pr_misc.h"
#include "memory.h"

#ifdef DEBUG
#include "pr_debug.h"
#endif

VOID PrintVPFSI (pvpfsi)
PVPFSI pvpfsi;
{
	dprintf ("Printing VPFSI structure\n");
	dprintf ("    vpi_vid       %lx\n", pvpfsi->vpi_vid);
	dprintf ("    vpi_hDEV      %lx\n", pvpfsi->vpi_hDEV);
	dprintf ("    vpi_bsize     %d\n", pvpfsi->vpi_bsize);
	dprintf ("    vpi_totsec    %ld\n", pvpfsi->vpi_totsec);
	dprintf ("    vpi_trksec    %d\n", pvpfsi->vpi_trksec);
	dprintf ("    vpi_nhead     %d\n", pvpfsi->vpi_nhead);
	dprintf ("    vpi_text      %Fs\n", pvpfsi->vpi_text);
} /* end PrintVPFSI */


VOID PrintCDFSI (pcdfsi)
PCDFSI pcdfsi;
{
	dprintf ("Printing CDFSI structure\n");
	dprintf ("    cdi_hVPB      %d\n", pcdfsi->cdi_hVPB);
	dprintf ("    cdi_end       %d\n", pcdfsi->cdi_end);
	dprintf ("    CDI_ISVALID   %d\n", (pcdfsi->cdi_flags & CDI_ISVALID));
	dprintf ("    CDI_ISROOT    %d\n", (pcdfsi->cdi_flags & CDI_ISROOT));
	dprintf ("    CDI_ISCURRENT %d\n", (pcdfsi->cdi_flags & CDI_ISCURRENT));
	dprintf ("    cdi_curdir    %Fs\n", pcdfsi->cdi_curdir);
}/* end PrintCDFSI */


VOID PrintSFFSI (psffsi)
PSFFSI psffsi;
{
	dprintf ("Printing SFFSI structure\n");
	dprintf ("    sfi_mode        %lx\n",   psffsi->sfi_mode);
	dprintf ("    sfi_hVPB        %d\n",    psffsi->sfi_hVPB);
	dprintf ("    Creation year   %d,",     GET_YEAR (psffsi->sfi_cdate));
	dprintf ("    Creation month  %d,",     GET_MONTH (psffsi->sfi_cdate));
	dprintf ("    Creation day    %d\n",    GET_DAY (psffsi->sfi_cdate));
	dprintf ("    Creation hour   %d'",     GET_HOUR (psffsi->sfi_ctime));
	dprintf ("    Creation minute %d'",     GET_MINUTE (psffsi->sfi_ctime));
	dprintf ("    Creation second %d\n",    GET_SECOND (psffsi->sfi_ctime));
	dprintf ("    Access year     %d,",     GET_YEAR (psffsi->sfi_adate));
	dprintf ("    Access month    %d,",     GET_MONTH (psffsi->sfi_adate));
	dprintf ("    Access day      %d\n",    GET_DAY (psffsi->sfi_adate));
	dprintf ("    Access hour     %d'",     GET_HOUR (psffsi->sfi_atime));
	dprintf ("    Access minute   %d'",     GET_MINUTE (psffsi->sfi_atime));
	dprintf ("    Access second   %d\n",    GET_SECOND (psffsi->sfi_atime));
	dprintf ("    Write year      %d,",     GET_YEAR (psffsi->sfi_mdate));
	dprintf ("    Write month     %d,",     GET_MONTH (psffsi->sfi_mdate));
	dprintf ("    Write day       %d\n",    GET_DAY (psffsi->sfi_mdate));
	dprintf ("    Write hour      %d'",     GET_HOUR (psffsi->sfi_mtime));
	dprintf ("    Write minute    %d'",     GET_MINUTE (psffsi->sfi_mtime));
	dprintf ("    Write second    %d\n",    GET_SECOND (psffsi->sfi_mtime));
	dprintf ("    sfi_size      %ld\n", psffsi->sfi_size);
	dprintf ("    sfi_position  %ld\n", psffsi->sfi_position);
	dprintf ("    sfi_UID       %d\n", psffsi->sfi_UID);
	dprintf ("    sfi_PID       %d\n", psffsi->sfi_PID);
	dprintf ("    sfi_PDB       %d\n", psffsi->sfi_PDB);
	dprintf ("    sfi_selfsfn   %d\n", psffsi->sfi_selfsfn);
	dprintf ("    STYPE_FILE    %d\n", (psffsi->sfi_type & STYPE_FILE));
	dprintf ("    STYPE_DEVICE  %d\n", (psffsi->sfi_type & STYPE_DEVICE));
	dprintf ("    STYPE_NMPIPE  %d\n", (psffsi->sfi_type & STYPE_NMPIPE));
	dprintf ("    STYPE_FCB     %d\n", (psffsi->sfi_type & STYPE_FCB));
} /* end PrintSFFSI */


VOID PrintFSFSI (pfsfsi)
PFSFSI pfsfsi;
{
	dprintf ("Printing FSFSI structure\n");
	dprintf ("    fsi_hVPB      %d\n", pfsfsi->fsi_hVPB);
} /* end PrintFSFSI */


VOID PrintBUF (pbBUF)
PBUF pbBUF;
{
	dprintf ("Printing BUF structure\n");
	dprintf ("    This address is       %Fp\n", pbBUF);
	dprintf ("    The owner is          %Fp\n", pbBUF->pblBufOwner);
	dprintf ("    BufList owns is       %d\n",  pbBUF->fBLOwns);
	dprintf ("    The number of users   %d\n",  pbBUF->cUsers);
	dprintf ("    The sector address    %Fp\n", pbBUF->sSector);
	dprintf ("    The prev BUF is       %Fp\n", pbBUF->pbPrevBUF);
	dprintf ("    The next BUF is       %Fp\n", pbBUF->pbNextBUF);
} /* end PrintBuf */


VOID PrintBufListAll (pblBufList)
PBUF_LIST pblBufList;
{
	while (pblBufList)
	{
		PrintBufList (pblBufList);
		Int3();
		if (pblBufList->pbBuf)
			PrintBUF ((PBUF) pblBufList->pbBuf);
		Int3();

		pblBufList = pblBufList->pblNext;
	}

} /* end PrintBufListAll */


VOID PrintBufList (pblBufList)
PBUF_LIST pblBufList;
{
	dprintf ("Printing BUF_LIST structure\n");
	dprintf ("    SectorNum             %ld\n", pblBufList->snSectNum);
	dprintf ("    BUF pointer           %Fp\n", pblBufList->pbBuf);
	dprintf ("    Pointer to Prev       %Fp\n", pblBufList->pblPrev);
	dprintf ("    Pointer to Next       %Fp\n", pblBufList->pblNext);
} /* end PrintBufList */


VOID PrintRPI (prpiRawPI)
PRAW_PATH_ISO prpiRawPI;
{
	dprintf ("Printing a ISO Path Entry\n");
	dprintf ("    Length Dir ID         %d\n", prpiRawPI->cbLenDirID);
	dprintf ("    XAR length            %d\n", prpiRawPI->clbXARLen);
	dprintf ("    Parent number         %d\n", prpiRawPI->pnParentNum);
	dprintf ("    Directory Location    %ld\n", prpiRawPI->lbLocDir);
	if ((prpiRawPI->cbLenDirID == 1) && (prpiRawPI->sDirID[0] == '\0'))
		dprintf ("    Directory Name        .\n");
	else if ((prpiRawPI->cbLenDirID == 1) && (prpiRawPI->sDirID[0] == '\1'))
		dprintf ("    Directory Name        ..\n");
	else
	{
		dprintf ("    Directory Name        ");
		PrintMsgArray (prpiRawPI->sDirID, prpiRawPI->cbLenDirID);
		dprintf ("\n");
	}

} /* end PrintRPI */


VOID PrintRPH (prphRawPH)
PRAW_PATH_HSG prphRawPH;
{
	dprintf ("Printing a HSG Path Entry\n");
	dprintf ("    Length Dir ID         %d\n", prphRawPH->cbLenDirID);
	dprintf ("    XAR length            %d\n", prphRawPH->clbXARLen);
	dprintf ("    Parent number         %d\n", prphRawPH->pnParentNum);
	dprintf ("    Directory Location    %ld\n", prphRawPH->lbLocDir);
	if ((prphRawPH->cbLenDirID == 1) && (prphRawPH->sDirID[0] == '\0'))
		dprintf ("    Directory Name        .\n");
	else if ((prphRawPH->cbLenDirID == 1) && (prphRawPH->sDirID[0] == '\1'))
		dprintf ("    Directory Name        ..\n");
	else
	{
		dprintf ("    Directory Name        ");
		PrintMsgArray (prphRawPH->sDirID, prphRawPH->cbLenDirID);
		dprintf ("\n");
	}

} /* end PrintRPH */


VOID PrintPathTableAll (pptPathTable)
PPATH_TABLE pptPathTable;
{
	while (pptPathTable)
	{
		PrintPathTable (pptPathTable);
		Int3();
		PrintPathEntry ((PPATH_ENTRY) &(pptPathTable->pePathEntry));
		if (pptPathTable->pbBuf)
			PrintBUF ((PBUF) pptPathTable->pbBuf);
		Int3();

		pptPathTable = pptPathTable->pptNextPTSect;
	}

} /* end PrintPathTableAll */


VOID PrintPathEntry (ppePathEntry)
PPATH_ENTRY ppePathEntry;
{
	dprintf ("Printing a PATH_ENTRY structure\n");
	dprintf ("    Directory Location    %ld\n", ppePathEntry->lbLocDir);
	dprintf ("    XAR length            %d\n", ppePathEntry->clbXAR_Len);
	dprintf ("    Parent directory Num  %d\n", ppePathEntry->pnParentNum);
	if (ppePathEntry->sDirID[0] == '\0')
		dprintf ("    Directory Name        .\n");
	else if (ppePathEntry->sDirID[0] == '\1')
		dprintf ("    Directory Name        ..\n");
	else
	{
		dprintf ("    Directory Name        %Fs\n", ppePathEntry->sDirID);
	}
	dprintf ("    Directory Entry       %Fp\n", ppePathEntry->pdeDirEntry);

} /* end PrintPathEntry */


VOID PrintPathTable (pptPathTable)
PPATH_TABLE pptPathTable;
{
	dprintf ("Printing a PATH_TABLE structure \n");
	dprintf ("    This sector number    %ld\n", pptPathTable->snSectNum);
	dprintf ("    BUF address           %Fp\n", pptPathTable->pbBuf);
	dprintf ("    Previous PT address   %Fp\n", pptPathTable->pptPrevPTSect);
	dprintf ("    Next PT address       %Fp\n", pptPathTable->pptNextPTSect);
	dprintf ("    First Dir Offset      %x\n",  pptPathTable->soPTOffset1);
	dprintf ("    First Dir Number      %d\n",  pptPathTable->pnDirNum1);
	dprintf ("    Last Dir Number       %d\n",  pptPathTable->pnDirNum2);
} /* end PrintPathTable */


VOID PrintRAW_DIR_REC (prdeRawDirRec)
PRAW_DIR_REC prdeRawDirRec;
{
	dprintf ("Printing a RAW_DIR_REC structure\n");
	dprintf ("    Directory ID Length   %d\n", prdeRawDirRec->cbDirLen);
	dprintf ("    XAR Length            %d\n", prdeRawDirRec->clbXARLen);
	dprintf ("    File Location (LBN)   %ld\n", prdeRawDirRec->lbFileLoc);
	dprintf ("    Extent Length         %ld\n", prdeRawDirRec->cbDataLen);
	dprintf ("    Recording Date        %d/%d/19%d\n",
		 prdeRawDirRec->abRecordTime[1], prdeRawDirRec->abRecordTime[2],
		 prdeRawDirRec->abRecordTime[0]);
	dprintf ("    Recording Time        %d:%d:%d\n",
		 prdeRawDirRec->abRecordTime[4], prdeRawDirRec->abRecordTime[5],
		 prdeRawDirRec->abRecordTime[6]);
	dprintf ("    File flags, HSG       %x\n", prdeRawDirRec->afFlagsHSG);
	dprintf ("    File flags, ISO       %x\n", prdeRawDirRec->afFlagsISO);
	dprintf ("    Interleave size (LBN) %d\n", prdeRawDirRec->clbIntLeaveSize);
	dprintf ("    Interleave skip (LBN) %d\n", prdeRawDirRec->clbIntLeaveSkip);
	dprintf ("    Volume Sequence Num   %d\n", prdeRawDirRec->vsnVSSN);
	dprintf ("    File ID Len           %d\n", prdeRawDirRec->cbFileIDLen);
	if ((prdeRawDirRec->cbFileIDLen == 1) && (prdeRawDirRec->sFileID[0] == '\0'))
		dprintf ("    Directory Name        .\n");
	else if ((prdeRawDirRec->cbFileIDLen == 1) && (prdeRawDirRec->sFileID[0] == '\1'))
		dprintf ("    Directory Name        ..\n");
	else
		dprintf ("    Directory Name        %Fs\n", prdeRawDirRec->sFileID);
} /* end PrintRAW_DIR_REC */


VOID PrintDirEntry (pdeDirEntry)
PDIR_ENTRY pdeDirEntry;
{
	dprintf ("Printing DIR_ENTRY structure\n");
	dprintf ("    Last Sector of file   %ld\t", pdeDirEntry->snLastSectorFile);
	dprintf	("    Last sector of dir    %ld\n", pdeDirEntry->snLastSectorDE);
	dprintf ("    File Offset of extent %ld\n", pdeDirEntry->cbStartOffset);
	dprintf ("    Dir Entry sector      %ld\t", pdeDirEntry->snSectNum);
	dprintf ("    Dir Entry offset      %d\n",  pdeDirEntry->soSectOff);
	dprintf ("    Extent sequence pos   %d\n",  pdeDirEntry->rsnRecSeq);
	dprintf ("    Directory entry len   %d\n",  pdeDirEntry->cbDirLen);
	dprintf ("    XAR length            %d\n",  pdeDirEntry->clbXARLen);
	dprintf ("    File Location, LBN    %ld\n", pdeDirEntry->lbFileLoc);
	dprintf ("    Extent length         %ld\n", pdeDirEntry->cbDataLen);
	dprintf ("    Recording Date        %d/%d/198%d\n",
		 GET_MONTH(pdeDirEntry->abDirDate),
		 GET_DAY(pdeDirEntry->abDirDate),
		 GET_YEAR (pdeDirEntry->abDirDate));
	dprintf ("    Recording Time        %d:%d:%d\n",
		 GET_HOUR(pdeDirEntry->abDirTime),
		 GET_MINUTE(pdeDirEntry->abDirTime),
		 GET_SECOND(pdeDirEntry->abDirTime));
	dprintf ("    File flags            %x\t",  pdeDirEntry->afFileAttr);
	dprintf ("    Multi Extent is       %d\n",  pdeDirEntry->fMultiExt);
	dprintf ("    File size is          %ld\n",  pdeDirEntry->cbFileSize);
	dprintf ("    Interleave size, LBN  %d\t",  pdeDirEntry->clbIntLeaveSize);
	dprintf ("    Interleave skip, LBN  %d\n",  pdeDirEntry->clbIntLeaveSkip);
	dprintf ("    Volume Sequence Num   %d\t",  pdeDirEntry->vsnVSSN);
	dprintf ("    File Length           %d\n",  pdeDirEntry->cbFileIDLen);
	dprintf ("    File Name             %Fs\n", pdeDirEntry->szFileID);
	dprintf ("    File Version          %d\t",  pdeDirEntry->sFileVer);
	dprintf ("    Most Recent Version   %d\n",  pdeDirEntry->sRecentVer);
} /* end PrintDirEntry */


VOID PrintRawVD_ISO (privISO_VTOC)
PRAW_ISO_VTOC privISO_VTOC;
{
	dprintf ("Printing RAW_ISO_VTOC structure\n");
	dprintf ("  VD type  %d, \tStandard ID \t", privISO_VTOC->ri_desc_type);
	PrintMsgArray (privISO_VTOC->ri_std_id, VOL_ID_LEN);
	dprintf (", \tVersion \t%d, \tVol Flags \t%x\n", privISO_VTOC->ri_version,
		 privISO_VTOC->ri_vol_flags);
	dprintf ("  System ID \t");
	PrintMsgArray (privISO_VTOC->ri_sys_id, VOLUME_ID_LEN);
	dprintf ("\n");
	dprintf ("  Volume ID \t");
	PrintMsgArray (privISO_VTOC->ri_vol_id, VOLUME_ID_LEN);
	dprintf ("\n");
	dprintf ("  Volume Size \t%ld, \tVolume Set Size \t%d\n",
		 privISO_VTOC->ri_vol_spaceI,
		 privISO_VTOC->ri_vs_sizeI);
	dprintf ("  Volume Seq Num \t%d, \tLogical Block Size \t%d\n",
		 privISO_VTOC->ri_vs_snumI,
		 privISO_VTOC->ri_lb_sizeI);
	dprintf ("  Path Table Size \t%ld, \tPath Table Loc \t%ld\n",
		 privISO_VTOC->ri_path_sizeI,
		 privISO_VTOC->ri_path_locI[0]);
	dprintf ("  Volume Set ID \n\t");
	PrintMsgArray (privISO_VTOC->ri_vs_id, 70);
	dprintf ("\n");
	dprintf ("  Publisher ID\n\t");
	PrintMsgArray (privISO_VTOC->ri_pub_id, 70);
	dprintf ("\n");
	dprintf ("  Application ID\n\t");
	PrintMsgArray (privISO_VTOC->ri_app_id, 70);
	dprintf ("\n");
	dprintf ("  CopyWrite File    \t");
	PrintMsgArray (privISO_VTOC->ri_cpyr_id, 32);
	dprintf ("\n");
	dprintf ("  Abstract File     \t");
	PrintMsgArray (privISO_VTOC->ri_abst_id, 32);
	dprintf ("\n");
	dprintf ("  Creation Year    ");
	PrintMsgArray (privISO_VTOC->ri_creat, CR_YEAR_LEN);
	dprintf (",  Creation Month   ");
	PrintMsgArray (&(privISO_VTOC->ri_creat[CR_MONTH_OFF]), CR_MONTH_LEN);
	dprintf ("\n  Creation Day     ");
	PrintMsgArray (&(privISO_VTOC->ri_creat[CR_DAY_OFF]), CR_DAY_LEN);
	dprintf (",  Creation Hour    ");
	PrintMsgArray (&(privISO_VTOC->ri_creat[CR_HOUR_OFF]), CR_HOUR_LEN);
	dprintf ("\n\n");
} /* end PrintRawVD_ISO */


VOID PrintRawVD_HSG (prhvHSG_VTOC)
PRAW_HSG_VTOC prhvHSG_VTOC;
{
	dprintf ("Printing RAW_HSG_VTOC structure\n");
	dprintf ("  Logical Block Location \t%ld\n", prhvHSG_VTOC->rh_lbnI);
	dprintf ("  VD type  %d, \tStandard ID \t", prhvHSG_VTOC->rh_desc_type);
	PrintMsgArray (prhvHSG_VTOC->rh_std_id, VOL_ID_LEN);
	dprintf (", \tVersion \t%d, \tVol Flags \t%x\n", prhvHSG_VTOC->rh_version,
		 prhvHSG_VTOC->rh_vol_flags);
	dprintf ("  System ID \t");
	PrintMsgArray (prhvHSG_VTOC->rh_sys_id, 32);
	dprintf ("\n");
	dprintf ("  Volume ID \t");
	PrintMsgArray (prhvHSG_VTOC->rh_vol_id, 32);
	dprintf ("\n");
	dprintf ("  Volume Size \t%ld, \tVolume Set Size \t%d\n",
		 prhvHSG_VTOC->rh_vol_spaceI,
		 prhvHSG_VTOC->rh_vs_sizeI);
	dprintf ("  Volume Seq Num \t%d, \tLogical Block Size \t%d\n",
		 prhvHSG_VTOC->rh_vs_snumI,
		 prhvHSG_VTOC->rh_lb_sizeI);
	dprintf ("  Path Table Size \t%ld, \tPath Table Loc \t%ld\n",
		 prhvHSG_VTOC->rh_path_sizeI,
		 prhvHSG_VTOC->rh_path_locI[0]);
	dprintf ("  Volume Set ID \n\t");
	PrintMsgArray (prhvHSG_VTOC->rh_vs_id, 70);
	dprintf ("\n");
	dprintf ("  Publisher ID\n\t");
	PrintMsgArray (prhvHSG_VTOC->rh_pub_id, 70);
	dprintf ("\n");
	dprintf ("  Application ID\n\t");
	PrintMsgArray (prhvHSG_VTOC->rh_app_id, 70);
	dprintf ("\n");
	dprintf ("  CopyWrite File    \t");
	PrintMsgArray (prhvHSG_VTOC->rh_cpyr_id, 32);
	dprintf ("\n");
	dprintf ("  Abstract File     \t");
	PrintMsgArray (prhvHSG_VTOC->rh_abst_id, 32);
	dprintf ("\n");
	dprintf ("  Creation Year    ");
	PrintMsgArray (prhvHSG_VTOC->rh_creat, CR_YEAR_LEN);
	dprintf (",  Creation Month   ");
	PrintMsgArray (&(prhvHSG_VTOC->rh_creat[CR_MONTH_OFF]), CR_MONTH_LEN);
	dprintf ("\n  Creation Day     ");
	PrintMsgArray (&(prhvHSG_VTOC->rh_creat[CR_DAY_OFF]), CR_DAY_LEN);
	dprintf (",  Creation Hour    ");
	PrintMsgArray (&(prhvHSG_VTOC->rh_creat[CR_HOUR_OFF]), CR_HOUR_LEN);
	dprintf ("\n\n");
} /* end PrintRawVD_HSG */


VOID PrintVOL_DESC (pvdVOL_DESC)
PVOL_DESC pvdVOL_DESC;
{
	dprintf ("Printing VOL_DESC structure\n");
	dprintf ("    Volume Standard       %d\t",  pvdVOL_DESC->fISOVol);
	dprintf ("  Descriptor Type         %d\n",  pvdVOL_DESC->vdtVolType);
	dprintf ("    Volume ID             %Fs\n", pvdVOL_DESC->szVolID);
	dprintf ("    Volume Space, LBN     %ld\n", pvdVOL_DESC->clbVolSpace);
	dprintf ("    Path Table Size       %ld",   pvdVOL_DESC->cbPTSize);
	dprintf ("    Path Table Loc, LBN   %ld\n", pvdVOL_DESC->lbPathLoc);
} /* end PrintVOL_DESC */


VOID PrintVOL_DEP_DATA (pvddVDD)
PVOL_DEP_DATA pvddVDD;
{
	dprintf ("Printing VOL_DEP_DATA structure\n");
	dprintf ("    Address of Vol Desc   %Fp\n", pvddVDD->pvdVolDesc);
	dprintf ("    Address of Root Dir   %Fp\n", pvddVDD->pdeRootDir);
	dprintf ("    Address of Path Table %Fp\n", pvddVDD->pptPathTable);
	dprintf ("    Address of Sect List  %Fp\n", pvddVDD->pblSectorList);
	dprintf ("    Physical Sector Size  %d\n",  pvddVDD->cbSectorSize);
} /* end PrintVOL_DEP_DATA */


VOID PrintDIR_DEP_DATA (pdddDDD)
PDIR_DEP_DATA pdddDDD;
{
	dprintf ("Printing DIR_DEP_DATA structure\n");
	dprintf ("    Address of Path Entry  %Fp\n",    pdddDDD->ppePathEntry);
	dprintf ("    Semaphore dword        %lx\n",    pdddDDD->sDirSem);
} /* end PrintDIR_DEP_DATA */


VOID PrintFILE_DEP_DATA (pfddData)
PFILE_DEP_DATA pfddData;
{
	dprintf ("Printing FILE_DEP_DATA structure\n");
	dprintf ("    First Dir Entry Addr  %Fp\n", pfddData->pdeFirstDirRec);
	dprintf ("    Last Dir Entry Addr   %Fp\n", pfddData->pdeLastDirRec);
	dprintf ("    File Close Flag       %d\n",  pfddData->fCloseFlag);
	dprintf ("    File Sem              %ld\n",  pfddData->sFileSem);
	dprintf ("    Direct Access Flag    %d\n",  pfddData->fDirAccess);
} /* end PrintFILE_DEP_DATA */


VOID PrintSearchString (pssString)
PSEARCH_STRING pssString;
{
	dprintf ("Printing Search String\n");
	dprintf ("    Search String         %Fs\n", pssString->szName);
} /* end PrintSearchString */


VOID PrintSEARCH_DEP_DATA (pSEARCH_DEP_DATA)
SEARCH_DEP_DATA FAR *pSEARCH_DEP_DATA;
{
	dprintf ("Printing SEARCH_DEP_DATA\n");
	dprintf ("    Last Dir Entry Addr   %Fp\n", pSEARCH_DEP_DATA->pdeLastDir);
	dprintf ("    Search String         %Fs\n",
		 pSEARCH_DEP_DATA->pssSearchString->szName);
	dprintf ("    Search String Len     %d\n",
		pSEARCH_DEP_DATA->pssSearchString->cbSearchString);
	dprintf ("    Search Attribute      %d\n", pSEARCH_DEP_DATA->afAttr);
	dprintf ("    Search Close Flag     %d\n", pSEARCH_DEP_DATA->fSearchClose);
	dprintf ("    fRootDir              %d\n", pSEARCH_DEP_DATA->fRootDir);
	dprintf ("    fRetRootDir           %d\n", pSEARCH_DEP_DATA->fRetRootDir);
	dprintf ("    Search Semaphore      %d\n", pSEARCH_DEP_DATA->sSearchSem);
} /* end PrintSEARCH_DEP_DATA */


VOID PrintMsgArray (pString, cbStrLen)
PCHAR   pString;
USHORT  cbStrLen;
{
	PSTRING_BUF psbStringBuf;

	/* Get message buffer */
	if (GetStringBuf (&psbStringBuf))
	{
		/* copy 'cbStrLen' characters from pString to psbStringBuf */
		/* append a null */
		CopyWithNull (psbStringBuf, pString, cbStrLen);

		/* call 'dprintf' to print the array */
		dprintf ("%Fs", psbStringBuf);
	}

} /* end PrintMsgArray */


VOID PTInUse ()
{
	PBUF pbThisBuf;

	pbThisBuf = pbFirstPT;

	dprintf ("\tPTInUse:  Printing Path Table in use list\n");

	while (pbThisBuf)
	{
		dprintf ("\t\tSector Number     %ld,\t Users    %d\n",
			((PPATH_TABLE) pbThisBuf->pblBufOwner)->snSectNum,
		 	pbThisBuf->cUsers);

		pbThisBuf = pbThisBuf->pbNextBUF;

	}

} /* end PTInUse */


VOID BLInUse ()
{
	PBUF pbThisBuf;

	pbThisBuf = pbFirstSec;

	dprintf ("\tBLInUse:  Printing Buf list in use list\n");

	while (pbThisBuf)
	{
		dprintf ("\t\tSector Number     %ld,\t Users    %d\n",
		pbThisBuf->pblBufOwner->snSectNum,
		pbThisBuf->cUsers);

		pbThisBuf = pbThisBuf->pbNextBUF;

	}

} /* end BLInUse */



USHORT NumBuf ()
{
	USHORT usCountBuf;
	PBUF pbBuf;

	pbBuf = pbFreeSec;
	usCountBuf = 0;

	while (pbBuf)
	{
		pbBuf = pbBuf->pbNextBUF;
		usCountBuf++;
	}

	return usCountBuf;

} /* end NumBuf */


/*
 * Print the status of the memory stacks 
 */

VOID PrintMemStatus ()
{
	dprintf ("Printing Memory Status\n");
	dprintf ("\tNumber of BUFs      --  %d\n", NumBuf());
	PrintHeap ();
}

/*
 *  Print out the statistics
 */

#ifdef STATS_H
VOID PrintStatistics ()
{
	dprintf ("Printing Statistics\n");
	dprintf ("\tst_cfptr  \t%ld,\t\tst_chdir  \t%ld\n", CurSt.st_cfptr, CurSt.st_chdir);
	dprintf ("\tst_close  \t%ld,\t\tst_fattr  \t%ld\n", CurSt.st_close, CurSt.st_fattr);
	dprintf ("\tst_finfo  \t%ld,\t\tst_fclose \t%ld\n", CurSt.st_finfo, CurSt.st_fclose);
	dprintf ("\tst_ffirst \t%ld,\t\tst_fnext  \t%ld\n", CurSt.st_ffirst, CurSt.st_fnext);
	dprintf ("\tst_fsinfo \t%ld,\t\tst_ioctl  \t%ld\n", CurSt.st_fsinfo, CurSt.st_ioctl);
	dprintf ("\tst_mount  \t%ld,\t\tst_open   \t%ld\n", CurSt.st_mount, CurSt.st_open);
	dprintf ("\tst_pinfo  \t%ld,\t\tst_pname  \t%ld\n", CurSt.st_pinfo, CurSt.st_pname);
	dprintf ("\tst_read   \t%ld\n", CurSt.st_read);
	dprintf ("\tDIR_SEC   \tHits  %ld, \tMisses  %ld\n", CurSt.st_hits[DIR_SEC], CurSt.st_misses[DIR_SEC]);
	dprintf ("\tPT_SEC    \tHits  %ld, \tMisses  %ld\n", CurSt.st_hits[PT_SEC], CurSt.st_misses[PT_SEC]);
	dprintf ("\tDATA_SEC  \tHits  %ld, \tMisses  %ld\n", CurSt.st_hits[DATA_SEC], CurSt.st_misses[DATA_SEC]);

} /* end PrintStatistics */
#endif

/*
 *  Print out the status of the heap
 */ 

VOID PrintHeap ()
{
	PHEAP    phHeap;

	phHeap = phHeapStart;

	dprintf ("\tPrintHeap\n");
	dprintf ("\t\tThis Heap:        %p\n",  phHeap);
	while (phHeap)
	{
		dprintf ("\t\tHeap Size:        %ld\n", phHeap->cbHeapSize);
		dprintf ("\t\t  Next Heap:      %Fp\n", phHeap->phNextHeap);

		phHeap = phHeap->phNextHeap;
	}
} /* end PrintHeap */

/*
 *  Print out the elements of a, possibly, DBCS string
 */
VOID PrintDBCS (pString, cbStrLen)
UCHAR   FAR *pString;
USHORT      cbStrLen;
{
	USHORT  usIndex;
	USHORT  usRet;

	/* Check that string length is contained in a valid buffer */
	if (usRet = FSH_PROBEBUF (PB_OPREAD & PB_OPWRITE, pString, cbStrLen))
	{
		dprintf ("\tPrintDBCS:  Invalid buffer  %d\n", usRet);
		Int3();

	} /* end if invalid buffer */

	/* else display the string */
	else
	{
		dprintf ("\tPrintDBCS:  Displaying string, len = %d \n", cbStrLen);
		usIndex = 0;

		while (usIndex++ < cbStrLen)
		{
			if (!(usIndex % 12))
			{
				dprintf ("\n");

			}
			dprintf ("%d   ", *(pString++));
			
		} /* end for each index */

		dprintf ("\n");

	} /* end else display string */

} /* end PrintDBCS */

/*
 *  Print out a list of a specific structure
 */

VOID PrintGlobalList (pglList)
PGEN_LLIST  pglList;
{
	dprintf ("\tPrintGlobalList\n");
	while (pglList)
	{
		dprintf ("\t\tStructure address  --  %p\n", pglList);
		pglList = pglList->pglNextGenLList;

	}

} /* end PrintGlobalList */
