Index: CMakeLists.txt =================================================================== --- lib/inflib/CMakeLists.txt (revision 59502) +++ lib/inflib/CMakeLists.txt (working copy) @@ -21,9 +21,6 @@ infhostrtl.c) add_definitions(-D__NO_CTYPE_INLINES -DINFLIB_HOST) - if(MSVC) - add_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS) - endif() add_library(inflibhost ${GLOBAL_FILES} ${SOURCE}) if(NOT MSVC) add_target_compile_flags(inflibhost "-Wpointer-arith -Wwrite-strings") Index: infget.c =================================================================== --- lib/inflib/infget.c (revision 59502) +++ lib/inflib/infget.c (working copy) @@ -19,6 +19,36 @@ WCHAR *buffer, unsigned int size); +static int +fake_swprintf(PWCHAR wbuffer, + PCSTR format, + ...) +#ifdef __GNUC__ +__attribute__((format(printf, 2, 3))) +#endif +; + +static int +fake_swprintf(PWCHAR wbuffer, + PCSTR format, + ...) +{ + va_list args; + char buffer[15]; + int ret; + + va_start(args, format); + ret = sprintf(buffer, format, args); + va_end(args); + + (void)RtlMultiByteToUnicodeN(wbuffer, + -1, + NULL, + buffer, + ret + 1); + return ret; +} + /* retrieve the string substitution for a given string, or NULL if not found */ /* if found, len is set to the substitution length */ static PCWSTR @@ -48,9 +78,9 @@ if (Inf->LanguageId != 0) { - swprintf(StringLangId, - L"Strings.%04hx", - Inf->LanguageId); + fake_swprintf(StringLangId, + "Strings.%04hx", + Inf->LanguageId); Status = InfpFindFirstLine(Inf, StringLangId, @@ -58,9 +88,9 @@ &Context); if (Status != INF_STATUS_SUCCESS) { - swprintf(StringLangId, - L"Strings.%04hx", - MAKELANGID(PRIMARYLANGID(Inf->LanguageId), SUBLANG_NEUTRAL)); + fake_swprintf(StringLangId, + "Strings.%04hx", + MAKELANGID(PRIMARYLANGID(Inf->LanguageId), SUBLANG_NEUTRAL)); Status = InfpFindFirstLine(Inf, StringLangId,