REDIVIVUS

Proposals / #1363

Restore the Mac wide-string formatter's three fixed arguments and variadic contract

checked · by eejitgames · submitted 2026-11-06

Mac UNICODE_FormatWideString (002ba1dc) is fixed-arity with a uint16_t * fourth argument, but its native body consumes successive DWORD values following three fixed inputs (capacity, destination, format). It loads the first value at [EBP+14], keeps a cursor starting at [EBP+18], then advances it by four and loads the next value. Format dispatch interprets values as signed/unsigned integers or UTF-16 string pointers. Callers at 0009d6b1 and 000cfc68 explicitly supply five total arguments. Recover void cdecl with the same first three names/types and ellipsis. Windows 005269d0 has the same formatter algorithm and already has three fixed arguments plus varargs. Full Mac body/epilogue and representative call setups verified; no prior Mac correction or issue found. Static contract correction, with no claim that formatting behavior is otherwise repaired.

Changes 1, applied together

  1. Set prototype mac 0x002ba1dc

    signatureundefined UNICODE_FormatWideString(int nMaxChars, uint16_t * wszDest, uint16_t * wszFormat, uint16_t * param_4)→void UNICODE_FormatWideString(int nMaxChars, uint16_t * wszDest, uint16_t * wszFormat, ...)
    convention__cdecl