ReactOS.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
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
List overview
Download
Ros-diffs
March 2017
----- 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
ros-diffs@reactos.org
14 participants
251 discussions
Start a n
N
ew thread
[gadamopoulos] 74037: [COMCTL32]: Fix all tests for BCM_GETIDEALSIZE that we have so far. (It still returns a wrong result for the start button with lautus).
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Mar 3 13:56:49 2017 New Revision: 74037 URL:
http://svn.reactos.org/svn/reactos?rev=74037&view=rev
Log: [COMCTL32]: Fix all tests for BCM_GETIDEALSIZE that we have so far. (It still returns a wrong result for the start button with lautus). Modified: trunk/reactos/dll/win32/comctl32/button.c Modified: trunk/reactos/dll/win32/comctl32/button.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/button.…
============================================================================== --- trunk/reactos/dll/win32/comctl32/button.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/button.c [iso-8859-1] Fri Mar 3 13:56:49 2017 @@ -315,16 +315,13 @@ WCHAR *text; HFONT hFont = 0, hPrevFont = 0; SIZE TextSize, ImageSize, ButtonSize; + BOOL ret = FALSE; pdata = _GetButtonData(hwnd); text = get_button_text( hwnd ); hdc = GetDC(hwnd); if (!pdata || !text || !hdc || !text[0]) - { - psize->cx = 100; - psize->cy = 100; goto cleanup; - } /* FIXME : Should use GetThemeTextExtent but unfortunately uses DrawTextW which is broken */ if (theme) @@ -381,6 +378,7 @@ } *psize = ButtonSize; + ret = TRUE; cleanup: if (hFont) @@ -390,7 +388,7 @@ if (hdc) ReleaseDC(hwnd, hdc); - return TRUE; + return ret; } #endif @@ -575,17 +573,24 @@ case BCM_GETIDEALSIZE: { HTHEME theme = GetWindowTheme(hWnd); - - if (btn_type != BS_PUSHBUTTON && btn_type != BS_DEFPUSHBUTTON) + BOOL ret = FALSE; + SIZE* pSize = (SIZE*)lParam; + + if (btn_type == BS_PUSHBUTTON || + btn_type == BS_DEFPUSHBUTTON || + btn_type == BS_USERBUTTON) { - SIZE* pSize = (SIZE*)lParam; + ret = BUTTON_GetIdealSize(theme, hWnd, pSize); + } + + if (!ret) + { GetClientRect(hWnd, &rect); pSize->cx = rect.right; pSize->cy = rect.bottom; - return TRUE; } - return BUTTON_GetIdealSize(theme, hWnd, (SIZE*)lParam); + return TRUE; } }
7 years, 9 months
1
0
0
0
[gadamopoulos] 74036: [COMCTL32_APITEST]: Simplify tests to not depend on internals of CreateWindow (creating buttons as top level windows and testing their sizes complicates stuff without reason).
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Mar 3 13:54:56 2017 New Revision: 74036 URL:
http://svn.reactos.org/svn/reactos?rev=74036&view=rev
Log: [COMCTL32_APITEST]: Simplify tests to not depend on internals of CreateWindow (creating buttons as top level windows and testing their sizes complicates stuff without reason). Modified: trunk/rostests/apitests/comctl32/button.c Modified: trunk/rostests/apitests/comctl32/button.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/comctl32/button.…
============================================================================== --- trunk/rostests/apitests/comctl32/button.c [iso-8859-1] (original) +++ trunk/rostests/apitests/comctl32/button.c [iso-8859-1] Fri Mar 3 13:54:56 2017 @@ -115,7 +115,10 @@ LOGFONTW lf; DWORD i; - hwnd1 = CreateWindowW(L"Button", L" ", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL); + hwnd2 = CreateWindowW(L"Static", L"", 0, 0, 0, 100, 100, 0, NULL, NULL, NULL); + ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); + + hwnd1 = CreateWindowW(L"Button", L" ", WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL); ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); SetWindowTheme(hwnd1, L"", L""); @@ -133,7 +136,7 @@ DestroyWindow(hwnd1); - hwnd1 = CreateWindowW(L"Button", L" ", BS_USERBUTTON, 10, 10, 100, 100, 0, NULL, NULL, NULL); + hwnd1 = CreateWindowW(L"Button", L" ", BS_USERBUTTON | WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL); ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); SetWindowTheme(hwnd1, L"", L""); @@ -147,20 +150,15 @@ - hwnd1 = CreateWindowW(L"Button", L"", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL); - ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); - SetWindowTheme(hwnd1, L"", L""); - - memset(&s, 0, sizeof(s)); - ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); - ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 100); + hwnd1 = CreateWindowW(L"Button", L"", WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); + SetWindowTheme(hwnd1, L"", L""); s.cx = 1; s.cy = 1; ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 100); + ok_size(s, 100, 100); hbmp = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(5), IMAGE_BITMAP, 0, 0, 0); ok (hbmp != 0, "Expected LoadImage to succeed\n"); @@ -170,7 +168,7 @@ memset(&s, 0, sizeof(s)); ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 100); + ok_size(s, 100, 100); himl = ImageList_LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(5), 1, 1, 0, IMAGE_BITMAP, 0); ok (himl != 0, "Expected ImageList_LoadImage to succeed\n"); @@ -183,29 +181,29 @@ memset(&s, 0, sizeof(s)); ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 100); - - DestroyWindow(hwnd1); - - - - - - hwnd1 = CreateWindowW(L"Button", L"", 0, 10, 10, 5, 5, 0, NULL, NULL, NULL); - ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); - SetWindowTheme(hwnd1, L"", L""); - - memset(&s, 0, sizeof(s)); - ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); - ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 34); - - DestroyWindow(hwnd1); - - - - - hwnd1 = CreateWindowW(L"Button", L" ", BS_BITMAP , 10, 10, 100, 100, 0, NULL, NULL, NULL); + ok_size(s, 100, 100); + + DestroyWindow(hwnd1); + + + + + + hwnd1 = CreateWindowW(L"Button", L"", WS_CHILD, 10, 10, 5, 5, hwnd2, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); + SetWindowTheme(hwnd1, L"", L""); + + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 5, 5); + + DestroyWindow(hwnd1); + + + + + hwnd1 = CreateWindowW(L"Button", L" ", BS_BITMAP | WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL); ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); SetWindowTheme(hwnd1, L"", L""); @@ -223,7 +221,7 @@ - hwnd1 = CreateWindowW(L"Button", L" ", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL); + hwnd1 = CreateWindowW(L"Button", L" ", WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL); ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); SetWindowTheme(hwnd1, L"", L""); @@ -302,7 +300,7 @@ - hwnd1 = CreateWindowW(L"Button", L"Start", BS_VCENTER, 0, 0, 0, 0, 0, NULL, NULL, NULL); + hwnd1 = CreateWindowW(L"Button", L"Start", BS_VCENTER | WS_CHILD, 0, 0, 0, 0, hwnd2, NULL, NULL, NULL); ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); SetWindowTheme(hwnd1, L"", L""); @@ -326,7 +324,7 @@ /* Test again with some real text to see if the formula is correct */ - hwnd1 = CreateWindowW(L"Button", L"Some test text", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL); + hwnd1 = CreateWindowW(L"Button", L"Some test text", WS_CHILD, 10, 10, 100, 100, hwnd2, NULL, NULL, NULL); ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); SetWindowTheme(hwnd1, L"", L""); @@ -361,53 +359,53 @@ DestroyWindow(hwnd1); - hwnd1 = CreateWindowW(L"Static", L"", 0, 0, 0, 100, 100, 0, NULL, NULL, NULL); - ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); - - for (i = BS_CHECKBOX; i <= BS_OWNERDRAW; i++) + for (i = BS_PUSHBUTTON; i <= BS_OWNERDRAW; i++) { if (i == BS_USERBUTTON) continue; - hwnd2 = CreateWindowW(L"Button", L" ", i, 0, 0, 72, 72, hwnd1, NULL, NULL, NULL); - ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); + if (i >= BS_CHECKBOX) + { + hwnd1 = CreateWindowW(L"Button", L" ", i|WS_CHILD, 0, 0, 72, 72, hwnd2, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 72, 72); + + SetWindowTheme(hwnd1, L"", L""); + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 72, 72); + DestroyWindow(hwnd1); + + hwnd1 = CreateWindowW(L"Button", L" ", i|WS_CHILD, 0, 0, 12, 12, hwnd2, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 12, 12); + DestroyWindow(hwnd1); + } + + hwnd1 = CreateWindowW(L"Button", L"", i|WS_CHILD, 0, 0, 72, 72, hwnd2, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); memset(&s, 0, sizeof(s)); - ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 72); - - SetWindowTheme(hwnd2, L"", L""); + ok_size(s, 72, 72); + DestroyWindow(hwnd1); + + hwnd1 = CreateWindowW(L"Button", L"", i|WS_CHILD, 0, 0, 150, 72, hwnd2, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); memset(&s, 0, sizeof(s)); - ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); - ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 72); - DestroyWindow(hwnd2); - - hwnd2 = CreateWindowW(L"Button", L" ", i, 0, 0, 12, 12, hwnd1, NULL, NULL, NULL); - ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); - memset(&s, 0, sizeof(s)); - ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); - ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 34); - DestroyWindow(hwnd2); - - hwnd2 = CreateWindowW(L"Button", L"", i, 0, 0, 72, 72, hwnd1, NULL, NULL, NULL); - ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); - memset(&s, 0, sizeof(s)); - ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); - ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok_size(s, 123, 72); - DestroyWindow(hwnd2); - - hwnd2 = CreateWindowW(L"Button", L"", i, 0, 0, 150, 72, hwnd1, NULL, NULL, NULL); - ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); - memset(&s, 0, sizeof(s)); - ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); ok_size(s, 150, 72); - DestroyWindow(hwnd2); + DestroyWindow(hwnd1); } - DestroyWindow(hwnd1); + DestroyWindow(hwnd2); } START_TEST(button)
7 years, 9 months
1
0
0
0
[gadamopoulos] 74035: [COMCTL32_APITEST]: Add a few more tests.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Mar 3 11:30:06 2017 New Revision: 74035 URL:
http://svn.reactos.org/svn/reactos?rev=74035&view=rev
Log: [COMCTL32_APITEST]: Add a few more tests. Modified: trunk/rostests/apitests/comctl32/button.c Modified: trunk/rostests/apitests/comctl32/button.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/comctl32/button.…
============================================================================== --- trunk/rostests/apitests/comctl32/button.c [iso-8859-1] (original) +++ trunk/rostests/apitests/comctl32/button.c [iso-8859-1] Fri Mar 3 11:30:06 2017 @@ -398,6 +398,14 @@ ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); ok_size(s, 123, 72); DestroyWindow(hwnd2); + + hwnd2 = CreateWindowW(L"Button", L"", i, 0, 0, 150, 72, hwnd1, NULL, NULL, NULL); + ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 150, 72); + DestroyWindow(hwnd2); } DestroyWindow(hwnd1); }
7 years, 9 months
1
0
0
0
[gadamopoulos] 74034: [COMCTL32_APITEST]: Make some tests more strict and add tests for all button types.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Mar 3 11:22:20 2017 New Revision: 74034 URL:
http://svn.reactos.org/svn/reactos?rev=74034&view=rev
Log: [COMCTL32_APITEST]: Make some tests more strict and add tests for all button types. Modified: trunk/rostests/apitests/comctl32/button.c Modified: trunk/rostests/apitests/comctl32/button.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/comctl32/button.…
============================================================================== --- trunk/rostests/apitests/comctl32/button.c [iso-8859-1] (original) +++ trunk/rostests/apitests/comctl32/button.c [iso-8859-1] Fri Mar 3 11:22:20 2017 @@ -11,7 +11,7 @@ #include <uxtheme.h> #define ok_rect(rc, l,r,t,b) ok((rc.left == (l)) && (rc.right == (r)) && (rc.top == (t)) && (rc.bottom == (b)), "Wrong rect. expected %d, %d, %d, %d got %ld, %ld, %ld, %ld\n", l,t,r,b, rc.left, rc.top, rc.right, rc.bottom) -#define ok_size(s, width, height) ok((s.cx == (width) && s.cy == (height)), "Expected size (%lu,%lu) got (%lu,%lu)\n", width, height, s.cx, s.cy) +#define ok_size(s, width, height) ok((s.cx == (width) && s.cy == (height)), "Expected size (%lu,%lu) got (%lu,%lu)\n", (LONG)width, (LONG)height, s.cx, s.cy) void Test_TextMargin() { @@ -52,6 +52,17 @@ ok_rect(rc, 1000, 1000, 1000, 1000); DestroyWindow(hwnd1); + + hwnd1 = CreateWindowW(L"Button", L"Test1", BS_DEFPUSHBUTTON, 10, 10, 100, 100, 0, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); + SetWindowTheme(hwnd1, L"", L""); + + ret = SendMessageW(hwnd1, BCM_GETTEXTMARGIN, 0, (LPARAM)&rc); + ok (ret == TRUE, "Expected BCM_GETTEXTMARGIN to succeed\n"); + ok_rect(rc, 1, 1, 1, 1); + + DestroyWindow(hwnd1); + } void Test_Imagelist() @@ -92,7 +103,7 @@ void Test_GetIdealSizeNoThemes() { - HWND hwnd1; + HWND hwnd1, hwnd2; BOOL ret; SIZE s, textent; HFONT font; @@ -102,6 +113,7 @@ BUTTON_IMAGELIST imlData; RECT rc; LOGFONTW lf; + DWORD i; hwnd1 = CreateWindowW(L"Button", L" ", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL); ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); @@ -121,6 +133,18 @@ DestroyWindow(hwnd1); + hwnd1 = CreateWindowW(L"Button", L" ", BS_USERBUTTON, 10, 10, 100, 100, 0, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); + SetWindowTheme(hwnd1, L"", L""); + + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, textent.cx + 5 + 2, + textent.cy + 7 + 2); /* the last +2 is the text margin */ + + DestroyWindow(hwnd1); + hwnd1 = CreateWindowW(L"Button", L"", 0, 10, 10, 100, 100, 0, NULL, NULL, NULL); @@ -130,15 +154,13 @@ memset(&s, 0, sizeof(s)); ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok (s.cx > 80, "Expected big cx\n"); - ok (s.cy > 80, "Expected big cy\n"); + ok_size(s, 123, 100); s.cx = 1; s.cy = 1; ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok (s.cx > 80, "Expected big cx\n"); - ok (s.cy > 80, "Expected big cy\n"); + ok_size(s, 123, 100); hbmp = LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(5), IMAGE_BITMAP, 0, 0, 0); ok (hbmp != 0, "Expected LoadImage to succeed\n"); @@ -148,8 +170,7 @@ memset(&s, 0, sizeof(s)); ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok (s.cx > 80, "Expected big cx\n"); - ok (s.cy > 80, "Expected big cy\n"); + ok_size(s, 123, 100); himl = ImageList_LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(5), 1, 1, 0, IMAGE_BITMAP, 0); ok (himl != 0, "Expected ImageList_LoadImage to succeed\n"); @@ -162,8 +183,22 @@ memset(&s, 0, sizeof(s)); ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); - ok (s.cx > 80, "Expected big cx\n"); - ok (s.cy > 80, "Expected big cy\n"); + ok_size(s, 123, 100); + + DestroyWindow(hwnd1); + + + + + + hwnd1 = CreateWindowW(L"Button", L"", 0, 10, 10, 5, 5, 0, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); + SetWindowTheme(hwnd1, L"", L""); + + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd1, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 123, 34); DestroyWindow(hwnd1); @@ -326,9 +361,45 @@ DestroyWindow(hwnd1); - - - + hwnd1 = CreateWindowW(L"Static", L"", 0, 0, 0, 100, 100, 0, NULL, NULL, NULL); + ok (hwnd1 != NULL, "Expected CreateWindowW to succeed\n"); + + for (i = BS_CHECKBOX; i <= BS_OWNERDRAW; i++) + { + if (i == BS_USERBUTTON) + continue; + + hwnd2 = CreateWindowW(L"Button", L" ", i, 0, 0, 72, 72, hwnd1, NULL, NULL, NULL); + ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 123, 72); + + SetWindowTheme(hwnd2, L"", L""); + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 123, 72); + DestroyWindow(hwnd2); + + hwnd2 = CreateWindowW(L"Button", L" ", i, 0, 0, 12, 12, hwnd1, NULL, NULL, NULL); + ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 123, 34); + DestroyWindow(hwnd2); + + hwnd2 = CreateWindowW(L"Button", L"", i, 0, 0, 72, 72, hwnd1, NULL, NULL, NULL); + ok (hwnd2 != NULL, "Expected CreateWindowW to succeed\n"); + memset(&s, 0, sizeof(s)); + ret = SendMessageW(hwnd2, BCM_GETIDEALSIZE, 0, (LPARAM)&s); + ok (ret == TRUE, "Expected BCM_GETIDEALSIZE to succeed\n"); + ok_size(s, 123, 72); + DestroyWindow(hwnd2); + } + DestroyWindow(hwnd1); } START_TEST(button)
7 years, 9 months
1
0
0
0
[hbelusca] 74033: [WS2_32]: Remove trailing whitespace.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri Mar 3 00:13:40 2017 New Revision: 74033 URL:
http://svn.reactos.org/svn/reactos?rev=74033&view=rev
Log: [WS2_32]: Remove trailing whitespace. Modified: trunk/reactos/dll/win32/ws2_32/inc/ws2_32p.h trunk/reactos/dll/win32/ws2_32/src/addrconv.c trunk/reactos/dll/win32/ws2_32/src/addrinfo.c trunk/reactos/dll/win32/ws2_32/src/async.c trunk/reactos/dll/win32/ws2_32/src/dcatalog.c trunk/reactos/dll/win32/ws2_32/src/dcatitem.c trunk/reactos/dll/win32/ws2_32/src/dllmain.c trunk/reactos/dll/win32/ws2_32/src/dprovide.c trunk/reactos/dll/win32/ws2_32/src/dthread.c trunk/reactos/dll/win32/ws2_32/src/dupsock.c trunk/reactos/dll/win32/ws2_32/src/event.c trunk/reactos/dll/win32/ws2_32/src/getxbyxx.c trunk/reactos/dll/win32/ws2_32/src/nscatalo.c trunk/reactos/dll/win32/ws2_32/src/nsprovid.c trunk/reactos/dll/win32/ws2_32/src/nsquery.c trunk/reactos/dll/win32/ws2_32/src/qos.c trunk/reactos/dll/win32/ws2_32/src/qshelpr.c trunk/reactos/dll/win32/ws2_32/src/rasdial.c trunk/reactos/dll/win32/ws2_32/src/recv.c trunk/reactos/dll/win32/ws2_32/src/rnr.c trunk/reactos/dll/win32/ws2_32/src/select.c trunk/reactos/dll/win32/ws2_32/src/send.c trunk/reactos/dll/win32/ws2_32/src/socklife.c trunk/reactos/dll/win32/ws2_32/src/startup.c trunk/reactos/dll/win32/ws2_32/src/wsautil.c Modified: trunk/reactos/dll/win32/ws2_32/inc/ws2_32p.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/inc/ws2_3…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/inc/ws2_32p.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/inc/ws2_32p.h [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -537,7 +537,7 @@ IN PNSQUERY_PROVIDER QueryProvider, IN LPWSAQUERYSETW QuerySet, IN LPWSASERVICECLASSINFOW ServiceClassInfo, - IN DWORD + IN DWORD ); VOID Modified: trunk/reactos/dll/win32/ws2_32/src/addrconv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/addrc…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/addrconv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/addrconv.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -272,7 +272,7 @@ INT ErrorCode; PWSSOCKET Socket; DPRINT("WSAHtonl: %p, %lx, %p\n", s, hostlong, lpnetlong); - + /* Check for WSAStartup */ if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS) { @@ -330,7 +330,7 @@ INT ErrorCode; PWSSOCKET Socket; DPRINT("WSAHtons: %p, %lx, %p\n", s, hostshort, lpnetshort); - + /* Check for WSAStartup */ if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS) { @@ -388,7 +388,7 @@ INT ErrorCode; PWSSOCKET Socket; DPRINT("WSANtohl: %p, %lx, %p\n", s, netlong, lphostlong); - + /* Check for WSAStartup */ if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS) { @@ -446,7 +446,7 @@ INT ErrorCode; PWSSOCKET Socket; DPRINT("WSANtohs: %p, %lx, %p\n", s, netshort, lphostshort); - + /* Check for WSAStartup */ if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS) { Modified: trunk/reactos/dll/win32/ws2_32/src/addrinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/addri…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/addrinfo.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/addrinfo.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -58,7 +58,7 @@ { /* Get the name */ UnicodeName = &Addrinfo->ai_canonname; - + /* Check if it exists */ if (*UnicodeName) { @@ -68,7 +68,7 @@ { /* Free the old one */ HeapFree(WsSockHeap, 0, *UnicodeName); - + /* Set the new one */ *UnicodeName = (LPWSTR)AnsiName; } @@ -99,9 +99,9 @@ return FALSE; WideCharToMultiByte(CP_ACP, 0, - AddressString, - -1, - AnsiAddressString, + AddressString, + -1, + AnsiAddressString, sizeof(AnsiAddressString), NULL, 0); @@ -234,7 +234,7 @@ /* Check if we ran out of memory */ if (Next) return EAI_MEMORY; - + /* Return success */ return 0; } @@ -282,11 +282,11 @@ /* Copy the canonical name */ strcpy(Alias, Hostent->h_name); - + /* Return success */ return 0; } - + /* Find out what the error was */ switch (GetLastError()) { @@ -345,7 +345,7 @@ /* Get the reverse name */ Dns_Ip4AddressToReverseName_W(ReverseBuffer, *Ip4Addr); } - /* FIXME: Not implemented for now + /* FIXME: Not implemented for now else if ( */ /* By this point we have the Reverse Name, so prepare for lookup */ @@ -444,7 +444,7 @@ /* Make a copy of the name */ strcpy(Name, NodeName); - + /* Loop */ while (TRUE) { @@ -477,7 +477,7 @@ { /* Allocate memory for a copy */ (*pptResult)->ai_canonname = HeapAlloc(WsSockHeap, 0, 512); - + /* Check if we had enough memory */ if (!(*pptResult)->ai_canonname) { @@ -487,11 +487,11 @@ else { /* Convert the alias to UNICODE */ - MultiByteToWideChar(CP_ACP, - 0, - Alias, - -1, - (*pptResult)->ai_canonname, + MultiByteToWideChar(CP_ACP, + 0, + Alias, + -1, + (*pptResult)->ai_canonname, 256); } } @@ -551,7 +551,7 @@ SetLastError(EAI_FAIL); return EAI_FAIL; } - + /* Save the flags and validate them */ iFlags = ptHints->ai_flags; if ((iFlags & AI_CANONNAME) && !pszNodeName) @@ -589,9 +589,9 @@ /* We need to convert it to ANSI */ WideCharToMultiByte(CP_ACP, 0, - pszServiceName, - -1, - AnsiServiceName, + pszServiceName, + -1, + AnsiServiceName, sizeof(AnsiServiceName), NULL, 0); @@ -637,7 +637,7 @@ /* Return the port from the servent */ if (ptService) wPort = wTcpPort = ptService->s_port; } - + /* If we got 0, then fail */ if (wPort == 0) { @@ -653,7 +653,7 @@ iSocketType = SOCK_STREAM; if (!wTcpPort && wUdpPort) iSocketType = SOCK_DGRAM; - //bClone = (wTcpPort && wUdpPort); + //bClone = (wTcpPort && wUdpPort); } } } @@ -668,19 +668,19 @@ dwAddress = htonl((iFlags & AI_PASSIVE) ? INADDR_ANY : INADDR_LOOPBACK); } - + /* Create the Addr Info */ *pptResult = NewAddrInfo(iSocketType, iProtocol, wPort, dwAddress); /* If we didn't get one back, assume out of memory */ if (!(*pptResult)) iError = EAI_MEMORY; - + /* Check if we have success and a nodename */ if (!iError && pszNodeName) { /* Set AI_NUMERICHOST since this is a numeric string */ (*pptResult)->ai_flags |= AI_NUMERICHOST; - + /* Check if the canonical name was requested */ if (iFlags & AI_CANONNAME) { @@ -697,7 +697,7 @@ (*pptResult)->ai_canonname = HeapAlloc(WsSockHeap, 0, wcslen(CanonicalName)); - + if (!(*pptResult)->ai_canonname) { /* No memory for the copy */ @@ -723,9 +723,9 @@ /* We need to convert it to ANSI */ WideCharToMultiByte(CP_ACP, 0, - pszNodeName, - -1, - AnsiNodeName, + pszNodeName, + -1, + AnsiNodeName, sizeof(AnsiNodeName), NULL, 0); @@ -751,7 +751,7 @@ { /* Free the address info and return nothing */ FreeAddrInfoW(*pptResult); - *pptResult = NULL; + *pptResult = NULL; } /* Return to caller */ @@ -778,7 +778,7 @@ /* Free it */ HeapFree(WsSockHeap, 0, NextInfo->ai_canonname); } - + /* Check if there is an address */ if (NextInfo->ai_addr) { @@ -807,7 +807,7 @@ { INT ErrorCode; LPWSTR UnicodeNodeName = NULL; - LPWSTR UnicodeServName = NULL; + LPWSTR UnicodeServName = NULL; DPRINT("getaddrinfo: %s, %s, %p, %p\n", nodename, servname, hints, res); /* Check for WSAStartup */ @@ -836,7 +836,7 @@ goto Quickie; } } - + /* Now call the unicode function */ ErrorCode = GetAddrInfoW(UnicodeNodeName, UnicodeServName, @@ -915,7 +915,7 @@ /* Unsupported family */ SetLastError(EAI_FAMILY); return EAI_FAMILY; - } + } /* Check for valid socket address length */ if ((DWORD)SockaddrLength < AddressLength) @@ -923,7 +923,7 @@ /* Check if we have a node name */ if (pNodeBuffer) - { + { /* Check if only the numeric host is wanted */ if (!(Flags & NI_NUMERICHOST)) { @@ -1030,7 +1030,7 @@ ServiceString = ServiceBuffer; ServLength = sizeof(ServiceBuffer) / sizeof(WCHAR); } - + /* Now call the unicode function */ ErrorCode = GetNameInfoW(sa, salen, Modified: trunk/reactos/dll/win32/ws2_32/src/async.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/async…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/async.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/async.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -954,7 +954,7 @@ WsAsyncFreeBlock(AsyncBlock); return NO_ERROR; } - + /* Move to the next entry */ Entry = Entry->Flink; } Modified: trunk/reactos/dll/win32/ws2_32/src/dcatalog.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/dcata…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/dcatalog.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/dcatalog.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -25,7 +25,7 @@ WsTcAllocate(VOID) { PTCATALOG Catalog; - + /* Allocate the object */ Catalog = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Catalog)); @@ -283,7 +283,7 @@ ErrorCode = WSASYSCALLFAILURE; break; } - + /* Get the next entry */ ErrorCode = RegQueryValueEx(Catalog->CatalogKey, "Next_Catalog_Entry_ID", @@ -313,7 +313,7 @@ } /* Initialize them all */ - for (i = 1; i <= CatalogEntries; i++) + for (i = 1; i <= CatalogEntries; i++) { /* Allocate a Catalog Entry Structure */ CatalogEntry = WsTcEntryAllocate(); @@ -517,13 +517,13 @@ /* Check if Address Family Matches or if it's wildcard */ if ((Entry->ProtocolInfo.iAddressFamily == af) || (af == AF_UNSPEC)) - { + { /* Check if Socket Type Matches or if it's wildcard */ if ((Entry->ProtocolInfo.iSocketType == type) || (type == 0)) { /* Check if Protocol is In Range or if it's wildcard */ - if (((Entry->ProtocolInfo.iProtocol <= protocol) && - ((Entry->ProtocolInfo.iProtocol + + if (((Entry->ProtocolInfo.iProtocol <= protocol) && + ((Entry->ProtocolInfo.iProtocol + Entry->ProtocolInfo.iProtocolMaxOffset) >= protocol)) || (protocol == 0)) { @@ -542,18 +542,18 @@ *CatalogEntry = Entry; ErrorCode = ERROR_SUCCESS; break; - } - else + } + else { ErrorCode = WSAEPROTONOSUPPORT; } - } - else + } + else { ErrorCode = WSAESOCKTNOSUPPORT; } - } - else + } + else { ErrorCode = WSAEAFNOSUPPORT; } @@ -790,7 +790,7 @@ { /* Load it */ ErrorCode = WsTcLoadProvider(Catalog, CatalogEntry); - + /* Skip it if we failed to load it */ if (ErrorCode != ERROR_SUCCESS) continue; @@ -830,7 +830,7 @@ NewHandle = WPUModifyIFSHandle(ProtocolInfo.dwCatalogEntryId, Handle, &Error); - + /* Check if the socket is invalid */ if (NewHandle == INVALID_SOCKET) return WSAENOTSOCK; Modified: trunk/reactos/dll/win32/ws2_32/src/dcatitem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/dcati…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/dcatitem.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/dcatitem.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -81,18 +81,18 @@ &EntryKey); /* Get Size of Catalog Entry Structure */ - Return = RegQueryValueEx(EntryKey, + Return = RegQueryValueEx(EntryKey, "PackedCatalogItem", 0, NULL, NULL, &RegSize); - - if(!(Buf = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, RegSize))) + + if (!(Buf = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, RegSize))) return ERROR_NOT_ENOUGH_MEMORY; /* Read the Whole Catalog Entry Structure */ - Return = RegQueryValueEx(EntryKey, + Return = RegQueryValueEx(EntryKey, "PackedCatalogItem", 0, &RegType, @@ -102,7 +102,7 @@ memcpy(CatalogEntry->DllPath, Buf, sizeof(CatalogEntry->DllPath)); index = sizeof(CatalogEntry->DllPath); - if(index < RegSize) + if (index < RegSize) { memcpy(&CatalogEntry->ProtocolInfo, &Buf[index], sizeof(WSAPROTOCOL_INFOW)); index += sizeof(WSAPROTOCOL_INFOW); Modified: trunk/reactos/dll/win32/ws2_32/src/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/dllma…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/dllmain.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -33,7 +33,7 @@ PWSPROCESS WsProcess; /* Main Entrypoint */ - switch (dwReason) + switch (dwReason) { case DLL_PROCESS_ATTACH: /* Save DLL Handle */ Modified: trunk/reactos/dll/win32/ws2_32/src/dprovide.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/dprov…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/dprovide.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/dprovide.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -20,14 +20,14 @@ WsTpAllocate(VOID) { PTPROVIDER Provider; - + DPRINT("WsTpAllocate: WsSockHeap %d\n", WsSockHeap); /* Allocate the object */ Provider = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Provider)); /* Setup non-zero data */ Provider->RefCount = 1; - + /* Return it */ return Provider; } @@ -44,7 +44,7 @@ CHAR ExpandedDllPath[MAX_PATH]; DWORD ErrorCode; DPRINT("WsTpInitialize: %p, %p, %p\n", Provider, DllName, ProtocolInfo); - + /* Clear the tables */ RtlZeroMemory(&Provider->UpcallTable, sizeof(Provider->UpcallTable)); RtlZeroMemory(&Provider->Service, sizeof(Provider->Service)); @@ -72,14 +72,14 @@ /* Load the DLL */ Provider->DllHandle = LoadLibrary(ExpandedDllPath); - if(!Provider->DllHandle) + if (!Provider->DllHandle) { return SOCKET_ERROR; } /* Get the pointer to WSPStartup */ WSPStartupProc = (LPWSPSTARTUP)GetProcAddress(Provider->DllHandle, "WSPStartup"); - if(!WSPStartupProc) + if (!WSPStartupProc) { return SOCKET_ERROR; } @@ -101,7 +101,7 @@ { LPWSPCLEANUP WSPCleanup = NULL; INT ErrorCode = ERROR_SUCCESS; - + /* Make sure we have a loaded handle */ if (Provider->DllHandle) { @@ -121,7 +121,7 @@ WsTpDelete(IN PTPROVIDER Provider) { INT ErrorCode; - + /* Make sure we have a loaded handle */ if (Provider->DllHandle) { Modified: trunk/reactos/dll/win32/ws2_32/src/dthread.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/dthre…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/dthread.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/dthread.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -18,7 +18,7 @@ { MSG Message; BOOL GotMessage = FALSE; - + /* Get the message */ GotMessage = PeekMessage(&Message, NULL, 0, 0, PM_REMOVE); @@ -46,7 +46,7 @@ Thread->Cancelled = FALSE; /* Call the blocking hook */ - while(Thread->BlockingHook()); + while (Thread->BlockingHook()); /* We're not blocking anymore */ Thread->Blocking = FALSE; @@ -135,7 +135,7 @@ WsThreadAllocate(VOID) { PWSTHREAD Thread; - + /* Allocate the object */ Thread = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Thread)); @@ -151,7 +151,7 @@ WsThreadStartup(VOID) { INT ErrorCode = WSASYSCALLFAILURE; - + /* Check if we have a valid TLS */ if (TlsIndex != TLS_OUT_OF_INDEXES) { @@ -175,7 +175,7 @@ IN PWSPROCESS Process) { INT ErrorCode = WSASYSCALLFAILURE; - + /* Set the process */ Thread->Process = Process; @@ -244,7 +244,7 @@ { PWSTHREAD Thread = NULL; INT ErrorCode = WSASYSCALLFAILURE; - + /* Make sure we have TLS */ if (TlsIndex != TLS_OUT_OF_INDEXES) { Modified: trunk/reactos/dll/win32/ws2_32/src/dupsock.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/dupso…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/dupsock.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/dupsock.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -27,16 +27,16 @@ WSAPROTOCOL_INFOW ProtocolInfoW; INT ErrorCode; DPRINT("WSADuplicateSocketA: %lx, %lx, %p\n", s, dwProcessId, lpProtocolInfo); - + /* Call the Unicode Function */ ErrorCode = WSADuplicateSocketW(s, dwProcessId, &ProtocolInfoW); /* Check for success */ if (ErrorCode == ERROR_SUCCESS) - { + { /* Convert Protocol Info to Ansi */ - if (lpProtocolInfo) - { + if (lpProtocolInfo) + { /* Convert the information to ANSI */ ErrorCode = MapUnicodeProtocolInfoToAnsi(&ProtocolInfoW, lpProtocolInfo); Modified: trunk/reactos/dll/win32/ws2_32/src/event.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/event…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/event.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/event.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -79,10 +79,10 @@ IN BOOL fAlertable) { /* Call Win32 */ - return WaitForMultipleObjectsEx(cEvents, - lphEvents, - fWaitAll, - dwTimeout, + return WaitForMultipleObjectsEx(cEvents, + lphEvents, + fWaitAll, + dwTimeout, fAlertable); } Modified: trunk/reactos/dll/win32/ws2_32/src/getxbyxx.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/getxb…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/getxbyxx.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/getxbyxx.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -16,16 +16,16 @@ /* DATA **********************************************************************/ AFPROTOCOLS afp[2] = {{AF_INET, IPPROTO_UDP}, {AF_INET, IPPROTO_TCP}}; - + /* FUNCTIONS *****************************************************************/ VOID WSAAPI -FixList(PCHAR **List, +FixList(PCHAR **List, ULONG_PTR Base) { /* Make sure it's valid */ - if(*List) + if (*List) { PCHAR *Addr; @@ -33,7 +33,7 @@ Addr = *List = (PCHAR*)(((ULONG_PTR)*List + Base)); /* Loop the pointers */ - while(*Addr) + while (*Addr) { /* Rebase them too */ *Addr = (PCHAR)(((ULONG_PTR)*Addr + Base)); @@ -63,7 +63,7 @@ ULONG_PTR HostentPtr = (ULONG_PTR)Hostent; /* Convert the Name Offset to a Pointer */ - if(Hostent->h_name) Hostent->h_name = (PCHAR)(Hostent->h_name + HostentPtr); + if (Hostent->h_name) Hostent->h_name = (PCHAR)(Hostent->h_name + HostentPtr); /* Convert all the List Offsets to Pointers */ FixList(&Hostent->h_aliases, HostentPtr); @@ -126,7 +126,7 @@ WsaQuery->dwNumberOfProtocols = sizeof(afp)/sizeof(afp[0]); WsaQuery->lpafpProtocols = afp; - if(!IsEqualGUID(Type, &HostnameGuid)) + if (!IsEqualGUID(Type, &HostnameGuid)) dwControlFlags |= LUP_RETURN_BLOB; /* Send the Query Request to find a Service */ @@ -134,7 +134,7 @@ dwControlFlags, &RnRHandle); - if(ErrorCode == ERROR_SUCCESS) + if (ErrorCode == ERROR_SUCCESS) { while (TRUE) { @@ -145,22 +145,22 @@ WsaQuery); /* Return the information requested */ - if(ErrorCode == ERROR_SUCCESS) + if (ErrorCode == ERROR_SUCCESS) { /* Get the Blob and check if we have one */ Blob = WsaQuery->lpBlob; - if(Blob) + if (Blob) { /* Did they want the name back? */ - if(NewName) *NewName = WsaQuery->lpszServiceInstanceName; - } - else + if (NewName) *NewName = WsaQuery->lpszServiceInstanceName; + } + else { /* Check if this was a Hostname lookup */ if (IsEqualGUID(Type, &HostnameGuid)) { /* Return the name anyways */ - if(NewName) *NewName = WsaQuery->lpszServiceInstanceName; + if (NewName) *NewName = WsaQuery->lpszServiceInstanceName; } else { @@ -168,8 +168,8 @@ ErrorCode = WSANO_DATA; } } - } - else + } + else { /* WSALookupServiceEnd will set its own error, so save ours */ ErrorCode = GetLastError(); @@ -197,12 +197,12 @@ } } } - + /* Finish the Query Request */ WSALookupServiceEnd(RnRHandle); /* Now set the Last Error */ - if(ErrorCode != ERROR_SUCCESS) SetLastError(ErrorCode); + if (ErrorCode != ERROR_SUCCESS) SetLastError(ErrorCode); /* Leave the loop */ break; @@ -240,13 +240,13 @@ } /* Check if no name was given */ - if(!name || !*name) + if (!name || !*name) { /* This means we should do a local lookup first */ - if(gethostname(szLocalName, MAX_HOSTNAME_LEN) != NO_ERROR) return(NULL); + if (gethostname(szLocalName, MAX_HOSTNAME_LEN) != NO_ERROR) return(NULL); pszName = szLocalName; - } - else + } + else { /* Use the name tha twas given to us */ pszName = (PCHAR)name; @@ -258,7 +258,7 @@ pszName, &HostAddrByNameGuid, 0); - + /* Check if we didn't get a blob, or if we got an empty name */ if (!(Blob) && (!(name) || !(*name))) { @@ -271,21 +271,21 @@ } /* Check if we got a blob */ - if(Blob) + if (Blob) { /* Copy the blob to our buffer and convert it */ Hostent = WsThreadBlobToHostent(Thread, Blob); /* Unpack the hostent */ - if(Hostent) UnpackHostEnt(Hostent); - } - else + if (Hostent) UnpackHostEnt(Hostent); + } + else { /* We failed, so zero it out */ Hostent = NULL; /* Normalize the error message */ - if(GetLastError() == WSASERVICE_NOT_FOUND) + if (GetLastError() == WSASERVICE_NOT_FOUND) { SetLastError(WSAHOST_NOT_FOUND); } @@ -360,23 +360,23 @@ AddressBuffer, &AddressGuid, 0); - + /* Check if we got a blob */ - if(Blob) + if (Blob) { /* Copy the blob to our buffer and convert it */ Hostent = WsThreadBlobToHostent(Thread, Blob); /* Unpack the hostent */ - if(Hostent) UnpackHostEnt(Hostent); - } - else + if (Hostent) UnpackHostEnt(Hostent); + } + else { /* We failed, so zero it out */ Hostent = NULL; /* Normalize the error message */ - if(GetLastError() == WSASERVICE_NOT_FOUND) + if (GetLastError() == WSASERVICE_NOT_FOUND) { SetLastError(WSAHOST_NOT_FOUND); } @@ -410,7 +410,7 @@ /* Get the Hostname in a String */ /* getxyDataEnt does not return blob for HostnameGuid */ getxyDataEnt(&Results, RNR_BUFFER_SIZE, NULL, &HostnameGuid, &Name); - if(Name) + if (Name) { /* Copy it */ strncpy(name, Name, namelen-1); @@ -450,7 +450,7 @@ } /* No protocol specified */ - if(!proto) proto = ""; + if (!proto) proto = ""; /* Allocate memory for the port name */ PortName = HeapAlloc(WsSockHeap, 0, strlen(proto) + 1 + 1 + 5); @@ -471,15 +471,15 @@ HeapFree(WsSockHeap, 0, PortName); /* Check if we got a blob */ - if(Blob) + if (Blob) { /* Copy the blob to our buffer and convert it */ Servent = WsThreadBlobToServent(Thread, Blob); /* Unpack the hostent */ - if(Servent) UnpackServEnt(Servent); - } - else + if (Servent) UnpackServEnt(Servent); + } + else { /* We failed, so zero it out */ Servent = 0; @@ -519,7 +519,7 @@ } /* No protocol specified */ - if(!proto) proto = ""; + if (!proto) proto = ""; /* Allocate buffer for it */ PortName = HeapAlloc(WsSockHeap, 0, strlen(proto) + 1 + strlen(name) + 1); @@ -540,15 +540,15 @@ HeapFree(WsSockHeap, 0, PortName); /* Check if we got a blob */ - if(Blob) + if (Blob) { /* Copy the blob to our buffer and convert it */ Servent = WsThreadBlobToServent(Thread, Blob); /* Unpack the hostent */ - if(Servent) UnpackServEnt(Servent); - } - else + if (Servent) UnpackServEnt(Servent); + } + else { /* We failed, so zero it out */ Servent = 0; @@ -568,10 +568,10 @@ WSAAPI WSAAsyncGetHostByAddr(IN HWND hWnd, IN UINT wMsg, - IN CONST CHAR FAR *Address, + IN CONST CHAR FAR *Address, IN INT Length, - IN INT Type, - OUT CHAR FAR *Buffer, + IN INT Type, + OUT CHAR FAR *Buffer, IN INT BufferLength) { HANDLE TaskHandle; @@ -633,10 +633,10 @@ */ HANDLE WSAAPI -WSAAsyncGetHostByName(IN HWND hWnd, - IN UINT wMsg, - IN CONST CHAR FAR *Name, - OUT CHAR FAR *Buffer, +WSAAsyncGetHostByName(IN HWND hWnd, + IN UINT wMsg, + IN CONST CHAR FAR *Name, + OUT CHAR FAR *Buffer, IN INT BufferLength) { HANDLE TaskHandle; @@ -771,7 +771,7 @@ PWSASYNCBLOCK AsyncBlock; INT ErrorCode; DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %lx\n", hWnd, wMsg, Number); - + /* Enter prolog */ if ((ErrorCode = WsApiProlog(&Process, &Thread)) != ERROR_SUCCESS) { @@ -831,7 +831,7 @@ INT ErrorCode; PVOID NameCopy; DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %s\n", hWnd, wMsg, Name); - + /* Enter prolog */ if ((ErrorCode = WsApiProlog(&Process, &Thread)) != ERROR_SUCCESS) { @@ -895,7 +895,7 @@ PWSASYNCBLOCK AsyncBlock; INT ErrorCode; DPRINT("WSAAsyncGetProtoByNumber: %lx, %lx, %lx\n", hWnd, wMsg, Port); - + /* Enter prolog */ if ((ErrorCode = WsApiProlog(&Process, &Thread)) != ERROR_SUCCESS) { @@ -948,7 +948,7 @@ PWSTHREAD Thread; INT ErrorCode; DPRINT("WSACancelAsyncRequest: %lx\n", hAsyncTaskHandle); - + /* Enter prolog */ if ((ErrorCode = WsApiProlog(&Process, &Thread)) == ERROR_SUCCESS) { @@ -958,7 +958,7 @@ /* Return */ if (ErrorCode == ERROR_SUCCESS) return ERROR_SUCCESS; } - + /* Fail */ SetLastError(ErrorCode); return SOCKET_ERROR; Modified: trunk/reactos/dll/win32/ws2_32/src/nscatalo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/nscat…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/nscatalo.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/nscatalo.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -282,7 +282,7 @@ } /* Initialize them all */ - for (i = 1; i <= CatalogEntries; i++) + for (i = 1; i <= CatalogEntries; i++) { /* Allocate a Catalog Entry Structure */ CatalogEntry = WsNcEntryAllocate(); @@ -396,12 +396,12 @@ CatalogEntry->DllPath, &CatalogEntry->ProviderId); - /* Ensure success */ - if (ErrorCode == ERROR_SUCCESS) - { - /* Set the provider */ - WsNcEntrySetProvider(CatalogEntry, Provider); - } + /* Ensure success */ + if (ErrorCode == ERROR_SUCCESS) + { + /* Set the provider */ + WsNcEntrySetProvider(CatalogEntry, Provider); + } /* Dereference it */ WsNpDereference(Provider); Modified: trunk/reactos/dll/win32/ws2_32/src/nsprovid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/nspro…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/nsprovid.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/nsprovid.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -17,7 +17,7 @@ WsNqProvAllocate(VOID) { PNSQUERY_PROVIDER Provider; - + /* Allocate the object */ Provider = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Provider)); @@ -63,7 +63,7 @@ WsNpAllocate(VOID) { PNS_PROVIDER Provider; - + /* Allocate the object */ Provider = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*Provider)); @@ -84,7 +84,7 @@ INT ErrorCode = ERROR_SUCCESS; LPNSPSTARTUP NSPStartupProc; CHAR AnsiPath[MAX_PATH], ExpandedDllPath[MAX_PATH]; - + /* Convert the path to ANSI */ WideCharToMultiByte(CP_ACP, 0, @@ -138,7 +138,7 @@ { INT ErrorCode = ERROR_SUCCESS; LPNSPCLEANUP lpNSPCleanup = NULL; - + /* Make sure we have a loaded handle */ if (Provider->DllHandle) { Modified: trunk/reactos/dll/win32/ws2_32/src/nsquery.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/nsque…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/nsquery.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/nsquery.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -22,7 +22,7 @@ WsNqAllocate(VOID) { PNSQUERY NsQuery; - + /* Allocate the object */ NsQuery = HeapAlloc(WsSockHeap, HEAP_ZERO_MEMORY, sizeof(*NsQuery)); @@ -30,7 +30,7 @@ NsQuery->Signature = ~0xBEADFACE; InitializeListHead(&NsQuery->ProviderList); NsQuery->TryAgain = TRUE; - + /* Return it */ return NsQuery; } @@ -73,7 +73,7 @@ { PNSQUERY_PROVIDER Provider; PLIST_ENTRY Entry; - + /* Make sure that we got initialized */ if (!NsQuery->ProviderList.Flink) return; @@ -163,7 +163,7 @@ { PNSQUERY_PROVIDER Provider; PLIST_ENTRY Entry; - + /* Protect us from closure */ WsNqLock(); NsQuery->ShuttingDown = TRUE; @@ -266,7 +266,7 @@ /* Save the current active provider */ Provider = NsQuery->ActiveProvider; - + /* Check if one exists */ if (Provider) { @@ -313,7 +313,7 @@ /* Reset it */ WsNqProvLookupServiceEnd(Provider); WsNqProvDelete(Provider); - } + } /* Start a new query */ if (!WsNqLookupServiceBegin(NsQuery, @@ -322,7 +322,7 @@ NsQuery->Catalog)) { /* New query succeeded, set active provider now */ - NsQuery->ActiveProvider = + NsQuery->ActiveProvider = WsNqNextProvider(NsQuery, NsQuery->ActiveProvider); } @@ -338,7 +338,7 @@ WsNqUnlock(); /* Keep looping as long as there is a provider */ - } while (NextProvider); + } while (NextProvider); } } else @@ -390,7 +390,7 @@ NsQuery->ControlFlags = ControlFlags; NsQuery->Catalog = Catalog; } - + /* Check if we have a specific ID */ if (Restrictions->lpNSProviderId) { @@ -425,7 +425,7 @@ WsNqBeginEnumerationProc, &EnumContext); ErrorCode = EnumContext.ErrorCode; - + /* Check for success */ if (ErrorCode != ERROR_SUCCESS) { @@ -521,7 +521,7 @@ { PNSQUERY_PROVIDER NextProvider = NULL; PLIST_ENTRY Entry; - + /* Get the first entry and get its provider */ Entry = Provider->QueryLink.Flink; if (Entry != &Query->ProviderList) @@ -541,7 +541,7 @@ { PNSQUERY_PROVIDER NextProvider = NULL; PLIST_ENTRY Entry; - + /* Get the first entry and get its provider */ Entry = Provider->QueryLink.Blink; if (Entry != &Query->ProviderList) @@ -561,7 +561,7 @@ { PNSQUERY_PROVIDER QueryProvider; DWORD Return = TRUE; - + /* Allocate a new Query Provider */ if ((QueryProvider = WsNqProvAllocate())) { Modified: trunk/reactos/dll/win32/ws2_32/src/qos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/qos.c…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/qos.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/qos.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -20,8 +20,8 @@ */ BOOL WSAAPI -WSAGetQOSByName(IN SOCKET s, - IN OUT LPWSABUF lpQOSName, +WSAGetQOSByName(IN SOCKET s, + IN OUT LPWSABUF lpQOSName, OUT LPQOS lpQOS) { PWSSOCKET Socket; Modified: trunk/reactos/dll/win32/ws2_32/src/qshelpr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/qshel…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/qshelpr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/qshelpr.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -204,14 +204,14 @@ if (AnsiSet->lpcsaBuffer[i].LocalAddr.lpSockaddr) { /* Align the current size and add the sockaddr's length */ - Size = (Size + 3) & ~3; + Size = (Size + 3) & ~3; Size += AnsiSet->lpcsaBuffer[i].LocalAddr.iSockaddrLength; } /* Check for remote sockaddr */ if (AnsiSet->lpcsaBuffer[i].RemoteAddr.lpSockaddr) { /* Align the current size and add the sockaddr's length */ - Size = (Size + 3) & ~3; + Size = (Size + 3) & ~3; Size += AnsiSet->lpcsaBuffer[i].RemoteAddr.iSockaddrLength; } @@ -825,11 +825,11 @@ ErrorCode = WSA_NOT_ENOUGH_MEMORY; goto error; } - + /* Build the relative buffer version */ ErrorCode = WSABuildQuerySetBufferA(AnsiSet, AnsiSize, AnsiCopy); if (ErrorCode != ERROR_SUCCESS) goto error; - + /* Re-use the ANSI version since the fields match */ UnicodeCopy = (LPWSAQUERYSETW)AnsiCopy; @@ -946,11 +946,11 @@ ErrorCode = WSA_NOT_ENOUGH_MEMORY; goto error; } - + /* Build the relative buffer version */ ErrorCode = WSABuildQuerySetBufferW(UnicodeSet, UnicodeSize, UnicodeCopy); if (ErrorCode != ERROR_SUCCESS) goto error; - + /* Re-use the Unicode version since the fields match */ AnsiCopy = (LPWSAQUERYSETA)UnicodeCopy; Modified: trunk/reactos/dll/win32/ws2_32/src/rasdial.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/rasdi…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/rasdial.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/rasdial.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -110,13 +110,13 @@ if (WsRasDllHandle) { /* Get function pointers */ - lpfnWSAttemptAutodialAddr = + lpfnWSAttemptAutodialAddr = (PVOID)GetProcAddress(WsRasDllHandle, "WSAttemptAutodialAddr"); - lpfnWSAttemptAutodialName = + lpfnWSAttemptAutodialName = (PVOID)GetProcAddress(WsRasDllHandle, "WSAttemptAutodialName"); - lpfnWSNoteSuccessfulHostentLookup = + lpfnWSNoteSuccessfulHostentLookup = (PVOID)GetProcAddress(WsRasDllHandle, "WSNoteSuccessfulHostentLookup"); } Modified: trunk/reactos/dll/win32/ws2_32/src/recv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/recv.…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/recv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/recv.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -45,13 +45,13 @@ /* Make the call */ Status = Socket->Provider->Service.lpWSPRecv(s, - &Buffers, + &Buffers, 1, - &BytesReceived, - (LPDWORD)&flags, + &BytesReceived, + (LPDWORD)&flags, NULL, - NULL, - ThreadId, + NULL, + ThreadId, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); @@ -111,15 +111,15 @@ /* Make the call */ Status = Socket->Provider->Service.lpWSPRecvFrom(s, - &Buffers, + &Buffers, 1, - &BytesReceived, + &BytesReceived, (LPDWORD)&flags, from, fromlen, NULL, - NULL, - ThreadId, + NULL, + ThreadId, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); @@ -174,13 +174,13 @@ { /* Make the call */ Status = Socket->Provider->Service.lpWSPRecv(s, - lpBuffers, + lpBuffers, dwBufferCount, - lpNumberOfBytesRecvd, - lpFlags, + lpNumberOfBytesRecvd, + lpFlags, lpOverlapped, - lpCompletionRoutine, - ThreadId, + lpCompletionRoutine, + ThreadId, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); @@ -275,15 +275,15 @@ { /* Make the call */ Status = Socket->Provider->Service.lpWSPRecvFrom(s, - lpBuffers, + lpBuffers, dwBufferCount, - lpNumberOfBytesRecvd, - lpFlags, + lpNumberOfBytesRecvd, + lpFlags, lpFrom, lpFromlen, lpOverlapped, lpCompletionRoutine, - ThreadId, + ThreadId, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); Modified: trunk/reactos/dll/win32/ws2_32/src/rnr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/rnr.c…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/rnr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/rnr.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -74,7 +74,7 @@ lpsaAddress->sa_family, &CatalogEntry); } - + /* Check for success */ if (ErrorCode == ERROR_SUCCESS) { @@ -167,7 +167,7 @@ lpsaAddress->sa_family, &CatalogEntry); } - + /* Check for success */ if (ErrorCode == ERROR_SUCCESS) { @@ -249,7 +249,7 @@ DPRINT("WSALookupServiceBeginA: %p\n", lpqsRestrictions); /* Verify pointer */ - if (IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)) || + if (IsBadReadPtr(lpqsRestrictions, sizeof(*lpqsRestrictions)) || IsBadReadPtr(lpqsRestrictions->lpServiceClassId, sizeof(*lpqsRestrictions->lpServiceClassId))) { /* Invalid */ @@ -313,7 +313,7 @@ /* * @implemented */ -INT +INT WINAPI WSALookupServiceBeginW(IN LPWSAQUERYSETW lpqsRestrictions, IN DWORD dwControlFlags, @@ -374,7 +374,7 @@ ErrorCode = SOCKET_ERROR; SetLastError(WSAENOBUFS); } - + /* Return */ return ErrorCode; } @@ -864,7 +864,7 @@ /* Get it from the address family */ ErrorCode = WsTcGetEntryFromAf(Catalog, AddressFamily, &CatalogEntry); } - + /* Check for success */ if (ErrorCode == ERROR_SUCCESS) { @@ -943,7 +943,7 @@ /* Get it from the address family */ ErrorCode = WsTcGetEntryFromAf(Catalog, AddressFamily, &CatalogEntry); } - + /* Check for success */ if (ErrorCode == ERROR_SUCCESS) { Modified: trunk/reactos/dll/win32/ws2_32/src/select.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/selec…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/select.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/select.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -38,10 +38,10 @@ */ INT WSAAPI -select(IN INT s, - IN OUT LPFD_SET readfds, - IN OUT LPFD_SET writefds, - IN OUT LPFD_SET exceptfds, +select(IN INT s, + IN OUT LPFD_SET readfds, + IN OUT LPFD_SET writefds, + IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout) { PWSSOCKET Socket; @@ -149,9 +149,9 @@ { /* Make the call */ Status = Socket->Provider->Service.lpWSPAsyncSelect(s, - hWnd, + hWnd, wMsg, - lEvent, + lEvent, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); Modified: trunk/reactos/dll/win32/ws2_32/src/send.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/send.…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/send.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/send.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -20,9 +20,9 @@ */ INT WSAAPI -send(IN SOCKET s, - IN CONST CHAR FAR* buf, - IN INT len, +send(IN SOCKET s, + IN CONST CHAR FAR* buf, + IN INT len, IN INT flags) { PWSSOCKET Socket; @@ -45,13 +45,13 @@ /* Make the call */ Status = Socket->Provider->Service.lpWSPSend(s, - &Buffers, + &Buffers, 1, - &BytesSent, - (DWORD)flags, + &BytesSent, + (DWORD)flags, NULL, - NULL, - ThreadId, + NULL, + ThreadId, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); @@ -83,7 +83,7 @@ IN CONST CHAR FAR* buf, IN INT len, IN INT flags, - IN CONST struct sockaddr *to, + IN CONST struct sockaddr *to, IN INT tolen) { PWSSOCKET Socket; @@ -106,15 +106,15 @@ /* Make the call */ Status = Socket->Provider->Service.lpWSPSendTo(s, - &Buffers, + &Buffers, 1, - &BytesSent, + &BytesSent, (DWORD)flags, to, tolen, NULL, - NULL, - ThreadId, + NULL, + ThreadId, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); @@ -164,13 +164,13 @@ { /* Make the call */ Status = Socket->Provider->Service.lpWSPSend(s, - lpBuffers, + lpBuffers, dwBufferCount, - lpNumberOfBytesSent, - dwFlags, + lpNumberOfBytesSent, + dwFlags, lpOverlapped, - lpCompletionRoutine, - ThreadId, + lpCompletionRoutine, + ThreadId, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); @@ -268,15 +268,15 @@ { /* Make the call */ Status = Socket->Provider->Service.lpWSPSendTo(s, - lpBuffers, + lpBuffers, dwBufferCount, - lpNumberOfBytesSent, - dwFlags, + lpNumberOfBytesSent, + dwFlags, lpTo, iToLen, lpOverlapped, - lpCompletionRoutine, - ThreadId, + lpCompletionRoutine, + ThreadId, &ErrorCode); /* Deference the Socket Context */ WsSockDereference(Socket); Modified: trunk/reactos/dll/win32/ws2_32/src/socklife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/sockl…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/socklife.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/socklife.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -50,7 +50,7 @@ { /* Make the call */ Status = Socket->Provider->Service.lpWSPBind(s, - name, + name, namelen, &ErrorCode); /* Deference the Socket Context */ @@ -441,8 +441,8 @@ LPWSAPROTOCOL_INFOW p = &ProtocolInfoW; /* Convert Protocol Info to Wide */ - if (lpProtocolInfo) - { + if (lpProtocolInfo) + { /* Copy the Data */ memcpy(&ProtocolInfoW, lpProtocolInfo, @@ -455,8 +455,8 @@ -1, ProtocolInfoW.szProtocol, sizeof(ProtocolInfoW.szProtocol) / sizeof(WCHAR)); - } - else + } + else { /* No Protocol Info Specified */ p = NULL; @@ -475,7 +475,7 @@ * @implemented */ SOCKET -WSAAPI +WSAAPI WSASocketW(IN INT af, IN INT type, IN INT protocol, @@ -506,8 +506,8 @@ Catalog = WsProcGetTCatalog(Process); /* Find a Provider for the Catalog ID */ - if (lpProtocolInfo) - { + if (lpProtocolInfo) + { /* Get the catalog ID */ CatalogId = lpProtocolInfo->dwCatalogEntryId; @@ -516,8 +516,8 @@ CatalogId, &CatalogEntry); } - else - { + else + { /* No ID */ CatalogId = 0; @@ -558,8 +558,8 @@ WsTcEntryDereference(CatalogEntry); /* Did we fail with WSAEINPROGRESS and had no specific provider? */ - if ((Status == INVALID_SOCKET) && - (ErrorCode == WSAEINPROGRESS) && + if ((Status == INVALID_SOCKET) && + (ErrorCode == WSAEINPROGRESS) && !(lpProtocolInfo)) { /* In that case, restart the lookup from this ID */ Modified: trunk/reactos/dll/win32/ws2_32/src/startup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/start…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/startup.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/startup.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -42,8 +42,8 @@ /* * @implemented */ -BOOL -WSAAPI +BOOL +WSAAPI WSApSetPostRoutine(PVOID Routine) { /* Set the post routine */ @@ -180,7 +180,7 @@ lstrcpy(lpWSAData->szDescription, "WinSock 2.0"); lstrcpy(lpWSAData->szSystemStatus, "Running"); - /* + /* * On Winsock 1, the following values are returned. * Taken straight from a Winsock Test app on Windows. */ @@ -188,13 +188,13 @@ { lpWSAData->iMaxSockets = 32767; lpWSAData->iMaxUdpDg = 65467; - } + } else { lpWSAData->iMaxSockets = 0; lpWSAData->iMaxUdpDg = 0; } - + /* Requested invalid version (0) */ if (ErrorCode != ERROR_SUCCESS) { Modified: trunk/reactos/dll/win32/ws2_32/src/wsautil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/src/wsaut…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/src/wsautil.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/src/wsautil.c [iso-8859-1] Fri Mar 3 00:13:40 2017 @@ -26,7 +26,7 @@ 0, MAXIMUM_ALLOWED, &WinsockRootKey); - + /* Check if it wasn't found */ if (ErrorCode == ERROR_FILE_NOT_FOUND) {
7 years, 9 months
1
0
0
0
[mjansen] 74032: [NTDLL] Some style changes for RtlNtPathNameToDosPathName as suggested by Thomas and Hermes. CORE-12847
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Mar 2 21:51:22 2017 New Revision: 74032 URL:
http://svn.reactos.org/svn/reactos?rev=74032&view=rev
Log: [NTDLL] Some style changes for RtlNtPathNameToDosPathName as suggested by Thomas and Hermes. CORE-12847 Modified: trunk/reactos/sdk/include/ndk/rtlfuncs.h trunk/reactos/sdk/lib/rtl/path.c trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c Modified: trunk/reactos/sdk/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ndk/rtlfuncs.h…
============================================================================== --- trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] Thu Mar 2 21:51:22 2017 @@ -2828,9 +2828,9 @@ NTAPI RtlNtPathNameToDosPathName( _In_ ULONG Flags, - _Inout_ RTL_UNICODE_STRING_BUFFER* Path, - _Out_opt_ ULONG* PathType, - _Out_opt_ ULONG* Unknown + _Inout_ PRTL_UNICODE_STRING_BUFFER Path, + _Out_opt_ PULONG PathType, + _Out_opt_ PULONG Unknown ); Modified: trunk/reactos/sdk/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/path.c?rev=740…
============================================================================== --- trunk/reactos/sdk/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/rtl/path.c [iso-8859-1] Thu Mar 2 21:51:22 2017 @@ -1792,9 +1792,9 @@ * @implemented */ NTSTATUS NTAPI RtlNtPathNameToDosPathName(IN ULONG Flags, - IN OUT RTL_UNICODE_STRING_BUFFER* Path, - OUT ULONG* PathType, - ULONG* Unknown) + IN OUT PRTL_UNICODE_STRING_BUFFER Path, + OUT PULONG PathType, + PULONG Unknown) { PCUNICODE_STRING UsePrefix = NULL, AlternatePrefix = NULL; @@ -1812,7 +1812,7 @@ if (PathType) *PathType = RTL_CONVERTED_UNC_PATH; } - else if (RtlPrefixUnicodeString(&RtlpDosDevicesPrefix, &Path->String, TRUE)) + else if (RtlPrefixUnicodeString(&RtlpDosDevicesPrefix, &Path->String, FALSE)) { UsePrefix = &RtlpDosDevicesPrefix; if (PathType) Modified: trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlNtPathN…
============================================================================== --- trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c [iso-8859-1] (original) +++ trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c [iso-8859-1] Thu Mar 2 21:51:22 2017 @@ -10,7 +10,7 @@ #define WIN32_NO_STATUS #include <ndk/rtlfuncs.h> -NTSTATUS (NTAPI *pRtlNtPathNameToDosPathName)(ULONG Flags, RTL_UNICODE_STRING_BUFFER* Path, ULONG* Type, ULONG* Unknown4); +NTSTATUS (NTAPI *pRtlNtPathNameToDosPathName)(ULONG Flags, PRTL_UNICODE_STRING_BUFFER Path, PULONG Type, PULONG Unknown4); #define ok_hex_(expression, result) \ do { \
7 years, 9 months
1
0
0
0
[mjansen] 74031: [NTDLL] Add implementation for RtlNtPathNameToDosPathName. CORE-12847 #resolve
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Mar 2 21:29:38 2017 New Revision: 74031 URL:
http://svn.reactos.org/svn/reactos?rev=74031&view=rev
Log: [NTDLL] Add implementation for RtlNtPathNameToDosPathName. CORE-12847 #resolve Modified: trunk/reactos/dll/ntdll/def/ntdll.spec trunk/reactos/sdk/include/ndk/rtlfuncs.h trunk/reactos/sdk/lib/rtl/path.c trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c Modified: trunk/reactos/dll/ntdll/def/ntdll.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Thu Mar 2 21:29:38 2017 @@ -784,7 +784,7 @@ 779 stdcall RtlNewSecurityObjectEx(ptr ptr ptr ptr long long ptr ptr) 780 stdcall RtlNewSecurityObjectWithMultipleInheritance(ptr ptr ptr ptr long long long ptr ptr) 781 stdcall RtlNormalizeProcessParams(ptr) -782 stdcall RtlNtPathNameToDosPathName(ptr ptr ptr ptr) ; CHECKME +782 stdcall RtlNtPathNameToDosPathName(long ptr ptr ptr) ; CHECKME (last arg) 783 stdcall RtlNtStatusToDosError(long) 784 stdcall RtlNtStatusToDosErrorNoTeb(long) 785 stdcall RtlNumberGenericTableElements(ptr) Modified: trunk/reactos/sdk/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ndk/rtlfuncs.h…
============================================================================== --- trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] Thu Mar 2 21:29:38 2017 @@ -2816,6 +2816,23 @@ _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo ); + + +#define RTL_UNCHANGED_UNK_PATH 1 +#define RTL_CONVERTED_UNC_PATH 2 +#define RTL_CONVERTED_NT_PATH 3 +#define RTL_UNCHANGED_DOS_PATH 4 + +NTSYSAPI +NTSTATUS +NTAPI +RtlNtPathNameToDosPathName( + _In_ ULONG Flags, + _Inout_ RTL_UNICODE_STRING_BUFFER* Path, + _Out_opt_ ULONG* PathType, + _Out_opt_ ULONG* Unknown +); + NTSYSAPI BOOLEAN Modified: trunk/reactos/sdk/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/path.c?rev=740…
============================================================================== --- trunk/reactos/sdk/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/rtl/path.c [iso-8859-1] Thu Mar 2 21:29:38 2017 @@ -44,6 +44,8 @@ const UNICODE_STRING RtlpDosAUXDevice = RTL_CONSTANT_STRING(L"AUX"); const UNICODE_STRING RtlpDosCONDevice = RTL_CONSTANT_STRING(L"CON"); const UNICODE_STRING RtlpDosNULDevice = RTL_CONSTANT_STRING(L"NUL"); + +const UNICODE_STRING RtlpDoubleSlashPrefix = RTL_CONSTANT_STRING(L"\\\\"); PRTLP_CURDIR_REF RtlpCurDirRef; @@ -1787,13 +1789,89 @@ } /* - * @unimplemented + * @implemented */ -NTSTATUS NTAPI -RtlNtPathNameToDosPathName(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3, ULONG Unknown4) -{ - DPRINT1("RtlNtPathNameToDosPathName: stub\n"); - return STATUS_NOT_IMPLEMENTED; +NTSTATUS NTAPI RtlNtPathNameToDosPathName(IN ULONG Flags, + IN OUT RTL_UNICODE_STRING_BUFFER* Path, + OUT ULONG* PathType, + ULONG* Unknown) +{ + PCUNICODE_STRING UsePrefix = NULL, AlternatePrefix = NULL; + + if (PathType) + *PathType = 0; + + if (!Path || Flags) + return STATUS_INVALID_PARAMETER; + + /* The initial check is done on Path->String */ + if (RtlPrefixUnicodeString(&RtlpDosDevicesUncPrefix, &Path->String, TRUE)) + { + UsePrefix = &RtlpDosDevicesUncPrefix; + AlternatePrefix = &RtlpDoubleSlashPrefix; + if (PathType) + *PathType = RTL_CONVERTED_UNC_PATH; + } + else if (RtlPrefixUnicodeString(&RtlpDosDevicesPrefix, &Path->String, TRUE)) + { + UsePrefix = &RtlpDosDevicesPrefix; + if (PathType) + *PathType = RTL_CONVERTED_NT_PATH; + } + + if (UsePrefix) + { + NTSTATUS Status; + + USHORT Len = Path->String.Length - UsePrefix->Length; + if (AlternatePrefix) + Len += AlternatePrefix->Length; + + Status = RtlEnsureBufferSize(0, &Path->ByteBuffer, Len); + if (!NT_SUCCESS(Status)) + return Status; + + if (Len + sizeof(UNICODE_NULL) <= Path->ByteBuffer.Size) + { + /* Then, the contents of Path->ByteBuffer are always used... */ + if (AlternatePrefix) + { + memcpy(Path->ByteBuffer.Buffer, AlternatePrefix->Buffer, AlternatePrefix->Length); + memmove(Path->ByteBuffer.Buffer + AlternatePrefix->Length, Path->ByteBuffer.Buffer + UsePrefix->Length, + Len - AlternatePrefix->Length); + } + else + { + memmove(Path->ByteBuffer.Buffer, Path->ByteBuffer.Buffer + UsePrefix->Length, Len); + } + Path->String.Buffer = (PWSTR)Path->ByteBuffer.Buffer; + Path->String.Length = Len; + Path->String.MaximumLength = Path->ByteBuffer.Size; + Path->String.Buffer[Len / sizeof(WCHAR)] = UNICODE_NULL; + } + return STATUS_SUCCESS; + } + + if (PathType) + { + switch (RtlDetermineDosPathNameType_Ustr(&Path->String)) + { + case RtlPathTypeUncAbsolute: + case RtlPathTypeDriveAbsolute: + case RtlPathTypeLocalDevice: + case RtlPathTypeRootLocalDevice: + *PathType = RTL_UNCHANGED_DOS_PATH; + break; + case RtlPathTypeUnknown: + case RtlPathTypeDriveRelative: + case RtlPathTypeRooted: + case RtlPathTypeRelative: + *PathType = RTL_UNCHANGED_UNK_PATH; + break; + } + } + + return STATUS_SUCCESS; } /* Modified: trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlNtPathN…
============================================================================== --- trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c [iso-8859-1] (original) +++ trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c [iso-8859-1] Thu Mar 2 21:29:38 2017 @@ -42,11 +42,6 @@ int Line; }; - -#define RTL_UNCHANGED_UNK_PATH 1 -#define RTL_CONVERTED_UNC_PATH 2 -#define RTL_CONVERTED_NT_PATH 3 -#define RTL_UNCHANGED_DOS_PATH 4 static struct test_entry test_data[] = {
7 years, 9 months
1
0
0
0
[mjansen] 74030: [NTDLL_APITEST] Add tests for RtlNtPathNameToDosPathName. CORE-12847
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Mar 2 20:43:09 2017 New Revision: 74030 URL:
http://svn.reactos.org/svn/reactos?rev=74030&view=rev
Log: [NTDLL_APITEST] Add tests for RtlNtPathNameToDosPathName. CORE-12847 Added: trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c (with props) Modified: trunk/rostests/apitests/ntdll/CMakeLists.txt trunk/rostests/apitests/ntdll/testlist.c Modified: trunk/rostests/apitests/ntdll/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/CMakeLists…
============================================================================== --- trunk/rostests/apitests/ntdll/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/ntdll/CMakeLists.txt [iso-8859-1] Thu Mar 2 20:43:09 2017 @@ -43,6 +43,7 @@ RtlInitializeBitMap.c RtlIsNameLegalDOS8Dot3.c RtlMemoryStream.c + RtlNtPathNameToDosPathName.c RtlpEnsureBufferSize.c RtlReAllocateHeap.c RtlUpcaseUnicodeStringToCountedOemString.c Added: trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlNtPathN…
============================================================================== --- trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c (added) +++ trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c [iso-8859-1] Thu Mar 2 20:43:09 2017 @@ -0,0 +1,447 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for RtlNtPathNameToDosPathName + * PROGRAMMER: Mark Jansen + */ + +#include <apitest.h> + +#define WIN32_NO_STATUS +#include <ndk/rtlfuncs.h> + +NTSTATUS (NTAPI *pRtlNtPathNameToDosPathName)(ULONG Flags, RTL_UNICODE_STRING_BUFFER* Path, ULONG* Type, ULONG* Unknown4); + +#define ok_hex_(expression, result) \ + do { \ + int _value = (expression); \ + winetest_ok(_value == (result), "Wrong value for '%s', expected: " #result " (0x%x), got: 0x%x\n", \ + #expression, (int)(result), _value); \ + } while (0) + + +#define ok_ptr_(expression, result) \ + do { \ + void *_value = (expression); \ + winetest_ok(_value == (result), "Wrong value for '%s', expected: " #result " (%p), got: %p\n", \ + #expression, (void*)(result), _value); \ + } while (0) + +#define ok_wstr_(x, y) \ + winetest_ok(wcscmp(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x) + + + +struct test_entry +{ + WCHAR* InputPath; + WCHAR* OutputPath; + ULONG Type; + + const char* File; + int Line; +}; + + +#define RTL_UNCHANGED_UNK_PATH 1 +#define RTL_CONVERTED_UNC_PATH 2 +#define RTL_CONVERTED_NT_PATH 3 +#define RTL_UNCHANGED_DOS_PATH 4 + +static struct test_entry test_data[] = +{ + /* Originally from RtlGetFullPathName_*.c (edited) */ + { L"", L"", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L".\\test", L".\\test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/test", L"/test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"??\\", L"??\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"??\\C:", L"??\\C:", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"??\\C:\\", L"??\\C:\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"??\\C:\\test", L"??\\C:\\test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"??\\C:\\test\\", L"??\\C:\\test\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"C:", L"C:", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"C:/test/", L"C:/test/", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\", L"C:\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\", L"C:\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\\\test", L"C:\\\\test", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\test", L"C:\\test", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\test", L"C:\\test", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\test", L"C:\\test", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\test\\", L"C:\\test\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\test\\", L"C:\\test\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\test\\", L"C:\\test\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\.", L"\\.", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\", L"\\.\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\??\\", L"", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\??\\C:", L"C:", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\??\\C:\\", L"C:\\", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\??\\C:\\test", L"C:\\test", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\??\\C:\\test\\", L"C:\\test\\", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\\\.", L"\\\\.", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\.\\", L"\\\\.\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\.\\", L"\\\\.\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\.\\", L"\\\\.\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\.\\Something\\", L"\\\\.\\Something\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\.\\Something\\", L"\\\\.\\Something\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\", L"\\\\??\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\", L"\\\\??\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:", L"\\\\??\\C:", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:", L"\\\\??\\C:", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:\\", L"\\\\??\\C:\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:\\", L"\\\\??\\C:\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:\\test", L"\\\\??\\C:\\test", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:\\test", L"\\\\??\\C:\\test", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:\\test\\", L"\\\\??\\C:\\test\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:\\test\\", L"\\\\??\\C:\\test\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\test", L"\\test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\test", L"\\test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\test", L"\\test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"test", L"test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"test", L"test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"test", L"test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + + /* Originally from RtlDetermineDosPathNameType.c (edited) */ + { L"", L"", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L" ", L" ", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"xyz", L"xyz", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"CON", L"CON", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"NUL", L"NUL", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L":", L":", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"::", L"::", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L":::", L":::", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"::::", L"::::", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"::\\", L"::\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\", L"\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\:", L"\\:", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\C:", L"\\C:", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\C:\\", L"\\C:\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/", L"/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/:", L"/:", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/C:", L"/C:", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/C:/", L"/C:/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"C", L"C", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"C:", L"C:", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"C:a", L"C:a", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"C:a\\", L"C:a\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"C:\\", L"C:\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:/", L"C:/", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\a", L"C:\\a", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:/a", L"C:/a", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"C:\\\\", L"C:\\\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\", L"\\\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\\\", L"\\\\\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\;", L"\\\\;", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\f\\b\\", L"\\\\f\\b\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\f\\b", L"\\\\f\\b", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\f\\", L"\\\\f\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\f", L"\\\\f", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\??\\UNC", L"UNC", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\??\\UNC\\", L"\\\\", RTL_CONVERTED_UNC_PATH, __FILE__, __LINE__ }, + { L"\\??\\UNC\\pth1\\pth2", L"\\\\pth1\\pth2", RTL_CONVERTED_UNC_PATH, __FILE__, __LINE__ }, + { L"\\??\\UNC\\path1", L"\\\\path1", RTL_CONVERTED_UNC_PATH, __FILE__, __LINE__ }, + { L"\\?", L"\\?", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\?\\", L"\\?\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\?\\UNC", L"\\?\\UNC", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\?\\UNC\\", L"\\?\\UNC\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\\\?\\UNC\\", L"\\\\?\\UNC\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\??\\unc", L"unc", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\??\\unc\\", L"\\\\", RTL_CONVERTED_UNC_PATH, __FILE__, __LINE__ }, + { L"\\??\\unc\\pth1\\pth2", L"\\\\pth1\\pth2", RTL_CONVERTED_UNC_PATH, __FILE__, __LINE__ }, + { L"\\??\\unc\\path1", L"\\\\path1", RTL_CONVERTED_UNC_PATH, __FILE__, __LINE__ }, + { L"\\?", L"\\?", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\?\\", L"\\?\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\?\\unc", L"\\?\\unc", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\?\\unc\\", L"\\?\\unc\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\\\?\\unc\\", L"\\\\?\\unc\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\?", L"\\\\?", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??", L"\\\\??", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\", L"\\\\??\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\??\\C:\\", L"\\\\??\\C:\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\.", L"\\\\.", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\.\\", L"\\\\.\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\\\.\\C:\\", L"\\\\.\\C:\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\/", L"\\/", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"/\\", L"/\\", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//", L"//", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"///", L"///", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//;", L"//;", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//?", L"//?", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"/\\?", L"/\\?", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\/?", L"\\/?", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//??", L"//??", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//?" L"?/", L"//?" L"?/", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//?" L"?/C:/", L"//?" L"?/C:/", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//.", L"//.", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"\\/.", L"\\/.", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"/\\.", L"/\\.", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//./", L"//./", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"//./C:/", L"//./C:/", RTL_UNCHANGED_DOS_PATH, __FILE__, __LINE__ }, + { L"%SystemRoot%", L"%SystemRoot%", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + + + /* Tests from RtlGetLengthWithoutTrailingPathSeperators.c */ + { L"", L"", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"T", L"T", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"Te", L"Te", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"Tes", L"Tes", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"Test", L"Test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + + /* Separators tests */ + { L"\\.", L"\\.", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.", L"\\.", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\", L"\\.\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\T", L"\\.\\T", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Te", L"\\.\\Te", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Tes", L"\\.\\Tes", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Test", L"\\.\\Test", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Test\\", L"\\.\\Test\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Test\\s", L"\\.\\Test\\s", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\T\\est", L"\\.\\T\\est", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\T\\e\\st", L"\\.\\T\\e\\st", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\T\\e\\s\\t", L"\\.\\T\\e\\s\\t", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\T\\e\\s\\t\\", L"\\.\\T\\e\\s\\t\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Tests\\String\\", L"\\Tests\\String\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Test\\String\\", L"\\.\\Test\\String\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Tests\\String\\", L"\\.\\Tests\\String\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Tests\\String\\s", L"\\.\\Tests\\String\\s", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + + /* Separator-only tests */ + { L"\\", L"\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/", L"/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + + /* Mixed separators tests */ + { L"/Test/String", L"/Test/String", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test/String", L"\\Test/String", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/Test\\String", L"/Test\\String", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test/String", L"\\Test/String", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/Test/String\\", L"/Test/String\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test/String\\", L"\\Test/String\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/Test\\String\\", L"/Test\\String\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test/String\\", L"\\Test/String\\", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/Test/String/", L"/Test/String/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test/String/", L"\\Test/String/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"/Test\\String/", L"/Test\\String/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test/String/", L"\\Test/String/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test/String/", L"\\Test/String/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test\\\\String/", L"\\Test\\\\String/", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + + /* Common path formats tests */ + { L"Test\\String", L"Test\\String", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\Test\\String", L"\\Test\\String", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L".\\Test\\String", L".\\Test\\String", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\.\\Test\\String", L"\\.\\Test\\String", RTL_UNCHANGED_UNK_PATH, __FILE__, __LINE__ }, + { L"\\??\\Test\\String", L"Test\\String", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + + /* Redundant trailing tests */ + { L"\\??\\Test\\String\\", L"Test\\String\\", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\??\\Test\\String\\\\",L"Test\\String\\\\", RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, + { L"\\??\\Test\\String\\\\\\\\\\", L"Test\\String\\\\\\\\\\",RTL_CONVERTED_NT_PATH, __FILE__, __LINE__ }, +}; + + +static void test_specialhandling() +{ + RTL_UNICODE_STRING_BUFFER Buffer; + const WCHAR TestString[] = L"\\??\\C:\\Test"; + WCHAR StaticBuffer[_countof(TestString)]; + ULONG Type; + //PUCHAR Ptr; + + /* Just initializing the ByteBuffer does not work */ + memset(&Buffer, 0, sizeof(Buffer)); + RtlInitBuffer(&Buffer.ByteBuffer, (PUCHAR)StaticBuffer, sizeof(StaticBuffer)); + memcpy(StaticBuffer, TestString, sizeof(TestString)); + Type = 0x12345; + + ok_hex(pRtlNtPathNameToDosPathName(0, &Buffer, &Type, NULL), STATUS_SUCCESS); + ok_hex(Type, RTL_UNCHANGED_UNK_PATH); + ok_ptr(Buffer.String.Buffer, NULL); + ok_int(Buffer.String.Length, 0); + ok_int(Buffer.String.MaximumLength, 0); + ok_ptr(Buffer.ByteBuffer.Buffer, Buffer.ByteBuffer.StaticBuffer); + ok_int(Buffer.ByteBuffer.Size, Buffer.ByteBuffer.StaticSize); + RtlFreeBuffer(&Buffer.ByteBuffer); + + /* Different strings in the String and ByteBuffer part */ + memset(&Buffer, 0, sizeof(Buffer)); + RtlInitBuffer(&Buffer.ByteBuffer, (PUCHAR)StaticBuffer, sizeof(StaticBuffer)); + memcpy(StaticBuffer, TestString, sizeof(TestString)); + Type = 0x12345; + + RtlInitUnicodeString(&Buffer.String, L"\\??\\D:\\1234"); + + ok_hex(pRtlNtPathNameToDosPathName(0, &Buffer, &Type, NULL), STATUS_SUCCESS); + ok_hex(Type, RTL_CONVERTED_NT_PATH); + ok_wstr(Buffer.String.Buffer, L"C:\\Test"); + ok_int(Buffer.String.Length, 14); + ok_int(Buffer.String.MaximumLength, 24); + ok_ptr(Buffer.ByteBuffer.Buffer, Buffer.ByteBuffer.StaticBuffer); + ok_int(Buffer.ByteBuffer.Size, Buffer.ByteBuffer.StaticSize); + RtlFreeBuffer(&Buffer.ByteBuffer); + + + /* Different strings, Buffer.String is not prefixed with \??\ */ + memset(&Buffer, 0, sizeof(Buffer)); + RtlInitBuffer(&Buffer.ByteBuffer, (PUCHAR)StaticBuffer, sizeof(StaticBuffer)); + memcpy(StaticBuffer, TestString, sizeof(TestString)); + Type = 0x12345; + + RtlInitUnicodeString(&Buffer.String, L"D:\\1234"); + + ok_hex(pRtlNtPathNameToDosPathName(0, &Buffer, &Type, NULL), STATUS_SUCCESS); + ok_hex(Type, RTL_UNCHANGED_DOS_PATH); + ok_wstr(Buffer.String.Buffer, L"D:\\1234"); + ok_int(Buffer.String.Length, 14); + ok_int(Buffer.String.MaximumLength, 16); + ok_ptr(Buffer.ByteBuffer.Buffer, Buffer.ByteBuffer.StaticBuffer); + ok_int(Buffer.ByteBuffer.Size, Buffer.ByteBuffer.StaticSize); + RtlFreeBuffer(&Buffer.ByteBuffer); + + + /* Different strings, smaller ByteBuffer */ + memset(&Buffer, 0, sizeof(Buffer)); + RtlInitBuffer(&Buffer.ByteBuffer, (PUCHAR)StaticBuffer, sizeof(StaticBuffer)); + memcpy(StaticBuffer, TestString, sizeof(TestString)); + Type = 0x12345; + + RtlInitUnicodeString(&Buffer.String, L"\\??\\D:\\1234"); + Buffer.ByteBuffer.Size -= 4 * sizeof(WCHAR); + + ok_hex(pRtlNtPathNameToDosPathName(0, &Buffer, &Type, NULL), STATUS_SUCCESS); + ok_hex(Type, RTL_CONVERTED_NT_PATH); + ok_wstr(Buffer.String.Buffer, L"C:\\Test"); + ok_int(Buffer.String.Length, 14); + ok_ptr(Buffer.ByteBuffer.Buffer, Buffer.ByteBuffer.StaticBuffer); + ok_int(Buffer.ByteBuffer.Size, Buffer.ByteBuffer.StaticSize - 4 * sizeof(WCHAR)); + RtlFreeBuffer(&Buffer.ByteBuffer); + + + /* These tests show that the size of the ByteBuffer should + at least equal the size of the string (minus 4, in case of \??\)! + The results are all over the place, and are most likely the result of implementation details.. */ + +#if 0 + /* Different strings, too small ByteBuffer + --> corrupt buffer, but none of the output params suggests so? */ + memset(&Buffer, 0, sizeof(Buffer)); + Buffer.ByteBuffer.Size = wcslen(TestString) * sizeof(WCHAR) + sizeof(UNICODE_NULL); + Buffer.ByteBuffer.Buffer = Ptr = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, Buffer.ByteBuffer.Size); + memcpy(Buffer.ByteBuffer.Buffer, TestString, Buffer.ByteBuffer.Size); + Type = 0x12345; + + RtlInitUnicodeString(&Buffer.String, L"\\??\\D:\\1234"); + Buffer.ByteBuffer.Size -= 5 * sizeof(WCHAR); + + ok_hex(pRtlNtPathNameToDosPathName(0, &Buffer, &Type, NULL), STATUS_SUCCESS); + ok_hex(Type, RTL_CONVERTED_NT_PATH); + //ok_wstr(Buffer.String.Buffer, L"C:\\"); + ok_int(Buffer.String.Length, 14); + ok_int(Buffer.String.MaximumLength, 16); + //ok_ptr(Buffer.ByteBuffer.Buffer, Ptr); // An attempt is made at allocating a buffer, but the move fails because the size of ByteBuffer seems to be used?? + ok_int(Buffer.ByteBuffer.Size, 16); + + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer.ByteBuffer.Buffer); + + /* Different strings, too small ByteBuffer, different path separators + --> corrupt buffer, but none of the output params suggests so? */ + memset(&Buffer, 0, sizeof(Buffer)); + Buffer.ByteBuffer.Size = wcslen(L"\\??\\C://Test") * sizeof(WCHAR) + sizeof(UNICODE_NULL); + Buffer.ByteBuffer.Buffer = Ptr = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, Buffer.ByteBuffer.Size); + memcpy(Buffer.ByteBuffer.Buffer, L"\\??\\C://Test", Buffer.ByteBuffer.Size); + Type = 0x12345; + + RtlInitUnicodeString(&Buffer.String, L"\\??\\D:\\1234"); + Buffer.ByteBuffer.Size -= 5 * sizeof(WCHAR); + + ok_hex(pRtlNtPathNameToDosPathName(0, &Buffer, &Type, NULL), STATUS_SUCCESS); + ok_hex(Type, RTL_CONVERTED_NT_PATH); + //ok_wstr(Buffer.String.Buffer, L"C:\\"); + ok_int(Buffer.String.Length, 14); + ok_int(Buffer.String.MaximumLength, 16); + ok_ptr(Buffer.ByteBuffer.Buffer, Ptr); + ok_int(Buffer.ByteBuffer.Size, 16); + + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer.ByteBuffer.Buffer); +#endif +} + +static void test_table(struct test_entry* Entry) +{ + RTL_UNICODE_STRING_BUFFER Buffer = { { 0 } }; + WCHAR StaticBuffer[MAX_PATH]; + ULONG Type = 0x12345; + + RtlInitBuffer(&Buffer.ByteBuffer, (PUCHAR)StaticBuffer, sizeof(StaticBuffer)); + + RtlInitUnicodeString(&Buffer.String, Entry->InputPath); + RtlEnsureBufferSize(RTL_SKIP_BUFFER_COPY, &Buffer.ByteBuffer, Buffer.String.MaximumLength); + memcpy(Buffer.ByteBuffer.Buffer, Buffer.String.Buffer, Buffer.String.MaximumLength); + + ok_hex_(pRtlNtPathNameToDosPathName(0, &Buffer, &Type, NULL), STATUS_SUCCESS); + + ok_hex_(Type, Entry->Type); + ok_wstr_(Buffer.String.Buffer, Entry->OutputPath); + /* If there is no change in the path, the pointer is unchanged */ + if (!wcscmp(Entry->InputPath, Entry->OutputPath)) + { + ok_ptr_(Buffer.String.Buffer, Entry->InputPath); + } + else + { + /* If there is a change in the path, the 'ByteBuffer' is used */ + winetest_ok((PUCHAR)Buffer.String.Buffer >= Buffer.ByteBuffer.StaticBuffer && + (PUCHAR)Buffer.String.Buffer <= (Buffer.ByteBuffer.StaticBuffer + Buffer.ByteBuffer.StaticSize), + "Expected Buffer to point inside StaticBuffer\n"); + } + ok_wstr_((const WCHAR *)Buffer.ByteBuffer.Buffer, Entry->OutputPath); + + ok_hex_(Buffer.MinimumStaticBufferForTerminalNul, 0); + + /* For none of our tests should we exceed the StaticBuffer size! */ + ok_ptr_(Buffer.ByteBuffer.Buffer, Buffer.ByteBuffer.StaticBuffer); + ok_hex_(Buffer.ByteBuffer.Size, Buffer.ByteBuffer.StaticSize); + + ok_hex_(Buffer.ByteBuffer.ReservedForAllocatedSize, 0); + ok_ptr_(Buffer.ByteBuffer.ReservedForIMalloc, NULL); + + RtlFreeBuffer(&Buffer.ByteBuffer); +} + + +START_TEST(RtlNtPathNameToDosPathName) +{ + RTL_UNICODE_STRING_BUFFER Buffer = { { 0 } }; + ULONG Type; + size_t n; + + HMODULE ntdll = GetModuleHandleW(L"ntdll.dll"); + pRtlNtPathNameToDosPathName = (void *)GetProcAddress(ntdll, "RtlNtPathNameToDosPathName"); + + if (!pRtlNtPathNameToDosPathName) + { + skip("RtlNtPathNameToDosPathName not found?\n"); + return; + } + + ok_ntstatus(pRtlNtPathNameToDosPathName(0, NULL, NULL, NULL), STATUS_INVALID_PARAMETER); + ok_ntstatus(pRtlNtPathNameToDosPathName(0, &Buffer, NULL, NULL), STATUS_SUCCESS); + ok_ntstatus(pRtlNtPathNameToDosPathName(1, &Buffer, NULL, NULL), STATUS_INVALID_PARAMETER); + + Type = 0x12345; + ok_ntstatus(pRtlNtPathNameToDosPathName(0, NULL, &Type, NULL), STATUS_INVALID_PARAMETER); + ok_int(Type, 0); + Type = 0x12345; + ok_ntstatus(pRtlNtPathNameToDosPathName(0, &Buffer, &Type, NULL), STATUS_SUCCESS); + ok_int(Type, RTL_UNCHANGED_UNK_PATH); + Type = 0x12345; + ok_ntstatus(pRtlNtPathNameToDosPathName(1, &Buffer, &Type, NULL), STATUS_INVALID_PARAMETER); + ok_int(Type, 0); + + test_specialhandling(); + + for (n = 0; n < _countof(test_data); ++n) + { + winetest_set_location(test_data[n].File, test_data[n].Line); + test_table(test_data + n); + } +} Propchange: trunk/rostests/apitests/ntdll/RtlNtPathNameToDosPathName.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/ntdll/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/testlist.c…
============================================================================== --- trunk/rostests/apitests/ntdll/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/ntdll/testlist.c [iso-8859-1] Thu Mar 2 20:43:09 2017 @@ -47,6 +47,7 @@ extern void func_RtlInitializeBitMap(void); extern void func_RtlIsNameLegalDOS8Dot3(void); extern void func_RtlMemoryStream(void); +extern void func_RtlNtPathNameToDosPathName(void); extern void func_RtlpEnsureBufferSize(void); extern void func_RtlReAllocateHeap(void); extern void func_RtlUpcaseUnicodeStringToCountedOemString(void); @@ -99,6 +100,7 @@ { "RtlInitializeBitMap", func_RtlInitializeBitMap }, { "RtlIsNameLegalDOS8Dot3", func_RtlIsNameLegalDOS8Dot3 }, { "RtlMemoryStream", func_RtlMemoryStream }, + { "RtlNtPathNameToDosPathName", func_RtlNtPathNameToDosPathName }, { "RtlpEnsureBufferSize", func_RtlpEnsureBufferSize }, { "RtlReAllocateHeap", func_RtlReAllocateHeap }, { "RtlUpcaseUnicodeStringToCountedOemString", func_RtlUpcaseUnicodeStringToCountedOemString },
7 years, 9 months
1
0
0
0
[mjansen] 74029: [NTDLL] Implement RtlpEnsureBufferSize. Patch by Hermes Belusca-Maito. CORE-11990 Some small changes by me.
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Mar 2 20:40:21 2017 New Revision: 74029 URL:
http://svn.reactos.org/svn/reactos?rev=74029&view=rev
Log: [NTDLL] Implement RtlpEnsureBufferSize. Patch by Hermes Belusca-Maito. CORE-11990 Some small changes by me. Modified: trunk/reactos/dll/ntdll/def/ntdll.spec trunk/reactos/sdk/include/ndk/rtlfuncs.h trunk/reactos/sdk/lib/rtl/unicode.c trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c Modified: trunk/reactos/dll/ntdll/def/ntdll.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Thu Mar 2 20:40:21 2017 @@ -956,7 +956,7 @@ 948 stdcall RtlZeroMemory(ptr long) 949 stdcall RtlZombifyActivationContext(ptr) 950 stdcall RtlpApplyLengthFunction(long long ptr ptr) -951 stdcall RtlpEnsureBufferSize(ptr ptr ptr) ; CHECKME +951 stdcall RtlpEnsureBufferSize(long ptr long) # stdcall RtlpNotOwnerCriticalSection 953 stdcall RtlpNtCreateKey(ptr long ptr long ptr ptr) 954 stdcall RtlpNtEnumerateSubKey(ptr ptr long long) Modified: trunk/reactos/sdk/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ndk/rtlfuncs.h…
============================================================================== --- trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] Thu Mar 2 20:40:21 2017 @@ -1048,6 +1048,8 @@ #endif // NTOS_MODE_USER +#define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock) + NTSYSAPI SIZE_T NTAPI @@ -2312,6 +2314,60 @@ _In_ PCUNICODE_STRING String ); +#define RTL_SKIP_BUFFER_COPY 0x00000001 + +NTSYSAPI +NTSTATUS +NTAPI +RtlpEnsureBufferSize( + _In_ ULONG Flags, + _Inout_ PRTL_BUFFER Buffer, + _In_ SIZE_T RequiredSize +); + +#ifdef NTOS_MODE_USER + +FORCEINLINE +VOID +RtlInitBuffer( + _Inout_ PRTL_BUFFER Buffer, + _In_ PUCHAR Data, + _In_ ULONG DataSize +) +{ + Buffer->Buffer = Buffer->StaticBuffer = Data; + Buffer->Size = Buffer->StaticSize = DataSize; + Buffer->ReservedForAllocatedSize = 0; + Buffer->ReservedForIMalloc = NULL; +} + +FORCEINLINE +NTSTATUS +RtlEnsureBufferSize( + _In_ ULONG Flags, + _Inout_ PRTL_BUFFER Buffer, + _In_ ULONG RequiredSize +) +{ + if (Buffer && RequiredSize <= Buffer->Size) + return STATUS_SUCCESS; + return RtlpEnsureBufferSize(Flags, Buffer, RequiredSize); +} + +FORCEINLINE +VOID +RtlFreeBuffer( + _Inout_ PRTL_BUFFER Buffer +) +{ + if (Buffer->Buffer != Buffer->StaticBuffer && Buffer->Buffer) + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer->Buffer); + Buffer->Buffer = Buffer->StaticBuffer; + Buffer->Size = Buffer->StaticSize; +} + +#endif /* NTOS_MODE_USER */ + // // Ansi String Functions // @@ -2626,7 +2682,6 @@ VOID ); -#define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock) // // Thread Pool Functions Modified: trunk/reactos/sdk/lib/rtl/unicode.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/unicode.c?rev=…
============================================================================== --- trunk/reactos/sdk/lib/rtl/unicode.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/rtl/unicode.c [iso-8859-1] Thu Mar 2 20:40:21 2017 @@ -2566,14 +2566,68 @@ } /* - * @unimplemented - */ -NTSTATUS -NTAPI -RtlpEnsureBufferSize(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3) -{ - DPRINT1("RtlpEnsureBufferSize: stub\n"); - return STATUS_NOT_IMPLEMENTED; + * @implemented + */ +NTSTATUS +NTAPI +RtlpEnsureBufferSize( + IN ULONG Flags, + IN OUT PRTL_BUFFER Buffer, + IN SIZE_T RequiredSize) +{ + PUCHAR NewBuffer; + + /* Parameter checks */ + if (Flags & ~RTL_SKIP_BUFFER_COPY) + return STATUS_INVALID_PARAMETER; + if (Buffer == NULL) + return STATUS_INVALID_PARAMETER; + + /* + * We don't need to grow the buffer if its size + * is already larger than the required size. + */ + if (Buffer->Size >= RequiredSize) + return STATUS_SUCCESS; + + /* + * When we are using the static buffer as our buffer, we don't need + * to grow it if its size is already larger than the required size. + * In this case, just keep it but update the current buffer size to + * the one requested. + * (But NEVER EVER modify the size of the static buffer!!) + * Otherwise, we'll need to create a new buffer and use this one instead. + */ + if ( (Buffer->Buffer == Buffer->StaticBuffer) && + (Buffer->StaticSize >= RequiredSize) ) + { + Buffer->Size = RequiredSize; + return STATUS_SUCCESS; + } + + /* The buffer we are using is not large enough, try to create a bigger one */ + NewBuffer = RtlpAllocateStringMemory(RequiredSize, TAG_USTR); + if (NewBuffer == NULL) + return STATUS_NO_MEMORY; + + /* Copy the original content if needed */ + if (!(Flags & RTL_SKIP_BUFFER_COPY)) + { + RtlMoveMemory(NewBuffer, Buffer->Buffer, Buffer->Size); + } + + /* Free the original buffer only if it's not the static buffer */ + if (Buffer->Buffer != Buffer->StaticBuffer) + { + RtlpFreeStringMemory(Buffer->Buffer, TAG_USTR); + } + + /* Update the members */ + Buffer->Buffer = NewBuffer; + Buffer->Size = RequiredSize; + + /* Done */ + return STATUS_SUCCESS; } static Modified: trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlpEnsure…
============================================================================== --- trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c [iso-8859-1] (original) +++ trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c [iso-8859-1] Thu Mar 2 20:40:21 2017 @@ -11,29 +11,6 @@ #include <ndk/rtlfuncs.h> #include <tlhelp32.h> -#ifndef RtlInitBuffer -#define RtlInitBuffer(RtlBuf, StaticData, StaticDataSize) \ - do { \ - (RtlBuf)->Buffer = (RtlBuf)->StaticBuffer = (PUCHAR)StaticData; \ - (RtlBuf)->Size = (RtlBuf)->StaticSize = StaticDataSize; \ - (RtlBuf)->ReservedForAllocatedSize = 0; \ - (RtlBuf)->ReservedForIMalloc = NULL; \ - } while (0) -#endif - -#ifndef RtlFreeBuffer -#define RtlFreeBuffer(RtlBuf) \ - do { \ - if ((RtlBuf)->Buffer != (RtlBuf)->StaticBuffer && (RtlBuf)->Buffer) \ - RtlFreeHeap(RtlGetProcessHeap(), 0, (RtlBuf)->Buffer); \ - (RtlBuf)->Buffer = (RtlBuf)->StaticBuffer; \ - (RtlBuf)->Size = (RtlBuf)->StaticSize; \ - } while (0) -#endif - -#ifndef RTL_SKIP_BUFFER_COPY -#define RTL_SKIP_BUFFER_COPY 0x00000001 -#endif NTSTATUS (NTAPI *pRtlpEnsureBufferSize)(_In_ ULONG Flags, _Inout_ PRTL_BUFFER Buffer, _In_ SIZE_T RequiredSize);
7 years, 9 months
1
0
0
0
[mjansen] 74028: [NTDLL_APITEST] Add tests for RtlpEnsureBufferSize. CORE-11990
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Mar 2 20:38:58 2017 New Revision: 74028 URL:
http://svn.reactos.org/svn/reactos?rev=74028&view=rev
Log: [NTDLL_APITEST] Add tests for RtlpEnsureBufferSize. CORE-11990 Added: trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c (with props) Modified: trunk/rostests/apitests/ntdll/CMakeLists.txt trunk/rostests/apitests/ntdll/testlist.c Modified: trunk/rostests/apitests/ntdll/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/CMakeLists…
============================================================================== --- trunk/rostests/apitests/ntdll/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/ntdll/CMakeLists.txt [iso-8859-1] Thu Mar 2 20:38:58 2017 @@ -43,6 +43,7 @@ RtlInitializeBitMap.c RtlIsNameLegalDOS8Dot3.c RtlMemoryStream.c + RtlpEnsureBufferSize.c RtlReAllocateHeap.c RtlUpcaseUnicodeStringToCountedOemString.c StackOverflow.c Added: trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlpEnsure…
============================================================================== --- trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c (added) +++ trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c [iso-8859-1] Thu Mar 2 20:38:58 2017 @@ -0,0 +1,196 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for RtlpEnsureBufferSize + * PROGRAMMER: Mark Jansen + */ + +#include <apitest.h> + +#define WIN32_NO_STATUS +#include <ndk/rtlfuncs.h> +#include <tlhelp32.h> + +#ifndef RtlInitBuffer +#define RtlInitBuffer(RtlBuf, StaticData, StaticDataSize) \ + do { \ + (RtlBuf)->Buffer = (RtlBuf)->StaticBuffer = (PUCHAR)StaticData; \ + (RtlBuf)->Size = (RtlBuf)->StaticSize = StaticDataSize; \ + (RtlBuf)->ReservedForAllocatedSize = 0; \ + (RtlBuf)->ReservedForIMalloc = NULL; \ + } while (0) +#endif + +#ifndef RtlFreeBuffer +#define RtlFreeBuffer(RtlBuf) \ + do { \ + if ((RtlBuf)->Buffer != (RtlBuf)->StaticBuffer && (RtlBuf)->Buffer) \ + RtlFreeHeap(RtlGetProcessHeap(), 0, (RtlBuf)->Buffer); \ + (RtlBuf)->Buffer = (RtlBuf)->StaticBuffer; \ + (RtlBuf)->Size = (RtlBuf)->StaticSize; \ + } while (0) +#endif + +#ifndef RTL_SKIP_BUFFER_COPY +#define RTL_SKIP_BUFFER_COPY 0x00000001 +#endif + +NTSTATUS (NTAPI *pRtlpEnsureBufferSize)(_In_ ULONG Flags, _Inout_ PRTL_BUFFER Buffer, _In_ SIZE_T RequiredSize); + + +static BOOL IsBlockFromHeap(HANDLE hHeap, PVOID ptr) +{ + /* Use when this is implemented */ +#if 0 + PROCESS_HEAP_ENTRY Entry; + BOOL ret = FALSE; + if (!HeapLock(hHeap)) + { + skip("Unable to lock heap\n"); + return FALSE; + } + + Entry.lpData = NULL; + while (!ret && HeapWalk(hHeap, &Entry)) + { + if ((Entry.wFlags & PROCESS_HEAP_ENTRY_BUSY) && + (Entry.lpData == ptr)) + { + ret = TRUE; + } + } + + HeapUnlock(hHeap); + return ret; +#else + HEAPENTRY32 he; + BOOL ret = FALSE; + HANDLE hHeapSnap = CreateToolhelp32Snapshot(TH32CS_SNAPHEAPLIST, GetCurrentProcessId()); + + if (hHeapSnap == INVALID_HANDLE_VALUE) + return FALSE; + + he.dwSize = sizeof(he); + + if (Heap32First(&he, GetCurrentProcessId(), (DWORD)hHeap)) + { + do { + if ((DWORD)ptr >= he.dwAddress && (DWORD)ptr <= (he.dwAddress + he.dwBlockSize)) + ret = TRUE; + } while (!ret && Heap32Next(&he)); + } + + CloseHandle(hHeapSnap); + + return ret; +#endif +} + + +START_TEST(RtlpEnsureBufferSize) +{ + RTL_BUFFER Buffer = { 0 }; + ULONG Flag; + UCHAR StaticBuf[4]; + PVOID tmp; + BOOL SkipHeapCheck; + + HMODULE mod = GetModuleHandleW(L"ntdll.dll"); + pRtlpEnsureBufferSize = (void *)GetProcAddress(mod, "RtlpEnsureBufferSize"); + + if (!pRtlpEnsureBufferSize) + { + skip("No RtlpEnsureBufferSize\n"); + return; + } + + memset(StaticBuf, 0xba, sizeof(StaticBuf)); + RtlInitBuffer(&Buffer, StaticBuf, sizeof(StaticBuf)); + + /* NULL buffer yields a failure */ + ok_ntstatus(pRtlpEnsureBufferSize(0, NULL, 0), STATUS_INVALID_PARAMETER); + + /* All flags other than '1' yield a failure */ + for (Flag = 2; Flag; Flag <<= 1) + { + ok_ntstatus(pRtlpEnsureBufferSize(Flag, &Buffer, 0), STATUS_INVALID_PARAMETER); + ok_ptr(Buffer.Buffer, Buffer.StaticBuffer); + ok_int(Buffer.Size, Buffer.StaticSize); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); + } + + ok_ntstatus(pRtlpEnsureBufferSize(0, &Buffer, 0), STATUS_SUCCESS); + ok_ptr(Buffer.Buffer, Buffer.StaticBuffer); + ok_int(Buffer.Size, Buffer.StaticSize); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); + + ok_ntstatus(pRtlpEnsureBufferSize(0, &Buffer, 1), STATUS_SUCCESS); + ok_ptr(Buffer.Buffer, Buffer.StaticBuffer); + ok_int(Buffer.Size, Buffer.StaticSize); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); + + ok_ntstatus(pRtlpEnsureBufferSize(0, &Buffer, 2), STATUS_SUCCESS); + ok_ptr(Buffer.Buffer, Buffer.StaticBuffer); + ok_int(Buffer.Size, Buffer.StaticSize); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); + + ok_ntstatus(pRtlpEnsureBufferSize(0, &Buffer, 3), STATUS_SUCCESS); + ok_ptr(Buffer.Buffer, Buffer.StaticBuffer); + ok_int(Buffer.Size, Buffer.StaticSize); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); + + ok_ntstatus(pRtlpEnsureBufferSize(0, &Buffer, 4), STATUS_SUCCESS); + ok_ptr(Buffer.Buffer, Buffer.StaticBuffer); + ok_int(Buffer.Size, Buffer.StaticSize); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); + + /* Check that IsBlockFromHeap works! */ + tmp = RtlAllocateHeap(RtlGetProcessHeap(), 0, 5); + SkipHeapCheck = (IsBlockFromHeap(RtlGetProcessHeap(), StaticBuf) != FALSE) || + (IsBlockFromHeap(RtlGetProcessHeap(), tmp) != TRUE); + RtlFreeHeap(RtlGetProcessHeap(), 0, tmp); + + if (SkipHeapCheck) + skip("Unable to verify the heap used\n"); + + /* Allocated is exactly what is asked for, not rounded to nearest whatever */ + ok_ntstatus(pRtlpEnsureBufferSize(0, &Buffer, 5), STATUS_SUCCESS); + if (!SkipHeapCheck) + ok_int(IsBlockFromHeap(RtlGetProcessHeap(), Buffer.Buffer), TRUE); + ok(!memcmp(Buffer.Buffer, StaticBuf, sizeof(StaticBuf)), "Expected First 4 bytes to be the same!\n"); + ok_int(Buffer.Size, 5); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); + + ok_ntstatus(pRtlpEnsureBufferSize(RTL_SKIP_BUFFER_COPY, &Buffer, 5), STATUS_SUCCESS); + if (!SkipHeapCheck) + ok_int(IsBlockFromHeap(RtlGetProcessHeap(), Buffer.Buffer), TRUE); + ok(memcmp(Buffer.Buffer, StaticBuf, sizeof(StaticBuf)), "Expected First 4 bytes to be different!\n"); + ok_int(Buffer.Size, 5); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); + + /* Size is not limited to UNICODE_STRING sizes */ + ok_ntstatus(pRtlpEnsureBufferSize(RTL_SKIP_BUFFER_COPY, &Buffer, UNICODE_STRING_MAX_BYTES + 1), STATUS_SUCCESS); + if (!SkipHeapCheck) + ok_int(IsBlockFromHeap(RtlGetProcessHeap(), Buffer.Buffer), TRUE); + ok(memcmp(Buffer.Buffer, StaticBuf, sizeof(StaticBuf)), "Expected First 4 bytes to be different!\n"); + ok_int(Buffer.Size, UNICODE_STRING_MAX_BYTES + 1); + ok_ptr(Buffer.StaticBuffer, StaticBuf); + ok_int(Buffer.StaticSize, sizeof(StaticBuf)); + RtlFreeBuffer(&Buffer); +} Propchange: trunk/rostests/apitests/ntdll/RtlpEnsureBufferSize.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/ntdll/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/testlist.c…
============================================================================== --- trunk/rostests/apitests/ntdll/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/ntdll/testlist.c [iso-8859-1] Thu Mar 2 20:38:58 2017 @@ -47,6 +47,7 @@ extern void func_RtlInitializeBitMap(void); extern void func_RtlIsNameLegalDOS8Dot3(void); extern void func_RtlMemoryStream(void); +extern void func_RtlpEnsureBufferSize(void); extern void func_RtlReAllocateHeap(void); extern void func_RtlUpcaseUnicodeStringToCountedOemString(void); extern void func_StackOverflow(void); @@ -98,6 +99,7 @@ { "RtlInitializeBitMap", func_RtlInitializeBitMap }, { "RtlIsNameLegalDOS8Dot3", func_RtlIsNameLegalDOS8Dot3 }, { "RtlMemoryStream", func_RtlMemoryStream }, + { "RtlpEnsureBufferSize", func_RtlpEnsureBufferSize }, { "RtlReAllocateHeap", func_RtlReAllocateHeap }, { "RtlUpcaseUnicodeStringToCountedOemString", func_RtlUpcaseUnicodeStringToCountedOemString }, { "StackOverflow", func_StackOverflow },
7 years, 9 months
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
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
Results per page:
10
25
50
100
200