benilla-re systems structs docs

system glue · source

glue: layout

Where the system's code lies, what runs it at startup, and what nothing runs.

glue owns one run of code, from 0x46a260 to 0x475b50: the object files of the client's Source\Glue folder. In order they hold the manager and its script functions (CGlueMgr.cpp), the realm list (RealmList.cpp), the model frame of the character screens (CSimpleModelFFX.cpp), character create, character select, the survey (SurveyDownloadGlue.cpp), the patch (PatchDownloadGlue.cpp) and the random name generator; create, select and the name generator pass no source path. Of the 753 functions in the run, 478 are static initializers, their thunks and their exit handlers, and one is unreached.

The system's other docs are manager, flow, connect, enterworld, script, realms, create, select, selectscene, selectghost, preview and downloads.

Roots: 0x46a260, 0x46a280, 0x46a2a0, 0x46a2d0, 0x46a3c0, 0x46c710, 0x46c740, 0x46c770, 0x46c7a0, 0x46c7d0, 0x46c800, 0x46c830, 0x46c860, 0x46c890, 0x46c8c0, 0x46c8f0, 0x46c920, 0x46c950, 0x46c980, 0x46c9a0, 0x46c9d0, 0x46ca00, 0x46ca30, 0x46ca60, 0x46cb40, 0x46cb70, 0x46cc40, 0x46de40, 0x46de60, 0x46de90, 0x46dec0, 0x46def0, 0x46df20, 0x46df50, 0x46df80, 0x46dfb0, 0x46dfe0, 0x46e010, 0x46e040, 0x46e070, 0x46e0a0, 0x46e0d0, 0x46e100, 0x46e120, 0x46e150, 0x46e180, 0x46e1b0, 0x46e1e0, 0x46e230, 0x46e260, 0x46e290, 0x46e450, 0x46f4c0, 0x46f4e0, 0x46f5e0, 0x46f610, 0x46f640, 0x46f670, 0x46f6a0, 0x46f6d0, 0x46f700, 0x46f730, 0x46f760, 0x46f790, 0x46f7c0, 0x46f7f0, 0x46f820, 0x46f850, 0x46f870, 0x46f8a0, 0x46f8d0, 0x46f900, 0x46f930, 0x46f980, 0x46f9b0, 0x46faf0, 0x46fb10, 0x46fb30, 0x46fb60, 0x46fb90, 0x46fbc0, 0x46fbf0, 0x46fc20, 0x46fc50, 0x46fc80, 0x46fcb0, 0x46fce0, 0x46fd10, 0x46fd40, 0x46fd70, 0x46fda0, 0x46fdd0, 0x46fdf0, 0x46fe20, 0x46fe50, 0x46fe80, 0x46feb0, 0x46ff00, 0x46ff30, 0x470090, 0x4700b0, 0x4700d0, 0x470100, 0x4701b0, 0x470220, 0x471a90, 0x471ac0, 0x471af0, 0x471b20, 0x471b50, 0x471b80, 0x471bb0, 0x471be0, 0x471c10, 0x471c40, 0x471c70, 0x471ca0, 0x471cd0, 0x471d00, 0x471d20, 0x471d50, 0x471d80, 0x471db0, 0x471de0, 0x471f20, 0x471f50, 0x471f80, 0x471fa0, 0x471fc0, 0x471ff0, 0x473730, 0x473760, 0x473790, 0x4737c0, 0x4737f0, 0x473820, 0x473850, 0x473880, 0x4738b0, 0x4738e0, 0x473910, 0x473940, 0x473970, 0x4739a0, 0x4739c0, 0x4739f0, 0x473a20, 0x473a50, 0x473a80, 0x473bd0, 0x473c00, 0x4741a0, 0x4741c0, 0x4741e0, 0x474210, 0x474240, 0x474270, 0x4742a0, 0x4742d0, 0x474300, 0x474330, 0x474360, 0x474390, 0x4743c0, 0x4743f0, 0x474420, 0x474450, 0x474480, 0x4744a0, 0x4744d0, 0x474500, 0x474530, 0x474560, 0x4745b0, 0x4745e0, 0x4749d0, 0x474cc0, 0x474ce0, 0x474d10, 0x474d40, 0x474d70, 0x474da0, 0x474dd0, 0x474e00, 0x474e30, 0x474e60, 0x474e90, 0x474ec0, 0x474ef0, 0x474f20, 0x474f50, 0x474f80, 0x474fa0, 0x474fd0, 0x475000, 0x475030, 0x475060, 0x4750b0, 0x4750e0, 0x475460, 0x475560, 0x475580, 0x475770, 0x4757a0, 0x4757d0, 0x475800, 0x475830, 0x475860, 0x475890, 0x4758c0, 0x4758f0, 0x475920, 0x475950, 0x475980, 0x4759b0, 0x4759e0, 0x475a00, 0x475a30, 0x475a60, 0x475a90, 0x475ac0, 0x475b10, 0x475b40

