Skip to content

Instantly share code, notes, and snippets.

@ItzSwirlz
Last active June 7, 2023 23:04
Show Gist options
  • Save ItzSwirlz/5550f9d420043e78deff63f0c358de69 to your computer and use it in GitHub Desktop.
Save ItzSwirlz/5550f9d420043e78deff63f0c358de69 to your computer and use it in GitHub Desktop.
VolumeID Constructor writeup in zip.dl (or zip.jar)
constructor, given a bytereader of data
- initializes position
- initializes a size of it, reads 4 bytes of the data
- If the read size if less than 16 bytes, throws exception(?)
Then, this.dt reads 4 more bytes
If the dt is not 1, 2, 3, 4, 5, or 6, it sets the value to 0.
These values probably match the DRIVE_UNKNOWN, DRIVE_RAMDISK, etc.
Then it sets DSN (data source name??): reads 4 mre bytes
Finds an offset by reading 4 more bytes
Then there is a condition called 'u':
If the offset is 20 (bytes/ints?) it reads another and makes u true.
ByteReader then seeks data with the position, and the offset - the position of the data (data.getPosition()), the original?
if position = 20, vloffset = 20, 20-20=0, then it reads 0 bytes??
Then it sets an iterator
IF: the vloffset is 20 bytes
- creates new buffer, size of the initially read 4 data bytes, subtracted by the offset, >> (right-shifted) 1
- Infinite loop:
-- Reads **2** data bytes, adds to to the buffer unless the byte is NULL ('\000')
- (When its done??) sets the label to the buffer made from the loop, 0, and i, which is wherever the iteration ended (if it does)
IF: the vloffset ISNT 20 bytes
Instead of a char buffer, makes a BYTE buffer/array, of the initial size - the offset
It then reads data and adds it to the buffer, then again changes the label.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment