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
July 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
567 discussions
Start a n
N
ew thread
Henri Verbeet : d2d1: Implement d2d_text_renderer_GetCurrentTransform().
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: a73035c3020eb624e82706e85120359e277ec888 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a73035c3020eb624e82706e85…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Jul 9 14:22:12 2015 +0200 d2d1: Implement d2d_text_renderer_GetCurrentTransform(). --- dlls/d2d1/render_target.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c index 44ec026..5063b6b 100644 --- a/dlls/d2d1/render_target.c +++ b/dlls/d2d1/render_target.c @@ -1326,9 +1326,13 @@ static HRESULT STDMETHODCALLTYPE d2d_text_renderer_IsPixelSnappingDisabled(IDWri static HRESULT STDMETHODCALLTYPE d2d_text_renderer_GetCurrentTransform(IDWriteTextRenderer *iface, void *ctx, DWRITE_MATRIX *transform) { - FIXME("iface %p, ctx %p, transform %p stub!\n", iface, ctx, transform); + struct d2d_d3d_render_target *render_target = impl_from_IDWriteTextRenderer(iface); - return E_NOTIMPL; + TRACE("iface %p, ctx %p, transform %p.\n", iface, ctx, transform); + + ID2D1RenderTarget_GetTransform(&render_target->ID2D1RenderTarget_iface, (D2D1_MATRIX_3X2_F *)transform); + + return S_OK; } static HRESULT STDMETHODCALLTYPE d2d_text_renderer_GetPixelsPerDip(IDWriteTextRenderer *iface, void *ctx, float *ppd)
1
0
0
0
Henri Verbeet : d2d1: Implement d2d_text_renderer_IsPixelSnappingDisabled( ).
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: 47260762a9a8afbe5685ce82dd7f16836fb530dd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=47260762a9a8afbe5685ce82d…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Jul 9 14:22:11 2015 +0200 d2d1: Implement d2d_text_renderer_IsPixelSnappingDisabled(). --- dlls/d2d1/render_target.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c index 2b33c80..44ec026 100644 --- a/dlls/d2d1/render_target.c +++ b/dlls/d2d1/render_target.c @@ -1314,9 +1314,13 @@ static ULONG STDMETHODCALLTYPE d2d_text_renderer_Release(IDWriteTextRenderer *if static HRESULT STDMETHODCALLTYPE d2d_text_renderer_IsPixelSnappingDisabled(IDWriteTextRenderer *iface, void *ctx, BOOL *disabled) { - FIXME("iface %p, ctx %p, disabled %p stub!\n", iface, ctx, disabled); + struct d2d_draw_text_layout_ctx *context = ctx; - return E_NOTIMPL; + TRACE("iface %p, ctx %p, disabled %p.\n", iface, ctx, disabled); + + *disabled = context->options & D2D1_DRAW_TEXT_OPTIONS_NO_SNAP; + + return S_OK; } static HRESULT STDMETHODCALLTYPE d2d_text_renderer_GetCurrentTransform(IDWriteTextRenderer *iface, @@ -1351,7 +1355,7 @@ static HRESULT STDMETHODCALLTYPE d2d_text_renderer_DrawGlyphRun(IDWriteTextRende FIXME("Ignoring glyph run description %p.\n", desc); if (effect) FIXME("Ignoring effect %p.\n", effect); - if (context->options) + if (context->options & ~D2D1_DRAW_TEXT_OPTIONS_NO_SNAP) FIXME("Ignoring options %#x.\n", context->options); TRACE("%s\n", debugstr_wn(desc->string, desc->stringLength));
1
0
0
0
Henri Verbeet : d2d1: Implement d2d_d3d_render_target_DrawGlyphRun().
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: a44dfc58ab598d83256f9083ca89f44c8af8c28f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a44dfc58ab598d83256f9083c…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Jul 9 14:22:10 2015 +0200 d2d1: Implement d2d_d3d_render_target_DrawGlyphRun(). --- dlls/d2d1/render_target.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c index 9e99156..2b33c80 100644 --- a/dlls/d2d1/render_target.c +++ b/dlls/d2d1/render_target.c @@ -826,8 +826,53 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawGlyphRun(ID2D1RenderTarg D2D1_POINT_2F baseline_origin, const DWRITE_GLYPH_RUN *glyph_run, ID2D1Brush *brush, DWRITE_MEASURING_MODE measuring_mode) { - FIXME("iface %p, baseline_origin {%.8e, %.8e}, glyph_run %p, brush %p, measuring_mode %#x stub!\n", + struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface); + D2D1_MATRIX_3X2_F *transform, prev_transform; + ID2D1PathGeometry *geometry; + ID2D1GeometrySink *sink; + HRESULT hr; + + TRACE("iface %p, baseline_origin {%.8e, %.8e}, glyph_run %p, brush %p, measuring_mode %#x.\n", iface, baseline_origin.x, baseline_origin.y, glyph_run, brush, measuring_mode); + + if (measuring_mode) + FIXME("Ignoring measuring mode %#x.\n", measuring_mode); + + if (FAILED(hr = ID2D1Factory_CreatePathGeometry(render_target->factory, &geometry))) + { + ERR("Failed to create geometry, hr %#x.\n", hr); + return; + } + + if (FAILED(hr = ID2D1PathGeometry_Open(geometry, &sink))) + { + ERR("Failed to open geometry sink, hr %#x.\n", hr); + ID2D1PathGeometry_Release(geometry); + return; + } + + if (FAILED(hr = IDWriteFontFace_GetGlyphRunOutline(glyph_run->fontFace, glyph_run->fontEmSize, + glyph_run->glyphIndices, glyph_run->glyphAdvances, glyph_run->glyphOffsets, glyph_run->glyphCount, + glyph_run->isSideways, glyph_run->bidiLevel & 1, (IDWriteGeometrySink *)sink))) + { + ERR("Failed to get glyph run outline, hr %#x.\n", hr); + ID2D1GeometrySink_Release(sink); + ID2D1PathGeometry_Release(geometry); + return; + } + + if (FAILED(hr = ID2D1GeometrySink_Close(sink))) + ERR("Failed to close geometry sink, hr %#x.\n", hr); + ID2D1GeometrySink_Release(sink); + + transform = &render_target->drawing_state.transform; + prev_transform = *transform; + transform->_31 += baseline_origin.x * transform->_11 + baseline_origin.y * transform->_21; + transform->_32 += baseline_origin.x * transform->_12 + baseline_origin.y * transform->_22; + ID2D1RenderTarget_FillGeometry(iface, (ID2D1Geometry *)geometry, brush, NULL); + *transform = prev_transform; + + ID2D1PathGeometry_Release(geometry); } static void STDMETHODCALLTYPE d2d_d3d_render_target_SetTransform(ID2D1RenderTarget *iface,
1
0
0
0
Nikolay Sivov : dwrite: Properly set run origin in DWRITE_READING_DIRECTION_RIGHT_TO_LEFT case.
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: 0dcc9ead9e21d23d7903f78513de0511f6de18bc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0dcc9ead9e21d23d7903f7851…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Jul 9 12:29:09 2015 +0300 dwrite: Properly set run origin in DWRITE_READING_DIRECTION_RIGHT_TO_LEFT case. --- dlls/dwrite/layout.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index c9c35cc..b07aec0 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -942,11 +942,17 @@ static inline IUnknown *layout_get_effect_from_pos(struct dwrite_textlayout *lay return ((struct layout_range_effect*)h)->effect; } +static inline BOOL layout_is_erun_rtl(const struct layout_effective_run *erun) +{ + return erun->run->u.regular.run.bidiLevel & 1; +} + /* 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, UINT32 line, FLOAT origin_x, BOOL strikethrough) { + BOOL is_rtl = layout->format.readingdir == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT; UINT32 i, start, length, last_cluster; struct layout_effective_run *run; @@ -958,10 +964,11 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const return E_OUTOFMEMORY; inlineobject->object = r->u.object.object; - inlineobject->origin_x = origin_x; - inlineobject->origin_y = 0.0; /* FIXME */ - inlineobject->align_dx = 0.0; inlineobject->width = get_cluster_range_width(layout, first_cluster, first_cluster + cluster_count); + inlineobject->origin_x = is_rtl ? origin_x - inlineobject->width : origin_x; + inlineobject->origin_y = 0.0; /* set after line is built */ + inlineobject->align_dx = 0.0; + /* It's not clear how these two are set, possibly directionality is derived from surrounding text (replaced text could have different ranges which differ in reading direction). */ @@ -995,10 +1002,17 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const run->run = r; run->start = start = layout->clusters[first_cluster].position; run->length = length; - run->origin_x = origin_x; + run->width = get_cluster_range_width(layout, first_cluster, first_cluster + cluster_count); + + /* Check if run direction matches paragraph direction, if it doesn't adjust by + run width */ + if (layout_is_erun_rtl(run) ^ is_rtl) + run->origin_x = is_rtl ? origin_x - run->width : origin_x + run->width; + else + run->origin_x = origin_x; + run->origin_y = 0.0; /* set after line is built */ run->align_dx = 0.0; - run->width = get_cluster_range_width(layout, first_cluster, first_cluster + cluster_count); run->line = line; if (r->u.regular.run.glyphCount) { @@ -1304,7 +1318,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) return hr; layout->metrics.lineCount = 0; - origin_x = 0.0; + origin_x = is_rtl ? layout->metrics.layoutWidth : 0.0; line = 0; run = layout->clusters[0].run; memset(&metrics, 0, sizeof(metrics)); @@ -1321,7 +1335,8 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) 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); + origin_x += is_rtl ? -get_cluster_range_width(layout, start, i) : + get_cluster_range_width(layout, start, i); run = layout->clusters[i].run; start = i; } @@ -1409,7 +1424,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) width = layout->clustermetrics[i].width; memset(&metrics, 0, sizeof(metrics)); - origin_x = 0.0; + origin_x = is_rtl ? layout->metrics.layoutWidth : 0.0; start = i; } else {
1
0
0
0
Nikolay Sivov : dwrite: Fix alignment shifts in RTL case.
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: 8201fa14c9db6e84a4b483d7ee25c72a1c50821b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8201fa14c9db6e84a4b483d7e…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Jul 9 12:26:23 2015 +0300 dwrite: Fix alignment shifts in RTL case. --- dlls/dwrite/layout.c | 17 ++++++++++++++--- dlls/dwrite/tests/layout.c | 2 -- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 507ad01..c9c35cc 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -1137,6 +1137,7 @@ static FLOAT layout_get_line_width(struct dwrite_textlayout *layout, static void layout_apply_leading_alignment(struct dwrite_textlayout *layout) { + BOOL is_rtl = layout->format.readingdir == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT; struct layout_effective_inline *inrun; struct layout_effective_run *erun; @@ -1153,11 +1154,12 @@ static void layout_apply_leading_alignment(struct dwrite_textlayout *layout) inrun = layout_get_next_inline_run(layout, inrun); } - layout->metrics.left = 0; + layout->metrics.left = is_rtl ? layout->metrics.layoutWidth - layout->metrics.width : 0.0; } static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout) { + BOOL is_rtl = layout->format.readingdir == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT; struct layout_effective_inline *inrun; struct layout_effective_run *erun; UINT32 line; @@ -1169,6 +1171,9 @@ static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout) FLOAT width = layout_get_line_width(layout, erun, inrun, line); FLOAT shift = layout->metrics.layoutWidth - width; + if (is_rtl) + shift *= -1.0; + while (erun && erun->line == line) { erun->align_dx = shift; erun = layout_get_next_erun(layout, erun); @@ -1180,11 +1185,12 @@ static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout) } } - layout->metrics.left = layout->metrics.layoutWidth - layout->metrics.width; + layout->metrics.left = is_rtl ? 0.0 : layout->metrics.layoutWidth - layout->metrics.width; } static void layout_apply_centered_alignment(struct dwrite_textlayout *layout) { + BOOL is_rtl = layout->format.readingdir == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT; struct layout_effective_inline *inrun; struct layout_effective_run *erun; UINT32 line; @@ -1196,6 +1202,9 @@ static void layout_apply_centered_alignment(struct dwrite_textlayout *layout) FLOAT width = layout_get_line_width(layout, erun, inrun, line); FLOAT shift = (layout->metrics.layoutWidth - width) / 2.0; + if (is_rtl) + shift *= -1.0; + while (erun && erun->line == line) { erun->align_dx = shift; erun = layout_get_next_erun(layout, erun); @@ -1277,6 +1286,7 @@ static void layout_apply_par_alignment(struct dwrite_textlayout *layout) static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) { + BOOL is_rtl = layout->format.readingdir == DWRITE_READING_DIRECTION_RIGHT_TO_LEFT; struct layout_effective_inline *inrun; struct layout_effective_run *erun; const struct layout_run *run; @@ -1411,7 +1421,8 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout) textpos += layout->clustermetrics[i].length; } - layout->metrics.left = layout->metrics.top = 0.0; + layout->metrics.left = is_rtl ? layout->metrics.layoutWidth - layout->metrics.width : 0; + layout->metrics.top = 0.0; layout->metrics.maxBidiReorderingDepth = 1; /* FIXME */ layout->metrics.height = 0.0; diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index 70908d2..0fc101b 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -3168,7 +3168,6 @@ static void test_SetReadingDirection(void) hr = IDWriteTextLayout_GetMetrics(layout, &metrics); ok(hr == S_OK, "got 0x%08x\n", hr); -todo_wine ok(metrics.left == metrics.layoutWidth - clusters[0].width, "got %.2f\n", metrics.left); ok(metrics.top == 0.0, "got %.2f\n", metrics.top); ok(metrics.width == clusters[0].width, "got %.2f\n", metrics.width); @@ -3184,7 +3183,6 @@ todo_wine hr = IDWriteTextLayout_GetMetrics(layout, &metrics); ok(hr == S_OK, "got 0x%08x\n", hr); -todo_wine ok(metrics.left == 0.0, "got %.2f\n", metrics.left); ok(metrics.top == 0.0, "got %.2f\n", metrics.top); ok(metrics.width == clusters[0].width, "got %.2f\n", metrics.width);
1
0
0
0
Nikolay Sivov : dwrite: Implement SetReadingDirection() for layout.
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: 6d52bc59c0dbda7ce365979e291f4e0ffff6d2e7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6d52bc59c0dbda7ce365979e2…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Jul 9 12:25:54 2015 +0300 dwrite: Implement SetReadingDirection() for layout. --- dlls/dwrite/layout.c | 34 ++++++++++++----- dlls/dwrite/tests/layout.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 10 deletions(-) diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index d979307..507ad01 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -352,6 +352,16 @@ static inline HRESULT format_set_paralignment(struct dwrite_textformat_data *for return S_OK; } +static inline HRESULT format_set_readingdirection(struct dwrite_textformat_data *format, + DWRITE_READING_DIRECTION direction, BOOL *changed) +{ + if ((UINT32)direction > DWRITE_READING_DIRECTION_BOTTOM_TO_TOP) + return E_INVALIDARG; + if (changed) *changed = format->readingdir != direction; + format->readingdir = direction; + return S_OK; +} + static HRESULT get_fontfallback_from_format(const struct dwrite_textformat_data *format, IDWriteFontFallback **fallback) { *fallback = format->fallback; @@ -2168,7 +2178,6 @@ static HRESULT WINAPI dwritetextlayout_SetWordWrapping(IDWriteTextLayout2 *iface static HRESULT WINAPI dwritetextlayout_SetReadingDirection(IDWriteTextLayout2 *iface, DWRITE_READING_DIRECTION direction) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout2(iface); - TRACE("(%p)->(%d)\n", This, direction); return IDWriteTextFormat1_SetReadingDirection(&This->IDWriteTextFormat1_iface, direction); } @@ -3208,8 +3217,19 @@ static HRESULT WINAPI dwritetextformat1_layout_SetWordWrapping(IDWriteTextFormat static HRESULT WINAPI dwritetextformat1_layout_SetReadingDirection(IDWriteTextFormat1 *iface, DWRITE_READING_DIRECTION direction) { struct dwrite_textlayout *This = impl_layout_form_IDWriteTextFormat1(iface); - FIXME("(%p)->(%d): stub\n", This, direction); - return E_NOTIMPL; + BOOL changed; + HRESULT hr; + + TRACE("(%p)->(%d)\n", This, direction); + + hr = format_set_readingdirection(&This->format, direction, &changed); + if (FAILED(hr)) + return hr; + + if (changed) + This->recompute = RECOMPUTE_EVERYTHING; + + return S_OK; } static HRESULT WINAPI dwritetextformat1_layout_SetFlowDirection(IDWriteTextFormat1 *iface, DWRITE_FLOW_DIRECTION direction) @@ -4088,14 +4108,8 @@ static HRESULT WINAPI dwritetextformat_SetWordWrapping(IDWriteTextFormat1 *iface static HRESULT WINAPI dwritetextformat_SetReadingDirection(IDWriteTextFormat1 *iface, DWRITE_READING_DIRECTION direction) { struct dwrite_textformat *This = impl_from_IDWriteTextFormat1(iface); - TRACE("(%p)->(%d)\n", This, direction); - - if ((UINT32)direction > DWRITE_READING_DIRECTION_BOTTOM_TO_TOP) - return E_INVALIDARG; - - This->format.readingdir = direction; - return S_OK; + return format_set_readingdirection(&This->format, direction, NULL); } static HRESULT WINAPI dwritetextformat_SetFlowDirection(IDWriteTextFormat1 *iface, DWRITE_FLOW_DIRECTION direction) diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index 07ebaf3..70908d2 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -3120,6 +3120,100 @@ static void test_SetParagraphAlignment(void) IDWriteFactory_Release(factory); } +static void test_SetReadingDirection(void) +{ + static const WCHAR strW[] = {'a',0}; + DWRITE_CLUSTER_METRICS clusters[1]; + DWRITE_TEXT_METRICS metrics; + IDWriteTextFormat *format; + IDWriteTextLayout *layout; + IDWriteFactory *factory; + DWRITE_READING_DIRECTION v; + DWRITE_LINE_METRICS lines[1]; + UINT32 count; + HRESULT hr; + + factory = create_factory(); + + hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, + DWRITE_FONT_STRETCH_NORMAL, 12.0, enusW, &format); + ok(hr == S_OK, "got 0x%08x\n", hr); + + v = IDWriteTextFormat_GetReadingDirection(format); + ok(v == DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, "got %d\n", v); + + hr = IDWriteFactory_CreateTextLayout(factory, strW, 1, format, 500.0, 100.0, &layout); + ok(hr == S_OK, "got 0x%08x\n", hr); + + v = IDWriteTextLayout_GetReadingDirection(layout); + ok(v == DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, "got %d\n", v); + + v = IDWriteTextFormat_GetReadingDirection(format); + ok(v == DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, "got %d\n", v); + + hr = IDWriteTextLayout_SetReadingDirection(layout, DWRITE_READING_DIRECTION_RIGHT_TO_LEFT); + ok(hr == S_OK, "got 0x%08x\n", hr); + + count = 0; + hr = IDWriteTextLayout_GetLineMetrics(layout, lines, 1, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count == 1, "got %u\n", count); + + count = 0; + hr = IDWriteTextLayout_GetClusterMetrics(layout, clusters, 1, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count == 1, "got %u\n", count); + + /* leading alignment, RTL */ + hr = IDWriteTextLayout_GetMetrics(layout, &metrics); + ok(hr == S_OK, "got 0x%08x\n", hr); + +todo_wine + ok(metrics.left == metrics.layoutWidth - clusters[0].width, "got %.2f\n", metrics.left); + ok(metrics.top == 0.0, "got %.2f\n", metrics.top); + ok(metrics.width == clusters[0].width, "got %.2f\n", metrics.width); + ok(metrics.height == lines[0].height, "got %.2f\n", metrics.height); + ok(metrics.layoutWidth == 500.0, "got %.2f\n", metrics.layoutWidth); + ok(metrics.layoutHeight == 100.0, "got %.2f\n", metrics.layoutHeight); + ok(metrics.lineCount == 1, "got %d\n", metrics.lineCount); + + /* trailing alignment, RTL */ + hr = IDWriteTextLayout_SetTextAlignment(layout, DWRITE_TEXT_ALIGNMENT_TRAILING); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteTextLayout_GetMetrics(layout, &metrics); + ok(hr == S_OK, "got 0x%08x\n", hr); + +todo_wine + ok(metrics.left == 0.0, "got %.2f\n", metrics.left); + ok(metrics.top == 0.0, "got %.2f\n", metrics.top); + ok(metrics.width == clusters[0].width, "got %.2f\n", metrics.width); + ok(metrics.height == lines[0].height, "got %.2f\n", metrics.height); + ok(metrics.layoutWidth == 500.0, "got %.2f\n", metrics.layoutWidth); + ok(metrics.layoutHeight == 100.0, "got %.2f\n", metrics.layoutHeight); + ok(metrics.lineCount == 1, "got %d\n", metrics.lineCount); + + /* centered alignment, RTL */ + hr = IDWriteTextLayout_SetTextAlignment(layout, DWRITE_TEXT_ALIGNMENT_CENTER); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteTextLayout_GetMetrics(layout, &metrics); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ok(metrics.left == (metrics.layoutWidth - clusters[0].width) / 2.0, "got %.2f\n", metrics.left); + ok(metrics.top == 0.0, "got %.2f\n", metrics.top); + ok(metrics.width == clusters[0].width, "got %.2f\n", metrics.width); + ok(metrics.height == lines[0].height, "got %.2f\n", metrics.height); + ok(metrics.layoutWidth == 500.0, "got %.2f\n", metrics.layoutWidth); + ok(metrics.layoutHeight == 100.0, "got %.2f\n", metrics.layoutHeight); + ok(metrics.lineCount == 1, "got %d\n", metrics.lineCount); + + IDWriteTextLayout_Release(layout); + + IDWriteTextFormat_Release(format); + IDWriteFactory_Release(factory); +} + START_TEST(layout) { static const WCHAR ctrlstrW[] = {0x202a,0}; @@ -3162,6 +3256,7 @@ START_TEST(layout) test_GetLineMetrics(); test_SetTextAlignment(); test_SetParagraphAlignment(); + test_SetReadingDirection(); IDWriteFactory_Release(factory); }
1
0
0
0
Sebastian Lackner : ntdll: Implement semi-stub for RtlGetCompressionWorkSpaceSize.
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: 577332f61252441b20a1dd9d1785e311f21403c1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=577332f61252441b20a1dd9d1…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 9 03:06:10 2015 +0200 ntdll: Implement semi-stub for RtlGetCompressionWorkSpaceSize. --- dlls/ntdll/rtl.c | 30 ++++++++++++++++++++++++------ dlls/ntdll/tests/rtl.c | 15 ++------------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 8bbb610..d9e448a 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1224,14 +1224,32 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushListSList(PSLIST_HEADER list, PSLIST_ENTRY /****************************************************************************** * RtlGetCompressionWorkSpaceSize [NTDLL.@] */ -NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT CompressionFormatAndEngine, - PULONG CompressBufferWorkSpaceSize, - PULONG CompressFragmentWorkSpaceSize) +NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT format, PULONG compress_workspace, + PULONG decompress_workspace) { - FIXME("0x%04x, %p, %p: stub!\n", CompressionFormatAndEngine, CompressBufferWorkSpaceSize, - CompressFragmentWorkSpaceSize); + FIXME("0x%04x, %p, %p: semi-stub\n", format, compress_workspace, decompress_workspace); - return STATUS_NOT_IMPLEMENTED; + switch (format & ~COMPRESSION_ENGINE_MAXIMUM) + { + case COMPRESSION_FORMAT_LZNT1: + if (compress_workspace) + { + /* FIXME: The current implementation of RtlCompressBuffer does not use a + * workspace buffer, but Windows applications might expect a nonzero value. */ + *compress_workspace = 16; + } + if (decompress_workspace) + *decompress_workspace = 0x1000; + return STATUS_SUCCESS; + + case COMPRESSION_FORMAT_NONE: + case COMPRESSION_FORMAT_DEFAULT: + return STATUS_INVALID_PARAMETER; + + default: + FIXME("format %u not implemented\n", format); + return STATUS_UNSUPPORTED_COMPRESSION; + } } /* compress data using LZNT1, currently only a stub */ diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index a2e7f6c..c6a7023 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -1623,14 +1623,10 @@ static void test_RtlCompressBuffer(void) compress_workspace = decompress_workspace = 0xdeadbeef; status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace, &decompress_workspace); - todo_wine ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); - if (status == STATUS_SUCCESS) - { - workspace = HeapAlloc(GetProcessHeap(), 0, compress_workspace); - ok(workspace != NULL, "HeapAlloc failed %d\n", GetLastError()); - } + workspace = HeapAlloc(GetProcessHeap(), 0, compress_workspace); + ok(workspace != NULL, "HeapAlloc failed %d\n", GetLastError()); /* test compression format / engine */ final_size = 0xdeadbeef; @@ -1699,35 +1695,28 @@ static void test_RtlGetCompressionWorkSpaceSize(void) /* test invalid format / engine */ status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_NONE, &compress_workspace, &decompress_workspace); - todo_wine ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_DEFAULT, &compress_workspace, &decompress_workspace); - todo_wine ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); status = pRtlGetCompressionWorkSpaceSize(0xFF, &compress_workspace, &decompress_workspace); - todo_wine ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status); /* test LZNT1 with normal and maximum compression */ compress_workspace = decompress_workspace = 0xdeadbeef; status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace, &decompress_workspace); - todo_wine ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); - todo_wine ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace); compress_workspace = decompress_workspace = 0xdeadbeef; status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM, &compress_workspace, &decompress_workspace); - todo_wine ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); - todo_wine ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace); }
1
0
0
0
Sebastian Lackner : ntdll/tests: Add tests for RtlGetCompressionWorkSpaceSize.
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: ee899dc55e7313161f69bd2e8e9194ba06ac4970 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ee899dc55e7313161f69bd2e8…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 9 03:05:45 2015 +0200 ntdll/tests: Add tests for RtlGetCompressionWorkSpaceSize. --- dlls/ntdll/tests/rtl.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 755424c..a2e7f6c 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -1685,6 +1685,52 @@ static void test_RtlCompressBuffer(void) HeapFree(GetProcessHeap(), 0, workspace); } +static void test_RtlGetCompressionWorkSpaceSize(void) +{ + ULONG compress_workspace, decompress_workspace; + NTSTATUS status; + + if (!pRtlGetCompressionWorkSpaceSize) + { + win_skip("RtlGetCompressionWorkSpaceSize is not available\n"); + return; + } + + /* test invalid format / engine */ + status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_NONE, &compress_workspace, + &decompress_workspace); + todo_wine + ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); + + status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_DEFAULT, &compress_workspace, + &decompress_workspace); + todo_wine + ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); + + status = pRtlGetCompressionWorkSpaceSize(0xFF, &compress_workspace, &decompress_workspace); + todo_wine + ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status); + + /* test LZNT1 with normal and maximum compression */ + compress_workspace = decompress_workspace = 0xdeadbeef; + status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace, + &decompress_workspace); + todo_wine + ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); + ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); + todo_wine + ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace); + + compress_workspace = decompress_workspace = 0xdeadbeef; + status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM, + &compress_workspace, &decompress_workspace); + todo_wine + ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); + ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); + todo_wine + ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace); +} + START_TEST(rtl) { InitFunctionPtrs(); @@ -1712,4 +1758,5 @@ START_TEST(rtl) test_LdrAddRefDll(); test_LdrLockLoaderLock(); test_RtlCompressBuffer(); + test_RtlGetCompressionWorkSpaceSize(); }
1
0
0
0
Sebastian Lackner : ntdll: Implement semi-stub for LZNT1 compression in RtlCompressBuffer.
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: 275424e939d850593d1dbd173d928e607411a6aa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=275424e939d850593d1dbd173…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 9 03:05:27 2015 +0200 ntdll: Implement semi-stub for LZNT1 compression in RtlCompressBuffer. This stub implementation just emits uncompressed blocks with appropriate chunk headers. --- dlls/ntdll/rtl.c | 58 +++++++++++++++++++++++++++++++++++++++++++------- dlls/ntdll/tests/rtl.c | 6 ------ 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 855bdb9..8bbb610 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1234,19 +1234,61 @@ NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT CompressionFormatAndEngine return STATUS_NOT_IMPLEMENTED; } +/* compress data using LZNT1, currently only a stub */ +static NTSTATUS lznt1_compress(UCHAR *src, ULONG src_size, UCHAR *dst, ULONG dst_size, + ULONG chunk_size, ULONG *final_size, UCHAR *workspace) +{ + UCHAR *src_cur = src, *src_end = src + src_size; + UCHAR *dst_cur = dst, *dst_end = dst + dst_size; + ULONG block_size; + + while (src_cur < src_end) + { + /* determine size of current chunk */ + block_size = min(0x1000, src_end - src_cur); + if (dst_cur + sizeof(WORD) + block_size > dst_end) + return STATUS_BUFFER_TOO_SMALL; + + /* write (uncompressed) chunk header */ + *(WORD *)dst_cur = 0x3000 | (block_size - 1); + dst_cur += sizeof(WORD); + + /* write chunk content */ + memcpy(dst_cur, src_cur, block_size); + dst_cur += block_size; + src_cur += block_size; + } + + if (final_size) + *final_size = dst_cur - dst; + + return STATUS_SUCCESS; +} + /****************************************************************************** * RtlCompressBuffer [NTDLL.@] */ -NTSTATUS WINAPI RtlCompressBuffer(USHORT CompressionFormatAndEngine, PUCHAR UncompressedBuffer, - ULONG UncompressedBufferSize, PUCHAR CompressedBuffer, - ULONG CompressedBufferSize, ULONG UncompressedChunkSize, - PULONG FinalCompressedSize, PVOID WorkSpace) +NTSTATUS WINAPI RtlCompressBuffer(USHORT format, PUCHAR uncompressed, ULONG uncompressed_size, + PUCHAR compressed, ULONG compressed_size, ULONG chunk_size, + PULONG final_size, PVOID workspace) { - FIXME("0x%04x, %p, %u, %p, %u, %u, %p, %p :stub\n", CompressionFormatAndEngine, UncompressedBuffer, - UncompressedBufferSize, CompressedBuffer, CompressedBufferSize, UncompressedChunkSize, - FinalCompressedSize, WorkSpace); + FIXME("0x%04x, %p, %u, %p, %u, %u, %p, %p: semi-stub\n", format, uncompressed, + uncompressed_size, compressed, compressed_size, chunk_size, final_size, workspace); - return STATUS_NOT_IMPLEMENTED; + switch (format & ~COMPRESSION_ENGINE_MAXIMUM) + { + case COMPRESSION_FORMAT_LZNT1: + return lznt1_compress(uncompressed, uncompressed_size, compressed, + compressed_size, chunk_size, final_size, workspace); + + case COMPRESSION_FORMAT_NONE: + case COMPRESSION_FORMAT_DEFAULT: + return STATUS_INVALID_PARAMETER; + + default: + FIXME("format %u not implemented\n", format); + return STATUS_UNSUPPORTED_COMPRESSION; + } } /****************************************************************************** diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 0b64d95..755424c 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -1636,21 +1636,18 @@ static void test_RtlCompressBuffer(void) final_size = 0xdeadbeef; status = pRtlCompressBuffer(COMPRESSION_FORMAT_NONE, test_buffer, sizeof(test_buffer), buf1, sizeof(buf1) - 1, 4096, &final_size, workspace); - todo_wine ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size); final_size = 0xdeadbeef; status = pRtlCompressBuffer(COMPRESSION_FORMAT_DEFAULT, test_buffer, sizeof(test_buffer), buf1, sizeof(buf1) - 1, 4096, &final_size, workspace); - todo_wine ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size); final_size = 0xdeadbeef; status = pRtlCompressBuffer(0xFF, test_buffer, sizeof(test_buffer), buf1, sizeof(buf1) - 1, 4096, &final_size, workspace); - todo_wine ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status); ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size); @@ -1659,9 +1656,7 @@ static void test_RtlCompressBuffer(void) memset(buf1, 0x11, sizeof(buf1)); status = pRtlCompressBuffer(COMPRESSION_FORMAT_LZNT1, test_buffer, sizeof(test_buffer), buf1, sizeof(buf1), 4096, &final_size, workspace); - todo_wine ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); - todo_wine ok((*(WORD *)buf1 & 0x7000) == 0x3000, "no chunk signature found %04x\n", *(WORD *)buf1); todo_wine ok(final_size < sizeof(test_buffer), "got wrong final_size %u\n", final_size); @@ -1685,7 +1680,6 @@ static void test_RtlCompressBuffer(void) memset(buf1, 0x11, sizeof(buf1)); status = pRtlCompressBuffer(COMPRESSION_FORMAT_LZNT1, test_buffer, sizeof(test_buffer), buf1, 4, 4096, &final_size, workspace); - todo_wine ok(status == STATUS_BUFFER_TOO_SMALL, "got wrong status 0x%08x\n", status); HeapFree(GetProcessHeap(), 0, workspace);
1
0
0
0
Sebastian Lackner : ntdll/tests: Add tests for RtlCompressBuffer.
by Alexandre Julliard
09 Jul '15
09 Jul '15
Module: wine Branch: master Commit: 025ea11dc46706875965aa02f275717d558b3048 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=025ea11dc46706875965aa02f…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Thu Jul 9 03:04:57 2015 +0200 ntdll/tests: Add tests for RtlCompressBuffer. --- dlls/ntdll/tests/rtl.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/winnt.h | 6 ++++ 2 files changed, 99 insertions(+) diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index e8eb04a..0b64d95 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -92,6 +92,9 @@ static NTSTATUS (WINAPI *pRtlIpv4StringToAddressA)(PCSTR, BOOLEAN, PCSTR *, IN_ static NTSTATUS (WINAPI *pLdrAddRefDll)(ULONG, HMODULE); static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG*, ULONG_PTR*); static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG_PTR); +static NTSTATUS (WINAPI *pRtlGetCompressionWorkSpaceSize)(USHORT, PULONG, PULONG); +static NTSTATUS (WINAPI *pRtlDecompressBuffer)(USHORT, PUCHAR, ULONG, const UCHAR*, ULONG, PULONG); +static NTSTATUS (WINAPI *pRtlCompressBuffer)(USHORT, const UCHAR*, ULONG, PUCHAR, ULONG, ULONG, PULONG, PVOID); static HMODULE hkernel32 = 0; static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); @@ -139,6 +142,9 @@ static void InitFunctionPtrs(void) pLdrAddRefDll = (void *)GetProcAddress(hntdll, "LdrAddRefDll"); pLdrLockLoaderLock = (void *)GetProcAddress(hntdll, "LdrLockLoaderLock"); pLdrUnlockLoaderLock = (void *)GetProcAddress(hntdll, "LdrUnlockLoaderLock"); + pRtlGetCompressionWorkSpaceSize = (void *)GetProcAddress(hntdll, "RtlGetCompressionWorkSpaceSize"); + pRtlDecompressBuffer = (void *)GetProcAddress(hntdll, "RtlDecompressBuffer"); + pRtlCompressBuffer = (void *)GetProcAddress(hntdll, "RtlCompressBuffer"); } hkernel32 = LoadLibraryA("kernel32.dll"); ok(hkernel32 != 0, "LoadLibrary failed\n"); @@ -1599,6 +1605,92 @@ static void test_LdrLockLoaderLock(void) pLdrUnlockLoaderLock(0, magic); } +static void test_RtlCompressBuffer(void) +{ + ULONG compress_workspace, decompress_workspace; + static const UCHAR test_buffer[] = "WineWineWine"; + static UCHAR buf1[0x1000], buf2[0x1000]; + ULONG final_size, buf_size; + UCHAR *workspace = NULL; + NTSTATUS status; + + if (!pRtlCompressBuffer || !pRtlDecompressBuffer || !pRtlGetCompressionWorkSpaceSize) + { + win_skip("skipping RtlCompressBuffer tests, required functions not available\n"); + return; + } + + compress_workspace = decompress_workspace = 0xdeadbeef; + status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace, + &decompress_workspace); + todo_wine + ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); + ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); + if (status == STATUS_SUCCESS) + { + workspace = HeapAlloc(GetProcessHeap(), 0, compress_workspace); + ok(workspace != NULL, "HeapAlloc failed %d\n", GetLastError()); + } + + /* test compression format / engine */ + final_size = 0xdeadbeef; + status = pRtlCompressBuffer(COMPRESSION_FORMAT_NONE, test_buffer, sizeof(test_buffer), + buf1, sizeof(buf1) - 1, 4096, &final_size, workspace); + todo_wine + ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); + ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size); + + final_size = 0xdeadbeef; + status = pRtlCompressBuffer(COMPRESSION_FORMAT_DEFAULT, test_buffer, sizeof(test_buffer), + buf1, sizeof(buf1) - 1, 4096, &final_size, workspace); + todo_wine + ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); + ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size); + + final_size = 0xdeadbeef; + status = pRtlCompressBuffer(0xFF, test_buffer, sizeof(test_buffer), + buf1, sizeof(buf1) - 1, 4096, &final_size, workspace); + todo_wine + ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status); + ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size); + + /* test compression */ + final_size = 0xdeadbeef; + memset(buf1, 0x11, sizeof(buf1)); + status = pRtlCompressBuffer(COMPRESSION_FORMAT_LZNT1, test_buffer, sizeof(test_buffer), + buf1, sizeof(buf1), 4096, &final_size, workspace); + todo_wine + ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); + todo_wine + ok((*(WORD *)buf1 & 0x7000) == 0x3000, "no chunk signature found %04x\n", *(WORD *)buf1); + todo_wine + ok(final_size < sizeof(test_buffer), "got wrong final_size %u\n", final_size); + + /* test decompression */ + buf_size = final_size; + final_size = 0xdeadbeef; + memset(buf2, 0x11, sizeof(buf2)); + status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf2, sizeof(buf2), + buf1, buf_size, &final_size); + todo_wine + ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); + todo_wine + ok(final_size == sizeof(test_buffer), "got wrong final_size %u\n", final_size); + todo_wine + ok(!memcmp(buf2, test_buffer, sizeof(test_buffer)), "got wrong decoded data\n"); + ok(buf2[sizeof(test_buffer)] == 0x11, "too many bytes written\n"); + + /* buffer too small */ + final_size = 0xdeadbeef; + memset(buf1, 0x11, sizeof(buf1)); + status = pRtlCompressBuffer(COMPRESSION_FORMAT_LZNT1, test_buffer, sizeof(test_buffer), + buf1, 4, 4096, &final_size, workspace); + todo_wine + ok(status == STATUS_BUFFER_TOO_SMALL, "got wrong status 0x%08x\n", status); + + HeapFree(GetProcessHeap(), 0, workspace); +} + START_TEST(rtl) { InitFunctionPtrs(); @@ -1625,4 +1717,5 @@ START_TEST(rtl) test_RtlIpv4StringToAddress(); test_LdrAddRefDll(); test_LdrLockLoaderLock(); + test_RtlCompressBuffer(); } diff --git a/include/winnt.h b/include/winnt.h index d077005..68a33f3 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -4829,6 +4829,12 @@ typedef struct _QUOTA_LIMITS_EX { #define FILE_256_BYTE_ALIGNMENT 0x000000ff #define FILE_512_BYTE_ALIGNMENT 0x000001ff +#define COMPRESSION_FORMAT_NONE 0 +#define COMPRESSION_FORMAT_DEFAULT 1 +#define COMPRESSION_FORMAT_LZNT1 2 +#define COMPRESSION_ENGINE_STANDARD 0 +#define COMPRESSION_ENGINE_MAXIMUM 256 + #define MAILSLOT_NO_MESSAGE ((DWORD)-1) #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
...
57
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
Results per page:
10
25
50
100
200