Object files

The run is bounded by the source paths its functions pass and by the static initializers the C runtime's table points at. The run's 223 slots are nine copies of a 24-initializer set from a shared header and seven initializers of glue's own globals. The eight initializers just before 0x46a260 in the code are a different set, and the code from 0x475b70 opens with a set of five and passes Common\ComponentCore\CharacterComponent.cpp.

Addresses: 0x46a260, 0x475b50, 0x46a6f0, 0x46a7b0, 0x46b930, 0x46e300, 0x46e510, 0x46fa00, 0x473c30, 0x473e30, 0x473f10, 0x474610, 0x827000 Confidence: verified Proof: one Test: none

The paths are pushed at 0x46a70d and 0x46a834 (CGlueMgr.cpp), 0x46e3c0 (RealmList.cpp), 0x46fa06 (CSimpleModelFFX.cpp), 0x473c67 and 0x47402c (SurveyDownloadGlue.cpp) and 0x474670 (PatchDownloadGlue.cpp); 0x46bf34, 0x46e54e and 0x473e9c pass Glue\..\WowSvcs\WowSvcsClientServices.h. The 24-initializer set is a copy of +inf, 2π, 1/2π, thirteen squares, 5.0, four squares, the shared count, a square and 0.5/10; the table's slots 0x8279c0 to 0x827d38 hold the nine sets and the seven others; the next slot holds 0x475b70. A set's first three initializers can lie apart from the rest (0x46a260 and 0x46c710), so the sets do not mark the files one for one; the files named above are the ones the paths name. The eight before the run (0x46a0c0 to 0x46a210, slots 0x827994 to 0x8279b0, followed by three slots for 0x4641b0, 0x464250 and 0x4642c0 before glue's first) store 10², 0.5/10, products with ±1/36, −255 and 256, 1/4.16667 and the count, into globals only they read; the five at 0x475b70 are +inf, 2π, 1/2π, 10² and 0.5/10, and the initializers and helpers (0x475c40 to 0x475f30) come next, and the component path is first pushed at 0x476030, in 0x476020.

Static initializers

Each of the 216 header initializers is a thunk, a five-byte jmp or a ten-byte call and jmp, and a body at the next 16-byte boundary that stores one value in a global: +inf copied from a constant, 3.14159 + 3.14159, 1 divided by that 2π, a square of a constant (10, 100, 50, 40, 30, 20, 11.1111, 5.55556, 5, 3, 1.5, 0.5, or 120), 5.0, or 0.5 / 10. Nine bodies instead count one more unit in the shared global 0xc2a3c4 and call 0x5b71c0 on the first; their thunks then register, with atexit, a body that counts it back down and tail-calls 0x5b71d0 at zero.

Addresses: 0x46a260, 0x46a270, 0x46a280, 0x46a290, 0x46a2a0, 0x46a2b0, 0x46c710, 0x46c720, 0x46c740, 0x46c750, 0x46c770, 0x46c780, 0x46c7a0, 0x46c7b0, 0x46c7d0, 0x46c7e0, 0x46c800, 0x46c810, 0x46c830, 0x46c840, 0x46c860, 0x46c870, 0x46c890, 0x46c8a0, 0x46c8c0, 0x46c8d0, 0x46c8f0, 0x46c900, 0x46c920, 0x46c930, 0x46c950, 0x46c960, 0x46c980, 0x46c990, 0x46c9a0, 0x46c9b0, 0x46c9d0, 0x46c9e0, 0x46ca00, 0x46ca10, 0x46ca30, 0x46ca40, 0x46ca60, 0x46ca70, 0x46ca90, 0x46caa0, 0x46cb40, 0x46cb50, 0x46cb70, 0x46cb80, 0x46cc40, 0x46cc50, 0x46de40, 0x46de50, 0x46de60, 0x46de70, 0x46de90, 0x46dea0, 0x46dec0, 0x46ded0, 0x46def0, 0x46df00, 0x46df20, 0x46df30, 0x46df50, 0x46df60, 0x46df80, 0x46df90, 0x46dfb0, 0x46dfc0, 0x46dfe0, 0x46dff0, 0x46e010, 0x46e020, 0x46e040, 0x46e050, 0x46e070, 0x46e080, 0x46e0a0, 0x46e0b0, 0x46e0d0, 0x46e0e0, 0x46e100, 0x46e110, 0x46e120, 0x46e130, 0x46e150, 0x46e160, 0x46e180, 0x46e190, 0x46e1b0, 0x46e1c0, 0x46e1e0, 0x46e1f0, 0x46e210, 0x46e220, 0x46e230, 0x46e240, 0x46e260, 0x46e270, 0x46e450, 0x46e460, 0x46f4c0, 0x46f4d0, 0x46f4e0, 0x46f4f0, 0x46f5e0, 0x46f5f0, 0x46f610, 0x46f620, 0x46f640, 0x46f650, 0x46f670, 0x46f680, 0x46f6a0, 0x46f6b0, 0x46f6d0, 0x46f6e0, 0x46f700, 0x46f710, 0x46f730, 0x46f740, 0x46f760, 0x46f770, 0x46f790, 0x46f7a0, 0x46f7c0, 0x46f7d0, 0x46f7f0, 0x46f800, 0x46f820, 0x46f830, 0x46f850, 0x46f860, 0x46f870, 0x46f880, 0x46f8a0, 0x46f8b0, 0x46f8d0, 0x46f8e0, 0x46f900, 0x46f910, 0x46f930, 0x46f940, 0x46f960, 0x46f970, 0x46f980, 0x46f990, 0x46f9b0, 0x46f9c0, 0x46faf0, 0x46fb00, 0x46fb10, 0x46fb20, 0x46fb30, 0x46fb40, 0x46fb60, 0x46fb70, 0x46fb90, 0x46fba0, 0x46fbc0, 0x46fbd0, 0x46fbf0, 0x46fc00, 0x46fc20, 0x46fc30, 0x46fc50, 0x46fc60, 0x46fc80, 0x46fc90, 0x46fcb0, 0x46fcc0, 0x46fce0, 0x46fcf0, 0x46fd10, 0x46fd20, 0x46fd40, 0x46fd50, 0x46fd70, 0x46fd80, 0x46fda0, 0x46fdb0, 0x46fdd0, 0x46fde0, 0x46fdf0, 0x46fe00, 0x46fe20, 0x46fe30, 0x46fe50, 0x46fe60, 0x46fe80, 0x46fe90, 0x46feb0, 0x46fec0, 0x46fee0, 0x46fef0, 0x46ff00, 0x46ff10, 0x46ff30, 0x46ff40, 0x470090, 0x4700a0, 0x4700b0, 0x4700c0, 0x4700d0, 0x4700e0, 0x471a90, 0x471aa0, 0x471ac0, 0x471ad0, 0x471af0, 0x471b00, 0x471b20, 0x471b30, 0x471b50, 0x471b60, 0x471b80, 0x471b90, 0x471bb0, 0x471bc0, 0x471be0, 0x471bf0, 0x471c10, 0x471c20, 0x471c40, 0x471c50, 0x471c70, 0x471c80, 0x471ca0, 0x471cb0, 0x471cd0, 0x471ce0, 0x471d00, 0x471d10, 0x471d20, 0x471d30, 0x471d50, 0x471d60, 0x471d80, 0x471d90, 0x471db0, 0x471dc0, 0x471de0, 0x471df0, 0x471e10, 0x471e20, 0x471f20, 0x471f30, 0x471f50, 0x471f60, 0x471f80, 0x471f90, 0x471fa0, 0x471fb0, 0x471fc0, 0x471fd0, 0x473730, 0x473740, 0x473760, 0x473770, 0x473790, 0x4737a0, 0x4737c0, 0x4737d0, 0x4737f0, 0x473800, 0x473820, 0x473830, 0x473850, 0x473860, 0x473880, 0x473890, 0x4738b0, 0x4738c0, 0x4738e0, 0x4738f0, 0x473910, 0x473920, 0x473940, 0x473950, 0x473970, 0x473980, 0x4739a0, 0x4739b0, 0x4739c0, 0x4739d0, 0x4739f0, 0x473a00, 0x473a20, 0x473a30, 0x473a50, 0x473a60, 0x473a80, 0x473a90, 0x473ab0, 0x473ac0, 0x473bd0, 0x473be0, 0x473c00, 0x473c10, 0x4741a0, 0x4741b0, 0x4741c0, 0x4741d0, 0x4741e0, 0x4741f0, 0x474210, 0x474220, 0x474240, 0x474250, 0x474270, 0x474280, 0x4742a0, 0x4742b0, 0x4742d0, 0x4742e0, 0x474300, 0x474310, 0x474330, 0x474340, 0x474360, 0x474370, 0x474390, 0x4743a0, 0x4743c0, 0x4743d0, 0x4743f0, 0x474400, 0x474420, 0x474430, 0x474450, 0x474460, 0x474480, 0x474490, 0x4744a0, 0x4744b0, 0x4744d0, 0x4744e0, 0x474500, 0x474510, 0x474530, 0x474540, 0x474560, 0x474570, 0x474590, 0x4745a0, 0x4745b0, 0x4745c0, 0x4745e0, 0x4745f0, 0x4749d0, 0x4749e0, 0x474cc0, 0x474cd0, 0x474ce0, 0x474cf0, 0x474d10, 0x474d20, 0x474d40, 0x474d50, 0x474d70, 0x474d80, 0x474da0, 0x474db0, 0x474dd0, 0x474de0, 0x474e00, 0x474e10, 0x474e30, 0x474e40, 0x474e60, 0x474e70, 0x474e90, 0x474ea0, 0x474ec0, 0x474ed0, 0x474ef0, 0x474f00, 0x474f20, 0x474f30, 0x474f50, 0x474f60, 0x474f80, 0x474f90, 0x474fa0, 0x474fb0, 0x474fd0, 0x474fe0, 0x475000, 0x475010, 0x475030, 0x475040, 0x475060, 0x475070, 0x475090, 0x4750a0, 0x4750b0, 0x4750c0, 0x4750e0, 0x4750f0, 0x475460, 0x475470, 0x475560, 0x475570, 0x475580, 0x475590, 0x475770, 0x475780, 0x4757a0, 0x4757b0, 0x4757d0, 0x4757e0, 0x475800, 0x475810, 0x475830, 0x475840, 0x475860, 0x475870, 0x475890, 0x4758a0, 0x4758c0, 0x4758d0, 0x4758f0, 0x475900, 0x475920, 0x475930, 0x475950, 0x475960, 0x475980, 0x475990, 0x4759b0, 0x4759c0, 0x4759e0, 0x4759f0, 0x475a00, 0x475a10, 0x475a30, 0x475a40, 0x475a60, 0x475a70, 0x475a90, 0x475aa0, 0x475ac0, 0x475ad0, 0x475af0, 0x475b00, 0x475b10, 0x475b20, 0x475b40, 0x475b50 Confidence: verified Proof: one Test: none

A typical pair is 0x46c710, jmp 0x46c720, and 0x46c720, fld [0x8036c8]; fmul [0x8036c8]; fstp [0xb41d54]; ret. The counter body at 0x46ca70 is inc of 0xc2a3c4, cmp eax,1 and a tail jump to 0x5b71c0 on equality; the thunk 0x46ca60 calls it and jumps to 0x46ca90, which pushes 0x46caa0 for _atexit 0x409aef; 0x46caa0 is dec [0xc2a3c4]; jne; jmp 0x5b71d0. The values come from each file's constant pool: +inf is 0x7f800000, π 0x40490fdb, and the quotients divide 0x3f800000 (1.0) by the 2π global or 0x3f000000 (0.5) by 0x41200000 (10.0).

File-specific initializers

Seven initializers set up glue's own globals, each a call and jmp thunk whose jmp registers an exit handler: the list at 0xb41d70, made empty and unlinked at exit without freeing; the critical section 0xb414cc, built and deleted; the realm category array 0xb41f74, zeroed and freed; the create screen's globals from 0xb42078, zeroed, with the create model destroyed and the class list freed at exit; the four dwords from 0xb42058, zeroed and their array freed; the name generator at 0xb420b8, built and its two arrays freed; and the character roster 0xb4213c, zeroed, with each record destroyed and the roster freed at exit. Each exit handler runs once, guarded by a bit it sets.

Addresses: 0x46a2d0, 0x46a2e0, 0x46a310, 0x46a320, 0x46a3c0, 0x46a3d0, 0x46a3e0, 0x46a3f0, 0x46e290, 0x46e2a0, 0x46e2c0, 0x46e2d0, 0x470100, 0x470110, 0x470150, 0x470160, 0x4701b0, 0x4701c0, 0x4701e0, 0x4701f0, 0x470220, 0x470230, 0x470240, 0x470250, 0x471ff0, 0x472000, 0x472020, 0x472030, 0xb41d70, 0xb414cc, 0xb41f74, 0xb42078, 0xb42058, 0xb420b8, 0xb4213c, 0x475110, 0x473700 Confidence: verified Proof: one Test: none

0x46a2e0 stores 0 in 0xb41d70 and the head's own address, then that address with bit 0 set, in 0xb41d74 and 0xb41d78; 0x46a320 walks from 0xb41d78, zeroing each node's two links, and clears the head. 0x46a3d0 and 0x46a3f0 load 0xb414cc into ecx and tail-jump to SCritSect::SCritSect 0x657990 and SCritSect::~SCritSect 0x6579a0. The exit handlers test and set a guard bit: bit 0 of 0xb41f14 (0x46e2d0), bits 0 and 1 of 0xb42024 (0x470160, 0x4701f0), bit 0 of 0xb4202c (0x470250) and of 0xb42100 (0x472030). 0x470160 destroys the model at 0xb42078 (0x47017e) and frees 0xb42084; 0x470230 loads 0xb420b8 and tail-jumps to 0x475110; 0x472030 calls 0x473700 on each 0x120-byte record of 0xb42144 and frees it.

Starts the listing hides

Two function starts lie where the disassembly listing, decoding linearly through a jump table, is out of step: 0x46c2c0 and 0x471080. Each is a call target, and a disassembly that starts at the address decodes a normal prologue there. The listing has no instruction at these two addresses.

Addresses: 0x46c2c0, 0x471080, 0x46b930, 0x470f80, 0x46c2ac, 0x47106c, 0x46c214, 0x471900 Confidence: verified Proof: one Test: none

The jump table 0x46c2ac (five entries) ends 0x46b930 and 0x47106c (five entries) ends 0x470f80, each just before the start. The listing decodes the table bytes as instructions and joins the real stream at 0x46c2c3 and 0x471083, inside the prologues. 0x46c2c0 is called from 0x46c214, 0x471080 from 0x471900. The other tables of the run, 0x46aaac, 0x46b7a8, 0x46e998 and 0x4712e0, are followed by padding at which the listing falls back into step; before 0x46aaac and 0x47106c the compiler's unexecuted fillers mov edi,edi and lea ecx,[ecx+0x0] sit between the function's last instruction and its table.

Unreached functions

Nothing live reaches 0x473d40, a lone jmp to SendSurveyFailure 0x5ab610 between the survey cancel and the survey feed.

Addresses: 0x473d40, 0x473ce0, 0x5ab610, 0x473df0 Confidence: verified Proof: one Test: none

The census is two scans over the whole image: every e8 or e9 byte whose target is the function, and every occurrence of its address as a dword in any section. Both find nothing for 0x473d40. The function above, 0x473ce0, ends in jmp 0x5b3320 followed by padding, so nothing falls through into it. The control is 0x5ab610, for which the first scan finds this jmp and the call at 0x47413b, and 0x473df0, for which it finds its two calls 0x46bca5 and 0x46dde0. Every other function of the run is reached: a census over all 753 finds each a call, a jump, a stored address in a table that live code reads, or a slot of a vtable that live code installs.