Skip to main content

DESC_SET_PROTOTYPE

Constant DESC_SET_PROTOTYPE 

Source
pub const DESC_SET_PROTOTYPE: &str = "\
Replace a function's whole signature at once: return type, parameters, calling convention, and varargs. \
Supply the signature as STRUCTURED fields, not a C string. `target` is the function's address or current \
name. `return_type` and each `params[].type` are resolved by name (DATATYPE_NOT_FOUND / AMBIGUOUS_DATATYPE \
with candidates); a function-pointer or anonymous type you spell out (e.g. \"void (*)(int)\") is \
synthesized on the fly. `params` is an ordered list of {name?, type}; an empty list [] means no arguments \
(do NOT pass [{type:\"void\"}]). `calling_convention` must be one the program recognizes (e.g. __cdecl, \
__stdcall, __fastcall, or Ghidra's default/unknown) — an unknown one returns INVALID_PARAMS listing the \
valid set. `variadic:true` adds trailing ... . Read the current signature as these same fields from \
inspect_function's `prototype`, change what you need, and send the whole thing back. Idempotent: if the \
signature is already equivalent you get status:already_applied. Pass expected_signature (the current \
`signature` string from inspect_function) ONLY to guard against drift (else STATE_CONFLICT). Correcting a \
wrong signature is the highest-leverage edit — it re-derives the decompiled C (fixes in_<reg>/extraout_<reg> \
noise). A thunk, an external import, or a function with custom variable storage is rejected with \
INVALID_PARAMS — do not retry it. The edit is saved to disk (durable).";