Writes a formatted message to the installer's log file. The message appears in the installer's log file prefixed with message code TSU:I0065, like this:

00072040|TSU:I0065|langid|Message text

The langid portion represents the hexadecimal language code in which the installer operates, for example 0409 (US English) or 0407 (German). The maximum length of the formatted message is a little less than 1024 characters.

void LogMessage(
    const TCHAR *pszFormat,


[Input] Formatting string; see Formatting specification below for its syntax.
Zero or more arguments for the formatting string specified by pszFormat.

Return value


Formatting specification

The formatting specification is similar to that used by printf. It consists of a text string that contains literal text interspersed with formatting specifiers. Each formatting specifier starts with a % (percent) sign and must be matched with a corresponding argument to the right of pszFormat (except for the literal percent character inserted by %%). It must use the following syntax:


The options must appear in the order shown and have the following meaning. Options within [brackets] are optional.

Option Description
% Signals the start of a format specification. To insert a literal '%' character, use two in sequence: %%
- Left-align the formatted data within its field width
# Add a prefix or padding: # padding for types a, s, w; # prefix for type p; 0x prefix for x and X types.
0 Zero-pad the data to its field width (overrides # for types a, s, w). If neither # nor 0 is specified, the field is padded with spaces if necessary to achieve the minimum width.
, Insert thousands separators for types d, i, and u. The thousands separator follows the locale conventions of the current user (typically , or .).
width Decimal number that specifies the minimum formatted field width. Padding uses 0, #, or spaces, depending on the earlier options.
.precision Decimal number that specifies the maximum formatted width (for types d, i, u, x and X) or the maximum number of characters to copy (for types a, s, w).
size Data size modifier for types d, i, u, x and X; may be one of the following:
Size Description
(none) Default integer width, currently 32 bits for both _WIN32 and _WIN64. Use for int, unsigned int, and related types.
h Half-width (16 bits). Use for short, unsigned short, and related types.
l Long (32 bits, same as I32). Use for long, unsigned long, and related types.
q Quad (64 bits, same as I64). Use for __int64, unsigned __int64, and related types.
I 32 bits for _WIN32 builds, 64 bits for _WIN64 builds. Use for LPARAM, LRESULT, UINT_PTR, etc.
I32 Always 32 bits.
I64 Always 64 bits.
type Data type specifier; may be one of the following:
Type Description
a 0-terminated string in ANSI format. Use for char *, CHAR *, and related types.
c Single character; follows _UNICODE. Use for TCHAR data.
d Signed decimal integer. Use for short, int, long, __int64, and related types.
i Same as d.
p Pointer; follows _WIN32/_WIN64 option. Use for void * and other pointer-sized types.
s 0-terminated string; follows _UNICODE. Use for TCHAR * data.
u Unsigned decimal integer. Use for short, int, long, __int64, and related types.
w 0-terminated string in Unicode format. Use for wchar_t *, WCHAR *, and related types.
x Hexadecimal integer using lowercase letters a-f. Use for short, int, long, __int64, and related types.
X Same as x, but uses uppercase letters A-F.
% Inserts a literal '%' character. There should be no corresponding argument for this pseudo-type.

All other type characters cause LogMessage to exit immediately.

See also

LogMessage() custom DLL function