winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2018
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
542 discussions
Start a n
N
ew thread
Matteo Bruni : d3d9/tests: Add more tests to test_viewport().
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: 12016da9e11d97201bfedfe0322c43155fad94f0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=12016da9e11d97201bfedfe0…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Thu Apr 26 23:30:12 2018 +0200 d3d9/tests: Add more tests to test_viewport(). Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/tests/visual.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 6609e48..a50cb19 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -13918,7 +13918,12 @@ static void test_viewport(void) { {{ 0, 0, 640, 480}, { 0, 120, 479, 359}, "Viewport (0, 0) - (640, 480)"}, {{ 0, 0, 320, 240}, { 0, 60, 239, 179}, "Viewport (0, 0) - (320, 240)"}, + {{ 0, 0, 1280, 960}, { 0, 240, 639, 479}, "Viewport (0, 0) - (1280, 960)"}, + {{ 0, 0, 2000, 1600}, { 0, 400, 639, 479}, "Viewport (0, 0) - (2000, 1600)"}, {{100, 100, 640, 480}, {100, 220, 579, 459}, "Viewport (100, 100) - (640, 480)"}, + {{ 0, 0, 8192, 8192}, {-10, -10, -10, -10}, "Viewport (0, 0) - (8192, 8192)"}, + /* AMD HD 2600 on XP draws nothing visible for this one. */ + /* {{ 0, 0, 8192, 480}, {-10, -10, -1, -1}, "(0, 0) - (8192, 480) viewport"}, */ }; static const struct vec3 quad[] = {
1
0
0
0
Matteo Bruni : wined3d: Don't clamp viewport coordinates.
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: 56d4de0fdee57b0acf02399525a893cc1b42d759 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=56d4de0fdee57b0acf023995…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Thu Apr 26 23:30:11 2018 +0200 wined3d: Don't clamp viewport coordinates. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/device.c | 2 +- dlls/wined3d/state.c | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index c04bd82..87d4542 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3163,7 +3163,7 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO /* Get the viewport */ wined3d_device_get_viewports(device, NULL, &vp); - TRACE("viewport x %.8e, y %.8e, width %.8e, height %.8e, min_z %.8e, max_z %.8e.\n", + TRACE("viewport x %.8e, y %.8e, width %.8e, height %.8e, min_z %.8e, max_z %.8e.\n", vp.x, vp.y, vp.width, vp.height, vp.min_z, vp.max_z); multiply_matrix(&mat,&view_mat,&world_mat); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index c869b63..d76708d 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -4002,22 +4002,10 @@ static void get_viewports(struct wined3d_context *context, const struct wined3d_ unsigned int width, height, i; for (i = 0; i < viewport_count; ++i) - { viewports[i] = state->viewports[i]; - if (target) - { - if (viewports[i].width > target->width) - viewports[i].width = target->width; - if (viewports[i].height > target->height) - viewports[i].height = target->height; - } - } - - /* - * Note: GL requires lower left, DirectX supplies upper left. This is - * reversed when using offscreen rendering. - */ + /* Note: GL uses a lower left origin while DirectX uses upper left. This + * is reversed when using offscreen rendering. */ if (context->render_offscreen) return;
1
0
0
0
Matteo Bruni : d3d9/tests: Improve test_viewport().
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: 576c5308e7595958e13fa736acc9618f79bbc807 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=576c5308e7595958e13fa736…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Thu Apr 26 23:30:10 2018 +0200 d3d9/tests: Improve test_viewport(). Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/tests/visual.c | 152 ++++++++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 69 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 492464a..6609e48 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -4719,6 +4719,30 @@ static void check_rect(struct surface_readback *rb, RECT r, const char *message) {r.bottom + 1, r.bottom - 1} }; unsigned int i, j, x_side, y_side; + DWORD color; + LONG x, y; + + if (r.left < 0 && r.top < 0 && r.right < 0 && r.bottom < 0) + { + BOOL all_match = TRUE; + + for (y = 0; y < 480; ++y) + { + for (x = 0; x < 640; ++x) + { + color = get_readback_color(rb, x, y); + if (color != 0xff000000) + { + all_match = FALSE; + break; + } + } + if (!all_match) + break; + } + ok(all_match, "%s: pixel (%d, %d) has color %08x.\n", message, x, y, color); + return; + } for (i = 0; i < 2; ++i) { @@ -4728,12 +4752,14 @@ static void check_rect(struct surface_readback *rb, RECT r, const char *message) { for (y_side = 0; y_side < 2; ++y_side) { - unsigned int x = x_coords[i][x_side], y = y_coords[j][y_side]; - DWORD color; DWORD expected = (x_side == 1 && y_side == 1) ? 0xffffffff : 0xff000000; + x = x_coords[i][x_side]; + y = y_coords[j][y_side]; + if (x < 0 || x >= 640 || y < 0 || y >= 480) + continue; color = get_readback_color(rb, x, y); - ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n", + ok(color == expected, "%s: pixel (%d, %d) has color %08x, expected %08x.\n", message, x, y, color, expected); } } @@ -13880,25 +13906,37 @@ done: DestroyWindow(window); } -static void viewport_test(void) +static void test_viewport(void) { + static const struct + { + D3DVIEWPORT9 vp; + RECT expected_rect; + const char *message; + } + tests[] = + { + {{ 0, 0, 640, 480}, { 0, 120, 479, 359}, "Viewport (0, 0) - (640, 480)"}, + {{ 0, 0, 320, 240}, { 0, 60, 239, 179}, "Viewport (0, 0) - (320, 240)"}, + {{100, 100, 640, 480}, {100, 220, 579, 459}, "Viewport (100, 100) - (640, 480)"}, + }; + static const struct vec3 quad[] = + { + {-1.5f, -0.5f, 0.1f}, + {-1.5f, 0.5f, 0.1f}, + { 0.5f, -0.5f, 0.1f}, + { 0.5f, 0.5f, 0.1f}, + }; + IDirect3DSurface9 *backbuffer; + struct surface_readback rb; IDirect3DDevice9 *device; - BOOL draw_failed = TRUE; - D3DVIEWPORT9 vp; + BOOL draw_succeeded; IDirect3D9 *d3d; + unsigned int i; ULONG refcount; - DWORD color; HWND window; HRESULT hr; - static const float quad[] = - { - -0.5f, -0.5f, 0.1f, - -0.5f, 0.5f, 0.1f, - 0.5f, -0.5f, 0.1f, - 0.5f, 0.5f, 0.1f, - }; - window = create_window(); d3d = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d, "Failed to create a D3D object.\n"); @@ -13908,71 +13946,47 @@ static void viewport_test(void) goto done; } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff0000, 1.0f, 0); - ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); - - /* Test a viewport with Width and Height bigger than the surface dimensions - * - * TODO: Test Width < surface.width, but X + Width > surface.width - * TODO: Test Width < surface.width, what happens with the height? - * - * The expected behavior is that the viewport behaves like the "default" - * viewport with X = Y = 0, Width = surface_width, Height = surface_height, - * MinZ = 0.0, MaxZ = 1.0. - * - * Starting with Windows 7 the behavior among driver versions is not - * consistent. The SetViewport call is accepted on all drivers. Some - * drivers(older nvidia ones) refuse to draw and return an error. Newer - * nvidia drivers draw, but use the actual values in the viewport and only - * display the upper left part on the surface. - */ - memset(&vp, 0, sizeof(vp)); - vp.X = 0; - vp.Y = 0; - vp.Width = 10000; - vp.Height = 10000; - vp.MinZ = 0.0; - vp.MaxZ = 0.0; - hr = IDirect3DDevice9_SetViewport(device, &vp); - ok(hr == D3D_OK, "IDirect3DDevice9_SetViewport failed with %08x\n", hr); + hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); + ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); - ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF returned %08x\n", hr); - hr = IDirect3DDevice9_BeginScene(device); - ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float)); - ok(hr == D3D_OK || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr); - draw_failed = FAILED(hr); - hr = IDirect3DDevice9_EndScene(device); - ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); + + /* This crashes on Windows. */ + if (0) + hr = IDirect3DDevice9_SetViewport(device, NULL); - if(!draw_failed) + for (i = 0; i < ARRAY_SIZE(tests); ++i) { - color = getPixelColor(device, 158, 118); - ok(color == 0x00ff0000, "viewport test: (158,118) has color %08x\n", color); - color = getPixelColor(device, 162, 118); - ok(color == 0x00ff0000, "viewport test: (162,118) has color %08x\n", color); - color = getPixelColor(device, 158, 122); - ok(color == 0x00ff0000, "viewport test: (158,122) has color %08x\n", color); - color = getPixelColor(device, 162, 122); - ok(color == 0x00ffffff || broken(color == 0x00ff0000), "viewport test: (162,122) has color %08x\n", color); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); - color = getPixelColor(device, 478, 358); - ok(color == 0x00ffffff || broken(color == 0x00ff0000), "viewport test: (478,358 has color %08x\n", color); - color = getPixelColor(device, 482, 358); - ok(color == 0x00ff0000, "viewport test: (482,358) has color %08x\n", color); - color = getPixelColor(device, 478, 362); - ok(color == 0x00ff0000, "viewport test: (478,362) has color %08x\n", color); - color = getPixelColor(device, 482, 362); - ok(color == 0x00ff0000, "viewport test: (482,362) has color %08x\n", color); + hr = IDirect3DDevice9_SetViewport(device, &tests[i].vp); + ok(SUCCEEDED(hr), "Failed to set the viewport, hr %#x.\n", hr); + + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0])); + ok(SUCCEEDED(hr) || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr); + draw_succeeded = SUCCEEDED(hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + if (draw_succeeded) + { + get_rt_readback(backbuffer, &rb); + check_rect(&rb, tests[i].expected_rect, tests[i].message); + release_surface_readback(&rb); + } } hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + IDirect3DSurface9_Release(backbuffer); refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); done: @@ -23947,7 +23961,7 @@ START_TEST(visual) yuv_layout_test(); zwriteenable_test(); alphatest_test(); - viewport_test(); + test_viewport(); test_constant_clamp_vs(); test_compare_instructions(); test_mova();
1
0
0
0
Matteo Bruni : d3d9/tests: Make use of the readback helpers in check_rect( ).
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: 4e8a5c8f70978b48716e508cd30755a3c2623680 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4e8a5c8f70978b48716e508c…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Thu Apr 26 23:30:09 2018 +0200 d3d9/tests: Make use of the readback helpers in check_rect(). Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/tests/visual.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 358ed1d..492464a 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -4706,7 +4706,7 @@ done: DestroyWindow(window); } -static void check_rect(IDirect3DDevice9 *device, RECT r, const char *message) +static void check_rect(struct surface_readback *rb, RECT r, const char *message) { LONG x_coords[2][2] = { @@ -4730,9 +4730,9 @@ static void check_rect(IDirect3DDevice9 *device, RECT r, const char *message) { unsigned int x = x_coords[i][x_side], y = y_coords[j][y_side]; DWORD color; - DWORD expected = (x_side == 1 && y_side == 1) ? 0x00ffffff : 0; + DWORD expected = (x_side == 1 && y_side == 1) ? 0xffffffff : 0xff000000; - color = getPixelColor(device, x, y); + color = get_readback_color(rb, x, y); ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n", message, x, y, color, expected); } @@ -4776,6 +4776,8 @@ static void projected_textures_test(IDirect3DDevice9 *device, IDirect3D9 *d3d; D3DCAPS9 caps; HRESULT hr; + IDirect3DSurface9 *backbuffer; + struct surface_readback rb; IDirect3DDevice9_GetDirect3D(device, &d3d); hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); @@ -4793,6 +4795,9 @@ static void projected_textures_test(IDirect3DDevice9 *device, ok(SUCCEEDED(hr), "CreatePixelShader failed (%08x)\n", hr); } + hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); + ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff203040, 0.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); @@ -4872,14 +4877,14 @@ static void projected_textures_test(IDirect3DDevice9 *device, if (vs) IDirect3DVertexShader9_Release(vs); if (ps) IDirect3DPixelShader9_Release(ps); + get_rt_readback(backbuffer, &rb); for (i = 0; i < 4; ++i) { if ((!tests[i].vs || vs) && (!tests[i].ps || ps)) - check_rect(device, tests[i].rect, tests[i].message); + check_rect(&rb, tests[i].rect, tests[i].message); } - - hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); + release_surface_readback(&rb); + IDirect3DSurface9_Release(backbuffer); } static void texture_transform_flags_test(void)
1
0
0
0
Alexandre Julliard : user32: Don' t wait for other threads to process WM_NCDESTROY.
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: 08b19c6f673837b960c460b17601979aa595470f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=08b19c6f673837b960c460b1…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Apr 27 14:14:14 2018 +0200 user32: Don't wait for other threads to process WM_NCDESTROY. Based on a patch by Andrew Eikum. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/win.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++ dlls/user32/win.c | 4 +- 2 files changed, 169 insertions(+), 2 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index d409918..6030121 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -10537,6 +10537,172 @@ static void test_display_affinity( HWND win ) SetWindowLongW(win, GWL_EXSTYLE, styleex); } +static struct destroy_data +{ + HWND main_wnd; + HWND thread1_wnd; + HWND thread2_wnd; + HANDLE evt; + DWORD main_tid; + DWORD destroy_count; + DWORD ncdestroy_count; +} destroy_data; + +static LRESULT WINAPI destroy_thread1_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_DESTROY: + ok( destroy_data.destroy_count > 0, "parent didn't get WM_DESTROY\n" ); + PostQuitMessage(0); + break; + case WM_NCDESTROY: + ok( destroy_data.ncdestroy_count > 0, "parent didn't get WM_NCDESTROY\n" ); + break; + } + return DefWindowProcA(hwnd, msg, wparam, lparam); +} + +static LRESULT WINAPI destroy_thread2_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_DESTROY: + ok( destroy_data.destroy_count > 0, "parent didn't get WM_DESTROY\n" ); + break; + case WM_NCDESTROY: + ok( destroy_data.ncdestroy_count > 0, "parent didn't get WM_NCDESTROY\n" ); + ok( WaitForSingleObject(destroy_data.evt, 10000) != WAIT_TIMEOUT, "timeout\n" ); + PostQuitMessage(0); + break; + } + return DefWindowProcA(hwnd, msg, wparam, lparam); +} + +static LRESULT WINAPI destroy_main_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_DESTROY: + destroy_data.destroy_count++; + break; + case WM_NCDESTROY: + destroy_data.ncdestroy_count++; + break; + } + return DefWindowProcA(hwnd, msg, wparam, lparam); +} + +static DWORD CALLBACK destroy_thread1(void *user) +{ + MSG msg; + + destroy_data.thread1_wnd = CreateWindowExA(0, "destroy_test_thread1", + "destroy test thread", WS_CHILD, 100, 100, 100, 100, + destroy_data.main_wnd, 0, GetModuleHandleA(NULL), NULL); + ok(destroy_data.thread1_wnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError()); + PostThreadMessageW(destroy_data.main_tid, WM_USER, 0, 0); + + while (GetMessageA(&msg, 0, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + PostThreadMessageW(destroy_data.main_tid, WM_USER + 2, 0, 0); + ok( WaitForSingleObject(destroy_data.evt, 10000) != WAIT_TIMEOUT, "timeout\n" ); + ok( IsWindow( destroy_data.thread1_wnd ), "window destroyed\n" ); + return 0; +} + +static DWORD CALLBACK destroy_thread2(void *user) +{ + MSG msg; + + destroy_data.thread2_wnd = CreateWindowExA(0, "destroy_test_thread2", + "destroy test thread", WS_CHILD, 100, 100, 100, 100, + destroy_data.main_wnd, 0, GetModuleHandleA(NULL), NULL); + ok(destroy_data.thread2_wnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError()); + + PostThreadMessageW(destroy_data.main_tid, WM_USER + 1, 0, 0); + Sleep( 100 ); + + while (GetMessageA(&msg, 0, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + ok( !IsWindow( destroy_data.thread2_wnd ), "window not destroyed\n" ); + return 0; +} + +static void test_destroy_quit(void) +{ + MSG msg; + WNDCLASSA wnd_classA; + ATOM ret; + HANDLE thread1, thread2; + + destroy_data.main_tid = GetCurrentThreadId(); + destroy_data.evt = CreateEventW(NULL, TRUE, FALSE, NULL); + destroy_data.destroy_count = 0; + destroy_data.ncdestroy_count = 0; + + memset(&wnd_classA, 0, sizeof(wnd_classA)); + wnd_classA.lpszClassName = "destroy_test_main"; + wnd_classA.lpfnWndProc = destroy_main_wndproc; + ret = RegisterClassA(&wnd_classA); + ok(ret, "RegisterClass failed with error %d\n", GetLastError()); + + wnd_classA.lpszClassName = "destroy_test_thread1"; + wnd_classA.lpfnWndProc = destroy_thread1_wndproc; + ret = RegisterClassA(&wnd_classA); + ok(ret, "RegisterClass failed with error %d\n", GetLastError()); + + wnd_classA.lpszClassName = "destroy_test_thread2"; + wnd_classA.lpfnWndProc = destroy_thread2_wndproc; + ret = RegisterClassA(&wnd_classA); + ok(ret, "RegisterClass failed with error %d\n", GetLastError()); + + destroy_data.main_wnd = CreateWindowExA(0, "destroy_test_main", + "destroy test main", WS_OVERLAPPED | WS_CAPTION, 100, 100, 100, 100, + 0, 0, GetModuleHandleA(NULL), NULL); + ok(destroy_data.main_wnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError()); + if (!destroy_data.main_wnd) + { + CloseHandle(destroy_data.evt); + return; + } + + thread1 = CreateThread(NULL, 0, destroy_thread1, 0, 0, NULL); + + while (GetMessageA(&msg, 0, 0, 0)) + { + BOOL done = 0; + switch (msg.message) + { + case WM_USER: + thread2 = CreateThread(NULL, 0, destroy_thread2, 0, 0, NULL); + CloseHandle( thread2 ); + break; + case WM_USER + 1: + DestroyWindow(destroy_data.main_wnd); + break; + case WM_USER + 2: + SetEvent(destroy_data.evt); + done = 1; + break; + default: + DispatchMessageA(&msg); + break; + } + if (done) break; + } + + ok( WaitForSingleObject( thread1, 10000 ) != WAIT_TIMEOUT, "timeout" ); + ok( !IsWindow( destroy_data.thread1_wnd ), "window not destroyed\n" ); + CloseHandle( thread1 ); +} + START_TEST(win) { char **argv; @@ -10692,6 +10858,7 @@ START_TEST(win) test_display_affinity(hwndMain); test_hide_window(); test_minimize_window(hwndMain); + test_destroy_quit(); /* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 17a72d2..7bb0088 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -971,7 +971,7 @@ LRESULT WIN_DestroyWindow( HWND hwnd ) for (i = 0; list[i]; i++) { if (WIN_IsCurrentThread( list[i] )) WIN_DestroyWindow( list[i] ); - else SendMessageW( list[i], WM_WINE_DESTROYWINDOW, 0, 0 ); + else SendNotifyMessageW( list[i], WM_WINE_DESTROYWINDOW, 0, 0 ); } HeapFree( GetProcessHeap(), 0, list ); } @@ -1088,7 +1088,7 @@ void destroy_thread_windows(void) if (!list) continue; for (i = 0; list[i]; i++) if (!WIN_IsCurrentThread( list[i] )) - SendMessageW( list[i], WM_WINE_DESTROYWINDOW, 0, 0 ); + SendNotifyMessageW( list[i], WM_WINE_DESTROYWINDOW, 0, 0 ); HeapFree( GetProcessHeap(), 0, list ); } }
1
0
0
0
Alexandre Julliard : user32: Destroy thread windows by going through the handle table.
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: 460b4e7adfef5280289f34b895e8d953e0d60579 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=460b4e7adfef5280289f34b8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Apr 27 16:23:39 2018 +0200 user32: Destroy thread windows by going through the handle table. This makes sure we catch child windows that may not have been deleted yet. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/user_main.c | 3 +- dlls/user32/win.c | 124 ++++++++++++++++++------------------------------ dlls/user32/win.h | 2 +- 3 files changed, 47 insertions(+), 82 deletions(-) diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 418359a..e287150 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -374,8 +374,7 @@ static void thread_detach(void) WDML_NotifyThreadDetach(); USER_Driver->pThreadDetach(); - if (thread_info->top_window) WIN_DestroyThreadWindows( thread_info->top_window ); - if (thread_info->msg_window) WIN_DestroyThreadWindows( thread_info->msg_window ); + destroy_thread_windows(); CloseHandle( thread_info->server_queue ); HeapFree( GetProcessHeap(), 0, thread_info->wmchar_data ); HeapFree( GetProcessHeap(), 0, thread_info->key_state ); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 0272566..17a72d2 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -287,8 +287,8 @@ static void free_window_handle( HWND hwnd ) SERVER_START_REQ( destroy_window ) { req->handle = wine_server_user_handle( hwnd ); - if (wine_server_call_err( req )) ptr = NULL; - else InterlockedCompareExchangePointer( &user_handles[index], NULL, ptr ); + wine_server_call( req ); + InterlockedCompareExchangePointer( &user_handles[index], NULL, ptr ); } SERVER_END_REQ; USER_Unlock(); @@ -1027,104 +1027,70 @@ LRESULT WIN_DestroyWindow( HWND hwnd ) /*********************************************************************** - * destroy_thread_window - * - * Destroy a window upon exit of its thread. + * next_thread_window */ -static void destroy_thread_window( HWND hwnd ) +static WND *next_thread_window( HWND *hwnd ) { - WND *wndPtr; - HWND *list; - HMENU menu = 0, sys_menu = 0; - struct window_surface *surface = NULL; - WORD index; - - /* free child windows */ - - if ((list = WIN_ListChildren( hwnd ))) - { - int i; - for (i = 0; list[i]; i++) - { - if (WIN_IsCurrentThread( list[i] )) destroy_thread_window( list[i] ); - else SendMessageW( list[i], WM_WINE_DESTROYWINDOW, 0, 0 ); - } - HeapFree( GetProcessHeap(), 0, list ); - } - - /* destroy the client-side storage */ + struct user_object *ptr; + WND *win; + WORD index = *hwnd ? USER_HANDLE_TO_INDEX( *hwnd ) + 1 : 0; - index = USER_HANDLE_TO_INDEX(hwnd); - if (index >= NB_USER_HANDLES) return; USER_Lock(); - if ((wndPtr = user_handles[index])) + while (index < NB_USER_HANDLES) { - if ((wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) != WS_CHILD) menu = (HMENU)wndPtr->wIDmenu; - sys_menu = wndPtr->hSysMenu; - free_dce( wndPtr->dce, hwnd ); - surface = wndPtr->surface; - wndPtr->surface = NULL; - InterlockedCompareExchangePointer( &user_handles[index], NULL, wndPtr ); + if (!(ptr = user_handles[index++])) continue; + if (ptr->type != USER_WINDOW) continue; + win = (WND *)ptr; + if (win->tid != GetCurrentThreadId()) continue; + *hwnd = ptr->handle; + return win; } USER_Unlock(); - - HeapFree( GetProcessHeap(), 0, wndPtr ); - if (menu) DestroyMenu( menu ); - if (sys_menu) DestroyMenu( sys_menu ); - if (surface) - { - register_window_surface( surface, NULL ); - window_surface_release( surface ); - } + return NULL; } /*********************************************************************** - * destroy_thread_child_windows + * destroy_thread_windows * - * Destroy child windows upon exit of its thread. + * Destroy all window owned by the current thread. */ -static void destroy_thread_child_windows( HWND hwnd ) +void destroy_thread_windows(void) { - HWND *list; + WND *wndPtr; + HWND hwnd = 0, *list; + HMENU menu, sys_menu; + struct window_surface *surface; int i; - if (WIN_IsCurrentThread( hwnd )) - { - destroy_thread_window( hwnd ); - } - else if ((list = WIN_ListChildren( hwnd ))) + while ((wndPtr = next_thread_window( &hwnd ))) { - for (i = 0; list[i]; i++) destroy_thread_child_windows( list[i] ); - HeapFree( GetProcessHeap(), 0, list ); - } -} + /* destroy the client-side storage */ - -/*********************************************************************** - * WIN_DestroyThreadWindows - * - * Destroy all children of 'wnd' owned by the current thread. - */ -void WIN_DestroyThreadWindows( HWND hwnd ) -{ - HWND *list; - int i; - - if (!(list = WIN_ListChildren( hwnd ))) return; - - /* reset owners of top-level windows */ - for (i = 0; list[i]; i++) - { - if (!WIN_IsCurrentThread( list[i] )) + list = WIN_ListChildren( hwnd ); + menu = ((wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) != WS_CHILD) ? (HMENU)wndPtr->wIDmenu : 0; + sys_menu = wndPtr->hSysMenu; + free_dce( wndPtr->dce, hwnd ); + surface = wndPtr->surface; + InterlockedCompareExchangePointer( &user_handles[USER_HANDLE_TO_INDEX(hwnd)], NULL, wndPtr ); + WIN_ReleasePtr( wndPtr ); + HeapFree( GetProcessHeap(), 0, wndPtr ); + if (menu) DestroyMenu( menu ); + if (sys_menu) DestroyMenu( sys_menu ); + if (surface) { - HWND owner = GetWindow( list[i], GW_OWNER ); - if (owner && WIN_IsCurrentThread( owner )) WIN_SetOwner( list[i], 0 ); + register_window_surface( surface, NULL ); + window_surface_release( surface ); } - } - for (i = 0; list[i]; i++) destroy_thread_child_windows( list[i] ); - HeapFree( GetProcessHeap(), 0, list ); + /* free child windows */ + + if (!list) continue; + for (i = 0; list[i]; i++) + if (!WIN_IsCurrentThread( list[i] )) + SendMessageW( list[i], WM_WINE_DESTROYWINDOW, 0, 0 ); + HeapFree( GetProcessHeap(), 0, list ); + } } diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 0c7fcc8..65cb921 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -96,7 +96,7 @@ extern ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPE extern BOOL WIN_GetRectangles( HWND hwnd, enum coords_relative relative, RECT *rectWindow, RECT *rectClient ) DECLSPEC_HIDDEN; extern void map_window_region( HWND from, HWND to, HRGN hrgn ) DECLSPEC_HIDDEN; extern LRESULT WIN_DestroyWindow( HWND hwnd ) DECLSPEC_HIDDEN; -extern void WIN_DestroyThreadWindows( HWND hwnd ) DECLSPEC_HIDDEN; +extern void destroy_thread_windows(void) DECLSPEC_HIDDEN; extern HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode ) DECLSPEC_HIDDEN; extern BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL ) DECLSPEC_HIDDEN; extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN;
1
0
0
0
Alexandre Julliard : winex11: Avoid left_side/top_side cursor names.
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: c102efbc3522f5954d6150296c14dedfc7fe5fb7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c102efbc3522f5954d615029…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Apr 27 10:34:16 2018 +0200 winex11: Avoid left_side/top_side cursor names. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/mouse.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index fdca083..8b2966d 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -834,8 +834,8 @@ static const struct system_cursors user32_cursors[] = { OCR_ICON, { "icon" }}, { OCR_SIZENWSE, { "top_left_corner", "nw-resize" }}, { OCR_SIZENESW, { "top_right_corner", "ne-resize" }}, - { OCR_SIZEWE, { "left_side", "size_hor", "h_double_arrow", "ew-resize" }}, - { OCR_SIZENS, { "top_side", "size_ver", "v_double_arrow", "ns-resize" }}, + { OCR_SIZEWE, { "h_double_arrow", "size_hor", "ew-resize" }}, + { OCR_SIZENS, { "v_double_arrow", "size_ver", "ns-resize" }}, { OCR_NO, { "not-allowed", "forbidden", "no-drop" }}, { OCR_HAND, { "hand2", "pointer", "pointing-hand" }}, { OCR_APPSTARTING, { "left_ptr_watch" }}, @@ -924,6 +924,7 @@ static const struct cursor_font_fallback fallbacks[] = { "fleur", XC_fleur }, { "gobbler", XC_gobbler }, { "gumby", XC_gumby }, + { "h_double_arrow", XC_sb_h_double_arrow }, { "hand1", XC_hand1 }, { "hand2", XC_hand2 }, { "heart", XC_heart }, @@ -971,6 +972,7 @@ static const struct cursor_font_fallback fallbacks[] = { "ul_angle", XC_ul_angle }, { "umbrella", XC_umbrella }, { "ur_angle", XC_ur_angle }, + { "v_double_arrow", XC_sb_v_double_arrow }, { "watch", XC_watch }, { "xterm", XC_xterm } };
1
0
0
0
Louis Lenders : shell32/tests: Add a test for SHGetSetFolderCustomSettings.
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: 1f42005b1754225ed108b7bd64c6be029be5e827 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1f42005b1754225ed108b7bd…
Author: Louis Lenders <xerox.xerox2000x(a)gmail.com> Date: Thu Apr 26 12:28:11 2018 +0200 shell32/tests: Add a test for SHGetSetFolderCustomSettings. Signed-off-by: Louis Lenders <xerox.xerox2000x(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/shell32/tests/shlfolder.c | 55 ++++++++++++++++++++++++++++++++++++++++++ include/shlobj.h | 2 ++ 2 files changed, 57 insertions(+) diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index c976c85..89a01b7 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -65,6 +65,7 @@ static HRESULT (WINAPI *pSHGetItemFromObject)(IUnknown*,REFIID,void**); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**); static BOOL (WINAPI *pSHGetPathFromIDListEx)(PCIDLIST_ABSOLUTE,WCHAR*,DWORD,GPFIDL_FLAGS); +static HRESULT (WINAPI *pSHGetSetFolderCustomSettings)(LPSHFOLDERCUSTOMSETTINGS,PCWSTR,DWORD); static WCHAR *make_wstr(const char *str) { @@ -118,6 +119,7 @@ static void init_function_pointers(void) MAKEFUNC(SHGetItemFromObject); MAKEFUNC(SHCreateDefaultContextMenu); MAKEFUNC(SHGetPathFromIDListEx); + MAKEFUNC(SHGetSetFolderCustomSettings); #undef MAKEFUNC /* test named exports */ @@ -5246,6 +5248,58 @@ todo_wine IShellFolder_Release(desktop); } +static void test_SHGetSetFolderCustomSettings(void) +{ + HRESULT hr; + SHFOLDERCUSTOMSETTINGS fcs; + WCHAR pathW[MAX_PATH]; + WCHAR bufferW[MAX_PATH]; + WCHAR iconpathW[MAX_PATH]; + static const WCHAR somedirW[] = {'s','o','m','e','_','d','i','r',0}; + static const WCHAR iconW[] = {'\\','s','o','m','e','_','i','c','o','n','.','i','c','o',0}; + static const WCHAR desktop_iniW[] = {'\\','D','e','s','k','t','o','p','.','i','n','i',0}; + + if (!pSHGetSetFolderCustomSettings) + { + win_skip("SHGetSetFolderCustomSetting not exported by name (only by ordinal) for version XP/win2003\n"); + return; + } + + GetTempPathW(MAX_PATH, pathW); + lstrcatW(pathW, somedirW); + CreateDirectoryW(pathW, NULL); + + lstrcpyW(iconpathW, pathW); + lstrcatW(iconpathW, iconW); + + memset(&fcs, 0, sizeof(fcs)); + fcs.dwSize = sizeof(fcs); + fcs.dwMask = FCSM_ICONFILE; + fcs.pszIconFile = iconpathW; + + hr = pSHGetSetFolderCustomSettings(&fcs, pathW, FCS_FORCEWRITE); /*creates and writes to a Desktop.ini*/ + todo_wine ok(hr == S_OK, "Expected S_OK, got %#x\n", hr); + + memset(&fcs, 0, sizeof(fcs)); + fcs.dwSize = sizeof(fcs); + fcs.dwMask = FCSM_ICONFILE; + fcs.cchIconFile = MAX_PATH; + fcs.pszIconFile = bufferW; + bufferW[0] = 0; + + hr = pSHGetSetFolderCustomSettings(&fcs, pathW, FCS_READ); + todo_wine ok(hr == S_OK, "Expected S_OK, got %#x\n", hr); + todo_wine ok(!lstrcmpiW(iconpathW, fcs.pszIconFile), "Expected %s, got %s\n", wine_dbgstr_w(iconpathW), wine_dbgstr_w(fcs.pszIconFile)); + + hr = pSHGetSetFolderCustomSettings(&fcs, NULL, FCS_READ); + todo_wine ok(hr == E_FAIL, "Expected E_FAIL, got %#x\n", hr); + + lstrcpyW(bufferW, pathW); + lstrcatW(bufferW, desktop_iniW); + DeleteFileW(bufferW); + RemoveDirectoryW(pathW); +} + START_TEST(shlfolder) { init_function_pointers(); @@ -5288,6 +5342,7 @@ START_TEST(shlfolder) test_GetDefaultColumn(); test_GetDefaultSearchGUID(); test_SHLimitInputEdit(); + test_SHGetSetFolderCustomSettings(); OleUninitialize(); } diff --git a/include/shlobj.h b/include/shlobj.h index 9d6dcdd..e963578 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -1490,6 +1490,7 @@ int WINAPI SHCreateDirectoryExW(HWND, LPCWSTR, LPSECURITY_ATTRIBUTES); #define FCSM_LOGO 0x00000020 #define FCSM_FLAGS 0x00000040 +#include <pshpack8.h> typedef struct { DWORD dwSize; DWORD dwMask; @@ -1507,6 +1508,7 @@ typedef struct { LPWSTR pszLogo; DWORD cchLogo; } SHFOLDERCUSTOMSETTINGS, *LPSHFOLDERCUSTOMSETTINGS; +#include <poppack.h> HRESULT WINAPI SHGetSetFolderCustomSettings(LPSHFOLDERCUSTOMSETTINGS pfcs, PCWSTR pszPath, DWORD dwReadWrite);
1
0
0
0
Owen Rudge : wsdapi/tests: Add tests for UnPublish.
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: a910526907f3956d3feb5b6ef8153190fae7a382 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a910526907f3956d3feb5b6e…
Author: Owen Rudge <orudge(a)codeweavers.com> Date: Thu Apr 26 23:36:03 2018 +0100 wsdapi/tests: Add tests for UnPublish. Signed-off-by: Owen Rudge <orudge(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wsdapi/tests/discovery.c | 142 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 2 deletions(-) diff --git a/dlls/wsdapi/tests/discovery.c b/dlls/wsdapi/tests/discovery.c index 69cce44..7440cfd 100644 --- a/dlls/wsdapi/tests/discovery.c +++ b/dlls/wsdapi/tests/discovery.c @@ -204,7 +204,7 @@ static void start_listening(messageStorage *msgStorage, const char *multicastAdd { struct addrinfo *multicastAddr = NULL, *bindAddr = NULL, *interfaceAddr = NULL; listenerThreadParams *parameter = NULL; - const DWORD receiveTimeout = 5000; + const DWORD receiveTimeout = 500; const UINT reuseAddr = 1; HANDLE hThread; SOCKET s = 0; @@ -241,7 +241,7 @@ static void start_listening(messageStorage *msgStorage, const char *multicastAdd if (multicastAddr->ai_family == AF_INET6) ((SOCKADDR_IN6 *)multicastAddr->ai_addr)->sin6_scope_id = 0; - /* Set a 5-second receive timeout */ + /* Set a 500ms receive timeout */ if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (const char *)&receiveTimeout, sizeof(receiveTimeout)) == SOCKET_ERROR) goto cleanup; /* Allocate memory for thread parameters */ @@ -737,6 +737,143 @@ after_publish_test: WSACleanup(); } +static void UnPublish_tests(void) +{ + IWSDiscoveryPublisher *publisher = NULL; + IWSDiscoveryPublisherNotify *sink1 = NULL; + char endpoint_reference_string[MAX_PATH], app_sequence_string[MAX_PATH]; + LPWSTR publisherIdW = NULL, sequenceIdW = NULL; + messageStorage *msg_storage; + WSADATA wsa_data; + BOOL message_ok, hello_message_seen = FALSE, endpoint_reference_seen = FALSE, app_sequence_seen = FALSE; + BOOL wine_ns_seen = FALSE, body_hello_seen = FALSE, any_body_seen = FALSE; + int ret, i; + HRESULT rc; + ULONG ref; + char *msg; + WSDXML_ELEMENT *body_any_element; + WSDXML_NAME body_any_name; + WSDXML_NAMESPACE ns; + WCHAR body_any_name_text[] = {'B','e','e','r',0}; + static const WCHAR body_any_text[] = {'B','o','d','y','T','e','s','t',0}; + static const WCHAR uri[] = {'h','t','t','p',':','/','/','w','i','n','e','.','t','e','s','t','/',0}; + static const WCHAR prefix[] = {'w','i','n','e',0}; + + rc = WSDCreateDiscoveryPublisher(NULL, &publisher); + ok(rc == S_OK, "WSDCreateDiscoveryPublisher(NULL, &publisher) failed: %08x\n", rc); + ok(publisher != NULL, "WSDCreateDiscoveryPublisher(NULL, &publisher) failed: publisher == NULL\n"); + + rc = IWSDiscoveryPublisher_SetAddressFamily(publisher, WSDAPI_ADDRESSFAMILY_IPV4); + ok(rc == S_OK, "IWSDiscoveryPublisher_SetAddressFamily(WSDAPI_ADDRESSFAMILY_IPV4) failed: %08x\n", rc); + + /* Create notification sink */ + ok(create_discovery_publisher_notify(&sink1) == TRUE, "create_discovery_publisher_notify failed\n"); + rc = IWSDiscoveryPublisher_RegisterNotificationSink(publisher, sink1); + ok(rc == S_OK, "IWSDiscoveryPublisher_RegisterNotificationSink failed: %08x\n", rc); + + /* Set up network listener */ + publisherIdW = utf8_to_wide(publisherId); + if (publisherIdW == NULL) goto after_unpublish_test; + + sequenceIdW = utf8_to_wide(sequenceId); + if (sequenceIdW == NULL) goto after_unpublish_test; + + msg_storage = heap_alloc_zero(sizeof(messageStorage)); + if (msg_storage == NULL) goto after_unpublish_test; + + msg_storage->running = TRUE; + InitializeCriticalSection(&msg_storage->criticalSection); + + ret = WSAStartup(MAKEWORD(2, 2), &wsa_data); + ok(ret == 0, "WSAStartup failed (ret = %d)\n", ret); + + ret = start_listening_on_all_addresses(msg_storage, AF_INET); + ok(ret == TRUE, "Unable to listen on IPv4 addresses (ret == %d)\n", ret); + + /* Create "any" elements for header */ + ns.Uri = uri; + ns.PreferredPrefix = prefix; + + body_any_name.LocalName = body_any_name_text; + body_any_name.Space = &ns; + + rc = WSDXMLBuildAnyForSingleElement(&body_any_name, body_any_text, &body_any_element); + ok(rc == S_OK, "WSDXMLBuildAnyForSingleElement failed with %08x\n", rc); + + /* Unpublish the service */ + rc = IWSDiscoveryPublisher_UnPublish(publisher, publisherIdW, 1, 1, sequenceIdW, body_any_element); + + WSDFreeLinkedMemory(body_any_element); + + ok(rc == S_OK, "Unpublish failed: %08x\n", rc); + + /* Wait up to 2 seconds for messages to be received */ + if (WaitForMultipleObjects(msg_storage->numThreadHandles, msg_storage->threadHandles, TRUE, 2000) == WAIT_TIMEOUT) + { + /* Wait up to 1 more second for threads to terminate */ + msg_storage->running = FALSE; + WaitForMultipleObjects(msg_storage->numThreadHandles, msg_storage->threadHandles, TRUE, 1000); + } + + DeleteCriticalSection(&msg_storage->criticalSection); + + /* Verify we've received a message */ + ok(msg_storage->messageCount >= 1, "No messages received\n"); + + sprintf(endpoint_reference_string, "<wsa:EndpointReference><wsa:Address>%s</wsa:Address></wsa:EndpointReference>", + publisherId); + sprintf(app_sequence_string, "<wsd:AppSequence InstanceId=\"1\" SequenceId=\"%s\" MessageNumber=\"1\"></wsd:AppSequence>", + sequenceId); + + message_ok = FALSE; + + /* Check we're received the correct message */ + for (i = 0; i < msg_storage->messageCount; i++) + { + msg = msg_storage->messages[i]; + message_ok = FALSE; + + hello_message_seen = (strstr(msg, "<wsa:Action>
http://schemas.xmlsoap.org/ws/2005/04/discovery/Bye
</wsa:Action>") != NULL); + endpoint_reference_seen = (strstr(msg, endpoint_reference_string) != NULL); + app_sequence_seen = (strstr(msg, app_sequence_string) != NULL); + wine_ns_seen = (strstr(msg, "xmlns:wine=\"
http://wine.test/\
"") != NULL); + body_hello_seen = (strstr(msg, "<soap:Body><wsd:Bye") != NULL); + any_body_seen = (strstr(msg, "<wine:Beer>BodyTest</wine:Beer>") != NULL); + message_ok = hello_message_seen && endpoint_reference_seen && app_sequence_seen && wine_ns_seen && + body_hello_seen && any_body_seen; + + if (message_ok) break; + } + + for (i = 0; i < msg_storage->messageCount; i++) + { + heap_free(msg_storage->messages[i]); + } + + heap_free(msg_storage); + + ok(hello_message_seen == TRUE, "Bye message not received\n"); + ok(endpoint_reference_seen == TRUE, "EndpointReference not received\n"); + ok(app_sequence_seen == TRUE, "AppSequence not received\n"); + ok(message_ok == TRUE, "Bye message metadata not received\n"); + ok(wine_ns_seen == TRUE, "Wine namespace not received\n"); + ok(body_hello_seen == TRUE, "Body and Bye elements not received\n"); + ok(any_body_seen == TRUE, "Custom body element not received\n"); + +after_unpublish_test: + + heap_free(publisherIdW); + heap_free(sequenceIdW); + + ref = IWSDiscoveryPublisher_Release(publisher); + ok(ref == 0, "IWSDiscoveryPublisher_Release() has %d references, should have 0\n", ref); + + /* Release the sinks */ + IWSDiscoveryPublisherNotify_Release(sink1); + + WSACleanup(); +} + enum firewall_op { APP_ADD, @@ -882,6 +1019,7 @@ START_TEST(discovery) CreateDiscoveryPublisher_tests(); CreateDiscoveryPublisher_XMLContext_tests(); Publish_tests(); + UnPublish_tests(); CoUninitialize(); if (firewall_enabled) set_firewall(APP_REMOVE);
1
0
0
0
Owen Rudge : wsdapi: Implement UnPublish.
by Alexandre Julliard
27 Apr '18
27 Apr '18
Module: wine Branch: master Commit: 399c142702260343e09be94a145de4ab76b1a492 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=399c142702260343e09be94a…
Author: Owen Rudge <orudge(a)codeweavers.com> Date: Thu Apr 26 23:35:59 2018 +0100 wsdapi: Implement UnPublish. Signed-off-by: Owen Rudge <orudge(a)codeweavers.com> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wsdapi/discovery.c | 14 +++++++-- dlls/wsdapi/soap.c | 72 +++++++++++++++++++++++++++++++++++++++++++ dlls/wsdapi/wsdapi_internal.h | 3 ++ 3 files changed, 86 insertions(+), 3 deletions(-) diff --git a/dlls/wsdapi/discovery.c b/dlls/wsdapi/discovery.c index fc8acfb..9971219 100644 --- a/dlls/wsdapi/discovery.c +++ b/dlls/wsdapi/discovery.c @@ -195,10 +195,18 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_Publish(IWSDiscoveryPublisher *T static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnPublish(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId, const WSDXML_ELEMENT *pAny) { - FIXME("(%p, %s, %s, %s, %s, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), - debugstr_w(pszSessionId), pAny); + IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This); - return E_NOTIMPL; + TRACE("(%p, %s, %s, %s, %s, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullInstanceId), + wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), pAny); + + if ((!impl->publisherStarted) || (pszId == NULL) || (lstrlenW(pszId) > WSD_MAX_TEXT_LENGTH) || + ((pszSessionId != NULL) && (lstrlenW(pszSessionId) > WSD_MAX_TEXT_LENGTH))) + { + return E_INVALIDARG; + } + + return send_bye_message(impl, pszId, ullInstanceId, ullMessageNumber, pszSessionId, pAny); } static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbe(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pProbeMessage, diff --git a/dlls/wsdapi/soap.c b/dlls/wsdapi/soap.c index 943a6a3..d0fb0af 100644 --- a/dlls/wsdapi/soap.c +++ b/dlls/wsdapi/soap.c @@ -45,6 +45,13 @@ static const WCHAR actionHello[] = { 'd','i','s','c','o','v','e','r','y','/', 'H','e','l','l','o', 0 }; +static const WCHAR actionBye[] = { + 'h','t','t','p',':','/','/', + 's','c','h','e','m','a','s','.','x','m','l','s','o','a','p','.','o','r','g','/', + 'w','s','/','2','0','0','5','/','0','4','/', + 'd','i','s','c','o','v','e','r','y','/', + 'B','y','e', 0 }; + static const WCHAR addressingNsUri[] = { 'h','t','t','p',':','/','/', 's','c','h','e','m','a','s','.','x','m','l','s','o','a','p','.','o','r','g','/', @@ -75,6 +82,7 @@ static const WCHAR sequenceIdString[] = { 'S','e','q','u','e','n','c','e','I','d static const WCHAR emptyString[] = { 0 }; static const WCHAR bodyString[] = { 'B','o','d','y', 0 }; static const WCHAR helloString[] = { 'H','e','l','l','o', 0 }; +static const WCHAR byeString[] = { 'B','y','e', 0 }; static const WCHAR endpointReferenceString[] = { 'E','n','d','p','o','i','n','t','R','e','f','e','r','e','n','c','e', 0 }; static const WCHAR addressString[] = { 'A','d','d','r','e','s','s', 0 }; static const WCHAR referenceParametersString[] = { 'R','e','f','e','r','e','n','c','e','P','a','r','a','m','e','t','e','r','s', 0 }; @@ -1008,3 +1016,67 @@ cleanup: return ret; } + +HRESULT send_bye_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLONG instance_id, ULONGLONG msg_num, + LPCWSTR session_id, const WSDXML_ELEMENT *any) +{ + WSDXML_ELEMENT *body_element = NULL, *bye_element, *endpoint_reference_element; + struct list *discovered_namespaces = NULL; + WSDXML_NAME *body_name = NULL; + WSD_SOAP_HEADER soap_header; + WSD_APP_SEQUENCE sequence; + WCHAR message_id[64]; + HRESULT ret = E_OUTOFMEMORY; + + sequence.InstanceId = instance_id; + sequence.MessageNumber = msg_num; + sequence.SequenceId = session_id; + + if (!create_guid(message_id)) goto failed; + + discovered_namespaces = WSDAllocateLinkedMemory(NULL, sizeof(struct list)); + if (!discovered_namespaces) goto failed; + + list_init(discovered_namespaces); + + populate_soap_header(&soap_header, discoveryTo, actionBye, message_id, &sequence, NULL); + + ret = IWSDXMLContext_AddNameToNamespace(impl->xmlContext, envelopeNsUri, bodyString, &body_name); + if (FAILED(ret)) goto cleanup; + + /* <soap:Body>, <wsd:Bye> */ + ret = WSDXMLBuildAnyForSingleElement(body_name, NULL, &body_element); + if (FAILED(ret)) goto cleanup; + + ret = add_child_element(impl->xmlContext, body_element, discoveryNsUri, byeString, NULL, &bye_element); + if (FAILED(ret)) goto cleanup; + + /* <wsa:EndpointReference>, <wsa:Address> */ + ret = add_child_element(impl->xmlContext, bye_element, addressingNsUri, endpointReferenceString, NULL, + &endpoint_reference_element); + if (FAILED(ret)) goto cleanup; + + ret = add_child_element(impl->xmlContext, endpoint_reference_element, addressingNsUri, addressString, id, NULL); + if (FAILED(ret)) goto cleanup; + + /* Write any body elements */ + if (any != NULL) + { + ret = duplicate_element(bye_element, any, discovered_namespaces); + if (FAILED(ret)) goto cleanup; + } + + /* Write and send the message */ + ret = write_and_send_message(impl, &soap_header, body_element, discovered_namespaces, NULL, 0); + goto cleanup; + +failed: + ret = E_OUTOFMEMORY; + +cleanup: + WSDFreeLinkedMemory(body_name); + WSDFreeLinkedMemory(body_element); + WSDFreeLinkedMemory(discovered_namespaces); + + return ret; +} diff --git a/dlls/wsdapi/wsdapi_internal.h b/dlls/wsdapi/wsdapi_internal.h index 57bf58c..45d54c2 100644 --- a/dlls/wsdapi/wsdapi_internal.h +++ b/dlls/wsdapi/wsdapi_internal.h @@ -62,6 +62,9 @@ HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLON const WSD_URI_LIST *xaddrs_list, const WSDXML_ELEMENT *hdr_any, const WSDXML_ELEMENT *ref_param_any, const WSDXML_ELEMENT *endpoint_ref_any, const WSDXML_ELEMENT *any); +HRESULT send_bye_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLONG instance_id, ULONGLONG msg_num, + LPCWSTR session_id, const WSDXML_ELEMENT *any); + HRESULT register_namespaces(IWSDXMLContext *xml_context); /* xml.c */
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
55
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Results per page:
10
25
50
100
200