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
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
February 2019
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
23 participants
208 discussions
Start a n
N
ew thread
[reactos] 01/01: [RICHED32_WINETEST] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e736079be39ab9453def1…
commit e736079be39ab9453def15861153033a059e5e1c Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 14:11:06 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 14:11:06 2019 +0100 [RICHED32_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- modules/rostests/winetests/riched32/editor.c | 107 +++++++++++++++------------ 1 file changed, 61 insertions(+), 46 deletions(-) diff --git a/modules/rostests/winetests/riched32/editor.c b/modules/rostests/winetests/riched32/editor.c index 6fe4005599..dd9773c3f6 100644 --- a/modules/rostests/winetests/riched32/editor.c +++ b/modules/rostests/winetests/riched32/editor.c @@ -104,7 +104,7 @@ static void test_WM_SETTEXT(void) * for line breaking (only \n adds a line break) */ - for (i = 0; i < sizeof(testitems)/sizeof(testitems[0]); i++) { + for (i = 0; i < ARRAY_SIZE(testitems); i++) { char buf[1024] = {0}; LRESULT result; @@ -410,7 +410,7 @@ static void test_EM_GETLINE(void) } memset(origdest, 0xBB, nBuf); - for (i = 0; i < sizeof(gl)/sizeof(struct getline_s); i++) + for (i = 0; i < ARRAY_SIZE(gl); i++) { int nCopied, expected_nCopied, expected_bytes_written; char gl_text[1024]; @@ -504,7 +504,7 @@ static void test_EM_LINELENGTH(void) } ok(result == 9, "Incorrect line count of %ld\n", result); - for (i = 0; i < sizeof(offset_test)/sizeof(offset_test[0]); i++) { + for (i = 0; i < ARRAY_SIZE(offset_test); i++) { result = SendMessageA(hwndRichEdit, EM_LINELENGTH, offset_test[i][0], 0); ok(result == offset_test[i][1], "Length of line at offset %d is %ld, expected %d\n", offset_test[i][0], result, offset_test[i][1]); @@ -525,7 +525,7 @@ static void test_EM_LINELENGTH(void) {16, 4}, /* Line 3: |wine */ }; SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text1); - for (i = 0; i < sizeof(offset_test1)/sizeof(offset_test1[0]); i++) { + for (i = 0; i < ARRAY_SIZE(offset_test1); i++) { result = SendMessageA(hwndRichEdit, EM_LINELENGTH, offset_test1[i][0], 0); todo_wine_if (offset_test1[i][2]) ok(result == offset_test1[i][1], "Length of line at offset %d is %ld, expected %d\n", @@ -781,20 +781,17 @@ static void test_EM_FINDTEXT(void) HWND hwndRichEdit = new_richedit(NULL); /* Empty rich edit control */ - run_tests_EM_FINDTEXT(hwndRichEdit, "1", find_tests, - sizeof(find_tests)/sizeof(struct find_s)); + run_tests_EM_FINDTEXT(hwndRichEdit, "1", find_tests, ARRAY_SIZE(find_tests)); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)haystack); /* Haystack text */ - run_tests_EM_FINDTEXT(hwndRichEdit, "2", find_tests2, - sizeof(find_tests2)/sizeof(struct find_s)); + run_tests_EM_FINDTEXT(hwndRichEdit, "2", find_tests2, ARRAY_SIZE(find_tests2)); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)haystack2); /* Haystack text 2 (with EOL characters) */ - run_tests_EM_FINDTEXT(hwndRichEdit, "3", find_tests3, - sizeof(find_tests3)/sizeof(struct find_s)); + run_tests_EM_FINDTEXT(hwndRichEdit, "3", find_tests3, ARRAY_SIZE(find_tests3)); DestroyWindow(hwndRichEdit); } @@ -1152,12 +1149,21 @@ static void simulate_typing_characters(HWND hwnd, const char* szChars) } } +static void format_test_result(char *target, const char *src) +{ + int i; + for (i = 0; i < strlen(src); i++) + sprintf(target + 2*i, "%02x", src[i] & 0xFF); + target[2*i] = 0; +} + /* * This test attempts to show the effect of enter on a richedit * control v1.0 inserts CRLF whereas for higher versions it only * inserts CR. If shows that EM_GETTEXTEX with GT_USECRLF == WM_GETTEXT * and also shows that GT_USECRLF has no effect in richedit 1.0, but * does for higher. The same test is cloned in riched32 and riched20. + * Also shows the difference between WM_CHAR/WM_KEYDOWN in v1.0 and higher versions */ static void test_enter(void) { @@ -1176,15 +1182,14 @@ static void test_enter(void) char expectedbuf[1024]; char resultbuf[1024]; HWND hwndRichEdit = new_richedit(NULL); - UINT i,j; - - for (i = 0; i < sizeof(testenteritems)/sizeof(testenteritems[0]); i++) { - - char buf[1024] = {0}; - LRESULT result; - GETTEXTEX getText; - const char *expected; + UINT i; + char buf[1024] = {0}; + GETTEXTEX getText = {sizeof(buf)}; + LRESULT result; + const char *expected; + for (i = 0; i < ARRAY_SIZE(testenteritems); i++) + { /* Set the text to the initial text */ result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)testenteritems[i].initialtext); ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result); @@ -1198,12 +1203,8 @@ static void test_enter(void) result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buf); expected = testenteritems[i].expectedtext; - resultbuf[0]=0x00; - for (j = 0; j < (UINT)result; j++) - sprintf(resultbuf+strlen(resultbuf), "%02x", buf[j] & 0xFF); - expectedbuf[0] = '\0'; - for (j = 0; j < strlen(expected); j++) - sprintf(expectedbuf+strlen(expectedbuf), "%02x", expected[j] & 0xFF); + format_test_result(resultbuf, buf); + format_test_result(expectedbuf, expected); result = strcmp(expected, buf); ok (result == 0, @@ -1211,21 +1212,14 @@ static void test_enter(void) i, resultbuf, expectedbuf); /* 2. Retrieve with EM_GETTEXTEX, GT_DEFAULT */ - getText.cb = sizeof(buf); getText.flags = GT_DEFAULT; - getText.codepage = CP_ACP; - getText.lpDefaultChar = NULL; - getText.lpUsedDefChar = NULL; + getText.codepage = CP_ACP; buf[0] = 0x00; result = SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf); expected = testenteritems[i].expectedtext; - resultbuf[0]=0x00; - for (j = 0; j < (UINT)result; j++) - sprintf(resultbuf+strlen(resultbuf), "%02x", buf[j] & 0xFF); - expectedbuf[0] = '\0'; - for (j = 0; j < strlen(expected); j++) - sprintf(expectedbuf+strlen(expectedbuf), "%02x", expected[j] & 0xFF); + format_test_result(resultbuf, buf); + format_test_result(expectedbuf, expected); result = strcmp(expected, buf); ok (result == 0 || broken(buf[0]==0x00 /* WinNT4 */), @@ -1233,21 +1227,14 @@ static void test_enter(void) i, resultbuf, expectedbuf); /* 3. Retrieve with EM_GETTEXTEX, GT_USECRLF */ - getText.cb = sizeof(buf); getText.flags = GT_USECRLF; - getText.codepage = CP_ACP; - getText.lpDefaultChar = NULL; - getText.lpUsedDefChar = NULL; + getText.codepage = CP_ACP; buf[0] = 0x00; result = SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf); expected = testenteritems[i].expectedtext; - resultbuf[0]=0x00; - for (j = 0; j < (UINT)result; j++) - sprintf(resultbuf+strlen(resultbuf), "%02x", buf[j] & 0xFF); - expectedbuf[0] = '\0'; - for (j = 0; j < strlen(expected); j++) - sprintf(expectedbuf+strlen(expectedbuf), "%02x", expected[j] & 0xFF); + format_test_result(resultbuf, buf); + format_test_result(expectedbuf, expected); result = strcmp(expected, buf); ok (result == 0 || broken(buf[0]==0x00 /* WinNT4 */), @@ -1255,6 +1242,34 @@ static void test_enter(void) i, resultbuf, expectedbuf); } + /* Show that WM_CHAR is handled differently from WM_KEYDOWN */ + getText.flags = GT_DEFAULT; + getText.codepage = CP_ACP; + + result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)""); + ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result); + SendMessageW(hwndRichEdit, WM_CHAR, 'T', 0); + SendMessageW(hwndRichEdit, WM_KEYDOWN, VK_RETURN, 0); + + result = SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf); + ok(result == 1, "Got %d\n", (int)result); + format_test_result(resultbuf, buf); + format_test_result(expectedbuf, "T"); + result = strcmp(resultbuf, expectedbuf); + ok (result == 0, "[%d] EM_GETTEXTEX, GT_DEFAULT unexpected '%s', expected '%s'\n", i, resultbuf, expectedbuf); + + result = SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)""); + ok (result == 1, "[%d] WM_SETTEXT returned %ld instead of 1\n", i, result); + SendMessageW(hwndRichEdit, WM_CHAR, 'T', 0); + SendMessageW(hwndRichEdit, WM_CHAR, '\r', 0); + + SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf); + ok(result == 1, "Got %d\n", (int)result); + format_test_result(resultbuf, buf); + format_test_result(expectedbuf, "T\r\n"); + result = strcmp(resultbuf, expectedbuf); + ok (result == 0, "[%d] EM_GETTEXTEX, GT_DEFAULT unexpected '%s', expected '%s'\n", i, resultbuf, expectedbuf); + DestroyWindow(hwndRichEdit); } @@ -1321,7 +1336,7 @@ static void test_EM_EXSETSEL(void) { HWND hwndRichEdit = new_richedit(NULL); int i; - const int num_tests = sizeof(exsetsel_tests)/sizeof(struct exsetsel_s); + const int num_tests = ARRAY_SIZE(exsetsel_tests); /* sending some text to the window */ SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"testing selection"); @@ -1378,7 +1393,7 @@ static void test_EM_SETSEL(void) char buffA[32] = {0}; HWND hwndRichEdit = new_richedit(NULL); int i; - const int num_tests = sizeof(exsetsel_tests)/sizeof(struct exsetsel_s); + const int num_tests = ARRAY_SIZE(exsetsel_tests); /* sending some text to the window */ SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"testing selection");
5 years, 10 months
1
0
0
0
[reactos] 01/01: [RICHED20] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dbfaf10dc0e53fe224361…
commit dbfaf10dc0e53fe224361e49b215a65bf27f0690 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 14:10:37 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 14:10:37 2019 +0100 [RICHED20] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/riched20/CMakeLists.txt | 23 +- dll/win32/riched20/caret.c | 2 +- dll/win32/riched20/editor.c | 402 +++++++++++++++++---------------- dll/win32/riched20/editor.h | 12 +- dll/win32/riched20/editstr.h | 3 + dll/win32/riched20/list.c | 6 - dll/win32/riched20/msvc-thiscall.c | 4 +- dll/win32/riched20/paint.c | 6 +- dll/win32/riched20/para.c | 159 +++++++++++-- dll/win32/riched20/reader.c | 15 +- dll/win32/riched20/richole.c | 441 ++++++++++++++++++++++++++----------- dll/win32/riched20/run.c | 16 +- dll/win32/riched20/style.c | 41 ++-- dll/win32/riched20/table.c | 4 +- dll/win32/riched20/txthost.c | 90 ++++---- dll/win32/riched20/txtsrv.c | 43 ++-- dll/win32/riched20/undo.c | 2 +- dll/win32/riched20/wrap.c | 279 +++++++++++++---------- dll/win32/riched20/writer.c | 2 +- media/doc/README.WINE | 2 +- 20 files changed, 968 insertions(+), 584 deletions(-) diff --git a/dll/win32/riched20/CMakeLists.txt b/dll/win32/riched20/CMakeLists.txt index a135a70b2a..36f96fe924 100644 --- a/dll/win32/riched20/CMakeLists.txt +++ b/dll/win32/riched20/CMakeLists.txt @@ -18,32 +18,27 @@ list(APPEND SOURCE string.c style.c table.c + txthost.c + txtsrv.c undo.c wrap.c writer.c precomp.h) -if(MSVC) - if(ARCH STREQUAL "i386") - list(APPEND SOURCE msvc-thiscall.c) - endif() - set_source_files_properties(txthost.c txtsrv.c PROPERTIES COMPILE_FLAGS "/FImsvc.h") - list(APPEND ADDITIONAL_SOURCE txthost.c txtsrv.c) -else() - list(APPEND SOURCE txthost.c txtsrv.c) +if(MSVC AND (ARCH STREQUAL "i386")) + list(APPEND SOURCE msvc-thiscall.c) endif() -list(APPEND ADDITIONAL_SOURCE - version.rc - ${CMAKE_CURRENT_BINARY_DIR}/riched20.def) - list(APPEND riched20_rc_deps ${CMAKE_CURRENT_SOURCE_DIR}/riched_tom.rgs ${CMAKE_CURRENT_BINARY_DIR}/riched_tom.tlb) - set_source_files_properties(version.rc PROPERTIES OBJECT_DEPENDS "${riched20_rc_deps}") -add_library(riched20 SHARED ${SOURCE} ${ADDITIONAL_SOURCE}) +add_library(riched20 SHARED + ${SOURCE} + version.rc + ${CMAKE_CURRENT_BINARY_DIR}/riched20.def) + add_typelib(riched_tom.idl) add_dependencies(riched20 stdole2) set_module_type(riched20 win32dll) diff --git a/dll/win32/riched20/caret.c b/dll/win32/riched20/caret.c index 4664f0ce09..ad72511da4 100644 --- a/dll/win32/riched20/caret.c +++ b/dll/win32/riched20/caret.c @@ -380,7 +380,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, c.nOffset -= nCharsToDelete; - ME_FindItemBack(c.pRun, diParagraph)->member.para.nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, ME_FindItemBack(c.pRun, diParagraph)); cursor = c; /* nChars is the number of characters that should be deleted from the diff --git a/dll/win32/riched20/editor.c b/dll/win32/riched20/editor.c index a883a963bd..c4ae49766e 100644 --- a/dll/win32/riched20/editor.c +++ b/dll/win32/riched20/editor.c @@ -522,8 +522,8 @@ void ME_RTFCharAttrHook(RTF_Info *info) RTFFont *f = RTFGetFont(info, info->rtfParam); if (f) { - MultiByteToWideChar(CP_ACP, 0, f->rtfFName, -1, fmt.szFaceName, sizeof(fmt.szFaceName)/sizeof(WCHAR)); - fmt.szFaceName[sizeof(fmt.szFaceName)/sizeof(WCHAR)-1] = '\0'; + MultiByteToWideChar(CP_ACP, 0, f->rtfFName, -1, fmt.szFaceName, ARRAY_SIZE(fmt.szFaceName)); + fmt.szFaceName[ARRAY_SIZE(fmt.szFaceName)-1] = '\0'; fmt.bCharSet = f->rtfFCharSet; fmt.dwMask = CFM_FACE | CFM_CHARSET; fmt.bPitchAndFamily = f->rtfFPitch | (f->rtfFFamily << 4); @@ -2431,6 +2431,181 @@ static void ME_UpdateSelectionLinkAttribute(ME_TextEditor *editor) ME_UpdateLinkAttribute(editor, &start, nChars); } +static BOOL handle_enter(ME_TextEditor *editor) +{ + BOOL ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000; + BOOL shift_is_down = GetKeyState(VK_SHIFT) & 0x8000; + + if (editor->bDialogMode) + { + if (ctrl_is_down) + return TRUE; + + if (!(editor->styleFlags & ES_WANTRETURN)) + { + if (editor->hwndParent) + { + DWORD dw; + dw = SendMessageW(editor->hwndParent, DM_GETDEFID, 0, 0); + if (HIWORD(dw) == DC_HASDEFID) + { + HWND hwDefCtrl = GetDlgItem(editor->hwndParent, LOWORD(dw)); + if (hwDefCtrl) + { + SendMessageW(editor->hwndParent, WM_NEXTDLGCTL, (WPARAM)hwDefCtrl, TRUE); + PostMessageW(hwDefCtrl, WM_KEYDOWN, VK_RETURN, 0); + } + } + } + return TRUE; + } + } + + if (editor->styleFlags & ES_MULTILINE) + { + static const WCHAR endl = '\r'; + static const WCHAR endlv10[] = {'\r','\n'}; + ME_Cursor cursor = editor->pCursors[0]; + ME_DisplayItem *para = cursor.pPara; + int from, to; + ME_Style *style, *eop_style; + + if (editor->styleFlags & ES_READONLY) + { + MessageBeep(MB_ICONERROR); + return TRUE; + } + + ME_GetSelectionOfs(editor, &from, &to); + if (editor->nTextLimit > ME_GetTextLength(editor) - (to-from)) + { + if (!editor->bEmulateVersion10) /* v4.1 */ + { + if (para->member.para.nFlags & MEPF_ROWEND) + { + /* Add a new table row after this row. */ + para = ME_AppendTableRow(editor, para); + para = para->member.para.next_para; + editor->pCursors[0].pPara = para; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + ME_CommitUndo(editor); + ME_CheckTablesForCorruption(editor); + ME_UpdateRepaint(editor, FALSE); + return TRUE; + } + else if (para == editor->pCursors[1].pPara && + cursor.nOffset + cursor.pRun->member.run.nCharOfs == 0 && + para->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART && + !para->member.para.prev_para->member.para.nCharOfs) + { + /* Insert a newline before the table. */ + para = para->member.para.prev_para; + para->member.para.nFlags &= ~MEPF_ROWSTART; + editor->pCursors[0].pPara = para; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[1] = editor->pCursors[0]; + ME_InsertTextFromCursor(editor, 0, &endl, 1, + editor->pCursors[0].pRun->member.run.style); + para = editor->pBuffer->pFirst->member.para.next_para; + ME_SetDefaultParaFormat(editor, ¶->member.para.fmt); + para->member.para.nFlags = 0; + mark_para_rewrap(editor, para); + editor->pCursors[0].pPara = para; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[1] = editor->pCursors[0]; + para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART; + ME_CommitCoalescingUndo(editor); + ME_CheckTablesForCorruption(editor); + ME_UpdateRepaint(editor, FALSE); + return TRUE; + } + } + else /* v1.0 - 3.0 */ + { + ME_DisplayItem *para = cursor.pPara; + if (ME_IsInTable(para)) + { + if (cursor.pRun->member.run.nFlags & MERF_ENDPARA) + { + if (from == to) + { + ME_ContinueCoalescingTransaction(editor); + para = ME_AppendTableRow(editor, para); + editor->pCursors[0].pPara = para; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + ME_CommitCoalescingUndo(editor); + ME_UpdateRepaint(editor, FALSE); + return TRUE; + } + } + else + { + ME_ContinueCoalescingTransaction(editor); + if (cursor.pRun->member.run.nCharOfs + cursor.nOffset == 0 && + !ME_IsInTable(para->member.para.prev_para)) + { + /* Insert newline before table */ + cursor.pRun = ME_FindItemBack(para, diRun); + if (cursor.pRun) + { + editor->pCursors[0].pRun = cursor.pRun; + editor->pCursors[0].pPara = para->member.para.prev_para; + } + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + ME_InsertTextFromCursor(editor, 0, &endl, 1, + editor->pCursors[0].pRun->member.run.style); + } + else + { + editor->pCursors[1] = editor->pCursors[0]; + para = ME_AppendTableRow(editor, para); + editor->pCursors[0].pPara = para; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + } + ME_CommitCoalescingUndo(editor); + ME_UpdateRepaint(editor, FALSE); + return TRUE; + } + } + } + + style = ME_GetInsertStyle(editor, 0); + + /* Normally the new eop style is the insert style, however in a list it is copied from the existing + eop style (this prevents the list label style changing when the new eop is inserted). + No extra ref is taken here on eop_style. */ + if (para->member.para.fmt.wNumbering) + eop_style = para->member.para.eop_run->style; + else + eop_style = style; + ME_ContinueCoalescingTransaction(editor); + if (shift_is_down) + ME_InsertEndRowFromCursor(editor, 0); + else + if (!editor->bEmulateVersion10) + ME_InsertTextFromCursor(editor, 0, &endl, 1, eop_style); + else + ME_InsertTextFromCursor(editor, 0, endlv10, 2, eop_style); + ME_CommitCoalescingUndo(editor); + SetCursor(NULL); + + ME_UpdateSelectionLinkAttribute(editor); + ME_UpdateRepaint(editor, FALSE); + ME_SaveTempStyle(editor, style); /* set the temp insert style for the new para */ + ME_ReleaseStyle(style); + } + return TRUE; + } + return FALSE; +} + static BOOL ME_KeyDown(ME_TextEditor *editor, WORD nKey) { @@ -2497,161 +2672,8 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey) ME_SendRequestResize(editor, FALSE); return TRUE; case VK_RETURN: - if (editor->bDialogMode) - { - if (ctrl_is_down) - return TRUE; - - if (!(editor->styleFlags & ES_WANTRETURN)) - { - if (editor->hwndParent) - { - DWORD dw; - dw = SendMessageW(editor->hwndParent, DM_GETDEFID, 0, 0); - if (HIWORD(dw) == DC_HASDEFID) - { - HWND hwDefCtrl = GetDlgItem(editor->hwndParent, LOWORD(dw)); - if (hwDefCtrl) - { - SendMessageW(editor->hwndParent, WM_NEXTDLGCTL, (WPARAM)hwDefCtrl, TRUE); - PostMessageW(hwDefCtrl, WM_KEYDOWN, VK_RETURN, 0); - } - } - } - return TRUE; - } - } - - if (editor->styleFlags & ES_MULTILINE) - { - ME_Cursor cursor = editor->pCursors[0]; - ME_DisplayItem *para = cursor.pPara; - int from, to; - const WCHAR endl = '\r'; - const WCHAR endlv10[] = {'\r','\n'}; - ME_Style *style, *eop_style; - - if (editor->styleFlags & ES_READONLY) { - MessageBeep(MB_ICONERROR); - return TRUE; - } - - ME_GetSelectionOfs(editor, &from, &to); - if (editor->nTextLimit > ME_GetTextLength(editor) - (to-from)) - { - if (!editor->bEmulateVersion10) { /* v4.1 */ - if (para->member.para.nFlags & MEPF_ROWEND) { - /* Add a new table row after this row. */ - para = ME_AppendTableRow(editor, para); - para = para->member.para.next_para; - editor->pCursors[0].pPara = para; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - ME_CommitUndo(editor); - ME_CheckTablesForCorruption(editor); - ME_UpdateRepaint(editor, FALSE); - return TRUE; - } - else if (para == editor->pCursors[1].pPara && - cursor.nOffset + cursor.pRun->member.run.nCharOfs == 0 && - para->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART && - !para->member.para.prev_para->member.para.nCharOfs) - { - /* Insert a newline before the table. */ - para = para->member.para.prev_para; - para->member.para.nFlags &= ~MEPF_ROWSTART; - editor->pCursors[0].pPara = para; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[1] = editor->pCursors[0]; - ME_InsertTextFromCursor(editor, 0, &endl, 1, - editor->pCursors[0].pRun->member.run.style); - para = editor->pBuffer->pFirst->member.para.next_para; - ME_SetDefaultParaFormat(editor, ¶->member.para.fmt); - para->member.para.nFlags = MEPF_REWRAP; - editor->pCursors[0].pPara = para; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[1] = editor->pCursors[0]; - para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART; - ME_CommitCoalescingUndo(editor); - ME_CheckTablesForCorruption(editor); - ME_UpdateRepaint(editor, FALSE); - return TRUE; - } - } else { /* v1.0 - 3.0 */ - ME_DisplayItem *para = cursor.pPara; - if (ME_IsInTable(para)) - { - if (cursor.pRun->member.run.nFlags & MERF_ENDPARA) - { - if (from == to) { - ME_ContinueCoalescingTransaction(editor); - para = ME_AppendTableRow(editor, para); - editor->pCursors[0].pPara = para; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - ME_CommitCoalescingUndo(editor); - ME_UpdateRepaint(editor, FALSE); - return TRUE; - } - } else { - ME_ContinueCoalescingTransaction(editor); - if (cursor.pRun->member.run.nCharOfs + cursor.nOffset == 0 && - !ME_IsInTable(para->member.para.prev_para)) - { - /* Insert newline before table */ - cursor.pRun = ME_FindItemBack(para, diRun); - if (cursor.pRun) { - editor->pCursors[0].pRun = cursor.pRun; - editor->pCursors[0].pPara = para->member.para.prev_para; - } - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - ME_InsertTextFromCursor(editor, 0, &endl, 1, - editor->pCursors[0].pRun->member.run.style); - } else { - editor->pCursors[1] = editor->pCursors[0]; - para = ME_AppendTableRow(editor, para); - editor->pCursors[0].pPara = para; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - } - ME_CommitCoalescingUndo(editor); - ME_UpdateRepaint(editor, FALSE); - return TRUE; - } - } - } - - style = ME_GetInsertStyle(editor, 0); - - /* Normally the new eop style is the insert style, however in a list it is copied from the existing - eop style (this prevents the list label style changing when the new eop is inserted). - No extra ref is taken here on eop_style. */ - if (para->member.para.fmt.wNumbering) - eop_style = para->member.para.eop_run->style; - else - eop_style = style; - ME_ContinueCoalescingTransaction(editor); - if (shift_is_down) - ME_InsertEndRowFromCursor(editor, 0); - else - if (!editor->bEmulateVersion10) - ME_InsertTextFromCursor(editor, 0, &endl, 1, eop_style); - else - ME_InsertTextFromCursor(editor, 0, endlv10, 2, eop_style); - ME_CommitCoalescingUndo(editor); - SetCursor(NULL); - - ME_UpdateSelectionLinkAttribute(editor); - ME_UpdateRepaint(editor, FALSE); - ME_SaveTempStyle(editor, style); /* set the temp insert style for the new para */ - ME_ReleaseStyle(style); - } - return TRUE; - } + if (!editor->bEmulateVersion10) + return handle_enter(editor); break; case VK_ESCAPE: if (editor->bDialogMode && editor->hwndParent) @@ -2724,6 +2746,12 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode, if (editor->bMouseCaptured) return 0; + if (editor->styleFlags & ES_READONLY) + { + MessageBeep(MB_ICONERROR); + return 0; /* FIXME really 0 ? */ + } + if (unicode) wstr = (WCHAR)charCode; else @@ -2732,10 +2760,8 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode, MultiByteToWideChar(CP_ACP, 0, &charA, 1, &wstr, 1); } - if (editor->styleFlags & ES_READONLY) { - MessageBeep(MB_ICONERROR); - return 0; /* FIXME really 0 ? */ - } + if (editor->bEmulateVersion10 && wstr == '\r') + handle_enter(editor); if ((unsigned)wstr >= ' ' || wstr == '\t') { @@ -3038,6 +3064,8 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) ed->bEmulateVersion10 = bEmulateVersion10; ed->styleFlags = 0; ed->exStyleFlags = 0; + ed->first_marked_para = NULL; + ed->total_rows = 0; ITextHost_TxGetPropertyBits(texthost, (TXTBIT_RICHTEXT|TXTBIT_MULTILINE| TXTBIT_READONLY|TXTBIT_USEPASSWORD| @@ -3051,6 +3079,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) ed->pBuffer = ME_MakeText(); ed->nZoomNumerator = ed->nZoomDenominator = 0; ed->nAvailWidth = 0; /* wrap to client area */ + list_init( &ed->style_list ); ME_MakeFirstParagraph(ed); /* The four cursors are for: * 0 - The position where the caret is shown @@ -3150,7 +3179,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) ed->wheel_remain = 0; - list_init( &ed->style_list ); list_init( &ed->reobj_list ); OleInitialize(NULL); @@ -3159,16 +3187,19 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) void ME_DestroyEditor(ME_TextEditor *editor) { - ME_DisplayItem *pFirst = editor->pBuffer->pFirst; - ME_DisplayItem *p = pFirst, *pNext = NULL; + ME_DisplayItem *p = editor->pBuffer->pFirst, *pNext = NULL; ME_Style *s, *cursor2; int i; ME_ClearTempStyle(editor); ME_EmptyUndoStack(editor); + editor->pBuffer->pFirst = NULL; while(p) { pNext = p->next; - ME_DestroyDisplayItem(p); + if (p->type == diParagraph) + destroy_para(editor, p); + else + ME_DestroyDisplayItem(p); p = pNext; } @@ -3905,17 +3936,17 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, return editor->nEventMask; case EM_SETCHARFORMAT: { - CHARFORMAT2W buf, *p; + CHARFORMAT2W p; BOOL bRepaint = TRUE; - p = ME_ToCF2W(&buf, (CHARFORMAT2W *)lParam); - if (p == NULL) return 0; + if (!cfany_to_cf2w(&p, (CHARFORMAT2W *)lParam)) + return 0; if (wParam & SCF_ALL) { if (editor->mode & TM_PLAINTEXT) { - ME_SetDefaultCharFormat(editor, p); + ME_SetDefaultCharFormat(editor, &p); } else { ME_Cursor start; ME_SetCursorToStart(editor, &start); - ME_SetCharFormat(editor, &start, NULL, p); + ME_SetCharFormat(editor, &start, NULL, &p); editor->nModifyStep = 1; } } else if (wParam & SCF_SELECTION) { @@ -3927,13 +3958,13 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, ME_MoveCursorWords(editor, &end, +1); start = end; ME_MoveCursorWords(editor, &start, -1); - ME_SetCharFormat(editor, &start, &end, p); + ME_SetCharFormat(editor, &start, &end, &p); } bRepaint = ME_IsSelection(editor); - ME_SetSelectionCharFormat(editor, p); + ME_SetSelectionCharFormat(editor, &p); if (bRepaint) editor->nModifyStep = 1; } else { /* SCF_DEFAULT */ - ME_SetDefaultCharFormat(editor, p); + ME_SetDefaultCharFormat(editor, &p); } ME_CommitUndo(editor); if (bRepaint) @@ -3957,7 +3988,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, ME_GetDefaultCharFormat(editor, &tmp); else ME_GetSelectionCharFormat(editor, &tmp); - ME_CopyToCFAny(dst, &tmp); + cf2w_to_cfany(dst, &tmp); return tmp.dwMask; } case EM_SETPARAFORMAT: @@ -4214,22 +4245,12 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, } case EM_GETLINECOUNT: { - ME_DisplayItem *item = editor->pBuffer->pFirst->next; - int nRows = 0; - + ME_DisplayItem *item = editor->pBuffer->pLast; + int nRows = editor->total_rows; ME_DisplayItem *prev_para = NULL, *last_para = NULL; - while (item != editor->pBuffer->pLast) - { - assert(item->type == diParagraph); - prev_para = ME_FindItemBack(item, diRun); - if (prev_para) { - assert(prev_para->member.run.nFlags & MERF_ENDPARA); - } - nRows += item->member.para.nRows; - item = item->member.para.next_para; - } last_para = ME_FindItemBack(item, diRun); + prev_para = ME_FindItemBack(last_para, diRun); assert(last_para); assert(last_para->member.run.nFlags & MERF_ENDPARA); if (editor->bEmulateVersion10 && prev_para && @@ -5276,10 +5297,9 @@ static BOOL isurlneutral( WCHAR c ) /* Some shortcuts */ if (isalnum( c )) return FALSE; - if (c > neutral_chars[sizeof(neutral_chars) / sizeof(neutral_chars[0]) - 1]) return FALSE; + if (c > neutral_chars[ARRAY_SIZE( neutral_chars ) - 1]) return FALSE; - return !!bsearch( &c, neutral_chars, sizeof(neutral_chars) / sizeof(neutral_chars[0]), - sizeof(c), wchar_comp ); + return !!bsearch( &c, neutral_chars, ARRAY_SIZE( neutral_chars ), sizeof(c), wchar_comp ); } /** @@ -5412,7 +5432,7 @@ static BOOL ME_IsCandidateAnURL(ME_TextEditor *editor, const ME_Cursor *start, i unsigned int i; ME_GetTextW(editor, bufferW, MAX_PREFIX_LEN, start, nChars, FALSE, FALSE); - for (i = 0; i < sizeof(prefixes) / sizeof(*prefixes); i++) + for (i = 0; i < ARRAY_SIZE(prefixes); i++) { if (nChars < prefixes[i].length) continue; if (!memcmp(prefixes[i].text, bufferW, prefixes[i].length * sizeof(WCHAR))) diff --git a/dll/win32/riched20/editor.h b/dll/win32/riched20/editor.h index def11c325a..b9dc4ec74f 100644 --- a/dll/win32/riched20/editor.h +++ b/dll/win32/riched20/editor.h @@ -63,8 +63,8 @@ void ME_SaveTempStyle(ME_TextEditor *editor, ME_Style *style) DECLSPEC_HIDDEN; void ME_ClearTempStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048]) DECLSPEC_HIDDEN; void ME_DumpStyle(ME_Style *s) DECLSPEC_HIDDEN; -CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from) DECLSPEC_HIDDEN; -void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) DECLSPEC_HIDDEN; +BOOL cfany_to_cf2w(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN; +BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN; void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) DECLSPEC_HIDDEN; /* only works with 2W structs */ void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) DECLSPEC_HIDDEN; /* ditto */ @@ -79,6 +79,7 @@ ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN; void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN; void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN; +void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) DECLSPEC_HIDDEN; /* string.c */ ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN; @@ -203,6 +204,11 @@ void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN; void para_num_init( ME_Context *c, ME_Paragraph *para ) DECLSPEC_HIDDEN; void para_num_clear( struct para_num *pn ) DECLSPEC_HIDDEN; +int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN; +void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN; +ME_DisplayItem *get_di_from_para(ME_Paragraph *para) DECLSPEC_HIDDEN; +void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN; +void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN; /* paint.c */ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLSPEC_HIDDEN; @@ -235,7 +241,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, BOOL selected) DECLSPE void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN; void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN; void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN; -void ME_GetITextDocumentInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN; +void ME_GetITextDocument2OldInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN; /* editor.c */ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN; diff --git a/dll/win32/riched20/editstr.h b/dll/win32/riched20/editstr.h index 206ce85287..96c9a1f644 100644 --- a/dll/win32/riched20/editstr.h +++ b/dll/win32/riched20/editstr.h @@ -219,6 +219,7 @@ typedef struct tagME_Paragraph struct para_num para_num; ME_Run *eop_run; /* ptr to the end-of-para run */ struct tagME_DisplayItem *prev_para, *next_para; + struct tagME_DisplayItem *prev_marked, *next_marked; } ME_Paragraph; typedef struct tagME_Cell /* v4.1 */ @@ -396,6 +397,7 @@ typedef struct tagME_TextEditor int nTotalWidth, nLastTotalWidth; int nAvailWidth; /* 0 = wrap to client area, else wrap width in twips */ int nUDArrowX; + int total_rows; COLORREF rgbBackColor; HBRUSH hbrBackground; BOOL bCaretAtEnd; @@ -432,6 +434,7 @@ typedef struct tagME_TextEditor int imeStartIndex; DWORD selofs; /* The size of the selection bar on the left side of control */ ME_SelectionType nSelectionType; + ME_DisplayItem *first_marked_para; /* Track previous notified selection */ CHARRANGE notified_cr; diff --git a/dll/win32/riched20/list.c b/dll/win32/riched20/list.c index ba35a90a98..23d1a38991 100644 --- a/dll/win32/riched20/list.c +++ b/dll/win32/riched20/list.c @@ -161,12 +161,6 @@ void ME_DestroyDisplayItem(ME_DisplayItem *item) { if (0) TRACE("type=%s\n", ME_GetDITypeName(item->type)); - if (item->type==diParagraph) - { - ME_DestroyString(item->member.para.text); - para_num_clear( &item->member.para.para_num ); - } - if (item->type==diRun) { if (item->member.run.reobj) diff --git a/dll/win32/riched20/msvc-thiscall.c b/dll/win32/riched20/msvc-thiscall.c index ca96c94b54..21669a604b 100644 --- a/dll/win32/riched20/msvc-thiscall.c +++ b/dll/win32/riched20/msvc-thiscall.c @@ -3,7 +3,7 @@ #define DEFINE_THISCALL_WRAPPER(func,args) \ typedef struct {int x[args/4];} _tag_##func; \ void __stdcall func(_tag_##func p1); \ - __declspec(naked) void __stdcall __thiscall_##func(_tag_##func p1) \ + __declspec(naked) void __thiscall_##func(_tag_##func p1) \ { \ __asm pop eax \ __asm push ecx \ @@ -52,7 +52,7 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmReleaseContext,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8) #define DEFINE_STDCALL_WRAPPER(num,func,args) \ - __declspec(naked) void __stdcall __stdcall_##func(_tag_##func p1) \ + __declspec(naked) void __stdcall_##func(_tag_##func p1) \ { \ __asm pop eax \ __asm pop ecx \ diff --git a/dll/win32/riched20/paint.c b/dll/win32/riched20/paint.c index fcc4e105a3..e2ccef4fbf 100644 --- a/dll/win32/riched20/paint.c +++ b/dll/win32/riched20/paint.c @@ -536,7 +536,7 @@ int ME_GetParaBorderWidth(const ME_Context* c, int flags) int idx = (flags >> 8) & 0xF; int width; - if (idx >= sizeof(border_details) / sizeof(border_details[0])) + if (idx >= ARRAY_SIZE(border_details)) { FIXME("Unsupported border value %d\n", idx); return 0; @@ -989,7 +989,7 @@ static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) } if (me_debug) { - const WCHAR wszRowDebug[] = {'r','o','w','[','%','d',']',0}; + static const WCHAR wszRowDebug[] = {'r','o','w','[','%','d',']',0}; WCHAR buf[128]; POINT pt = c->pt; wsprintfW(buf, wszRowDebug, no); @@ -1017,7 +1017,7 @@ static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) c->pt.y + para->pt.y + run->pt.y + baseline, p, para); if (me_debug) { - const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0}; + static const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0}; WCHAR buf[2560]; POINT pt; pt.x = c->pt.x + run->pt.x; diff --git a/dll/win32/riched20/para.c b/dll/win32/riched20/para.c index f2a70e5746..6eec6b5906 100644 --- a/dll/win32/riched20/para.c +++ b/dll/win32/riched20/para.c @@ -23,19 +23,137 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit); +void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para) +{ + para->member.para.nFlags |= MEPF_REWRAP; + add_marked_para(editor, para); +} + +ME_DisplayItem *get_di_from_para(ME_Paragraph *para) +{ + return (ME_DisplayItem *)((ptrdiff_t)para - offsetof(ME_DisplayItem, member)); +} + static ME_DisplayItem *make_para(ME_TextEditor *editor) { ME_DisplayItem *item = ME_MakeDI(diParagraph); ME_SetDefaultParaFormat(editor, &item->member.para.fmt); item->member.para.nFlags = MEPF_REWRAP; + item->member.para.next_marked = item->member.para.prev_marked = NULL; + return item; } +void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) +{ + assert(item->type == diParagraph); + + if (item->member.para.nWidth == editor->nTotalWidth) + { + item->member.para.nWidth = 0; + editor->nTotalWidth = get_total_width(editor); + } + editor->total_rows -= item->member.para.nRows; + ME_DestroyString(item->member.para.text); + para_num_clear( &item->member.para.para_num ); + remove_marked_para(editor, item); + ME_DestroyDisplayItem(item); +} + +int get_total_width(ME_TextEditor *editor) +{ + ME_Paragraph *para; + int total_width = 0; + + if (editor->pBuffer->pFirst && editor->pBuffer->pLast) + { + para = &editor->pBuffer->pFirst->next->member.para; + while (para != &editor->pBuffer->pLast->member.para && para->next_para) + { + total_width = max(total_width, para->nWidth); + para = ¶->next_para->member.para; + } + } + + return total_width; +} + +void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *di) +{ + ME_DisplayItem *head = editor->first_marked_para; + + assert(di->type == diParagraph); + if (!di->member.para.next_marked && !di->member.para.prev_marked) + { + if (di == head) + editor->first_marked_para = NULL; + } + else if (di->member.para.next_marked && di->member.para.prev_marked) + { + di->member.para.prev_marked->member.para.next_marked = di->member.para.next_marked; + di->member.para.next_marked->member.para.prev_marked = di->member.para.prev_marked; + di->member.para.prev_marked = di->member.para.next_marked = NULL; + } + else if (di->member.para.next_marked) + { + assert(di == editor->first_marked_para); + editor->first_marked_para = di->member.para.next_marked; + di->member.para.next_marked->member.para.prev_marked = NULL; + di->member.para.next_marked = NULL; + } + else + { + di->member.para.prev_marked->member.para.next_marked = NULL; + di->member.para.prev_marked = NULL; + } +} + +void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *di) +{ + ME_DisplayItem *iter = editor->first_marked_para; + + if (!iter) + { + editor->first_marked_para = di; + return; + } + while (iter) + { + if (iter == di) + return; + else if (di->member.para.nCharOfs < iter->member.para.nCharOfs) + { + if (iter == editor->first_marked_para) + editor->first_marked_para = di; + di->member.para.next_marked = iter; + iter->member.para.prev_marked = di; + break; + } + else if (di->member.para.nCharOfs >= iter->member.para.nCharOfs) + { + if (!iter->member.para.next_marked || di->member.para.nCharOfs < iter->member.para.next_marked->member.para.nCharOfs) + { + if (iter->member.para.next_marked) + { + di->member.para.next_marked = iter->member.para.next_marked; + iter->member.para.next_marked->member.para.prev_marked = di; + } + di->member.para.prev_marked = iter; + iter->member.para.next_marked = di; + break; + } + } + iter = iter->member.para.next_marked; + } +} + void ME_MakeFirstParagraph(ME_TextEditor *editor) { + static const WCHAR cr_lf[] = {'\r','\n',0}; ME_Context c; CHARFORMAT2W cf; + const CHARFORMATW *host_cf; LOGFONTW lf; HFONT hf; ME_TextBuffer *text = editor->pBuffer; @@ -43,7 +161,6 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor) ME_DisplayItem *run; ME_Style *style; int eol_len; - WCHAR cr_lf[] = {'\r','\n',0}; ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost)); @@ -76,6 +193,14 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor) style = ME_MakeStyle(&cf); text->pDefaultStyle = style; + if (ITextHost_TxGetCharFormat(editor->texthost, &host_cf) == S_OK) + { + ZeroMemory(&cf, sizeof(cf)); + cf.cbSize = sizeof(cf); + cfany_to_cf2w(&cf, (CHARFORMAT2W *)host_cf); + ME_SetDefaultCharFormat(editor, &cf); + } + eol_len = editor->bEmulateVersion10 ? 2 : 1; para->member.para.text = ME_MakeStringN( cr_lf, eol_len ); @@ -95,6 +220,7 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor) text->pLast->member.para.nCharOfs = editor->bEmulateVersion10 ? 2 : 1; + add_marked_para(editor, para); ME_DestroyContext(&c); } @@ -102,7 +228,7 @@ static void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, con { while(first != last) { - first->member.para.nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, first); first = first->member.para.next_para; } } @@ -197,7 +323,7 @@ static ME_String *para_num_get_str( ME_Paragraph *para, WORD num ) /* This is not base-26 (or 27) as zeros don't count unless they are leading zeros. It's simplest to start with the least significant letter, so first calculate how many letters are needed. */ - for (i = 0, total = 0; i < sizeof(letter_base) / sizeof(letter_base[0]); i++) + for (i = 0, total = 0; i < ARRAY_SIZE( letter_base ); i++) { total += letter_base[i]; if (num < total) break; @@ -219,7 +345,7 @@ static ME_String *para_num_get_str( ME_Paragraph *para, WORD num ) case PFN_UCROMAN: if (!num) num = 1; - for (i = 0; i < sizeof(roman_base) / sizeof(roman_base[0]); i++) + for (i = 0; i < ARRAY_SIZE( roman_base ); i++) { if (i > 0) { @@ -325,11 +451,11 @@ void para_num_clear( struct para_num *pn ) pn->text = NULL; } -static void para_num_clear_list( ME_Paragraph *para, const PARAFORMAT2 *orig_fmt ) +static void para_num_clear_list( ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *orig_fmt ) { do { - para->nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, get_di_from_para(para)); para_num_clear( ¶->para_num ); if (para->next_para->type != diParagraph) break; para = ¶->next_para->member.para; @@ -404,12 +530,12 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA if (memcmp(©, ¶->fmt, sizeof(PARAFORMAT2))) { - para->nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, get_di_from_para(para)); if (((dwMask & PFM_NUMBERING) && (copy.wNumbering != para->fmt.wNumbering)) || ((dwMask & PFM_NUMBERINGSTART) && (copy.wNumberingStart != para->fmt.wNumberingStart)) || ((dwMask & PFM_NUMBERINGSTYLE) && (copy.wNumberingStyle != para->fmt.wNumberingStyle))) { - para_num_clear_list( para, © ); + para_num_clear_list( editor, para, © ); } } @@ -446,7 +572,7 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, /* Clear any cached para numbering following this paragraph */ if (run_para->member.para.fmt.wNumbering) - para_num_clear_list( &run_para->member.para, &run_para->member.para.fmt ); + para_num_clear_list( editor, &run_para->member.para, &run_para->member.para.fmt ); new_para->member.para.text = ME_VSplitString( run_para->member.para.text, run->member.run.nCharOfs ); @@ -478,7 +604,8 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, } new_para->member.para.nCharOfs = run_para->member.para.nCharOfs + ofs; new_para->member.para.nCharOfs += eol_len; - new_para->member.para.nFlags = MEPF_REWRAP; + new_para->member.para.nFlags = 0; + mark_para_rewrap(editor, new_para); /* FIXME initialize format style and call ME_SetParaFormat blah blah */ new_para->member.para.fmt = run_para->member.para.fmt; @@ -544,8 +671,10 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, } /* force rewrap of the */ - run_para->member.para.prev_para->member.para.nFlags |= MEPF_REWRAP; - new_para->member.para.prev_para->member.para.nFlags |= MEPF_REWRAP; + if (run_para->member.para.prev_para->type == diParagraph) + mark_para_rewrap(editor, run_para->member.para.prev_para); + + mark_para_rewrap(editor, new_para->member.para.prev_para); /* we've added the end run, so we need to modify nCharOfs in the next paragraphs */ ME_PropagateCharOffset(next_para, eol_len); @@ -572,7 +701,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp, /* Clear any cached para numbering following this paragraph */ if (tp->member.para.fmt.wNumbering) - para_num_clear_list( &tp->member.para, &tp->member.para.fmt ); + para_num_clear_list( editor, &tp->member.para, &tp->member.para.fmt ); pNext = tp->member.para.next_para; @@ -673,14 +802,14 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp, tp->member.para.next_para = pNext->member.para.next_para; pNext->member.para.next_para->member.para.prev_para = tp; ME_Remove(pNext); - ME_DestroyDisplayItem(pNext); + destroy_para(editor, pNext); ME_PropagateCharOffset(tp->member.para.next_para, -end_len); ME_CheckCharOffsets(editor); editor->nParagraphs--; - tp->member.para.nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, tp); return tp; } diff --git a/dll/win32/riched20/reader.c b/dll/win32/riched20/reader.c index 03101090b3..dc551bf584 100644 --- a/dll/win32/riched20/reader.c +++ b/dll/win32/riched20/reader.c @@ -109,7 +109,7 @@ int _RTFGetChar(RTF_Info *info) } ch = (unsigned char)stream->buffer[stream->dwUsed++]; if (!ch) - return EOF; + return ' '; return ch; } @@ -2175,14 +2175,13 @@ static RTFKey rtfKey[] = { 0, -1, NULL, 0 } }; -#define RTF_KEY_COUNT (sizeof(rtfKey) / sizeof(RTFKey)) typedef struct tagRTFHashTableEntry { int count; RTFKey **value; } RTFHashTableEntry; -static RTFHashTableEntry rtfHashTable[RTF_KEY_COUNT * 2]; +static RTFHashTableEntry rtfHashTable[ARRAY_SIZE(rtfKey) * 2]; /* @@ -2199,7 +2198,7 @@ void LookupInit(void) int index; rp->rtfKHash = Hash (rp->rtfKStr); - index = rp->rtfKHash % (RTF_KEY_COUNT * 2); + index = rp->rtfKHash % (ARRAY_SIZE(rtfKey) * 2); if (!rtfHashTable[index].count) rtfHashTable[index].value = heap_alloc(sizeof(RTFKey *)); else @@ -2212,7 +2211,7 @@ void LookupCleanup(void) { unsigned int i; - for (i=0; i<RTF_KEY_COUNT*2; i++) + for (i = 0; i < ARRAY_SIZE(rtfKey) * 2; i++) { heap_free( rtfHashTable[i].value ); rtfHashTable[i].value = NULL; @@ -2235,7 +2234,7 @@ static void Lookup(RTF_Info *info, char *s) ++s; /* skip over the leading \ character */ hash = Hash (s); - entry = &rtfHashTable[hash % (RTF_KEY_COUNT * 2)]; + entry = &rtfHashTable[hash % (ARRAY_SIZE(rtfKey) * 2)]; for (i = 0; i < entry->count; i++) { rp = entry->value[i]; @@ -2597,13 +2596,13 @@ RTFPutUnicodeString(RTF_Info *info, const WCHAR *string, int length) RTFFlushCPOutputBuffer(info); while (length) { - int fit = min(length, sizeof(info->OutputBuffer) / sizeof(WCHAR) - info->dwOutputCount); + int fit = min(length, ARRAY_SIZE(info->OutputBuffer) - info->dwOutputCount); memmove(info->OutputBuffer + info->dwOutputCount, string, fit * sizeof(WCHAR)); info->dwOutputCount += fit; length -= fit; string += fit; - if (sizeof(info->OutputBuffer) / sizeof(WCHAR) == info->dwOutputCount) + if (ARRAY_SIZE(info->OutputBuffer) == info->dwOutputCount) RTFFlushUnicodeOutputBuffer(info); } } diff --git a/dll/win32/riched20/richole.c b/dll/win32/riched20/richole.c index 91a656b3f3..88ce7b6bfb 100644 --- a/dll/win32/riched20/richole.c +++ b/dll/win32/riched20/richole.c @@ -46,6 +46,7 @@ DEFINE_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xa DEFINE_GUID(IID_ITextHost, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1); DEFINE_GUID(IID_ITextHost2, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1); DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d); +DEFINE_GUID(IID_ITextDocument2Old, 0x01c25500, 0x4268, 0x11d1, 0x88, 0x3a, 0x3c, 0x8b, 0x00, 0xc1, 0x00, 0x00); DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d); DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d); DEFINE_GUID(IID_ITextFont, 0x8cc497c3, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d); @@ -97,7 +98,7 @@ void release_typelib(void) if (!typelib) return; - for (i = 0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++) + for (i = 0; i < ARRAY_SIZE(typeinfos); i++) if (typeinfos[i]) ITypeInfo_Release(typeinfos[i]); @@ -208,7 +209,7 @@ enum range_update_op { typedef struct IRichEditOleImpl { IUnknown IUnknown_inner; IRichEditOle IRichEditOle_iface; - ITextDocument ITextDocument_iface; + ITextDocument2Old ITextDocument2Old_iface; IUnknown *outer_unk; LONG ref; @@ -267,9 +268,9 @@ static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface) return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface); } -static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface) +static inline IRichEditOleImpl *impl_from_ITextDocument2Old(ITextDocument2Old *iface) { - return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument_iface); + return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument2Old_iface); } static inline IRichEditOleImpl *impl_from_IUnknown(IUnknown *iface) @@ -633,7 +634,7 @@ static void textrange_set_font(ITextRange *range, ITextFont *font) if (ITextFont_GetName(font, &str) == S_OK) { fmt.dwMask |= CFM_FACE; - lstrcpynW(fmt.szFaceName, str, sizeof(fmt.szFaceName)/sizeof(WCHAR)); + lstrcpynW(fmt.szFaceName, str, ARRAY_SIZE(fmt.szFaceName)); SysFreeString(str); } @@ -817,7 +818,7 @@ static HRESULT set_textfont_prop(ITextFontImpl *font, enum textfont_prop_id prop fmt.wWeight = value->l; break; case FONT_NAME: - lstrcpynW(fmt.szFaceName, value->str, sizeof(fmt.szFaceName)/sizeof(WCHAR)); + lstrcpynW(fmt.szFaceName, value->str, ARRAY_SIZE(fmt.szFaceName)); break; default: FIXME("unhandled font property %d\n", propid); @@ -943,8 +944,8 @@ static HRESULT WINAPI IRichEditOleImpl_inner_fnQueryInterface(IUnknown *iface, R *ppvObj = &This->IUnknown_inner; else if (IsEqualGUID(riid, &IID_IRichEditOle)) *ppvObj = &This->IRichEditOle_iface; - else if (IsEqualGUID(riid, &IID_ITextDocument)) - *ppvObj = &This->ITextDocument_iface; + else if (IsEqualGUID(riid, &IID_ITextDocument) || IsEqualGUID(riid, &IID_ITextDocument2Old)) + *ppvObj = &This->ITextDocument2Old_iface; if (*ppvObj) { IUnknown_AddRef((IUnknown *)*ppvObj); @@ -4114,43 +4115,38 @@ static HRESULT create_textpara(ITextRange *range, ITextPara **ret) } /* ITextDocument */ -static HRESULT WINAPI -ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid, - void** ppvObject) +static HRESULT WINAPI ITextDocument2Old_fnQueryInterface(ITextDocument2Old* iface, REFIID riid, + void **ppvObject) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); return IRichEditOle_QueryInterface(&This->IRichEditOle_iface, riid, ppvObject); } -static ULONG WINAPI -ITextDocument_fnAddRef(ITextDocument* me) +static ULONG WINAPI ITextDocument2Old_fnAddRef(ITextDocument2Old *iface) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); return IRichEditOle_AddRef(&This->IRichEditOle_iface); } -static ULONG WINAPI -ITextDocument_fnRelease(ITextDocument* me) +static ULONG WINAPI ITextDocument2Old_fnRelease(ITextDocument2Old *iface) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); return IRichEditOle_Release(&This->IRichEditOle_iface); } -static HRESULT WINAPI -ITextDocument_fnGetTypeInfoCount(ITextDocument* me, - UINT* pctinfo) +static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfoCount(ITextDocument2Old *iface, + UINT *pctinfo) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); TRACE("(%p)->(%p)\n", This, pctinfo); *pctinfo = 1; return S_OK; } -static HRESULT WINAPI -ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid, - ITypeInfo** ppTInfo) +static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfo(ITextDocument2Old *iface, UINT iTInfo, LCID lcid, + ITypeInfo **ppTInfo) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); HRESULT hr; TRACE("(%p)->(%u,%d,%p)\n", This, iTInfo, lcid, ppTInfo); @@ -4161,11 +4157,11 @@ ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid, return hr; } -static HRESULT WINAPI -ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid, - LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) +static HRESULT WINAPI ITextDocument2Old_fnGetIDsOfNames(ITextDocument2Old *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); ITypeInfo *ti; HRESULT hr; @@ -4178,12 +4174,12 @@ ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid, return hr; } -static HRESULT WINAPI -ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember, - REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, - VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) +static HRESULT WINAPI ITextDocument2Old_fnInvoke(ITextDocument2Old *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); ITypeInfo *ti; HRESULT hr; @@ -4193,24 +4189,22 @@ ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember, hr = get_typeinfo(ITextDocument_tid, &ti); if (SUCCEEDED(hr)) - hr = ITypeInfo_Invoke(ti, me, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + hr = ITypeInfo_Invoke(ti, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); return hr; } -static HRESULT WINAPI -ITextDocument_fnGetName(ITextDocument* me, BSTR* pName) +static HRESULT WINAPI ITextDocument2Old_fnGetName(ITextDocument2Old *iface, BSTR *pName) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnGetSelection(ITextDocument *me, ITextSelection **selection) +static HRESULT WINAPI ITextDocument2Old_fnGetSelection(ITextDocument2Old *iface, ITextSelection **selection) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); - TRACE("(%p)->(%p)\n", me, selection); + TRACE("(%p)->(%p)\n", iface, selection); if (!selection) return E_INVALIDARG; @@ -4228,125 +4222,110 @@ ITextDocument_fnGetSelection(ITextDocument *me, ITextSelection **selection) return S_OK; } -static HRESULT WINAPI -ITextDocument_fnGetStoryCount(ITextDocument* me, LONG* pCount) +static HRESULT WINAPI ITextDocument2Old_fnGetStoryCount(ITextDocument2Old *iface, LONG *pCount) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnGetStoryRanges(ITextDocument* me, - ITextStoryRanges** ppStories) +static HRESULT WINAPI ITextDocument2Old_fnGetStoryRanges(ITextDocument2Old *iface, + ITextStoryRanges **ppStories) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnGetSaved(ITextDocument* me, LONG* pValue) +static HRESULT WINAPI ITextDocument2Old_fnGetSaved(ITextDocument2Old *iface, LONG *pValue) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnSetSaved(ITextDocument* me, LONG Value) +static HRESULT WINAPI ITextDocument2Old_fnSetSaved(ITextDocument2Old *iface, LONG Value) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue) +static HRESULT WINAPI ITextDocument2Old_fnGetDefaultTabStop(ITextDocument2Old *iface, float *pValue) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value) +static HRESULT WINAPI ITextDocument2Old_fnSetDefaultTabStop(ITextDocument2Old *iface, float Value) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnNew(ITextDocument* me) +static HRESULT WINAPI ITextDocument2Old_fnNew(ITextDocument2Old *iface) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, LONG Flags, - LONG CodePage) +static HRESULT WINAPI ITextDocument2Old_fnOpen(ITextDocument2Old *iface, VARIANT *pVar, + LONG Flags, LONG CodePage) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, LONG Flags, - LONG CodePage) +static HRESULT WINAPI ITextDocument2Old_fnSave(ITextDocument2Old *iface, VARIANT *pVar, + LONG Flags, LONG CodePage) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnFreeze(ITextDocument* me, LONG* pCount) +static HRESULT WINAPI ITextDocument2Old_fnFreeze(ITextDocument2Old *iface, LONG *pCount) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnUnfreeze(ITextDocument* me, LONG* pCount) +static HRESULT WINAPI ITextDocument2Old_fnUnfreeze(ITextDocument2Old *iface, LONG *pCount) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnBeginEditCollection(ITextDocument* me) +static HRESULT WINAPI ITextDocument2Old_fnBeginEditCollection(ITextDocument2Old *iface) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnEndEditCollection(ITextDocument* me) +static HRESULT WINAPI ITextDocument2Old_fnEndEditCollection(ITextDocument2Old *iface) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnUndo(ITextDocument* me, LONG Count, LONG* prop) +static HRESULT WINAPI ITextDocument2Old_fnUndo(ITextDocument2Old *iface, LONG Count, LONG *prop) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static HRESULT WINAPI -ITextDocument_fnRedo(ITextDocument* me, LONG Count, LONG* prop) +static HRESULT WINAPI ITextDocument2Old_fnRedo(ITextDocument2Old *iface, LONG Count, LONG *prop) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } @@ -4367,11 +4346,10 @@ static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end, I return S_OK; } -static HRESULT WINAPI -ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2, - ITextRange** ppRange) +static HRESULT WINAPI ITextDocument2Old_fnRange(ITextDocument2Old *iface, LONG cp1, LONG cp2, + ITextRange **ppRange) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); TRACE("%p %p %d %d\n", This, ppRange, cp1, cp2); if (!ppRange) @@ -4381,42 +4359,247 @@ ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2, return CreateITextRange(This, cp1, cp2, ppRange); } -static HRESULT WINAPI -ITextDocument_fnRangeFromPoint(ITextDocument* me, LONG x, LONG y, - ITextRange** ppRange) +static HRESULT WINAPI ITextDocument2Old_fnRangeFromPoint(ITextDocument2Old *iface, LONG x, LONG y, + ITextRange **ppRange) { - IRichEditOleImpl *This = impl_from_ITextDocument(me); + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); FIXME("stub %p\n",This); return E_NOTIMPL; } -static const ITextDocumentVtbl tdvt = { - ITextDocument_fnQueryInterface, - ITextDocument_fnAddRef, - ITextDocument_fnRelease, - ITextDocument_fnGetTypeInfoCount, - ITextDocument_fnGetTypeInfo, - ITextDocument_fnGetIDsOfNames, - ITextDocument_fnInvoke, - ITextDocument_fnGetName, - ITextDocument_fnGetSelection, - ITextDocument_fnGetStoryCount, - ITextDocument_fnGetStoryRanges, - ITextDocument_fnGetSaved, - ITextDocument_fnSetSaved, - ITextDocument_fnGetDefaultTabStop, - ITextDocument_fnSetDefaultTabStop, - ITextDocument_fnNew, - ITextDocument_fnOpen, - ITextDocument_fnSave, - ITextDocument_fnFreeze, - ITextDocument_fnUnfreeze, - ITextDocument_fnBeginEditCollection, - ITextDocument_fnEndEditCollection, - ITextDocument_fnUndo, - ITextDocument_fnRedo, - ITextDocument_fnRange, - ITextDocument_fnRangeFromPoint +/* ITextDocument2Old methods */ +static HRESULT WINAPI ITextDocument2Old_fnAttachMsgFilter(ITextDocument2Old *iface, IUnknown *filter) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%p): stub\n", This, filter); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnSetEffectColor(ITextDocument2Old *iface, LONG index, COLORREF cr) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%d, 0x%x): stub\n", This, index, cr); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetEffectColor(ITextDocument2Old *iface, LONG index, COLORREF *cr) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%d, %p): stub\n", This, index, cr); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetCaretType(ITextDocument2Old *iface, LONG *type) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%p): stub\n", This, type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnSetCaretType(ITextDocument2Old *iface, LONG type) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%d): stub\n", This, type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetImmContext(ITextDocument2Old *iface, LONG *context) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%p): stub\n", This, context); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnReleaseImmContext(ITextDocument2Old *iface, LONG context) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%d): stub\n", This, context); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetPreferredFont(ITextDocument2Old *iface, LONG cp, LONG charrep, + LONG options, LONG current_charrep, LONG current_fontsize, + BSTR *bstr, LONG *pitch_family, LONG *new_fontsize) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%d, %d, %d, %d, %d, %p, %p, %p): stub\n", This, cp, charrep, options, current_charrep, + current_fontsize, bstr, pitch_family, new_fontsize); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetNotificationMode(ITextDocument2Old *iface, LONG *mode) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%p): stub\n", This, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnSetNotificationMode(ITextDocument2Old *iface, LONG mode) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(0x%x): stub\n", This, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetClientRect(ITextDocument2Old *iface, LONG type, LONG *left, LONG *top, + LONG *right, LONG *bottom) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%d, %p, %p, %p, %p): stub\n", This, type, left, top, right, bottom); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetSelectionEx(ITextDocument2Old *iface, ITextSelection **selection) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%p): stub\n", This, selection); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetWindow(ITextDocument2Old *iface, LONG *hwnd) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%p): stub\n", This, hwnd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnGetFEFlags(ITextDocument2Old *iface, LONG *flags) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%p): stub\n", This, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnUpdateWindow(ITextDocument2Old *iface) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p): stub\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnCheckTextLimit(ITextDocument2Old *iface, LONG cch, LONG *exceed) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%d, %p): stub\n", This, cch, exceed); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnIMEInProgress(ITextDocument2Old *iface, LONG mode) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(0x%x): stub\n", This, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnSysBeep(ITextDocument2Old *iface) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p): stub\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnUpdate(ITextDocument2Old *iface, LONG mode) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(0x%x): stub\n", This, mode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ITextDocument2Old_fnNotify(ITextDocument2Old *iface, LONG notify) +{ + IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface); + + FIXME("(%p)->(%d): stub\n", This, notify); + + return E_NOTIMPL; +} + +static const ITextDocument2OldVtbl tdvt = { + ITextDocument2Old_fnQueryInterface, + ITextDocument2Old_fnAddRef, + ITextDocument2Old_fnRelease, + ITextDocument2Old_fnGetTypeInfoCount, + ITextDocument2Old_fnGetTypeInfo, + ITextDocument2Old_fnGetIDsOfNames, + ITextDocument2Old_fnInvoke, + ITextDocument2Old_fnGetName, + ITextDocument2Old_fnGetSelection, + ITextDocument2Old_fnGetStoryCount, + ITextDocument2Old_fnGetStoryRanges, + ITextDocument2Old_fnGetSaved, + ITextDocument2Old_fnSetSaved, + ITextDocument2Old_fnGetDefaultTabStop, + ITextDocument2Old_fnSetDefaultTabStop, + ITextDocument2Old_fnNew, + ITextDocument2Old_fnOpen, + ITextDocument2Old_fnSave, + ITextDocument2Old_fnFreeze, + ITextDocument2Old_fnUnfreeze, + ITextDocument2Old_fnBeginEditCollection, + ITextDocument2Old_fnEndEditCollection, + ITextDocument2Old_fnUndo, + ITextDocument2Old_fnRedo, + ITextDocument2Old_fnRange, + ITextDocument2Old_fnRangeFromPoint, + /* ITextDocument2Old methods */ + ITextDocument2Old_fnAttachMsgFilter, + ITextDocument2Old_fnSetEffectColor, + ITextDocument2Old_fnGetEffectColor, + ITextDocument2Old_fnGetCaretType, + ITextDocument2Old_fnSetCaretType, + ITextDocument2Old_fnGetImmContext, + ITextDocument2Old_fnReleaseImmContext, + ITextDocument2Old_fnGetPreferredFont, + ITextDocument2Old_fnGetNotificationMode, + ITextDocument2Old_fnSetNotificationMode, + ITextDocument2Old_fnGetClientRect, + ITextDocument2Old_fnGetSelectionEx, + ITextDocument2Old_fnGetWindow, + ITextDocument2Old_fnGetFEFlags, + ITextDocument2Old_fnUpdateWindow, + ITextDocument2Old_fnCheckTextLimit, + ITextDocument2Old_fnIMEInProgress, + ITextDocument2Old_fnSysBeep, + ITextDocument2Old_fnUpdate, + ITextDocument2Old_fnNotify }; /* ITextSelection */ @@ -5517,7 +5700,7 @@ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *p reo->IUnknown_inner.lpVtbl = &reo_unk_vtbl; reo->IRichEditOle_iface.lpVtbl = &revt; - reo->ITextDocument_iface.lpVtbl = &tdvt; + reo->ITextDocument2Old_iface.lpVtbl = &tdvt; reo->ref = 1; reo->editor = editor; reo->txtSel = NULL; @@ -5750,8 +5933,8 @@ void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) } } -void ME_GetITextDocumentInterface(IRichEditOle *iface, LPVOID *ppvObj) +void ME_GetITextDocument2OldInterface(IRichEditOle *iface, LPVOID *ppvObj) { IRichEditOleImpl *This = impl_from_IRichEditOle(iface); - *ppvObj = &This->ITextDocument_iface; + *ppvObj = &This->ITextDocument2Old_iface; } diff --git a/dll/win32/riched20/run.c b/dll/win32/riched20/run.c index 3c7b38e2f6..b9e1269fe8 100644 --- a/dll/win32/riched20/run.c +++ b/dll/win32/riched20/run.c @@ -103,6 +103,9 @@ void ME_CheckCharOffsets(ME_TextEditor *editor) ME_DisplayItem *p = editor->pBuffer->pFirst; int ofs = 0, ofsp = 0; + if (!TRACE_ON(richedit_check)) + return; + TRACE_(richedit_check)("Checking begin\n"); if(TRACE_ON(richedit_lists)) { @@ -229,7 +232,7 @@ void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p) int i; assert(p->type == diRun && pNext->type == diRun); assert(p->member.run.nCharOfs != -1); - ME_GetParagraph(p)->member.para.nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, ME_GetParagraph(p)); /* Update all cursors so that they don't contain the soon deleted run */ for (i=0; i<editor->nCursors; i++) { @@ -243,8 +246,7 @@ void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p) ME_Remove(pNext); ME_DestroyDisplayItem(pNext); ME_UpdateRunFlags(editor, &p->member.run); - if(TRACE_ON(richedit_check)) - ME_CheckCharOffsets(editor); + ME_CheckCharOffsets(editor); } /****************************************************************************** @@ -282,7 +284,7 @@ ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor) editor->pCursors[i].nOffset -= nOffset; } } - cursor->pPara->member.para.nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, cursor->pPara); return run; } @@ -350,7 +352,7 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style, ME_InsertBefore( insert_before, pDI ); TRACE("Shift length:%d\n", len); ME_PropagateCharOffset( insert_before, len ); - insert_before->member.run.para->nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, get_di_from_para(insert_before->member.run.para)); /* Move any cursors that were at the end of the previous run to the end of the inserted run */ prev = ME_FindItemBack( pDI, diRun ); @@ -615,8 +617,8 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visu SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen, int startx, int *pAscent, int *pDescent) { + static const WCHAR spaceW[] = {' ',0}; SIZE size; - WCHAR spaceW[] = {' ',0}; nLen = min( nLen, run->len ); @@ -771,7 +773,7 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C ME_ReleaseStyle(para->para_num.style); para->para_num.style = NULL; } - para->nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, get_di_from_para(para)); } } diff --git a/dll/win32/riched20/style.c b/dll/win32/riched20/style.c index 0b85d69f6f..c3f3fc3f9a 100644 --- a/dll/win32/riched20/style.c +++ b/dll/win32/riched20/style.c @@ -33,7 +33,7 @@ static int all_refs = 0; * sizeof(char[AW]) */ -CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from) +BOOL cfany_to_cf2w(CHARFORMAT2W *to, const CHARFORMAT2W *from) { if (from->cbSize == sizeof(CHARFORMATA)) { @@ -41,9 +41,9 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from) CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName)); to->cbSize = sizeof(CHARFORMAT2W); if (f->dwMask & CFM_FACE) { - MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, ARRAY_SIZE(to->szFaceName)); } - return to; + return TRUE; } if (from->cbSize == sizeof(CHARFORMATW)) { @@ -52,7 +52,7 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from) /* theoretically, we don't need to zero the remaining memory */ ZeroMemory(&to->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W, wWeight)); to->cbSize = sizeof(CHARFORMAT2W); - return to; + return TRUE; } if (from->cbSize == sizeof(CHARFORMAT2A)) { @@ -61,17 +61,22 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from) CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName)); /* convert face name */ if (f->dwMask & CFM_FACE) - MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, ARRAY_SIZE(to->szFaceName)); /* copy the rest of the 2A structure to 2W */ CopyMemory(&to->wWeight, &f->wWeight, sizeof(CHARFORMAT2A)-FIELD_OFFSET(CHARFORMAT2A, wWeight)); to->cbSize = sizeof(CHARFORMAT2W); - return to; + return TRUE; + } + if (from->cbSize == sizeof(CHARFORMAT2W)) + { + CopyMemory(to, from, sizeof(CHARFORMAT2W)); + return TRUE; } - return (from->cbSize >= sizeof(CHARFORMAT2W)) ? from : NULL; + return FALSE; } -static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) +BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from) { assert(from->cbSize == sizeof(CHARFORMAT2W)); if (to->cbSize == sizeof(CHARFORMATA)) @@ -80,14 +85,14 @@ static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName)); WideCharToMultiByte(CP_ACP, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), NULL, NULL); t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */ - return to; + return TRUE; } if (to->cbSize == sizeof(CHARFORMATW)) { CHARFORMATW *t = (CHARFORMATW *)to; CopyMemory(t, from, sizeof(*t)); t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */ - return to; + return TRUE; } if (to->cbSize == sizeof(CHARFORMAT2A)) { @@ -99,16 +104,14 @@ static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) /* copy the rest of the 2A structure to 2W */ CopyMemory(&t->wWeight, &from->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W,wWeight)); t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */ - return to; + return TRUE; } - assert(to->cbSize >= sizeof(CHARFORMAT2W)); - return from; -} - -void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) -{ - if (ME_ToCFAny(to, from) == from) - CopyMemory(to, from, to->cbSize); + if (to->cbSize == sizeof(CHARFORMAT2W)) + { + CopyMemory(to, from, sizeof(CHARFORMAT2W)); + return TRUE; + } + return FALSE; } ME_Style *ME_MakeStyle(CHARFORMAT2W *style) diff --git a/dll/win32/riched20/table.c b/dll/win32/riched20/table.c index 4cd77eb399..7e8d7ffacb 100644 --- a/dll/win32/riched20/table.c +++ b/dll/win32/riched20/table.c @@ -56,6 +56,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists); +static const WCHAR cr_lf[] = {'\r', '\n', 0}; + static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor, int nCursor, const WCHAR *eol_str, int eol_len, @@ -77,7 +79,6 @@ static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor, ME_DisplayItem* ME_InsertTableRowStartFromCursor(ME_TextEditor *editor) { ME_DisplayItem *para; - WCHAR cr_lf[] = {'\r', '\n', 0}; para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWSTART); return para->member.para.prev_para; } @@ -128,7 +129,6 @@ ME_DisplayItem* ME_InsertTableCellFromCursor(ME_TextEditor *editor) ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor) { ME_DisplayItem *para; - WCHAR cr_lf[] = {'\r', '\n', 0}; para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWEND); return para->member.para.prev_para; } diff --git a/dll/win32/riched20/txthost.c b/dll/win32/riched20/txthost.c index b479bde81b..eaa6aaef06 100644 --- a/dll/win32/riched20/txthost.c +++ b/dll/win32/riched20/txthost.c @@ -501,10 +501,10 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i #ifdef __i386__ /* thiscall functions are i386-specific */ -#define THISCALL(func) __thiscall_ ## func +#define THISCALL(func) (void *) __thiscall_ ## func #define DEFINE_THISCALL_WRAPPER(func,args) \ - extern typeof(func) THISCALL(func); \ - __ASM_STDCALL_FUNC(__thiscall_ ## func, args, \ + extern HRESULT __thiscall_ ## func(void); \ + __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ "popl %eax\n\t" \ "pushl %ecx\n\t" \ "pushl %eax\n\t" \ @@ -559,10 +559,10 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8) #ifdef __i386__ /* thiscall functions are i386-specific */ -#define STDCALL(func) __stdcall_ ## func +#define STDCALL(func) (void *) __stdcall_ ## func #define DEFINE_STDCALL_WRAPPER(num,func,args) \ - extern typeof(func) __stdcall_ ## func; \ - __ASM_STDCALL_FUNC(__stdcall_ ## func, args, \ + extern HRESULT __stdcall_ ## func(void); \ + __ASM_GLOBAL_FUNC(__stdcall_ ## func, \ "popl %eax\n\t" \ "popl %ecx\n\t" \ "pushl %eax\n\t" \ @@ -613,45 +613,45 @@ const ITextHostVtbl itextHostStdcallVtbl = { NULL, NULL, NULL, - __stdcall_ITextHostImpl_TxGetDC, - __stdcall_ITextHostImpl_TxReleaseDC, - __stdcall_ITextHostImpl_TxShowScrollBar, - __stdcall_ITextHostImpl_TxEnableScrollBar, - __stdcall_ITextHostImpl_TxSetScrollRange, - __stdcall_ITextHostImpl_TxSetScrollPos, - __stdcall_ITextHostImpl_TxInvalidateRect, - __stdcall_ITextHostImpl_TxViewChange, - __stdcall_ITextHostImpl_TxCreateCaret, - __stdcall_ITextHostImpl_TxShowCaret, - __stdcall_ITextHostImpl_TxSetCaretPos, - __stdcall_ITextHostImpl_TxSetTimer, - __stdcall_ITextHostImpl_TxKillTimer, - __stdcall_ITextHostImpl_TxScrollWindowEx, - __stdcall_ITextHostImpl_TxSetCapture, - __stdcall_ITextHostImpl_TxSetFocus, - __stdcall_ITextHostImpl_TxSetCursor, - __stdcall_ITextHostImpl_TxScreenToClient, - __stdcall_ITextHostImpl_TxClientToScreen, - __stdcall_ITextHostImpl_TxActivate, - __stdcall_ITextHostImpl_TxDeactivate, - __stdcall_ITextHostImpl_TxGetClientRect, - __stdcall_ITextHostImpl_TxGetViewInset, - __stdcall_ITextHostImpl_TxGetCharFormat, - __stdcall_ITextHostImpl_TxGetParaFormat, - __stdcall_ITextHostImpl_TxGetSysColor, - __stdcall_ITextHostImpl_TxGetBackStyle, - __stdcall_ITextHostImpl_TxGetMaxLength, - __stdcall_ITextHostImpl_TxGetScrollBars, - __stdcall_ITextHostImpl_TxGetPasswordChar, - __stdcall_ITextHostImpl_TxGetAcceleratorPos, - __stdcall_ITextHostImpl_TxGetExtent, - __stdcall_ITextHostImpl_OnTxCharFormatChange, - __stdcall_ITextHostImpl_OnTxParaFormatChange, - __stdcall_ITextHostImpl_TxGetPropertyBits, - __stdcall_ITextHostImpl_TxNotify, - __stdcall_ITextHostImpl_TxImmGetContext, - __stdcall_ITextHostImpl_TxImmReleaseContext, - __stdcall_ITextHostImpl_TxGetSelectionBarWidth, + STDCALL(ITextHostImpl_TxGetDC), + STDCALL(ITextHostImpl_TxReleaseDC), + STDCALL(ITextHostImpl_TxShowScrollBar), + STDCALL(ITextHostImpl_TxEnableScrollBar), + STDCALL(ITextHostImpl_TxSetScrollRange), + STDCALL(ITextHostImpl_TxSetScrollPos), + STDCALL(ITextHostImpl_TxInvalidateRect), + STDCALL(ITextHostImpl_TxViewChange), + STDCALL(ITextHostImpl_TxCreateCaret), + STDCALL(ITextHostImpl_TxShowCaret), + STDCALL(ITextHostImpl_TxSetCaretPos), + STDCALL(ITextHostImpl_TxSetTimer), + STDCALL(ITextHostImpl_TxKillTimer), + STDCALL(ITextHostImpl_TxScrollWindowEx), + STDCALL(ITextHostImpl_TxSetCapture), + STDCALL(ITextHostImpl_TxSetFocus), + STDCALL(ITextHostImpl_TxSetCursor), + STDCALL(ITextHostImpl_TxScreenToClient), + STDCALL(ITextHostImpl_TxClientToScreen), + STDCALL(ITextHostImpl_TxActivate), + STDCALL(ITextHostImpl_TxDeactivate), + STDCALL(ITextHostImpl_TxGetClientRect), + STDCALL(ITextHostImpl_TxGetViewInset), + STDCALL(ITextHostImpl_TxGetCharFormat), + STDCALL(ITextHostImpl_TxGetParaFormat), + STDCALL(ITextHostImpl_TxGetSysColor), + STDCALL(ITextHostImpl_TxGetBackStyle), + STDCALL(ITextHostImpl_TxGetMaxLength), + STDCALL(ITextHostImpl_TxGetScrollBars), + STDCALL(ITextHostImpl_TxGetPasswordChar), + STDCALL(ITextHostImpl_TxGetAcceleratorPos), + STDCALL(ITextHostImpl_TxGetExtent), + STDCALL(ITextHostImpl_OnTxCharFormatChange), + STDCALL(ITextHostImpl_OnTxParaFormatChange), + STDCALL(ITextHostImpl_TxGetPropertyBits), + STDCALL(ITextHostImpl_TxNotify), + STDCALL(ITextHostImpl_TxImmGetContext), + STDCALL(ITextHostImpl_TxImmReleaseContext), + STDCALL(ITextHostImpl_TxGetSelectionBarWidth), }; #endif /* __i386__ */ diff --git a/dll/win32/riched20/txtsrv.c b/dll/win32/riched20/txtsrv.c index eb61e4eff6..18c2ca9d69 100644 --- a/dll/win32/riched20/txtsrv.c +++ b/dll/win32/riched20/txtsrv.c @@ -35,10 +35,10 @@ #ifdef __i386__ /* thiscall functions are i386-specific */ -#define THISCALL(func) __thiscall_ ## func +#define THISCALL(func) (void *) __thiscall_ ## func #define DEFINE_THISCALL_WRAPPER(func,args) \ - extern typeof(func) THISCALL(func); \ - __ASM_STDCALL_FUNC(__thiscall_ ## func, args, \ + extern HRESULT __thiscall_ ## func(void); \ + __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ "popl %eax\n\t" \ "pushl %ecx\n\t" \ "pushl %eax\n\t" \ @@ -78,12 +78,13 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID r *ppv = &This->IUnknown_inner; else if (IsEqualIID(riid, &IID_ITextServices)) *ppv = &This->ITextServices_iface; - else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument)) { + else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument) || + IsEqualIID(riid, &IID_ITextDocument2Old)) { if (!This->editor->reOle) if (!CreateIRichEditOle(This->outer_unk, This->editor, (void **)(&This->editor->reOle))) return E_OUTOFMEMORY; - if (IsEqualIID(riid, &IID_ITextDocument)) - ME_GetITextDocumentInterface(This->editor->reOle, ppv); + if (IsEqualIID(riid, &IID_ITextDocument) || IsEqualIID(riid, &IID_ITextDocument2Old)) + ME_GetITextDocument2OldInterface(This->editor->reOle, ppv); else *ppv = This->editor->reOle; } else { @@ -182,11 +183,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, LONG { ITextServicesImpl *This = impl_from_ITextServices(iface); - *plMin = This->editor->horz_si.nMin; - *plMax = This->editor->horz_si.nMax; - *plPos = This->editor->horz_si.nPos; - *plPage = This->editor->horz_si.nPage; - *pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0; + if (plMin) + *plMin = This->editor->horz_si.nMin; + if (plMax) + *plMax = This->editor->horz_si.nMax; + if (plPos) + *plPos = This->editor->horz_si.nPos; + if (plPage) + *plPage = This->editor->horz_si.nPage; + if (pfEnabled) + *pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0; return S_OK; } @@ -195,11 +201,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, LONG { ITextServicesImpl *This = impl_from_ITextServices(iface); - *plMin = This->editor->vert_si.nMin; - *plMax = This->editor->vert_si.nMax; - *plPos = This->editor->vert_si.nPos; - *plPage = This->editor->vert_si.nPage; - *pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0; + if (plMin) + *plMin = This->editor->vert_si.nMin; + if (plMax) + *plMax = This->editor->vert_si.nMax; + if (plPos) + *plPos = This->editor->vert_si.nPos; + if (plPage) + *plPage = This->editor->vert_si.nPage; + if (pfEnabled) + *pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0; return S_OK; } diff --git a/dll/win32/riched20/undo.c b/dll/win32/riched20/undo.c index 582f88860c..2f18fc78bb 100644 --- a/dll/win32/riched20/undo.c +++ b/dll/win32/riched20/undo.c @@ -341,7 +341,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo) add_undo_set_para_fmt( editor, ¶->member.para ); para->member.para.fmt = undo->u.set_para_fmt.fmt; para->member.para.border = undo->u.set_para_fmt.border; - para->member.para.nFlags |= MEPF_REWRAP; + mark_para_rewrap(editor, para); break; } case undo_set_char_fmt: diff --git a/dll/win32/riched20/wrap.c b/dll/win32/riched20/wrap.c index e3a70f07d1..a66137d42c 100644 --- a/dll/win32/riched20/wrap.c +++ b/dll/win32/riched20/wrap.c @@ -23,7 +23,6 @@ #include "editor.h" WINE_DEFAULT_DEBUG_CHANNEL(richedit); -WINE_DECLARE_DEBUG_CHANNEL(richedit_check); /* * Unsolved problems: @@ -140,8 +139,7 @@ static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *ite ME_Cursor cursor = {wc->pPara, item, nVChar}; assert(item->member.run.nCharOfs != -1); - if(TRACE_ON(richedit_check)) - ME_CheckCharOffsets(editor); + ME_CheckCharOffsets(editor); run = &item->member.run; @@ -160,8 +158,7 @@ static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *ite run2->pt.x = run->pt.x+run->nWidth; run2->pt.y = run->pt.y; - if(TRACE_ON(richedit_check)) - ME_CheckCharOffsets(editor); + ME_CheckCharOffsets(editor); TRACE("After split: %s(%d, %d), %s(%d, %d)\n", debugstr_run( run ), run->pt.x, run->pt.y, @@ -260,7 +257,7 @@ static void layout_row( ME_DisplayItem *start, const ME_DisplayItem *end ) TRACE("%d runs\n", num_runs); if (!num_runs) return; - if (num_runs > sizeof(buf) / (sizeof(buf[0]) * 5)) + if (num_runs > ARRAY_SIZE( buf ) / 5) vis_to_log = heap_alloc( num_runs * sizeof(int) * 5 ); log_to_vis = vis_to_log + num_runs; @@ -733,12 +730,13 @@ static int ME_GetParaLineSpace(ME_Context* c, ME_Paragraph* para) return sp * c->editor->nZoomNumerator / c->editor->nZoomDenominator; } -static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp) { +static void ME_PrepareParagraphForWrapping(ME_TextEditor *editor, ME_Context *c, ME_DisplayItem *tp) { ME_DisplayItem *p; tp->member.para.nWidth = 0; /* remove row start items as they will be reinserted by the * paragraph wrapper anyway */ + editor->total_rows -= tp->member.para.nRows; tp->member.para.nRows = 0; for (p = tp->next; p != tp->member.para.next_para; p = p->next) { if (p->type == diStartRow) { @@ -766,7 +764,7 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p ) ME_Run *run; ME_DisplayItem *di; SCRIPT_ITEM buf[16], *items = buf; - int items_passed = sizeof( buf ) / sizeof( buf[0] ), num_items, cur_item; + int items_passed = ARRAY_SIZE( buf ), num_items, cur_item; SCRIPT_CONTROL control = { LANG_USER_DEFAULT, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0 }; SCRIPT_STATE state = { 0, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0, 0 }; @@ -870,7 +868,7 @@ static HRESULT shape_para( ME_Context *c, ME_DisplayItem *p ) return hr; } -static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) { +static void ME_WrapTextParagraph(ME_TextEditor *editor, ME_Context *c, ME_DisplayItem *tp) { ME_DisplayItem *p; ME_WrapContext wc; int border = 0; @@ -881,7 +879,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) { if (!(tp->member.para.nFlags & MEPF_REWRAP)) { return; } - ME_PrepareParagraphForWrapping(c, tp); + ME_PrepareParagraphForWrapping(editor, c, tp); /* Calculate paragraph numbering label */ para_num_init( c, &tp->member.para ); @@ -969,6 +967,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) { tp->member.para.nFlags &= ~MEPF_REWRAP; tp->member.para.nHeight = wc.pt.y; tp->member.para.nRows = wc.nRow; + editor->total_rows += wc.nRow; } static void ME_MarkRepaintEnd(ME_DisplayItem *para, @@ -980,139 +979,179 @@ static void ME_MarkRepaintEnd(ME_DisplayItem *para, *repaint_end = para; } +static void adjust_para_y(ME_DisplayItem *item, ME_Context *c, ME_DisplayItem *repaint_start, ME_DisplayItem *repaint_end) +{ + if (item->member.para.nFlags & MEPF_ROWSTART) + { + ME_DisplayItem *cell = ME_FindItemFwd(item, diCell); + ME_DisplayItem *endRowPara; + int borderWidth = 0; + cell->member.cell.pt = c->pt; + /* Offset the text by the largest top border width. */ + while (cell->member.cell.next_cell) + { + borderWidth = max(borderWidth, cell->member.cell.border.top.width); + cell = cell->member.cell.next_cell; + } + endRowPara = ME_FindItemFwd(cell, diParagraph); + assert(endRowPara->member.para.nFlags & MEPF_ROWEND); + if (borderWidth > 0) + { + borderWidth = max(ME_twips2pointsY(c, borderWidth), 1); + while (cell) + { + cell->member.cell.yTextOffset = borderWidth; + cell = cell->member.cell.prev_cell; + } + c->pt.y += borderWidth; + } + if (endRowPara->member.para.fmt.dxStartIndent > 0) + { + int dxStartIndent = endRowPara->member.para.fmt.dxStartIndent; + cell = ME_FindItemFwd(item, diCell); + cell->member.cell.pt.x += ME_twips2pointsX(c, dxStartIndent); + c->pt.x = cell->member.cell.pt.x; + } + } + else if (item->member.para.nFlags & MEPF_ROWEND) + { + /* Set all the cells to the height of the largest cell */ + ME_DisplayItem *startRowPara; + int prevHeight, nHeight, bottomBorder = 0; + ME_DisplayItem *cell = ME_FindItemBack(item, diCell); + item->member.para.nWidth = cell->member.cell.pt.x + cell->member.cell.nWidth; + if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWSTART)) + { + /* Last row, the bottom border is added to the height. */ + cell = cell->member.cell.prev_cell; + while (cell) + { + bottomBorder = max(bottomBorder, cell->member.cell.border.bottom.width); + cell = cell->member.cell.prev_cell; + } + bottomBorder = ME_twips2pointsY(c, bottomBorder); + cell = ME_FindItemBack(item, diCell); + } + prevHeight = cell->member.cell.nHeight; + nHeight = cell->member.cell.prev_cell->member.cell.nHeight + bottomBorder; + cell->member.cell.nHeight = nHeight; + item->member.para.nHeight = nHeight; + cell = cell->member.cell.prev_cell; + cell->member.cell.nHeight = nHeight; + while (cell->member.cell.prev_cell) + { + cell = cell->member.cell.prev_cell; + cell->member.cell.nHeight = nHeight; + } + /* Also set the height of the start row paragraph */ + startRowPara = ME_FindItemBack(cell, diParagraph); + startRowPara->member.para.nHeight = nHeight; + c->pt.x = startRowPara->member.para.pt.x; + c->pt.y = cell->member.cell.pt.y + nHeight; + if (prevHeight < nHeight) + { + /* The height of the cells has grown, so invalidate the bottom of + * the cells. */ + ME_MarkRepaintEnd(item, &repaint_start, &repaint_end); + cell = ME_FindItemBack(item, diCell); + while (cell) + { + ME_MarkRepaintEnd(ME_FindItemBack(cell, diParagraph), &repaint_start, &repaint_end); + cell = cell->member.cell.prev_cell; + } + } + } + else if (item->member.para.pCell && + item->member.para.pCell != item->member.para.next_para->member.para.pCell) + { + /* The next paragraph is in the next cell in the table row. */ + ME_Cell *cell = &item->member.para.pCell->member.cell; + cell->nHeight = c->pt.y + item->member.para.nHeight - cell->pt.y; + + /* Propagate the largest height to the end so that it can be easily + * sent back to all the cells at the end of the row. */ + if (cell->prev_cell) + cell->nHeight = max(cell->nHeight, cell->prev_cell->member.cell.nHeight); + + c->pt.x = cell->pt.x + cell->nWidth; + c->pt.y = cell->pt.y; + cell->next_cell->member.cell.pt = c->pt; + if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWEND)) + c->pt.y += cell->yTextOffset; + } + else + { + if (item->member.para.pCell) + { + /* Next paragraph in the same cell. */ + c->pt.x = item->member.para.pCell->member.cell.pt.x; + } + else + /* Normal paragraph */ + c->pt.x = 0; + c->pt.y += item->member.para.nHeight; + } +} + BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) { ME_DisplayItem *item; ME_Context c; - int totalWidth = 0; + int totalWidth = editor->nTotalWidth, diff = 0, prev_width; ME_DisplayItem *repaint_start = NULL, *repaint_end = NULL; + ME_Paragraph *para; + + if (!editor->first_marked_para) + return FALSE; ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost)); - c.pt.x = 0; - item = editor->pBuffer->pFirst->next; - while(item != editor->pBuffer->pLast) { - BOOL bRedraw = FALSE; + item = editor->first_marked_para; + c.pt = item->member.para.pt; + while (item != editor->pBuffer->pLast) + { assert(item->type == diParagraph); - if ((item->member.para.nFlags & MEPF_REWRAP) - || (item->member.para.pt.y != c.pt.y)) - bRedraw = TRUE; - item->member.para.pt = c.pt; - ME_WrapTextParagraph(&c, item); + prev_width = item->member.para.nWidth; + ME_WrapTextParagraph(editor, &c, item); + if (prev_width == totalWidth && item->member.para.nWidth < totalWidth) + totalWidth = get_total_width(editor); + else + totalWidth = max(totalWidth, item->member.para.nWidth); - if (bRedraw) - ME_MarkRepaintEnd(item, &repaint_start, &repaint_end); + if (!item->member.para.nCharOfs) + ME_MarkRepaintEnd(item->member.para.prev_para, &repaint_start, &repaint_end); + ME_MarkRepaintEnd(item, &repaint_start, &repaint_end); + adjust_para_y(item, &c, repaint_start, repaint_end); - if (item->member.para.nFlags & MEPF_ROWSTART) + if (item->member.para.next_para) { - ME_DisplayItem *cell = ME_FindItemFwd(item, diCell); - ME_DisplayItem *endRowPara; - int borderWidth = 0; - cell->member.cell.pt = c.pt; - /* Offset the text by the largest top border width. */ - while (cell->member.cell.next_cell) { - borderWidth = max(borderWidth, cell->member.cell.border.top.width); - cell = cell->member.cell.next_cell; - } - endRowPara = ME_FindItemFwd(cell, diParagraph); - assert(endRowPara->member.para.nFlags & MEPF_ROWEND); - if (borderWidth > 0) - { - borderWidth = max(ME_twips2pointsY(&c, borderWidth), 1); - while (cell) { - cell->member.cell.yTextOffset = borderWidth; - cell = cell->member.cell.prev_cell; - } - c.pt.y += borderWidth; - } - if (endRowPara->member.para.fmt.dxStartIndent > 0) + diff = c.pt.y - item->member.para.next_para->member.para.pt.y; + if (diff) { - int dxStartIndent = endRowPara->member.para.fmt.dxStartIndent; - cell = ME_FindItemFwd(item, diCell); - cell->member.cell.pt.x += ME_twips2pointsX(&c, dxStartIndent); - c.pt.x = cell->member.cell.pt.x; - } - } - else if (item->member.para.nFlags & MEPF_ROWEND) - { - /* Set all the cells to the height of the largest cell */ - ME_DisplayItem *startRowPara; - int prevHeight, nHeight, bottomBorder = 0; - ME_DisplayItem *cell = ME_FindItemBack(item, diCell); - item->member.para.nWidth = cell->member.cell.pt.x + cell->member.cell.nWidth; - if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWSTART)) - { - /* Last row, the bottom border is added to the height. */ - cell = cell->member.cell.prev_cell; - while (cell) + para = &item->member.para; + while (para->next_para && para != &item->member.para.next_marked->member.para && + para != &editor->pBuffer->pLast->member.para) { - bottomBorder = max(bottomBorder, cell->member.cell.border.bottom.width); - cell = cell->member.cell.prev_cell; - } - bottomBorder = ME_twips2pointsY(&c, bottomBorder); - cell = ME_FindItemBack(item, diCell); - } - prevHeight = cell->member.cell.nHeight; - nHeight = cell->member.cell.prev_cell->member.cell.nHeight + bottomBorder; - cell->member.cell.nHeight = nHeight; - item->member.para.nHeight = nHeight; - cell = cell->member.cell.prev_cell; - cell->member.cell.nHeight = nHeight; - while (cell->member.cell.prev_cell) - { - cell = cell->member.cell.prev_cell; - cell->member.cell.nHeight = nHeight; - } - /* Also set the height of the start row paragraph */ - startRowPara = ME_FindItemBack(cell, diParagraph); - startRowPara->member.para.nHeight = nHeight; - c.pt.x = startRowPara->member.para.pt.x; - c.pt.y = cell->member.cell.pt.y + nHeight; - if (prevHeight < nHeight) - { - /* The height of the cells has grown, so invalidate the bottom of - * the cells. */ - ME_MarkRepaintEnd(item, &repaint_start, &repaint_end); - cell = ME_FindItemBack(item, diCell); - while (cell) { - ME_MarkRepaintEnd(ME_FindItemBack(cell, diParagraph), &repaint_start, &repaint_end); - cell = cell->member.cell.prev_cell; + ME_MarkRepaintEnd(para->next_para, &repaint_start, &repaint_end); + para->next_para->member.para.pt.y = c.pt.y; + adjust_para_y(para->next_para, &c, repaint_start, repaint_end); + para = ¶->next_para->member.para; } } } - else if (item->member.para.pCell && - item->member.para.pCell != item->member.para.next_para->member.para.pCell) + if (item->member.para.next_marked) { - /* The next paragraph is in the next cell in the table row. */ - ME_Cell *cell = &item->member.para.pCell->member.cell; - cell->nHeight = c.pt.y + item->member.para.nHeight - cell->pt.y; - - /* Propagate the largest height to the end so that it can be easily - * sent back to all the cells at the end of the row. */ - if (cell->prev_cell) - cell->nHeight = max(cell->nHeight, cell->prev_cell->member.cell.nHeight); - - c.pt.x = cell->pt.x + cell->nWidth; - c.pt.y = cell->pt.y; - cell->next_cell->member.cell.pt = c.pt; - if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWEND)) - c.pt.y += cell->yTextOffset; + ME_DisplayItem *rem = item; + item = item->member.para.next_marked; + remove_marked_para(editor, rem); } else { - if (item->member.para.pCell) { - /* Next paragraph in the same cell. */ - c.pt.x = item->member.para.pCell->member.cell.pt.x; - } else { - /* Normal paragraph */ - c.pt.x = 0; - } - c.pt.y += item->member.para.nHeight; + remove_marked_para(editor, item); + item = editor->pBuffer->pLast; } - - totalWidth = max(totalWidth, item->member.para.nWidth); - item = item->member.para.next_para; + c.pt.y = item->member.para.pt.y; } editor->sizeWindow.cx = c.rcView.right-c.rcView.left; editor->sizeWindow.cy = c.rcView.bottom-c.rcView.top; diff --git a/dll/win32/riched20/writer.c b/dll/win32/riched20/writer.c index b1e99d642f..2bd97d8db2 100644 --- a/dll/win32/riched20/writer.c +++ b/dll/win32/riched20/writer.c @@ -760,7 +760,7 @@ ME_StreamOutRTFCharProps(ME_OutStream *pStream, CHARFORMAT2W *fmt) { CFE_STRIKEOUT, "\\strike", "\\strike0" }, }; - for (i = 0; i < sizeof(effects) / sizeof(effects[0]); i++) + for (i = 0; i < ARRAY_SIZE( effects ); i++) { if ((old_fmt->dwEffects ^ fmt->dwEffects) & effects[i].effect) strcat( props, fmt->dwEffects & effects[i].effect ? effects[i].on : effects[i].off ); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 7e52949524..6f654787d8 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -158,7 +158,7 @@ reactos/dll/win32/qmgrprxy # Synced to WineStaging-2.9 reactos/dll/win32/query # Synced to WineStaging-3.3 reactos/dll/win32/rasapi32 # Synced to WineStaging-3.3 reactos/dll/win32/resutils # Synced to WineStaging-3.3 -reactos/dll/win32/riched20 # Synced to WineStaging-3.9 +reactos/dll/win32/riched20 # Synced to WineStaging-4.0 reactos/dll/win32/riched32 # Synced to WineStaging-3.3 reactos/dll/win32/rpcrt4 # Synced to WineStaging-4.0 reactos/dll/win32/rsabase # Synced to WineStaging-3.3
5 years, 10 months
1
0
0
0
[reactos] 01/01: [PSDK] Update tom.idl. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f5580f4c9df060478f2da…
commit f5580f4c9df060478f2dafd588af2695930212c9 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 14:08:53 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 14:08:53 2019 +0100 [PSDK] Update tom.idl. CORE-15682 --- sdk/include/psdk/tom.idl | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/sdk/include/psdk/tom.idl b/sdk/include/psdk/tom.idl index 357b0457a5..5c1fd6bd97 100644 --- a/sdk/include/psdk/tom.idl +++ b/sdk/include/psdk/tom.idl @@ -237,6 +237,97 @@ interface ITextDocument : IDispatch HRESULT RangeFromPoint([in]LONG x, [in]LONG y, [retval, out]ITextRange **ppRange); } +[ + object, + uuid(01c25500-4268-11d1-883a-3c8b00c10000) +] +interface ITextDocument2Old : ITextDocument +{ + HRESULT AttachMsgFilter([in]IUnknown *filter); + HRESULT SetEffectColor([in]LONG index, [in]COLORREF cr); + HRESULT GetEffectColor([in]LONG index, [out]COLORREF *cr); + HRESULT GetCaretType([retval, out]LONG *type); + HRESULT SetCaretType([in]LONG type); + HRESULT GetImmContext([retval, out]LONG *context); + HRESULT ReleaseImmContext([in]LONG context); + HRESULT GetPreferredFont([in]LONG cp, [in]LONG codepage, [in]LONG option, [in]LONG current_codepage, [in]LONG current_fontsize, + [out]BSTR *bstr, [out]LONG *pitch_family, [out]LONG *new_fontsize); + HRESULT GetNotificationMode([retval, out]LONG *mode); + HRESULT SetNotificationMode([in]LONG mode); + HRESULT GetClientRect([in]LONG type, [out]LONG *left, [out]LONG *top, [out]LONG *right, [out]LONG *bottom); + HRESULT GetSelectionEx([retval, out]ITextSelection **selection); + HRESULT GetWindow([out]LONG *hwnd); + HRESULT GetFEFlags([out]LONG *flags); + HRESULT UpdateWindow(); + HRESULT CheckTextLimit([in]LONG cch, [out]LONG *exceed); + HRESULT IMEInProgress([in]LONG mode); + HRESULT SysBeep(); + HRESULT Update([in]LONG mode); + HRESULT Notify([in]LONG notify); +} + +interface ITextDisplays; +interface ITextFont2; +interface ITextPara2; +interface ITextRange2; +interface ITextSelection2; +interface ITextStory; +interface ITextStoryRanges2; +interface ITextStrings; + +[ + object, + uuid(c241f5e0-7206-11d8-a2c7-00a0d1d6c6b3) +] +interface ITextDocument2 : ITextDocument +{ + HRESULT GetCaretType([retval, out]LONG *value); + HRESULT SetCaretType([in]LONG value); + HRESULT GetDisplays([retval, out]ITextDisplays **displays); + HRESULT GetDocumentFont([retval, out]ITextFont2 **font); + HRESULT SetDocumentFont([in]ITextFont2 *font); + HRESULT GetDocumentPara([retval, out]ITextPara2 **para); + HRESULT SetDocumentPara([in]ITextPara2 *para); + HRESULT GetEastAsianFlags([retval, out]LONG *flags); + HRESULT GetGenerator([retval, out]BSTR *bstr); + HRESULT SetIMEInProgress([in]LONG value); + HRESULT GetNotificationMode([retval, out]LONG *mode); + HRESULT SetNotificationMode([in]LONG mode); + HRESULT GetSelection2([retval, out]ITextSelection2 **selection); + HRESULT GetStoryRanges2([retval, out]ITextStoryRanges2 **stories); + HRESULT GetTypographyOptions([retval, out]LONG *options); + HRESULT GetVersion([retval, out]LONG *value); + HRESULT GetWindow([retval, out]LONG *hwnd); + HRESULT AttachMsgFilter([in]IUnknown *filter); + HRESULT CheckTextLimit([in]LONG cch, [out]LONG *exceed); + HRESULT GetCallManager([retval, out]IUnknown **manager); + HRESULT GetClientRect([in]LONG type, [out]LONG *left, [out]LONG *top, [out]LONG *right, [out]LONG *bottom); + HRESULT GetEffectColor([in]LONG index, [out]COLORREF *cr); + HRESULT GetImmContext([retval, out]LONG *context); + HRESULT GetPreferredFont([in]LONG cp, [in]LONG codepage, [in]LONG option, [in]LONG current_codepage, [in]LONG current_fontsize, + [out]BSTR *bstr, [out]LONG *pitch_family, [out]LONG *new_fontsize); + HRESULT GetProperty([in]LONG type, [out]LONG *value); + HRESULT GetStrings([out]ITextStrings **strings); + HRESULT Notify([in]LONG notify); + HRESULT Range2([in]LONG cp_active, [in]LONG cp_anchor, [retval, out]ITextRange2 **range); + HRESULT RangeFromPoint2([in]LONG x, [in]LONG y, [in]LONG type, [retval, out]ITextRange2 **range); + HRESULT ReleaseCallManager([in]IUnknown *manager); + HRESULT ReleaseImmContext([in]LONG context); + HRESULT SetEffectColor([in]LONG index, [in]LONG value); + HRESULT SetProperty([in]LONG type, [in]LONG value); + HRESULT SetTypographyOptions([in]LONG options, [in]LONG mask); + HRESULT SysBeep(); + HRESULT Update([in]LONG value); + HRESULT UpdateWindow(); + HRESULT GetMathProperties([out]LONG *options); + HRESULT SetMathProperties([in]LONG options, [in]LONG mask); + HRESULT GetActiveStory([retval, out]ITextStory **story); + HRESULT SetActiveStory([in]ITextStory *story); + HRESULT GetMainStory([retval, out]ITextStory **story); + HRESULT GetNewStory([retval, out]ITextStory **story); + HRESULT GetStory([in]LONG index, [retval, out]ITextStory **story); +} + interface ITextFont; interface ITextPara;
5 years, 10 months
1
0
0
0
[reactos] 01/01: [REGEDIT_WINETEST] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c540ae79014842ab3fa14…
commit c540ae79014842ab3fa14e60c9c7d364aae787cd Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 13:30:32 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 13:30:32 2019 +0100 [REGEDIT_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- modules/rostests/winetests/regedit/regedit.c | 74 ++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/modules/rostests/winetests/regedit/regedit.c b/modules/rostests/winetests/regedit/regedit.c index 3bab7e1220..66b9562445 100644 --- a/modules/rostests/winetests/regedit/regedit.c +++ b/modules/rostests/winetests/regedit/regedit.c @@ -1638,6 +1638,22 @@ static void test_invalid_import(void) verify_reg_nonexist(hkey, "Wine32a"); verify_reg_nonexist(hkey, "Wine32b"); + /* Test with embedded null characters */ + exec_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine33a\"=\"\\0\n" + "\"Wine33b\"=\"\\0\\0\n" + "\"Wine33c\"=\"Value1\\0\n" + "\"Wine33d\"=\"Value2\\0\\0\\0\\0\n" + "\"Wine33e\"=\"Value3\\0Value4\n" + "\"Wine33f\"=\"\\0Value4\n\n"); + verify_reg_nonexist(hkey, "Wine33a"); + verify_reg_nonexist(hkey, "Wine33b"); + verify_reg_nonexist(hkey, "Wine33c"); + verify_reg_nonexist(hkey, "Wine33d"); + verify_reg_nonexist(hkey, "Wine33e"); + verify_reg_nonexist(hkey, "Wine33f"); + RegCloseKey(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); @@ -2134,6 +2150,22 @@ static void test_invalid_import_unicode(void) verify_reg_nonexist(hkey, "Wine32a"); verify_reg_nonexist(hkey, "Wine32b"); + /* Test with embedded null characters */ + exec_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine33a\"=\"\\0\n" + "\"Wine33b\"=\"\\0\\0\n" + "\"Wine33c\"=\"Value1\\0\n" + "\"Wine33d\"=\"Value2\\0\\0\\0\\0\n" + "\"Wine33e\"=\"Value3\\0Value4\n" + "\"Wine33f\"=\"\\0Value4\n\n"); + verify_reg_nonexist(hkey, "Wine33a"); + verify_reg_nonexist(hkey, "Wine33b"); + verify_reg_nonexist(hkey, "Wine33c"); + verify_reg_nonexist(hkey, "Wine33d"); + verify_reg_nonexist(hkey, "Wine33e"); + verify_reg_nonexist(hkey, "Wine33f"); + RegCloseKey(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); @@ -3483,6 +3515,18 @@ static void test_export(void) "\"Wine3b\"=hex:12,34,56,78\r\n" "\"Wine3c\"=dword:10203040\r\n\r\n"; + const char *embedded_null_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" + "\"Wine4a\"=dword:00000005\r\n" + "\"Wine4b\"=\"\"\r\n" + "\"Wine4c\"=\"Value\"\r\n" + "\"Wine4d\"=\"\"\r\n" + "\"Wine4e\"=dword:00000100\r\n" + "\"Wine4f\"=\"\"\r\n" + "\"Wine4g\"=\"Value2\"\r\n" + "\"Wine4h\"=\"abc\"\r\n\r\n"; + lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); ok(lr == ERROR_SUCCESS || lr == ERROR_FILE_NOT_FOUND, "RegDeleteKeyA failed: %d\n", lr); @@ -3600,6 +3644,7 @@ static void test_export(void) delete_key(HKEY_CURRENT_USER, KEY_BASE); + /* Test registry export with embedded null characters */ exec_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" "\"Wine3a\"=hex(1):56,00,61,00,6c,00,75,00,65,00,00,00\n" @@ -3617,6 +3662,35 @@ static void test_export(void) ok(compare_export("file.reg", hex_types_test, 0), "compare_export() failed\n"); delete_key(HKEY_CURRENT_USER, KEY_BASE); + + exec_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine4a\"=dword:00000005\n" + "\"Wine4b\"=hex(1):00,00,00,00,00,00,00,00\n" + "\"Wine4c\"=\"Value\"\n" + "\"Wine4d\"=hex(1):00,00,61,00,62,00,63,00\n" + "\"Wine4e\"=dword:00000100\n" + "\"Wine4f\"=hex(1):00,00,56,00,61,00,6c,00,75,00,65,00,00,00\n" + "\"Wine4g\"=\"Value2\"\n" + "\"Wine4h\"=hex(1):61,00,62,00,63,00,00,00, \\\n" + " 64,00,65,00,66,00,00,00\n\n"); + open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + dword = 0x5; + verify_reg(hkey, "Wine4a", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine4b", REG_SZ, "\0\0\0\0\0\0\0", 4, 0); + verify_reg(hkey, "Wine4c", REG_SZ, "Value", 6, 0); + verify_reg(hkey, "Wine4d", REG_SZ, "\0abc", 5, 0); + dword = 0x100; + verify_reg(hkey, "Wine4e", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine4f", REG_SZ, "\0Value", 7, 0); + verify_reg(hkey, "Wine4g", REG_SZ, "Value2", 7, 0); + verify_reg(hkey, "Wine4h", REG_SZ, "abc\0def", 8, 0); + RegCloseKey(hkey); + + run_regedit_exe("regedit.exe /e file.reg HKEY_CURRENT_USER\\" KEY_BASE); + ok(compare_export("file.reg", embedded_null_test, 0), "compare_export() failed\n"); + + delete_key(HKEY_CURRENT_USER, KEY_BASE); } START_TEST(regedit)
5 years, 10 months
1
0
0
0
[reactos] 01/01: [QMGR] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9ce8769f4e0abea7ce546…
commit 9ce8769f4e0abea7ce5465337da29ee66afc3529 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 13:30:06 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 13:30:06 2019 +0100 [QMGR] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/qmgr/file.c | 2 +- media/doc/README.WINE | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dll/win32/qmgr/file.c b/dll/win32/qmgr/file.c index 3673ede142..dbdfc97bcc 100644 --- a/dll/win32/qmgr/file.c +++ b/dll/win32/qmgr/file.c @@ -518,7 +518,7 @@ BOOL processFile(BackgroundCopyFileImpl *file, BackgroundCopyJobImpl *job) uc.lpszPassword = NULL; uc.dwPasswordLength = 0; uc.lpszHostName = host; - uc.dwHostNameLength = sizeof(host)/sizeof(host[0]); + uc.dwHostNameLength = ARRAY_SIZE(host); uc.nPort = 0; uc.lpszUrlPath = NULL; uc.dwUrlPathLength = ~0u; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 6fb3564947..7e52949524 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -153,7 +153,7 @@ reactos/dll/win32/powrprof # Forked at Wine-1.0rc5 reactos/dll/win32/printui # Synced to WineStaging-3.3 reactos/dll/win32/propsys # Synced to WineStaging-4.0 reactos/dll/win32/pstorec # Synced to WineStaging-3.3 -reactos/dll/win32/qmgr # Synced to WineStaging-3.3 +reactos/dll/win32/qmgr # Synced to WineStaging-4.0 reactos/dll/win32/qmgrprxy # Synced to WineStaging-2.9 reactos/dll/win32/query # Synced to WineStaging-3.3 reactos/dll/win32/rasapi32 # Synced to WineStaging-3.3
5 years, 10 months
1
0
0
0
[reactos] 01/01: [PSAPI_WINETEST] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4567e13e3e5f0d0028a47…
commit 4567e13e3e5f0d0028a47aa011249f834be3712d Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 13:29:37 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 13:29:37 2019 +0100 [PSAPI_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- modules/rostests/winetests/psapi/CMakeLists.txt | 2 +- modules/rostests/winetests/psapi/psapi_main.c | 342 +++++++++++++----------- 2 files changed, 189 insertions(+), 155 deletions(-) diff --git a/modules/rostests/winetests/psapi/CMakeLists.txt b/modules/rostests/winetests/psapi/CMakeLists.txt index 638c93f7e7..bbb295b4f0 100644 --- a/modules/rostests/winetests/psapi/CMakeLists.txt +++ b/modules/rostests/winetests/psapi/CMakeLists.txt @@ -2,5 +2,5 @@ add_definitions(-D__WINESRC__) add_executable(psapi_winetest psapi_main.c testlist.c) set_module_type(psapi_winetest win32cui) -add_importlibs(psapi_winetest msvcrt kernel32) +add_importlibs(psapi_winetest psapi user32 msvcrt kernel32) add_rostests_file(TARGET psapi_winetest) diff --git a/modules/rostests/winetests/psapi/psapi_main.c b/modules/rostests/winetests/psapi/psapi_main.c index a03605b173..9285334859 100644 --- a/modules/rostests/winetests/psapi/psapi_main.c +++ b/modules/rostests/winetests/psapi/psapi_main.c @@ -35,64 +35,30 @@ #include "winnt.h" #include "wine/winternl.h" #include "winnls.h" +#include "winuser.h" +#define PSAPI_VERSION 1 #include "psapi.h" #include "wine/test.h" -#define PSAPI_GET_PROC(func) \ - p ## func = (void*)GetProcAddress(hpsapi, #func); \ - if(!p ## func) { \ - ok(0, "GetProcAddress(%s) failed\n", #func); \ - FreeLibrary(hpsapi); \ - return FALSE; \ - } - -static BOOL (WINAPI *pEmptyWorkingSet)(HANDLE); -static BOOL (WINAPI *pEnumProcesses)(DWORD*, DWORD, DWORD*); -static BOOL (WINAPI *pEnumProcessModules)(HANDLE, HMODULE*, DWORD, LPDWORD); -static DWORD (WINAPI *pGetModuleBaseNameA)(HANDLE, HMODULE, LPSTR, DWORD); -static DWORD (WINAPI *pGetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, DWORD); -static DWORD (WINAPI *pGetModuleFileNameExW)(HANDLE, HMODULE, LPWSTR, DWORD); -static BOOL (WINAPI *pGetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD); -static DWORD (WINAPI *pGetMappedFileNameA)(HANDLE, LPVOID, LPSTR, DWORD); -static DWORD (WINAPI *pGetMappedFileNameW)(HANDLE, LPVOID, LPWSTR, DWORD); -static BOOL (WINAPI *pGetPerformanceInfo)(PPERFORMANCE_INFORMATION, DWORD); -static DWORD (WINAPI *pGetProcessImageFileNameA)(HANDLE, LPSTR, DWORD); -static DWORD (WINAPI *pGetProcessImageFileNameW)(HANDLE, LPWSTR, DWORD); -static BOOL (WINAPI *pGetProcessMemoryInfo)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD); -static BOOL (WINAPI *pGetWsChanges)(HANDLE, PPSAPI_WS_WATCH_INFORMATION, DWORD); -static BOOL (WINAPI *pInitializeProcessForWsWatch)(HANDLE); -static BOOL (WINAPI *pQueryWorkingSet)(HANDLE, PVOID, DWORD); static NTSTATUS (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); static NTSTATUS (WINAPI *pNtQueryVirtualMemory)(HANDLE, LPCVOID, ULONG, PVOID, SIZE_T, SIZE_T *); +static BOOL (WINAPI *pIsWow64Process)(HANDLE, BOOL *); +static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **); +static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *); + +static BOOL wow64; -static BOOL InitFunctionPtrs(HMODULE hpsapi) +static BOOL init_func_ptrs(void) { - PSAPI_GET_PROC(EmptyWorkingSet); - PSAPI_GET_PROC(EnumProcessModules); - PSAPI_GET_PROC(EnumProcesses); - PSAPI_GET_PROC(GetModuleBaseNameA); - PSAPI_GET_PROC(GetModuleFileNameExA); - PSAPI_GET_PROC(GetModuleFileNameExW); - PSAPI_GET_PROC(GetModuleInformation); - PSAPI_GET_PROC(GetMappedFileNameA); - PSAPI_GET_PROC(GetMappedFileNameW); - PSAPI_GET_PROC(GetProcessMemoryInfo); - PSAPI_GET_PROC(GetWsChanges); - PSAPI_GET_PROC(InitializeProcessForWsWatch); - PSAPI_GET_PROC(QueryWorkingSet); - /* GetProcessImageFileName is not exported on NT4 */ - pGetPerformanceInfo = - (void *)GetProcAddress(hpsapi, "GetPerformanceInfo"); - pGetProcessImageFileNameA = - (void *)GetProcAddress(hpsapi, "GetProcessImageFileNameA"); - pGetProcessImageFileNameW = - (void *)GetProcAddress(hpsapi, "GetProcessImageFileNameW"); pNtQuerySystemInformation = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQuerySystemInformation"); pNtQueryVirtualMemory = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQueryVirtualMemory"); + pIsWow64Process = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsWow64Process"); + pWow64DisableWow64FsRedirection = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "Wow64DisableWow64FsRedirection"); + pWow64RevertWow64FsRedirection = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "Wow64RevertWow64FsRedirection"); return TRUE; } -static HANDLE hpSR, hpQI, hpVR, hpQV, hpAA; +static HANDLE hpSR, hpQI, hpVR, hpQV; static const HANDLE hBad = (HANDLE)0xdeadbeef; static void test_EnumProcesses(void) @@ -100,59 +66,133 @@ static void test_EnumProcesses(void) DWORD pid, ret, cbUsed = 0xdeadbeef; SetLastError(0xdeadbeef); - ret = pEnumProcesses(NULL, 0, &cbUsed); + ret = EnumProcesses(NULL, 0, &cbUsed); ok(ret == 1, "failed with %d\n", GetLastError()); ok(cbUsed == 0, "cbUsed=%d\n", cbUsed); SetLastError(0xdeadbeef); - ret = pEnumProcesses(&pid, 4, &cbUsed); + ret = EnumProcesses(&pid, 4, &cbUsed); ok(ret == 1, "failed with %d\n", GetLastError()); ok(cbUsed == 4, "cbUsed=%d\n", cbUsed); } static void test_EnumProcessModules(void) { + char buffer[200] = "C:\\windows\\system32\\notepad.exe"; + PROCESS_INFORMATION pi = {0}; + STARTUPINFOA si = {0}; + void *cookie; HMODULE hMod; DWORD ret, cbNeeded = 0xdeadbeef; SetLastError(0xdeadbeef); - pEnumProcessModules(NULL, NULL, 0, &cbNeeded); + EnumProcessModules(NULL, NULL, 0, &cbNeeded); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pEnumProcessModules(hpQI, NULL, 0, &cbNeeded); + EnumProcessModules(hpQI, NULL, 0, &cbNeeded); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); hMod = (void *)0xdeadbeef; - ret = pEnumProcessModules(hpQI, &hMod, sizeof(HMODULE), NULL); + ret = EnumProcessModules(hpQI, &hMod, sizeof(HMODULE), NULL); ok(!ret, "succeeded\n"); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); hMod = (void *)0xdeadbeef; - ret = pEnumProcessModules(hpQV, &hMod, sizeof(HMODULE), NULL); + ret = EnumProcessModules(hpQV, &hMod, sizeof(HMODULE), NULL); ok(!ret, "succeeded\n"); ok(GetLastError() == ERROR_NOACCESS, "expected error=ERROR_NOACCESS but got %d\n", GetLastError()); ok(hMod == GetModuleHandleA(NULL), "hMod=%p GetModuleHandleA(NULL)=%p\n", hMod, GetModuleHandleA(NULL)); SetLastError(0xdeadbeef); - ret = pEnumProcessModules(hpQV, NULL, 0, &cbNeeded); + ret = EnumProcessModules(hpQV, NULL, 0, &cbNeeded); ok(ret == 1, "failed with %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pEnumProcessModules(hpQV, NULL, sizeof(HMODULE), &cbNeeded); + ret = EnumProcessModules(hpQV, NULL, sizeof(HMODULE), &cbNeeded); ok(!ret, "succeeded\n"); ok(GetLastError() == ERROR_NOACCESS, "expected error=ERROR_NOACCESS but got %d\n", GetLastError()); SetLastError(0xdeadbeef); hMod = (void *)0xdeadbeef; - ret = pEnumProcessModules(hpQV, &hMod, sizeof(HMODULE), &cbNeeded); + ret = EnumProcessModules(hpQV, &hMod, sizeof(HMODULE), &cbNeeded); ok(ret == 1, "got %d, failed with %d\n", ret, GetLastError()); ok(hMod == GetModuleHandleA(NULL), "hMod=%p GetModuleHandleA(NULL)=%p\n", hMod, GetModuleHandleA(NULL)); ok(cbNeeded % sizeof(hMod) == 0, "not a multiple of sizeof(HMODULE) cbNeeded=%d\n", cbNeeded); + + ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + ok(ret, "CreateProcess failed: %u\n", GetLastError()); + + ret = WaitForInputIdle(pi.hProcess, 1000); + ok(!ret, "wait timed out\n"); + + SetLastError(0xdeadbeef); + hMod = NULL; + ret = EnumProcessModules(pi.hProcess, &hMod, sizeof(HMODULE), &cbNeeded); + ok(ret == 1, "got %d, error %u\n", ret, GetLastError()); + ok(!!hMod, "expected non-NULL module\n"); + ok(cbNeeded % sizeof(hMod) == 0, "got %u\n", cbNeeded); + + TerminateProcess(pi.hProcess, 0); + + if (sizeof(void *) == 8) + { + MODULEINFO info; + char name[40]; + + strcpy(buffer, "C:\\windows\\syswow64\\notepad.exe"); + ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + ok(ret, "CreateProcess failed: %u\n", GetLastError()); + + ret = WaitForInputIdle(pi.hProcess, 1000); + ok(!ret, "wait timed out\n"); + + SetLastError(0xdeadbeef); + hMod = NULL; + ret = EnumProcessModules(pi.hProcess, &hMod, sizeof(HMODULE), &cbNeeded); + ok(ret == 1, "got %d, error %u\n", ret, GetLastError()); + ok(!!hMod, "expected non-NULL module\n"); + ok(cbNeeded % sizeof(hMod) == 0, "got %u\n", cbNeeded); + + ret = GetModuleBaseNameA(pi.hProcess, hMod, name, sizeof(name)); + ok(ret, "got error %u\n", GetLastError()); + ok(!strcmp(name, "notepad.exe"), "got %s\n", name); + + ret = GetModuleFileNameExA(pi.hProcess, hMod, name, sizeof(name)); + ok(ret, "got error %u\n", GetLastError()); +todo_wine + ok(!strcmp(name, buffer), "got %s\n", name); + + ret = GetModuleInformation(pi.hProcess, hMod, &info, sizeof(info)); + ok(ret, "got error %u\n", GetLastError()); + ok(info.lpBaseOfDll == hMod, "expected %p, got %p\n", hMod, info.lpBaseOfDll); + ok(info.SizeOfImage, "image size was 0\n"); + ok(info.EntryPoint >= info.lpBaseOfDll, "got entry point %p\n", info.EntryPoint); + + TerminateProcess(pi.hProcess, 0); + } + else if (wow64) + { + pWow64DisableWow64FsRedirection(&cookie); + ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + pWow64RevertWow64FsRedirection(cookie); + ok(ret, "CreateProcess failed: %u\n", GetLastError()); + + ret = WaitForInputIdle(pi.hProcess, 1000); + ok(!ret, "wait timed out\n"); + + SetLastError(0xdeadbeef); + ret = EnumProcessModules(pi.hProcess, &hMod, sizeof(HMODULE), &cbNeeded); + ok(!ret, "got %d\n", ret); +todo_wine + ok(GetLastError() == ERROR_PARTIAL_COPY, "got error %u\n", GetLastError()); + + TerminateProcess(pi.hProcess, 0); + } } static void test_GetModuleInformation(void) @@ -163,29 +203,29 @@ static void test_GetModuleInformation(void) DWORD ret; SetLastError(0xdeadbeef); - pGetModuleInformation(NULL, hMod, &info, sizeof(info)); + GetModuleInformation(NULL, hMod, &info, sizeof(info)); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetModuleInformation(hpQI, hMod, &info, sizeof(info)); + GetModuleInformation(hpQI, hMod, &info, sizeof(info)); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetModuleInformation(hpQV, hBad, &info, sizeof(info)); + GetModuleInformation(hpQV, hBad, &info, sizeof(info)); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetModuleInformation(hpQV, hMod, &info, sizeof(info)-1); + GetModuleInformation(hpQV, hMod, &info, sizeof(info)-1); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %d\n", GetLastError()); - ret = pGetModuleInformation(hpQV, hMod, &info, sizeof(info)); + ret = GetModuleInformation(hpQV, hMod, &info, sizeof(info)); ok(ret == 1, "failed with %d\n", GetLastError()); ok(info.lpBaseOfDll == hMod, "lpBaseOfDll=%p hMod=%p\n", info.lpBaseOfDll, hMod); hMod = LoadLibraryA("shell32.dll"); ok(hMod != NULL, "Failed to load shell32.dll, error: %u\n", GetLastError()); - ret = pGetModuleInformation(hpQV, hMod, &info, sizeof(info)); + ret = GetModuleInformation(hpQV, hMod, &info, sizeof(info)); ok(ret == 1, "failed with %d\n", GetLastError()); info.SizeOfImage /= sizeof(DWORD); for (tmp = (DWORD *)hMod; info.SizeOfImage; info.SizeOfImage--) @@ -208,15 +248,10 @@ static void test_GetPerformanceInfo(void) BOOL ret; SetLastError(0xdeadbeef); - ret = pGetPerformanceInfo(&info, sizeof(info)-1); + ret = GetPerformanceInfo(&info, sizeof(info)-1); ok(!ret, "GetPerformanceInfo unexpectedly succeeded\n"); ok(GetLastError() == ERROR_BAD_LENGTH, "expected error=ERROR_BAD_LENGTH but got %d\n", GetLastError()); - SetLastError(0xdeadbeef); - ret = pGetPerformanceInfo(&info, sizeof(info)); - ok(ret, "GetPerformanceInfo failed with %d\n", GetLastError()); - ok(info.cb == sizeof(PERFORMANCE_INFORMATION), "got %d\n", info.cb); - if (!pNtQuerySystemInformation) win_skip("NtQuerySystemInformation not found, skipping tests\n"); else @@ -233,6 +268,10 @@ static void test_GetPerformanceInfo(void) ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status); ok(size >= sizeof(SYSTEM_PERFORMANCE_INFORMATION), "incorrect length %d\n", size); + SetLastError(0xdeadbeef); + ret = GetPerformanceInfo(&info, sizeof(info)); + ok(ret, "GetPerformanceInfo failed with %d\n", GetLastError()); + ok(info.cb == sizeof(PERFORMANCE_INFORMATION), "got %d\n", info.cb); ok(check_with_margin(info.CommitTotal, sys_performance_info->TotalCommittedPages, 288), "expected approximately %ld but got %d\n", info.CommitTotal, sys_performance_info->TotalCommittedPages); @@ -297,7 +336,7 @@ static void test_GetPerformanceInfo(void) } HeapFree(GetProcessHeap(), 0, sys_process_info); - ok(check_with_margin(info.HandleCount, handle_count, 24), + ok(check_with_margin(info.HandleCount, handle_count, 256), "expected approximately %d but got %d\n", info.HandleCount, handle_count); ok(check_with_margin(info.ProcessCount, process_count, 4), @@ -315,22 +354,22 @@ static void test_GetProcessMemoryInfo(void) DWORD ret; SetLastError(0xdeadbeef); - ret = pGetProcessMemoryInfo(NULL, &pmc, sizeof(pmc)); + ret = GetProcessMemoryInfo(NULL, &pmc, sizeof(pmc)); ok(!ret, "GetProcessMemoryInfo should fail\n"); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetProcessMemoryInfo(hpSR, &pmc, sizeof(pmc)); + ret = GetProcessMemoryInfo(hpSR, &pmc, sizeof(pmc)); ok(!ret, "GetProcessMemoryInfo should fail\n"); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetProcessMemoryInfo(hpQI, &pmc, sizeof(pmc)-1); + ret = GetProcessMemoryInfo(hpQI, &pmc, sizeof(pmc)-1); ok(!ret, "GetProcessMemoryInfo should fail\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetProcessMemoryInfo(hpQI, &pmc, sizeof(pmc)); + ret = GetProcessMemoryInfo(hpQI, &pmc, sizeof(pmc)); ok(ret == 1, "failed with %d\n", GetLastError()); } @@ -380,17 +419,17 @@ static void test_GetMappedFileName(void) GetCurrentProcess(), ¤t_process, 0, 0, DUPLICATE_SAME_ACCESS ); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath)); + ret = GetMappedFileNameA(NULL, hMod, szMapPath, sizeof(szMapPath)); ok(!ret, "GetMappedFileName should fail\n"); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(hpSR, hMod, szMapPath, sizeof(szMapPath)); + ret = GetMappedFileNameA(hpSR, hMod, szMapPath, sizeof(szMapPath)); ok(!ret, "GetMappedFileName should fail\n"); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError( 0xdeadbeef ); - ret = pGetMappedFileNameA(hpQI, hMod, szMapPath, sizeof(szMapPath)); + ret = GetMappedFileNameA(hpQI, hMod, szMapPath, sizeof(szMapPath)); ok( ret || broken(GetLastError() == ERROR_UNEXP_NET_ERR), /* win2k */ "GetMappedFileNameA failed with error %u\n", GetLastError() ); if (ret) @@ -433,33 +472,34 @@ static void test_GetMappedFileName(void) ok(base != NULL, "MapViewOfFile error %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, 0); + ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, 0); ok(!ret, "GetMappedFileName should fail\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(GetCurrentProcess(), base, 0, sizeof(map_name)); + ret = GetMappedFileNameA(GetCurrentProcess(), base, 0, sizeof(map_name)); ok(!ret, "GetMappedFileName should fail\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, 1); + ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, 1); ok(ret == 1, "GetMappedFileName error %d\n", GetLastError()); ok(!map_name[0] || broken(map_name[0] == device_name[0]) /* before win2k */, "expected 0, got %c\n", map_name[0]); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name)); + ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name)); ok(ret, "GetMappedFileName error %d\n", GetLastError()); ok(ret > strlen(device_name), "map_name should be longer than device_name\n"); ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameW(GetCurrentProcess(), base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0])); + ret = GetMappedFileNameW(GetCurrentProcess(), base, map_nameW, ARRAY_SIZE(map_nameW)); +todo_wine { ok(ret, "GetMappedFileNameW error %d\n", GetLastError()); ok(ret > strlen(device_name), "map_name should be longer than device_name\n"); - - if (nt_get_mapped_file_name(GetCurrentProcess(), base, nt_map_name, sizeof(nt_map_name)/sizeof(nt_map_name[0]))) +} + if (nt_get_mapped_file_name(GetCurrentProcess(), base, nt_map_name, ARRAY_SIZE(nt_map_name))) { ok(memcmp(map_nameW, nt_map_name, lstrlenW(map_nameW)) == 0, "map name does not start with a device name: %s\n", map_name); WideCharToMultiByte(CP_ACP, 0, map_nameW, -1, map_name, MAX_PATH, NULL, NULL); @@ -467,7 +507,7 @@ static void test_GetMappedFileName(void) } SetLastError(0xdeadbeef); - ret = pGetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0])); + ret = GetMappedFileNameW(current_process, base, map_nameW, sizeof(map_nameW)/sizeof(map_nameW[0])); ok(ret, "GetMappedFileNameW error %d\n", GetLastError()); ok(ret > strlen(device_name), "map_name should be longer than device_name\n"); @@ -479,24 +519,24 @@ static void test_GetMappedFileName(void) } SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name)); + ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x2000, map_name, sizeof(map_name)); ok(ret, "GetMappedFileName error %d\n", GetLastError()); ok(ret > strlen(device_name), "map_name should be longer than device_name\n"); ok(memcmp(map_name, device_name, strlen(device_name)) == 0, "map name does not start with a device name: %s\n", map_name); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(GetCurrentProcess(), base + 0x4000, map_name, sizeof(map_name)); + ret = GetMappedFileNameA(GetCurrentProcess(), base + 0x4000, map_name, sizeof(map_name)); ok(!ret, "GetMappedFileName should fail\n"); ok(GetLastError() == ERROR_UNEXP_NET_ERR, "expected ERROR_UNEXP_NET_ERR, got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(GetCurrentProcess(), NULL, map_name, sizeof(map_name)); + ret = GetMappedFileNameA(GetCurrentProcess(), NULL, map_name, sizeof(map_name)); ok(!ret, "GetMappedFileName should fail\n"); todo_wine ok(GetLastError() == ERROR_UNEXP_NET_ERR, "expected ERROR_UNEXP_NET_ERR, got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(0, base, map_name, sizeof(map_name)); + ret = GetMappedFileNameA(0, base, map_name, sizeof(map_name)); ok(!ret, "GetMappedFileName should fail\n"); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); @@ -514,7 +554,7 @@ todo_wine ok(base != NULL, "MapViewOfFile error %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name)); + ret = GetMappedFileNameA(GetCurrentProcess(), base, map_name, sizeof(map_name)); ok(!ret, "GetMappedFileName should fail\n"); ok(GetLastError() == ERROR_FILE_INVALID, "expected ERROR_FILE_INVALID, got %d\n", GetLastError()); @@ -530,12 +570,9 @@ static void test_GetProcessImageFileName(void) WCHAR szImgPathW[MAX_PATH]; DWORD ret, ret1; - if(pGetProcessImageFileNameA == NULL) - return; - /* This function is available on WinXP+ only */ SetLastError(0xdeadbeef); - if(!pGetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath))) + if(!GetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath))) { if(GetLastError() == ERROR_INVALID_FUNCTION) { win_skip("GetProcessImageFileName not implemented\n"); @@ -549,19 +586,19 @@ static void test_GetProcessImageFileName(void) } SetLastError(0xdeadbeef); - pGetProcessImageFileNameA(NULL, szImgPath, sizeof(szImgPath)); + GetProcessImageFileNameA(NULL, szImgPath, sizeof(szImgPath)); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetProcessImageFileNameA(hpSR, szImgPath, sizeof(szImgPath)); + GetProcessImageFileNameA(hpSR, szImgPath, sizeof(szImgPath)); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetProcessImageFileNameA(hpQI, szImgPath, 0); + GetProcessImageFileNameA(hpQI, szImgPath, 0); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %d\n", GetLastError()); - ret = pGetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath)); - ret1 = pGetMappedFileNameA(hpQV, hMod, szMapPath, sizeof(szMapPath)); + ret = GetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath)); + ret1 = GetMappedFileNameA(hpQV, hMod, szMapPath, sizeof(szMapPath)); if(ret && ret1) { /* Windows returns 2*strlen-1 */ @@ -570,32 +607,32 @@ static void test_GetProcessImageFileName(void) } SetLastError(0xdeadbeef); - pGetProcessImageFileNameW(NULL, szImgPathW, sizeof(szImgPathW)); + GetProcessImageFileNameW(NULL, szImgPathW, ARRAY_SIZE(szImgPathW)); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); /* no information about correct buffer size returned: */ SetLastError(0xdeadbeef); - pGetProcessImageFileNameW(hpQI, szImgPathW, 0); + GetProcessImageFileNameW(hpQI, szImgPathW, 0); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetProcessImageFileNameW(hpQI, NULL, 0); + GetProcessImageFileNameW(hpQI, NULL, 0); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %d\n", GetLastError()); /* correct call */ memset(szImgPathW, 0xff, sizeof(szImgPathW)); - ret = pGetProcessImageFileNameW(hpQI, szImgPathW, sizeof(szImgPathW)/sizeof(WCHAR)); + ret = GetProcessImageFileNameW(hpQI, szImgPathW, ARRAY_SIZE(szImgPathW)); ok(ret > 0, "GetProcessImageFileNameW should have succeeded.\n"); ok(szImgPathW[0] == '\\', "GetProcessImageFileNameW should have returned an NT path.\n"); ok(lstrlenW(szImgPathW) == ret, "Expected length to be %d, got %d\n", ret, lstrlenW(szImgPathW)); /* boundary values of 'size' */ SetLastError(0xdeadbeef); - pGetProcessImageFileNameW(hpQI, szImgPathW, ret); + GetProcessImageFileNameW(hpQI, szImgPathW, ret); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "expected error=ERROR_INSUFFICIENT_BUFFER but got %d\n", GetLastError()); memset(szImgPathW, 0xff, sizeof(szImgPathW)); - ret = pGetProcessImageFileNameW(hpQI, szImgPathW, ret + 1); + ret = GetProcessImageFileNameW(hpQI, szImgPathW, ret + 1); ok(ret > 0, "GetProcessImageFileNameW should have succeeded.\n"); ok(szImgPathW[0] == '\\', "GetProcessImageFileNameW should have returned an NT path.\n"); ok(lstrlenW(szImgPathW) == ret, "Expected length to be %d, got %d\n", ret, lstrlenW(szImgPathW)); @@ -609,21 +646,21 @@ static void test_GetModuleFileNameEx(void) DWORD ret; SetLastError(0xdeadbeef); - ret = pGetModuleFileNameExA(NULL, hMod, szModExPath, sizeof(szModExPath)); + ret = GetModuleFileNameExA(NULL, hMod, szModExPath, sizeof(szModExPath)); ok( !ret, "GetModuleFileNameExA succeeded\n" ); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetModuleFileNameExA(hpQI, hMod, szModExPath, sizeof(szModExPath)); + ret = GetModuleFileNameExA(hpQI, hMod, szModExPath, sizeof(szModExPath)); ok( !ret, "GetModuleFileNameExA succeeded\n" ); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetModuleFileNameExA(hpQV, hBad, szModExPath, sizeof(szModExPath)); + ret = GetModuleFileNameExA(hpQV, hBad, szModExPath, sizeof(szModExPath)); ok( !ret, "GetModuleFileNameExA succeeded\n" ); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); - ret = pGetModuleFileNameExA(hpQV, NULL, szModExPath, sizeof(szModExPath)); + ret = GetModuleFileNameExA(hpQV, NULL, szModExPath, sizeof(szModExPath)); if(!ret) return; ok(ret == strlen(szModExPath), "szModExPath=\"%s\" ret=%d\n", szModExPath, ret); @@ -633,7 +670,7 @@ static void test_GetModuleFileNameEx(void) SetLastError(0xdeadbeef); memset( szModExPath, 0xcc, sizeof(szModExPath) ); - ret = pGetModuleFileNameExA(hpQV, NULL, szModExPath, 4 ); + ret = GetModuleFileNameExA(hpQV, NULL, szModExPath, 4 ); ok( ret == 4 || ret == strlen(szModExPath), "wrong length %u\n", ret ); ok( broken(szModExPath[3]) /*w2kpro*/ || strlen(szModExPath) == 3, "szModExPath=\"%s\" ret=%d\n", szModExPath, ret ); @@ -642,14 +679,14 @@ static void test_GetModuleFileNameEx(void) if (0) /* crashes on Windows 10 */ { SetLastError(0xdeadbeef); - ret = pGetModuleFileNameExA(hpQV, NULL, szModExPath, 0 ); + ret = GetModuleFileNameExA(hpQV, NULL, szModExPath, 0 ); ok( ret == 0, "wrong length %u\n", ret ); ok(GetLastError() == ERROR_INVALID_PARAMETER, "got error %d\n", GetLastError()); } SetLastError(0xdeadbeef); memset( buffer, 0xcc, sizeof(buffer) ); - ret = pGetModuleFileNameExW(hpQV, NULL, buffer, 4 ); + ret = GetModuleFileNameExW(hpQV, NULL, buffer, 4 ); ok( ret == 4 || ret == lstrlenW(buffer), "wrong length %u\n", ret ); ok( broken(buffer[3]) /*w2kpro*/ || lstrlenW(buffer) == 3, "buffer=%s ret=%d\n", wine_dbgstr_w(buffer), ret ); @@ -659,7 +696,7 @@ static void test_GetModuleFileNameEx(void) { SetLastError(0xdeadbeef); buffer[0] = 0xcc; - ret = pGetModuleFileNameExW(hpQV, NULL, buffer, 0 ); + ret = GetModuleFileNameExW(hpQV, NULL, buffer, 0 ); ok( ret == 0, "wrong length %u\n", ret ); ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError()); ok( buffer[0] == 0xcc, "buffer modified %s\n", wine_dbgstr_w(buffer) ); @@ -673,18 +710,18 @@ static void test_GetModuleBaseName(void) DWORD ret; SetLastError(0xdeadbeef); - pGetModuleBaseNameA(NULL, hMod, szModBaseName, sizeof(szModBaseName)); + GetModuleBaseNameA(NULL, hMod, szModBaseName, sizeof(szModBaseName)); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetModuleBaseNameA(hpQI, hMod, szModBaseName, sizeof(szModBaseName)); + GetModuleBaseNameA(hpQI, hMod, szModBaseName, sizeof(szModBaseName)); ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pGetModuleBaseNameA(hpQV, hBad, szModBaseName, sizeof(szModBaseName)); + GetModuleBaseNameA(hpQV, hBad, szModBaseName, sizeof(szModBaseName)); ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); - ret = pGetModuleBaseNameA(hpQV, NULL, szModBaseName, sizeof(szModBaseName)); + ret = GetModuleBaseNameA(hpQV, NULL, szModBaseName, sizeof(szModBaseName)); if(!ret) return; ok(ret == strlen(szModBaseName), "szModBaseName=\"%s\" ret=%d\n", szModBaseName, ret); @@ -697,24 +734,29 @@ static void test_ws_functions(void) { PSAPI_WS_WATCH_INFORMATION wswi[4096]; ULONG_PTR pages[4096]; + HANDLE ws_handle; char *addr; unsigned int i; BOOL ret; + ws_handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_SET_QUOTA | + PROCESS_SET_INFORMATION, FALSE, GetCurrentProcessId()); + ok(!!ws_handle, "got error %u\n", GetLastError()); + SetLastError(0xdeadbeef); - pEmptyWorkingSet(NULL); + EmptyWorkingSet(NULL); todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - pEmptyWorkingSet(hpSR); + EmptyWorkingSet(hpSR); todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pEmptyWorkingSet(hpAA); + ret = EmptyWorkingSet(ws_handle); ok(ret == 1, "failed with %d\n", GetLastError()); SetLastError( 0xdeadbeef ); - ret = pInitializeProcessForWsWatch( NULL ); + ret = InitializeProcessForWsWatch( NULL ); todo_wine ok( !ret, "InitializeProcessForWsWatch succeeded\n" ); if (!ret) { @@ -726,7 +768,7 @@ static void test_ws_functions(void) ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() ); } SetLastError(0xdeadbeef); - ret = pInitializeProcessForWsWatch(hpAA); + ret = InitializeProcessForWsWatch(ws_handle); ok(ret == 1, "failed with %d\n", GetLastError()); addr = VirtualAlloc(NULL, 1, MEM_COMMIT, PAGE_READWRITE); @@ -741,7 +783,7 @@ static void test_ws_functions(void) } SetLastError(0xdeadbeef); - ret = pQueryWorkingSet(hpQI, pages, 4096 * sizeof(ULONG_PTR)); + ret = QueryWorkingSet(hpQI, pages, 4096 * sizeof(ULONG_PTR)); todo_wine ok(ret == 1, "failed with %d\n", GetLastError()); if(ret == 1) { @@ -757,7 +799,7 @@ static void test_ws_functions(void) test_gwsc: SetLastError(0xdeadbeef); - ret = pGetWsChanges(hpQI, wswi, sizeof(wswi)); + ret = GetWsChanges(hpQI, wswi, sizeof(wswi)); todo_wine ok(ret == 1, "failed with %d\n", GetLastError()); if(ret == 1) { @@ -777,43 +819,35 @@ free_page: START_TEST(psapi_main) { - HMODULE hpsapi = LoadLibraryA("psapi.dll"); + DWORD pid = GetCurrentProcessId(); - if(!hpsapi) - { - win_skip("Could not load psapi.dll\n"); - return; - } + init_func_ptrs(); - if(InitFunctionPtrs(hpsapi)) - { - DWORD pid = GetCurrentProcessId(); + if (pIsWow64Process) + IsWow64Process(GetCurrentProcess(), &wow64); hpSR = OpenProcess(STANDARD_RIGHTS_REQUIRED, FALSE, pid); + ok(!!hpSR, "got error %u\n", GetLastError()); hpQI = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); + ok(!!hpQI, "got error %u\n", GetLastError()); hpVR = OpenProcess(PROCESS_VM_READ, FALSE, pid); + ok(!!hpVR, "got error %u\n", GetLastError()); hpQV = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid); - hpAA = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); - - if(hpSR && hpQI && hpVR && hpQV && hpAA) - { - test_EnumProcesses(); - test_EnumProcessModules(); - test_GetModuleInformation(); - test_GetPerformanceInfo(); - test_GetProcessMemoryInfo(); - test_GetMappedFileName(); - test_GetProcessImageFileName(); - test_GetModuleFileNameEx(); - test_GetModuleBaseName(); - test_ws_functions(); - } - CloseHandle(hpSR); - CloseHandle(hpQI); - CloseHandle(hpVR); - CloseHandle(hpQV); - CloseHandle(hpAA); - } - - FreeLibrary(hpsapi); + ok(!!hpQV, "got error %u\n", GetLastError()); + + test_EnumProcesses(); + test_EnumProcessModules(); + test_GetModuleInformation(); + test_GetPerformanceInfo(); + test_GetProcessMemoryInfo(); + test_GetMappedFileName(); + test_GetProcessImageFileName(); + test_GetModuleFileNameEx(); + test_GetModuleBaseName(); + test_ws_functions(); + + CloseHandle(hpSR); + CloseHandle(hpQI); + CloseHandle(hpVR); + CloseHandle(hpQV); }
5 years, 10 months
1
0
0
0
[reactos] 01/01: [PROPSYS_WINETEST] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8bc8ae005fee89dec0faa…
commit 8bc8ae005fee89dec0faa1407cf8fd64d2d1d230 Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 13:29:12 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 13:29:12 2019 +0100 [PROPSYS_WINETEST] Sync with Wine Staging 4.0. CORE-15682 --- modules/rostests/winetests/propsys/propstore.c | 1 + modules/rostests/winetests/propsys/propsys.c | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/rostests/winetests/propsys/propstore.c b/modules/rostests/winetests/propsys/propstore.c index 01500dd3f9..3fe8613a8b 100644 --- a/modules/rostests/winetests/propsys/propstore.c +++ b/modules/rostests/winetests/propsys/propstore.c @@ -214,6 +214,7 @@ static void test_persistserialized(void) if (FAILED(hr)) { + IPropertyStore_Release(propstore); skip("IPersistSerializedPropStorage not supported\n"); return; } diff --git a/modules/rostests/winetests/propsys/propsys.c b/modules/rostests/winetests/propsys/propsys.c index a6c7023527..34c51b382b 100644 --- a/modules/rostests/winetests/propsys/propsys.c +++ b/modules/rostests/winetests/propsys/propsys.c @@ -133,7 +133,7 @@ static void test_PSStringFromPropertyKey(void) int i; - for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++) + for (i = 0; i < ARRAY_SIZE(testcases); i++) { if (testcases[i].psz) memcpy(testcases[i].psz, fillerW, PKEYSTR_MAX * sizeof(WCHAR)); @@ -413,7 +413,7 @@ static void test_PSPropertyKeyFromString(void) int i; - for (i = 0; i < sizeof(testcases)/sizeof(testcases[0]); i++) + for (i = 0; i < ARRAY_SIZE(testcases); i++) { if (testcases[i].pkey) *testcases[i].pkey = out_init; @@ -480,7 +480,7 @@ static void test_InitPropVariantFromGUIDAsString(void) InitVariantFromGUIDAsString(&IID_NULL, NULL); } - for(i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++) { + for(i=0; i < ARRAY_SIZE(testcases); i++) { memset(&propvar, 0, sizeof(PROPVARIANT)); hres = InitPropVariantFromGUIDAsString(testcases[i].guid, &propvar); ok(hres == S_OK, "%d) InitPropVariantFromGUIDAsString returned %x\n", i, hres); @@ -1230,6 +1230,24 @@ static void test_PropVariantChangeType_LPWSTR(void) PropVariantClear(&src); } +static void test_InitPropVariantFromCLSID(void) +{ + PROPVARIANT propvar; + GUID clsid; + HRESULT hr; + + memset(&propvar, 0, sizeof(propvar)); + propvar.vt = VT_I4; + propvar.u.lVal = 15; + + memset(&clsid, 0xcc, sizeof(clsid)); + hr = InitPropVariantFromCLSID(&clsid, &propvar); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(propvar.vt == VT_CLSID, "Unexpected type %d.\n", propvar.vt); + ok(IsEqualGUID(propvar.u.puuid, &clsid), "Unexpected puuid value.\n"); + PropVariantClear(&propvar); +} + START_TEST(propsys) { test_PSStringFromPropertyKey(); @@ -1244,4 +1262,5 @@ START_TEST(propsys) test_PropVariantChangeType_LPWSTR(); test_PropVariantToBoolean(); test_PropVariantToStringWithDefault(); + test_InitPropVariantFromCLSID(); }
5 years, 10 months
1
0
0
0
[reactos] 01/01: [PSDK] Update propvarutil.h. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2801bfeea1e25e0db92fa…
commit 2801bfeea1e25e0db92fa96674d5f9dcbdc8ffbd Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 13:28:43 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 13:28:43 2019 +0100 [PSDK] Update propvarutil.h. CORE-15682 --- sdk/include/psdk/propvarutil.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/include/psdk/propvarutil.h b/sdk/include/psdk/propvarutil.h index ced51ec295..0285cafbb4 100644 --- a/sdk/include/psdk/propvarutil.h +++ b/sdk/include/psdk/propvarutil.h @@ -64,6 +64,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar); HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar); HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar); +HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar); HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar); HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid); HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
5 years, 10 months
1
0
0
0
[reactos] 01/01: [PROPSYS] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ab64b474976e394827b75…
commit ab64b474976e394827b754083984442c68a1c03d Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 13:28:11 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 13:28:11 2019 +0100 [PROPSYS] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/propsys/propsys.spec | 2 +- dll/win32/propsys/propvar.c | 13 +++++++++++++ media/doc/README.WINE | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dll/win32/propsys/propsys.spec b/dll/win32/propsys/propsys.spec index 73161a87a8..f496006393 100644 --- a/dll/win32/propsys/propsys.spec +++ b/dll/win32/propsys/propsys.spec @@ -30,7 +30,7 @@ @ stdcall -private DllUnregisterServer() @ stub InitPropVariantFromBooleanVector @ stdcall InitPropVariantFromBuffer(ptr long ptr) -@ stub InitPropVariantFromCLSID +@ stdcall InitPropVariantFromCLSID(ptr ptr) @ stub InitPropVariantFromDoubleVector @ stub InitPropVariantFromFileTime @ stub InitPropVariantFromFileTimeVector diff --git a/dll/win32/propsys/propvar.c b/dll/win32/propsys/propvar.c index f0877329af..05ded2e154 100644 --- a/dll/win32/propsys/propvar.c +++ b/dll/win32/propsys/propvar.c @@ -570,6 +570,19 @@ HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *p return S_OK; } +HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar) +{ + TRACE("(%s %p)\n", debugstr_guid(clsid), ppropvar); + + ppropvar->u.puuid = CoTaskMemAlloc(sizeof(*ppropvar->u.puuid)); + if(!ppropvar->u.puuid) + return E_OUTOFMEMORY; + + ppropvar->vt = VT_CLSID; + memcpy(ppropvar->u.puuid, clsid, sizeof(*ppropvar->u.puuid)); + return S_OK; +} + HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar) { SAFEARRAY *arr; diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 6ca08c7acd..6fb3564947 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -151,7 +151,7 @@ reactos/dll/win32/pdh # Synced to WineStaging-4.0 reactos/dll/win32/pidgen # Synced to WineStaging-4.0 reactos/dll/win32/powrprof # Forked at Wine-1.0rc5 reactos/dll/win32/printui # Synced to WineStaging-3.3 -reactos/dll/win32/propsys # Synced to WineStaging-3.9 +reactos/dll/win32/propsys # Synced to WineStaging-4.0 reactos/dll/win32/pstorec # Synced to WineStaging-3.3 reactos/dll/win32/qmgr # Synced to WineStaging-3.3 reactos/dll/win32/qmgrprxy # Synced to WineStaging-2.9
5 years, 10 months
1
0
0
0
[reactos] 01/01: [PIDGEN] Sync with Wine Staging 4.0. CORE-15682
by Amine Khaldi
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=59e9abd907828625ba810…
commit 59e9abd907828625ba8105831a1c1cde1478924d Author: Amine Khaldi <amine.khaldi(a)reactos.org> AuthorDate: Sat Feb 2 13:27:41 2019 +0100 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sat Feb 2 13:27:41 2019 +0100 [PIDGEN] Sync with Wine Staging 4.0. CORE-15682 --- dll/win32/pidgen/main.c | 7 +++++++ dll/win32/pidgen/pidgen.spec | 2 +- media/doc/README.WINE | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dll/win32/pidgen/main.c b/dll/win32/pidgen/main.c index cf165eae13..95f5389cc0 100644 --- a/dll/win32/pidgen/main.c +++ b/dll/win32/pidgen/main.c @@ -50,3 +50,10 @@ int WINAPI PIDGenSimpA(LPCSTR str, int p1, int p2, int p3, int p4, int p5, int p return 0; } + +int WINAPI PIDGenSimpW(const WCHAR* str, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) +{ + FIXME("%s,%d,%d,%d,%d,%d,%d,%d,%d\n", debugstr_w(str), p1, p2, p3, p4, p5, p6, p7, p8); + + return 0; +} diff --git a/dll/win32/pidgen/pidgen.spec b/dll/win32/pidgen/pidgen.spec index 8b7e778b91..aba010715f 100644 --- a/dll/win32/pidgen/pidgen.spec +++ b/dll/win32/pidgen/pidgen.spec @@ -1,7 +1,7 @@ @ stub PIDGenA @ stub PIDGenW @ stdcall PIDGenSimpA(str long long long long long long long long) -@ stub PIDGenSimpW +@ stdcall PIDGenSimpW(wstr long long long long long long long long) @ stub SetupPIDGenA @ stub SetupPIDGenW @ stub VerifyPIDSequenceW diff --git a/media/doc/README.WINE b/media/doc/README.WINE index d82d26ee10..6ca08c7acd 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -148,7 +148,7 @@ reactos/dll/win32/olepro32 # Synced to WineStaging-3.3 reactos/dll/win32/olesvr32 # Synced to WineStaging-3.3 reactos/dll/win32/olethk32 # Synced to WineStaging-3.3 reactos/dll/win32/pdh # Synced to WineStaging-4.0 -reactos/dll/win32/pidgen # Synced to WineStaging-3.9 +reactos/dll/win32/pidgen # Synced to WineStaging-4.0 reactos/dll/win32/powrprof # Forked at Wine-1.0rc5 reactos/dll/win32/printui # Synced to WineStaging-3.3 reactos/dll/win32/propsys # Synced to WineStaging-3.9
5 years, 10 months
1
0
0
0
← Newer
1
...
17
18
19
20
21
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
Results per page:
10
25
50
100
200