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
July
June
May
April
March
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
April 2010
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 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
2 participants
898 discussions
Start a n
N
ew thread
Andrew Nguyen : kernel32: Process CRLF escape sequences in normal insert sequence processing path in FormatMessageA /W.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: 722fd58446b67e57fe1082667c46f008e4edf783 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=722fd58446b67e57fe1082667…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Apr 28 04:20:44 2010 -0500 kernel32: Process CRLF escape sequences in normal insert sequence processing path in FormatMessageA/W. --- dlls/kernel32/format_msg.c | 8 ++++++++ dlls/kernel32/tests/format_msg.c | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index d610573..c93514f 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -360,6 +360,14 @@ static LPWSTR format_message( BOOL unicode_caller, DWORD dwFlags, LPCWSTR fmtstr ADD_TO_T('\n'); f++; break; + case 'r': + ADD_TO_T('\r'); + f++; + break; + case 't': + ADD_TO_T('\t'); + f++; + break; case '0': eos = TRUE; f++; diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index 24dfd3b..397665c 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -84,6 +84,7 @@ static void test_message_from_string_wide(void) static const WCHAR fmt_t0t[] = {'t','e','s','t','%','0','t','e','s','t',0}; static const WCHAR fmt_yah[] = {'y','a','h','%','!','%','0',' ',' ',' ',0}; static const WCHAR fmt_space[] = {'%',' ','%',' ',' ',' ',0}; + static const WCHAR fmt_nrt[] = {'%','n','%','r','%','t',0}; static const WCHAR fmt_hi_lf[] = {'h','i','\n',0}; static const WCHAR fmt_hi_crlf[] = {'h','i','\r','\n',0}; static const WCHAR fmt_cr[] = {'\r',0}; @@ -108,6 +109,7 @@ static void test_message_from_string_wide(void) static const WCHAR s_2dot147[] = {' ','.','.',' ',' ','4','2','7',0}; static const WCHAR s_yah[] = {'y','a','h','!',0}; static const WCHAR s_space[] = {' ',' ',' ',' ',0}; + static const WCHAR s_nrt[] = {'\r','\n','\r','\t',0}; static const WCHAR s_hi_crlf[] = {'h','i','\r','\n',0}; static const WCHAR s_crlf[] = {'\r','\n',0}; static const WCHAR s_crlfcrlf[] = {'\r','\n','\r','\n',0}; @@ -327,6 +329,12 @@ static void test_message_from_string_wide(void) ok(!lstrcmpW(s_space, out), "failed out=%s\n", wine_dbgstr_w(out)); ok(r==4,"failed: r=%d\n", r); + /* %n yields \r\n, %r yields \r, %t yields \t */ + r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_nrt, 0, + 0, out, sizeof(out)/sizeof(WCHAR)); + ok(!lstrcmpW(s_nrt, out), "failed out=%s\n", wine_dbgstr_w(out)); + ok(r==4,"failed: r=%d\n", r); + /* line feed */ r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_hi_lf, 0, 0, out, sizeof(out)/sizeof(WCHAR)); @@ -624,6 +632,12 @@ static void test_message_from_string(void) ok(!strcmp(" ", out),"failed out=[%s]\n",out); ok(r==4,"failed: r=%d\n",r); + /* %n yields \r\n, %r yields \r, %t yields \t */ + r = doit(FORMAT_MESSAGE_FROM_STRING, "%n%r%t", 0, + 0, out, sizeof(out)/sizeof(CHAR)); + ok(!strcmp("\r\n\r\t", out),"failed out=[%s]\n",out); + ok(r==4,"failed: r=%d\n",r); + /* line feed */ r = doit(FORMAT_MESSAGE_FROM_STRING, "hi\n", 0, 0, out, sizeof(out)/sizeof(CHAR));
1
0
0
0
Andrew Nguyen : kernel32: Remove a superfluous function call in the format_insert helper.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: 1d18b890a6f7eefcdc978285e1cc0b57275afb85 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1d18b890a6f7eefcdc978285e…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Apr 28 04:20:41 2010 -0500 kernel32: Remove a superfluous function call in the format_insert helper. --- dlls/kernel32/format_msg.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index a66cb9b..d610573 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -144,7 +144,7 @@ static LPCWSTR format_insert( BOOL unicode_caller, int insert, LPCWSTR format, } else { - char *str = (char *)get_arg( insert, flags, args ); + char *str = (char *)arg; DWORD length = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); *result = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, str, -1, *result, length );
1
0
0
0
Andrew Nguyen : kernel32/tests: Centralize the FormatMessageW skip detection.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: e724f6aa28be9590f61749f017350975253a4790 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e724f6aa28be9590f61749f01…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Apr 28 04:20:39 2010 -0500 kernel32/tests: Centralize the FormatMessageW skip detection. --- dlls/kernel32/tests/format_msg.c | 71 ++++++++----------------------------- 1 files changed, 16 insertions(+), 55 deletions(-) diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index 1bf1188..24dfd3b 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -130,15 +130,6 @@ static void test_message_from_string_wide(void) WCHAR out[0x100] = {0}; DWORD r, error; - SetLastError(0xdeadbeef); - r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL); - error = GetLastError(); - if (!r && error == ERROR_CALL_NOT_IMPLEMENTED) - { - win_skip("FormatMessageW is not implemented\n"); - return; - } - /* the basics */ r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, test, 0, 0, out, sizeof(out)/sizeof(WCHAR), NULL); @@ -802,14 +793,6 @@ static void test_message_ignore_inserts_wide(void) DWORD ret; WCHAR out[256]; - SetLastError(0xdeadbeef); - ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL); - if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - win_skip("FormatMessageW is not implemented\n"); - return; - } - ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, test, 0, 0, out, sizeof(out)/sizeof(WCHAR), NULL); ok(ret == 4, "Expected FormatMessageW to return 4, got %d\n", ret); @@ -902,14 +885,6 @@ static void test_message_insufficient_buffer_wide(void) WCHAR out[5]; SetLastError(0xdeadbeef); - ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL); - if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - win_skip("FormatMessageW is not implemented\n"); - return; - } - - SetLastError(0xdeadbeef); memcpy(out, init_buf, sizeof(init_buf)); ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, test, 0, 0, out, 0, NULL); ok(ret == 0, "Expected FormatMessageA to return 0, got %u\n", ret); @@ -1006,15 +981,6 @@ static void test_message_null_buffer_wide(void) SetLastError(0xdeadbeef); ret = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, 0, 0, NULL, 0, NULL); error = GetLastError(); - if (!ret && error == ERROR_CALL_NOT_IMPLEMENTED) - { - win_skip("FormatMessageW is not implemented\n"); - return; - } - - SetLastError(0xdeadbeef); - ret = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, 0, 0, NULL, 0, NULL); - error = GetLastError(); ok(!ret, "FormatMessageW returned %u\n", ret); ok(error == ERROR_INVALID_PARAMETER, "last error %u\n", error); @@ -1144,14 +1110,6 @@ static void test_message_allocate_buffer_wide(void) DWORD ret; WCHAR *buf; - SetLastError(0xdeadbeef); - ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL); - if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - win_skip("FormatMessageW is not implemented\n"); - return; - } - /* While MSDN suggests that FormatMessageW allocates a buffer whose size is * the larger of the output string and the requested buffer size, the tests * will not try to determine the actual size of the buffer allocated, as @@ -1397,14 +1355,6 @@ static void test_message_invalid_flags_wide(void) WCHAR *ptr; SetLastError(0xdeadbeef); - ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL); - if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) - { - win_skip("FormatMessageW is not implemented\n"); - return; - } - - SetLastError(0xdeadbeef); memcpy(out, init_buf, sizeof(init_buf)); ret = FormatMessageW(0, test, 0, 0, out, sizeof(out)/sizeof(WCHAR), NULL); ok(ret == 0, "Expected FormatMessageW to return 0, got %u\n", ret); @@ -1482,17 +1432,28 @@ static void test_message_invalid_flags_wide(void) START_TEST(format_msg) { + DWORD ret; + test_message_from_string(); - test_message_from_string_wide(); test_message_ignore_inserts(); - test_message_ignore_inserts_wide(); test_message_insufficient_buffer(); - test_message_insufficient_buffer_wide(); test_message_null_buffer(); - test_message_null_buffer_wide(); test_message_allocate_buffer(); - test_message_allocate_buffer_wide(); test_message_from_hmodule(); test_message_invalid_flags(); + + SetLastError(0xdeadbeef); + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL); + if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + win_skip("FormatMessageW is not implemented\n"); + return; + } + + test_message_from_string_wide(); + test_message_ignore_inserts_wide(); + test_message_insufficient_buffer_wide(); + test_message_null_buffer_wide(); + test_message_allocate_buffer_wide(); test_message_invalid_flags_wide(); }
1
0
0
0
Andrew Nguyen : kernel32: Handle some escape sequences with FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageA /W.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: 5505ae978b08ed5facd6bf953c646ab51de6d356 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5505ae978b08ed5facd6bf953…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Apr 28 04:20:35 2010 -0500 kernel32: Handle some escape sequences with FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageA/W. --- dlls/kernel32/format_msg.c | 37 +++++++++++- dlls/kernel32/tests/format_msg.c | 124 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index 185c459..a66cb9b 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -286,8 +286,41 @@ static LPWSTR format_message( BOOL unicode_caller, DWORD dwFlags, LPCWSTR fmtstr f = fmtstr; if (dwFlags & FORMAT_MESSAGE_IGNORE_INSERTS) { - while (*f && !eos) - ADD_TO_T(*f++); + while (*f && !eos) { + if (*f=='%') { + f++; + switch (*f) + { + case '0': + eos = TRUE; + f++; + break; + case 'n': + ADD_TO_T('\r'); + ADD_TO_T('\n'); + f++; + break; + case 'r': + ADD_TO_T('\r'); + f++; + break; + case 't': + ADD_TO_T('\t'); + f++; + break; + case '\0': + SetLastError(ERROR_INVALID_PARAMETER); + HeapFree(GetProcessHeap(), 0, target); + return NULL; + default: + ADD_TO_T('%'); + ADD_TO_T(*f++); + break; + } + } + else + ADD_TO_T(*f++); + } } else { while (*f && !eos) { diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index 9021c09..1bf1188 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -730,6 +730,128 @@ static void test_message_from_string(void) ok(r==2,"failed: r=%d\n",r); } +static void test_message_ignore_inserts(void) +{ + static const char init_buf[] = {'x', 'x', 'x', 'x', 'x'}; + + DWORD ret; + CHAR out[256]; + + ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "test", 0, 0, out, + sizeof(out)/sizeof(CHAR), NULL); + ok(ret == 4, "Expected FormatMessageA to return 4, got %d\n", ret); + ok(!strcmp("test", out), "Expected output string \"test\", got %s\n", out); + + /* The %0 escape sequence is handled. */ + ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "test%0", 0, 0, out, + sizeof(out)/sizeof(CHAR), NULL); + ok(ret == 4, "Expected FormatMessageA to return 4, got %d\n", ret); + ok(!strcmp("test", out), "Expected output string \"test\", got %s\n", out); + + ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "test%0test", 0, 0, out, + sizeof(out)/sizeof(CHAR), NULL); + ok(ret == 4, "Expected FormatMessageA to return 4, got %d\n", ret); + ok(!strcmp("test", out), "Expected output string \"test\", got %s\n", out); + + /* While FormatMessageA returns 0 in this case, no last error code is set. */ + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "%0test", 0, 0, out, + sizeof(out)/sizeof(CHAR), NULL); + ok(ret == 0, "Expected FormatMessageA to return 0, got %d\n", ret); + ok(!memcmp(out, init_buf, sizeof(init_buf)) || + broken(!strcmp("", out)), /* Win9x */ + "Expected the output buffer to be untouched\n"); + ok(GetLastError() == 0xdeadbeef, "Expected GetLastError() to return 0xdeadbeef, got %u\n", GetLastError()); + + /* Insert sequences are ignored. */ + ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "test%1%2!*.*s!%99", 0, 0, out, + sizeof(out)/sizeof(CHAR), NULL); + ok(ret == 17, "Expected FormatMessageA to return 17, got %d\n", ret); + ok(!strcmp("test%1%2!*.*s!%99", out), "Expected output string \"test%%1%%2!*.*s!%%99\", got %s\n", out); + + /* Only the "%n", "%r", and "%t" escape sequences are processed. */ + ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "%%% %.%!", 0, 0, out, + sizeof(out)/sizeof(CHAR), NULL); + ok(ret == 8 || + broken(ret == 7) /* Win9x */, + "Expected FormatMessageA to return 8, got %d\n", ret); + ok(!strcmp("%%% %.%!", out) || + broken(!strcmp("%%% %.!", out)) /* Win9x */, + "Expected output string \"%%%%%% %%.%%!\", got %s\n", out); + + ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, "%n%r%t", 0, 0, out, + sizeof(out)/sizeof(CHAR), NULL); + ok(ret == 4, "Expected FormatMessageA to return 4, got %d\n", ret); + ok(!strcmp("\r\n\r\t", out), "Expected output string \"\\r\\n\\r\\t\", got %s\n", out); +} + +static void test_message_ignore_inserts_wide(void) +{ + static const WCHAR test[] = {'t','e','s','t',0}; + static const WCHAR empty[] = {0}; + static const WCHAR fmt_t0[] = {'t','e','s','t','%','0',0}; + static const WCHAR fmt_t0t[] = {'t','e','s','t','%','0','t','e','s','t',0}; + static const WCHAR fmt_0t[] = {'%','0','t','e','s','t',0}; + static const WCHAR fmt_t12oos99[] = {'t','e','s','t','%','1','%','2','!','*','.','*','s','!','%','9','9',0}; + static const WCHAR fmt_pctspacedot[] = {'%','%','%',' ','%','.','%','!',0}; + static const WCHAR fmt_nrt[] = {'%','n','%','r','%','t',0}; + + static const WCHAR s_nrt[] = {'\r','\n','\r','\t',0}; + + DWORD ret; + WCHAR out[256]; + + SetLastError(0xdeadbeef); + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, 0, NULL, 0, NULL); + if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + win_skip("FormatMessageW is not implemented\n"); + return; + } + + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, test, 0, 0, out, + sizeof(out)/sizeof(WCHAR), NULL); + ok(ret == 4, "Expected FormatMessageW to return 4, got %d\n", ret); + ok(!lstrcmpW(test, out), "Expected output string \"test\", got %s\n", wine_dbgstr_w(out)); + + /* The %0 escape sequence is handled. */ + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, fmt_t0, 0, 0, out, + sizeof(out)/sizeof(WCHAR), NULL); + ok(ret == 4, "Expected FormatMessageW to return 4, got %d\n", ret); + ok(!lstrcmpW(test, out), "Expected output string \"test\", got %s\n", wine_dbgstr_w(out)); + + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, fmt_t0t, 0, 0, out, + sizeof(out)/sizeof(WCHAR), NULL); + ok(ret == 4, "Expected FormatMessageW to return 4, got %d\n", ret); + ok(!lstrcmpW(test, out), "Expected output string \"test\", got %s\n", wine_dbgstr_w(out)); + + /* While FormatMessageA returns 0 in this case, no last error code is set. */ + SetLastError(0xdeadbeef); + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, fmt_0t, 0, 0, out, + sizeof(out)/sizeof(WCHAR), NULL); + ok(ret == 0, "Expected FormatMessageW to return 0, got %d\n", ret); + ok(!lstrcmpW(empty, out), "Expected the output buffer to be the empty string, got %s\n", wine_dbgstr_w(out)); + ok(GetLastError() == 0xdeadbeef, "Expected GetLastError() to return 0xdeadbeef, got %u\n", GetLastError()); + + /* Insert sequences are ignored. */ + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, fmt_t12oos99, 0, 0, out, + sizeof(out)/sizeof(WCHAR), NULL); + ok(ret == 17, "Expected FormatMessageW to return 17, got %d\n", ret); + ok(!lstrcmpW(fmt_t12oos99, out), "Expected output string \"test%%1%%2!*.*s!%%99\", got %s\n", wine_dbgstr_w(out)); + + /* Only the "%n", "%r", and "%t" escape sequences are processed. */ + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, fmt_pctspacedot, 0, 0, out, + sizeof(out)/sizeof(WCHAR), NULL); + ok(ret == 8, "Expected FormatMessageW to return 8, got %d\n", ret); + ok(!lstrcmpW(fmt_pctspacedot, out), "Expected output string \"%%%%%% %%.%%!\", got %s\n", wine_dbgstr_w(out)); + + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_IGNORE_INSERTS, fmt_nrt, 0, 0, out, + sizeof(out)/sizeof(WCHAR), NULL); + ok(ret == 4, "Expected FormatMessageW to return 4, got %d\n", ret); + ok(!lstrcmpW(s_nrt, out), "Expected output string \"\\r\\n\\r\\t\", got %s\n", wine_dbgstr_w(out)); +} + static void test_message_insufficient_buffer(void) { static const char init_buf[] = {'x', 'x', 'x', 'x', 'x'}; @@ -1362,6 +1484,8 @@ START_TEST(format_msg) { test_message_from_string(); test_message_from_string_wide(); + test_message_ignore_inserts(); + test_message_ignore_inserts_wide(); test_message_insufficient_buffer(); test_message_insufficient_buffer_wide(); test_message_null_buffer();
1
0
0
0
Andrew Nguyen : kernel32: Correct output buffer behavior with empty input strings for FormatMessageA /W.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: 2193b9e887b109a7134d3318406be665a45471af URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2193b9e887b109a7134d33184…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Apr 28 04:20:32 2010 -0500 kernel32: Correct output buffer behavior with empty input strings for FormatMessageA/W. --- dlls/kernel32/format_msg.c | 48 +++++++++++++++++-------- dlls/kernel32/tests/format_msg.c | 71 ++++++++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 18 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index feed8a1..185c459 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -446,22 +446,30 @@ DWORD WINAPI FormatMessageA( goto failure; TRACE("-- %s\n", debugstr_w(target)); - destlength = WideCharToMultiByte(CP_ACP, 0, target, -1, NULL, 0, NULL, NULL); - if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) { - LPSTR buf = LocalAlloc(LMEM_ZEROINIT, max(nSize, destlength)); - WideCharToMultiByte(CP_ACP, 0, target, -1, buf, destlength, NULL, NULL); - *((LPSTR*)lpBuffer) = buf; - } else { - if (nSize < destlength) + + /* Only try writing to an output buffer if there are processed characters + * in the temporary output buffer. */ + if (*target) + { + destlength = WideCharToMultiByte(CP_ACP, 0, target, -1, NULL, 0, NULL, NULL); + if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - goto failure; + LPSTR buf = LocalAlloc(LMEM_ZEROINIT, max(nSize, destlength)); + WideCharToMultiByte(CP_ACP, 0, target, -1, buf, destlength, NULL, NULL); + *((LPSTR*)lpBuffer) = buf; } - - WideCharToMultiByte(CP_ACP, 0, target, -1, lpBuffer, destlength, NULL, NULL); + else + { + if (nSize < destlength) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + goto failure; + } + WideCharToMultiByte(CP_ACP, 0, target, -1, lpBuffer, destlength, NULL, NULL); + } + ret = destlength - 1; /* null terminator */ } - ret = destlength - 1; /* null terminator */ failure: HeapFree(GetProcessHeap(),0,target); HeapFree(GetProcessHeap(),0,from); @@ -542,10 +550,18 @@ DWORD WINAPI FormatMessageW( talloced = strlenW(target)+1; TRACE("-- %s\n",debugstr_w(target)); - if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) { - /* nSize is the MINIMUM size */ - *((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT, max(nSize, talloced)*sizeof(WCHAR)); - strcpyW(*(LPWSTR*)lpBuffer, target); + + /* Only allocate a buffer if there are processed characters in the + * temporary output buffer. If a caller supplies the buffer, then + * a null terminator will be written to it. */ + if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) + { + if (*target) + { + /* nSize is the MINIMUM size */ + *((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT, max(nSize, talloced)*sizeof(WCHAR)); + strcpyW(*(LPWSTR*)lpBuffer, target); + } } else { diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index e1f5b3e..9021c09 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -53,6 +53,7 @@ static DWORD __cdecl doitW(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id static void test_message_from_string_wide(void) { static const WCHAR test[] = {'t','e','s','t',0}; + static const WCHAR empty[] = {0}; static const WCHAR te[] = {'t','e',0}; static const WCHAR st[] = {'s','t',0}; static const WCHAR t[] = {'t',0}; @@ -144,6 +145,25 @@ static void test_message_from_string_wide(void) ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out)); ok(r==4, "failed: r=%d\n", r); + /* null string, crashes on Windows */ + if (0) + { + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, NULL, 0, + 0, out, sizeof(out)/sizeof(WCHAR), NULL); + } + + /* empty string */ + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, empty, 0, + 0, out, sizeof(out)/sizeof(WCHAR), NULL); + error = GetLastError(); + ok(!lstrcmpW(empty, out), "failed out=%s\n", wine_dbgstr_w(out)); + ok(r==0, "succeeded: r=%d\n", r); + ok(error==0xdeadbeef, "last error %u\n", error); + /* format placeholder with no specifier */ SetLastError(0xdeadbeef); memcpy(out, init_buf, sizeof(init_buf)); @@ -420,6 +440,27 @@ static void test_message_from_string(void) ok(!strcmp("test", out),"failed out=[%s]\n",out); ok(r==4,"failed: r=%d\n",r); + /* null string, crashes on Windows */ + if (0) + { + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, NULL, 0, + 0, out, sizeof(out)/sizeof(CHAR), NULL); + } + + /* empty string */ + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "", 0, + 0, out, sizeof(out)/sizeof(CHAR), NULL); + ok(!memcmp(out, init_buf, sizeof(init_buf)) || + broken(!strcmp("", out)), /* Win9x */ + "Expected the buffer to be untouched\n"); + ok(r==0, "succeeded: r=%d\n", r); + ok(GetLastError()==0xdeadbeef, + "last error %u\n", GetLastError()); + /* format placeholder with no specifier */ SetLastError(0xdeadbeef); memcpy(out, init_buf, sizeof(init_buf)); @@ -898,6 +939,15 @@ static void test_message_allocate_buffer(void) * in any case be safe for FormatMessageA to allocate in the manner that * MSDN suggests. */ + SetLastError(0xdeadbeef); + buf = (char *)0xdeadbeef; + ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, + "", 0, 0, (char *)&buf, 0, NULL); + ok(ret == 0, "Expected FormatMessageA to return 0, got %u\n", ret); + ok(buf == NULL, "Expected output buffer pointer to be NULL\n"); + ok(GetLastError() == 0xdeadbeef, + "Expected last error to be untouched, got %u\n", GetLastError()); + buf = (char *)0xdeadbeef; ret = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, "test", 0, 0, (char *)&buf, 0, NULL); @@ -966,6 +1016,7 @@ static void test_message_allocate_buffer(void) static void test_message_allocate_buffer_wide(void) { + static const WCHAR empty[] = {0}; static const WCHAR test[] = {'t','e','s','t',0}; DWORD ret; @@ -979,13 +1030,29 @@ static void test_message_allocate_buffer_wide(void) return; } - /* While MSDN suggests that FormatMessageA allocates a buffer whose size is + /* While MSDN suggests that FormatMessageW allocates a buffer whose size is * the larger of the output string and the requested buffer size, the tests * will not try to determine the actual size of the buffer allocated, as * the return value of LocalSize cannot be trusted for the purpose, and it should - * in any case be safe for FormatMessageA to allocate in the manner that + * in any case be safe for FormatMessageW to allocate in the manner that * MSDN suggests. */ + if (0) /* crashes on Windows */ + { + buf = (WCHAR *)0xdeadbeef; + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, 0, 0, (WCHAR *)&buf, 0, NULL); + } + + SetLastError(0xdeadbeef); + buf = (WCHAR *)0xdeadbeef; + ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, + empty, 0, 0, (WCHAR *)&buf, 0, NULL); + ok(ret == 0, "Expected FormatMessageW to return 0, got %u\n", ret); + ok(buf == NULL, "Expected output buffer pointer to be NULL\n"); + ok(GetLastError() == 0xdeadbeef, + "Expected last error to be untouched, got %u\n", GetLastError()); + buf = (WCHAR *)0xdeadbeef; ret = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, test, 0, 0, (WCHAR *)&buf, 0, NULL);
1
0
0
0
Andrew Nguyen : kernel32: Improve flag error handling in FormatMessageA/W.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: f50198f6620504e55653a9caaf7773beceb1fc06 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f50198f6620504e55653a9caa…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Apr 28 04:20:25 2010 -0500 kernel32: Improve flag error handling in FormatMessageA/W. --- dlls/kernel32/format_msg.c | 36 +++++--- dlls/kernel32/tests/format_msg.c | 181 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 11 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=f50198f6620504e55653a…
1
0
0
0
Andrew Nguyen : kernel32: Remove leftover preprocessor undef directives in the FormatMessage implementation .
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: 9df55f06a250e1d1413b2e073fb9b346a871d850 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9df55f06a250e1d1413b2e073…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Apr 28 04:20:22 2010 -0500 kernel32: Remove leftover preprocessor undef directives in the FormatMessage implementation. --- dlls/kernel32/format_msg.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index b6ffb7f..78f3cc5 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -461,8 +461,6 @@ failure: TRACE("-- returning %u\n", ret); return ret; } -#undef ADD_TO_T - /*********************************************************************** * FormatMessageW (KERNEL32.@) @@ -553,4 +551,3 @@ failure: TRACE("-- returning %u\n", ret); return ret; } -#undef ADD_TO_T
1
0
0
0
Andrew Nguyen : kernel32: Fail if a format placeholder is present without a format specifier in FormatMessageA /W.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: 3cb43a081b4b062330c82900fbd1dee03b00cba7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3cb43a081b4b062330c82900f…
Author: Andrew Nguyen <anguyen(a)codeweavers.com> Date: Wed Apr 28 04:20:19 2010 -0500 kernel32: Fail if a format placeholder is present without a format specifier in FormatMessageA/W. --- dlls/kernel32/format_msg.c | 9 +++++- dlls/kernel32/tests/format_msg.c | 51 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index 4dbaf36..b6ffb7f 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -297,8 +297,9 @@ static LPWSTR format_message( BOOL unicode_caller, DWORD dwFlags, LPCWSTR fmtstr f++; if (!*f) { - ADD_TO_T('%'); - continue; + SetLastError(ERROR_INVALID_PARAMETER); + HeapFree(GetProcessHeap(), 0, target); + return NULL; } switch (*f) { @@ -433,6 +434,8 @@ DWORD WINAPI FormatMessageA( } target = format_message( FALSE, dwFlags, from, &format_args ); + if (!target) + goto failure; TRACE("-- %s\n", debugstr_w(target)); destlength = WideCharToMultiByte(CP_ACP, 0, target, -1, NULL, 0, NULL, NULL); @@ -522,6 +525,8 @@ DWORD WINAPI FormatMessageW( } target = format_message( TRUE, dwFlags, from, &format_args ); + if (!target) + goto failure; talloced = strlenW(target)+1; TRACE("-- %s\n",debugstr_w(target)); diff --git a/dlls/kernel32/tests/format_msg.c b/dlls/kernel32/tests/format_msg.c index f118831..c842409 100644 --- a/dlls/kernel32/tests/format_msg.c +++ b/dlls/kernel32/tests/format_msg.c @@ -58,6 +58,8 @@ static void test_message_from_string_wide(void) static const WCHAR t[] = {'t',0}; static const WCHAR e[] = {'e',0}; static const WCHAR s[] = {'s',0}; + static const WCHAR fmt_null[] = {'%',0}; + static const WCHAR fmt_tnull[] = {'t','e','s','t','%',0}; static const WCHAR fmt_1[] = {'%','1',0}; static const WCHAR fmt_12[] = {'%','1','%','2',0}; static const WCHAR fmt_123[] = {'%','1','%','3','%','2','%','1',0}; @@ -121,6 +123,9 @@ static void test_message_from_string_wide(void) 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}; + static const WCHAR init_buf[] = {'x', 'x', 'x', 'x', 'x', 'x'}; + static const WCHAR broken_buf[] = {'t','e','s','t','x','x'}; + WCHAR out[0x100] = {0}; DWORD r, error; @@ -139,6 +144,29 @@ static void test_message_from_string_wide(void) ok(!lstrcmpW(test, out), "failed out=%s\n", wine_dbgstr_w(out)); ok(r==4, "failed: r=%d\n", r); + /* format placeholder with no specifier */ + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, fmt_null, 0, + 0, out, sizeof(out)/sizeof(WCHAR), NULL); + error = GetLastError(); + ok(!memcmp(out, init_buf, sizeof(init_buf)), + "Expected the buffer to be unchanged\n"); + ok(r==0, "succeeded: r=%d\n", r); + ok(error==ERROR_INVALID_PARAMETER, "last error %u\n", error); + + /* test string with format placeholder with no specifier */ + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, fmt_tnull, 0, + 0, out, sizeof(out)/sizeof(WCHAR), NULL); + error = GetLastError(); + ok(!memcmp(out, init_buf, sizeof(init_buf)) || + broken(!memcmp(out, broken_buf, sizeof(broken_buf))), /* W2K3+ */ + "Expected the buffer to be unchanged\n"); + ok(r==0, "succeeded: r=%d\n", r); + ok(error==ERROR_INVALID_PARAMETER, "last error %u\n", error); + /* using the format feature */ r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1s, 0, 0, out, sizeof(out)/sizeof(WCHAR), test); @@ -383,6 +411,7 @@ static void test_message_from_string(void) { CHAR out[0x100] = {0}; DWORD r; + static const char init_buf[] = {'x', 'x', 'x', 'x', 'x', 'x'}; static const WCHAR szwTest[] = { 't','e','s','t',0}; /* the basics */ @@ -391,6 +420,28 @@ static void test_message_from_string(void) ok(!strcmp("test", out),"failed out=[%s]\n",out); ok(r==4,"failed: r=%d\n",r); + /* format placeholder with no specifier */ + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "%", 0, + 0, out, sizeof(out)/sizeof(CHAR), NULL); + ok(!memcmp(out, init_buf, sizeof(init_buf)), + "Expected the buffer to be untouched\n"); + ok(r==0, "succeeded: r=%d\n", r); + ok(GetLastError()==ERROR_INVALID_PARAMETER, + "last error %u\n", GetLastError()); + + /* test string with format placeholder with no specifier */ + SetLastError(0xdeadbeef); + memcpy(out, init_buf, sizeof(init_buf)); + r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "test%", 0, + 0, out, sizeof(out)/sizeof(CHAR), NULL); + ok(!memcmp(out, init_buf, sizeof(init_buf)), + "Expected the buffer to be untouched\n"); + ok(r==0, "succeeded: r=%d\n", r); + ok(GetLastError()==ERROR_INVALID_PARAMETER, + "last error %u\n", GetLastError()); + /* using the format feature */ r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!s!", 0, 0, out, sizeof(out)/sizeof(CHAR), "test");
1
0
0
0
Michael Stefaniuc : wineconsole: Switch the rest to use the explicit W-forms.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: b3350899f20cfc341a6d2cf9e4f1c1cc53e34e10 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b3350899f20cfc341a6d2cf9e…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Apr 28 01:10:42 2010 +0200 wineconsole: Switch the rest to use the explicit W-forms. And compile with -DWINE_NO_UNICODE_MACROS. --- programs/wineconsole/Makefile.in | 2 +- programs/wineconsole/curses.c | 2 +- programs/wineconsole/winecon_user.h | 14 +++++++------- programs/wineconsole/wineconsole.c | 12 ++++++------ 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/programs/wineconsole/Makefile.in b/programs/wineconsole/Makefile.in index f35767c..1763b18 100644 --- a/programs/wineconsole/Makefile.in +++ b/programs/wineconsole/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DUNICODE +EXTRADEFS = -DWINE_NO_UNICODE_MACROS TOPSRCDIR = @top_srcdir@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ diff --git a/programs/wineconsole/curses.c b/programs/wineconsole/curses.c index 549efb4..773f985 100644 --- a/programs/wineconsole/curses.c +++ b/programs/wineconsole/curses.c @@ -882,7 +882,7 @@ static DWORD CALLBACK input_thread( void *arg ) else numEvent = WCCURSES_FillSimpleChar(ir, inchar); - if (numEvent) WriteConsoleInput(data->hConIn, ir, numEvent, &n); + if (numEvent) WriteConsoleInputW(data->hConIn, ir, numEvent, &n); } close( PRIVATE(data)->sync_pipe[0] ); return 0; diff --git a/programs/wineconsole/winecon_user.h b/programs/wineconsole/winecon_user.h index 51db26c..73a7701 100644 --- a/programs/wineconsole/winecon_user.h +++ b/programs/wineconsole/winecon_user.h @@ -45,13 +45,13 @@ struct inner_data_user { /* from user.c */ extern const COLORREF WCUSER_ColorMap[16]; extern BOOL WCUSER_GetProperties(struct inner_data*, BOOL); -extern BOOL WCUSER_ValidateFont(const struct inner_data* data, const LOGFONT* lf); +extern BOOL WCUSER_ValidateFont(const struct inner_data* data, const LOGFONTW* lf); extern BOOL WCUSER_ValidateFontMetric(const struct inner_data* data, - const TEXTMETRIC* tm, DWORD fontType); -extern HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, const LOGFONT* lf, - LONG* el); -extern void WCUSER_FillLogFont(LOGFONT* lf, const WCHAR* name, + const TEXTMETRICW* tm, DWORD fontType); +extern HFONT WCUSER_CopyFont(struct config_data* config, HWND hWnd, + const LOGFONTW* lf, LONG* el); +extern void WCUSER_FillLogFont(LOGFONTW* lf, const WCHAR* name, UINT height, UINT weight); -extern void WCUSER_DumpLogFont(const char* pfx, const LOGFONT* lf, DWORD ft); -extern void WCUSER_DumpTextMetric(const TEXTMETRIC* tm, DWORD ft); +extern void WCUSER_DumpLogFont(const char* pfx, const LOGFONTW* lf, DWORD ft); +extern void WCUSER_DumpTextMetric(const TEXTMETRICW* tm, DWORD ft); diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c index 0e57176..5acb9ad 100644 --- a/programs/wineconsole/wineconsole.c +++ b/programs/wineconsole/wineconsole.c @@ -45,7 +45,7 @@ static void printf_res(UINT uResId, ...) va_list args; va_start(args, uResId); - LoadStringW(GetModuleHandle(NULL), uResId, buffer, sizeof(buffer)/sizeof(WCHAR)); + LoadStringW(GetModuleHandleW(NULL), uResId, buffer, sizeof(buffer)/sizeof(buffer[0])); WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, ansi, sizeof(ansi), NULL, NULL); vprintf(ansi, args); va_end(args); @@ -561,7 +561,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data)); if (!data) return 0; - GetStartupInfo(&si); + GetStartupInfoW(&si); if (pid == 0) { @@ -672,9 +672,9 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna */ static BOOL WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine) { - PROCESS_INFORMATION info; - STARTUPINFO startup; - BOOL done; + PROCESS_INFORMATION info; + STARTUPINFOW startup; + BOOL done; /* we're in the case wineconsole <exe> <options>... spawn the new process */ memset(&startup, 0, sizeof(startup)); @@ -696,7 +696,7 @@ static BOOL WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine) return FALSE; } - done = CreateProcess(NULL, cmdLine, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info); + done = CreateProcessW(NULL, cmdLine, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info); /* we no longer need the handles passed to the child for the console */ CloseHandle(startup.hStdInput);
1
0
0
0
Michael Stefaniuc : wineconsole: Use the explicit W types/ functions in dialog.c.
by Alexandre Julliard
28 Apr '10
28 Apr '10
Module: wine Branch: master Commit: fe0c5cb68a7bc0d55a83f5adffb9035cd6b4d49d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fe0c5cb68a7bc0d55a83f5adf…
Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Apr 28 01:08:48 2010 +0200 wineconsole: Use the explicit W types/functions in dialog.c. --- programs/wineconsole/dialog.c | 255 ++++++++++++++++++++--------------------- 1 files changed, 126 insertions(+), 129 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=fe0c5cb68a7bc0d55a83f…
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
90
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
Results per page:
10
25
50
100
200