TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: ALL
from: MIKE RUSKAI
date: 1999-10-17 12:19:00
subject: Attn: HPFS gurus

I've been collecting information on HPFS's system area lately, and to do
that, I've been reading the HPFS SuperBlock using DosDevIOCtl().

Since I haven't seen information that says anything to the contrary, I've
been assuming that the SuperBlock is on LSN 16 of a drive, period.
However, I've had two people so far come up with odd results for their
directory band size, and when I had them send me what's supposed to be
their SuperBlock for the drive in question, it turns out to clearly not be.
With one, I actually received 18 sectors of data (because I couldn't at
first figure out how to read only one non-0 sector with DosDevIOCtl()).
That one clearly contained Boot Manager code.  The other may have been the
same, but I only received one sector worth.

Before I go further, here's the C code that's used to read the SuperBlock:

/* reading SuperBlock */

    ULONG bpParmLen, bpDataLen, sectorSize;
    HFILE driveHandle; /* handle from DosOpen() */
    char *sdata;
    int i;
    TRACKLAYOUT *tl;

    #define SECC 1 /* sector count to read */

    bpParmLen=sizeof(TRACKLAYOUT)+sizeof(ULONG)*SECC;
    tl=(PTRACKLAYOUT)malloc(bpParmLen);

    bpDataLen=sectorSize*SECC;
    sdata=(char*)malloc(bpDataLen);

    memset(sdata, 0, bpDataLen);

    tl->bCommand=0;
    tl->usHead=1;
    tl->usCylinder=0;
    tl->usFirstSector=0;
    tl->cSectors=SECC;

    /*
        The loop allows reading more than one sector with a simple
        change to the SECC definition.
    */


    for (i=0; iTrackTable[i].usSectorNumber=i+17;
        tl->TrackTable[i].usSectorSize=sectorSize;
        }

    rc=DosDevIOCtl(driveHandle, IOCTL_DISK, DSK_READTRACK, tl,
                   bpParmLen, &bpParmLen, sdata, bpDataLen, &bpDataLen);

/* end */

The declarations are, of course, at the beginning of the entire source file
(you can see it at http://home.att.net/~thanny/hpfssi.zip), and the only
notable thing that's happened before the above is the retrieval of the
drive's sector size, via a DosDevIOCtl() category 8, DSK_GETDEVICEPARMS
call.

Which is more likely, that in rare cases the above would not read LSN 16 at
all, or that in rare cases the SuperBlock doesn't reside at LSN 16 at all?

Naturally, I'm interested in solutions that address the problem in either
case.

Mike Ruskai
thannymeister@yahoo.com


... Had to give away the kids - The cat got allergic.

___ Blue Wave/QWK v2.20
--- Platinum Xpress/Win/Wildcat5! v3.0pr2
* Origin: FIDO QWK MAIL & MORE! WWW.DOCSPLACE.ORG (1:3603/140)

SOURCE: echoes via The OS/2 BBS

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.