benilla-re systems structs docs

ReadBzFile

function · storm · orchestration

Address
0x6476e0 · 191 bytes, up to 0x64779e
Signature
uint32_t __fastcall (SFileObject *file, void *buffer, uint32_t size, uint32_t *read)
Meaning
Inflates up to a size of a .bz file, refilling 4 KiB of input, and returns 1 when it delivered bytes
Confidence
verified, proof two
Finding
storm/bz#reading-a-bz-file
Test
storm::bz_read_difftest, storm::bz_damaged_difftest

Finding: Reading a .bz file in storm: compressed loose files

0x6476e0(file, out, size, &read) sets the stream's output to out and size, then loops: with no input left it points the input at the buffer and freads up to 0x1000 bytes into it, storing the count when it is above 0; it calls inflate(stream, Z_SYNC_FLUSH) (0x730ea0, "The zlib it links"). A full output stores size, adds it to the position and returns 1. Otherwise Z_STREAM_END stores the bytes produced, adds them and returns 1 when there are any, else 0; Z_OK loops; any other result returns 0 with read and the position untouched. So a stream that ends early, or damage the output reaches, fails the read in which it shows.

The derivation is in the doc.

Callers 3

Callees 2

Calls and jumps by a bare address, from tables/calls.tsv.