Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ea755999
Commit
ea755999
authored
Aug 08, 2006
by
Clinton Stimpson
Committed by
Alexandre Julliard
Aug 10, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Fix crash with NULL lParam in EM_SETTEXTEX.
parent
8b1b3818
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
2 deletions
+77
-2
editor.c
dlls/riched20/editor.c
+2
-2
editor.c
dlls/riched20/tests/editor.c
+75
-0
No files found.
dlls/riched20/editor.c
View file @
ea755999
...
...
@@ -1622,7 +1622,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
{
LPWSTR
wszText
=
(
LPWSTR
)
lParam
;
SETTEXTEX
*
pStruct
=
(
SETTEXTEX
*
)
wParam
;
size_t
len
=
lstrlenW
(
wszText
)
;
size_t
len
=
wszText
?
lstrlenW
(
wszText
)
:
0
;
int
from
,
to
;
ME_Style
*
style
;
TRACE
(
"EM_SETTEXEX - %s, flags %d, cp %d
\n
"
,
debugstr_w
(
wszText
),
(
int
)
pStruct
->
flags
,
pStruct
->
codepage
);
...
...
@@ -1640,7 +1640,7 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
}
else
{
ME_InternalDeleteText
(
editor
,
0
,
ME_GetTextLength
(
editor
));
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
-
1
,
editor
->
pBuffer
->
pDefaultStyle
);
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
editor
->
pBuffer
->
pDefaultStyle
);
len
=
1
;
}
ME_CommitUndo
(
editor
);
...
...
dlls/riched20/tests/editor.c
View file @
ea755999
...
...
@@ -898,6 +898,80 @@ static void test_ES_PASSWORD()
"EM_GETPASSWORDCHAR returned %c (%d) when set to 'x', instead of x (120)
\n
"
,
result
,
result
);
}
static
void
test_EM_SETTEXTEX
()
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
SETTEXTEX
setText
;
GETTEXTEX
getText
;
WCHAR
TestItem1
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
'S'
,
'o'
,
'm'
,
'e'
,
'T'
,
'e'
,
'x'
,
't'
,
0
};
#define MAX_BUF_LEN 1024
WCHAR
buf
[
MAX_BUF_LEN
];
int
result
;
CHARRANGE
cr
;
setText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
cb
=
MAX_BUF_LEN
;
getText
.
flags
=
GT_DEFAULT
;
setText
.
flags
=
0
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
buf
);
ok
(
lstrcmpW
(
buf
,
TestItem1
)
==
0
,
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX
\n
"
);
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
NULL
);
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
buf
);
ok
(
result
==
1
,
"EM_SETTEXTEX returned %d, instead of 1
\n
"
,
result
);
ok
(
lstrlenW
(
buf
)
==
0
,
"EM_SETTEXTEX with NULL lParam should clear rich edit.
\n
"
);
/* put some text back */
setText
.
flags
=
0
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
/* select some text */
cr
.
cpMax
=
1
;
cr
.
cpMin
=
3
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* replace current selection */
setText
.
flags
=
ST_SELECTION
;
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
NULL
);
ok
(
result
==
0
,
"EM_SETTEXTEX with NULL lParam to replace selection"
" with no text should return 0. Got %i
\n
"
,
result
);
/* put some text back */
setText
.
flags
=
0
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
/* select some text */
cr
.
cpMax
=
1
;
cr
.
cpMin
=
3
;
SendMessage
(
hwndRichEdit
,
EM_EXSETSEL
,
0
,
(
LPARAM
)
&
cr
);
/* replace current selection */
setText
.
flags
=
ST_SELECTION
;
result
=
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
TestItem1
);
/* get text */
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
buf
);
ok
(
result
==
lstrlenW
(
TestItem1
),
"EM_SETTEXTEX with NULL lParam to replace selection"
" with no text should return 0. Got %i
\n
"
,
result
);
ok
(
lstrlenW
(
buf
)
==
22
,
"EM_SETTEXTEX to replace selection with more text failed: %i.
\n
"
,
lstrlenW
(
buf
)
);
DestroyWindow
(
hwndRichEdit
);
}
START_TEST
(
editor
)
{
MSG
msg
;
...
...
@@ -918,6 +992,7 @@ START_TEST( editor )
test_EM_AUTOURLDETECT
();
test_EM_SETUNDOLIMIT
();
test_ES_PASSWORD
();
test_EM_SETTEXTEX
();
/* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment