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
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2022
----- 2025 -----
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
907 discussions
Start a n
N
ew thread
Nikolay Sivov : d2d1/tests: Test bitmap options when created from existing surface.
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: 470fe5903a58486c1376e6d3f8cabe4beb233462 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=470fe5903a58486c1376e6d3…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun May 29 14:07:11 2022 +0300 d2d1/tests: Test bitmap options when created from existing surface. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/tests/d2d1.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 6f22436c892..ac96c1a0d50 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -11609,10 +11609,11 @@ static void test_bitmap_map(BOOL d3d11) D2D1_MAPPED_RECT mapped_rect; ID3D11Device *d3d_device; ID3D11Texture2D *texture; + unsigned int i, options; IDXGISurface *surface; ID2D1Bitmap1 *bitmap; + ID2D1Bitmap *bitmap2; D2D1_SIZE_U size; - unsigned int i; HRESULT hr; if (!init_test_context(&ctx, d3d11)) @@ -11779,6 +11780,49 @@ static void test_bitmap_map(BOOL d3d11) ID2D1Bitmap1_Release(bitmap); + /* Options are derived from the surface properties. */ + bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; + bitmap_desc.dpiX = bitmap_desc.dpiY = 0.0f; + hr = ID2D1DeviceContext_CreateSharedBitmap(ctx.context, &IID_IDXGISurface, surface, + (const D2D1_BITMAP_PROPERTIES *)&bitmap_desc, &bitmap2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap_QueryInterface(bitmap2, &IID_ID2D1Bitmap1, (void **)&bitmap); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + options = ID2D1Bitmap1_GetOptions(bitmap); + todo_wine + ok(options == (D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ), + "Unexpected options %#x.\n", options); + + ID2D1Bitmap1_Release(bitmap); + ID2D1Bitmap_Release(bitmap2); + + hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, NULL, &bitmap); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + options = ID2D1Bitmap1_GetOptions(bitmap); + todo_wine + ok(options == (D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ), + "Unexpected options %#x.\n", options); + ID2D1Bitmap1_Release(bitmap); + + /* Options incompatible with the surface. */ + bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET; + hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + if (SUCCEEDED(hr)) ID2D1Bitmap1_Release(bitmap); + bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_NONE; + hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + if (SUCCEEDED(hr)) ID2D1Bitmap1_Release(bitmap); + bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW; + hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + if (SUCCEEDED(hr)) ID2D1Bitmap1_Release(bitmap); + ID3D11Texture2D_Release(texture); IDXGISurface_Release(surface);
1
0
0
0
Nikolay Sivov : d2d1: Explicitly validate bitmap options for CreateBitmap().
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: d5ddf3bd1250b218d69eca23bb8cb9a875e585bc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d5ddf3bd1250b218d69eca23…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun May 29 13:42:38 2022 +0300 d2d1: Explicitly validate bitmap options for CreateBitmap(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/bitmap.c | 20 ++++++++++++++++++++ dlls/d2d1/tests/d2d1.c | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c index 8386f703b46..904d44cc075 100644 --- a/dlls/d2d1/bitmap.c +++ b/dlls/d2d1/bitmap.c @@ -336,6 +336,23 @@ static void d2d_bitmap_init(struct d2d_bitmap *bitmap, struct d2d_device_context } } +static BOOL check_bitmap_options(unsigned int options) +{ + switch (options) + { + case D2D1_BITMAP_OPTIONS_NONE: + case D2D1_BITMAP_OPTIONS_TARGET: + case D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW: + case D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE: + case D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE: + case D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ: + return TRUE; + default: + WARN("Invalid bitmap options %#x.\n", options); + return FALSE; + } +} + HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size, const void *src_data, UINT32 pitch, const D2D1_BITMAP_PROPERTIES1 *desc, struct d2d_bitmap **bitmap) { @@ -364,6 +381,9 @@ HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size, return E_INVALIDARG; } + if (!check_bitmap_options(desc->bitmapOptions)) + return E_INVALIDARG; + texture_desc.Width = size.width; texture_desc.Height = size.height; if (!texture_desc.Width || !texture_desc.Height) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 0069cf746bb..6f22436c892 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -11798,6 +11798,18 @@ static void test_bitmap_create(BOOL d3d11) { D2D1_BITMAP_OPTIONS_CPU_READ }, { D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE }, }; + static const struct + { + unsigned int options; + } valid_options[] = + { + { D2D1_BITMAP_OPTIONS_NONE }, + { D2D1_BITMAP_OPTIONS_TARGET }, + { D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW }, + { D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE }, + { D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE }, + { D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ }, + }; D2D1_BITMAP_PROPERTIES1 bitmap_desc; struct d2d1_test_context ctx; ID2D1Bitmap1 *bitmap; @@ -11820,10 +11832,25 @@ static void test_bitmap_create(BOOL d3d11) bitmap_desc.bitmapOptions = invalid_options[i].options; bitmap_desc.colorContext = NULL; hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap); - todo_wine_if(i != 1) ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); - if (SUCCEEDED(hr)) - ID2D1Bitmap1_Release(bitmap); + + winetest_pop_context(); + } + + for (i = 0; i < ARRAY_SIZE(valid_options); ++i) + { + winetest_push_context("Test %u", i); + + set_size_u(&size, 4, 4); + bitmap_desc.dpiX = 96.0f; + bitmap_desc.dpiY = 96.0f; + bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; + bitmap_desc.bitmapOptions = valid_options[i].options; + bitmap_desc.colorContext = NULL; + hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ID2D1Bitmap1_Release(bitmap); winetest_pop_context(); }
1
0
0
0
Nikolay Sivov : d2d1: Create staging texture with read access for bitmaps with D2D1_BITMAP_OPTIONS_CPU_READ.
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: a95ed154470649a3518ff6ce7f287205f503453f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a95ed154470649a3518ff6ce…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun May 29 13:17:22 2022 +0300 d2d1: Create staging texture with read access for bitmaps with D2D1_BITMAP_OPTIONS_CPU_READ. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/bitmap.c | 4 ++++ dlls/d2d1/tests/d2d1.c | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c index 971e3c7ff6b..8386f703b46 100644 --- a/dlls/d2d1/bitmap.c +++ b/dlls/d2d1/bitmap.c @@ -374,12 +374,16 @@ HRESULT d2d_bitmap_create(struct d2d_device_context *context, D2D1_SIZE_U size, texture_desc.SampleDesc.Count = 1; texture_desc.SampleDesc.Quality = 0; texture_desc.Usage = D3D11_USAGE_DEFAULT; + if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_CPU_READ) + texture_desc.Usage = D3D11_USAGE_STAGING; texture_desc.BindFlags = 0; if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_TARGET) texture_desc.BindFlags |= D3D11_BIND_RENDER_TARGET; if (!(desc->bitmapOptions & D2D1_BITMAP_OPTIONS_CANNOT_DRAW)) texture_desc.BindFlags |= D3D11_BIND_SHADER_RESOURCE; texture_desc.CPUAccessFlags = 0; + if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_CPU_READ) + texture_desc.CPUAccessFlags |= D3D11_CPU_ACCESS_READ; texture_desc.MiscFlags = 0; if (desc->bitmapOptions & D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE) texture_desc.MiscFlags |= D3D11_RESOURCE_MISC_GDI_COMPATIBLE; diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index e8f07976d54..0069cf746bb 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -11709,10 +11709,8 @@ static void test_bitmap_map(BOOL d3d11) hr = IDXGISurface_QueryInterface(surface, &IID_ID3D11Texture2D, (void **)&texture); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID3D11Texture2D_GetDesc(texture, &texture_desc); - todo_wine ok(texture_desc.Usage == D3D11_USAGE_STAGING, "Unexpected usage %u.\n", texture_desc.Usage); ok(!texture_desc.BindFlags, "Unexpected bind flags %#x.\n", texture_desc.BindFlags); - todo_wine ok(texture_desc.CPUAccessFlags == D3D11_CPU_ACCESS_READ, "Unexpected CPU access flags %#x.\n", texture_desc.CPUAccessFlags); ok(!texture_desc.MiscFlags, "Unexpected misc flags %#x.\n", texture_desc.MiscFlags); @@ -11822,7 +11820,7 @@ static void test_bitmap_create(BOOL d3d11) bitmap_desc.bitmapOptions = invalid_options[i].options; bitmap_desc.colorContext = NULL; hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap); - todo_wine + todo_wine_if(i != 1) ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) ID2D1Bitmap1_Release(bitmap);
1
0
0
0
Nikolay Sivov : d2d1/tests: Add some tests for invalid bitmap options.
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: 9cdf2a6e90bab3888d548733645d20a2d61137b3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9cdf2a6e90bab3888d548733…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun May 29 13:09:36 2022 +0300 d2d1/tests: Add some tests for invalid bitmap options. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/tests/d2d1.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 0319b146ff2..e8f07976d54 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -11789,6 +11789,50 @@ static void test_bitmap_map(BOOL d3d11) release_test_context(&ctx); } +static void test_bitmap_create(BOOL d3d11) +{ + static const struct + { + unsigned int options; + } invalid_options[] = + { + { D2D1_BITMAP_OPTIONS_CANNOT_DRAW }, + { D2D1_BITMAP_OPTIONS_CPU_READ }, + { D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE }, + }; + D2D1_BITMAP_PROPERTIES1 bitmap_desc; + struct d2d1_test_context ctx; + ID2D1Bitmap1 *bitmap; + D2D1_SIZE_U size; + unsigned int i; + HRESULT hr; + + if (!init_test_context(&ctx, d3d11)) + return; + + for (i = 0; i < ARRAY_SIZE(invalid_options); ++i) + { + winetest_push_context("Test %u", i); + + set_size_u(&size, 4, 4); + bitmap_desc.dpiX = 96.0f; + bitmap_desc.dpiY = 96.0f; + bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; + bitmap_desc.bitmapOptions = invalid_options[i].options; + bitmap_desc.colorContext = NULL; + hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + if (SUCCEEDED(hr)) + ID2D1Bitmap1_Release(bitmap); + + winetest_pop_context(); + } + + release_test_context(&ctx); +} + START_TEST(d2d1) { HMODULE d2d1_dll = GetModuleHandleA("d2d1.dll"); @@ -11866,6 +11910,7 @@ START_TEST(d2d1) queue_d3d10_test(test_stroke_contains_point); queue_test(test_image_bounds); queue_test(test_bitmap_map); + queue_test(test_bitmap_create); run_queued_tests(); }
1
0
0
0
Dmitry Timoshkov : d2d1/tests: Add some tests for bitmap mapping.
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: 991eb2be4e62cb5c4fd94888793bf26910a90035 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=991eb2be4e62cb5c4fd94888…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri May 27 12:22:57 2022 +0300 d2d1/tests: Add some tests for bitmap mapping. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d2d1/tests/d2d1.c | 206 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index d5fa6f26e4d..0319b146ff2 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -11584,6 +11584,211 @@ static void test_image_bounds(BOOL d3d11) release_test_context(&ctx); } +static void test_bitmap_map(BOOL d3d11) +{ + static const struct + { + unsigned int options; + } invalid_map_options[] = + { + { D2D1_BITMAP_OPTIONS_NONE }, + { D2D1_BITMAP_OPTIONS_TARGET }, + { D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_TARGET }, + { D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE }, + }; + static const struct + { + unsigned int options; + } valid_map_options[] = + { + { D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ }, + }; + D2D1_BITMAP_PROPERTIES1 bitmap_desc; + D3D11_TEXTURE2D_DESC texture_desc; + struct d2d1_test_context ctx; + D2D1_MAPPED_RECT mapped_rect; + ID3D11Device *d3d_device; + ID3D11Texture2D *texture; + IDXGISurface *surface; + ID2D1Bitmap1 *bitmap; + D2D1_SIZE_U size; + unsigned int i; + HRESULT hr; + + if (!init_test_context(&ctx, d3d11)) + return; + + for (i = 0; i < ARRAY_SIZE(invalid_map_options); ++i) + { + winetest_push_context("Test %u", i); + + set_size_u(&size, 4, 4); + bitmap_desc.dpiX = 96.0f; + bitmap_desc.dpiY = 96.0f; + bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; + bitmap_desc.bitmapOptions = invalid_map_options[i].options; + bitmap_desc.colorContext = NULL; + hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_NONE, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_GetSurface(bitmap, &surface); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDXGISurface_QueryInterface(surface, &IID_ID3D11Texture2D, (void **)&texture); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ID3D11Texture2D_GetDesc(texture, &texture_desc); + ok(!texture_desc.CPUAccessFlags, "Unexpected CPU access flags %#x.\n", texture_desc.CPUAccessFlags); + ID3D11Texture2D_Release(texture); + IDXGISurface_Release(surface); + + ID2D1Bitmap1_Release(bitmap); + + winetest_pop_context(); + } + + for (i = 0; i < ARRAY_SIZE(valid_map_options); ++i) + { + winetest_push_context("Test %u", i); + + set_size_u(&size, 4, 4); + bitmap_desc.dpiX = 96.0f; + bitmap_desc.dpiY = 96.0f; + bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; + bitmap_desc.bitmapOptions = valid_map_options[i].options; + bitmap_desc.colorContext = NULL; + hr = ID2D1DeviceContext_CreateBitmap(ctx.context, size, NULL, 0, &bitmap_desc, &bitmap); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_NONE, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect); + todo_wine + ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Unmap(bitmap); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Unmap(bitmap); + todo_wine + ok(hr == D2DERR_WRONG_STATE, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ | D2D1_MAP_OPTIONS_WRITE, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_GetSurface(bitmap, &surface); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = IDXGISurface_QueryInterface(surface, &IID_ID3D11Texture2D, (void **)&texture); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ID3D11Texture2D_GetDesc(texture, &texture_desc); + todo_wine + ok(texture_desc.Usage == D3D11_USAGE_STAGING, "Unexpected usage %u.\n", texture_desc.Usage); + ok(!texture_desc.BindFlags, "Unexpected bind flags %#x.\n", texture_desc.BindFlags); + todo_wine + ok(texture_desc.CPUAccessFlags == D3D11_CPU_ACCESS_READ, "Unexpected CPU access flags %#x.\n", + texture_desc.CPUAccessFlags); + ok(!texture_desc.MiscFlags, "Unexpected misc flags %#x.\n", texture_desc.MiscFlags); + ID3D11Texture2D_Release(texture); + IDXGISurface_Release(surface); + + ID2D1Bitmap1_Release(bitmap); + + winetest_pop_context(); + } + + hr = IDXGIDevice_QueryInterface(ctx.device, &IID_ID3D11Device, (void **)&d3d_device); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + texture_desc.Width = 4; + texture_desc.Height = 4; + texture_desc.MipLevels = 1; + texture_desc.ArraySize = 1; + texture_desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + texture_desc.SampleDesc.Count = 1; + texture_desc.SampleDesc.Quality = 0; + texture_desc.Usage = D3D11_USAGE_STAGING; + texture_desc.BindFlags = 0; + texture_desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + texture_desc.MiscFlags = 0; + + hr = ID3D11Device_CreateTexture2D(d3d_device, &texture_desc, NULL, &texture); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3D11Texture2D_QueryInterface(texture, &IID_IDXGISurface, (void **)&surface); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ; + hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(ctx.context, surface, &bitmap_desc, &bitmap); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_READ, &mapped_rect); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Unmap(bitmap); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE, &mapped_rect); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Unmap(bitmap); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE | D2D1_MAP_OPTIONS_READ, &mapped_rect); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Unmap(bitmap); + todo_wine + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Bitmap1_Map(bitmap, D2D1_MAP_OPTIONS_WRITE | D2D1_MAP_OPTIONS_READ | D2D1_MAP_OPTIONS_DISCARD, &mapped_rect); + todo_wine + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + + ID2D1Bitmap1_Release(bitmap); + + ID3D11Texture2D_Release(texture); + IDXGISurface_Release(surface); + + ID3D11Device_Release(d3d_device); + + release_test_context(&ctx); +} + START_TEST(d2d1) { HMODULE d2d1_dll = GetModuleHandleA("d2d1.dll"); @@ -11660,6 +11865,7 @@ START_TEST(d2d1) queue_test(test_effect_grayscale); queue_d3d10_test(test_stroke_contains_point); queue_test(test_image_bounds); + queue_test(test_bitmap_map); run_queued_tests(); }
1
0
0
0
Alex Henrie : ntoskrnl: Add ExNotifyCallback stub.
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: 942eb6008d81673990ede01a1dd64e1f1958dc84 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=942eb6008d81673990ede01a…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Sun May 29 15:39:29 2022 -0600 ntoskrnl: Add ExNotifyCallback stub. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53051
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> --- dlls/ntoskrnl.exe/ntoskrnl.c | 8 ++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index f8e1c24bb49..0994af447f9 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2250,6 +2250,14 @@ void WINAPI ExUnregisterCallback(void *callback_registration) FIXME("callback_registration %p stub.\n", callback_registration); } +/*********************************************************************** + * ExNotifyCallback (NTOSKRNL.EXE.@) + */ +void WINAPI ExNotifyCallback(void *obj, void *arg1, void *arg2) +{ + FIXME("(%p, %p, %p): stub\n", obj, arg1, arg2); +} + /*********************************************************************** * ExFreePool (NTOSKRNL.EXE.@) */ diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index d445c5a5557..4df6b1ae472 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -175,7 +175,7 @@ @ stdcall ExIsResourceAcquiredExclusiveLite(ptr) @ stdcall ExIsResourceAcquiredSharedLite(ptr) @ stdcall ExLocalTimeToSystemTime(ptr ptr) RtlLocalTimeToSystemTime -@ stub ExNotifyCallback +@ stdcall ExNotifyCallback(ptr ptr ptr) @ stub ExQueryPoolBlockSize @ stub ExQueueWorkItem @ stub ExRaiseAccessViolation
1
0
0
0
Jinoh Kang : include: Mark IPersistFolder3::InitializeEx's optional parameters as [unique].
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: 93dcb935737189964f9c8a49dffe021a5f61090e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=93dcb935737189964f9c8a49…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Mon May 30 19:37:31 2022 +0900 include: Mark IPersistFolder3::InitializeEx's optional parameters as [unique]. The Windows SDK headers makes it clear that the IBindCtx and ppfti parameters of InitializeEx are optional. Bring Wine's definition in sync with those. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- include/shobjidl.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/shobjidl.idl b/include/shobjidl.idl index 867af3898b5..065e0c8c528 100644 --- a/include/shobjidl.idl +++ b/include/shobjidl.idl @@ -1395,9 +1395,9 @@ interface IPersistFolder3 : IPersistFolder2 } PERSIST_FOLDER_TARGET_INFO; HRESULT InitializeEx( - [in] IBindCtx *pbc, + [in, unique] IBindCtx *pbc, [in] LPCITEMIDLIST pidlRoot, - [in] const PERSIST_FOLDER_TARGET_INFO *ppfti); + [in, unique] const PERSIST_FOLDER_TARGET_INFO *ppfti); HRESULT GetFolderTargetInfo( [out] PERSIST_FOLDER_TARGET_INFO *ppfti ); }
1
0
0
0
Jinoh Kang : include: Mark IShellItem::BindToHandler's pbc parameter as [unique].
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: 6efdef2290f3bf4e0bb697a32c69b3c3d7ebbe6c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6efdef2290f3bf4e0bb697a3…
Author: Jinoh Kang <jinoh.kang.kr(a)gmail.com> Date: Mon May 30 19:20:34 2022 +0900 include: Mark IShellItem::BindToHandler's pbc parameter as [unique]. The Windows SDK headers makes it clear that the IBindCtx parameter of BindToHandler is optional. Bring Wine's definition in sync with those. Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- include/shobjidl.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/shobjidl.idl b/include/shobjidl.idl index 8113d9a7ff6..867af3898b5 100644 --- a/include/shobjidl.idl +++ b/include/shobjidl.idl @@ -381,7 +381,7 @@ interface IShellItem : IUnknown typedef DWORD SICHINTF; HRESULT BindToHandler( - [in] IBindCtx *pbc, + [in, unique] IBindCtx *pbc, [in] REFGUID rbhid, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut);
1
0
0
0
Zhiyi Zhang : win32u: Create a dummy bitmap for display device contexts.
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: 546cbdc2508acdc2672b13e1ce838a54feb4db47 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=546cbdc2508acdc2672b13e1…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Wed May 18 15:42:41 2022 +0800 win32u: Create a dummy bitmap for display device contexts. On Windows 7 and older versions of Windows, calling GetCurrentObject(hdc, OBJ_BITMAP) for a display device context will return a valid handle. However, this handle will fail for GetObject(). On newer versions of Windows, GetCurrentObject(hdc, OBJ_BITMAP) for display device contexts returns a bitmap of virtual screen size and its size changes after display mode changes. This behavior is tested in the _check_display_dc() function in user32/tests/monitor.c. The screen shot function of WeChat depends on GetObject() to either return failure or a valid size for the bitmap from display device contexts. Since Wine currently report Windows 7 as default and to save memory, the Windows 7 behavior is implemented. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/gdi32/tests/bitmap.c | 1 - dlls/user32/tests/monitor.c | 1 - dlls/win32u/dc.c | 13 +++++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index 18d1e8f6c28..d3074286ee6 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -2789,7 +2789,6 @@ static void test_CreateBitmap(void) "0: %p, 1: %p, 4: %p, 5: %p, curObj1 %p, old1 %p\n", bm, bm1, bm4, bm5, curObj1, old1); ok(bm != bm2 && bm != bm3, "0: %p, 2: %p, 3: %p\n", bm, bm2, bm3); - todo_wine ok(bm != curObj2, "0: %p, curObj2 %p\n", bm, curObj2); ok(old2 == 0, "old2 %p\n", old2); diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 94cb7e60382..4b774037508 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -2164,7 +2164,6 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_ ok_(__FILE__, line)(!!hbmp, "GetCurrentObject failed, error %#lx.\n", GetLastError()); ret = GetObjectA(hbmp, sizeof(bitmap), &bitmap); /* GetObjectA fails on Win7 and older */ - ok_(__FILE__, line)(ret || broken(!ret), "GetObjectA failed, error %ld.\n", GetLastError()); if (ret) { ok_(__FILE__, line)(bitmap.bmType == 0, "Expected bmType %d, got %d.\n", 0, bitmap.bmType); diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index b684e198c05..95dd2651929 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -274,7 +274,13 @@ void free_dc_ptr( DC *dc ) GDI_dec_ref_count( dc->hPen ); GDI_dec_ref_count( dc->hBrush ); GDI_dec_ref_count( dc->hFont ); - if (dc->hBitmap) GDI_dec_ref_count( dc->hBitmap ); + if (dc->hBitmap) + { + if (dc->is_display) + NtGdiDeleteClientObj( dc->hBitmap ); + else + GDI_dec_ref_count( dc->hBitmap ); + } free_gdi_handle( dc->hSelf ); free_dc_state( dc ); } @@ -724,7 +730,10 @@ HDC WINAPI NtGdiOpenDCW( UNICODE_STRING *device, const DEVMODEW *devmode, UNICOD if (!(dc = alloc_dc_ptr( NTGDI_OBJ_DC ))) return 0; hdc = dc->hSelf; - dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP )); + if (is_display) + dc->hBitmap = NtGdiCreateClientObj( NTGDI_OBJ_SURF ); + else + dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP )); TRACE("(device=%s, output=%s): returning %p\n", debugstr_us(device), debugstr_us(output), dc->hSelf );
1
0
0
0
Hans Leidekker : mshtml/tests: Add HTMLStorage tests.
by Alexandre Julliard
30 May '22
30 May '22
Module: wine Branch: master Commit: 18d4d5a51c1e3461d93bf132a8b8283f386497a9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=18d4d5a51c1e3461d93bf132…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Mon May 30 10:29:49 2022 +0200 mshtml/tests: Add HTMLStorage tests. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mshtml/tests/misc.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) diff --git a/dlls/mshtml/tests/misc.c b/dlls/mshtml/tests/misc.c index 1702a24c804..410d24884ee 100644 --- a/dlls/mshtml/tests/misc.c +++ b/dlls/mshtml/tests/misc.c @@ -24,6 +24,7 @@ #include "windef.h" #include "winbase.h" #include "ole2.h" +#include "mshtml.h" #include "initguid.h" #include "optary.h" @@ -106,11 +107,200 @@ static void test_HTMLLoadOptions(void) IHtmlLoadOptions_Release(loadopts); } +static IHTMLDocument2 *create_doc_from_url(const WCHAR *start_url) +{ + BSTR url; + IBindCtx *bc; + IMoniker *url_mon; + IPersistMoniker *persist_mon; + IHTMLDocument2 *doc; + HRESULT hres; + + hres = CreateBindCtx(0, &bc); + ok(hres == S_OK, "CreateBindCtx failed: 0x%08lx\n", hres); + + url = SysAllocString(start_url); + hres = CreateURLMoniker(NULL, url, &url_mon); + ok(hres == S_OK, "CreateURLMoniker failed: 0x%08lx\n", hres); + + hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, + CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER, &IID_IHTMLDocument2, + (void**)&doc); + ok(hres == S_OK, "CoCreateInstance failed: 0x%08lx\n", hres); + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistMoniker, + (void**)&persist_mon); + ok(hres == S_OK, "IHTMLDocument2_QueryInterface failed: 0x%08lx\n", hres); + + hres = IPersistMoniker_Load(persist_mon, FALSE, url_mon, bc, + STGM_SHARE_EXCLUSIVE | STGM_READWRITE); + ok(hres == S_OK, "IPersistMoniker_Load failed: 0x%08lx\n", hres); + + IPersistMoniker_Release(persist_mon); + IMoniker_Release(url_mon); + IBindCtx_Release(bc); + SysFreeString(url); + return doc; +} + +static HRESULT get_localstorage(IHTMLDocument2 *doc, IHTMLStorage **storage) +{ + IHTMLWindow2 *window; + IHTMLWindow6 *window6; + HRESULT hres; + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + ok(window != NULL, "window == NULL\n"); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow6, (void**)&window6); + IHTMLWindow2_Release(window); + if(FAILED(hres)) { + win_skip("IHTMLWindow6 not supported\n"); + return hres; + } + + hres = IHTMLWindow6_get_localStorage(window6, storage); + ok(hres == S_OK, "get_localStorage failed: %08lx\n", hres); + ok(*storage != NULL, "*storage == NULL\n"); + + IHTMLWindow6_Release(window6); + return hres; +} + +static void test_HTMLStorage(void) +{ + IHTMLDocument2 *doc, *doc2; + IHTMLStorage *storage, *storage2; + VARIANT var; + BSTR key, value; + HRESULT hres; + + doc = create_doc_from_url(L"
http://www.codeweavers.com/
"); + doc2 = create_doc_from_url(L"
http://www.codeweavers.com/
"); + + hres = get_localstorage(doc, &storage); + ok(hres == S_OK, "got %08lx\n", hres); + + hres = get_localstorage(doc2, &storage2); + ok(hres == S_OK, "got %08lx\n", hres); + + key = SysAllocString(L""); + V_VT(&var) = 0xdead; + hres = IHTMLStorage_getItem(storage, key, &var); + ok(hres == S_OK, "getItem failed: %08lx\n", hres); + ok(V_VT(&var) == VT_NULL, "got %d\n", V_VT(&var)); + + key = SysAllocString(L"undefined"); + hres = IHTMLStorage_removeItem(storage, key); + ok(hres == S_OK, "removeItem failed: %08lx\n", hres); + + value = SysAllocString(L"null"); + hres = IHTMLStorage_setItem(storage, key, value); + ok(hres == S_OK, "setItem failed: %08lx\n", hres); + + V_VT(&var) = 0xdead; + hres = IHTMLStorage_getItem(storage, key, &var); + ok(hres == S_OK, "getItem failed: %08lx\n", hres); + ok(V_VT(&var) == VT_BSTR, "got %d\n", V_VT(&var)); + if (V_VT(&var) == VT_BSTR) ok(!wcscmp(V_BSTR(&var), L"null"), "got %s\n", wine_dbgstr_w(V_BSTR(&var))); + hres = IHTMLStorage_removeItem(storage, key); + ok(hres == S_OK, "removeItem failed: %08lx\n", hres); + SysFreeString(key); + SysFreeString(value); + + key = SysAllocString(L"winetest"); + value = SysAllocString(L"winetest"); + hres = IHTMLStorage_setItem(storage, key, value); + ok(hres == S_OK, "setItem failed: %08lx\n", hres); + + /* retrieve value from different storage instance */ + V_VT(&var) = 0xdead; + hres = IHTMLStorage_getItem(storage2, key, &var); + ok(hres == S_OK, "getItem failed: %08lx\n", hres); + ok(V_VT(&var) == VT_BSTR, "got %d\n", V_VT(&var)); + if (V_VT(&var) == VT_BSTR) ok(!wcscmp(V_BSTR(&var), L"winetest"), "got %s\n", wine_dbgstr_w(V_BSTR(&var))); + + hres = IHTMLStorage_removeItem(storage, key); + ok(hres == S_OK, "removeItem failed: %08lx\n", hres); + + V_VT(&var) = 0xdead; + hres = IHTMLStorage_getItem(storage2, key, &var); + ok(hres == S_OK, "getItem failed: %08lx\n", hres); + ok(V_VT(&var) == VT_NULL, "got %d\n", V_VT(&var)); + SysFreeString(key); + SysFreeString(value); + + /* item doesn't exist */ + key = SysAllocString(L"nosuch"); + hres = IHTMLStorage_removeItem(storage, key); + ok(hres == S_OK, "removeItem failed: %08lx\n", hres); + + V_VT(&var) = 0xdead; + hres = IHTMLStorage_getItem(storage, key, &var); + ok(hres == S_OK, "getItem failed: %08lx\n", hres); + ok(V_VT(&var) == VT_NULL, "got %d\n", V_VT(&var)); + SysFreeString(key); + + hres = IHTMLStorage_getItem(storage, NULL, NULL); + ok(hres == E_POINTER, "getItem returned: %08lx\n", hres); + + hres = IHTMLStorage_getItem(storage, key, NULL); + ok(hres == E_POINTER, "getItem failed: %08lx\n", hres); + + V_VT(&var) = 0xdead; + hres = IHTMLStorage_getItem(storage, NULL, &var); + ok(hres == S_OK, "getItem returned: %08lx\n", hres); + ok(V_VT(&var) == VT_NULL, "got %d\n", V_VT(&var)); + + hres = IHTMLStorage_setItem(storage, NULL, NULL); + ok(hres == S_OK, "setItem failed: %08lx\n", hres); + + key = SysAllocString(L"winetest2"); + hres = IHTMLStorage_setItem(storage, key, NULL); + ok(hres == S_OK, "setItem failed: %08lx\n", hres); + + hres = IHTMLStorage_setItem(storage, NULL, key); + ok(hres == S_OK, "setItem failed: %08lx\n", hres); + + hres = IHTMLStorage_removeItem(storage, key); + ok(hres == S_OK, "removeItem failed: %08lx\n", hres); + SysFreeString(key); + + hres = IHTMLStorage_removeItem(storage, NULL); + ok(hres == S_OK, "removeItem failed: %08lx\n", hres); + + /* Unicode characters */ + key = SysAllocString(L"winetest"); + value = SysAllocString(L"\x20ac"); + hres = IHTMLStorage_setItem(storage, key, value); + ok(hres == S_OK, "setItem failed: %08lx\n", hres); + hres = IHTMLStorage_removeItem(storage, key); + ok(hres == S_OK, "removeItem failed: %08lx\n", hres); + SysFreeString(value); + SysFreeString(key); + + key = SysAllocString(L"\x20ac"); + value = SysAllocString(L"winetest"); + hres = IHTMLStorage_setItem(storage, key, value); + ok(hres == S_OK, "setItem failed: %08lx\n", hres); + hres = IHTMLStorage_removeItem(storage, key); + ok(hres == S_OK, "removeItem failed: %08lx\n", hres); + SysFreeString(value); + SysFreeString(key); + + IHTMLStorage_Release(storage); + IHTMLStorage_Release(storage2); + IHTMLDocument2_Release(doc); + IHTMLDocument2_Release(doc2); +} + START_TEST(misc) { CoInitialize(NULL); test_HTMLLoadOptions(); + test_HTMLStorage(); CoUninitialize(); }
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
91
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Results per page:
10
25
50
100
200