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
390a248e
Commit
390a248e
authored
Aug 26, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Aug 27, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Return the number of characters copied in WM_GETTEXT even if the buffer is too small.
parent
b9d955b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
3 deletions
+37
-3
status.c
dlls/comctl32/status.c
+8
-3
status.c
dlls/comctl32/tests/status.c
+29
-0
No files found.
dlls/comctl32/status.c
View file @
390a248e
...
...
@@ -1016,12 +1016,17 @@ STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf)
len
=
strlenW
(
infoPtr
->
parts
[
0
].
text
);
if
(
size
>
len
)
{
if
(
!
size
)
return
len
;
else
if
(
size
>
len
)
{
strcpyW
(
buf
,
infoPtr
->
parts
[
0
].
text
);
return
len
;
}
return
-
1
;
else
{
memcpy
(
buf
,
infoPtr
->
parts
[
0
].
text
,
(
size
-
1
)
*
sizeof
(
WCHAR
));
buf
[
size
-
1
]
=
0
;
return
size
-
1
;
}
}
...
...
dlls/comctl32/tests/status.c
View file @
390a248e
...
...
@@ -466,6 +466,34 @@ static void test_status_ownerdraw(void)
SetWindowLongPtr
(
g_hMainWnd
,
GWLP_WNDPROC
,
(
LONG_PTR
)
g_wndproc_saved
);
}
static
void
test_gettext
(
void
)
{
HWND
hwndStatus
=
CreateWindow
(
SUBCLASS_NAME
,
NULL
,
WS_CHILD
|
WS_VISIBLE
,
0
,
0
,
300
,
20
,
g_hMainWnd
,
NULL
,
NULL
,
NULL
);
char
buf
[
5
];
int
r
;
r
=
SendMessage
(
hwndStatus
,
SB_SETTEXT
,
0
,
(
LPARAM
)
"Text"
);
expect
(
TRUE
,
r
);
r
=
SendMessage
(
hwndStatus
,
WM_GETTEXTLENGTH
,
0
,
0
);
expect
(
4
,
r
);
/* A size of 0 returns the length of the text */
r
=
SendMessage
(
hwndStatus
,
WM_GETTEXT
,
0
,
0
);
expect
(
4
,
r
);
/* A size of 1 only stores the NULL terminator */
buf
[
0
]
=
0xa
;
r
=
SendMessage
(
hwndStatus
,
WM_GETTEXT
,
1
,
(
LPARAM
)
buf
);
expect
(
0
,
r
);
ok
(
!
buf
[
0
],
"expected empty buffer
\n
"
);
/* A size of 2 returns a length 1 */
r
=
SendMessage
(
hwndStatus
,
WM_GETTEXT
,
2
,
(
LPARAM
)
buf
);
expect
(
1
,
r
);
r
=
SendMessage
(
hwndStatus
,
WM_GETTEXT
,
sizeof
(
buf
),
(
LPARAM
)
buf
);
expect
(
4
,
r
);
ok
(
!
strcmp
(
buf
,
"Text"
),
"expected Text, got %s
\n
"
,
buf
);
DestroyWindow
(
hwndStatus
);
}
START_TEST
(
status
)
{
hinst
=
GetModuleHandleA
(
NULL
);
...
...
@@ -483,4 +511,5 @@ START_TEST(status)
test_create
();
test_height
();
test_status_ownerdraw
();
test_gettext
();
}
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