benilla-re systems structs docs

source

The symbol table

Every known function, global, struct and struct field of WoW.exe 1.12.1.5875, one row each. A row says what the thing is in a line and links to the finding that proves it. The detail lives in the finding; the row is the index.

Four files, tab-separated, UTF-8, one header line, no comments:

Sorting is plain byte order (LC_ALL=C sort), and every key below is written so that byte order is numeric order. Two people adding rows in different places then merge without conflict.

One row per address

An address has exactly one row, owned by one system. A function belongs to the system whose object file holds it; other systems reach it through their closures (../systems/README.md). Library code the client links is owned by its library: crt (the MSVC C runtime), storm (Blizzard's Storm library), lua (Lua 5.0), zlib (zlib 1.2.2) and d3dx (Direct3D 9's D3DX math routines and their dispatch). A correction edits the row in place. A row is never duplicated to record a second opinion: a disagreement is settled at the bytes first (../docs/METHOD.md).

Systems without a doc

These systems own rows but have no doc under ../systems/ yet. A row's system is one of these, a system with a doc, a library, or unassigned; the check holds the table to this list.

The Mac client

The 1.12.1 Mac client is a second binary, read only where it does what WoW.exe does not (../docs/METHOD.md, The binary decides): key input, in ../systems/core/mackeys.md.

Names

One convention, the client's own C++ style:

A name is unique among functions and globals, and a field's name is unique within its struct. The exports (cargo xtask export, and the Ghidra apply ../tools/ghidra/setup.sh) leave a function with no name at the tool's own FUN_00514ae0.

Common columns

columnvalues
address0x and exactly six lowercase hex digits: 0x514ae0. The virtual address in the exe, never a file offset or an RVA.
nameAs above. Empty only when the meaning is unknown.
name_fromidb for a community name; later-build for a struct named from a later build (Names); empty for a name given here.
systemThe owning system: a lowercase word naming a doc under ../systems/, a library, or a system without a doc (above). unassigned when the row's object file is not yet identified, or its owner is not; ownership is never guessed.
meaningOne line starting with a verb: what the thing does or holds.
confidenceverified: read at the bytes, the derivation recorded in finding. inferred: a lead, not settled.
proofFor verified: one (one reading) or two (two independent readings reconciled). For inferred: none. A test is not a proof; it has its own column.
findingWhere the derivation is: a doc under ../systems/ without .md, #, and the entry's anchor, for example random#state-advance; METHOD#the-harness for the facts the harness rests on. The entry mentions the row's address.

Confidence and proof are separate on purpose: every row states both, so verified is never a default and never says how strongly. The full rules are in ../docs/METHOD.md.

An anchor is the GitHub slug of the entry's heading: lowercase, spaces to hyphens, punctuation dropped (## State advance is #state-advance). Renaming a heading means changing every row that links to it in the same commit.

