TWUGetErrorMessage

The TWUGetErrorMessage function retrieves a descriptive error message for a given Win32 error code. This can be used to provide more information in the case of failure. If no description is available, a default string with the error code embedded in it is returned.

TCHAR * TWUGetErrorMessage(
    URESULT uResult,
    TCHAR *pszBuffer,
    UINT uBufferSize
);

Delphi version:

function TWUGetErrorMessage(
    _uResult: URESULT;
    pszBuffer: PTCHAR;
    uBufferSize: UINT
): PTCHAR;

Parameters

uResult
[Input] A Win32 error code returned by one of the TWU functions or another Win32 function.
pszBuffer
[Output] Pointer to a buffer that receives the error message text. The size of the buffer must be at least 32 characters (not bytes), although most error messages require more. To avoid truncation, provide a buffer of at least 256 characters long.
uBufferSize
[Input] Size of the buffer area pointed to by pszBuffer. The size must be expressed as a count of characters, not bytes. (In Delphi, use Length(pszBuffer) if pszBuffer is a fixed-size null-terminated string buffer.)

Return value

The function returns a pointer to the end of the formatted error message, i.e., to the terminating 0 character.