kernel32: Replicate the MS bug with va_list argument counting in FormatMessage.
diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c
index ce4e52f..4b5b00c 100644
--- a/dlls/kernel32/format_msg.c
+++ b/dlls/kernel32/format_msg.c
@@ -210,6 +210,8 @@
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 @@
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 */
diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c
index 43b3ce2..583cae8 100644
--- a/dlls/kernel32/tests/format_msg.c
+++ b/dlls/kernel32/tests/format_msg.c
@@ -337,7 +337,7 @@
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 @@
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 */
{