A row's finding may live in another system's doc: a library function whose behaviour matters to one system (the C runtime's rand is explained in random), or a function of a system with no doc yet whose meaning a finding elsewhere derives.

functions.tsv

address size name name_from system class signature meaning confidence proof finding test

columnvalues
sizeDecimal bytes from the entry to the end of the body's last instruction, by the rule below. A cited instruction address belongs to the function whose [address, address + size) holds it.
classprimitive, orchestration, host, boundary or unreached. Required on every row of a system that has a doc; empty only for a row owned by a system not yet written.
signatureThe C prototype without the name, in the grammar below: uint32_t __fastcall (uint32_t x). Empty when not derived.
testThe bit-exact tests that run this function against the exe, whole or a slice, crate::test_fn separated by , : a top-level test function of a file under crates/<crate>/tests/ (../docs/CONTRIBUTING.md, Adding a test). Empty when there is none.

A function row's address is a function start (../docs/METHOD.md, Completeness). Its body is every instruction reached from that entry by falling through (a call falls through), by the targets of jcc and jmp, and by the entries of a jump table it indexes. A path ends at ret, at an indirect jmp that is not a table jump, at a tail call: a jmp to an address with a row of its own, which the target of every tail call needs, and at a call to a function that never returns (_exit, __exit, __amsg_exit, longjmp, ExitProcess, or one whose body reaches no return) where padding or another function follows the call. A call to the next instruction pushes its own address and enters nothing. A jump table's entries run from the address its jmp names; where hand-written code biases its index, from the first dword after it that is an entry, and where it negates its index (neg ecx; jmp [ecx*4+base]), down from that address; its cases may follow it. Code reached only through a stored address, such as an exception filter or handler in a scope table, is not in the body. size runs from the entry to the end of the body's last instruction, and nothing in [address, address + size) is other than body, padding, the function's jump-table data and its own exception code: code reached only through a stored address that points into that range (a filter, a handler, a catch funclet, or the continuation one returns, as in mov eax,<continuation>; ret), with the code it reaches. Exception code past the end of the body stays outside the size. Padding is int3 and the no-op fillers compilers align with, where no branch lands: nop of any length, xchg ax,ax, mov edi,edi, and lea of a register to itself plus zero (lea ecx,[ecx+0x0]). cargo xtask check --exe recomputes every size from dumps/disasm.txt, which restarts the decode at every row, every call target and every table's end.

Thirty-three starts, all the C runtime's, can hold no row, since no size satisfies this rule (cargo xtask census lists them, and its test holds the list):

Classes:

A class on a row with no finding is the classifier's, from cargo xtask census; a reading replaces it.

The signature grammar

A signature is RET CONV (PARAMS) and nothing else: the return type, one convention, the parameter list. Tools read it (the C header and the Ghidra, IDA and Binary Ninja imports), so the check holds every signature to this form.

cargo xtask check --exe adds the stack: the sum of the bytes the signature puts on the stack is the N of every ret N the body reaches in its own extent, and a __cdecl body returns with ret. A struct returned by value through a hidden pointer (any size but 1, 2, 4 and 8) adds four bytes to __stdcall and __thiscall. A body that ends in a tail jump, as a thunk does, takes the ret N of the row it jumps to; a body that never returns is not compared.

The convention is decided at the bytes on both sides of the call, by tools/conventions.py: the registers the body reads before it writes them, and what every direct caller loads into ecx and edx before the call. A function the client reaches through a pointer has the type of the registration, whatever its body reads: int __fastcall (lua_State *L) for a Lua C function, __fastcall (const char *name, const char *args) for a console command, and __fastcall (void *param, uint32_t opcode, uint32_t time, CDataStore *msg) for a message handler. Another function that no direct call reaches and whose body reads neither register keeps the registers of its older signature. Which test it applies, and how far its answer goes, is in the tool's header.

globals.tsv

address type name name_from system meaning confidence proof finding

columnvalues
typeA C type: float, uint32_t[64], char[8], void *, a struct from structs.tsv, or a pointer to one. Its size is the size of the type.

A .data global that code writes is a variable, even when its file bytes hold a sensible value: the meaning names its default and its finding names its writers. A .rdata value is a constant. Pooled literals (1.0f and the like) get a row only when a finding cites their address.

structs.tsv

name name_from size vtable system meaning confidence proof finding

columnvalues
nameThe class name, by the naming rule.
sizeDecimal bytes, from the allocation or the constructor.
vtableThe address of the vtable the constructor finally stores, a row of globals.tsv; empty for a struct without one.

fields.tsv

struct offset size type name system meaning confidence proof finding

columnvalues
structA row of structs.tsv.
offset0x and exactly four lowercase hex digits from the start of the struct: 0x0014.
sizeDecimal bytes; offset + size stays within the struct.
typeAs in globals.tsv.

A field's type comes from the instruction that loads it (fld dword is a float), and its meaning from its writers, never from one reader's use of it. A sub-object of a class the image does not name is written as its named base followed by its own fields.

Rules the check enforces

cargo xtask check enforces these, and cargo xtask check --exe the body of every function row.

rulevaluewhy
columnsthe headers above, in order, every row completeparallel edits must merge
sortingbyte order of the keys aboveparallel edits must merge
meaning120 characters, one line, verb first, no final perioda cell is a gloss; the finding holds the detail
name48 characters, the naming ruleapplied to Ghidra as an identifier, and to the exports
signature200 characters, and the grammar aboveone prototype, no commentary
banned in meaning?, TODO, probably, maybe, seems, likelya guess is inferred, said in the confidence column
verifiedneeds one or two, and a findingprovenance is the point of the label
inferredneeds none; a finding is alloweda finding can name what it did not settle
findingresolves to an entry that mentions the row's addressthe row and its derivation stay linked
classset on every row of a system with a doca written system's closure is classified
systema system with a doc, a library, unassigned, or one of Systems without a doc, which lists no system that has a docevery row has a known owner
unreachedtest emptynothing runs the code
addressesunique across functions and globalsone row per address
addresses in meaningeach resolves to a rowa citation without a row cannot be looked up
bodiesevery function row starts a function and has its body's size (--exe)a cited address belongs to the row whose extent holds it
stackthe bytes a signature puts on the stack are the ret N of its body (--exe)a caller cannot tell a missing parameter from a wrong convention