winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2009
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
1207 discussions
Start a n
N
ew thread
Alexandre Julliard : kernel32/tests: Fix FormatMessage test failures on various Windows versions.
by Alexandre Julliard
30 Oct '09
30 Oct '09
Module: wine Branch: master Commit: 36e56ad1aa3214c148725a626b5df678981b13b1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=36e56ad1aa3214c148725a626…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 29 22:10:21 2009 +0100 kernel32/tests: Fix FormatMessage test failures on various Windows versions. --- dlls/kernel32/tests/format_msg.c | 81 ++++++++++++++++++++++--------------- include/winerror.h | 9 ++++ 2 files changed, 57 insertions(+), 33 deletions(-) diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index 583cae8..dbd7fc7 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -121,6 +121,7 @@ static void test_message_from_string_wide(void) static const WCHAR s_sp001sp002[] = {' ',' ','0','0','1',',',' ',' ','0','0','0','2',0}; static const WCHAR s_sp002sp001[] = {' ',' ','0','0','0','2',',',' ',' ','0','0','1',0}; static const WCHAR s_sp002sp003[] = {' ',' ','0','0','0','2',',',' ','0','0','0','0','3',0}; + static const WCHAR s_sp001004[] = {' ',' ','0','0','1',',','0','0','0','0','0','4',0}; WCHAR out[0x100] = {0}; DWORD r, error; @@ -337,7 +338,8 @@ 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 ); - ok(!lstrcmpW( s_sp001sp002, out),"failed out=[%s]\n", wine_dbgstr_w(out)); + ok(!lstrcmpW( s_sp001sp002, out) || broken(!lstrcmpW(s_sp001004, 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 */ { @@ -573,35 +575,42 @@ static void test_message_from_string(void) ok(r==3, "failed: r=%d\n",r); r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*s!", 0, 0, out, sizeof(out), 4, "t"); - ok(!strcmp( " t", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%d\n",r); - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4.2u!", - 0, 0, out, sizeof(out), 3 ); - ok(!strcmp( " 03", out),"failed out=[%s]\n",out); - ok(r==4,"failed: r=%d\n",r); - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*.*u!", - 0, 0, out, sizeof(out), 5, 3, 1 ); - ok(!strcmp( " 001", out),"failed out=[%s]\n",out); - ok(r==5,"failed: r=%d\n",r); - r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*.*u!,%1!*.*u!", - 0, 0, out, sizeof(out), 5, 3, 1, 4, 2 ); - ok(!strcmp( " 001, 0002", out),"failed out=[%s]\n",out); - 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 ); - 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 */ + if (!strcmp("*s",out)) win_skip( "width/precision not supported\n" ); + else { - ULONG_PTR args[] = { 6, 4, 2, 5, 3, 1 }; - r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, - "%1!*.*u!,%1!*.*u!", 0, 0, out, sizeof(out), (__ms_va_list *)args ); - ok(!strcmp(" 0002, 00003", out),"failed out=[%s]\n",out); - ok(r==13,"failed: r=%d\n",r); - r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, - "%1!*.*u!,%4!*.*u!", 0, 0, out, sizeof(out), (__ms_va_list *)args ); - ok(!strcmp(" 0002, 001", out),"failed out=[%s]\n",out); + ok(!strcmp( " t", out),"failed out=[%s]\n",out); + ok(r==4,"failed: r=%d\n",r); + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4.2u!", + 0, 0, out, sizeof(out), 3 ); + ok(!strcmp( " 03", out),"failed out=[%s]\n",out); + ok(r==4,"failed: r=%d\n",r); + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*.*u!", + 0, 0, out, sizeof(out), 5, 3, 1 ); + ok(!strcmp( " 001", out),"failed out=[%s]\n",out); + ok(r==5,"failed: r=%d\n",r); + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*.*u!,%1!*.*u!", + 0, 0, out, sizeof(out), 5, 3, 1, 4, 2 ); + ok(!strcmp( " 001, 0002", out),"failed out=[%s]\n",out); + 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 ); + /* older Win versions marked as broken even though this is arguably the correct behavior */ + /* but the new (brain-damaged) behavior is specified on MSDN */ + ok(!strcmp( " 001, 0002", out) || broken(!strcmp(" 001,000004", 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 */ + { + ULONG_PTR args[] = { 6, 4, 2, 5, 3, 1 }; + r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, + "%1!*.*u!,%1!*.*u!", 0, 0, out, sizeof(out), (__ms_va_list *)args ); + ok(!strcmp(" 0002, 00003", out),"failed out=[%s]\n",out); + ok(r==13,"failed: r=%d\n",r); + r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, + "%1!*.*u!,%4!*.*u!", 0, 0, out, sizeof(out), (__ms_va_list *)args ); + ok(!strcmp(" 0002, 001", out),"failed out=[%s]\n",out); + ok(r==12,"failed: r=%d\n",r); + } } /* change of pace... test the low byte of dwflags */ @@ -677,35 +686,41 @@ static void test_message_from_hmodule(void) MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_MR_MID_NOT_FOUND || error == ERROR_MUI_FILE_NOT_FOUND, "last error %u\n", error); SetLastError(0xdeadbeef); ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_MR_MID_NOT_FOUND || error == ERROR_MUI_FILE_NOT_LOADED, "last error %u\n", error); SetLastError(0xdeadbeef); ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_MR_MID_NOT_FOUND || error == ERROR_MUI_FILE_NOT_LOADED, "last error %u\n", error); SetLastError(0xdeadbeef); ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_RESOURCE_LANG_NOT_FOUND || + error == ERROR_MR_MID_NOT_FOUND || + error == ERROR_MUI_FILE_NOT_LOADED, + "last error %u\n", error); SetLastError(0xdeadbeef); ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_UK), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - ok(error == ERROR_RESOURCE_LANG_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_RESOURCE_LANG_NOT_FOUND || + error == ERROR_MR_MID_NOT_FOUND || + error == ERROR_MUI_FILE_NOT_FOUND, + "last error %u\n", error); } START_TEST(format_msg) diff --git a/include/winerror.h b/include/winerror.h index a1fa985..5d02c06 100644 --- a/include/winerror.h +++ b/include/winerror.h @@ -1559,6 +1559,15 @@ static inline HRESULT HRESULT_FROM_WIN32(unsigned int x) #define ERROR_SXS_THREAD_QUERIES_DISABLED 14010 #define ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET 14011 #define ERROR_SXS_CORRUPTION 14083 +#define ERROR_MUI_FILE_NOT_FOUND 15100 +#define ERROR_MUI_INVALID_FILE 15101 +#define ERROR_MUI_INVALID_RC_CONFIG 15102 +#define ERROR_MUI_INVALID_LOCALE_NAME 15103 +#define ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME 15104 +#define ERROR_MUI_FILE_NOT_LOADED 15105 +#define ERROR_RESOURCE_ENUM_USER_STOP 15106 +#define ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED 15107 +#define ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME 15108 /* HRESULT values for OLE, SHELL and other Interface stuff */ /* the codes 4000-40ff are reserved for OLE */
1
0
0
0
Alexandre Julliard : kernel32/tests: Use __ms_va_list in the FormatMessage test.
by Alexandre Julliard
30 Oct '09
30 Oct '09
Module: wine Branch: master Commit: 24a8e33fb68bed795558948109f88f9237390115 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=24a8e33fb68bed79555894810…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 29 19:15:20 2009 +0100 kernel32/tests: Use __ms_va_list in the FormatMessage test. --- dlls/kernel32/tests/format_msg.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index 4b4192e..43b3ce2 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -26,29 +26,29 @@ /* #define ok(cond,failstr) if(!(cond)) {printf("line %d : %s\n",__LINE__,failstr);exit(1);} */ -static DWORD doit(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, - LPSTR out, DWORD outsize, ... ) +static DWORD __cdecl doit(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, + LPSTR out, DWORD outsize, ... ) { - va_list list; + __ms_va_list list; DWORD r; - va_start(list, outsize); + __ms_va_start(list, outsize); r = FormatMessageA(flags, src, msg_id, lang_id, out, outsize, &list); - va_end(list); + __ms_va_end(list); return r; } -static DWORD doitW(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, - LPWSTR out, DWORD outsize, ... ) +static DWORD __cdecl doitW(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, + LPWSTR out, DWORD outsize, ... ) { - va_list list; + __ms_va_list list; DWORD r; - va_start(list, outsize); + __ms_va_start(list, outsize); r = FormatMessageW(flags, src, msg_id, lang_id, out, outsize, &list); - va_end(list); + __ms_va_end(list); return r; } @@ -343,11 +343,11 @@ static void test_message_from_string_wide(void) { ULONG_PTR args[] = { 6, 4, 2, 5, 3, 1 }; r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, fmt_1oou1oou, - 0, 0, out, sizeof(out)/sizeof(WCHAR), (va_list *)args ); + 0, 0, out, sizeof(out)/sizeof(WCHAR), (__ms_va_list *)args ); ok(!lstrcmpW(s_sp002sp003, out),"failed out=[%s]\n", wine_dbgstr_w(out)); ok(r==13,"failed: r=%d\n",r); r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, fmt_1oou4oou, - 0, 0, out, sizeof(out)/sizeof(WCHAR), (va_list *)args ); + 0, 0, out, sizeof(out)/sizeof(WCHAR), (__ms_va_list *)args ); ok(!lstrcmpW(s_sp002sp001, out),"failed out=[%s]\n", wine_dbgstr_w(out)); ok(r==12,"failed: r=%d\n",r); } @@ -595,11 +595,11 @@ static void test_message_from_string(void) { ULONG_PTR args[] = { 6, 4, 2, 5, 3, 1 }; r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, - "%1!*.*u!,%1!*.*u!", 0, 0, out, sizeof(out), (va_list *)args ); + "%1!*.*u!,%1!*.*u!", 0, 0, out, sizeof(out), (__ms_va_list *)args ); ok(!strcmp(" 0002, 00003", out),"failed out=[%s]\n",out); ok(r==13,"failed: r=%d\n",r); r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, - "%1!*.*u!,%4!*.*u!", 0, 0, out, sizeof(out), (va_list *)args ); + "%1!*.*u!,%4!*.*u!", 0, 0, out, sizeof(out), (__ms_va_list *)args ); ok(!strcmp(" 0002, 001", out),"failed out=[%s]\n",out); ok(r==12,"failed: r=%d\n",r); }
1
0
0
0
Alexandre Julliard : kernel32: Replicate the MS bug with va_list argument counting in FormatMessage.
by Alexandre Julliard
30 Oct '09
30 Oct '09
Module: wine Branch: master Commit: 0e26e741f7e40e9483fd22d7b326ede1b801f380 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0e26e741f7e40e9483fd22d7b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 29 20:48:26 2009 +0100 kernel32: Replicate the MS bug with va_list argument counting in FormatMessage. --- dlls/kernel32/format_msg.c | 4 ++++ dlls/kernel32/tests/format_msg.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) 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 @@ 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 */ 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 @@ 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 */ {
1
0
0
0
Alexandre Julliard : kernel32: Fix handling of width and precision arguments and remove assumptions about va_list implementation in FormatMessage .
by Alexandre Julliard
30 Oct '09
30 Oct '09
Module: wine Branch: master Commit: b3534015135a3b3622c5f3c7d4aefefb04e8d36d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b3534015135a3b3622c5f3c7d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 29 19:11:28 2009 +0100 kernel32: Fix handling of width and precision arguments and remove assumptions about va_list implementation in FormatMessage. --- dlls/kernel32/format_msg.c | 75 ++++++++++++++++++++++++++++---------- dlls/kernel32/tests/format_msg.c | 13 ++++++- 2 files changed, 67 insertions(+), 21 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=b3534015135a3b3622c5f…
1
0
0
0
Alexandre Julliard : kernel32: Propagate the error result from RtlFindMessage in FormatMessage.
by Alexandre Julliard
30 Oct '09
30 Oct '09
Module: wine Branch: master Commit: 100131d4ca7c409ef0fc940def01f0593a75cc75 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=100131d4ca7c409ef0fc940de…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 29 17:40:15 2009 +0100 kernel32: Propagate the error result from RtlFindMessage in FormatMessage. --- dlls/kernel32/format_msg.c | 28 ++++++++++++++-------------- dlls/kernel32/tests/format_msg.c | 8 ++++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index 18b4f96..46f65a1 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -72,11 +72,16 @@ static LPWSTR load_messageW( HMODULE module, UINT id, WORD lang ) { const MESSAGE_RESOURCE_ENTRY *mre; WCHAR *buffer; + NTSTATUS status; TRACE("module = %p, id = %08x\n", module, id ); if (!module) module = GetModuleHandleW( NULL ); - if (RtlFindMessage( module, RT_MESSAGETABLE, lang, id, &mre ) != STATUS_SUCCESS) return NULL; + if ((status = RtlFindMessage( module, RT_MESSAGETABLE, lang, id, &mre )) != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + return NULL; + } if (mre->Flags & MESSAGE_RESOURCE_UNICODE) { @@ -102,11 +107,16 @@ static LPSTR load_messageA( HMODULE module, UINT id, WORD lang ) { const MESSAGE_RESOURCE_ENTRY *mre; char *buffer; + NTSTATUS status; TRACE("module = %p, id = %08x\n", module, id ); if (!module) module = GetModuleHandleW( NULL ); - if (RtlFindMessage( module, RT_MESSAGETABLE, lang, id, &mre ) != STATUS_SUCCESS) return NULL; + if ((status = RtlFindMessage( module, RT_MESSAGETABLE, lang, id, &mre )) != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + return NULL; + } if (mre->Flags & MESSAGE_RESOURCE_UNICODE) { @@ -426,12 +436,7 @@ DWORD WINAPI FormatMessageA( from = load_messageA( (HMODULE)lpSource, dwMessageId, dwLanguageId ); if (!from && (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)) from = load_messageA( kernel32_handle, dwMessageId, dwLanguageId ); - - if (!from) - { - SetLastError (ERROR_RESOURCE_LANG_NOT_FOUND); - return 0; - } + if (!from) return 0; } target = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 100); t = target; @@ -597,12 +602,7 @@ DWORD WINAPI FormatMessageW( from = load_messageW( (HMODULE)lpSource, dwMessageId, dwLanguageId ); if (!from && (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)) from = load_messageW( kernel32_handle, dwMessageId, dwLanguageId ); - - if (!from) - { - SetLastError (ERROR_RESOURCE_LANG_NOT_FOUND); - return 0; - } + if (!from) return 0; } target = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 100 * sizeof(WCHAR) ); t = target; diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index 2bbcfc8..15064b2 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -668,28 +668,28 @@ static void test_message_from_hmodule(void) MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - todo_wine ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); SetLastError(0xdeadbeef); ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - todo_wine ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); SetLastError(0xdeadbeef); ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - todo_wine ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); SetLastError(0xdeadbeef); ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), out, sizeof(out)/sizeof(CHAR), NULL); error = GetLastError(); ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); - todo_wine ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); SetLastError(0xdeadbeef); ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044,
1
0
0
0
Alexandre Julliard : kernel32: Reimplement the formatting of inserts in FormatMessageW.
by Alexandre Julliard
30 Oct '09
30 Oct '09
Module: wine Branch: master Commit: b381958f7879e90a0e501982acd192acc11b8411 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b381958f7879e90a0e501982a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 29 17:36:45 2009 +0100 kernel32: Reimplement the formatting of inserts in FormatMessageW. --- dlls/kernel32/format_msg.c | 186 ++++++++++++++++++++++++++++++-------------- 1 files changed, 127 insertions(+), 59 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index dd10efa..18b4f96 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -256,6 +256,126 @@ static LPCSTR format_insertA( int insert, LPCSTR format, DWORD flags, __ms_va_li } +/********************************************************************** + * format_insertW (internal) + */ +static LPCWSTR format_insertW( int insert, LPCWSTR format, DWORD flags, __ms_va_list *args, LPWSTR *result) +{ + static const WCHAR fmt_lu[] = {'%','l','u',0}; + WCHAR *wstring = NULL, *p, fmt[256]; + ULONG_PTR arg; + int size; + + if (*format != '!') /* simple string */ + { + WCHAR *str = (WCHAR *)get_arg( insert, flags, args ); + *result = HeapAlloc( GetProcessHeap(), 0, (strlenW(str) + 1) * sizeof(WCHAR) ); + strcpyW( *result, str ); + return format; + } + + format++; + p = fmt; + *p++ = '%'; + + while (*format == '0' || + *format == '+' || + *format == '-' || + *format == ' ' || + *format == '*' || + *format == '#') + { + if (*format == '*') + { + p += sprintfW( p, fmt_lu, get_arg( insert, flags, args )); + insert++; + format++; + } + else *p++ = *format++; + } + while (isdigitW(*format)) *p++ = *format++; + + if (*format == '.') + { + *p++ = *format++; + if (*format == '*') + { + p += sprintfW( p, fmt_lu, get_arg( insert, flags, args )); + insert++; + format++; + } + else + while (isdigitW(*format)) *p++ = *format++; + } + + arg = get_arg( insert, flags, args ); + + /* check for ascii string format */ + if ((format[0] == 'h' && format[1] == 's') || + (format[0] == 'h' && format[1] == 'S') || + (format[0] == 'S')) + { + DWORD len = MultiByteToWideChar( CP_ACP, 0, (char *)arg, -1, /*FIXME*/ NULL, 0 ); + wstring = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, (char *)arg, -1, wstring, len ); + arg = (ULONG_PTR)wstring; + *p++ = 's'; + } + /* check for ascii character format */ + else if ((format[0] == 'h' && format[1] == 'c') || + (format[0] == 'h' && format[1] == 'C') || + (format[0] == 'C')) + { + char ch = arg; + wstring = HeapAlloc( GetProcessHeap(), 0, 2 ); + MultiByteToWideChar( CP_ACP, 0, &ch, 1, wstring, 1 ); + wstring[1] = 0; + arg = (ULONG_PTR)wstring; + *p++ = 's'; + } + /* check for wide string format */ + else if ((format[0] == 'l' && format[1] == 's') || + (format[0] == 'l' && format[1] == 'S') || + (format[0] == 'w' && format[1] == 's')) + { + *p++ = 's'; + } + /* check for wide character format */ + else if ((format[0] == 'l' && format[1] == 'c') || + (format[0] == 'l' && format[1] == 'C') || + (format[0] == 'w' && format[1] == 'c')) + { + *p++ = 'c'; + } + /* FIXME: handle I64 etc. */ + else while (*format && *format != '!') *p++ = *format++; + + *p = 0; + size = 256; + for (;;) + { + WCHAR *ret = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) ); + int needed = snprintfW( ret, size, fmt, arg ); + if (needed == -1 || needed >= size) + { + HeapFree( GetProcessHeap(), 0, ret ); + size = max( needed + 1, size * 2 ); + } + else + { + *result = ret; + break; + } + } + + while (*format && *format != '!') format++; + if (*format == '!') format++; + + HeapFree( GetProcessHeap(), 0, wstring ); + return format; +} + + /*********************************************************************** * FormatMessageA (KERNEL32.@) * FIXME: missing wrap, @@ -439,18 +559,17 @@ DWORD WINAPI FormatMessageW( DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, - __ms_va_list* _args ) + __ms_va_list* args ) { - LPDWORD args=(LPDWORD)_args; #if defined(__i386__) || defined(__sparc__) /* This implementation is completely dependent on the format of the va_list on x86 CPUs */ LPWSTR target,t; DWORD talloced; - LPWSTR from,f; + LPWSTR from; + LPCWSTR f; DWORD width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK; BOOL eos = FALSE; WCHAR ch; - static const WCHAR fmt_wc[] = {'%','w','c',0}; TRACE("(0x%x,%p,%d,0x%x,%p,%d,%p)\n", dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args); @@ -508,10 +627,8 @@ DWORD WINAPI FormatMessageW( while (*f && !eos) { if (*f=='%') { int insertnr; - WCHAR *fmtstr,*sprintfbuf,*x; - DWORD *argliststart; + WCHAR *str,*x; - fmtstr = NULL; f++; if (!*f) { ADD_TO_T('%'); @@ -534,58 +651,9 @@ DWORD WINAPI FormatMessageW( f++; break; } - if (*f=='!') { - f++; - if (NULL!=(x=strchrW(f,'!'))) { - *x='\0'; - fmtstr=HeapAlloc( GetProcessHeap(), 0,(strlenW(f)+2)*sizeof(WCHAR)); - sprintfW(fmtstr,PCNTFMTWSTR,f); - f=x+1; - } else { - fmtstr=HeapAlloc(GetProcessHeap(),0,(strlenW(f)+2)*sizeof(WCHAR)); - sprintfW(fmtstr,PCNTFMTWSTR,f); - f+=strlenW(f); /*at \0*/ - } - } else { - if(!args) break; - fmtstr = HeapAlloc( GetProcessHeap(),0,3*sizeof(WCHAR)); - strcpyW( fmtstr, FMTWSTR ); - } - if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) - argliststart=args+insertnr-1; - else - argliststart=(*(DWORD**)args)+insertnr-1; - - if (fmtstr[strlenW(fmtstr)-1]=='s' && argliststart[0]) { - DWORD xarr[3]; - WCHAR *fmt_end = fmtstr + strlenW(fmtstr) - 1; - - /* remap %ws to %ls */ - if (fmt_end > fmtstr && (fmt_end[-1] == 'w')) fmt_end[-1] = 'l'; - xarr[0]=*(argliststart+0); - /* possible invalid pointers */ - xarr[1]=*(argliststart+1); - xarr[2]=*(argliststart+2); - sprintfbuf = HeapAlloc(GetProcessHeap(), 0, 1000); - /* CMF - This makes a BIG assumption about va_list */ - vsnprintfW(sprintfbuf, 1000, fmtstr, (va_list) xarr); - } - else if (strcmpW(fmtstr, fmt_wc) == 0) { - sprintfbuf = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * 2); - sprintfbuf[0] = *(WCHAR *)argliststart; - sprintfbuf[1] = 0; - } else { - sprintfbuf=HeapAlloc(GetProcessHeap(),0,100); - - /* CMF - This makes a BIG assumption about va_list */ - vsprintfW(sprintfbuf, fmtstr, (va_list) argliststart); - } - x=sprintfbuf; - while (*x) { - ADD_TO_T(*x++); - } - HeapFree(GetProcessHeap(),0,sprintfbuf); - HeapFree(GetProcessHeap(),0,fmtstr); + f = format_insertW( insertnr, f, dwFlags, args, &str ); + for (x = str; *x; x++) ADD_TO_T(*x); + HeapFree( GetProcessHeap(), 0, str ); break; case 'n': ADD_TO_T('\r');
1
0
0
0
Alexandre Julliard : kernel32: Reimplement the formatting of inserts in FormatMessageA.
by Alexandre Julliard
30 Oct '09
30 Oct '09
Module: wine Branch: master Commit: 3307563a6c2cf026fbfeadea6b2c821e8acbe99b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3307563a6c2cf026fbfeadea6…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Oct 29 17:23:00 2009 +0100 kernel32: Reimplement the formatting of inserts in FormatMessageA. --- dlls/kernel32/format_msg.c | 205 ++++++++++++++++++++++++++++++-------------- 1 files changed, 139 insertions(+), 66 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index 7145479..dd10efa 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -2,6 +2,7 @@ * FormatMessage implementation * * Copyright 1996 Marcus Meissner + * Copyright 2009 Alexandre Julliard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -124,6 +125,137 @@ static LPSTR load_messageA( HMODULE module, UINT id, WORD lang ) } +/********************************************************************** + * get_arg (internal) + */ +static ULONG_PTR get_arg( int nr, DWORD flags, __ms_va_list *args ) +{ + if (flags & FORMAT_MESSAGE_ARGUMENT_ARRAY) return ((ULONG_PTR *)args)[nr - 1]; + return (*(ULONG_PTR **)args)[nr - 1]; /* FIXME */ +} + + +/********************************************************************** + * format_insertA (internal) + */ +static LPCSTR format_insertA( int insert, LPCSTR format, DWORD flags, __ms_va_list *args, LPSTR *result ) +{ + char *astring = NULL, *p, fmt[256]; + ULONG_PTR arg; + int size; + + if (*format != '!') /* simple string */ + { + char *str = (char *)get_arg( insert, flags, args ); + *result = HeapAlloc( GetProcessHeap(), 0, strlen(str) + 1 ); + strcpy( *result, str ); + return format; + } + + format++; + p = fmt; + *p++ = '%'; + + while (*format == '0' || + *format == '+' || + *format == '-' || + *format == ' ' || + *format == '*' || + *format == '#') + { + if (*format == '*') + { + p += sprintf( p, "%lu", get_arg( insert, flags, args )); + insert++; + format++; + } + else *p++ = *format++; + } + while (isdigit(*format)) *p++ = *format++; + + if (*format == '.') + { + *p++ = *format++; + if (*format == '*') + { + p += sprintf( p, "%lu", get_arg( insert, flags, args )); + insert++; + format++; + } + else + while (isdigit(*format)) *p++ = *format++; + } + + arg = get_arg( insert, flags, args ); + + /* check for wide string format */ + if ((format[0] == 'l' && format[1] == 's') || + (format[0] == 'l' && format[1] == 'S') || + (format[0] == 'w' && format[1] == 's') || + (format[0] == 'S')) + { + DWORD len = WideCharToMultiByte( CP_ACP, 0, (WCHAR *)arg, -1, /*FIXME*/ + NULL, 0, NULL, NULL ); + astring = HeapAlloc( GetProcessHeap(), 0, len ); + WideCharToMultiByte( CP_ACP, 0, (WCHAR *)arg, -1, astring, len, NULL, NULL ); + arg = (ULONG_PTR)astring; + *p++ = 's'; + } + /* check for wide character format */ + else if ((format[0] == 'l' && format[1] == 'c') || + (format[0] == 'l' && format[1] == 'C') || + (format[0] == 'w' && format[1] == 'c') || + (format[0] == 'C')) + { + WCHAR ch = arg; + DWORD len = WideCharToMultiByte( CP_ACP, 0, &ch, 1, NULL, 0, NULL, NULL ); + astring = HeapAlloc( GetProcessHeap(), 0, len + 1 ); + WideCharToMultiByte( CP_ACP, 0, &ch, 1, astring, len, NULL, NULL ); + astring[len] = 0; + arg = (ULONG_PTR)astring; + *p++ = 's'; + } + /* check for ascii string format */ + else if ((format[0] == 'h' && format[1] == 's') || + (format[0] == 'h' && format[1] == 'S')) + { + *p++ = 's'; + } + /* check for ascii character format */ + else if ((format[0] == 'h' && format[1] == 'c') || + (format[0] == 'h' && format[1] == 'C')) + { + *p++ = 'c'; + } + /* FIXME: handle I64 etc. */ + else while (*format && *format != '!') *p++ = *format++; + + *p = 0; + size = 256; + for (;;) + { + char *ret = HeapAlloc( GetProcessHeap(), 0, size ); + int needed = snprintf( ret, size, fmt, arg ); + if (needed == -1 || needed >= size) + { + HeapFree( GetProcessHeap(), 0, ret ); + size = max( needed + 1, size * 2 ); + } + else + { + *result = ret; + break; + } + } + + while (*format && *format != '!') format++; + if (*format == '!') format++; + + HeapFree( GetProcessHeap(), 0, astring ); + return format; +} + + /*********************************************************************** * FormatMessageA (KERNEL32.@) * FIXME: missing wrap, @@ -135,15 +267,15 @@ DWORD WINAPI FormatMessageA( DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, - __ms_va_list* _args ) + __ms_va_list* args ) { - LPDWORD args=(LPDWORD)_args; DWORD ret = 0; #if defined(__i386__) || defined(__sparc__) /* This implementation is completely dependent on the format of the va_list on x86 CPUs */ LPSTR target,t; DWORD talloced; - LPSTR from,f; + LPSTR from; + LPCSTR f; DWORD width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK; BOOL eos = FALSE; CHAR ch; @@ -204,11 +336,8 @@ DWORD WINAPI FormatMessageA( while (*f && !eos) { if (*f=='%') { int insertnr; - char *fmtstr,*x,*lastf; - DWORD *argliststart; + char *str,*x; - fmtstr = NULL; - lastf = f; f++; if (!*f) { ADD_TO_T('%'); @@ -230,65 +359,9 @@ DWORD WINAPI FormatMessageA( f++; break; } - if (*f=='!') { - f++; - if (NULL!=(x=strchr(f,'!'))) { - *x='\0'; - fmtstr=HeapAlloc(GetProcessHeap(),0,strlen(f)+2); - sprintf(fmtstr,"%%%s",f); - f=x+1; - } else { - fmtstr=HeapAlloc(GetProcessHeap(),0,strlen(f)+2); - sprintf(fmtstr,"%%%s",f); - f+=strlen(f); /*at \0*/ - } - } else { - if(!args) break; - fmtstr = HeapAlloc(GetProcessHeap(),0,3); - strcpy( fmtstr, "%s" ); - } - if (args) { - int sz; - LPSTR b; - - if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) - argliststart=args+insertnr-1; - else - argliststart=(*(DWORD**)args)+insertnr-1; - - /* FIXME: precision and width components are not handled correctly */ - if (strcmp(fmtstr, "%ls") == 0 || strcmp(fmtstr,"%S") == 0 || strcmp(fmtstr,"%ws") == 0) - { - sz = WideCharToMultiByte(CP_ACP, 0, *(WCHAR**)argliststart, -1, NULL, 0, NULL, NULL); - b = HeapAlloc(GetProcessHeap(), 0, sz); - WideCharToMultiByte(CP_ACP, 0, *(WCHAR**)argliststart, -1, b, sz, NULL, NULL); - } - else if (strcmp(fmtstr, "%wc") == 0) - { - sz = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)argliststart, 1, NULL, 0, NULL, NULL); - b = HeapAlloc(GetProcessHeap(), 0, sz + 1); - WideCharToMultiByte(CP_ACP, 0, (WCHAR *)argliststart, 1, b, sz, NULL, NULL); - b[sz] = 0; - } - else - { - b = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sz = 1000); - /* CMF - This makes a BIG assumption about va_list */ - TRACE("A BIG assumption\n"); - vsnprintf(b, sz, fmtstr, (va_list) argliststart); - } - for (x=b; *x; x++) ADD_TO_T(*x); - - HeapFree(GetProcessHeap(),0,b); - } else { - /* NULL args - copy formatstr - * (probably wrong) - */ - while ((lastf<f)&&(*lastf)) { - ADD_TO_T(*lastf++); - } - } - HeapFree(GetProcessHeap(),0,fmtstr); + f = format_insertA( insertnr, f, dwFlags, args, &str ); + for (x = str; *x; x++) ADD_TO_T(*x); + HeapFree( GetProcessHeap(), 0, str ); break; case 'n': ADD_TO_T('\r');
1
0
0
0
Louis Lenders : kernel32/tests: Add more tests for FormatMessageA.
by Alexandre Julliard
29 Oct '09
29 Oct '09
Module: wine Branch: master Commit: 1be99033b1892aa59589e7997f4c5a0ce77e2b42 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1be99033b1892aa59589e7997…
Author: Louis Lenders <xerox_xerox2000(a)yahoo.co.uk> Date: Thu Oct 29 01:04:16 2009 +0100 kernel32/tests: Add more tests for FormatMessageA. --- dlls/kernel32/tests/format_msg.c | 53 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-) diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index 09a0a4a..2bbcfc8 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -647,9 +647,62 @@ static void test_message_null_buffer(void) ok(error == ERROR_INVALID_PARAMETER, "last error %u\n", error); } +static void test_message_from_hmodule(void) +{ + DWORD ret, error; + HMODULE h; + CHAR out[0x100] = {0}; + + h = GetModuleHandle("kernel32.dll"); + ok(h != 0, "GetModuleHandle failed\n"); + + /*Test existing messageID; as the message strings from wine's kernel32 differ from windows' kernel32 we don't compare + the strings but only test that FormatMessage doesn't return 0*/ + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 7/*=ERROR_ARENA_TRASHED*/, + MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out)/sizeof(CHAR), NULL); + ok(ret != 0, "FormatMessageA returned 0\n"); + + /*Test non existing messageID with varying language ID's Note: FormatMessageW behaves the same*/ + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + todo_wine ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + todo_wine ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + todo_wine ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + todo_wine ok(error == ERROR_MR_MID_NOT_FOUND, "last error %u\n", error); + + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_UK), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + ok(error == ERROR_RESOURCE_LANG_NOT_FOUND, "last error %u\n", error); +} + START_TEST(format_msg) { test_message_from_string(); test_message_from_string_wide(); test_message_null_buffer(); + test_message_from_hmodule(); }
1
0
0
0
Damjan Jovanovic : wia: Add rudimentary wia headers.
by Alexandre Julliard
29 Oct '09
29 Oct '09
Module: wine Branch: master Commit: 290c5de8d97ee7b0dbcc7cefc4380ac4b5a16cf6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=290c5de8d97ee7b0dbcc7cefc…
Author: Damjan Jovanovic <damjan.jov(a)gmail.com> Date: Thu Oct 29 15:15:09 2009 +0200 wia: Add rudimentary wia headers. --- .gitignore | 2 + include/Makefile.in | 3 + include/wia.h | 24 ++++++++++ include/wia_lh.idl | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/wia_xp.idl | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 283 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 2ac3a69..50aa0b3 100644 --- a/.gitignore +++ b/.gitignore @@ -194,6 +194,8 @@ include/urlhist.h include/urlmon.h include/vmr9.h include/wbemcli.h +include/wia_lh.h +include/wia_xp.h include/wincodec.h include/wine/itss.h include/wine/svcctl.h diff --git a/include/Makefile.in b/include/Makefile.in index eb2cabe..83e4358 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -81,6 +81,8 @@ PUBLIC_IDL_H_SRCS = \ urlmon.idl \ vmr9.idl \ wbemcli.idl \ + wia_lh.idl \ + wia_xp.idl \ wincodec.idl \ wine/itss.idl \ wine/svcctl.idl \ @@ -455,6 +457,7 @@ SRCDIR_INCLUDES = \ vfwmsgs.h \ vmrender.idl \ wfext.h \ + wia.h \ winbase.h \ wincon.h \ wincred.h \ diff --git a/include/wia.h b/include/wia.h new file mode 100644 index 0000000..300f28a --- /dev/null +++ b/include/wia.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2009 Damjan Jovanovic + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#if (_WIN32_WINNT >= 0x0600) +#include <wia_lh.h> +#elif (_WIN32_WINNT >= 0x0501) +#include <wia_xp.h> +#endif diff --git a/include/wia_lh.idl b/include/wia_lh.idl new file mode 100644 index 0000000..5024787 --- /dev/null +++ b/include/wia_lh.idl @@ -0,0 +1,127 @@ +/* + * Copyright 2009 Damjan Jovanovic + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "wtypes.idl"; +import "objidl.idl"; + +interface IEnumWIA_DEV_INFO; +interface IWiaItem; +interface IWiaEventCallback; + +cpp_quote("DEFINE_GUID(CLSID_WiaDevMgr, 0xa1f4e726,0x8cf1,0x11d1,0xbf,0x92,0x00,0x60,0x08,0x1e,0xd8,0x11);") + +[ + object, + uuid(5eb2502a-8cf1-11d1-bf92-0060081ed811) +] +interface IWiaDevMgr : IUnknown +{ + HRESULT EnumDeviceInfo( + [in] LONG lFlag, + [retval, out] IEnumWIA_DEV_INFO **ppIEnum); + + HRESULT CreateDevice( + [in] BSTR bstrDeviceID, + [out] IWiaItem **ppWiaItemRoot); + + HRESULT SelectDeviceDlg( + [in] HWND hwndParent, + [in] LONG lDeviceType, + [in] LONG lFlags, + [in, out] BSTR *pbstrDeviceID, + [retval, out] IWiaItem **ppItemRoot); + + HRESULT SelectDeviceDlgID( + [in] HWND hwndParent, + [in] LONG lDeviceType, + [in] LONG lFlags, + [retval, out] BSTR *pbstrDeviceID); + + HRESULT GetImageDlg( + [in] HWND hwndParent, + [in] LONG lDeviceType, + [in] LONG lFlags, + [in] LONG lIntent, + [in] IWiaItem *pItemRoot, + [in] BSTR bstrFilename, + [in, out] GUID *pguidFormat); + + HRESULT RegisterEventCallbackProgram( + [in] LONG lFlags, + [in] BSTR bstrDeviceID, + [in] const GUID *pEventGUID, + [in] BSTR bstrCommandline, + [in] BSTR bstrName, + [in] BSTR bstrDescription, + [in] BSTR bstrIcon); + + HRESULT RegisterEventCallbackInterface( + [in] LONG lFlags, + [in] BSTR bstrDeviceID, + [in] const GUID *pEventGUID, + [unique, in] IWiaEventCallback *pIWiaEventCallback, + [out] IUnknown **pEventObject); + + HRESULT RegisterEventCallbackCLSID( + [in] LONG lFlags, + [in] BSTR bstrDeviceID, + [in] const GUID *pEventGUID, + [unique, in] const GUID *pClsID, + [in] BSTR bstrName, + [in] BSTR bstrDescription, + [in] BSTR bstrIcon); + + HRESULT AddDeviceDlg( + [in] HWND hwndParent, + [in] LONG lFlags); +} + +[ + object, + uuid(5e38b83c-8cf1-11d1-bf92-0060081ed811) +] +interface IEnumWIA_DEV_INFO : IUnknown +{ + /* fill in */ +} + +[ + object, + uuid(4db1ad10-3391-11d2-9a33-00c04fa36145) +] +interface IWiaItem : IUnknown +{ + /* FIXME: fill in */ +} + +[ + object, + uuid(ae6287b0-0084-11d2-973b-00a0c9068f2e) +] +interface IWiaEventCallback : IUnknown +{ + HRESULT ImageEventCallback( + [in] const GUID *pEventGUID, + [in] BSTR bstrEventDescription, + [in] BSTR bstrDeviceID, + [in] BSTR bstrDeviceDescription, + [in] DWORD dwDeviceType, + [in] BSTR bstrFullItemName, + [in,out] ULONG *pulEventType, + [in] ULONG ulReserved); +} diff --git a/include/wia_xp.idl b/include/wia_xp.idl new file mode 100644 index 0000000..5024787 --- /dev/null +++ b/include/wia_xp.idl @@ -0,0 +1,127 @@ +/* + * Copyright 2009 Damjan Jovanovic + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "wtypes.idl"; +import "objidl.idl"; + +interface IEnumWIA_DEV_INFO; +interface IWiaItem; +interface IWiaEventCallback; + +cpp_quote("DEFINE_GUID(CLSID_WiaDevMgr, 0xa1f4e726,0x8cf1,0x11d1,0xbf,0x92,0x00,0x60,0x08,0x1e,0xd8,0x11);") + +[ + object, + uuid(5eb2502a-8cf1-11d1-bf92-0060081ed811) +] +interface IWiaDevMgr : IUnknown +{ + HRESULT EnumDeviceInfo( + [in] LONG lFlag, + [retval, out] IEnumWIA_DEV_INFO **ppIEnum); + + HRESULT CreateDevice( + [in] BSTR bstrDeviceID, + [out] IWiaItem **ppWiaItemRoot); + + HRESULT SelectDeviceDlg( + [in] HWND hwndParent, + [in] LONG lDeviceType, + [in] LONG lFlags, + [in, out] BSTR *pbstrDeviceID, + [retval, out] IWiaItem **ppItemRoot); + + HRESULT SelectDeviceDlgID( + [in] HWND hwndParent, + [in] LONG lDeviceType, + [in] LONG lFlags, + [retval, out] BSTR *pbstrDeviceID); + + HRESULT GetImageDlg( + [in] HWND hwndParent, + [in] LONG lDeviceType, + [in] LONG lFlags, + [in] LONG lIntent, + [in] IWiaItem *pItemRoot, + [in] BSTR bstrFilename, + [in, out] GUID *pguidFormat); + + HRESULT RegisterEventCallbackProgram( + [in] LONG lFlags, + [in] BSTR bstrDeviceID, + [in] const GUID *pEventGUID, + [in] BSTR bstrCommandline, + [in] BSTR bstrName, + [in] BSTR bstrDescription, + [in] BSTR bstrIcon); + + HRESULT RegisterEventCallbackInterface( + [in] LONG lFlags, + [in] BSTR bstrDeviceID, + [in] const GUID *pEventGUID, + [unique, in] IWiaEventCallback *pIWiaEventCallback, + [out] IUnknown **pEventObject); + + HRESULT RegisterEventCallbackCLSID( + [in] LONG lFlags, + [in] BSTR bstrDeviceID, + [in] const GUID *pEventGUID, + [unique, in] const GUID *pClsID, + [in] BSTR bstrName, + [in] BSTR bstrDescription, + [in] BSTR bstrIcon); + + HRESULT AddDeviceDlg( + [in] HWND hwndParent, + [in] LONG lFlags); +} + +[ + object, + uuid(5e38b83c-8cf1-11d1-bf92-0060081ed811) +] +interface IEnumWIA_DEV_INFO : IUnknown +{ + /* fill in */ +} + +[ + object, + uuid(4db1ad10-3391-11d2-9a33-00c04fa36145) +] +interface IWiaItem : IUnknown +{ + /* FIXME: fill in */ +} + +[ + object, + uuid(ae6287b0-0084-11d2-973b-00a0c9068f2e) +] +interface IWiaEventCallback : IUnknown +{ + HRESULT ImageEventCallback( + [in] const GUID *pEventGUID, + [in] BSTR bstrEventDescription, + [in] BSTR bstrDeviceID, + [in] BSTR bstrDeviceDescription, + [in] DWORD dwDeviceType, + [in] BSTR bstrFullItemName, + [in,out] ULONG *pulEventType, + [in] ULONG ulReserved); +}
1
0
0
0
Dmitry Timoshkov : msi: Add support for msidbControlAttributesProgress95.
by Alexandre Julliard
29 Oct '09
29 Oct '09
Module: wine Branch: master Commit: 0513f3c4e61f8f4bb74765c533297589f6231c49 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0513f3c4e61f8f4bb74765c53…
Author: Dmitry Timoshkov <dmitry(a)codeweavers.com> Date: Thu Oct 29 20:46:47 2009 +0800 msi: Add support for msidbControlAttributesProgress95. --- dlls/msi/dialog.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index 88cdfa9..59ef8c3 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -685,6 +685,10 @@ static msi_control *msi_dialog_add_control( msi_dialog *dialog, name = MSI_RecordGetString( rec, 2 ); attributes = MSI_RecordGetInteger( rec, 8 ); text = MSI_RecordGetString( rec, 10 ); + + TRACE("%s, %s, %08x, %s, %08x\n", debugstr_w(szCls), debugstr_w(name), + attributes, debugstr_w(text), style); + if( attributes & msidbControlAttributesVisible ) style |= WS_VISIBLE; if( ~attributes & msidbControlAttributesEnabled ) @@ -1575,8 +1579,14 @@ end: static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) { msi_control *control; + DWORD attributes, style; + + style = WS_VISIBLE; + attributes = MSI_RecordGetInteger( rec, 8 ); + if( !(attributes & msidbControlAttributesProgress95) ) + style |= PBS_SMOOTH; - control = msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, WS_VISIBLE ); + control = msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, style ); if( !control ) return ERROR_FUNCTION_FAILED;
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
121
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Results per page:
10
25
50
100
200