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
May 2016
----- 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
4 participants
542 discussions
Start a n
N
ew thread
Nikolay Sivov : comctl32/tooltips: Cut tooltip text at first tab char unless TTS_NOPREFIX is used.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: 75059e9ee10dd2505de79849b05d3897c8d88073 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=75059e9ee10dd2505de79849b…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon May 2 20:36:51 2016 +0300 comctl32/tooltips: Cut tooltip text at first tab char unless TTS_NOPREFIX is used. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/comctl32/tests/tooltips.c | 175 +++++++++++++++++++++++------------------ dlls/comctl32/tooltips.c | 6 ++ 2 files changed, 105 insertions(+), 76 deletions(-) diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c index 3382fce..e94b2fd 100644 --- a/dlls/comctl32/tests/tooltips.c +++ b/dlls/comctl32/tests/tooltips.c @@ -288,13 +288,15 @@ static HWND create_parent_window(void) static void test_gettext(void) { + static const CHAR testtip2A[] = "testtip\ttest2"; + static const CHAR testtipA[] = "testtip"; HWND hwnd, notify; TTTOOLINFOA toolinfoA; TTTOOLINFOW toolinfoW; LRESULT r; CHAR bufA[10] = ""; WCHAR bufW[10] = { 0 }; - static const CHAR testtipA[] = "testtip"; + DWORD length, style; notify = create_parent_window(); ok(notify != NULL, "Expected notification window to be created\n"); @@ -316,49 +318,48 @@ static void test_gettext(void) toolinfoA.lParam = 0xdeadbeef; GetClientRect(hwnd, &toolinfoA.rect); r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); - if (r) - { - toolinfoA.hwnd = NULL; - toolinfoA.uId = 0x1234ABCD; - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, "") == 0, "lpszText should be an empty string\n"); + ok(r, "got %ld\n", r); - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); - ok(toolinfoA.lpszText == NULL, - "expected NULL, got %p\n", toolinfoA.lpszText); + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1234abcd; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!*toolinfoA.lpszText, "lpszText should be empty, got %s\n", toolinfoA.lpszText); - /* NULL hinst, valid resource id for text */ - toolinfoA.cbSize = sizeof(TTTOOLINFOA); - toolinfoA.hwnd = NULL; - toolinfoA.hinst = NULL; - toolinfoA.uFlags = 0; - toolinfoA.uId = 0x1233ABCD; - toolinfoA.lpszText = MAKEINTRESOURCEA(IDS_TBADD1); - toolinfoA.lParam = 0xdeadbeef; - GetClientRect(hwnd, &toolinfoA.rect); - r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); - ok(r, "failed to add a tool\n"); + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); +todo_wine + ok(!r, "got %ld\n", r); + ok(toolinfoA.lpszText == NULL, "expected NULL, got %p\n", toolinfoA.lpszText); - toolinfoA.hwnd = NULL; - toolinfoA.uId = 0x1233ABCD; - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, "abc") == 0, "lpszText should be an empty string\n"); + /* NULL hinst, valid resource id for text */ + toolinfoA.cbSize = sizeof(TTTOOLINFOA); + toolinfoA.hwnd = NULL; + toolinfoA.hinst = NULL; + toolinfoA.uFlags = 0; + toolinfoA.uId = 0x1233abcd; + toolinfoA.lpszText = MAKEINTRESOURCEA(IDS_TBADD1); + toolinfoA.lParam = 0xdeadbeef; + GetClientRect(hwnd, &toolinfoA.rect); + r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); + ok(r, "failed to add a tool\n"); - toolinfoA.hinst = (HINSTANCE)0xdeadbee; - SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); - ok(toolinfoA.hinst == NULL, "expected NULL, got %p\n", toolinfoA.hinst); + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1233abcd; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, "abc"), "got wrong text, %s\n", toolinfoA.lpszText); - SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&toolinfoA); - } - else - { - win_skip( "Old comctl32, not testing NULL text\n" ); - DestroyWindow( hwnd ); - return; - } + toolinfoA.hinst = (HINSTANCE)0xdeadbee; + r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); +todo_wine + ok(!r, "got %ld\n", r); + ok(toolinfoA.hinst == NULL, "expected NULL, got %p\n", toolinfoA.hinst); + + r = SendMessageA(hwnd, TTM_DELTOOLA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); /* add another tool with text */ toolinfoA.cbSize = sizeof(TTTOOLINFOA); @@ -372,28 +373,26 @@ static void test_gettext(void) GetClientRect(hwnd, &toolinfoA.rect); r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); ok(r, "Adding the tool to the tooltip failed\n"); - if (r) - { - DWORD length; - length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0); - ok(length == 0, "Expected 0, got %d\n", length); + length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0); + ok(length == 0, "Expected 0, got %d\n", length); - toolinfoA.hwnd = NULL; - toolinfoA.uId = 0x1235ABCD; - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, testtipA) == 0, "lpszText should be an empty string\n"); + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1235abcd; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %p\n", testtipA, toolinfoA.lpszText); - memset(bufA, 0x1f, sizeof(bufA)); - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, testtipA) == 0, - "expected %s, got %p\n", testtipA, toolinfoA.lpszText); + memset(bufA, 0x1f, sizeof(bufA)); + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); +todo_wine + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %p\n", testtipA, toolinfoA.lpszText); - length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0); - ok(length == 0, "Expected 0, got %d\n", length); - } + length = SendMessageA(hwnd, WM_GETTEXTLENGTH, 0, 0); + ok(length == 0, "Expected 0, got %d\n", length); /* add another with callback text */ toolinfoA.cbSize = sizeof(TTTOOLINFOA); @@ -406,33 +405,26 @@ static void test_gettext(void) GetClientRect(hwnd, &toolinfoA.rect); r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); ok(r, "Adding the tool to the tooltip failed\n"); - if (r) - { - toolinfoA.hwnd = notify; - toolinfoA.uId = 0x1236ABCD; - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); - ok(strcmp(toolinfoA.lpszText, testcallbackA) == 0, - "lpszText should be an (%s) string\n", testcallbackA); - toolinfoA.lpszText = bufA; - SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); - ok(toolinfoA.lpszText == LPSTR_TEXTCALLBACKA, - "expected LPSTR_TEXTCALLBACKA, got %p\n", toolinfoA.lpszText); - } + toolinfoA.hwnd = notify; + toolinfoA.uId = 0x1236abcd; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testcallbackA), "lpszText should be an (%s) string\n", testcallbackA); + + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); +todo_wine + ok(!r, "got %ld\n", r); + ok(toolinfoA.lpszText == LPSTR_TEXTCALLBACKA, "expected LPSTR_TEXTCALLBACKA, got %p\n", toolinfoA.lpszText); DestroyWindow(hwnd); DestroyWindow(notify); - SetLastError(0xdeadbeef); hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, 0, 10, 10, 300, 100, NULL, NULL, NULL, 0); - - if (!hwnd && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { - win_skip("CreateWindowExW is not implemented\n"); - return; - } ok(hwnd != NULL, "failed to create tooltip wnd\n"); toolinfoW.cbSize = sizeof(TTTOOLINFOW); @@ -455,6 +447,37 @@ static void test_gettext(void) ok(toolinfoW.lpszText[0] == 0, "lpszText should be an empty string\n"); } + /* text with embedded tabs */ + toolinfoA.cbSize = sizeof(TTTOOLINFOA); + toolinfoA.hwnd = NULL; + toolinfoA.hinst = GetModuleHandleA(NULL); + toolinfoA.uFlags = 0; + toolinfoA.uId = 0x1235abce; + strcpy(bufA, testtip2A); + toolinfoA.lpszText = bufA; + toolinfoA.lParam = 0xdeadbeef; + GetClientRect(hwnd, &toolinfoA.rect); + r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA); + ok(r, "got %ld\n", r); + + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1235abce; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testtipA), "expected %s, got %s\n", testtipA, toolinfoA.lpszText); + + /* enable TTS_NOPREFIX, original text is retained */ + style = GetWindowLongA(hwnd, GWL_STYLE); + SetWindowLongA(hwnd, GWL_STYLE, style | TTS_NOPREFIX); + + toolinfoA.hwnd = NULL; + toolinfoA.uId = 0x1235abce; + toolinfoA.lpszText = bufA; + r = SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); + ok(!r, "got %ld\n", r); + ok(!strcmp(toolinfoA.lpszText, testtip2A), "expected %s, got %s\n", testtipA, toolinfoA.lpszText); + DestroyWindow(hwnd); } diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 8bf6919..eed113e 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -509,6 +509,12 @@ TOOLTIPS_GetTipText (const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer) buffer[0] = '\0'; } + if (!(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & TTS_NOPREFIX)) { + WCHAR *ptrW; + if ((ptrW = strchrW(buffer, '\t'))) + *ptrW = 0; + } + TRACE("%s\n", debugstr_w(buffer)); }
1
0
0
0
Hugh McMaster : kernel32/tests: Add tests for SetConsoleFont.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: 9c01d10bc6ee75620debe9ecabcad5e14e230e0f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9c01d10bc6ee75620debe9eca…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Tue May 3 02:07:01 2016 +0200 kernel32/tests: Add tests for SetConsoleFont. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 3f72573..5b66d9f 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -2897,6 +2897,47 @@ static void test_GetConsoleFontInfo(HANDLE std_output) SetConsoleScreenBufferSize(std_output, orig_sb_size); } +static void test_SetConsoleFont(HANDLE std_output) +{ + HANDLE hmod; + BOOL (WINAPI *pSetConsoleFont)(HANDLE, DWORD); + BOOL ret; + DWORD (WINAPI *pGetNumberOfConsoleFonts)(void); + DWORD num_fonts; + + hmod = GetModuleHandleA("kernel32.dll"); + pSetConsoleFont = (void *)GetProcAddress(hmod, "SetConsoleFont"); + if (!pSetConsoleFont) + { + win_skip("SetConsoleFont is not available\n"); + return; + } + + SetLastError(0xdeadbeef); + ret = pSetConsoleFont(NULL, 0); + ok(!ret, "got %d, expected zero\n", ret); + todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = pSetConsoleFont(GetStdHandle(STD_INPUT_HANDLE), 0); + ok(!ret, "got %d, expected zero\n", ret); + todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError()); + + pGetNumberOfConsoleFonts = (void *)GetProcAddress(hmod, "GetNumberOfConsoleFonts"); + if (!pGetNumberOfConsoleFonts) + { + win_skip("GetNumberOfConsoleFonts is not available\n"); + return; + } + + num_fonts = pGetNumberOfConsoleFonts(); + + SetLastError(0xdeadbeef); + ret = pSetConsoleFont(std_output, num_fonts); + ok(!ret, "got %d, expected zero\n", ret); + todo_wine ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %u, expected 87\n", GetLastError()); +} + START_TEST(console) { static const char font_name[] = "Lucida Console"; @@ -3044,4 +3085,5 @@ START_TEST(console) test_GetConsoleFontSize(hConOut); test_GetLargestConsoleWindowSize(hConOut); test_GetConsoleFontInfo(hConOut); + test_SetConsoleFont(hConOut); }
1
0
0
0
Hugh McMaster : kernel32/tests: Add more tests for GetConsoleFontInfo.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: 46cc1388cfa78c41ea73cfee61ba00ab04cdd19e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=46cc1388cfa78c41ea73cfee6…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Tue May 3 02:06:50 2016 +0200 kernel32/tests: Add more tests for GetConsoleFontInfo. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/console.c | 59 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 3f627be..3f72573 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -2789,7 +2789,7 @@ static void test_GetConsoleFontInfo(HANDLE std_output) CONSOLE_FONT_INFO *cfi; BOOL ret; CONSOLE_SCREEN_BUFFER_INFO csbi; - COORD orig_font, tmp_font; + COORD orig_sb_size, tmp_sb_size, orig_font, tmp_font; hmod = GetModuleHandleA("kernel32.dll"); pGetConsoleFontInfo = (void *)GetProcAddress(hmod, "GetConsoleFontInfo"); @@ -2811,6 +2811,12 @@ static void test_GetConsoleFontInfo(HANDLE std_output) cfi = HeapAlloc(GetProcessHeap(), 0, memsize); memset(cfi, 0, memsize); + GetConsoleScreenBufferInfo(std_output, &csbi); + orig_sb_size = csbi.dwSize; + tmp_sb_size.X = csbi.dwSize.X + 3; + tmp_sb_size.Y = csbi.dwSize.Y + 5; + SetConsoleScreenBufferSize(std_output, tmp_sb_size); + SetLastError(0xdeadbeef); ret = pGetConsoleFontInfo(NULL, FALSE, 0, cfi); ok(!ret, "got %d, expected zero\n", ret); @@ -2834,22 +2840,61 @@ static void test_GetConsoleFontInfo(HANDLE std_output) index = cfi[0].nFont; orig_font = GetConsoleFontSize(std_output, index); - SetLastError(0xdeadbeef); + memset(cfi, 0, memsize); ret = pGetConsoleFontInfo(std_output, FALSE, num_fonts, cfi); todo_wine ok(ret, "got %d, expected non-zero\n", ret); - todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); - ok(cfi[index].dwFontSize.X == win_width, "got %d, expected %d\n", cfi[index].dwFontSize.X, win_width); - ok(cfi[index].dwFontSize.Y == win_height, "got %d, expected %d\n", cfi[index].dwFontSize.Y, win_height); + todo_wine ok(cfi[index].dwFontSize.X == win_width, "got %d, expected %d\n", + cfi[index].dwFontSize.X, win_width); + todo_wine ok(cfi[index].dwFontSize.Y == win_height, "got %d, expected %d\n", + cfi[index].dwFontSize.Y, win_height); for (i = 0; i < num_fonts; i++) { + ok(cfi[i].nFont == i, "element out of order, got nFont %d, expected %d\n", cfi[i].nFont, i); tmp_font = GetConsoleFontSize(std_output, cfi[i].nFont); tmp_w = (double)orig_font.X / tmp_font.X * win_width; tmp_h = (double)orig_font.Y / tmp_font.Y * win_height; - ok(cfi[i].dwFontSize.X == tmp_w, "got %d, expected %d\n", cfi[i].dwFontSize.X, tmp_w); - ok(cfi[i].dwFontSize.Y == tmp_h, "got %d, expected %d\n", cfi[i].dwFontSize.Y, tmp_h); + todo_wine ok(cfi[i].dwFontSize.X == tmp_w, "got %d, expected %d\n", cfi[i].dwFontSize.X, tmp_w); + todo_wine ok(cfi[i].dwFontSize.Y == tmp_h, "got %d, expected %d\n", cfi[i].dwFontSize.Y, tmp_h); } + + SetLastError(0xdeadbeef); + ret = pGetConsoleFontInfo(NULL, TRUE, 0, cfi); + ok(!ret, "got %d, expected zero\n", ret); + todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = pGetConsoleFontInfo(GetStdHandle(STD_INPUT_HANDLE), TRUE, 0, cfi); + ok(!ret, "got %d, expected zero\n", ret); + todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "got %u, expected 6\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = pGetConsoleFontInfo(std_output, TRUE, 0, cfi); + ok(!ret, "got %d, expected zero\n", ret); + todo_wine ok(GetLastError() == 0xdeadbeef, "got %u, expected 0xdeadbeef\n", GetLastError()); + + memset(cfi, 0, memsize); + ret = pGetConsoleFontInfo(std_output, TRUE, num_fonts, cfi); + todo_wine ok(ret, "got %d, expected non-zero\n", ret); + + todo_wine ok(cfi[index].dwFontSize.X == csbi.dwMaximumWindowSize.X, "got %d, expected %d\n", + cfi[index].dwFontSize.X, csbi.dwMaximumWindowSize.X); + todo_wine ok(cfi[index].dwFontSize.Y == csbi.dwMaximumWindowSize.Y, "got %d, expected %d\n", + cfi[index].dwFontSize.Y, csbi.dwMaximumWindowSize.Y); + + for (i = 0; i < num_fonts; i++) + { + ok(cfi[i].nFont == i, "element out of order, got nFont %d, expected %d\n", cfi[i].nFont, i); + tmp_font = GetConsoleFontSize(std_output, cfi[i].nFont); + tmp_w = (double)orig_font.X / tmp_font.X * csbi.dwMaximumWindowSize.X; + tmp_h = (double)orig_font.Y / tmp_font.Y * csbi.dwMaximumWindowSize.Y; + todo_wine ok(cfi[i].dwFontSize.X == tmp_w, "got %d, expected %d\n", cfi[i].dwFontSize.X, tmp_w); + todo_wine ok(cfi[i].dwFontSize.Y == tmp_h, "got %d, expected %d\n", cfi[i].dwFontSize.Y, tmp_h); + } + + HeapFree(GetProcessHeap(), 0, cfi); + SetConsoleScreenBufferSize(std_output, orig_sb_size); } START_TEST(console)
1
0
0
0
Sebastian Lackner : kernel32: Fix possible leak of directory handle in RemoveDirectoryW.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: d638df9f3e31c08623fa653f837abc754c0d2e44 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d638df9f3e31c08623fa653f8…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Tue May 3 03:22:24 2016 +0200 kernel32: Fix possible leak of directory handle in RemoveDirectoryW. Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/path.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index b3fccb2..620401d 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -1655,13 +1655,19 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path ) status = NtOpenFile( &handle, DELETE | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ); - if (status == STATUS_SUCCESS) - status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE ); - RtlFreeUnicodeString( &nt_name ); + if (status != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + RtlFreeUnicodeString( &nt_name ); + return FALSE; + } + status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE ); + RtlFreeUnicodeString( &nt_name ); if (status != STATUS_SUCCESS) { SetLastError( RtlNtStatusToDosError(status) ); + NtClose( handle ); return FALSE; }
1
0
0
0
Daniel Lehman : ntdll: Add trace for NtQueryEvent/Semaphore.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: ad83e2cd5742ca98a55591a3c5c4a5b7cabe5eae URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ad83e2cd5742ca98a55591a3c…
Author: Daniel Lehman <dlehman25(a)gmail.com> Date: Tue May 3 02:55:56 2016 +0200 ntdll: Add trace for NtQueryEvent/Semaphore. Signed-off-by: Daniel Lehman <dlehman25(a)gmail.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/sync.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index e949df6..74f7779 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -235,6 +235,8 @@ NTSTATUS WINAPI NtQuerySemaphore( HANDLE handle, SEMAPHORE_INFORMATION_CLASS cla NTSTATUS ret; SEMAPHORE_BASIC_INFORMATION *out = info; + TRACE("(%p, %u, %p, %u, %p)\n", handle, class, info, len, ret_len); + if (class != SemaphoreBasicInformation) { FIXME("(%p,%d,%u) Unknown class\n", handle, class, len); @@ -417,6 +419,8 @@ NTSTATUS WINAPI NtQueryEvent( HANDLE handle, EVENT_INFORMATION_CLASS class, NTSTATUS ret; EVENT_BASIC_INFORMATION *out = info; + TRACE("(%p, %u, %p, %u, %p)\n", handle, class, info, len, ret_len); + if (class != EventBasicInformation) { FIXME("(%p, %d, %d) Unknown class\n",
1
0
0
0
Daniel Lehman : ntdll: Fix prev_count from NtReleaseMutant.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: 7950562e9e7faf26a13fc542845462094f4fa875 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7950562e9e7faf26a13fc5428…
Author: Daniel Lehman <dlehman25(a)gmail.com> Date: Tue May 3 02:55:43 2016 +0200 ntdll: Fix prev_count from NtReleaseMutant. Signed-off-by: Daniel Lehman <dlehman25(a)gmail.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/sync.c | 2 +- dlls/ntdll/tests/om.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index 46cbca7..e949df6 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -510,7 +510,7 @@ NTSTATUS WINAPI NtReleaseMutant( IN HANDLE handle, OUT PLONG prev_count OPTIONAL { req->handle = wine_server_obj_handle( handle ); status = wine_server_call( req ); - if (prev_count) *prev_count = reply->prev_count; + if (prev_count) *prev_count = 1 - reply->prev_count; } SERVER_END_REQ; return status; diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index 2bc4ccd..64a16ab 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -1942,12 +1942,12 @@ static void test_mutant(void) prev = 0xdeadbeef; status = pNtReleaseMutant(mutant, &prev); ok( status == STATUS_SUCCESS, "NtQueryRelease failed %08x\n", status ); - todo_wine ok( prev == -1, "NtQueryRelease failed, expected -1, got %d\n", prev ); + ok( prev == -1, "NtQueryRelease failed, expected -1, got %d\n", prev ); prev = 0xdeadbeef; status = pNtReleaseMutant(mutant, &prev); ok( status == STATUS_SUCCESS, "NtQueryRelease failed %08x\n", status ); - todo_wine ok( prev == 0, "NtQueryRelease failed, expected 0, got %d\n", prev ); + ok( prev == 0, "NtQueryRelease failed, expected 0, got %d\n", prev ); memset(&info, 0xcc, sizeof(info)); status = pNtQueryMutant(mutant, MutantBasicInformation, &info, sizeof(info), NULL);
1
0
0
0
Daniel Lehman : ntdll: Add NtQueryMutant.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: 142730ea6677cea638aef34d687dd0a30140b5f7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=142730ea6677cea638aef34d6…
Author: Daniel Lehman <dlehman25(a)gmail.com> Date: Tue May 3 02:55:34 2016 +0200 ntdll: Add NtQueryMutant. Signed-off-by: Daniel Lehman <dlehman25(a)gmail.com> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/sync.c | 40 ++++++++++---- dlls/ntdll/tests/om.c | 120 +++++++++++++++++++++++++++++++++++++++++ include/wine/server_protocol.h | 21 +++++++- server/mutex.c | 16 ++++++ server/protocol.def | 10 ++++ server/request.h | 8 +++ server/trace.c | 15 ++++++ 7 files changed, 220 insertions(+), 10 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=142730ea6677cea638aef…
1
0
0
0
Alexandre Julliard : ntdll/tests: Add tests for directory sorting.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: d18c14c311474b163a793aa8938f6424fee244c3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d18c14c311474b163a793aa89…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 3 13:16:16 2016 +0900 ntdll/tests: Add tests for directory sorting. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/directory.c | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index 21767f6..431471a 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -34,6 +34,7 @@ #define WIN32_NO_STATUS #include "wine/test.h" +#include "winnls.h" #include "winternl.h" static NTSTATUS (WINAPI *pNtClose)( PHANDLE ); @@ -46,6 +47,7 @@ static BOOLEAN (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING,LPCS static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)( LPCWSTR, PUNICODE_STRING, PWSTR*, CURDIR* ); static VOID (WINAPI *pRtlInitUnicodeString)( PUNICODE_STRING, LPCWSTR ); static VOID (WINAPI *pRtlFreeUnicodeString)( PUNICODE_STRING ); +static LONG (WINAPI *pRtlCompareUnicodeString)( const UNICODE_STRING*, const UNICODE_STRING*,BOOLEAN ); static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen, LPCSTR src, DWORD srclen ); static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirection)( BOOLEAN enable ); @@ -249,6 +251,84 @@ static void test_flags_NtQueryDirectoryFile(OBJECT_ATTRIBUTES *attr, const char pNtClose(new_dirh); } +static void test_directory_sort( const WCHAR *testdir ) +{ + OBJECT_ATTRIBUTES attr; + UNICODE_STRING ntdirname; + IO_STATUS_BLOCK io; + UINT data_pos, data_len, count; + BYTE data[8192]; + WCHAR prev[MAX_PATH], name[MAX_PATH]; + UNICODE_STRING prev_str, name_str; + FILE_BOTH_DIRECTORY_INFORMATION *info; + NTSTATUS status; + HANDLE handle; + int res; + + if (!pRtlDosPathNameToNtPathName_U( testdir, &ntdirname, NULL, NULL )) + { + ok(0, "RtlDosPathNametoNtPathName_U failed\n"); + return; + } + InitializeObjectAttributes( &attr, &ntdirname, OBJ_CASE_INSENSITIVE, 0, NULL ); + status = pNtOpenFile( &handle, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io, FILE_SHARE_READ, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_FOR_BACKUP_INTENT | FILE_DIRECTORY_FILE ); + ok(status == STATUS_SUCCESS, "failed to open dir %s\n", wine_dbgstr_w(testdir) ); + + U(io).Status = 0xdeadbeef; + status = pNtQueryDirectoryFile( handle, NULL, NULL, NULL, &io, data, sizeof(data), + FileBothDirectoryInformation, FALSE, NULL, TRUE ); + ok( status == STATUS_SUCCESS, "failed to query directory; status %x\n", status ); + ok( U(io).Status == STATUS_SUCCESS, "failed to query directory; status %x\n", U(io).Status ); + data_len = io.Information; + ok( data_len >= sizeof(FILE_BOTH_DIRECTORY_INFORMATION), "not enough data in directory\n" ); + data_pos = 0; + count = 0; + + while (data_pos < data_len) + { + info = (FILE_BOTH_DIRECTORY_INFORMATION *)(data + data_pos); + + memcpy( name, info->FileName, info->FileNameLength ); + name[info->FileNameLength / sizeof(WCHAR)] = 0; + switch (count) + { + case 0: /* first entry must be '.' */ + ok( !lstrcmpW( name, dotW ), "wrong name %s\n", wine_dbgstr_w( name )); + break; + case 1: /* second entry must be '..' */ + ok( !lstrcmpW( name, dotdotW ), "wrong name %s\n", wine_dbgstr_w( name )); + break; + case 2: /* nothing to compare against */ + break; + default: + pRtlInitUnicodeString( &prev_str, prev ); + pRtlInitUnicodeString( &name_str, name ); + res = pRtlCompareUnicodeString( &prev_str, &name_str, TRUE ); + ok( res < 0, "wrong result %d %s %s\n", res, wine_dbgstr_w( prev ), wine_dbgstr_w( name )); + break; + } + count++; + lstrcpyW( prev, name ); + + if (info->NextEntryOffset == 0) + { + U(io).Status = 0xdeadbeef; + status = pNtQueryDirectoryFile( handle, 0, NULL, NULL, &io, data, sizeof(data), + FileBothDirectoryInformation, FALSE, NULL, FALSE ); + ok (U(io).Status == status, "wrong status %x / %x\n", status, U(io).Status); + if (status == STATUS_NO_MORE_FILES) break; + ok( status == STATUS_SUCCESS, "failed to query directory; status %x\n", status ); + data_len = io.Information; + data_pos = 0; + } + else data_pos += info->NextEntryOffset; + } + + pNtClose( handle ); + pRtlFreeUnicodeString( &ntdirname ); +} + static void test_NtQueryDirectoryFile(void) { OBJECT_ATTRIBUTES attr; @@ -526,6 +606,7 @@ static void test_NtQueryDirectoryFile(void) ok(U(io).Status == 0xdeadbeef, "wrong status %x\n", U(io).Status); done: + test_directory_sort( testdirW ); tear_down_attribute_test( testdirW ); pRtlFreeUnicodeString(&ntdirname); } @@ -675,6 +756,7 @@ static void test_redirection(void) START_TEST(directory) { + WCHAR sysdir[MAX_PATH]; HMODULE hntdll = GetModuleHandleA("ntdll.dll"); if (!hntdll) { @@ -691,10 +773,13 @@ START_TEST(directory) pRtlDosPathNameToNtPathName_U = (void *)GetProcAddress(hntdll, "RtlDosPathNameToNtPathName_U"); pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString"); pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString"); + pRtlCompareUnicodeString = (void *)GetProcAddress(hntdll, "RtlCompareUnicodeString"); pRtlMultiByteToUnicodeN = (void *)GetProcAddress(hntdll,"RtlMultiByteToUnicodeN"); pRtlWow64EnableFsRedirection = (void *)GetProcAddress(hntdll,"RtlWow64EnableFsRedirection"); pRtlWow64EnableFsRedirectionEx = (void *)GetProcAddress(hntdll,"RtlWow64EnableFsRedirectionEx"); + GetSystemDirectoryW( sysdir, MAX_PATH ); + test_directory_sort( sysdir ); test_NtQueryDirectoryFile(); test_NtQueryDirectoryFile_case(); test_redirection();
1
0
0
0
Alexandre Julliard : ntdll: Cache the entire directory contents and sort the names before returning files.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: 12fc123338f7af601d3fe76b168a644fcd7e1362 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=12fc123338f7af601d3fe76b1…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 3 13:15:40 2016 +0900 ntdll: Cache the entire directory contents and sort the names before returning files. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/directory.c | 1048 ++++++++++++++---------------------------- dlls/ntdll/tests/directory.c | 38 +- 2 files changed, 366 insertions(+), 720 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=12fc123338f7af601d3fe…
1
0
0
0
Alexandre Julliard : ntdll: Implement RtlCompareUnicodeStrings.
by Alexandre Julliard
03 May '16
03 May '16
Module: wine Branch: master Commit: 500604054138722f9332065d08cc98d5ad766bca URL:
http://source.winehq.org/git/wine.git/?a=commit;h=500604054138722f9332065d0…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 3 13:21:38 2016 +0900 ntdll: Implement RtlCompareUnicodeStrings. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/ntdll.spec | 3 ++- dlls/ntdll/rtlstr.c | 32 +++++++++++++++++++------------- dlls/ntdll/tests/rtlstr.c | 36 +++++++++++++++++++++++++++++++++++- include/winternl.h | 1 + 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 01c84c6..a7256c4 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -464,7 +464,8 @@ @ stdcall RtlCompareMemory(ptr ptr long) @ stdcall RtlCompareMemoryUlong(ptr long long) @ stdcall RtlCompareString(ptr ptr long) -@ stdcall RtlCompareUnicodeString (ptr ptr long) +@ stdcall RtlCompareUnicodeString(ptr ptr long) +@ stdcall RtlCompareUnicodeStrings(ptr long ptr long long) @ stdcall RtlCompressBuffer(long ptr long ptr long long ptr ptr) @ stdcall RtlComputeCrc32(long ptr long) # @ stub RtlComputeImportTableHash diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c index 01b4446..3013658 100644 --- a/dlls/ntdll/rtlstr.c +++ b/dlls/ntdll/rtlstr.c @@ -452,32 +452,38 @@ LONG WINAPI RtlCompareString( const STRING *s1, const STRING *s2, BOOLEAN CaseIn /****************************************************************************** - * RtlCompareUnicodeString (NTDLL.@) + * RtlCompareUnicodeStrings (NTDLL.@) */ -LONG WINAPI RtlCompareUnicodeString( const UNICODE_STRING *s1, const UNICODE_STRING *s2, - BOOLEAN CaseInsensitive ) +LONG WINAPI RtlCompareUnicodeStrings( const WCHAR *s1, SIZE_T len1, const WCHAR *s2, SIZE_T len2, + BOOLEAN case_insensitive ) { - unsigned int len; LONG ret = 0; - LPCWSTR p1, p2; - - len = min(s1->Length, s2->Length) / sizeof(WCHAR); - p1 = s1->Buffer; - p2 = s2->Buffer; + SIZE_T len = min( len1, len2 ); - if (CaseInsensitive) + if (case_insensitive) { - while (!ret && len--) ret = toupperW(*p1++) - toupperW(*p2++); + while (!ret && len--) ret = toupperW(*s1++) - toupperW(*s2++); } else { - while (!ret && len--) ret = *p1++ - *p2++; + while (!ret && len--) ret = *s1++ - *s2++; } - if (!ret) ret = s1->Length - s2->Length; + if (!ret) ret = len1 - len2; return ret; } +/****************************************************************************** + * RtlCompareUnicodeString (NTDLL.@) + */ +LONG WINAPI RtlCompareUnicodeString( const UNICODE_STRING *s1, const UNICODE_STRING *s2, + BOOLEAN CaseInsensitive ) +{ + return RtlCompareUnicodeStrings( s1->Buffer, s1->Length / sizeof(WCHAR), + s2->Buffer, s2->Length / sizeof(WCHAR), CaseInsensitive ); +} + + /************************************************************************** * RtlEqualString (NTDLL.@) * diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c index dc27c3e..7f889df 100644 --- a/dlls/ntdll/tests/rtlstr.c +++ b/dlls/ntdll/tests/rtlstr.c @@ -41,6 +41,8 @@ static NTSTATUS (WINAPI *pRtlAppendStringToString)(STRING *, const STRING *); static NTSTATUS (WINAPI *pRtlAppendUnicodeStringToString)(UNICODE_STRING *, const UNICODE_STRING *); static NTSTATUS (WINAPI *pRtlAppendUnicodeToString)(UNICODE_STRING *, LPCWSTR); static NTSTATUS (WINAPI *pRtlCharToInteger)(PCSZ, ULONG, int *); +static LONG (WINAPI *pRtlCompareUnicodeString)(const UNICODE_STRING*, const UNICODE_STRING*, BOOLEAN); +static LONG (WINAPI *pRtlCompareUnicodeStrings)(const WCHAR *,SIZE_T,const WCHAR *,SIZE_T,BOOLEAN); static VOID (WINAPI *pRtlCopyString)(STRING *, const STRING *); static BOOLEAN (WINAPI *pRtlCreateUnicodeString)(PUNICODE_STRING, LPCWSTR); static BOOLEAN (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, LPCSTR); @@ -75,7 +77,6 @@ static NTSTATUS (WINAPI *pRtlUTF8ToUnicodeN)(WCHAR *, ULONG, ULONG *, const CHAR /*static VOID (WINAPI *pRtlCopyUnicodeString)(UNICODE_STRING *, const UNICODE_STRING *);*/ /*static VOID (WINAPI *pRtlEraseUnicodeString)(UNICODE_STRING *);*/ /*static LONG (WINAPI *pRtlCompareString)(const STRING *,const STRING *,BOOLEAN);*/ -/*static LONG (WINAPI *pRtlCompareUnicodeString)(const UNICODE_STRING *,const UNICODE_STRING *,BOOLEAN);*/ /*static BOOLEAN (WINAPI *pRtlEqualString)(const STRING *,const STRING *,BOOLEAN);*/ /*static BOOLEAN (WINAPI *pRtlPrefixString)(const STRING *, const STRING *, BOOLEAN);*/ /*static BOOLEAN (WINAPI *pRtlPrefixUnicodeString)(const UNICODE_STRING *, const UNICODE_STRING *, BOOLEAN);*/ @@ -112,6 +113,8 @@ static void InitFunctionPtrs(void) pRtlAppendUnicodeStringToString = (void *)GetProcAddress(hntdll, "RtlAppendUnicodeStringToString"); pRtlAppendUnicodeToString = (void *)GetProcAddress(hntdll, "RtlAppendUnicodeToString"); pRtlCharToInteger = (void *)GetProcAddress(hntdll, "RtlCharToInteger"); + pRtlCompareUnicodeString = (void *)GetProcAddress(hntdll, "RtlCompareUnicodeString"); + pRtlCompareUnicodeStrings = (void *)GetProcAddress(hntdll, "RtlCompareUnicodeStrings"); pRtlCopyString = (void *)GetProcAddress(hntdll, "RtlCopyString"); pRtlCreateUnicodeString = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeString"); pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz"); @@ -1856,6 +1859,36 @@ static void test_RtlIsTextUnicode(void) HeapFree(GetProcessHeap(), 0, be_unicode_no_controls); } +static void test_RtlCompareUnicodeString(void) +{ + WCHAR ch1, ch2; + UNICODE_STRING str1, str2; + + str1.Buffer = &ch1; + str1.Length = str1.MaximumLength = sizeof(WCHAR); + str2.Buffer = &ch2; + str2.Length = str2.MaximumLength = sizeof(WCHAR); + for (ch1 = 0; ch1 < 512; ch1++) + { + for (ch2 = 0; ch2 < 1024; ch2++) + { + LONG res = pRtlCompareUnicodeString( &str1, &str2, FALSE ); + ok( res == (ch1 - ch2), "wrong result %d %04x %04x\n", res, ch1, ch2 ); + res = pRtlCompareUnicodeString( &str1, &str2, TRUE ); + ok( res == (pRtlUpcaseUnicodeChar(ch1) - pRtlUpcaseUnicodeChar(ch2)), + "wrong result %d %04x %04x\n", res, ch1, ch2 ); + if (pRtlCompareUnicodeStrings) + { + res = pRtlCompareUnicodeStrings( &ch1, 1, &ch2, 1, FALSE ); + ok( res == (ch1 - ch2), "wrong result %d %04x %04x\n", res, ch1, ch2 ); + res = pRtlCompareUnicodeStrings( &ch1, 1, &ch2, 1, TRUE ); + ok( res == (pRtlUpcaseUnicodeChar(ch1) - pRtlUpcaseUnicodeChar(ch2)), + "wrong result %d %04x %04x\n", res, ch1, ch2 ); + } + } + } +} + static const WCHAR szGuid[] = { '{','0','1','0','2','0','3','0','4','-', '0','5','0','6','-' ,'0','7','0','8','-','0','9','0','A','-', '0','B','0','C','0','D','0','E','0','F','0','A','}','\0' }; @@ -2522,6 +2555,7 @@ START_TEST(rtlstr) test_RtlGUIDFromString(); test_RtlStringFromGUID(); test_RtlIsTextUnicode(); + test_RtlCompareUnicodeString(); if(0) { test_RtlUpcaseUnicodeChar(); diff --git a/include/winternl.h b/include/winternl.h index 0e6cd4b..339d807 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2386,6 +2386,7 @@ NTSYSAPI PDEBUG_BUFFER WINAPI RtlCreateQueryDebugBuffer(ULONG,BOOLEAN); NTSYSAPI ULONG WINAPI RtlCompactHeap(HANDLE,ULONG); NTSYSAPI LONG WINAPI RtlCompareString(const STRING*,const STRING*,BOOLEAN); NTSYSAPI LONG WINAPI RtlCompareUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN); +NTSYSAPI LONG WINAPI RtlCompareUnicodeStrings(const WCHAR*,SIZE_T,const WCHAR*,SIZE_T,BOOLEAN); NTSYSAPI NTSTATUS WINAPI RtlCompressBuffer(USHORT,PUCHAR,ULONG,PUCHAR,ULONG,ULONG,PULONG,PVOID); NTSYSAPI DWORD WINAPI RtlComputeCrc32(DWORD,const BYTE*,INT); NTSYSAPI NTSTATUS WINAPI RtlConvertSidToUnicodeString(PUNICODE_STRING,PSID,BOOLEAN);
1
0
0
0
← Newer
1
...
47
48
49
50
51
52
53
54
55
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
Results per page:
10
25
50
100
200