SFileObject
struct · storm · 96 bytes
- Meaning
- Holds an open Storm file: its kind, C runtime file, names, .bz inflate state and lock
- Confidence
- verified, proof two
- Finding
- storm/bz#the-file-object
Finding: The file object in storm: compressed loose files
0x647290(kind) builds the object: the kind at +0x00, the lock at +0x24, and 0 in every field but
+0x14, +0x20 and +0x44 to +0x50, which keep what the allocation held. A kind-1
open fills the FILE * (+0x04), the path and name copies (+0x0c, +0x10), the inflated size
(+0x14), the input buffer (+0x18), the zlib stream (+0x1c), the position (+0x20) and 16 header
bytes (+0x44, flagged at +0x54). Other kinds use +0x08, +0x3c and +0x40; +0x58 and
+0x5c serve overlapped reads. 0x6472d0 ends the inflate and frees the stream, the copies and
the buffer, and deletes the lock; it does not close the FILE *, which only SFile::Close does first.
The derivation is in the doc.
Fields 16
| offset | size | type | name | meaning | confidence | finding |
|---|---|---|---|---|---|---|
0x0000 | 4 | uint32_t | m_kind | Holds the loose-file index kind the open resolved | verified, proof two | storm/bz#the-file-object |
0x0004 | 4 | void * | m_file | Holds the C runtime FILE of a loose or .bz file | verified, proof two | storm/bz#the-file-object |
0x0008 | 4 | void * | m_archiveBlock | Holds kind 2's 8-byte block, whose +0x04 is the archive opened for the file | verified, proof one | storm/bz#the-file-object |
0x000c | 4 | char * | m_path | Holds a copy of the full path, without a final .bz | verified, proof two | storm/bz#the-file-object |
0x0010 | 4 | char * | m_name | Holds a copy of the name the open was given | verified, proof two | storm/bz#the-file-object |
0x0014 | 4 | uint32_t | m_bzSize | Holds the inflated size from a .bz header | verified, proof two | storm/bz#the-file-object |
0x0018 | 4 | uint8_t * | m_bzInput | Holds the 0x1000-byte input buffer of a .bz file | verified, proof two | storm/bz#the-file-object |
0x001c | 4 | void * | m_bzStream | Holds the 0x38-byte zlib stream of a .bz file | verified, proof two | storm/bz#the-file-object |
0x0020 | 4 | uint32_t | m_bzPosition | Holds the bytes successful reads delivered since the .bz stream began | verified, proof two | storm/bz#the-file-object |
0x0024 | 24 | uint8_t[24] | m_lock | Holds the critical section reads and seeks take | verified, proof two | storm/bz#the-file-object |
0x003c | 4 | void * | m_archiveFile | Holds the archive file record of kinds 2 and 3 | verified, proof one | storm/bz#the-file-object |
0x0040 | 4 | void * | m_zipFile | Holds the SZip.cpp handle of a kind-4 file | verified, proof one | storm/bz#the-file-object |
0x0044 | 16 | uint8_t[16] | m_extraBytes | Holds 16 bytes: a .bz header's, which no live code reads, or what 0x655210 fills for kinds 2 and 3 | verified, proof two | storm/bz#the-file-object |
0x0054 | 4 | uint32_t | m_extraBytesSet | Holds 1 when +0x44 is filled | verified, proof two | storm/bz#the-file-object |
0x0058 | 4 | uint32_t | m_closeAfterRead | Holds 1 when SFile::Load hands the file to an overlapped read, whose worker then closes it | verified, proof one | storm/bz#the-file-object |
0x005c | 4 | uint32_t | m_pendingReads | Counts the overlapped reads queued and not yet run | verified, proof one | storm/bz#the-file-object |