ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2018
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
436 discussions
Start a n
N
ew thread
01/01: [USP10_WINETEST] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=79d934d0a1fd857dfcdb0…
commit 79d934d0a1fd857dfcdb0a8813d7e18966fc2e43 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 24 13:07:49 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 24 13:07:49 2018 +0100 [USP10_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/usp10/usp10.c | 1231 +++++++++++++----------------- 1 file changed, 533 insertions(+), 698 deletions(-) diff --git a/modules/rostests/winetests/usp10/usp10.c b/modules/rostests/winetests/usp10/usp10.c index 1ea873786a..f548b5792c 100644 --- a/modules/rostests/winetests/usp10/usp10.c +++ b/modules/rostests/winetests/usp10/usp10.c @@ -28,12 +28,13 @@ #include <stdio.h> #include <wine/test.h> -#include <winnls.h> -#include <wingdi.h> -#include <winuser.h> -//#include <windows.h> +#include <windows.h> #include <usp10.h> +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) +#endif + typedef struct _itemTest { char todo_flag[6]; int iCharPos; @@ -1292,11 +1293,12 @@ static int _find_font_for_range(HDC hdc, const CHAR *recommended, BYTE range, co if (*hfont) { winetest_trace("using font %s\n",lParam.lf.lfFaceName); - *origFont = SelectObject(hdc,*hfont); if (fingerprint) { WORD output[10]; int i; + + *origFont = SelectObject(hdc,*hfont); if (GetGlyphIndicesW(hdc, fingerprint->check, 10, output, 0) != GDI_ERROR) { for (i=0; i < 10; i++) @@ -1310,6 +1312,7 @@ static int _find_font_for_range(HDC hdc, const CHAR *recommended, BYTE range, co } if (i == 10) rc = 1; } + SelectObject(hdc, *origFont); } else rc = 1; } @@ -2020,7 +2023,7 @@ static void test_ScriptShape(HDC hdc) chars[0] = 'A'; chars[2] = 'A'; - for (j = 0; j < sizeof(test_data) / sizeof(*test_data); ++j) + for (j = 0; j < ARRAY_SIZE(test_data); ++j) { WCHAR c = test_data[j].c; SCRIPT_ITEM *item; @@ -2074,15 +2077,15 @@ static void test_ScriptShape(HDC hdc) /* Text does not support this range. */ memset(items, 0, sizeof(items)); nb = 0; - hr = ScriptItemize(test3, sizeof(test3)/sizeof(test3[0]), sizeof(items)/sizeof(items[0]), NULL, NULL, items, &nb); + hr = ScriptItemize(test3, ARRAY_SIZE(test3), ARRAY_SIZE(items), NULL, NULL, items, &nb); ok(hr == S_OK, "ScriptItemize failed, hr %#x.\n", hr); ok(items[0].a.eScript > 0, "Expected script id.\n"); ok(nb == 1, "Unexpected number of items.\n"); memset(glyphs, 0xff, sizeof(glyphs)); nb = 0; - hr = ScriptShape(hdc, &sc, test3, sizeof(test3)/sizeof(test3[0]), sizeof(glyphs)/sizeof(glyphs[0]), &items[0].a, - glyphs, logclust, attrs, &nb); + hr = ScriptShape(hdc, &sc, test3, ARRAY_SIZE(test3), ARRAY_SIZE(glyphs), + &items[0].a, glyphs, logclust, attrs, &nb); ok(hr == S_OK, "ScriptShape failed, hr %#x.\n", hr); ok(nb == 1, "Unexpected glyph count %u\n", nb); ok(glyphs[0] == 0, "Unexpected glyph id\n"); @@ -2164,7 +2167,6 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 const SCRIPT_PROPERTIES **ppSp; int cInChars; - int cMaxItems; SCRIPT_ITEM pItem[255]; int pcItems; WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0}; @@ -2175,192 +2177,135 @@ static void test_ScriptItemIzeShapePlace(HDC hdc, unsigned short pwOutGlyphs[256 WCHAR TestItem6[] = {'T', 'e', 's', 't', 'f',' ',' ',' ','\r','\n','e','n','d',0}; SCRIPT_CACHE psc; - int cChars; - int cMaxGlyphs; unsigned short pwOutGlyphs1[256]; - unsigned short pwOutGlyphs2[256]; unsigned short pwLogClust[256]; SCRIPT_VISATTR psva[256]; int pcGlyphs; int piAdvance[256]; GOFFSET pGoffset[256]; ABC pABC[256]; - int cnt; + unsigned int i; - /* Start testing usp10 functions */ - /* This test determines that the pointer returned by ScriptGetProperties is valid - * by checking a known value in the table */ + /* Verify we get a valid pointer from ScriptGetProperties(). */ hr = ScriptGetProperties(&ppSp, &iMaxProps); ok(hr == S_OK, "ScriptGetProperties failed: 0x%08x\n", hr); trace("number of script properties %d\n", iMaxProps); - ok (iMaxProps > 0, "Number of scripts returned should not be 0\n"); - if (iMaxProps > 0) - ok( ppSp[0]->langid == 0, "Langid[0] not = to 0\n"); /* Check a known value to ensure */ - /* ptrs work */ - - /* This is a valid test that will cause parsing to take place */ - cInChars = 5; - cMaxItems = 255; - hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr); - /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is * - * returned. */ - ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n"); - if (pcItems > 0) - ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars, - "Start pos not = 0 (%d) or end pos not = %d (%d)\n", - pItem[0].iCharPos, cInChars, pItem[1].iCharPos); - - /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue - * ie. ScriptItemize has succeeded and that pItem has been set */ - cInChars = 5; - if (hr == S_OK) { - psc = NULL; /* must be null on first call */ - cChars = cInChars; - cMaxGlyphs = cInChars; - hr = ScriptShape(NULL, &psc, TestItem1, cChars, - cMaxGlyphs, &pItem[0].a, - pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); - ok (hr == E_PENDING, "If psc is NULL (%08x) the E_PENDING should be returned\n", hr); - cMaxGlyphs = 4; - hr = ScriptShape(hdc, &psc, TestItem1, cChars, - cMaxGlyphs, &pItem[0].a, - pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); - ok (hr == E_OUTOFMEMORY, "If not enough output area cChars (%d) is > than CMaxGlyphs " - "(%d) but not E_OUTOFMEMORY\n", - cChars, cMaxGlyphs); - cMaxGlyphs = 256; - hr = ScriptShape(hdc, &psc, TestItem1, cChars, - cMaxGlyphs, &pItem[0].a, - pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); - ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr); - ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); - ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs); - if (hr ==0) { - hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance, - pGoffset, pABC); - ok (hr == S_OK, "ScriptPlace should return S_OK not (%08x)\n", hr); - hr = ScriptPlace(NULL, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance, - pGoffset, pABC); - ok (hr == S_OK, "ScriptPlace should return S_OK not (%08x)\n", hr); - for (cnt=0; cnt < pcGlyphs; cnt++) - pwOutGlyphs[cnt] = pwOutGlyphs1[cnt]; /* Send to next function */ - } - - /* This test will check to make sure that SCRIPT_CACHE is reused and that not translation * - * takes place if fNoGlyphIndex is set. */ - - cInChars = 5; - cMaxItems = 255; - hr = ScriptItemize(TestItem2, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr); - /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is * - * returned. */ - ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars, - "Start pos not = 0 (%d) or end pos not = %d (%d)\n", - pItem[0].iCharPos, cInChars, pItem[1].iCharPos); - /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue */ - if (hr == S_OK) { - cChars = cInChars; - cMaxGlyphs = 256; - pItem[0].a.fNoGlyphIndex = 1; /* say no translate */ - hr = ScriptShape(NULL, &psc, TestItem2, cChars, - cMaxGlyphs, &pItem[0].a, - pwOutGlyphs2, pwLogClust, psva, &pcGlyphs); - ok (hr != E_PENDING, "If psc should not be NULL (%08x) and the E_PENDING should be returned\n", hr); - ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr); - ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); - ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs); - for (cnt=0; cnt < cChars && TestItem2[cnt] == pwOutGlyphs2[cnt]; cnt++) {} - ok (cnt == cChars, "Translation to place when told not to. WCHAR %d - %04x != %04x\n", - cnt, TestItem2[cnt], pwOutGlyphs2[cnt]); - if (hr == S_OK) { - hr = ScriptPlace(hdc, &psc, pwOutGlyphs2, pcGlyphs, psva, &pItem[0].a, piAdvance, - pGoffset, pABC); - ok (hr == S_OK, "ScriptPlace should return S_OK not (%08x)\n", hr); - } - } - ScriptFreeCache( &psc); - ok (!psc, "psc is not null after ScriptFreeCache\n"); - - } - - /* This is a valid test that will cause parsing to take place and create 3 script_items */ - cInChars = (sizeof(TestItem3)/2)-1; - cMaxItems = 255; - hr = ScriptItemize(TestItem3, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr); - if (hr == S_OK) - { - ok (pcItems == 3, "The number of SCRIPT_ITEMS should be 3 not %d\n", pcItems); - if (pcItems > 2) - { - ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == 6, - "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n", - pItem[0].iCharPos, pItem[1].iCharPos); - ok (pItem[1].iCharPos == 6 && pItem[2].iCharPos == 11, - "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n", - pItem[1].iCharPos, pItem[2].iCharPos); - ok (pItem[2].iCharPos == 11 && pItem[3].iCharPos == cInChars, - "Start pos [2] not = 11 (%d) or end [3] pos not = 14 (%d), cInChars = %d\n", - pItem[2].iCharPos, pItem[3].iCharPos, cInChars); - } - } + ok(iMaxProps > 0, "Got unexpected script count %d.\n", iMaxProps); + ok(ppSp[0]->langid == 0, "Got unexpected langid %#x.\n", ppSp[0]->langid); + + /* This is a valid test that will cause parsing to take place. */ + cInChars = lstrlenW(TestItem1); + hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + /* This test is for the interim operation of ScriptItemize() where only + * one SCRIPT_ITEM is returned. */ + ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems); + ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); + ok(pItem[1].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n", + pItem[1].iCharPos, cInChars); - /* This is a valid test that will cause parsing to take place and create 5 script_items */ - cInChars = (sizeof(TestItem4)/2)-1; - cMaxItems = 255; - hr = ScriptItemize(TestItem4, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr); - if (hr == S_OK) - { - ok (pcItems == 5, "The number of SCRIPT_ITEMS should be 5 not %d\n", pcItems); - if (pcItems > 4) - { - ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == 6, - "Start pos [0] not = 0 (%d) or end pos [1] not = %d\n", - pItem[0].iCharPos, pItem[1].iCharPos); - ok (pItem[0].a.s.uBidiLevel == 0, "Should have been bidi=0 not %d\n", - pItem[0].a.s.uBidiLevel); - ok (pItem[1].iCharPos == 6 && pItem[2].iCharPos == 11, - "Start pos [1] not = 6 (%d) or end pos [2] not = 11 (%d)\n", - pItem[1].iCharPos, pItem[2].iCharPos); - ok (pItem[1].a.s.uBidiLevel == 1, "Should have been bidi=1 not %d\n", - pItem[1].a.s.uBidiLevel); - ok (pItem[2].iCharPos == 11 && pItem[3].iCharPos == 12, - "Start pos [2] not = 11 (%d) or end [3] pos not = 12 (%d)\n", - pItem[2].iCharPos, pItem[3].iCharPos); - ok (pItem[2].a.s.uBidiLevel == 0, "Should have been bidi=0 not %d\n", - pItem[2].a.s.uBidiLevel); - ok (pItem[3].iCharPos == 12 && pItem[4].iCharPos == 13, - "Start pos [3] not = 12 (%d) or end [4] pos not = 13 (%d)\n", - pItem[3].iCharPos, pItem[4].iCharPos); - ok (pItem[3].a.s.uBidiLevel == 0, "Should have been bidi=0 not %d\n", - pItem[3].a.s.uBidiLevel); - ok (pItem[4].iCharPos == 13 && pItem[5].iCharPos == cInChars, - "Start pos [4] not = 13 (%d) or end [5] pos not = 16 (%d), cInChars = %d\n", - pItem[4].iCharPos, pItem[5].iCharPos, cInChars); - } + psc = NULL; + hr = ScriptShape(NULL, &psc, TestItem1, cInChars, cInChars, + &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); + ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); + + hr = ScriptShape(hdc, &psc, TestItem1, cInChars, cInChars - 1, + &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); + ok(hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); + + hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1), + &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!!psc, "Got unexpected psc %p.\n", psc); + ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); + + /* Send to next test. */ + memcpy(pwOutGlyphs, pwOutGlyphs1, pcGlyphs * sizeof(*pwOutGlyphs)); + + hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, + psva, &pItem[0].a, piAdvance, pGoffset, pABC); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = ScriptPlace(NULL, &psc, pwOutGlyphs1, pcGlyphs, + psva, &pItem[0].a, piAdvance, pGoffset, pABC); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + /* This test verifies that SCRIPT_CACHE is reused and that no translation + * takes place if fNoGlyphIndex is set. */ + cInChars = lstrlenW(TestItem2); + hr = ScriptItemize(TestItem2, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + /* This test is for the interim operation of ScriptItemize() where only + * one SCRIPT_ITEM is returned. */ + ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems); + ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); + ok(pItem[1].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n", + pItem[1].iCharPos, cInChars); + + pItem[0].a.fNoGlyphIndex = 1; /* No translation. */ + hr = ScriptShape(NULL, &psc, TestItem2, cInChars, ARRAY_SIZE(pwOutGlyphs1), + &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!!psc, "Got unexpected psc %p.\n", psc); + ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); + + for (i = 0; i < cInChars; ++i) + { + ok(pwOutGlyphs1[i] == TestItem2[i], + "Got unexpected pwOutGlyphs1[%u] %#x, expected %#x.\n", + i, pwOutGlyphs1[i], TestItem2[i]); } - /* - * This test is for when the first unicode character requires bidi support - */ - cInChars = (sizeof(TestItem5)-1)/sizeof(WCHAR); - hr = ScriptItemize(TestItem5, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr); - ok (pcItems == 4, "There should have been 4 items, found %d\n", pcItems); - ok (pItem[0].a.s.uBidiLevel == 1, "The first character should have been bidi=1 not %d\n", - pItem[0].a.s.uBidiLevel); - - /* This test checks to make sure that the test to see if there are sufficient buffers to store * - * the pointer to the last char works. Note that windows often needs a greater number of * - * SCRIPT_ITEMS to process a string than is returned in pcItems. */ - cInChars = (sizeof(TestItem6)/2)-1; - cMaxItems = 4; - hr = ScriptItemize(TestItem6, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == E_OUTOFMEMORY, "ScriptItemize should return E_OUTOFMEMORY, returned %08x\n", hr); - + hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, + psva, &pItem[0].a, piAdvance, pGoffset, pABC); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ScriptFreeCache(&psc); + ok(!psc, "Got unexpected psc %p.\n", psc); + + /* This is a valid test that will cause parsing to take place and create 3 + * script_items. */ + cInChars = lstrlenW(TestItem3); + hr = ScriptItemize(TestItem3, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(pcItems == 3, "Got unexpected item count %d.\n", pcItems); + ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); + ok(pItem[1].iCharPos == 6, "Got unexpected character position %d.\n", pItem[1].iCharPos); + ok(pItem[2].iCharPos == 11, "Got unexpected character position %d.\n", pItem[2].iCharPos); + ok(pItem[3].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n", + pItem[3].iCharPos, cInChars); + + /* This is a valid test that will cause parsing to take place and create 5 + * script_items. */ + cInChars = lstrlenW(TestItem4); + hr = ScriptItemize(TestItem4, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(pcItems == 5, "Got unexpected item count %d.\n", pcItems); + + ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); + ok(pItem[1].iCharPos == 6, "Got unexpected character position %d.\n", pItem[1].iCharPos); + ok(pItem[2].iCharPos == 11, "Got unexpected character position %d.\n", pItem[2].iCharPos); + ok(pItem[3].iCharPos == 12, "Got unexpected character position %d.\n", pItem[3].iCharPos); + ok(pItem[4].iCharPos == 13, "Got unexpected character position %d.\n", pItem[4].iCharPos); + ok(pItem[5].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n", + pItem[5].iCharPos, cInChars); + + ok(pItem[0].a.s.uBidiLevel == 0, "Got unexpected bidi level %u.\n", pItem[0].a.s.uBidiLevel); + ok(pItem[1].a.s.uBidiLevel == 1, "Got unexpected bidi level %u.\n", pItem[1].a.s.uBidiLevel); + ok(pItem[2].a.s.uBidiLevel == 0, "Got unexpected bidi level %u.\n", pItem[2].a.s.uBidiLevel); + ok(pItem[3].a.s.uBidiLevel == 0, "Got unexpected bidi level %u.\n", pItem[3].a.s.uBidiLevel); + ok(pItem[4].a.s.uBidiLevel == 0, "Got unexpected bidi level %u.\n", pItem[3].a.s.uBidiLevel); + + /* This test is for when the first Unicode character requires BiDi support. */ + hr = ScriptItemize(TestItem5, lstrlenW(TestItem5), ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(pcItems == 4, "Got unexpected item count %d.\n", pcItems); + ok(pItem[0].a.s.uBidiLevel == 1, "Got unexpected bidi level %u.\n", pItem[0].a.s.uBidiLevel); + + /* This test verifies that the test to see if there are sufficient buffers + * to store the pointer to the last character works. Note that Windows + * often needs a greater number of SCRIPT_ITEMS to process a string than + * is returned in pcItems. */ + hr = ScriptItemize(TestItem6, lstrlenW(TestItem6), 4, NULL, NULL, pItem, &pcItems); + ok(hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); } static void test_ScriptGetCMap(HDC hdc, unsigned short pwOutGlyphs[256]) @@ -2693,14 +2638,11 @@ static void test_ScriptTextOut(HDC hdc) HRESULT hr; int cInChars; - int cMaxItems; SCRIPT_ITEM pItem[255]; int pcItems; WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0}; SCRIPT_CACHE psc; - int cChars; - int cMaxGlyphs; unsigned short pwOutGlyphs1[256]; WORD pwLogClust[256]; SCRIPT_VISATTR psva[256]; @@ -2710,112 +2652,84 @@ static void test_ScriptTextOut(HDC hdc) ABC pABC[256]; RECT rect; int piX; - int iCP = 1; - BOOL fTrailing = FALSE; - SCRIPT_LOGATTR *psla; SCRIPT_LOGATTR sla[256]; - /* This is a valid test that will cause parsing to take place */ - cInChars = 5; - cMaxItems = 255; - hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr); - /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is * - * returned. */ - ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n"); - if (pcItems > 0) - ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars, - "Start pos not = 0 (%d) or end pos not = %d (%d)\n", - pItem[0].iCharPos, cInChars, pItem[1].iCharPos); - - /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue - * ie. ScriptItemize has succeeded and that pItem has been set */ + /* This is a valid test that will cause parsing to take place. */ + cInChars = lstrlenW(TestItem1); + hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + /* This test is for the interim operation of ScriptItemize() where only + * one SCRIPT_ITEM is returned. */ + ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems); + ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); + ok(pItem[1].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n", + pItem[1].iCharPos, cInChars); + + psc = NULL; cInChars = 5; - if (hr == S_OK) { - psc = NULL; /* must be null on first call */ - cChars = cInChars; - cMaxGlyphs = 256; - hr = ScriptShape(hdc, &psc, TestItem1, cChars, - cMaxGlyphs, &pItem[0].a, - pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); - ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr); - ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); - ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs); - if (hr == S_OK) { - /* Note hdc is needed as glyph info is not yet in psc */ - hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance, - pGoffset, pABC); - ok (hr == S_OK, "Should return S_OK not (%08x)\n", hr); - ScriptFreeCache(&psc); /* Get rid of psc for next test set */ - ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); - - hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL); - ok (hr == E_INVALIDARG, "Should return 0 not (%08x)\n", hr); - - hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs, - piAdvance, NULL, pGoffset); - ok( hr == E_INVALIDARG, "(NULL,NULL,TestItem1, cInChars, dwFlags, pwOutGlyphs3), " - "expected E_INVALIDARG, got %08x\n", hr); - - /* Set psc to NULL, to be able to check if a pointer is returned in psc */ - psc = NULL; - hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, - NULL, NULL, NULL); - ok( hr == E_INVALIDARG, "(NULL,&psc,NULL,0,0,0,NULL,), expected E_INVALIDARG, " - "got %08x\n", hr); - ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); - - /* hdc is required for this one rather than the usual optional */ - psc = NULL; - hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs, - piAdvance, NULL, pGoffset); - ok( hr == E_INVALIDARG, "(NULL,&psc,), expected E_INVALIDARG, got %08x\n", hr); - ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); - - /* Set that it returns 0 status */ - hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs, - piAdvance, NULL, pGoffset); - ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr); - - /* Test Rect Rgn is acceptable */ - SetRect(&rect, 10, 10, 40, 20); - hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs, - piAdvance, NULL, pGoffset); - ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr); - - iCP = 1; - hr = ScriptCPtoX(iCP, fTrailing, cChars, pcGlyphs, (const WORD *) &pwLogClust, - (const SCRIPT_VISATTR *) &psva, (const int *)&piAdvance, &pItem[0].a, &piX); - ok(hr == S_OK, "ScriptCPtoX Stub should return S_OK not %08x\n", hr); - - psla = (SCRIPT_LOGATTR *)&sla; - hr = ScriptBreak(TestItem1, cChars, &pItem[0].a, psla); - ok(hr == S_OK, "ScriptBreak Stub should return S_OK not %08x\n", hr); - - /* Clean up and go */ - ScriptFreeCache(&psc); - ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); - } - } + hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1), + &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!!psc, "Got unexpected psc %p.\n", psc); + ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); + + /* Note hdc is needed as glyph info is not yet in psc. */ + hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, + psva, &pItem[0].a, piAdvance, pGoffset, pABC); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + /* Get rid of psc for next test set. */ + ScriptFreeCache(&psc); + ok(!psc, "Got unexpected psc %p.\n", psc); + + hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + hr = ScriptTextOut(NULL, NULL, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, + pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!psc, "Got unexpected psc %p.\n", psc); + + /* hdc is required. */ + hr = ScriptTextOut(NULL, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, + pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!psc, "Got unexpected psc %p.\n", psc); + hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, + pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + /* Test Rect Rgn is acceptable. */ + SetRect(&rect, 10, 10, 40, 20); + hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, + pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = ScriptCPtoX(1, FALSE, cInChars, pcGlyphs, pwLogClust, psva, piAdvance, &pItem[0].a, &piX); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = ScriptBreak(TestItem1, cInChars, &pItem[0].a, sla); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + ScriptFreeCache(&psc); + ok(!psc, "Got unexpected psc %p.\n", psc); } +/* The intent is to validate that the DC passed into ScriptTextOut() is used + * instead of the (possibly) invalid cached one. */ static void test_ScriptTextOut2(HDC hdc) { -/* Intent is to validate that the HDC passed into ScriptTextOut is - * used instead of the (possibly) invalid cached one - */ HRESULT hr; HDC hdc1, hdc2; int cInChars; - int cMaxItems; SCRIPT_ITEM pItem[255]; int pcItems; WCHAR TestItem1[] = {'T', 'e', 's', 't', 'a', 0}; SCRIPT_CACHE psc; - int cChars; - int cMaxGlyphs; unsigned short pwOutGlyphs1[256]; WORD pwLogClust[256]; SCRIPT_VISATTR psva[256]; @@ -2823,67 +2737,53 @@ static void test_ScriptTextOut2(HDC hdc) int piAdvance[256]; GOFFSET pGoffset[256]; ABC pABC[256]; + BOOL ret; - /* Create an extra DC that will be used until the ScriptTextOut */ + /* Create an extra DC that will be used until the ScriptTextOut() call. */ hdc1 = CreateCompatibleDC(hdc); - ok (hdc1 != 0, "CreateCompatibleDC failed to create a DC\n"); + ok(!!hdc1, "Failed to create a DC.\n"); hdc2 = CreateCompatibleDC(hdc); - ok (hdc2 != 0, "CreateCompatibleDC failed to create a DC\n"); + ok(!!hdc2, "Failed to create a DC.\n"); + + /* This is a valid test that will cause parsing to take place. */ + cInChars = lstrlenW(TestItem1); + hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + /* This test is for the interim operation of ScriptItemize() where only + * one SCRIPT_ITEM is returned. */ + ok(pcItems == 1, "Got unexpected item count %d.\n", pcItems); + ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); + ok(pItem[1].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n", + pItem[1].iCharPos, cInChars); - /* This is a valid test that will cause parsing to take place */ - cInChars = 5; - cMaxItems = 255; - hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr); - /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is * - * returned. */ - ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n"); - if (pcItems > 0) - ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars, - "Start pos not = 0 (%d) or end pos not = %d (%d)\n", - pItem[0].iCharPos, cInChars, pItem[1].iCharPos); - - /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue - * ie. ScriptItemize has succeeded and that pItem has been set */ - cInChars = 5; - if (hr == S_OK) { - psc = NULL; /* must be null on first call */ - cChars = cInChars; - cMaxGlyphs = 256; - hr = ScriptShape(hdc2, &psc, TestItem1, cChars, - cMaxGlyphs, &pItem[0].a, - pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); - ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr); - ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); - ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs); - if (hr == S_OK) { - BOOL ret; - - /* Note hdc is needed as glyph info is not yet in psc */ - hr = ScriptPlace(hdc2, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance, - pGoffset, pABC); - ok (hr == S_OK, "Should return S_OK not (%08x)\n", hr); - - /* key part!!! cached dc is being deleted */ - ret = DeleteDC(hdc2); - ok(ret, "DeleteDC should return 1 not %d\n", ret); - - /* At this point the cached hdc (hdc2) has been destroyed, - * however, we are passing in a *real* hdc (the original hdc). - * The text should be written to that DC - */ - hr = ScriptTextOut(hdc1, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs, - piAdvance, NULL, pGoffset); - ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr); - ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); - - DeleteDC(hdc1); - - /* Clean up and go */ - ScriptFreeCache(&psc); - ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); - } - } + psc = NULL; + hr = ScriptShape(hdc2, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1), + &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!!psc, "Got unexpected psc %p.\n", psc); + ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); + + /* Note hdc is needed as glyph info is not yet in psc. */ + hr = ScriptPlace(hdc2, &psc, pwOutGlyphs1, pcGlyphs, + psva, &pItem[0].a, piAdvance, pGoffset, pABC); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + /* Key part! Cached DC is being deleted. */ + ret = DeleteDC(hdc2); + ok(ret, "Got unexpected ret %#x.\n", ret); + + /* At this point the cached DC (hdc2) has been destroyed. However, we are + * passing in a *real* DC (the original DC). The text should be written to + * that DC. */ + hr = ScriptTextOut(hdc1, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, + pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!!psc, "Got unexpected psc %p.\n", psc); + + DeleteDC(hdc1); + + ScriptFreeCache(&psc); + ok(!psc, "Got unexpected psc %p.\n", psc); } static void test_ScriptTextOut3(HDC hdc) @@ -2891,14 +2791,11 @@ static void test_ScriptTextOut3(HDC hdc) HRESULT hr; int cInChars; - int cMaxItems; SCRIPT_ITEM pItem[255]; int pcItems; WCHAR TestItem1[] = {' ','\r', 0}; SCRIPT_CACHE psc; - int cChars; - int cMaxGlyphs; unsigned short pwOutGlyphs1[256]; WORD pwLogClust[256]; SCRIPT_VISATTR psva[256]; @@ -2908,48 +2805,39 @@ static void test_ScriptTextOut3(HDC hdc) ABC pABC[256]; RECT rect; - /* This is to ensure that nonexistent glyphs are translated into a valid glyph number */ - cInChars = 2; - cMaxItems = 255; - hr = ScriptItemize(TestItem1, cInChars, cMaxItems, NULL, NULL, pItem, &pcItems); - ok (hr == S_OK, "ScriptItemize should return S_OK, returned %08x\n", hr); - /* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is * - * returned. */ - ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n"); - if (pcItems > 0) - ok (pItem[0].iCharPos == 0 && pItem[2].iCharPos == cInChars, - "Start pos not = 0 (%d) or end pos not = %d (%d)\n", - pItem[0].iCharPos, cInChars, pItem[2].iCharPos); - - /* It would appear that we have a valid SCRIPT_ANALYSIS and can continue - * ie. ScriptItemize has succeeded and that pItem has been set */ - cInChars = 2; - if (hr == S_OK) { - psc = NULL; /* must be null on first call */ - cChars = cInChars; - cMaxGlyphs = 256; - hr = ScriptShape(hdc, &psc, TestItem1, cChars, - cMaxGlyphs, &pItem[0].a, - pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); - ok (hr == S_OK, "ScriptShape should return S_OK not (%08x)\n", hr); - ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n"); - ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs); - if (hr ==0) { - /* Note hdc is needed as glyph info is not yet in psc */ - hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, psva, &pItem[0].a, piAdvance, - pGoffset, pABC); - ok (hr == S_OK, "Should return S_OK not (%08x)\n", hr); - - /* Test Rect Rgn is acceptable */ - SetRect(&rect, 10, 10, 40, 20); - hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs, - piAdvance, NULL, pGoffset); - ok (hr == S_OK, "ScriptTextOut should return S_OK not (%08x)\n", hr); - } - /* Clean up and go */ - ScriptFreeCache(&psc); - ok( psc == NULL, "Expected psc to be NULL, got %p\n", psc); - } + /* This is to ensure that non-existent glyphs are translated into a valid + * glyph number. */ + cInChars = lstrlenW(TestItem1); + hr = ScriptItemize(TestItem1, cInChars, ARRAY_SIZE(pItem), NULL, NULL, pItem, &pcItems); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + /* This test is for the interim operation of ScriptItemize() where only + * one SCRIPT_ITEM is returned. */ + ok(pcItems == 2, "Got unexpected item count %d.\n", pcItems); + ok(pItem[0].iCharPos == 0, "Got unexpected character position %d.\n", pItem[0].iCharPos); + ok(pItem[1].iCharPos == 1, "Got unexpected character position %d.\n", pItem[0].iCharPos); + ok(pItem[2].iCharPos == cInChars, "Got unexpected character position %d, expected %d.\n", + pItem[2].iCharPos, cInChars); + + psc = NULL; + hr = ScriptShape(hdc, &psc, TestItem1, cInChars, ARRAY_SIZE(pwOutGlyphs1), + &pItem[0].a, pwOutGlyphs1, pwLogClust, psva, &pcGlyphs); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!!psc, "Got unexpected psc %p.\n", psc); + ok(pcGlyphs == cInChars, "Got unexpected glyph count %d, expected %d.\n", pcGlyphs, cInChars); + + /* Note hdc is needed as glyph info is not yet in psc. */ + hr = ScriptPlace(hdc, &psc, pwOutGlyphs1, pcGlyphs, + psva, &pItem[0].a, piAdvance, pGoffset, pABC); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + /* Test Rect Rgn is acceptable. */ + SetRect(&rect, 10, 10, 40, 20); + hr = ScriptTextOut(hdc, &psc, 0, 0, 0, &rect, &pItem[0].a, NULL, 0, + pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + ScriptFreeCache(&psc); + ok(!psc, "Got unexpected psc %p.\n", psc); } #define test_item_ScriptXtoX(a,b,c,d,e,f) (winetest_set_location(__FILE__,__LINE__), 0) ? 0 : _test_item_ScriptXtoX(a,b,c,d,e,f) @@ -3211,26 +3099,23 @@ static void test_ScriptXtoX(void) win_skip("Uniscribe version too old to test Hebrew clusters\n"); } +/* This set of tests is for the string functions of Uniscribe. The + * ScriptStringAnalyse() function allocates memory pointed to by the + * SCRIPT_STRING_ANALYSIS ssa pointer. This memory is freed by + * ScriptStringFree(). There needs to be a valid hdc for this as + * ScriptStringAnalyse() calls ScriptItemize(), ScriptShape() and + * ScriptPlace() which require it. */ static void test_ScriptString(HDC hdc) { -/******************************************************************************************* - * - * This set of tests are for the string functions of uniscribe. The ScriptStringAnalyse - * function allocates memory pointed to by the SCRIPT_STRING_ANALYSIS ssa pointer. This - * memory is freed by ScriptStringFree. There needs to be a valid hdc for this as - * ScriptStringAnalyse calls ScriptItemize, ScriptShape and ScriptPlace which require it. - * - */ HRESULT hr; WCHAR teststr[] = {'T','e','s','t','1',' ','a','2','b','3', '\0'}; - int len = (sizeof(teststr) / sizeof(WCHAR)) - 1; + int len = ARRAY_SIZE(teststr) - 1; int Glyphs = len * 2 + 16; - int Charset; DWORD Flags = SSA_GLYPHS; int ReqWidth = 100; - static const int Dx[(sizeof(teststr) / sizeof(WCHAR)) - 1]; - static const BYTE InClass[(sizeof(teststr) / sizeof(WCHAR)) - 1]; + static const int Dx[ARRAY_SIZE(teststr) - 1]; + static const BYTE InClass[ARRAY_SIZE(teststr) - 1]; SCRIPT_STRING_ANALYSIS ssa = NULL; int X = 10; @@ -3241,78 +3126,62 @@ static void test_ScriptString(HDC hdc) int MaxSel = 0; BOOL Disabled = FALSE; const int *clip_len; - int i; UINT *order; + unsigned int i; + /* Test without hdc to get E_PENDING. */ + hr = ScriptStringAnalyse(NULL, teststr, len, Glyphs, -1, + Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa); + ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); - Charset = -1; /* this flag indicates unicode input */ - /* Test without hdc to get E_PENDING */ - hr = ScriptStringAnalyse( NULL, teststr, len, Glyphs, Charset, Flags, - ReqWidth, NULL, NULL, Dx, NULL, - InClass, &ssa); - ok(hr == E_PENDING, "ScriptStringAnalyse Stub should return E_PENDING not %08x\n", hr); - - /* Test that 0 length string returns E_INVALIDARG */ - hr = ScriptStringAnalyse( hdc, teststr, 0, Glyphs, Charset, Flags, - ReqWidth, NULL, NULL, Dx, NULL, - InClass, &ssa); - ok(hr == E_INVALIDARG, "ScriptStringAnalyse should return E_INVALIDARG not %08x\n", hr); - - /* test with hdc, this should be a valid test */ - hr = ScriptStringAnalyse( hdc, teststr, len, Glyphs, Charset, Flags, - ReqWidth, NULL, NULL, Dx, NULL, - InClass, &ssa); - ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr); + /* Test that 0 length string returns E_INVALIDARG. */ + hr = ScriptStringAnalyse(hdc, teststr, 0, Glyphs, -1, + Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + /* Test with hdc, this should be a valid test. */ + hr = ScriptStringAnalyse(hdc, teststr, len, Glyphs, -1, + Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ScriptStringFree(&ssa); - /* test makes sure that a call with a valid pssa still works */ - hr = ScriptStringAnalyse( hdc, teststr, len, Glyphs, Charset, Flags, - ReqWidth, NULL, NULL, Dx, NULL, - InClass, &ssa); - ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr); - ok(ssa != NULL, "ScriptStringAnalyse pssa should not be NULL\n"); + /* Test makes sure that a call with a valid pssa still works. */ + hr = ScriptStringAnalyse(hdc, teststr, len, Glyphs, -1, + Flags, ReqWidth, NULL, NULL, Dx, NULL, InClass, &ssa); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(!!ssa, "Got unexpected ssa %p.\n", ssa); - if (hr == S_OK) - { - hr = ScriptStringOut(ssa, X, Y, Options, &rc, MinSel, MaxSel, Disabled); - ok(hr == S_OK, "ScriptStringOut should return S_OK not %08x\n", hr); - } + hr = ScriptStringOut(ssa, X, Y, Options, &rc, MinSel, MaxSel, Disabled); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); - clip_len = ScriptString_pcOutChars(ssa); - ok(*clip_len == len, "ScriptString_pcOutChars failed, got %d, expected %d\n", *clip_len, len); + clip_len = ScriptString_pcOutChars(ssa); + ok(*clip_len == len, "Got unexpected *clip_len %d, expected %d.\n", *clip_len, len); - order = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *clip_len * sizeof(UINT)); - hr = ScriptStringGetOrder(ssa, order); - ok(hr == S_OK, "ScriptStringGetOrder failed, got %08x, expected S_OK\n", hr); + order = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *clip_len * sizeof(*order)); + hr = ScriptStringGetOrder(ssa, order); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); - for (i = 0; i < *clip_len; i++) ok(order[i] == i, "%d: got %d expected %d\n", i, order[i], i); - HeapFree(GetProcessHeap(), 0, order); + for (i = 0; i < *clip_len; ++i) + { + ok(order[i] == i, "Got unexpected order[%u] %u.\n", i, order[i]); + } + HeapFree(GetProcessHeap(), 0, order); - hr = ScriptStringFree(&ssa); - ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr); + hr = ScriptStringFree(&ssa); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); } +/* Test ScriptStringXtoCP() and ScriptStringCPtoX(). Since fonts may differ + * between Windows and Wine, the test generates values using one function, and + * then verifies the output is consistent with the output of the other. */ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) { -/***************************************************************************************** - * - * This test is for the ScriptStringXtoCP and ScriptStringXtoCP functions. Due to the - * nature of the fonts between Windows and Wine, the test is implemented by generating - * values using one one function then checking the output of the second. In this way - * the validity of the functions is established using Windows as a base and confirming - * similar behaviour in wine. - */ - HRESULT hr; static const WCHAR teststr1[] = {0x05e9, 'i', 0x05dc, 'n', 0x05d5, 'e', 0x05dd, '.',0}; static const BOOL rtl[] = {1, 0, 1, 0, 1, 0, 1, 0}; - void *String = (WCHAR *) &teststr1; /* ScriptStringAnalysis needs void */ - int String_len = (sizeof(teststr1)/sizeof(WCHAR))-1; + unsigned int String_len = ARRAY_SIZE(teststr1) - 1; int Glyphs = String_len * 2 + 16; /* size of buffer as recommended */ - int Charset = -1; /* unicode */ - DWORD Flags = SSA_GLYPHS; - int ReqWidth = 100; - static const BYTE InClass[(sizeof(teststr1)/sizeof(WCHAR))-1]; + static const BYTE InClass[ARRAY_SIZE(teststr1) - 1]; SCRIPT_STRING_ANALYSIS ssa = NULL; int Ch; /* Character position in string */ @@ -3320,170 +3189,135 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) int Cp; /* Character position in string */ int X; int trail,lead; - BOOL fTrailing; - /* Test with hdc, this should be a valid test - * Here we generate an SCRIPT_STRING_ANALYSIS that will be used as input to the - * following character positions to X and X to character position functions. - */ - - hr = ScriptStringAnalyse( hdc, String, String_len, Glyphs, Charset, Flags, - ReqWidth, NULL, NULL, NULL, NULL, - InClass, &ssa); - ok(hr == S_OK || - hr == E_INVALIDARG, /* NT */ - "ScriptStringAnalyse should return S_OK or E_INVALIDARG not %08x\n", hr); + /* Test with hdc, this should be a valid test. Here we generate a + * SCRIPT_STRING_ANALYSIS that will be used as input to the following + * character-positions-to-X and X-to-character-position functions. */ + hr = ScriptStringAnalyse(hdc, &teststr1, String_len, Glyphs, -1, + SSA_GLYPHS, 100, NULL, NULL, NULL, NULL, InClass, &ssa); + ok(hr == S_OK || broken(hr == E_INVALIDARG) /* NT */, + "Got unexpected hr %08x.\n", hr); + if (hr != S_OK) + return; + ok(!!ssa, "Got unexpected ssa %p.\n", ssa); - if (hr == S_OK) + /* Loop to generate character positions to provide starting positions for + * the ScriptStringCPtoX() and ScriptStringXtoCP() functions. */ + for (Cp = 0; Cp < String_len; ++Cp) { - ok(ssa != NULL, "ScriptStringAnalyse ssa should not be NULL\n"); - - /* - * Loop to generate character positions to provide starting positions for the - * ScriptStringCPtoX and ScriptStringXtoCP functions - */ - for (Cp = 0; Cp < String_len; Cp++) - { - /* The fTrailing flag is used to indicate whether the X being returned is at - * the beginning or the end of the character. What happens here is that if - * fTrailing indicates the end of the character, ie. FALSE, then ScriptStringXtoCP - * returns the beginning of the next character and iTrailing is FALSE. So for this - * loop iTrailing will be FALSE in both cases. - */ - hr = ScriptStringCPtoX(ssa, Cp, TRUE, &trail); - ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr); - hr = ScriptStringCPtoX(ssa, Cp, FALSE, &lead); - ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr); - if (rtl[Cp]) - ok(lead > trail, "Leading values should be after trailing for rtl characters(%i)\n",Cp); - else - ok(lead < trail, "Trailing values should be after leading for ltr characters(%i)\n",Cp); - - /* move by 1 pixel so that we are not between 2 characters. That could result in being the lead of a rtl and - at the same time the trail of an ltr */ - - /* inside the leading edge */ - X = lead; - if (rtl[Cp]) X--; else X++; - hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); - ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr); - ok(Cp == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp, Ch, trail); - ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n", - iTrailing, X); - - /* inside the trailing edge */ - X = trail; - if (rtl[Cp]) X++; else X--; - hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); - ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr); - ok(Cp == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp, Ch, trail); - ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n", - iTrailing, X); - - /* outside the "trailing" edge */ - if (Cp < String_len-1) - { - if (rtl[Cp]) X = lead; else X = trail; - X++; - hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); - ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr); - ok(Cp + 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp + 1, Ch, trail); - if (rtl[Cp+1]) - ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n", - iTrailing, X); - else - ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n", - iTrailing, X); - } + /* The fTrailing flag is used to indicate whether the X being returned + * is at the beginning or the end of the character. What happens here + * is that if fTrailing indicates the end of the character, i.e. FALSE, + * then ScriptStringXtoCP() returns the beginning of the next + * character and iTrailing is FALSE. So for this loop iTrailing will + * be FALSE in both cases. */ + hr = ScriptStringCPtoX(ssa, Cp, TRUE, &trail); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = ScriptStringCPtoX(ssa, Cp, FALSE, &lead); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(rtl[Cp] ? lead > trail : lead < trail, + "Got unexpected lead %d, trail %d, for rtl[%u] %u.\n", + lead, trail, Cp, rtl[Cp]); + + /* Move by 1 pixel so that we are not between 2 characters. That could + * result in being the lead of a RTL and at the same time the trail of + * an LTR. */ + + /* Inside the leading edge. */ + X = rtl[Cp] ? lead - 1 : lead + 1; + hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(Ch == Cp, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp); + ok(!iTrailing, "Got unexpected iTrailing %#x for X %d.\n", iTrailing, X); - /* outside the "leading" edge */ - if (Cp != 0) - { - if (rtl[Cp]) X = trail; else X = lead; - X--; - hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); - ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr); - ok(Cp - 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp - 1, Ch, trail); - if (Cp != 0 && rtl[Cp-1]) - ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n", - iTrailing, X); - else - ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n", - iTrailing, X); - } - } + /* Inside the trailing edge. */ + X = rtl[Cp] ? trail + 1 : trail - 1; + hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(Ch == Cp, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp); + ok(iTrailing, "Got unexpected iTrailing %#x for X %d.\n", iTrailing, X); - /* Check beyond the leading boundary of the whole string */ - if (rtl[0]) + /* Outside the trailing edge. */ + if (Cp < String_len - 1) { - /* having a leading rtl character seems to confuse usp */ - /* this looks to be a windows bug we should emulate */ - hr = ScriptStringCPtoX(ssa, 0, TRUE, &X); - ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr); - X--; + X = rtl[Cp] ? lead + 1 : trail + 1; hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); - ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr); - ok(Ch == 1, "ScriptStringXtoCP should return Ch = 1 not %d for X outside leading edge when rtl\n", Ch); - ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside leading edge when rtl\n", - iTrailing); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(Ch == Cp + 1, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp + 1); + ok(iTrailing == !!rtl[Cp + 1], "Got unexpected iTrailing %#x for X %d, expected %#x.\n", + iTrailing, X, !!rtl[Cp + 1]); } - else + + /* Outside the leading edge. */ + if (Cp) { - hr = ScriptStringCPtoX(ssa, 0, FALSE, &X); - ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr); - X--; + X = rtl[Cp] ? trail - 1 : lead - 1; hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); - ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr); - ok(Ch == -1, "ScriptStringXtoCP should return Ch = -1 not %d for X outside leading edge\n", Ch); - ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = outside leading edge\n", - iTrailing); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(Ch == Cp - 1, "Got unexpected Ch %d for X %d, expected %d.\n", Ch, X, Cp - 1); + ok(iTrailing == !rtl[Cp - 1], "Got unexpected iTrailing %#x for X %d, expected %#x.\n", + iTrailing, X, !rtl[Cp - 1]); } + } - /* Check beyond the end boundary of the whole string */ - if (rtl[String_len-1]) - { - hr = ScriptStringCPtoX(ssa, String_len-1, FALSE, &X); - ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr); - } - else - { - hr = ScriptStringCPtoX(ssa, String_len-1, TRUE, &X); - ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr); - } - X++; + /* Check beyond the leading boundary of the whole string. */ + if (rtl[0]) + { + /* Having a leading RTL character seems to confuse usp. This looks to + * be a Windows bug we should emulate. */ + hr = ScriptStringCPtoX(ssa, 0, TRUE, &X); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + --X; hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); - ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr); - ok(Ch == String_len, "ScriptStringXtoCP should return Ch = %i not %d for X outside trailing edge\n", String_len, Ch); - ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside trailing edge\n", - iTrailing); - - /* - * Cleanup the SSA for the next round of tests - */ - hr = ScriptStringFree(&ssa); - ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr); - - /* - * Test to see that exceeding the number of chars returns E_INVALIDARG. First - * generate an SSA for the subsequent tests. - */ - hr = ScriptStringAnalyse( hdc, String, String_len, Glyphs, Charset, Flags, - ReqWidth, NULL, NULL, NULL, NULL, - InClass, &ssa); - ok(hr == S_OK, "ScriptStringAnalyse should return S_OK not %08x\n", hr); - - /* - * When ScriptStringCPtoX is called with a character position Cp that exceeds the - * string length, return E_INVALIDARG. This also invalidates the ssa so a - * ScriptStringFree should also fail. - */ - fTrailing = FALSE; - Cp = String_len + 1; - hr = ScriptStringCPtoX(ssa, Cp, fTrailing, &X); - ok(hr == E_INVALIDARG, "ScriptStringCPtoX should return E_INVALIDARG not %08x\n", hr); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(Ch == 1, "Got unexpected Ch %d.\n", Ch); + ok(!iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing); + } + else + { + hr = ScriptStringCPtoX(ssa, 0, FALSE, &X); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + --X; + hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(Ch == -1, "Got unexpected Ch %d.\n", Ch); + ok(iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing); + } - ScriptStringFree(&ssa); + /* Check beyond the end boundary of the whole string. */ + if (rtl[String_len - 1]) + { + hr = ScriptStringCPtoX(ssa, String_len - 1, FALSE, &X); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); } + else + { + hr = ScriptStringCPtoX(ssa, String_len - 1, TRUE, &X); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + } + ++X; + hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(Ch == String_len, "Got unexpected Ch %d, expected %d.\n", Ch, String_len); + ok(!iTrailing, "Got unexpected iTrailing %#x.\n", iTrailing); + + /* Cleanup the SSA for the next round of tests. */ + hr = ScriptStringFree(&ssa); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + /* Test to see that exceeding the number of characters returns + * E_INVALIDARG. First generate an SSA for the subsequent tests. */ + hr = ScriptStringAnalyse(hdc, &teststr1, String_len, Glyphs, -1, + SSA_GLYPHS, 100, NULL, NULL, NULL, NULL, InClass, &ssa); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + /* When ScriptStringCPtoX() is called with a character position that + * exceeds the string length, return E_INVALIDARG. This also invalidates + * the ssa so a ScriptStringFree() should also fail. */ + hr = ScriptStringCPtoX(ssa, String_len + 1, FALSE, &X); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + ScriptStringFree(&ssa); } static HWND create_test_window(void) @@ -3672,7 +3506,7 @@ static void test_ScriptLayout(void) hr = ScriptLayout(sizeof(levels[0]), levels[0], NULL, NULL); ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); - for (i = 0; i < sizeof(levels)/sizeof(levels[0]); i++) + for (i = 0; i < ARRAY_SIZE(levels); ++i) { hr = ScriptLayout(sizeof(levels[0]), levels[i], vistolog, logtovis); ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); @@ -3745,7 +3579,7 @@ static void test_digit_substitution(void) LGRPID_ARMENIAN }; - for (i = 0; i < sizeof(groups)/sizeof(groups[0]); i++) + for (i = 0; i < ARRAY_SIZE(groups); ++i) { ret = EnumLanguageGroupLocalesA(enum_proc, groups[i], 0, 0); ok(ret, "EnumLanguageGroupLocalesA failed unexpectedly: %u\n", GetLastError()); @@ -3867,116 +3701,117 @@ static void test_newlines(void) static void test_ScriptGetFontFunctions(HDC hdc) { + static const WCHAR test_phagspa[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859, + 0x0020, 0xa850, 0xa85c, 0xa85e}; + SCRIPT_CONTROL control; + SCRIPT_CACHE sc = NULL; + SCRIPT_ITEM items[15]; + OPENTYPE_TAG tags[5]; + SCRIPT_STATE state; + int count = 0; HRESULT hr; + if (!pScriptGetFontScriptTags || !pScriptGetFontLanguageTags || !pScriptGetFontFeatureTags) { - win_skip("ScriptGetFontScriptTags,ScriptGetFontLanguageTags or ScriptGetFontFeatureTags not available on this platform\n"); + win_skip("ScriptGetFontScriptTags, ScriptGetFontLanguageTags or " + "ScriptGetFontFeatureTags not available on this platform.\n"); + return; } + + hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, &count); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, tags, &count); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontScriptTags(NULL, &sc, NULL, ARRAY_SIZE(tags), tags, &count); + ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontScriptTags(hdc, &sc, NULL, ARRAY_SIZE(tags), tags, &count); + ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); + if (hr == S_OK) + ok(count <= 5, "Got unexpected count %d.\n", count); else - { - SCRIPT_CACHE sc = NULL; - OPENTYPE_TAG tags[5]; - int count = 0; - int outnItems=0; - SCRIPT_ITEM outpItems[15]; - SCRIPT_CONTROL Control; - SCRIPT_STATE State; - static const WCHAR test_phagspa[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859, 0x0020, 0xa850, 0xa85c, 0xa85e}; - - hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, &count); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 5, tags, NULL); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, tags, &count); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontScriptTags(NULL, &sc, NULL, 5, tags, &count); - ok(hr == E_PENDING,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 5, tags, &count); - ok((hr == S_OK || hr == E_OUTOFMEMORY),"Incorrect return code\n"); - if (hr == S_OK) - ok(count <= 5, "Count should be less or equal to 5 with S_OK return\n"); - else if (hr == E_OUTOFMEMORY) - ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n"); - ok(sc != NULL, "ScriptCache should be initialized\n"); + ok(!count, "Got unexpected count %d.\n", count); + ok(!!sc, "Got unexpected script cache %p.\n", sc); - ScriptFreeCache(&sc); - sc = NULL; - - hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, NULL); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, &count); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 5, tags, NULL); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, tags, &count); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontLanguageTags(NULL, &sc, NULL, latn_tag, 5, tags, &count); - ok(hr == E_PENDING,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 5, tags, &count); - ok((hr == S_OK || hr == E_OUTOFMEMORY),"Incorrect return code\n"); - if (hr == S_OK) - ok(count <= 5, "Count should be less or equal to 5 with S_OK return\n"); - else if (hr == E_OUTOFMEMORY) - ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n"); + ScriptFreeCache(&sc); + sc = NULL; - ScriptFreeCache(&sc); - sc = NULL; - - hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, NULL); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, &count); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 5, tags, NULL); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, tags, &count); - ok(hr == E_INVALIDARG,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontFeatureTags(NULL, &sc, NULL, latn_tag, 0x0, 5, tags, &count); - ok(hr == E_PENDING,"Incorrect return code\n"); - ok(sc == NULL, "ScriptCache should remain uninitialized\n"); - hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 5, tags, &count); - ok((hr == S_OK || hr == E_OUTOFMEMORY),"Incorrect return code\n"); - if (hr == S_OK) - ok(count <= 5, "Count should be less or equal to 5 with S_OK return\n"); - else if (hr == E_OUTOFMEMORY) - ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n"); - - memset(&Control, 0, sizeof(Control)); - memset(&State, 0, sizeof(State)); - - hr = ScriptItemize(test_phagspa, 10, 15, &Control, &State, outpItems, &outnItems); - ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr); - memset(tags,0,sizeof(tags)); - hr = pScriptGetFontScriptTags(hdc, &sc, &outpItems[0].a, 5, tags, &count); - ok( hr == USP_E_SCRIPT_NOT_IN_FONT || broken(hr == S_OK), "wrong return code\n"); - - hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, dsrt_tag, 5, tags, &count); - ok( hr == S_OK, "wrong return code\n"); - hr = pScriptGetFontLanguageTags(hdc, &sc, &outpItems[0].a, dsrt_tag, 5, tags, &count); - ok( hr == E_INVALIDARG || broken(hr == S_OK), "wrong return code\n"); - - hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, dsrt_tag, 0x0, 5, tags, &count); - ok( hr == S_OK, "wrong return code\n"); - hr = pScriptGetFontFeatureTags(hdc, &sc, &outpItems[0].a, dsrt_tag, 0x0, 5, tags, &count); - ok( hr == E_INVALIDARG || broken(hr == S_OK), "wrong return code\n"); + hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, NULL, &count); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, 0, tags, &count); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontLanguageTags(NULL, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count); + ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, latn_tag, ARRAY_SIZE(tags), tags, &count); + ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); + if (hr == S_OK) + ok(count <= 5, "Got unexpected count %d.\n", count); + else + ok(!count, "Got unexpected count %d.\n", count); - ScriptFreeCache(&sc); - } + ScriptFreeCache(&sc); + sc = NULL; + + hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, NULL, &count); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, 0, tags, &count); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontFeatureTags(NULL, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count); + ok(hr == E_PENDING, "Got unexpected hr %#x.\n", hr); + ok(!sc, "Got unexpected script cache %p.\n", sc); + hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, latn_tag, 0x0, ARRAY_SIZE(tags), tags, &count); + ok(hr == S_OK || hr == E_OUTOFMEMORY, "Got unexpected hr %#x.\n", hr); + if (hr == S_OK) + ok(count <= 5, "Got unexpected count %d.\n", count); + else + ok(!count, "Got unexpected count %d.\n", count); + + memset(&control, 0, sizeof(control)); + memset(&state, 0, sizeof(state)); + + hr = ScriptItemize(test_phagspa, ARRAY_SIZE(test_phagspa), ARRAY_SIZE(items), + &control, &state, items, &count); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + memset(tags, 0, sizeof(tags)); + hr = pScriptGetFontScriptTags(hdc, &sc, &items[0].a, ARRAY_SIZE(tags), tags, &count); + ok(hr == USP_E_SCRIPT_NOT_IN_FONT || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr); + + hr = pScriptGetFontLanguageTags(hdc, &sc, NULL, dsrt_tag, ARRAY_SIZE(tags), tags, &count); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = pScriptGetFontLanguageTags(hdc, &sc, &items[0].a, dsrt_tag, ARRAY_SIZE(tags), tags, &count); + ok(hr == E_INVALIDARG || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr); + + hr = pScriptGetFontFeatureTags(hdc, &sc, NULL, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = pScriptGetFontFeatureTags(hdc, &sc, &items[0].a, dsrt_tag, 0x0, ARRAY_SIZE(tags), tags, &count); + ok(hr == E_INVALIDARG || broken(hr == S_OK), "Got unexpected hr %#x.\n", hr); + + ScriptFreeCache(&sc); } struct logical_width_test @@ -4008,7 +3843,7 @@ static void test_ScriptGetLogicalWidths(void) SCRIPT_ANALYSIS sa = { 0 }; unsigned int i, j; - for (i = 0; i < sizeof(logical_width_tests)/sizeof(logical_width_tests[0]); i++) + for (i = 0; i < ARRAY_SIZE(logical_width_tests); ++i) { const struct logical_width_test *ptr = logical_width_tests + i; SCRIPT_VISATTR attrs[3]; @@ -4069,7 +3904,7 @@ static void test_ScriptIsComplex(void) hr = ScriptIsComplex(test2W, 0, SIC_ASCIIDIGIT); ok(hr == S_FALSE, "got 0x%08x\n", hr); - for (i = 0; i < sizeof(complex_tests)/sizeof(complex_tests[0]); i++) + for (i = 0; i < ARRAY_SIZE(complex_tests); ++i) { hr = ScriptIsComplex(complex_tests[i].text, lstrlenW(complex_tests[i].text), complex_tests[i].flags); todo_wine_if(complex_tests[i].todo)
6 years, 7 months
1
0
0
0
01/01: [USP10] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=92666dbaa6ee3038d2c82…
commit 92666dbaa6ee3038d2c82177bb869140c5dac3df Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Mar 24 13:07:16 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Mar 24 13:07:16 2018 +0100 [USP10] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/usp10/CMakeLists.txt | 4 +- dll/win32/usp10/bidi.c | 99 ++++++++++++++++++++++------------------ dll/win32/usp10/bracket.c | 4 +- dll/win32/usp10/breaking.c | 14 ++++++ dll/win32/usp10/indic.c | 16 ++++++- dll/win32/usp10/indicsyllable.c | 4 +- dll/win32/usp10/linebreak.c | 4 +- dll/win32/usp10/mirror.c | 3 +- dll/win32/usp10/opentype.c | 13 +++++- dll/win32/usp10/precomp.h | 23 ++++++++++ dll/win32/usp10/shape.c | 13 ++++++ dll/win32/usp10/shaping.c | 6 ++- dll/win32/usp10/usp10.c | 30 ++++++++---- dll/win32/usp10/usp10_internal.h | 37 +-------------- media/doc/README.WINE | 2 +- 15 files changed, 171 insertions(+), 101 deletions(-) diff --git a/dll/win32/usp10/CMakeLists.txt b/dll/win32/usp10/CMakeLists.txt index ff58b7ef42..25b76c5642 100644 --- a/dll/win32/usp10/CMakeLists.txt +++ b/dll/win32/usp10/CMakeLists.txt @@ -15,7 +15,7 @@ list(APPEND SOURCE shape.c shaping.c usp10.c - usp10_internal.h + precomp.h ${CMAKE_CURRENT_BINARY_DIR}/usp10_stubs.c) add_library(usp10 SHARED @@ -25,5 +25,5 @@ add_library(usp10 SHARED set_module_type(usp10 win32dll) target_link_libraries(usp10 wine) add_importlibs(usp10 advapi32 user32 gdi32 msvcrt kernel32 ntdll) -add_pch(usp10 usp10_internal.h SOURCE) +add_pch(usp10 precomp.h SOURCE) add_cd_file(TARGET usp10 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/usp10/bidi.c b/dll/win32/usp10/bidi.c index a06ff8c65b..b0df781c82 100644 --- a/dll/win32/usp10/bidi.c +++ b/dll/win32/usp10/bidi.c @@ -41,9 +41,19 @@ * has been modified. */ -#include <windef.h> - -#include <wine/list.h> +#include "config.h" + +#include <stdarg.h> +#include <stdlib.h> +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winnls.h" +#include "usp10.h" +#include "wine/unicode.h" +#include "wine/debug.h" +#include "wine/heap.h" +#include "wine/list.h" #include "usp10_internal.h" @@ -682,8 +692,9 @@ static BracketPair *computeBracketPairs(IsolatedRun *iso_run) WCHAR *open_stack; int *stack_index; int stack_top = iso_run->length; + unsigned int pair_count = 0; BracketPair *out = NULL; - int pair_count = 0; + SIZE_T out_size = 0; int i; open_stack = heap_alloc(iso_run->length * sizeof(*open_stack)); @@ -692,55 +703,55 @@ static BracketPair *computeBracketPairs(IsolatedRun *iso_run) for (i = 0; i < iso_run->length; i++) { unsigned short ubv = get_table_entry(bidi_bracket_table, iso_run->item[i].ch); - if (ubv) + + if (!ubv) + continue; + + if ((ubv >> 8) == 0) { - if (!out) - { - out = heap_alloc(sizeof(*out)); - out[0].start = -1; - } + --stack_top; + open_stack[stack_top] = iso_run->item[i].ch + (signed char)(ubv & 0xff); + /* Deal with canonical equivalent U+2329/232A and U+3008/3009. */ + if (open_stack[stack_top] == 0x232a) + open_stack[stack_top] = 0x3009; + stack_index[stack_top] = i; + } + else if ((ubv >> 8) == 1) + { + unsigned int j; - if ((ubv >> 8) == 0) - { - stack_top --; - open_stack[stack_top] = iso_run->item[i].ch + (signed char)(ubv & 0xff); - /* deal with canonical equivalent U+2329/232A and U+3008/3009 */ - if (open_stack[stack_top] == 0x232A) - open_stack[stack_top] = 0x3009; - stack_index[stack_top] = i; - } - else if ((ubv >> 8) == 1) + for (j = stack_top; j < iso_run->length; ++j) { - int j; - if (stack_top == iso_run->length) continue; - for (j = stack_top; j < iso_run->length; j++) - { - WCHAR c = iso_run->item[i].ch; - if (c == 0x232A) c = 0x3009; - if (c == open_stack[j]) - { - out[pair_count].start = stack_index[j]; - out[pair_count].end = i; - pair_count++; - out = HeapReAlloc(GetProcessHeap(), 0, out, sizeof(BracketPair) * (pair_count+1)); - out[pair_count].start = -1; - stack_top = j+1; - break; - } - } + WCHAR c = iso_run->item[i].ch; + + if (c == 0x232a) + c = 0x3009; + + if (c != open_stack[j]) + continue; + + if (!(usp10_array_reserve((void **)&out, &out_size, pair_count + 2, sizeof(*out)))) + ERR("Failed to grow output array.\n"); + + out[pair_count].start = stack_index[j]; + out[pair_count].end = i; + ++pair_count; + + out[pair_count].start = -1; + stack_top = j + 1; + break; } } } - if (pair_count == 0) - { - heap_free(out); - out = NULL; - } - else if (pair_count > 1) - qsort(out, pair_count, sizeof(BracketPair), compr); heap_free(open_stack); heap_free(stack_index); + + if (!pair_count) + return NULL; + + qsort(out, pair_count, sizeof(*out), compr); + return out; } diff --git a/dll/win32/usp10/bracket.c b/dll/win32/usp10/bracket.c index 6905464990..1509d572c9 100644 --- a/dll/win32/usp10/bracket.c +++ b/dll/win32/usp10/bracket.c @@ -2,7 +2,9 @@ /* generated from
http://www.unicode.org/Public/10.0.0/ucd/BidiBrackets.txt
*/ /* DO NOT EDIT!! */ -const unsigned short /* DECLSPEC_HIDDEN */ bidi_bracket_table[768] = +#include "wine/unicode.h" + +const unsigned short DECLSPEC_HIDDEN bidi_bracket_table[768] = { /* level 1 offsets */ 0x0100, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, diff --git a/dll/win32/usp10/breaking.c b/dll/win32/usp10/breaking.c index b6e3151744..9b12d9e63d 100644 --- a/dll/win32/usp10/breaking.c +++ b/dll/win32/usp10/breaking.c @@ -18,7 +18,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ +#include "config.h" +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "winnls.h" +#include "usp10.h" +#include "winternl.h" + +#include "wine/debug.h" +#include "wine/heap.h" #include "usp10_internal.h" WINE_DEFAULT_DEBUG_CHANNEL(uniscribe); diff --git a/dll/win32/usp10/indic.c b/dll/win32/usp10/indic.c index fae5f43c61..5a228e88de 100644 --- a/dll/win32/usp10/indic.c +++ b/dll/win32/usp10/indic.c @@ -18,7 +18,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ - +#include "config.h" +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "winnls.h" +#include "usp10.h" +#include "winternl.h" + +#include "wine/debug.h" +#include "wine/heap.h" #include "usp10_internal.h" WINE_DEFAULT_DEBUG_CHANNEL(uniscribe); diff --git a/dll/win32/usp10/indicsyllable.c b/dll/win32/usp10/indicsyllable.c index ead8735b9b..dbdac5d4ae 100644 --- a/dll/win32/usp10/indicsyllable.c +++ b/dll/win32/usp10/indicsyllable.c @@ -3,7 +3,9 @@ /* and from
http://www.unicode.org/Public/10.0.0/ucd/IndicPositionalCategory.txt
*/ /* DO NOT EDIT!! */ -const unsigned short /* DECLSPEC_HIDDEN */ indic_syllabic_table[3312] = +#include "wine/unicode.h" + +const unsigned short DECLSPEC_HIDDEN indic_syllabic_table[3312] = { /* level 1 offsets */ 0x0100, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, 0x0110, diff --git a/dll/win32/usp10/linebreak.c b/dll/win32/usp10/linebreak.c index 0c03e334c0..56bde66e9e 100644 --- a/dll/win32/usp10/linebreak.c +++ b/dll/win32/usp10/linebreak.c @@ -2,7 +2,9 @@ /* generated from
http://www.unicode.org/Public/10.0.0/ucd/LineBreak.txt
*/ /* DO NOT EDIT!! */ -const unsigned short /* DECLSPEC_HIDDEN */ wine_linebreak_table[7248] = +#include "wine/unicode.h" + +const unsigned short DECLSPEC_HIDDEN wine_linebreak_table[7248] = { /* level 1 offsets */ 0x0100, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0170, diff --git a/dll/win32/usp10/mirror.c b/dll/win32/usp10/mirror.c index c8f3468165..23dab536c4 100644 --- a/dll/win32/usp10/mirror.c +++ b/dll/win32/usp10/mirror.c @@ -2,8 +2,7 @@ /* generated from
http://www.unicode.org/Public/10.0.0/ucd/BidiMirroring.txt
*/ /* DO NOT EDIT!! */ -#include <windef.h> -#include <winnt.h> +#include "wine/unicode.h" const WCHAR DECLSPEC_HIDDEN wine_mirror_map[3292] = { diff --git a/dll/win32/usp10/opentype.c b/dll/win32/usp10/opentype.c index 9b7827af65..2d708a8c40 100644 --- a/dll/win32/usp10/opentype.c +++ b/dll/win32/usp10/opentype.c @@ -18,10 +18,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ +#include <stdarg.h> +#include <stdlib.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "usp10.h" +#include "winternl.h" #include "usp10_internal.h" -#include <winternl.h> +#include "wine/debug.h" +#include "wine/heap.h" WINE_DEFAULT_DEBUG_CHANNEL(uniscribe); diff --git a/dll/win32/usp10/precomp.h b/dll/win32/usp10/precomp.h new file mode 100644 index 0000000000..00da1b9083 --- /dev/null +++ b/dll/win32/usp10/precomp.h @@ -0,0 +1,23 @@ + +#ifndef _USP10_PRECOMP_H_ +#define _USP10_PRECOMP_H_ + +#include <config.h> + +#include <stdarg.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include <windef.h> +#include <winbase.h> +#include <wingdi.h> +#include <usp10.h> + +#include <wine/debug.h> +#include <wine/unicode.h> + +#include "usp10_internal.h" + +#endif /* !_USP10_PRECOMP_H_ */ diff --git a/dll/win32/usp10/shape.c b/dll/win32/usp10/shape.c index 946eba31bd..ca084e7285 100644 --- a/dll/win32/usp10/shape.c +++ b/dll/win32/usp10/shape.c @@ -18,9 +18,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ +#include <stdarg.h> +#include <stdlib.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "usp10.h" +#include "winternl.h" #include "usp10_internal.h" +#include "wine/debug.h" +#include "wine/heap.h" + WINE_DEFAULT_DEBUG_CHANNEL(uniscribe); #define FIRST_ARABIC_CHAR 0x0600 diff --git a/dll/win32/usp10/shaping.c b/dll/win32/usp10/shaping.c index 4a5d4c9469..82435ff2c3 100644 --- a/dll/win32/usp10/shaping.c +++ b/dll/win32/usp10/shaping.c @@ -2,7 +2,9 @@ /* generated from
http://www.unicode.org/Public/10.0.0/ucd/ArabicShaping.txt
*/ /* DO NOT EDIT!! */ -const unsigned short /* DECLSPEC_HIDDEN */ wine_shaping_table[2912] = +#include "wine/unicode.h" + +const unsigned short DECLSPEC_HIDDEN wine_shaping_table[2912] = { /* level 1 offsets */ 0x0100, 0x0110, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, @@ -373,7 +375,7 @@ const unsigned short /* DECLSPEC_HIDDEN */ wine_shaping_table[2912] = 0x0000, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000 }; -const unsigned short /* DECLSPEC_HIDDEN */ wine_shaping_forms[256][4] = +const unsigned short DECLSPEC_HIDDEN wine_shaping_forms[256][4] = { { 0x0600, 0x0600, 0x0600, 0x0600 }, { 0x0601, 0x0601, 0x0601, 0x0601 }, diff --git a/dll/win32/usp10/usp10.c b/dll/win32/usp10/usp10.c index abc40fc891..fe83722053 100644 --- a/dll/win32/usp10/usp10.c +++ b/dll/win32/usp10/usp10.c @@ -24,11 +24,23 @@ * and filtering characters and bi-directional text with custom line breaks. */ +#include <stdarg.h> +#include <stdlib.h> +#include <math.h> + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "winreg.h" +#include "usp10.h" + #include "usp10_internal.h" -#include <math.h> -#include <winuser.h> -#include <winreg.h> +#include "wine/debug.h" +#include "wine/heap.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(uniscribe); @@ -1143,7 +1155,7 @@ HRESULT WINAPI ScriptGetProperties(const SCRIPT_PROPERTIES ***props, int *num) if (!props && !num) return E_INVALIDARG; - if (num) *num = sizeof(script_props)/sizeof(script_props[0]); + if (num) *num = ARRAY_SIZE(script_props); if (props) *props = script_props; return S_OK; @@ -3597,14 +3609,13 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN if (!psa->fNoGlyphIndex) /* Have Glyphs? */ fuOptions |= ETO_GLYPH_INDEX; /* Say don't do translation to glyph */ - lpDx = heap_alloc(cGlyphs * sizeof(INT) * 2); - if (!lpDx) return E_OUTOFMEMORY; + if (!(lpDx = heap_calloc(cGlyphs, 2 * sizeof(*lpDx)))) + return E_OUTOFMEMORY; fuOptions |= ETO_PDY; if (psa->fRTL && psa->fLogicalOrder) { - reordered_glyphs = heap_alloc( cGlyphs * sizeof(WORD) ); - if (!reordered_glyphs) + if (!(reordered_glyphs = heap_calloc(cGlyphs, sizeof(*reordered_glyphs)))) { heap_free( lpDx ); return E_OUTOFMEMORY; @@ -3743,8 +3754,7 @@ HRESULT WINAPI ScriptLayout(int runs, const BYTE *level, int *vistolog, int *log if (!level || (!vistolog && !logtovis)) return E_INVALIDARG; - indexs = heap_alloc(sizeof(int) * runs); - if (!indexs) + if (!(indexs = heap_calloc(runs, sizeof(*indexs)))) return E_OUTOFMEMORY; if (vistolog) diff --git a/dll/win32/usp10/usp10_internal.h b/dll/win32/usp10/usp10_internal.h index c0e28d542c..22295132bb 100644 --- a/dll/win32/usp10/usp10_internal.h +++ b/dll/win32/usp10/usp10_internal.h @@ -19,25 +19,9 @@ * */ -#ifndef _USP10_INTERNAL_H_ -#define _USP10_INTERNAL_H_ +#pragma once -#include <config.h> - -#include <stdarg.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#include <windef.h> -#include <winbase.h> -#include <wingdi.h> -#include <usp10.h> - -#include <wine/debug.h> -#include <wine/unicode.h> -#include <wine/list.h> +#include "wine/list.h" #define MS_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ ( ( (ULONG)_x4 << 24 ) | \ @@ -237,21 +221,6 @@ typedef struct { enum {lex_Halant, lex_Composed_Vowel, lex_Matra_post, lex_Matra_pre, lex_Matra_above, lex_Matra_below, lex_ZWJ, lex_ZWNJ, lex_NBSP, lex_Modifier, lex_Vowel, lex_Consonant, lex_Generic, lex_Ra, lex_Vedic, lex_Anudatta, lex_Nukta}; -static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) -{ - return HeapAlloc(GetProcessHeap(), 0, size); -} - -static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size) -{ - return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); -} - -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} - static inline BOOL is_consonant( int type ) { return (type == lex_Ra || type == lex_Consonant); @@ -307,5 +276,3 @@ unsigned int OpenType_apply_GPOS_lookup(const ScriptCache *psc, const OUTLINETEX HRESULT OpenType_GetFontScriptTags(ScriptCache *psc, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags) DECLSPEC_HIDDEN; HRESULT OpenType_GetFontLanguageTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pLanguageTags, int *pcTags) DECLSPEC_HIDDEN; HRESULT OpenType_GetFontFeatureTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG language_tag, BOOL filtered, OPENTYPE_TAG searchingFor, char tableType, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags, LoadedFeature** feature) DECLSPEC_HIDDEN; - -#endif /* _USP10_INTERNAL_H_ */ diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 48f62c6a60..d9e9e13644 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -189,7 +189,7 @@ reactos/dll/win32/twain_32 # Synced to WineStaging-3.3 reactos/dll/win32/updspapi # Synced to WineStaging-3.3 reactos/dll/win32/url # Synced to WineStaging-3.3 reactos/dll/win32/urlmon # Synced to WineStaging-3.3 -reactos/dll/win32/usp10 # Synced to Wine-3.0 +reactos/dll/win32/usp10 # Synced to WineStaging-3.3 reactos/dll/win32/uxtheme # Forked reactos/dll/win32/vbscript # Synced to Wine-3.0 reactos/dll/win32/version # Synced to Wine-3.0
6 years, 7 months
1
0
0
0
01/01: [NTOSKRNL] More asserts regarding reference count
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2b6df67f0abe387db2a18…
commit 2b6df67f0abe387db2a18d51d0eb728349546e21 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Mar 24 11:59:45 2018 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Mar 24 11:59:45 2018 +0100 [NTOSKRNL] More asserts regarding reference count CORE-14285 CORE-14480 --- ntoskrnl/cc/view.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index e896c57093..f7e7f5f7c6 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -431,7 +431,7 @@ CcRosReleaseVacb ( CcRosVacbIncRefCount(Vacb); } - ASSERT(Vacb->ReferenceCount != 0); + ASSERT(Vacb->ReferenceCount > 0); CcRosReleaseVacbLock(Vacb); @@ -863,6 +863,9 @@ CcRosGetVacb ( DPRINT("*BaseAddress %p\n", *BaseAddress); *Vacb = current; *BaseOffset = current->FileOffset.QuadPart; + + ASSERT(current->ReferenceCount > 1); + return STATUS_SUCCESS; }
6 years, 7 months
1
0
0
0
02/02: [BOOTDATA] Now that our shell supports hard error balloons, tell winsrv that it can send these notifications to the shell.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=56fd088c8a9d5eaf8297d…
commit 56fd088c8a9d5eaf8297dce631060f690e0154bc Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Mar 24 00:24:52 2018 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sat Mar 24 00:25:42 2018 +0100 [BOOTDATA] Now that our shell supports hard error balloons, tell winsrv that it can send these notifications to the shell. --- boot/bootdata/hivesys.inf | 1 + 1 file changed, 1 insertion(+) diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf index ffdfc21684..72d0fb8739 100644 --- a/boot/bootdata/hivesys.inf +++ b/boot/bootdata/hivesys.inf @@ -1312,6 +1312,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Windows","CSDVersion",0x00010001,0x000002 HKLM,"SYSTEM\CurrentControlSet\Control\Windows","Directory",0x00020002,"%SystemRoot%" HKLM,"SYSTEM\CurrentControlSet\Control\Windows","ErrorMode",0x00010003,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Control\Windows","NoInteractiveServices",0x00010003,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Control\Windows","ShellErrorMode",0x00010003,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Control\Windows","SystemDirectory",0x00020002,"%SystemRoot%\system32" HKLM,"SYSTEM\CurrentControlSet\Control\SecurityProviders","SecurityProviders",2,"schannel.dll"
6 years, 7 months
1
0
0
0
01/02: [BOOTDATA] Set the event logs 'Retention' value to zero so that the events can always be overwritten when the logs are full.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=37afd9c3718551fa00463…
commit 37afd9c3718551fa004633f883dc195710ae4ba2 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Mar 24 00:16:42 2018 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sat Mar 24 00:25:22 2018 +0100 [BOOTDATA] Set the event logs 'Retention' value to zero so that the events can always be overwritten when the logs are full. --- boot/bootdata/hivesys.inf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf index d2e7d03ca7..ffdfc21684 100644 --- a/boot/bootdata/hivesys.inf +++ b/boot/bootdata/hivesys.inf @@ -1537,17 +1537,17 @@ HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Type",0x00010001,0x00000010 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Application",,0x00000010 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Application","File",0x00020000,"%SystemRoot%\system32\config\AppEvent.Evt" HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Application","MaxSize",0x00010003,524288 -HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Application","Retention",0x00010003,604800 +HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Application","Retention",0x00010003,0 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Security",,0x00000010 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Security","File",0x00020000,"%SystemRoot%\system32\config\SecEvent.Evt" HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Security","MaxSize",0x00010003,524288 -HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Security","Retention",0x00010003,604800 +HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\Security","Retention",0x00010003,0 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\System",,0x00000010 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\System","File",0x00020000,"%SystemRoot%\system32\config\SysEvent.Evt" HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\System","MaxSize",0x00010003,524288 -HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\System","Retention",0x00010003,604800 +HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\System","Retention",0x00010003,0 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\System\Application Popup","EventMessageFile",0x00020000,"%SystemRoot%\system32\ntdll.dll" HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\System\Application Popup","TypesSupported",0x00010003,0x00000007 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog\System\EventLog","EventMessageFile",0x00020000,"%SystemRoot%\system32\netevent.dll"
6 years, 7 months
1
0
0
0
02/02: [CRT] Implement the missing CRT _sc(w)printf() functions. CORE-14497
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1a318898010a8c94624b6…
commit 1a318898010a8c94624b60966acf546284c636d9 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Fri Mar 23 22:30:18 2018 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Mar 23 22:30:18 2018 +0100 [CRT] Implement the missing CRT _sc(w)printf() functions. CORE-14497 --- dll/win32/msvcrt/msvcrt.spec | 4 ++-- sdk/lib/crt/crt.cmake | 2 ++ sdk/lib/crt/printf/_scprintf.c | 25 +++++++++++++++++++++++++ sdk/lib/crt/printf/_scwprintf.c | 25 +++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/dll/win32/msvcrt/msvcrt.spec b/dll/win32/msvcrt/msvcrt.spec index 368c97e4cc..202bf7e115 100644 --- a/dll/win32/msvcrt/msvcrt.spec +++ b/dll/win32/msvcrt/msvcrt.spec @@ -601,8 +601,8 @@ @ cdecl -arch=i386 _safe_fprem() @ cdecl -arch=i386 _safe_fprem1() @ cdecl _scalb(double long) -# stub _scprintf -# stub _scwprintf +@ varargs _scprintf(str) +@ varargs _scwprintf(wstr) @ cdecl _searchenv(str str ptr) @ stdcall -i386 _seh_longjmp_unwind(ptr) # stub _set_SSE2_enable diff --git a/sdk/lib/crt/crt.cmake b/sdk/lib/crt/crt.cmake index 66c5b52e1d..a6a7e5dc13 100644 --- a/sdk/lib/crt/crt.cmake +++ b/sdk/lib/crt/crt.cmake @@ -135,6 +135,8 @@ list(APPEND CRT_SOURCE misc/tls.c printf/_cprintf.c printf/_cwprintf.c + printf/_scprintf.c + printf/_scwprintf.c printf/_snprintf.c printf/_snprintf_s.c printf/_snwprintf.c diff --git a/sdk/lib/crt/printf/_scprintf.c b/sdk/lib/crt/printf/_scprintf.c new file mode 100644 index 0000000000..9eb30ca4e3 --- /dev/null +++ b/sdk/lib/crt/printf/_scprintf.c @@ -0,0 +1,25 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS crt library + * FILE: lib/sdk/crt/printf/_scprintf.c + * PURPOSE: Implementation of _scprintf + */ + +#include <stdio.h> +#include <stdarg.h> + +int +__cdecl +_scprintf( + const char *format, + ...) +{ + int len; + va_list args; + + va_start(args, format); + len = _vscprintf(format, args); + va_end(args); + + return len; +} diff --git a/sdk/lib/crt/printf/_scwprintf.c b/sdk/lib/crt/printf/_scwprintf.c new file mode 100644 index 0000000000..78c4c9ee1a --- /dev/null +++ b/sdk/lib/crt/printf/_scwprintf.c @@ -0,0 +1,25 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS crt library + * FILE: lib/sdk/crt/printf/_scwprintf.c + * PURPOSE: Implementation of _scwprintf + */ + +#include <stdio.h> +#include <stdarg.h> + +int +__cdecl +_scwprintf( + const wchar_t *format, + ...) +{ + int len; + va_list args; + + va_start(args, format); + len = _vscwprintf(format, args); + va_end(args); + + return len; +}
6 years, 7 months
1
0
0
0
01/02: [CRT] Fix implementation of _vsc(w)printf() for native NT.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fd6e2d752d80b660ec603…
commit fd6e2d752d80b660ec603102f97204f794837a7a Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Fri Mar 23 22:02:31 2018 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Mar 23 22:03:35 2018 +0100 [CRT] Fix implementation of _vsc(w)printf() for native NT. --- sdk/lib/crt/printf/_vscprintf.c | 5 +++-- sdk/lib/crt/printf/_vscwprintf.c | 18 ++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/sdk/lib/crt/printf/_vscprintf.c b/sdk/lib/crt/printf/_vscprintf.c index 7b4e6b5f72..1f626783d2 100644 --- a/sdk/lib/crt/printf/_vscprintf.c +++ b/sdk/lib/crt/printf/_vscprintf.c @@ -11,9 +11,10 @@ int __cdecl streamout(FILE *stream, const char *format, va_list argptr); int +__cdecl _vscprintf( - const char *format, - va_list argptr) + const char *format, + va_list argptr) { FILE nulfile; nulfile._tmpfname = nulfile._ptr = nulfile._base = NULL; diff --git a/sdk/lib/crt/printf/_vscwprintf.c b/sdk/lib/crt/printf/_vscwprintf.c index 5b01fc1db9..e0c2b1b164 100644 --- a/sdk/lib/crt/printf/_vscwprintf.c +++ b/sdk/lib/crt/printf/_vscwprintf.c @@ -2,33 +2,23 @@ * COPYRIGHT: GNU GPL, see COPYING in the top level directory * PROJECT: ReactOS crt library * FILE: lib/sdk/crt/printf/_vscwprintf.c - * PURPOSE: Implementation of _vscprintf + * PURPOSE: Implementation of _vscwprintf */ #include <stdio.h> #include <stdarg.h> -#ifdef _LIBCNT_ -#include <ntddk.h> -#endif - int __cdecl wstreamout(FILE *stream, const wchar_t *format, va_list argptr); int __cdecl _vscwprintf( - const wchar_t *format, - va_list argptr) + const wchar_t *format, + va_list argptr) { - int ret; -#ifndef _LIBCNT_ FILE nulfile; nulfile._tmpfname = nulfile._ptr = nulfile._base = NULL; nulfile._bufsiz = nulfile._charbuf = nulfile._cnt = 0; nulfile._flag = _IOSTRG | _IOWRT; - ret = wstreamout(&nulfile, format, argptr); -#else - ret = -1; -#endif - return ret; + return wstreamout(&nulfile, format, argptr); }
6 years, 7 months
1
0
0
0
01/01: [URLMON_WINETEST] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7f95c141535acb78c7062…
commit 7f95c141535acb78c7062a91349aa4a57ce37edc Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Fri Mar 23 12:35:59 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Fri Mar 23 12:35:59 2018 +0100 [URLMON_WINETEST] Sync with Wine Staging 3.3. CORE-14434 --- modules/rostests/winetests/urlmon/generated.c | 13 +- modules/rostests/winetests/urlmon/misc.c | 30 +-- modules/rostests/winetests/urlmon/protocol.c | 68 +++--- modules/rostests/winetests/urlmon/sec_mgr.c | 29 +-- modules/rostests/winetests/urlmon/stream.c | 21 +- modules/rostests/winetests/urlmon/uri.c | 315 +++++++++++++++++++++++--- modules/rostests/winetests/urlmon/url.c | 35 +-- 7 files changed, 376 insertions(+), 135 deletions(-) diff --git a/modules/rostests/winetests/urlmon/generated.c b/modules/rostests/winetests/urlmon/generated.c index 20594d91f1..75358140a1 100644 --- a/modules/rostests/winetests/urlmon/generated.c +++ b/modules/rostests/winetests/urlmon/generated.c @@ -5,10 +5,6 @@ * Unit tests for data structure packing */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #ifndef __REACTOS__ #define WINVER 0x0501 #define _WIN32_IE 0x0501 @@ -18,12 +14,11 @@ #define WINE_NOWINSOCK #include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <objbase.h> -#include <urlmon.h> +#include "windef.h" +#include "winbase.h" +#include "urlmon.h" -#include <wine/test.h> +#include "wine/test.h" /*********************************************************************** * Compatibility macros diff --git a/modules/rostests/winetests/urlmon/misc.c b/modules/rostests/winetests/urlmon/misc.c index 875334d68f..e88c960497 100644 --- a/modules/rostests/winetests/urlmon/misc.c +++ b/modules/rostests/winetests/urlmon/misc.c @@ -16,27 +16,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE #define NONAMELESSUNION #include <wine/test.h> -//#include <stdarg.h> -//#include <stddef.h> +#include <stdarg.h> +#include <stddef.h> #include <stdio.h> -//#include "windef.h" -//#include "winbase.h" -#include <winreg.h> -#include <winnls.h> -#include <ole2.h> -//#include "urlmon.h" +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "urlmon.h" -#include <initguid.h> +#include "initguid.h" +#include "wine/heap.h" DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B); @@ -94,11 +89,6 @@ static int strcmp_wa(const WCHAR *strw, const char *stra) return lstrcmpW(strw, buf); } -static void heap_free(void *mem) -{ - HeapFree(GetProcessHeap(), 0, mem); -} - static WCHAR *a2w(const char *str) { WCHAR *ret; @@ -2342,7 +2332,7 @@ static void test_bsc_marshaling(void) rem_bindinfo.stgmedData.tymed = TYMED_HGLOBAL; - buf = GlobalAlloc(0, sizeof(5)); + buf = GlobalAlloc(0, 5); strcpy(buf, "test"); rem_bindinfo.stgmedData.u.hGlobal = buf; rem_bindinfo.cbstgmedData = 5; @@ -2559,7 +2549,7 @@ static void test_bsc_marshaling(void) rem_bindinfo.stgmedData.tymed = TYMED_HGLOBAL; - buf = GlobalAlloc(0, sizeof(5)); + buf = GlobalAlloc(0, 5); strcpy(buf, "test"); rem_bindinfo.stgmedData.u.hGlobal = buf; rem_bindinfo.cbstgmedData = 5; diff --git a/modules/rostests/winetests/urlmon/protocol.c b/modules/rostests/winetests/urlmon/protocol.c index 4012cf1d19..50fe999dfe 100644 --- a/modules/rostests/winetests/urlmon/protocol.c +++ b/modules/rostests/winetests/urlmon/protocol.c @@ -16,23 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE #include <wine/test.h> -//#include <stdarg.h> +#include <stdarg.h> #include <stdio.h> -//#include "windef.h" -//#include "winbase.h" -#include <winnls.h> -#include <ole2.h> -#include <urlmon.h> -#include <wininet.h> +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "urlmon.h" +#include "wininet.h" static HRESULT (WINAPI *pCoInternetGetSession)(DWORD, IInternetSession **, DWORD); static HRESULT (WINAPI *pReleaseBindInfo)(BINDINFO*); @@ -945,6 +940,39 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, return S_OK; } +static void test_http_info(IInternetProtocol *protocol) +{ + IWinInetHttpInfo *info; + char buf[1024]; + DWORD size, len; + HRESULT hres; + + static const WCHAR connectionW[] = {'c','o','n','n','e','c','t','i','o','n',0}; + + hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info); + ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08x\n", hres); + + size = sizeof(buf); + strcpy(buf, "connection"); + hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL); + if(tested_protocol != FTP_TEST) { + ok(hres == S_OK, "QueryInfo failed: %08x\n", hres); + + ok(!strcmp(buf, "Keep-Alive"), "buf = %s\n", buf); + len = strlen(buf); + ok(size == len, "size = %u, expected %u\n", size, len); + + size = sizeof(buf); + memcpy(buf, connectionW, sizeof(connectionW)); + hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL); + ok(hres == S_FALSE, "QueryInfo returned %08x\n", hres); + }else { + ok(hres == S_FALSE, "QueryInfo failed: %08x\n", hres); + } + + IWinInetHttpInfo_Release(info); +} + static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) { @@ -1076,6 +1104,9 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR "grcfBSCF = %08x\n", grfBSCF); } + if((grfBSCF & BSCF_FIRSTDATANOTIFICATION) && !binding_test) + test_http_info(async_protocol); + if(!(bindf & BINDF_FROMURLMON) && !(grfBSCF & BSCF_LASTDATANOTIFICATION)) { if(state == STATE_CONNECTING) { @@ -3140,19 +3171,6 @@ static void test_protocol_terminate(IInternetProtocol *protocol) ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres); } -static void test_http_info(IInternetProtocol *protocol) -{ - IWinInetHttpInfo *info; - HRESULT hres; - - hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info); - ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08x\n", hres); - - /* TODO */ - - IWinInetHttpInfo_Release(info); -} - /* is_first refers to whether this is the first call to this function * _for this url_ */ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tymed) @@ -3194,7 +3212,6 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym ULONG ref; test_priority(async_protocol); - test_http_info(async_protocol); SET_EXPECT(ReportProgress_COOKIE_SENT); if(http_is_first) { @@ -3463,7 +3480,6 @@ static void test_ftp_protocol(void) ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres); test_priority(async_protocol); - test_http_info(async_protocol); SET_EXPECT(GetBindInfo); SET_EXPECT(ReportProgress_FINDINGRESOURCE); diff --git a/modules/rostests/winetests/urlmon/sec_mgr.c b/modules/rostests/winetests/urlmon/sec_mgr.c index 3bb4a3e89e..7c57d9e375 100644 --- a/modules/rostests/winetests/urlmon/sec_mgr.c +++ b/modules/rostests/winetests/urlmon/sec_mgr.c @@ -18,31 +18,27 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE -#define NONAMELESSUNION /* needed for IInternetZoneManagerEx2 */ +#ifdef __REACTOS__ #undef _WIN32_IE +#endif #define _WIN32_IE 0x0700 #include <wine/test.h> -//#include <stdarg.h> -//#include <stddef.h> +#include <stdarg.h> +#include <stddef.h> #include <stdio.h> -//#include "windef.h" -//#include "winbase.h" -#include <winreg.h> -#include <winnls.h> -#include <ole2.h> -//#include "urlmon.h" +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "urlmon.h" -//#include "initguid.h" +#include "initguid.h" +#include <wine/heap.h> #define URLZONE_CUSTOM URLZONE_USER_MIN+1 #define URLZONE_CUSTOM2 URLZONE_CUSTOM+1 @@ -184,11 +180,6 @@ static int strcmp_w(const WCHAR *str1, const WCHAR *str2) return memcmp(str1, str2, len1*sizeof(WCHAR)); } -static inline void heap_free(void *mem) -{ - HeapFree(GetProcessHeap(), 0, mem); -} - static inline LPWSTR a2w(LPCSTR str) { LPWSTR ret = NULL; diff --git a/modules/rostests/winetests/urlmon/stream.c b/modules/rostests/winetests/urlmon/stream.c index afa91cc02b..6717198b31 100644 --- a/modules/rostests/winetests/urlmon/stream.c +++ b/modules/rostests/winetests/urlmon/stream.c @@ -16,23 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS #define CONST_VTABLE #include <wine/test.h> -//#include <stdarg.h> -//#include <stddef.h> - -//#include "windef.h" -//#include "winbase.h" -#include <winnls.h> -#include <ole2.h> -//#include "urlmon.h" -#include <wininet.h> +#include <stdarg.h> +#include <stddef.h> + +#include "windef.h" +#include "winbase.h" +#include "ole2.h" +#include "urlmon.h" +#include "wininet.h" #define DEFINE_EXPECT(func) \ static BOOL expect_ ## func = FALSE, called_ ## func = FALSE diff --git a/modules/rostests/winetests/urlmon/uri.c b/modules/rostests/winetests/urlmon/uri.c index fb9a7d08f6..90f51bf5dd 100644 --- a/modules/rostests/winetests/urlmon/uri.c +++ b/modules/rostests/winetests/urlmon/uri.c @@ -18,28 +18,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include <wine/test.h> -//#include <stdarg.h> -//#include <stddef.h> +#include <stdarg.h> +#include <stddef.h> #define COBJMACROS #define CONST_VTABLE #define WIN32_LEAN_AND_MEAN -//#include "windef.h" -//#include "winbase.h" -#include <winreg.h> -#include <winnls.h> -#include <ole2.h> -//#include "urlmon.h" -#include <shlwapi.h> -#include <wininet.h> -#include <strsafe.h> -#include <initguid.h> +#include "windef.h" +#include "winbase.h" +#include "urlmon.h" +#include "shlwapi.h" +#include "wininet.h" +#include "strsafe.h" +#include "initguid.h" +#include <wine/heap.h> DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C); @@ -4805,6 +4799,266 @@ static const uri_properties uri_tests[] = { {URL_SCHEME_FILE,S_OK,FALSE}, {URLZONE_INVALID,E_NOTIMPL,FALSE} } + }, + /* Path with Unicode characters. Unicode characters should not be encoded */ + {/* "
http://127.0.0.1/测试/test.txt
" with Chinese in UTF-8 encoding */ + "
http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt
", 0, S_OK, FALSE, + { + {"
http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt
",S_OK,FALSE}, + {"127.0.0.1",S_OK,FALSE}, + {"
http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt
",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"127.0.0.1",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE}, + {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"
http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt
",S_OK,FALSE}, + {"http",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_IPV4,S_OK,FALSE}, + {80,S_OK,FALSE}, + {URL_SCHEME_HTTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + { "file:\xE6\xB5\x8B\xE8\xAF\x95.html", 0, S_OK, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE}, + {"file",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Username with Unicode characters. Unicode characters should not be encoded */ + { "ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK, FALSE, + { + {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999",S_OK,FALSE}, + {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"
winehq.org
",S_OK,FALSE}, + {".txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"
ftp.winehq.org
",S_OK,FALSE}, + {"wine",S_OK,FALSE}, + {"/dir/foobar.txt",S_OK,FALSE}, + {"/dir/foobar.txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"ftp",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95:wine",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {9999,S_OK,FALSE}, + {URL_SCHEME_FTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Password with Unicode characters. Unicode characters should not be encoded */ + { "ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK, FALSE, + { + {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999",S_OK,FALSE}, + {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"
winehq.org
",S_OK,FALSE}, + {".txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"
ftp.winehq.org
",S_OK,FALSE}, + {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE}, + {"/dir/foobar.txt",S_OK,FALSE}, + {"/dir/foobar.txt",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE}, + {"ftp",S_OK,FALSE}, + {"winepass:\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE}, + {"winepass",S_OK,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {9999,S_OK,FALSE}, + {URL_SCHEME_FTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Query with Unicode characters. Unicode characters should not be encoded */ + { "
http://www.winehq.org/tests/..?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y
", 0, S_OK, FALSE, + { + {"
http://www.winehq.org/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y
",S_OK,FALSE}, + {"
www.winehq.org
",S_OK,FALSE}, + {"
http://www.winehq.org/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y
",S_OK,FALSE}, + {"
winehq.org
",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"
www.winehq.org
",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"/",S_OK,FALSE}, + {"/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE}, + {"?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE}, + {"
http://www.winehq.org/tests/..?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y
",S_OK,FALSE}, + {"http",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {80,S_OK,FALSE}, + {URL_SCHEME_HTTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE}, + } + }, + /* Fragment with Unicode characters. Unicode characters should not be encoded */ + { "
http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95
", 0, S_OK, FALSE, + { + {"
http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95
",S_OK,FALSE}, + {"
www.winehq.org
",S_OK,FALSE}, + {"
http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95
",S_OK,FALSE}, + {"
winehq.org
",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE}, + {"
www.winehq.org
",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"/tests/",S_OK,FALSE}, + {"/tests/",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"
http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95
",S_OK,FALSE}, + {"http",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {80,S_OK,FALSE}, + {URL_SCHEME_HTTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE}, + } + }, + /* ZERO WIDTH JOINER as non-printing Unicode characters should not be encoded if not preprocessed. */ + { "file:a\xE2\x80\x8D.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"file:a\xE2\x80\x8D.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"a\xE2\x80\x8D.html",S_OK,FALSE}, + {"a\xE2\x80\x8D.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"file:a\xE2\x80\x8D.html",S_OK,FALSE}, + {"file",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* LEFT-TO-RIGHT MARK as non-printing Unicode characters should not be encoded if not preprocessed. */ + { "file:ab\xE2\x80\x8E.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"file:ab\xE2\x80\x8D.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"ab\xE2\x80\x8D.html",S_OK,FALSE}, + {"ab\xE2\x80\x8D.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"file:ab\xE2\x80\x8D.html",S_OK,FALSE}, + {"file",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Invalid Unicode characters should not be filtered */ + { "file:ab\xc3\x28.html", 0, S_OK, FALSE, + { + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"file:ab\xc3\x28.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {".html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"ab\xc3\x28.html",S_OK,FALSE}, + {"ab\xc3\x28.html",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"file:ab\xc3\x28.html",S_OK,FALSE}, + {"file",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE} + }, + { + {Uri_HOST_UNKNOWN,S_OK,FALSE}, + {0,S_FALSE,FALSE}, + {URL_SCHEME_FILE,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } + }, + /* Make sure % encoded unicode characters are not decoded. */ + { "ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/", 0, S_OK, FALSE, + { + {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK,FALSE}, + {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com",S_OK,FALSE}, + {"
ftp://ftp.google.com/
",S_OK,FALSE}, + {"
google.com
",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"",S_FALSE,FALSE}, + {"
ftp.google.com
",S_OK,FALSE}, + {"%E6%B5%8B%E8%AF%95",S_OK,FALSE}, + {"/",S_OK,FALSE}, + {"/",S_OK,FALSE}, + {"",S_FALSE,FALSE}, + {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK,FALSE}, + {"ftp",S_OK,FALSE}, + {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95",S_OK,FALSE}, + {"%E6%B5%8B%E8%AF%95",S_OK,FALSE} + }, + { + {Uri_HOST_DNS,S_OK,FALSE}, + {21,S_OK,FALSE}, + {URL_SCHEME_FTP,S_OK,FALSE}, + {URLZONE_INVALID,E_NOTIMPL,FALSE} + } } }; @@ -7396,6 +7650,9 @@ static const uri_parse_test uri_parse_tests[] = { {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE}, {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE}, {"
http://google.com/
",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE}, + {"file:/c:/dir/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\dir\\test.mp3",S_OK}, + {"file:/c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK}, + {"file://c:\\test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK}, /* PARSE_URL_FROM_PATH tests. */ /* This function almost seems to useless (just returns the absolute uri). */ @@ -7432,24 +7689,14 @@ static inline LPWSTR a2w(LPCSTR str) { LPWSTR ret = NULL; if(str) { - DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + DWORD len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len); } return ret; } -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) -{ - return HeapAlloc(GetProcessHeap(), 0, size); -} - -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} - static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) { LPWSTR strAW = a2w(strA); DWORD ret = lstrcmpW(strAW, strB); @@ -8113,8 +8360,12 @@ static void test_IUri_GetPropertyLength(void) { for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) { DWORD expectedLen, receivedLen; uri_str_property prop = test.str_props[j]; + LPWSTR expectedValueW; expectedLen = lstrlenA(prop.value); + /* Value may be unicode encoded */ + expectedValueW = a2w(prop.value); + expectedLen = lstrlenW(expectedValueW); /* This won't be necessary once GetPropertyLength is implemented. */ receivedLen = -1; @@ -10573,11 +10824,11 @@ static void test_CoInternetParseIUri(void) { if(SUCCEEDED(hr)) { DWORD len = lstrlenA(test.property); ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)), - "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n", - test.property, wine_dbgstr_w(result), i); + "Error: Expected %s but got %s instead on uri_parse_tests[%d] - %s.\n", + test.property, wine_dbgstr_w(result), i, wine_dbgstr_w(uriW)); ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len), - "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n", - len, result_len, i); + "Error: Expected %d, but got %d instead on uri_parse_tests[%d] - %s.\n", + len, result_len, i, wine_dbgstr_w(uriW)); } else { ok(!result_len, "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n", diff --git a/modules/rostests/winetests/urlmon/url.c b/modules/rostests/winetests/urlmon/url.c index 1cc886379e..70234ff3fd 100644 --- a/modules/rostests/winetests/urlmon/url.c +++ b/modules/rostests/winetests/urlmon/url.c @@ -19,29 +19,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -//#include <stdarg.h> +#include <stdarg.h> #include <stdio.h> #define COBJMACROS #define NONAMELESSUNION #define CONST_VTABLE -#include <windef.h> -#include <winbase.h> -#include <winnls.h> -#include <winreg.h> -#include <wingdi.h> -#include <objbase.h> -//#include "initguid.h" -//#include "urlmon.h" -#include <wininet.h> -#include <mshtml.h> +#include "windef.h" +#include "winbase.h" +#include "initguid.h" +#include "urlmon.h" +#include "wininet.h" +#include "mshtml.h" -#include <wine/test.h> +#include "wine/test.h" static HRESULT (WINAPI *pCreateAsyncBindCtxEx)(IBindCtx *, DWORD, IBindStatusCallback *, IEnumFORMATETC *, IBindCtx **, DWORD); @@ -190,6 +182,7 @@ static HRESULT abort_hres; static BOOL have_IHttpNegotiate2, use_bscex, is_async_prot; static BOOL test_redirect, use_cache_file, callback_read, no_callback, test_abort; static WCHAR cache_file_name[MAX_PATH]; +static WCHAR http_cache_file[MAX_PATH]; static BOOL only_check_prot_args = FALSE; static BOOL invalid_cn_accepted = FALSE; static BOOL abort_start = FALSE; @@ -1935,6 +1928,14 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" ); } + if(test_protocol == HTTP_TEST && !emulate_protocol && http_cache_file[0]) { + HANDLE file = CreateFileW(http_cache_file, DELETE, FILE_SHARE_DELETE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file == INVALID_HANDLE_VALUE, "expected INVALID_HANDLE_VALUE, got %p\n", file); + ok(GetLastError() == ERROR_SHARING_VIOLATION, "expected ERROR_SHARING_VIOLATION, got %u\n", GetLastError()); + http_cache_file[0] = 0; + } + return S_OK; } @@ -2091,6 +2092,8 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW else if(emulate_protocol) ok(!lstrcmpW(pstgmed->u.lpszFileName, cache_fileW), "unexpected file name %s\n", wine_dbgstr_w(pstgmed->u.lpszFileName)); + else if(test_protocol == HTTP_TEST) + lstrcpyW(http_cache_file, pstgmed->u.lpszFileName); else ok(pstgmed->u.lpszFileName != NULL, "lpszFileName == NULL\n"); }
6 years, 7 months
1
0
0
0
01/01: [URLMON] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=143d4fdbd29a8aa153237…
commit 143d4fdbd29a8aa1532374cba9d062ff46a0d736 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Fri Mar 23 12:35:23 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Fri Mar 23 12:35:23 2018 +0100 [URLMON] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/urlmon/CMakeLists.txt | 4 +-- dll/win32/urlmon/axinstall.c | 10 +++++++- dll/win32/urlmon/bindctx.c | 5 ++++ dll/win32/urlmon/binding.c | 8 ++++++ dll/win32/urlmon/bindprot.c | 3 +++ dll/win32/urlmon/download.c | 3 +++ dll/win32/urlmon/file.c | 6 +++++ dll/win32/urlmon/format.c | 3 +++ dll/win32/urlmon/ftp.c | 7 ++++++ dll/win32/urlmon/gopher.c | 3 +++ dll/win32/urlmon/http.c | 18 ++++++++++---- dll/win32/urlmon/internet.c | 6 +++++ dll/win32/urlmon/mimefilter.c | 3 +++ dll/win32/urlmon/mk.c | 6 +++++ dll/win32/urlmon/precomp.h | 21 ++++++++++++++++ dll/win32/urlmon/protocol.c | 4 +++ dll/win32/urlmon/sec_mgr.c | 11 +++++++++ dll/win32/urlmon/session.c | 5 ++++ dll/win32/urlmon/umon.c | 10 ++++++-- dll/win32/urlmon/umstream.c | 9 +++++++ dll/win32/urlmon/uri.c | 31 ++++++++++++++++------- dll/win32/urlmon/urlmon.rc | 1 + dll/win32/urlmon/urlmon_main.c | 18 ++++++++++++-- dll/win32/urlmon/urlmon_main.h | 54 +++++++++-------------------------------- dll/win32/urlmon/usrmarshal.c | 6 ++++- media/doc/README.WINE | 2 +- 26 files changed, 191 insertions(+), 66 deletions(-) diff --git a/dll/win32/urlmon/CMakeLists.txt b/dll/win32/urlmon/CMakeLists.txt index 6194ab7431..51eeb5abc5 100644 --- a/dll/win32/urlmon/CMakeLists.txt +++ b/dll/win32/urlmon/CMakeLists.txt @@ -43,7 +43,7 @@ list(APPEND SOURCE uri.c urlmon_main.c usrmarshal.c - urlmon_main.h) + precomp.h) add_library(urlmon SHARED ${SOURCE} @@ -56,5 +56,5 @@ add_library(urlmon SHARED set_module_type(urlmon win32dll) target_link_libraries(urlmon uuid wine ${PSEH_LIB}) add_importlibs(urlmon rpcrt4 propsys ole32 oleaut32 shlwapi shell32 wininet user32 advapi32 advpack kernel32_vista msvcrt kernel32 ntdll) -add_pch(urlmon urlmon_main.h SOURCE) +add_pch(urlmon precomp.h SOURCE) add_cd_file(TARGET urlmon DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/urlmon/axinstall.c b/dll/win32/urlmon/axinstall.c index c84adbbf94..d2cf7e6d85 100644 --- a/dll/win32/urlmon/axinstall.c +++ b/dll/win32/urlmon/axinstall.c @@ -16,12 +16,20 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "urlmon_main.h" +#define OEMRESOURCE #include <assert.h> +#include "urlmon_main.h" #include "resource.h" +#include "advpub.h" +#include "fdi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + static const WCHAR ctxW[] = {'c','t','x',0}; static const WCHAR cab_extW[] = {'.','c','a','b',0}; static const WCHAR infW[] = {'i','n','f',0}; diff --git a/dll/win32/urlmon/bindctx.c b/dll/win32/urlmon/bindctx.c index 7a81406e73..2759f3d226 100644 --- a/dll/win32/urlmon/bindctx.c +++ b/dll/win32/urlmon/bindctx.c @@ -16,7 +16,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdio.h> + #include "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); static WCHAR bscb_holderW[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 }; diff --git a/dll/win32/urlmon/binding.c b/dll/win32/urlmon/binding.c index f09e6c962c..88b3c1cc5f 100644 --- a/dll/win32/urlmon/binding.c +++ b/dll/win32/urlmon/binding.c @@ -16,7 +16,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define NONAMELESSUNION + #include "urlmon_main.h" +#include "winreg.h" +#include "shlwapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); static WCHAR cbinding_contextW[] = {'C','B','i','n','d','i','n','g',' ','C','o','n','t','e','x','t',0}; static WCHAR bscb_holderW[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 }; diff --git a/dll/win32/urlmon/bindprot.c b/dll/win32/urlmon/bindprot.c index c65b55f23d..47c972b1e3 100644 --- a/dll/win32/urlmon/bindprot.c +++ b/dll/win32/urlmon/bindprot.c @@ -17,6 +17,9 @@ */ #include "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef void (*task_proc_t)(BindProtocol*,task_header_t*); diff --git a/dll/win32/urlmon/download.c b/dll/win32/urlmon/download.c index 1b4d12159d..ca81818caa 100644 --- a/dll/win32/urlmon/download.c +++ b/dll/win32/urlmon/download.c @@ -17,6 +17,9 @@ */ #include "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { IBindStatusCallback IBindStatusCallback_iface; diff --git a/dll/win32/urlmon/file.c b/dll/win32/urlmon/file.c index bd7abc3c43..bba7be1079 100644 --- a/dll/win32/urlmon/file.c +++ b/dll/win32/urlmon/file.c @@ -17,6 +17,12 @@ */ #include "urlmon_main.h" +#include "winreg.h" +#include "shlwapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { IInternetProtocolEx IInternetProtocolEx_iface; diff --git a/dll/win32/urlmon/format.c b/dll/win32/urlmon/format.c index 1a30c52ef2..6967c3b4f3 100644 --- a/dll/win32/urlmon/format.c +++ b/dll/win32/urlmon/format.c @@ -17,6 +17,9 @@ */ #include "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); static WCHAR wszEnumFORMATETC[] = {'_','E','n','u','m','F','O','R','M','A','T','E','T','C','_',0}; diff --git a/dll/win32/urlmon/ftp.c b/dll/win32/urlmon/ftp.c index 4d71e116f8..da1efe202d 100644 --- a/dll/win32/urlmon/ftp.c +++ b/dll/win32/urlmon/ftp.c @@ -18,6 +18,13 @@ #include "urlmon_main.h" +#define NO_SHLWAPI_REG +#include "shlwapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + typedef struct { Protocol base; diff --git a/dll/win32/urlmon/gopher.c b/dll/win32/urlmon/gopher.c index 556eed2782..4087ed5ace 100644 --- a/dll/win32/urlmon/gopher.c +++ b/dll/win32/urlmon/gopher.c @@ -17,6 +17,9 @@ */ #include "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { Protocol base; diff --git a/dll/win32/urlmon/http.c b/dll/win32/urlmon/http.c index 0b0f8af110..9cc6117aaa 100644 --- a/dll/win32/urlmon/http.c +++ b/dll/win32/urlmon/http.c @@ -17,7 +17,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define NONAMELESSUNION + #include "urlmon_main.h" +#include "wininet.h" + +#define NO_SHLWAPI_REG +#include "shlwapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { Protocol base; @@ -902,11 +912,9 @@ static HRESULT WINAPI HttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption if(!This->base.request) return E_FAIL; - if(!HttpQueryInfoW(This->base.request, dwOption, pBuffer, pcbBuffer, pdwFlags)) { - if(pBuffer) - memset(pBuffer, 0, *pcbBuffer); - return S_OK; - } + if(!HttpQueryInfoA(This->base.request, dwOption, pBuffer, pcbBuffer, pdwFlags)) + return S_FALSE; + return S_OK; } diff --git a/dll/win32/urlmon/internet.c b/dll/win32/urlmon/internet.c index 8a6b7f8d84..28aaa0b43c 100644 --- a/dll/win32/urlmon/internet.c +++ b/dll/win32/urlmon/internet.c @@ -18,6 +18,12 @@ */ #include "urlmon_main.h" +#include "winreg.h" +#include "shlwapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); static const WCHAR feature_control_keyW[] = {'S','o','f','t','w','a','r','e','\\', diff --git a/dll/win32/urlmon/mimefilter.c b/dll/win32/urlmon/mimefilter.c index 3b5dcb37c6..e12c2b7196 100644 --- a/dll/win32/urlmon/mimefilter.c +++ b/dll/win32/urlmon/mimefilter.c @@ -17,6 +17,9 @@ */ #include "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { IInternetProtocol IInternetProtocol_iface; diff --git a/dll/win32/urlmon/mk.c b/dll/win32/urlmon/mk.c index aa7b60c440..984f381de3 100644 --- a/dll/win32/urlmon/mk.c +++ b/dll/win32/urlmon/mk.c @@ -17,6 +17,12 @@ */ #include "urlmon_main.h" +#include "wine/debug.h" + +#define NO_SHLWAPI_REG +#include "shlwapi.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { IInternetProtocolEx IInternetProtocolEx_iface; diff --git a/dll/win32/urlmon/precomp.h b/dll/win32/urlmon/precomp.h new file mode 100644 index 0000000000..544651e310 --- /dev/null +++ b/dll/win32/urlmon/precomp.h @@ -0,0 +1,21 @@ + +#ifndef _URLMON_PRECOMP_H +#define _URLMON_PRECOMP_H + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT + +#include "urlmon_main.h" + +#include <winreg.h> +#include <advpub.h> +#define NO_SHLWAPI_REG +#include <shlwapi.h> + +#include <wine/debug.h> + +#endif /* !_URLMON_PRECOMP_H */ diff --git a/dll/win32/urlmon/protocol.c b/dll/win32/urlmon/protocol.c index 50dc17bb86..a6ccf83484 100644 --- a/dll/win32/urlmon/protocol.c +++ b/dll/win32/urlmon/protocol.c @@ -19,6 +19,10 @@ #include "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + static inline HRESULT report_progress(Protocol *protocol, ULONG status_code, LPCWSTR status_text) { return IInternetProtocolSink_ReportProgress(protocol->protocol_sink, status_code, status_text); diff --git a/dll/win32/urlmon/sec_mgr.c b/dll/win32/urlmon/sec_mgr.c index 865e67b2be..eab155d54b 100644 --- a/dll/win32/urlmon/sec_mgr.c +++ b/dll/win32/urlmon/sec_mgr.c @@ -21,7 +21,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdio.h> + #include "urlmon_main.h" +#include "winreg.h" +#include "wininet.h" + +#define NO_SHLWAPI_REG +#include "shlwapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); static const WCHAR currentlevelW[] = {'C','u','r','r','e','n','t','L','e','v','e','l',0}; static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; diff --git a/dll/win32/urlmon/session.c b/dll/win32/urlmon/session.c index 69161abd50..1df483f130 100644 --- a/dll/win32/urlmon/session.c +++ b/dll/win32/urlmon/session.c @@ -17,6 +17,11 @@ */ #include "urlmon_main.h" +#include "winreg.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { LPWSTR protocol; diff --git a/dll/win32/urlmon/umon.c b/dll/win32/urlmon/umon.c index 132e97ede4..9e46319358 100644 --- a/dll/win32/urlmon/umon.c +++ b/dll/win32/urlmon/umon.c @@ -22,8 +22,14 @@ #include "urlmon_main.h" -#include <shellapi.h> -#include <hlink.h> +#include "winreg.h" +#include "shlwapi.h" +#include "hlink.h" +#include "shellapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { IMoniker IMoniker_iface; diff --git a/dll/win32/urlmon/umstream.c b/dll/win32/urlmon/umstream.c index 23e1f86917..6243954526 100644 --- a/dll/win32/urlmon/umstream.c +++ b/dll/win32/urlmon/umstream.c @@ -21,6 +21,15 @@ #include "urlmon_main.h" +#include "winreg.h" +#include "wine/winternl.h" +#include "wininet.h" +#include "shlwapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + typedef struct ProxyBindStatusCallback { IBindStatusCallback IBindStatusCallback_iface; diff --git a/dll/win32/urlmon/uri.c b/dll/win32/urlmon/uri.c index 05579d9a0f..8de3161a7b 100644 --- a/dll/win32/urlmon/uri.c +++ b/dll/win32/urlmon/uri.c @@ -17,9 +17,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <limits.h> + #include "urlmon_main.h" +#include "wine/debug.h" + +#define NO_SHLWAPI_REG +#include "shlwapi.h" -#include <strsafe.h> +#include "strsafe.h" #define URI_DISPLAY_NO_ABSOLUTE_URI 0x1 #define URI_DISPLAY_NO_DEFAULT_PORT_AUTH 0x2 @@ -36,6 +42,8 @@ #define COMBINE_URI_FORCE_FLAG_USE 0x1 +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + static const IID IID_IUriObj = {0x4b364760,0x9f51,0x11df,{0x98,0x1c,0x08,0x00,0x20,0x0c,0x9a,0x66}}; typedef struct { @@ -349,6 +357,11 @@ static inline BOOL is_slash(WCHAR c) return c == '/' || c == '\\'; } +static inline BOOL is_ascii(WCHAR c) +{ + return c < 0x80; +} + static BOOL is_default_port(URL_SCHEME scheme, DWORD port) { DWORD i; @@ -2156,7 +2169,7 @@ static BOOL canonicalize_username(const parse_data *data, Uri *uri, DWORD flags, continue; } } - } else if(!is_reserved(*ptr) && !is_unreserved(*ptr) && *ptr != '\\') { + } else if(is_ascii(*ptr) && !is_reserved(*ptr) && !is_unreserved(*ptr) && *ptr != '\\') { /* Only percent encode forbidden characters if the NO_ENCODE_FORBIDDEN_CHARACTERS flag * is NOT set. */ @@ -2214,7 +2227,7 @@ static BOOL canonicalize_password(const parse_data *data, Uri *uri, DWORD flags, continue; } } - } else if(!is_reserved(*ptr) && !is_unreserved(*ptr) && *ptr != '\\') { + } else if(is_ascii(*ptr) && !is_reserved(*ptr) && !is_unreserved(*ptr) && *ptr != '\\') { /* Only percent encode forbidden characters if the NO_ENCODE_FORBIDDEN_CHARACTERS flag * is NOT set. */ @@ -2349,7 +2362,7 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri, if(!computeOnly) uri->canon_uri[uri->canon_len] = *ptr; ++uri->canon_len; - } else if(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) && + } else if(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr) && known_scheme) { if(!computeOnly) { pct_encode_val(*ptr, uri->canon_uri+uri->canon_len); @@ -2919,7 +2932,7 @@ static DWORD canonicalize_path_hierarchical(const WCHAR *path, DWORD path_len, U len++; do_default_action = FALSE; } - } else if(known_scheme && !is_res && !is_unreserved(*ptr) && !is_reserved(*ptr) && + } else if(known_scheme && !is_res && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr) && (!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) || is_file)) { if(!is_file || !(flags & Uri_CREATE_FILE_USE_DOS_PATH)) { /* Escape the forbidden character. */ @@ -3045,7 +3058,7 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla } } else if(is_mk && *ptr == ':' && ptr + 1 < data->path + data->path_len && *(ptr + 1) == ':') { flags &= ~Uri_CREATE_FILE_USE_DOS_PATH; - } else if(known_scheme && !is_unreserved(*ptr) && !is_reserved(*ptr) && + } else if(known_scheme && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr) && !(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS)) { if(!(is_file && (flags & Uri_CREATE_FILE_USE_DOS_PATH))) { if(!computeOnly) @@ -3199,7 +3212,7 @@ static BOOL canonicalize_query(const parse_data *data, Uri *uri, DWORD flags, BO continue; } } - } else if(known_scheme && !is_unreserved(*ptr) && !is_reserved(*ptr)) { + } else if(known_scheme && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr)) { if(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) && !(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO)) { if(!computeOnly) @@ -3249,7 +3262,7 @@ static BOOL canonicalize_fragment(const parse_data *data, Uri *uri, DWORD flags, continue; } } - } else if(known_scheme && !is_unreserved(*ptr) && !is_reserved(*ptr)) { + } else if(known_scheme && is_ascii(*ptr) && !is_unreserved(*ptr) && !is_reserved(*ptr)) { if(!(flags & Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS) && !(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO)) { if(!computeOnly) @@ -6882,7 +6895,7 @@ static HRESULT parse_canonicalize(const Uri *uri, DWORD flags, LPWSTR output, len += 3; do_default_action = FALSE; } - } else if(!is_reserved(*ptr) && !is_unreserved(*ptr)) { + } else if(is_ascii(*ptr) && !is_reserved(*ptr) && !is_unreserved(*ptr)) { if(flags & URL_ESCAPE_UNSAFE) { if(len + 3 < output_len) pct_encode_val(*ptr, output+len); diff --git a/dll/win32/urlmon/urlmon.rc b/dll/win32/urlmon/urlmon.rc index cea1099888..4a7bbfeb7b 100644 --- a/dll/win32/urlmon/urlmon.rc +++ b/dll/win32/urlmon/urlmon.rc @@ -18,6 +18,7 @@ #include <windef.h> #include <winuser.h> +#include <commctrl.h> #include "resource.h" diff --git a/dll/win32/urlmon/urlmon_main.c b/dll/win32/urlmon/urlmon_main.c index 4cc17cafdf..c4f1cec5fa 100644 --- a/dll/win32/urlmon/urlmon_main.c +++ b/dll/win32/urlmon/urlmon_main.c @@ -18,11 +18,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <stdarg.h> + +#define NONAMELESSUNION + #include "urlmon_main.h" -#include <ole2.h> +#include "winreg.h" + +#define NO_SHLWAPI_REG +#include "shlwapi.h" +#include "advpub.h" +#include "initguid.h" + +#include "wine/debug.h" + +#include "urlmon.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); -#include <initguid.h> DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C); LONG URLMON_refCount = 0; diff --git a/dll/win32/urlmon/urlmon_main.h b/dll/win32/urlmon/urlmon_main.h index 45679521a5..a4a1c78d52 100644 --- a/dll/win32/urlmon/urlmon_main.h +++ b/dll/win32/urlmon/urlmon_main.h @@ -22,30 +22,18 @@ #include <stdarg.h> -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS -#define NONAMELESSUNION -#define NONAMELESSSTRUCT - -#include <windef.h> -#include <winbase.h> -#include <winreg.h> -#include <objbase.h> -#include <oleauto.h> -#include <urlmon.h> -#include <wininet.h> -#include <advpub.h> -#define NO_SHLWAPI_REG -#include <shlwapi.h> - -#include <wine/debug.h> -#include <wine/list.h> -#include <wine/unicode.h> - -WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "urlmon.h" +#include "wininet.h" + +#include "wine/unicode.h" +#include "wine/heap.h" +#include "wine/list.h" extern HINSTANCE hProxyDll DECLSPEC_HIDDEN; extern HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; @@ -247,31 +235,11 @@ void release_notif_hwnd(HWND) DECLSPEC_HIDDEN; const char *debugstr_bindstatus(ULONG) DECLSPEC_HIDDEN; -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size) -{ - return HeapAlloc(GetProcessHeap(), 0, size); -} - -static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size) -{ - return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); -} - -static inline void* __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t size) -{ - return HeapReAlloc(GetProcessHeap(), 0, mem, size); -} - static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t size) { return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size); } -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} - static inline LPWSTR heap_strdupW(LPCWSTR str) { LPWSTR ret = NULL; diff --git a/dll/win32/urlmon/usrmarshal.c b/dll/win32/urlmon/usrmarshal.c index fd8d6d228f..9ddb130646 100644 --- a/dll/win32/urlmon/usrmarshal.c +++ b/dll/win32/urlmon/usrmarshal.c @@ -16,9 +16,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define NONAMELESSUNION + #include "urlmon_main.h" -#include <ole2.h> +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); HRESULT CALLBACK IWinInetHttpInfo_QueryInfo_Proxy(IWinInetHttpInfo* This, DWORD dwOption, LPVOID pBuffer, DWORD *pcbBuf, DWORD *pdwFlags, diff --git a/media/doc/README.WINE b/media/doc/README.WINE index b19935bbf1..48f62c6a60 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -188,7 +188,7 @@ reactos/dll/win32/traffic # Synced to WineStaging-3.3 reactos/dll/win32/twain_32 # Synced to WineStaging-3.3 reactos/dll/win32/updspapi # Synced to WineStaging-3.3 reactos/dll/win32/url # Synced to WineStaging-3.3 -reactos/dll/win32/urlmon # Synced to Wine-3.0 +reactos/dll/win32/urlmon # Synced to WineStaging-3.3 reactos/dll/win32/usp10 # Synced to Wine-3.0 reactos/dll/win32/uxtheme # Forked reactos/dll/win32/vbscript # Synced to Wine-3.0
6 years, 7 months
1
0
0
0
01/01: [URL] Sync with Wine Staging 3.3. CORE-14434
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=06f94a685ca425c6984f8…
commit 06f94a685ca425c6984f8d8e0767004d3af339f4 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Fri Mar 23 12:34:38 2018 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Fri Mar 23 12:34:38 2018 +0100 [URL] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/url/url_main.c | 26 +++++++++++--------------- media/doc/README.WINE | 2 +- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/dll/win32/url/url_main.c b/dll/win32/url/url_main.c index 79eaca148f..8ad413b6ea 100644 --- a/dll/win32/url/url_main.c +++ b/dll/win32/url/url_main.c @@ -16,22 +16,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <winreg.h> -//#include "winerror.h" -#include <shellapi.h> -#include <shlwapi.h> -//#include "intshcut.h" -#include <winuser.h> -//#include "commctrl.h" -#include <prsht.h> -#include <wine/debug.h> +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winerror.h" +#include "shellapi.h" +#include "shlwapi.h" +#include "intshcut.h" +#include "winuser.h" +#include "commctrl.h" +#include "prsht.h" +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(url); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 9f96e3dcbb..b19935bbf1 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -187,7 +187,7 @@ reactos/dll/win32/tapi32 # Synced to WineStaging-3.3 reactos/dll/win32/traffic # Synced to WineStaging-3.3 reactos/dll/win32/twain_32 # Synced to WineStaging-3.3 reactos/dll/win32/updspapi # Synced to WineStaging-3.3 -reactos/dll/win32/url # Synced to WineStaging-2.9 +reactos/dll/win32/url # Synced to WineStaging-3.3 reactos/dll/win32/urlmon # Synced to Wine-3.0 reactos/dll/win32/usp10 # Synced to Wine-3.0 reactos/dll/win32/uxtheme # Forked
6 years, 7 months
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
44
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
Results per page:
10
25
50
100
200