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
June 2015
----- 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
610 discussions
Start a n
N
ew thread
Alex Henrie : user32: Send BM_SETCHECK before WM_CAPTURECHANGED and add tests.
by Alexandre Julliard
23 Jun '15
23 Jun '15
Module: wine Branch: master Commit: c68843f898da704432c391cab9e534323fec72ae URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c68843f898da704432c391cab…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Jun 23 00:59:08 2015 -0600 user32: Send BM_SETCHECK before WM_CAPTURECHANGED and add tests. --- dlls/user32/button.c | 2 +- dlls/user32/tests/msg.c | 226 +++++++++++++++++++++++++++++++----------------- 2 files changed, 150 insertions(+), 78 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=c68843f898da704432c39…
1
0
0
0
Nikolay Sivov : dwrite: Call SetFillMode() once per run.
by Alexandre Julliard
23 Jun '15
23 Jun '15
Module: wine Branch: master Commit: 69d5e351f97d448a7fd7cc52982d8c5a97fb24bc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=69d5e351f97d448a7fd7cc529…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Jun 22 17:58:40 2015 +0300 dwrite: Call SetFillMode() once per run. --- dlls/dwrite/font.c | 3 ++ dlls/dwrite/tests/font.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 103 insertions(+), 2 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 8ffad31..2091867 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -523,6 +523,9 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface, if (is_sideways) FIXME("sideways mode is not supported.\n"); + if (count) + ID2D1SimplifiedGeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING); + for (g = 0; g < count; g++) { FLOAT xoffset = 0.0, yoffset = 0.0; struct glyph_outline *outline; diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 846b4da..111762c 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -37,6 +37,35 @@ #define EXPECT_HR(hr,hr_exp) \ ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) +#define DEFINE_EXPECT(func) \ + static BOOL expect_ ## func = FALSE, called_ ## func = FALSE + +#define SET_EXPECT(func) \ + do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0) + +#define CHECK_EXPECT2(func) \ + do { \ + ok(expect_ ##func, "unexpected call " #func "\n"); \ + called_ ## func = TRUE; \ + }while(0) + +#define CHECK_EXPECT(func) \ + do { \ + CHECK_EXPECT2(func); \ + expect_ ## func = FALSE; \ + }while(0) + +#define CHECK_CALLED(func) \ + do { \ + ok(called_ ## func, "expected " #func "\n"); \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + +#define CLEAR_CALLED(func) \ + expect_ ## func = called_ ## func = FALSE + +DEFINE_EXPECT(setfillmode); + #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__) static void _expect_ref(IUnknown* obj, ULONG ref, int line) { @@ -457,6 +486,7 @@ static ULONG WINAPI test_geometrysink_Release(ID2D1SimplifiedGeometrySink *iface static void WINAPI test_geometrysink_SetFillMode(ID2D1SimplifiedGeometrySink *iface, D2D1_FILL_MODE mode) { + CHECK_EXPECT(setfillmode); ok(mode == D2D1_FILL_MODE_WINDING, "fill mode %d\n", mode); } @@ -508,7 +538,44 @@ static const ID2D1SimplifiedGeometrySinkVtbl test_geometrysink_vtbl = { test_geometrysink_Close }; +static void WINAPI test_geometrysink2_BeginFigure(ID2D1SimplifiedGeometrySink *iface, + D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin) +{ + ok(0, "unexpected call\n"); +} + +static void WINAPI test_geometrysink2_AddLines(ID2D1SimplifiedGeometrySink *iface, + const D2D1_POINT_2F *points, UINT32 count) +{ + ok(0, "unexpected call\n"); +} + +static void WINAPI test_geometrysink2_AddBeziers(ID2D1SimplifiedGeometrySink *iface, + const D2D1_BEZIER_SEGMENT *beziers, UINT32 count) +{ + ok(0, "unexpected call\n"); +} + +static void WINAPI test_geometrysink2_EndFigure(ID2D1SimplifiedGeometrySink *iface, D2D1_FIGURE_END figureEnd) +{ + ok(0, "unexpected call\n"); +} + +static const ID2D1SimplifiedGeometrySinkVtbl test_geometrysink2_vtbl = { + test_geometrysink_QueryInterface, + test_geometrysink_AddRef, + test_geometrysink_Release, + test_geometrysink_SetFillMode, + test_geometrysink_SetSegmentFlags, + test_geometrysink2_BeginFigure, + test_geometrysink2_AddLines, + test_geometrysink2_AddBeziers, + test_geometrysink2_EndFigure, + test_geometrysink_Close +}; + static ID2D1SimplifiedGeometrySink test_geomsink = { &test_geometrysink_vtbl }; +static ID2D1SimplifiedGeometrySink test_geomsink2 = { &test_geometrysink2_vtbl }; static void test_CreateFontFromLOGFONT(void) { @@ -2991,6 +3058,7 @@ static void test_GetGlyphRunOutline(void) /* default advances, no offsets */ memset(g_startpoints, 0, sizeof(g_startpoints)); g_startpoint_count = 0; + SET_EXPECT(setfillmode); hr = IDWriteFontFace_GetGlyphRunOutline(face, 1024.0, glyphs, NULL, NULL, 2, FALSE, FALSE, &test_geomsink); ok(hr == S_OK, "got 0x%08x\n", hr); ok(g_startpoint_count == 2, "got %d\n", g_startpoint_count); @@ -2999,10 +3067,12 @@ static void test_GetGlyphRunOutline(void) ok(g_startpoints[0].x == 229.5 && g_startpoints[0].y == -629.0, "0: got (%.2f,%.2f)\n", g_startpoints[0].x, g_startpoints[0].y); ok(g_startpoints[1].x == 729.5 && g_startpoints[1].y == -629.0, "1: got (%.2f,%.2f)\n", g_startpoints[1].x, g_startpoints[1].y); } + CHECK_CALLED(setfillmode); /* default advances, no offsets, RTL */ memset(g_startpoints, 0, sizeof(g_startpoints)); g_startpoint_count = 0; + SET_EXPECT(setfillmode); hr = IDWriteFontFace_GetGlyphRunOutline(face, 1024.0, glyphs, NULL, NULL, 2, FALSE, TRUE, &test_geomsink); ok(hr == S_OK, "got 0x%08x\n", hr); ok(g_startpoint_count == 2, "got %d\n", g_startpoint_count); @@ -3011,10 +3081,12 @@ static void test_GetGlyphRunOutline(void) ok(g_startpoints[0].x == -270.5 && g_startpoints[0].y == -629.0, "0: got (%.2f,%.2f)\n", g_startpoints[0].x, g_startpoints[0].y); ok(g_startpoints[1].x == -770.5 && g_startpoints[1].y == -629.0, "1: got (%.2f,%.2f)\n", g_startpoints[1].x, g_startpoints[1].y); } + CHECK_CALLED(setfillmode); /* default advances, additional offsets */ memset(g_startpoints, 0, sizeof(g_startpoints)); g_startpoint_count = 0; + SET_EXPECT(setfillmode); hr = IDWriteFontFace_GetGlyphRunOutline(face, 1024.0, glyphs, NULL, offsets, 2, FALSE, FALSE, &test_geomsink); ok(hr == S_OK, "got 0x%08x\n", hr); ok(g_startpoint_count == 2, "got %d\n", g_startpoint_count); @@ -3023,10 +3095,12 @@ static void test_GetGlyphRunOutline(void) ok(g_startpoints[0].x == 230.5 && g_startpoints[0].y == -630.0, "0: got (%.2f,%.2f)\n", g_startpoints[0].x, g_startpoints[0].y); ok(g_startpoints[1].x == 729.5 && g_startpoints[1].y == -629.0, "1: got (%.2f,%.2f)\n", g_startpoints[1].x, g_startpoints[1].y); } + CHECK_CALLED(setfillmode); /* default advances, additional offsets, RTL */ memset(g_startpoints, 0, sizeof(g_startpoints)); g_startpoint_count = 0; + SET_EXPECT(setfillmode); hr = IDWriteFontFace_GetGlyphRunOutline(face, 1024.0, glyphs, NULL, offsets, 2, FALSE, TRUE, &test_geomsink); ok(hr == S_OK, "got 0x%08x\n", hr); ok(g_startpoint_count == 2, "got %d\n", g_startpoint_count); @@ -3034,10 +3108,12 @@ static void test_GetGlyphRunOutline(void) ok(g_startpoints[0].x == -271.5 && g_startpoints[0].y == -630.0, "0: got (%.2f,%.2f)\n", g_startpoints[0].x, g_startpoints[0].y); ok(g_startpoints[1].x == -770.5 && g_startpoints[1].y == -629.0, "1: got (%.2f,%.2f)\n", g_startpoints[1].x, g_startpoints[1].y); } + CHECK_CALLED(setfillmode); /* custom advances and offsets, offset turns total advance value to zero */ memset(g_startpoints, 0, sizeof(g_startpoints)); g_startpoint_count = 0; + SET_EXPECT(setfillmode); hr = IDWriteFontFace_GetGlyphRunOutline(face, 1024.0, glyphs, advances, offsets, 2, FALSE, FALSE, &test_geomsink); ok(hr == S_OK, "got 0x%08x\n", hr); ok(g_startpoint_count == 2, "got %d\n", g_startpoint_count); @@ -3045,11 +3121,33 @@ static void test_GetGlyphRunOutline(void) ok(g_startpoints[0].x == 230.5 && g_startpoints[0].y == -630.0, "0: got (%.2f,%.2f)\n", g_startpoints[0].x, g_startpoints[0].y); ok(g_startpoints[1].x == 230.5 && g_startpoints[1].y == -629.0, "1: got (%.2f,%.2f)\n", g_startpoints[1].x, g_startpoints[1].y); } + CHECK_CALLED(setfillmode); - IDWriteFontFace_Release(face); - IDWriteFactory_Release(factory); + /* 0 glyph count */ + hr = IDWriteFontFace_GetGlyphRunOutline(face, 1024.0, glyphs, NULL, NULL, 0, FALSE, FALSE, &test_geomsink2); + ok(hr == S_OK, "got 0x%08x\n", hr); + IDWriteFactory_Release(factory); + IDWriteFontFace_Release(face); DELETE_FONTFILE(path); + + /* space glyph */ + factory = create_factory(); + face = create_fontface(factory); + + codepoint = ' '; + glyphs[0] = 0; + hr = IDWriteFontFace_GetGlyphIndices(face, &codepoint, 1, glyphs); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(glyphs[0] > 0, "got %u\n", glyphs[0]); + + SET_EXPECT(setfillmode); + hr = IDWriteFontFace_GetGlyphRunOutline(face, 1024.0, glyphs, NULL, NULL, 1, FALSE, FALSE, &test_geomsink2); + ok(hr == S_OK, "got 0x%08x\n", hr); + CHECK_CALLED(setfillmode); + + IDWriteFactory_Release(factory); + IDWriteFontFace_Release(face); } static void test_GetEudcFontCollection(void)
1
0
0
0
Nikolay Sivov : dwrite: Set baseline origin Y for reported runs.
by Alexandre Julliard
23 Jun '15
23 Jun '15
Module: wine Branch: master Commit: 643125e50f620137c30576a219d6e497f4d1a047 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=643125e50f620137c30576a21…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Jun 22 11:56:25 2015 +0300 dwrite: Set baseline origin Y for reported runs. --- dlls/dwrite/layout.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 6 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index ba31ec6..25e8eac 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -181,6 +181,7 @@ struct layout_effective_run { FLOAT origin_x; /* baseline X position */ FLOAT origin_y; /* baseline Y position */ UINT16 *clustermap; /* effective clustermap, allocated separately, is not reused from nominal map */ + UINT32 line; }; struct layout_effective_inline { @@ -191,6 +192,7 @@ struct layout_effective_inline { FLOAT origin_y; BOOL is_sideways; BOOL is_rtl; + UINT32 line; }; struct layout_strikethrough { @@ -906,7 +908,7 @@ static inline IUnknown *layout_get_effect_from_pos(struct dwrite_textlayout *lay /* Effective run is built from consecutive clusters of a single nominal run, 'first_cluster' is 0 based cluster index, 'cluster_count' indicates how many clusters to add, including first one. */ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const struct layout_run *r, UINT32 first_cluster, - UINT32 cluster_count, FLOAT origin_x, BOOL strikethrough) + UINT32 cluster_count, UINT32 line, FLOAT origin_x, BOOL strikethrough) { UINT32 i, start, length, last_cluster; struct layout_effective_run *run; @@ -926,6 +928,7 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const different ranges which differ in reading direction). */ inlineobject->is_sideways = FALSE; inlineobject->is_rtl = FALSE; + inlineobject->line = line; /* effect assigned from start position and on is used for inline objects */ inlineobject->effect = layout_get_effect_from_pos(layout, layout->clusters[first_cluster].position); @@ -954,7 +957,8 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const run->start = start = layout->clusters[first_cluster].position; run->length = length; run->origin_x = origin_x; - run->origin_y = 0.0; /* FIXME: set after line is built */ + run->origin_y = 0.0; /* set after line is built */ + run->line = line; if (r->u.regular.run.glyphCount) { /* trim from the left */ @@ -1039,11 +1043,41 @@ static inline BOOL layout_get_strikethrough_from_pos(struct dwrite_textlayout *l return ((struct layout_range_bool*)h)->value; } +static inline struct layout_effective_run *layout_get_next_erun(struct dwrite_textlayout *layout, + const struct layout_effective_run *cur) +{ + struct list *e; + + if (!cur) + e = list_head(&layout->eruns); + else + e = list_next(&layout->eruns, &cur->entry); + if (!e) + return NULL; + return LIST_ENTRY(e, struct layout_effective_run, entry); +} + +static inline struct layout_effective_inline *layout_get_next_inline_run(struct dwrite_textlayout *layout, + const struct layout_effective_inline *cur) +{ + struct list *e; + + if (!cur) + e = list_head(&layout->inlineobjects); + else + e = list_next(&layout->inlineobjects, &cur->entry); + if (!e) + return NULL; + return LIST_ENTRY(e, struct layout_effective_inline, entry); +} + static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) { - DWRITE_LINE_METRICS metrics; + struct layout_effective_inline *inrun; + struct layout_effective_run *erun; const struct layout_run *run; - FLOAT width, origin_x; + DWRITE_LINE_METRICS metrics; + FLOAT width, origin_x, origin_y; UINT32 i, start, line, textpos; HRESULT hr; BOOL s[2]; @@ -1070,7 +1104,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) /* switched to next nominal run, at this point all previous pending clusters are already checked for layout line overflow, so new effective run will fit in current line */ if (run != layout->clusters[i].run || s[0] != s[1]) { - hr = layout_add_effective_run(layout, run, start, i - start, origin_x, s[0]); + hr = layout_add_effective_run(layout, run, start, i - start, line, origin_x, s[0]); if (FAILED(hr)) return hr; origin_x += get_cluster_range_width(layout, start, i); @@ -1096,7 +1130,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) last_cluster = i ? i - 1 : i; if (i >= start) { - hr = layout_add_effective_run(layout, run, start, i - start + 1, origin_x, s[0]); + hr = layout_add_effective_run(layout, run, start, i - start + 1, line, origin_x, s[0]); if (FAILED(hr)) return hr; /* we don't need to update origin for next run as we're going to wrap */ @@ -1165,6 +1199,33 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) } layout->line_count = line; + + /* Now all line info is here, update effective runs positions in flow direction */ + erun = layout_get_next_erun(layout, NULL); + inrun = layout_get_next_inline_run(layout, NULL); + + origin_y = 0.0; + for (line = 0; line < layout->line_count; line++) { + + origin_y += layout->lines[line].baseline; + + /* For all runs on this line */ + while (erun && erun->line == line) { + erun->origin_y = origin_y; + erun = layout_get_next_erun(layout, erun); + if (!erun) + break; + } + + /* Same for inline runs */ + while (inrun && inrun->line == line) { + inrun->origin_y = origin_y; + inrun = layout_get_next_inline_run(layout, inrun); + if (!inrun) + break; + } + } + layout->recompute &= ~RECOMPUTE_EFFECTIVE_RUNS; return hr; }
1
0
0
0
Nikolay Sivov : dwrite/tests: Show that line baseline is relative to this line.
by Alexandre Julliard
23 Jun '15
23 Jun '15
Module: wine Branch: master Commit: 88663caf7470ac16c9b392cc70dfae3921276815 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=88663caf7470ac16c9b392cc7…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Jun 21 22:43:01 2015 +0300 dwrite/tests: Show that line baseline is relative to this line. --- dlls/dwrite/tests/layout.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index 505c2eb..ecf4183 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -2730,8 +2730,9 @@ static IDWriteFontFace *get_fontface_from_format(IDWriteTextFormat *format) static void test_GetLineMetrics(void) { static const WCHAR strW[] = {'a','b','c','d',' ',0}; + static const WCHAR str2W[] = {'a','b','\r','c','d',0}; DWRITE_FONT_METRICS fontmetrics; - DWRITE_LINE_METRICS metrics; + DWRITE_LINE_METRICS metrics[2]; IDWriteTextFormat *format; IDWriteTextLayout *layout; IDWriteFontFace *fontface; @@ -2749,31 +2750,47 @@ static void test_GetLineMetrics(void) ok(hr == S_OK, "got 0x%08x\n", hr); count = 0; - hr = IDWriteTextLayout_GetLineMetrics(layout, &metrics, 0, &count); + hr = IDWriteTextLayout_GetLineMetrics(layout, metrics, 0, &count); ok(hr == E_NOT_SUFFICIENT_BUFFER, "got 0x%08x\n", hr); ok(count == 1, "got count %u\n", count); - memset(&metrics, 0, sizeof(metrics)); - hr = IDWriteTextLayout_GetLineMetrics(layout, &metrics, 1, &count); + memset(metrics, 0, sizeof(metrics)); + hr = IDWriteTextLayout_GetLineMetrics(layout, metrics, 1, &count); ok(hr == S_OK, "got 0x%08x\n", hr); - ok(metrics.length == 5, "got %u\n", metrics.length); - ok(metrics.trailingWhitespaceLength == 1, "got %u\n", metrics.trailingWhitespaceLength); + ok(metrics[0].length == 5, "got %u\n", metrics[0].length); + ok(metrics[0].trailingWhitespaceLength == 1, "got %u\n", metrics[0].trailingWhitespaceLength); - ok(metrics.newlineLength == 0, "got %u\n", metrics.newlineLength); - ok(metrics.isTrimmed == FALSE, "got %d\n", metrics.isTrimmed); + ok(metrics[0].newlineLength == 0, "got %u\n", metrics[0].newlineLength); + ok(metrics[0].isTrimmed == FALSE, "got %d\n", metrics[0].isTrimmed); /* Tahoma doesn't provide BASE table, so baseline is calculated from font metrics */ fontface = get_fontface_from_format(format); ok(fontface != NULL, "got %p\n", fontface); IDWriteFontFace_GetMetrics(fontface, &fontmetrics); - ok(metrics.baseline == fontmetrics.ascent, "got %.2f, expected %d\n", metrics.baseline, + ok(metrics[0].baseline == fontmetrics.ascent, "got %.2f, expected %d\n", metrics[0].baseline, fontmetrics.ascent); - ok(metrics.height == fontmetrics.ascent + fontmetrics.descent, "got %.2f, expected %d\n", - metrics.height, fontmetrics.ascent + fontmetrics.descent); + ok(metrics[0].height == fontmetrics.ascent + fontmetrics.descent, "got %.2f, expected %d\n", + metrics[0].height, fontmetrics.ascent + fontmetrics.descent); + IDWriteTextLayout_Release(layout); - IDWriteFontFace_Release(fontface); + /* force 2 lines */ + hr = IDWriteFactory_CreateTextLayout(factory, str2W, 5, format, 10000.0, 1000.0, &layout); + ok(hr == S_OK, "got 0x%08x\n", hr); + + memset(metrics, 0, sizeof(metrics)); + count = 2; + hr = IDWriteTextLayout_GetLineMetrics(layout, metrics, 2, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); +todo_wine { + ok(count == 2, "got %u\n", count); + /* baseline is relative to a line, and is not accumulated */ + ok(metrics[0].baseline == metrics[1].baseline, "got %.2f, %.2f\n", metrics[0].baseline, + metrics[1].baseline); +} IDWriteTextLayout_Release(layout); + + IDWriteFontFace_Release(fontface); IDWriteTextFormat_Release(format); IDWriteFactory_Release(factory); }
1
0
0
0
Nikolay Sivov : dwrite: Set line baseline/height from font metrics.
by Alexandre Julliard
23 Jun '15
23 Jun '15
Module: wine Branch: master Commit: 8adc6679e9750cfd0ddf5821585f1cdbfa64cbc9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8adc6679e9750cfd0ddf58215…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Jun 21 15:34:02 2015 +0300 dwrite: Set line baseline/height from font metrics. --- dlls/dwrite/layout.c | 61 ++++++++++++++++++++++++++++++++++++++++++---- dlls/dwrite/tests/layout.c | 3 +-- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index ebc6f37..ba31ec6 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -168,6 +168,8 @@ struct layout_run { struct inline_object_run object; struct regular_layout_run regular; } u; + FLOAT baseline; + FLOAT height; }; struct layout_effective_run { @@ -573,6 +575,11 @@ static inline UINT32 get_clipped_range_length(const struct dwrite_textlayout *la return layout->len - range->h.range.startPosition; } +static inline FLOAT get_scaled_font_metric(UINT32 metric, FLOAT emSize, const DWRITE_FONT_METRICS *metrics) +{ + return (FLOAT)metric * emSize / (FLOAT)metrics->designUnitsPerEm; +} + static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) { IDWriteTextAnalyzer *analyzer; @@ -639,6 +646,7 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props = NULL; DWRITE_SHAPING_TEXT_PROPERTIES *text_props = NULL; struct regular_layout_run *run = &r->u.regular; + DWRITE_FONT_METRICS fontmetrics = { 0 }; IDWriteFontFamily *family; UINT32 index, max_count; IDWriteFont *font; @@ -669,6 +677,8 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) hr = S_OK; } metrics->width = inlinemetrics.width; + r->baseline = inlinemetrics.baseline; + r->height = inlinemetrics.height; /* FIXME: use resolved breakpoints in this case too */ @@ -778,6 +788,22 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) run->run.glyphCount = 0; else run->run.glyphCount = run->glyphcount; + + /* baseline derived from font metrics */ + if (layout->gdicompatible) { + /* FIXME: check return value when it's actually implemented */ + IDWriteFontFace_GetGdiCompatibleMetrics(run->run.fontFace, + run->run.fontEmSize, + layout->pixels_per_dip, + &layout->transform, + &fontmetrics); + } + else + IDWriteFontFace_GetMetrics(run->run.fontFace, &fontmetrics); + + r->baseline = get_scaled_font_metric(fontmetrics.ascent, run->run.fontEmSize, &fontmetrics); + r->height = get_scaled_font_metric(fontmetrics.ascent + fontmetrics.descent, run->run.fontEmSize, &fontmetrics); + layout_set_cluster_metrics(layout, r, &cluster); continue; @@ -1059,11 +1085,15 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) layout->clustermetrics[i].isNewline || /* always wrap on new line */ i == layout->cluster_count - 1) /* end of the text */ { - UINT32 strlength, index = i; + UINT32 strlength, last_cluster = i, index; + FLOAT descent; - if (!overflow) + if (!overflow) { metrics.length += layout->clustermetrics[i].length; - strlength = metrics.length; + last_cluster = i; + } + else + last_cluster = i ? i - 1 : i; if (i >= start) { hr = layout_add_effective_run(layout, run, start, i - start + 1, origin_x, s[0]); @@ -1074,6 +1104,8 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) /* take a look at clusters we got for this line in reverse order to set trailing properties for current line */ + strlength = metrics.length; + index = last_cluster; while (strlength) { DWRITE_CLUSTER_METRICS *cluster = &layout->clustermetrics[index]; @@ -1092,8 +1124,27 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) index--; } - metrics.height = 0.0; /* FIXME */ - metrics.baseline = 0.0; /* FIXME */ + /* look for max baseline and descent for this line */ + strlength = metrics.length; + index = last_cluster; + metrics.baseline = 0.0; + descent = 0.0; + while (strlength) { + DWRITE_CLUSTER_METRICS *cluster = &layout->clustermetrics[index]; + const struct layout_run *cur = layout->clusters[index].run; + FLOAT cur_descent = cur->height - cur->baseline; + + if (cur->baseline > metrics.baseline) + metrics.baseline = cur->baseline; + + if (cur_descent > descent) + descent = cur_descent; + + strlength -= cluster->length; + index--; + } + metrics.height = descent + metrics.baseline; + metrics.isTrimmed = width > layout->maxwidth; hr = layout_set_line_metrics(layout, &metrics, &line); if (FAILED(hr)) diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index 51e7f4a..505c2eb 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -2767,12 +2767,11 @@ static void test_GetLineMetrics(void) ok(fontface != NULL, "got %p\n", fontface); IDWriteFontFace_GetMetrics(fontface, &fontmetrics); -todo_wine { ok(metrics.baseline == fontmetrics.ascent, "got %.2f, expected %d\n", metrics.baseline, fontmetrics.ascent); ok(metrics.height == fontmetrics.ascent + fontmetrics.descent, "got %.2f, expected %d\n", metrics.height, fontmetrics.ascent + fontmetrics.descent); -} + IDWriteFontFace_Release(fontface); IDWriteTextLayout_Release(layout); IDWriteTextFormat_Release(format);
1
0
0
0
Nikolay Sivov : quartz/tests: Get rid of some casts.
by Alexandre Julliard
23 Jun '15
23 Jun '15
Module: wine Branch: master Commit: 9c9f8c0bb99efde296eb647b27524cb0796698b2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9c9f8c0bb99efde296eb647b2…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Jun 21 10:43:00 2015 +0300 quartz/tests: Get rid of some casts. --- dlls/quartz/tests/referenceclock.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/quartz/tests/referenceclock.c b/dlls/quartz/tests/referenceclock.c index eb6fbda..4721675 100644 --- a/dlls/quartz/tests/referenceclock.c +++ b/dlls/quartz/tests/referenceclock.c @@ -28,21 +28,21 @@ static void test_IReferenceClock_query_interface(const char * clockdesc, IReferenceClock * pClock) { HRESULT hr; - void *pF; + IUnknown *pF; - hr = IReferenceClock_QueryInterface(pClock, &IID_IUnknown, &pF); + hr = IReferenceClock_QueryInterface(pClock, &IID_IUnknown, (void**)&pF); ok(hr == S_OK, "IReferenceClock_QueryInterface returned %x\n", hr); ok(pF != NULL, "pF is NULL\n"); - if (SUCCEEDED(hr)) IUnknown_Release((IUnknown *)pF); + if (SUCCEEDED(hr)) IUnknown_Release(pF); - hr = IReferenceClock_QueryInterface(pClock, &IID_IDirectDraw, &pF); + hr = IReferenceClock_QueryInterface(pClock, &IID_IDirectDraw, (void**)&pF); ok(hr == E_NOINTERFACE, "IReferenceClock_QueryInterface returned %x\n", hr); ok(pF == NULL, "pF is not NULL\n"); - hr = IReferenceClock_QueryInterface(pClock, &IID_IReferenceClock, &pF); + hr = IReferenceClock_QueryInterface(pClock, &IID_IReferenceClock, (void**)&pF); ok(hr == S_OK, "IReferenceClock_QueryInterface returned %x\n", hr); ok(pF != NULL, "pF is NULL\n"); - if (SUCCEEDED(hr)) IReferenceClock_Release((IReferenceClock *)pF); + if (SUCCEEDED(hr)) IUnknown_Release(pF); } /* The following method expects a reference clock that will keep ticking for
1
0
0
0
Huw Davies : Revert "advapi32: Fix RegEnumValueW when enumerating long values.".
by Alexandre Julliard
23 Jun '15
23 Jun '15
Module: wine Branch: master Commit: 645a31474ccff7923a254aa71f862818a8cde9ed URL:
http://source.winehq.org/git/wine.git/?a=commit;h=645a31474ccff7923a254aa71…
Author: Huw Davies <huw(a)codeweavers.com> Date: Mon Jun 22 21:23:54 2015 +0100 Revert "advapi32: Fix RegEnumValueW when enumerating long values.". This reverts commit 443ef6e7a6026f6aaa5ffcfcbc33d582da780ac5. The tests fail on all versions of Windows. --- dlls/advapi32/registry.c | 68 +++++++++++++++++++++++------------------- dlls/advapi32/tests/registry.c | 13 -------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index f8bf21a..30130b1 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -1922,47 +1922,53 @@ LSTATUS WINAPI RegEnumValueW( HKEY hkey, DWORD index, LPWSTR value, LPDWORD val_ status = NtEnumerateValueKey( hkey, index, KeyValueFullInformation, buffer, total_size, &total_size ); + if (status && status != STATUS_BUFFER_OVERFLOW) goto done; - /* retry with a dynamically allocated buffer */ - while (status == STATUS_BUFFER_OVERFLOW) - { - if (buf_ptr != buffer) heap_free( buf_ptr ); - if (!(buf_ptr = heap_alloc( total_size ))) return ERROR_NOT_ENOUGH_MEMORY; - info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr; - status = NtEnumerateValueKey( hkey, index, KeyValueFullInformation, - buf_ptr, total_size, &total_size ); - } - - if (status) goto done; - - if (value) + if (value || data) { - if (info->NameLength/sizeof(WCHAR) >= *val_count) + /* retry with a dynamically allocated buffer */ + while (status == STATUS_BUFFER_OVERFLOW) { - status = STATUS_BUFFER_OVERFLOW; - goto overflow; + if (buf_ptr != buffer) heap_free( buf_ptr ); + if (!(buf_ptr = heap_alloc( total_size ))) + return ERROR_NOT_ENOUGH_MEMORY; + info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr; + status = NtEnumerateValueKey( hkey, index, KeyValueFullInformation, + buf_ptr, total_size, &total_size ); } - memcpy( value, info->Name, info->NameLength ); - *val_count = info->NameLength / sizeof(WCHAR); - value[*val_count] = 0; - } - if (data) - { - if (total_size - info->DataOffset > *count) + if (status) goto done; + + if (value) { - status = STATUS_BUFFER_OVERFLOW; - goto overflow; + if (info->NameLength/sizeof(WCHAR) >= *val_count) + { + status = STATUS_BUFFER_OVERFLOW; + goto overflow; + } + memcpy( value, info->Name, info->NameLength ); + *val_count = info->NameLength / sizeof(WCHAR); + value[*val_count] = 0; } - memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); - if (total_size - info->DataOffset <= *count-sizeof(WCHAR) && is_string(info->Type)) + + if (data) { - /* if the type is REG_SZ and data is not 0-terminated - * and there is enough space in the buffer NT appends a \0 */ - WCHAR *ptr = (WCHAR *)(data + total_size - info->DataOffset); - if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0; + if (total_size - info->DataOffset > *count) + { + status = STATUS_BUFFER_OVERFLOW; + goto overflow; + } + memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); + if (total_size - info->DataOffset <= *count-sizeof(WCHAR) && is_string(info->Type)) + { + /* if the type is REG_SZ and data is not 0-terminated + * and there is enough space in the buffer NT appends a \0 */ + WCHAR *ptr = (WCHAR *)(data + total_size - info->DataOffset); + if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0; + } } } + else status = STATUS_SUCCESS; overflow: if (type) *type = info->Type; diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 561101b..c801384 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -522,8 +522,6 @@ static void test_enum_value(void) static const WCHAR foobarW[] = {'f','o','o','b','a','r',0}; static const WCHAR testW[] = {'T','e','s','t',0}; static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0}; - WCHAR longW[128]; - int i; /* create the working key for new 'Test' value */ res = RegCreateKeyA( hkey_main, "TestKey", &test_key ); @@ -712,17 +710,6 @@ static void test_enum_value(void) ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" ); - /* tests the overflow case for the fixed "char buffer[]" in RegEnumValueW */ - for (i = 0; i < sizeof(longW)/sizeof(WCHAR); i++) longW[i] = 'x'; - longW[i - 1] = 0; - res = RegSetValueExW( test_key, testW, 0, REG_SZ, (const BYTE *)longW, sizeof(longW) ); - ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res ); - data_count = 20; - type = 1234; - res = RegEnumValueW( test_key, 0, NULL, NULL, NULL, &type, NULL, &data_count); - ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res ); - ok( data_count == sizeof(longW), "data_count set to %d\n", data_count ); - cleanup: RegDeleteKeyA(test_key, ""); RegCloseKey(test_key);
1
0
0
0
Piotr Caban : msvcr110: Add __crtGetLocaleInfoEx implementation.
by Alexandre Julliard
22 Jun '15
22 Jun '15
Module: wine Branch: master Commit: d940ac24126d7b3a1c568edc5b1bdbd7118977ac URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d940ac24126d7b3a1c568edc5…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Mon Jun 22 12:52:30 2015 +0200 msvcr110: Add __crtGetLocaleInfoEx implementation. --- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcrt/locale.c | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 516af25..e5ef1bb 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -917,7 +917,7 @@ @ stub -arch=i386,win64 __crtFlsGetValue @ stub -arch=i386,win64 __crtFlsSetValue @ stub -arch=i386,win64 __crtGetDateFormatEx -@ stub -arch=i386,win64 __crtGetLocaleInfoEx +@ cdecl -arch=i386,win64 __crtGetLocaleInfoEx(wstr long ptr long) @ cdecl __crtGetShowWindowMode() MSVCR110__crtGetShowWindowMode @ stub -arch=i386,win64 __crtGetTimeFormatEx @ stub -arch=i386,win64 __crtGetUserDefaultLocaleName diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 6646df3..ff034b7 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -902,7 +902,7 @@ @ stub -arch=i386,win64 __crtFlsSetValue @ stub -arch=i386,win64 __crtGetDateFormatEx @ stub __crtGetFileInformationByHandleEx -@ stub -arch=i386,win64 __crtGetLocaleInfoEx +@ cdecl -arch=i386,win64 __crtGetLocaleInfoEx(wstr long ptr long) @ cdecl __crtGetShowWindowMode() MSVCR110__crtGetShowWindowMode @ stub __crtGetTickCount64 @ stub -arch=i386,win64 __crtGetTimeFormatEx diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index ad0cc98..bd919e6 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -628,6 +628,15 @@ int CDECL __crtGetLocaleInfoW( LCID lcid, LCTYPE type, MSVCRT_wchar_t *buffer, i } /********************************************************************* + * __crtGetLocaleInfoEx (MSVC110.@) + */ +int CDECL __crtGetLocaleInfoEx( const WCHAR *locale, LCTYPE type, MSVCRT_wchar_t *buffer, int len ) +{ + TRACE("(%s, %x, %p, %d)\n", debugstr_w(locale), type, buffer, len); + return GetLocaleInfoEx(locale, type, buffer, len); +} + +/********************************************************************* * btowc(MSVCRT.@) */ MSVCRT_wint_t CDECL MSVCRT_btowc(int c)
1
0
0
0
Bernhard Übelacker : advapi32: Fix RegEnumValueW when enumerating long values.
by Alexandre Julliard
22 Jun '15
22 Jun '15
Module: wine Branch: master Commit: 443ef6e7a6026f6aaa5ffcfcbc33d582da780ac5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=443ef6e7a6026f6aaa5ffcfcb…
Author: Bernhard Übelacker <bernhardu(a)vr-web.de> Date: Sun Jun 21 18:25:48 2015 +0200 advapi32: Fix RegEnumValueW when enumerating long values. --- dlls/advapi32/registry.c | 68 +++++++++++++++++++----------------------- dlls/advapi32/tests/registry.c | 13 ++++++++ 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 30130b1..f8bf21a 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -1922,53 +1922,47 @@ LSTATUS WINAPI RegEnumValueW( HKEY hkey, DWORD index, LPWSTR value, LPDWORD val_ status = NtEnumerateValueKey( hkey, index, KeyValueFullInformation, buffer, total_size, &total_size ); - if (status && status != STATUS_BUFFER_OVERFLOW) goto done; - if (value || data) + /* retry with a dynamically allocated buffer */ + while (status == STATUS_BUFFER_OVERFLOW) { - /* retry with a dynamically allocated buffer */ - while (status == STATUS_BUFFER_OVERFLOW) - { - if (buf_ptr != buffer) heap_free( buf_ptr ); - if (!(buf_ptr = heap_alloc( total_size ))) - return ERROR_NOT_ENOUGH_MEMORY; - info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr; - status = NtEnumerateValueKey( hkey, index, KeyValueFullInformation, - buf_ptr, total_size, &total_size ); - } + if (buf_ptr != buffer) heap_free( buf_ptr ); + if (!(buf_ptr = heap_alloc( total_size ))) return ERROR_NOT_ENOUGH_MEMORY; + info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr; + status = NtEnumerateValueKey( hkey, index, KeyValueFullInformation, + buf_ptr, total_size, &total_size ); + } - if (status) goto done; + if (status) goto done; - if (value) + if (value) + { + if (info->NameLength/sizeof(WCHAR) >= *val_count) { - if (info->NameLength/sizeof(WCHAR) >= *val_count) - { - status = STATUS_BUFFER_OVERFLOW; - goto overflow; - } - memcpy( value, info->Name, info->NameLength ); - *val_count = info->NameLength / sizeof(WCHAR); - value[*val_count] = 0; + status = STATUS_BUFFER_OVERFLOW; + goto overflow; } + memcpy( value, info->Name, info->NameLength ); + *val_count = info->NameLength / sizeof(WCHAR); + value[*val_count] = 0; + } - if (data) + if (data) + { + if (total_size - info->DataOffset > *count) { - if (total_size - info->DataOffset > *count) - { - status = STATUS_BUFFER_OVERFLOW; - goto overflow; - } - memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); - if (total_size - info->DataOffset <= *count-sizeof(WCHAR) && is_string(info->Type)) - { - /* if the type is REG_SZ and data is not 0-terminated - * and there is enough space in the buffer NT appends a \0 */ - WCHAR *ptr = (WCHAR *)(data + total_size - info->DataOffset); - if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0; - } + status = STATUS_BUFFER_OVERFLOW; + goto overflow; + } + memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); + if (total_size - info->DataOffset <= *count-sizeof(WCHAR) && is_string(info->Type)) + { + /* if the type is REG_SZ and data is not 0-terminated + * and there is enough space in the buffer NT appends a \0 */ + WCHAR *ptr = (WCHAR *)(data + total_size - info->DataOffset); + if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0; } } - else status = STATUS_SUCCESS; overflow: if (type) *type = info->Type; diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index c801384..561101b 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -522,6 +522,8 @@ static void test_enum_value(void) static const WCHAR foobarW[] = {'f','o','o','b','a','r',0}; static const WCHAR testW[] = {'T','e','s','t',0}; static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0}; + WCHAR longW[128]; + int i; /* create the working key for new 'Test' value */ res = RegCreateKeyA( hkey_main, "TestKey", &test_key ); @@ -710,6 +712,17 @@ static void test_enum_value(void) ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" ); + /* tests the overflow case for the fixed "char buffer[]" in RegEnumValueW */ + for (i = 0; i < sizeof(longW)/sizeof(WCHAR); i++) longW[i] = 'x'; + longW[i - 1] = 0; + res = RegSetValueExW( test_key, testW, 0, REG_SZ, (const BYTE *)longW, sizeof(longW) ); + ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res ); + data_count = 20; + type = 1234; + res = RegEnumValueW( test_key, 0, NULL, NULL, NULL, &type, NULL, &data_count); + ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res ); + ok( data_count == sizeof(longW), "data_count set to %d\n", data_count ); + cleanup: RegDeleteKeyA(test_key, ""); RegCloseKey(test_key);
1
0
0
0
Hans Leidekker : wbemprox: Implement Win32_Process.WorkingSetSize.
by Alexandre Julliard
22 Jun '15
22 Jun '15
Module: wine Branch: master Commit: 927400be6318ff65bb8b99f6c59faeb1ca075e9f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=927400be6318ff65bb8b99f6c…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Mon Jun 22 12:14:21 2015 +0200 wbemprox: Implement Win32_Process.WorkingSetSize. --- dlls/wbemprox/builtin.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 41a8e97..f1e5c4a 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -351,6 +351,8 @@ static const WCHAR prop_volumenameW[] = {'V','o','l','u','m','e','N','a','m','e',0}; static const WCHAR prop_volumeserialnumberW[] = {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0}; +static const WCHAR prop_workingsetsizeW[] = + {'W','o','r','k','i','n','g','S','e','t','S','i','z','e',0}; /* column definitions must be kept in sync with record structures below */ static const struct column col_baseboard[] = @@ -521,16 +523,17 @@ static const struct column col_printer[] = }; static const struct column col_process[] = { - { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_commandlineW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, - { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_pprocessidW, CIM_UINT32, VT_I4 }, - { prop_processidW, CIM_UINT32, VT_I4 }, - { prop_threadcountW, CIM_UINT32, VT_I4 }, + { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_commandlineW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_pprocessidW, CIM_UINT32, VT_I4 }, + { prop_processidW, CIM_UINT32, VT_I4 }, + { prop_threadcountW, CIM_UINT32, VT_I4 }, + { prop_workingsetsizeW, CIM_UINT64 }, /* methods */ - { method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } + { method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } }; static const struct column col_processor[] = { @@ -911,6 +914,7 @@ struct record_process UINT32 pprocess_id; UINT32 process_id; UINT32 thread_count; + UINT64 workingsetsize; /* methods */ class_method *get_owner; }; @@ -2204,16 +2208,17 @@ static enum fill_status fill_process( struct table *table, const struct expr *co if (!resize_table( table, row + 1, sizeof(*rec) )) goto done; rec = (struct record_process *)(table->data + offset); - rec->caption = heap_strdupW( entry.szExeFile ); - rec->commandline = get_cmdline( entry.th32ProcessID ); - rec->description = heap_strdupW( entry.szExeFile ); + rec->caption = heap_strdupW( entry.szExeFile ); + rec->commandline = get_cmdline( entry.th32ProcessID ); + rec->description = heap_strdupW( entry.szExeFile ); sprintfW( handle, fmtW, entry.th32ProcessID ); - rec->handle = heap_strdupW( handle ); - rec->name = heap_strdupW( entry.szExeFile ); - rec->process_id = entry.th32ProcessID; - rec->pprocess_id = entry.th32ParentProcessID; - rec->thread_count = entry.cntThreads; - rec->get_owner = process_get_owner; + rec->handle = heap_strdupW( handle ); + rec->name = heap_strdupW( entry.szExeFile ); + rec->process_id = entry.th32ProcessID; + rec->pprocess_id = entry.th32ParentProcessID; + rec->thread_count = entry.cntThreads; + rec->workingsetsize = 0; + rec->get_owner = process_get_owner; if (!match_row( table, row, cond, &status )) { free_row_values( table, row );
1
0
0
0
← Newer
1
...
15
16
17
18
19
20
21
...
61
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
Results per page:
10
25
50
100
200