int Decodeargument(t_module *pmod,wchar_t *prtype,void *data,int ndata,wchar_t *text,int ntext,int *nontriv);

Decodes data of size ndata as element of prefixed type prtype to the UNICODE string text at least ntext wide characters long. Optionally sets nontriv to zero if decoding is trivial (i.e. invalid or contains only hexadecimal or decimal numbers) and to 1 otherwise.

Note that this routine ignores ARG_OUT. The burden of proof whether pointer points to the valid data is on the calling routine.


(in) Optional ointer to the module descriptor (structure of type t_module), necessary to decode module-dependent items, like resource strings or .NET-specific data
(in) Pointer to the UNICODE string, prefixed type of the information in data
(in) Pointer to the argument, ndata bytes long, that will be decoded to the text
(in) Length of the data, bytes
(out) UNICODE buffer, at least ntext wide characters long, that receives decoding. The produced string is always null-terminated
(in) Length of the text buffer, wide characters
(out) Optional pointer to the variable that will be set to 0 if decoding is trivial (contains only hexadecimal or decimal number) or not possible due to the error, and 1 otherwise

Return values:

Returns length of the decoded text, in wide characters, not including the terminal zero, or 0 on any error.


Suppose we are going to decode parameter Msg of DefWindowProc(). The corresponding call may be like this:

int msg;
wchar_t text[TEXTLEN],prefixedtype[SHORTNAME];
// Get value of the argument.
// Prepare prefixed type. Internal type of Msg in the database is
// WM_XA (ASCII) or WM_XW (UNICODE). Names of the constants are the
// same in both cases.
// Decoding of Msg is module-independent, I set pmod to NULL.

On return, text will contain "WM_SETCURSOR", which is the name of the message with code 32 (0x20).

See also:
Analysis, arguments, known functions, Decodeknownbyaddr(), Decodeknownbyname(), Decodetype(), Decodestructure()