Use CFIX_LOG to log arbitrary information. The macro allows printf-style formatting and variable argument lists. Consult the documentation of printf for a list of format specifiers.
void CFIX_LOG( __in PCTSTR Format, ... );In C++, it is valid to pass a PCSTR even though UNICODE is defined and PCWSTR if UNICODE is not defined. Additionally, the following overloads exist:
void CFIX_LOG( __in std::string Message ); void CFIX_LOG( __in std::wstring Message );
If UNICODE has been defined, string parameters are expected to by of type PCWSTR. Otherwise, ANSI is assumed and string parameters are expected to by of type PCSTR.
In kernel mode, ANSI strings are not supported. Strings are always assumed to by of type PCWSTR. Moreover, formatting can only take place at IRQL <= APC_LEVEL. At higher IRQL, formatting is skipped and the Format string is used as-is.
CFIX_LOG( L"A simple log message" ); CFIX_LOG( L"Value is %x, Last error was: %d", foo, GetLastError() );