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

This commit is contained in:
Alexandre Julliard 2009-10-29 20:48:26 +01:00
parent 24a8e33fb6
commit 0e26e741f7
2 changed files with 6 additions and 2 deletions

View File

@ -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 */

View File

@ -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 */
{