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
f39d39e3
Commit
f39d39e3
authored
May 02, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add an exception handler around LB_GETTEXT to hide a Delphi bug.
parent
cedfd3f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
listbox.c
dlls/user32/listbox.c
+22
-7
No files found.
dlls/user32/listbox.c
View file @
f39d39e3
...
...
@@ -43,6 +43,7 @@
#include "wine/unicode.h"
#include "user_private.h"
#include "controls.h"
#include "wine/exception.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
listbox
);
...
...
@@ -799,6 +800,8 @@ static BOOL LISTBOX_SetTabStops( LB_DESCR *descr, INT count, LPINT tabs, BOOL sh
*/
static
LRESULT
LISTBOX_GetText
(
LB_DESCR
*
descr
,
INT
index
,
LPWSTR
buffer
,
BOOL
unicode
)
{
DWORD
len
;
if
((
index
<
0
)
||
(
index
>=
descr
->
nb_items
))
{
SetLastError
(
ERROR_INVALID_INDEX
);
...
...
@@ -808,7 +811,7 @@ static LRESULT LISTBOX_GetText( LB_DESCR *descr, INT index, LPWSTR buffer, BOOL
{
if
(
!
buffer
)
{
DWORD
len
=
strlenW
(
descr
->
items
[
index
].
str
);
len
=
strlenW
(
descr
->
items
[
index
].
str
);
if
(
unicode
)
return
len
;
return
WideCharToMultiByte
(
CP_ACP
,
0
,
descr
->
items
[
index
].
str
,
len
,
...
...
@@ -817,20 +820,32 @@ static LRESULT LISTBOX_GetText( LB_DESCR *descr, INT index, LPWSTR buffer, BOOL
TRACE
(
"index %d (0x%04x) %s
\n
"
,
index
,
index
,
debugstr_w
(
descr
->
items
[
index
].
str
));
if
(
unicode
)
__TRY
/* hide a Delphi bug that passes a read-only buffer */
{
strcpyW
(
buffer
,
descr
->
items
[
index
].
str
);
return
strlenW
(
buffer
);
if
(
unicode
)
{
strcpyW
(
buffer
,
descr
->
items
[
index
].
str
);
len
=
strlenW
(
buffer
);
}
else
{
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
descr
->
items
[
index
].
str
,
-
1
,
(
LPSTR
)
buffer
,
0x7FFFFFFF
,
NULL
,
NULL
)
-
1
;
}
}
else
__EXCEPT_PAGE_FAULT
{
return
WideCharToMultiByte
(
CP_ACP
,
0
,
descr
->
items
[
index
].
str
,
-
1
,
(
LPSTR
)
buffer
,
0x7FFFFFFF
,
NULL
,
NULL
)
-
1
;
WARN
(
"got an invalid buffer (Delphi bug?)
\n
"
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
LB_ERR
;
}
__ENDTRY
}
else
{
if
(
buffer
)
*
((
LPDWORD
)
buffer
)
=*
(
LPDWORD
)(
&
descr
->
items
[
index
].
data
);
return
sizeof
(
DWORD
);
len
=
sizeof
(
DWORD
);
}
return
len
;
}
static
inline
INT
LISTBOX_lstrcmpiW
(
LCID
lcid
,
LPCWSTR
str1
,
LPCWSTR
str2
)
...
...
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