From: Paul Gofman pgofman@codeweavers.com
--- dlls/shlwapi/tests/string.c | 26 ++++++++++++++++++++++++++ dlls/shlwapi/wsprintf.c | 18 +++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/dlls/shlwapi/tests/string.c b/dlls/shlwapi/tests/string.c index f74ebf13c22..d3016837f9f 100644 --- a/dlls/shlwapi/tests/string.c +++ b/dlls/shlwapi/tests/string.c @@ -1717,16 +1717,42 @@ static void test_printf_format(void) { "%hs", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)"str" }, { "%hS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)"str" }, { "%ws", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str" }, + { "%wS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str" }, { "%hhs", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)"str" }, { "%hhS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)"str" }, + { "%wws", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str" }, + { "%wwS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str" }, { "%wwws", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str" }, + { "%wwwS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str" }, + { "%hws", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%hwS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%whs", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%whS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%hwls", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%hwlls", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%hwlS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%hwllS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%lhws", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%llhws", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%lhwS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, + { "%llhwS", sizeof(ULONG_PTR), "str", NULL, (ULONG_PTR)L"str", "str" }, { "%c", sizeof(SHORT), "\xc8", L"\x95c8", 0x95c8 }, { "%lc", sizeof(SHORT), "\x3f", L"\x95c8", 0x95c8 }, + { "%lllc", sizeof(SHORT), "\x3f", L"\x95c8", 0x95c8 }, + { "%lllllc", sizeof(SHORT), "\x3f", L"\x95c8", 0x95c8 }, { "%C", sizeof(SHORT), "\x3f", L"\xc8", 0x95c8 }, { "%lC", sizeof(SHORT), "\x3f", L"\x95c8", 0x95c8 }, + { "%lllC", sizeof(SHORT), "\x3f", L"\x95c8", 0x95c8 }, + { "%lllllC", sizeof(SHORT), "\x3f", L"\x95c8", 0x95c8 }, { "%hc", sizeof(BYTE), "\xc8", L"\xc8", 0x95c8 }, { "%hhc", sizeof(BYTE), "\xc8", L"\xc8", 0x95c8 }, { "%hhhc", sizeof(BYTE), "\xc8", L"\xc8", 0x95c8 }, + { "%wc", sizeof(BYTE), "\x3f", L"\x95c8", 0x95c8 }, + { "%wC", sizeof(BYTE), "\x3f", L"\x95c8", 0x95c8 }, + { "%hwc", sizeof(BYTE), "\x3f", L"\xc8", 0x95c8 }, + { "%whc", sizeof(BYTE), "\x3f", L"\xc8", 0x95c8 }, + { "%hwC", sizeof(BYTE), "\x3f", L"\xc8", 0x95c8 }, + { "%whC", sizeof(BYTE), "\x3f", L"\xc8", 0x95c8 }, { "%I64u", sizeof(ULONG64), "10", NULL, 10 }, { "%llI64u", sizeof(ULONG64), "10", NULL, 10 }, { "%I64llu", sizeof(ULONG64), "10", NULL, 10 }, diff --git a/dlls/shlwapi/wsprintf.c b/dlls/shlwapi/wsprintf.c index ed385081821..eb64b5e3845 100644 --- a/dlls/shlwapi/wsprintf.c +++ b/dlls/shlwapi/wsprintf.c @@ -114,7 +114,7 @@ static INT WPRINTF_ParseFormatA( LPCSTR format, WPRINTF_FORMAT *res ) { switch (*p) { - case 'l': res->flags |= WPRINTF_LONG; ++p; break; + case 'l': res->flags |= WPRINTF_LONG | WPRINTF_WIDE; ++p; break; case 'I': if (p[1] == '6' && p[2] == '4') { res->flags |= WPRINTF_I64; p += 3; } else if (p[1] == '3' && p[2] == '2') p += 3; @@ -127,20 +127,20 @@ static INT WPRINTF_ParseFormatA( LPCSTR format, WPRINTF_FORMAT *res ) switch(*p) { case 'c': - res->type = (res->flags & WPRINTF_LONG) ? WPR_WCHAR : WPR_CHAR; + res->type = (res->flags & WPRINTF_WIDE) ? WPR_WCHAR : WPR_CHAR; break; case 'C': - res->type = (res->flags & WPRINTF_SHORT) ? WPR_CHAR : WPR_WCHAR; + res->type = (res->flags & (WPRINTF_SHORT | WPRINTF_WIDE)) == WPRINTF_SHORT ? WPR_CHAR : WPR_WCHAR; break; case 'd': case 'i': res->type = WPR_SIGNED; break; case 's': - res->type = (res->flags & (WPRINTF_LONG |WPRINTF_WIDE)) ? WPR_WSTRING : WPR_STRING; + res->type = (res->flags & WPRINTF_WIDE) ? WPR_WSTRING : WPR_STRING; break; case 'S': - res->type = (res->flags & (WPRINTF_SHORT|WPRINTF_WIDE)) ? WPR_STRING : WPR_WSTRING; + res->type = (res->flags & (WPRINTF_SHORT | WPRINTF_WIDE)) == WPRINTF_SHORT ? WPR_STRING : WPR_WSTRING; break; case 'u': res->type = WPR_UNSIGNED; @@ -201,7 +201,7 @@ static INT WPRINTF_ParseFormatW( LPCWSTR format, WPRINTF_FORMAT *res ) { switch (*p) { - case 'l': res->flags |= WPRINTF_LONG; ++p; break; + case 'l': res->flags |= WPRINTF_LONG | WPRINTF_WIDE; ++p; break; case 'I': if (p[1] == '6' && p[2] == '4') { res->flags |= WPRINTF_I64; p += 3; } else if (p[1] == '3' && p[2] == '2') p += 3; @@ -217,17 +217,17 @@ static INT WPRINTF_ParseFormatW( LPCWSTR format, WPRINTF_FORMAT *res ) res->type = (res->flags & WPRINTF_SHORT) ? WPR_CHAR : WPR_WCHAR; break; case 'C': - res->type = (res->flags & WPRINTF_LONG) ? WPR_WCHAR : WPR_CHAR; + res->type = (res->flags & (WPRINTF_SHORT | WPRINTF_WIDE)) == WPRINTF_WIDE ? WPR_WCHAR : WPR_CHAR; break; case 'd': case 'i': res->type = WPR_SIGNED; break; case 's': - res->type = ((res->flags & WPRINTF_SHORT) && !(res->flags & WPRINTF_WIDE)) ? WPR_STRING : WPR_WSTRING; + res->type = (res->flags & WPRINTF_SHORT) ? WPR_STRING : WPR_WSTRING; break; case 'S': - res->type = (res->flags & (WPRINTF_LONG|WPRINTF_WIDE)) ? WPR_WSTRING : WPR_STRING; + res->type = (res->flags & (WPRINTF_SHORT | WPRINTF_WIDE)) == WPRINTF_WIDE ? WPR_WSTRING : WPR_STRING; break; case 'u': res->type = WPR_UNSIGNED;