Commit 0e26e741 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Replicate the MS bug with va_list argument counting in FormatMessage.

parent 24a8e33f
......@@ -210,6 +210,8 @@ static LPCSTR format_insertA( int insert, LPCSTR format, DWORD flags,
while (isdigit(*format)) *p++ = *format++;
}
/* replicate MS bug: drop an argument when using va_list with width/precision */
if (insert == -1 && args->list) args->last--;
arg = get_arg( insert, flags, args );
/* check for wide string format */
......@@ -333,6 +335,8 @@ static LPCWSTR format_insertW( int insert, LPCWSTR format, DWORD flags,
while (isdigitW(*format)) *p++ = *format++;
}
/* replicate MS bug: drop an argument when using va_list with width/precision */
if (insert == -1 && args->list) args->last--;
arg = get_arg( insert, flags, args );
/* check for ascii string format */
......
......@@ -337,7 +337,7 @@ static void test_message_from_string_wide(void)
ok(r==11,"failed: r=%d\n",r);
r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1oou3oou,
0, 0, out, sizeof(out)/sizeof(WCHAR), 5, 3, 1, 6, 4, 2 );
todo_wine ok(!lstrcmpW( s_sp001sp002, out),"failed out=[%s]\n", wine_dbgstr_w(out));
ok(!lstrcmpW( s_sp001sp002, out),"failed out=[%s]\n", wine_dbgstr_w(out));
ok(r==12,"failed: r=%d\n",r);
/* args are not counted the same way with an argument array */
{
......@@ -589,7 +589,7 @@ static void test_message_from_string(void)
ok(r==11,"failed: r=%d\n",r);
r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*.*u!,%3!*.*u!",
0, 0, out, sizeof(out), 5, 3, 1, 6, 4, 2 );
todo_wine ok(!strcmp( " 001, 0002", out),"failed out=[%s]\n",out);
ok(!strcmp( " 001, 0002", out),"failed out=[%s]\n",out);
ok(r==12,"failed: r=%d\n",r);
/* args are not counted the same way with an argument array */
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment