Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : ZIPHEAD.BAS
'From: HOWARD MENCHER
'Subj: READ ZIP HEADER
'--------------------------------------------------------------------------
CLS
DEFINT A-Z
DIM filenames$(255)
foundnames = 0
DIM signature AS STRING * 4: DIM junk AS STRING * 1
DIM tmpname AS STRING * 1
headsig$ = "04034B50"
TYPE ziphdr
signatr AS STRING * 4 'should be const 0x04034b50
version AS INTEGER
bitflag AS INTEGER
stortype AS INTEGER
time AS INTEGER
date AS INTEGER
crc AS LONG
ziplen AS LONG
fullsize AS LONG
fnamelen AS INTEGER
extra AS INTEGER
END TYPE
DIM ziphead AS ziphdr
INPUT "Name of .ZIP file to display (
IF zname$ = "" THEN END
getzipdir: '
' open in serial mode, read in 4 char at a time & look
' for signatures
OPEN "B", 1, zname$
WHILE NOT EOF(1)
sigpos& = SEEK(1)
GET #1, , signature$
b1 = ASC(LEFT$(signature$, 1))
b2 = ASC(MID$(signature$, 2, 1))
b3 = ASC(MID$(signature$, 3, 1))
b4 = ASC(RIGHT$(signature$, 1))
tst4$ = HEX$(b4)
IF LEN(tst4$) < 2 THEN tst4$ = "0" + tst4$
tst3$ = HEX$(b3)
IF LEN(tst3$) < 2 THEN tst3$ = "0" + tst3$
tst2$ = HEX$(b2)
IF LEN(tst2$) < 2 THEN tst2$ = "0" + tst2$
tst1$ = HEX$(b1)
IF LEN(tst1$) < 2 THEN tst1$ = "0" + tst1$
result$ = tst4$ + tst3$ + tst2$ + tst1$
IF result$ = headsig$ THEN GOSUB readhdr
WEND
CLOSE : foundnames = foundnames - 1
FOR t = 0 TO foundnames
PRINT filenames$(t)
NEXT t
END
readhdr: ' try to make sense of the zip header
SEEK #1, sigpos&
GET #1, sigpos&, ziphead
x = ziphead.fnamelen
FOR t = 1 TO x
GET #1, , tmpname$
filenames$(foundnames) = filenames$(foundnames) + tmpname$
NEXT t
foundnames = foundnames + 1
x = ziphead.extra
FOR t = 1 TO x
GET #1, , junk$
NEXT t
totloffset& = sigpos& + 30 + ziphead.fnamelen + ziphead.extra +
SEEK #1, totloffset&
RETURN
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/