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
4cc3b97e
Commit
4cc3b97e
authored
May 14, 2005
by
Paul Vriens
Committed by
Alexandre Julliard
May 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for a NULL pointer in GetWindowTextA/W.
parent
bfec8c22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
win.c
dlls/user/tests/win.c
+11
-0
win.c
dlls/user/win.c
+4
-0
No files found.
dlls/user/tests/win.c
View file @
4cc3b97e
...
@@ -2771,6 +2771,15 @@ void test_scroll()
...
@@ -2771,6 +2771,15 @@ void test_scroll()
DestroyWindow
(
hwnd
);
DestroyWindow
(
hwnd
);
}
}
static
void
test_params
()
{
INT
rc
;
/* Just a param check */
SetLastError
(
0xdeadbeef
);
rc
=
GetWindowText
(
hwndMain2
,
NULL
,
1024
);
ok
(
rc
==
0
,
"GetWindowText: rc=%d err=%ld
\n
"
,
rc
,
GetLastError
());
}
START_TEST
(
win
)
START_TEST
(
win
)
{
{
...
@@ -2810,6 +2819,8 @@ START_TEST(win)
...
@@ -2810,6 +2819,8 @@ START_TEST(win)
assert
(
hwndMain
);
assert
(
hwndMain
);
assert
(
hwndMain2
);
assert
(
hwndMain2
);
test_params
();
test_capture_1
();
test_capture_1
();
test_capture_2
();
test_capture_2
();
test_capture_3
(
hwndMain
,
hwndMain2
);
test_capture_3
(
hwndMain
,
hwndMain2
);
...
...
dlls/user/win.c
View file @
4cc3b97e
...
@@ -2223,6 +2223,8 @@ INT WINAPI GetWindowTextA( HWND hwnd, LPSTR lpString, INT nMaxCount )
...
@@ -2223,6 +2223,8 @@ INT WINAPI GetWindowTextA( HWND hwnd, LPSTR lpString, INT nMaxCount )
{
{
WCHAR
*
buffer
;
WCHAR
*
buffer
;
if
(
!
lpString
)
return
0
;
if
(
WIN_IsCurrentProcess
(
hwnd
))
if
(
WIN_IsCurrentProcess
(
hwnd
))
return
(
INT
)
SendMessageA
(
hwnd
,
WM_GETTEXT
,
nMaxCount
,
(
LPARAM
)
lpString
);
return
(
INT
)
SendMessageA
(
hwnd
,
WM_GETTEXT
,
nMaxCount
,
(
LPARAM
)
lpString
);
...
@@ -2266,6 +2268,8 @@ INT WINAPI InternalGetWindowText(HWND hwnd,LPWSTR lpString,INT nMaxCount )
...
@@ -2266,6 +2268,8 @@ INT WINAPI InternalGetWindowText(HWND hwnd,LPWSTR lpString,INT nMaxCount )
*/
*/
INT
WINAPI
GetWindowTextW
(
HWND
hwnd
,
LPWSTR
lpString
,
INT
nMaxCount
)
INT
WINAPI
GetWindowTextW
(
HWND
hwnd
,
LPWSTR
lpString
,
INT
nMaxCount
)
{
{
if
(
!
lpString
)
return
0
;
if
(
WIN_IsCurrentProcess
(
hwnd
))
if
(
WIN_IsCurrentProcess
(
hwnd
))
return
(
INT
)
SendMessageW
(
hwnd
,
WM_GETTEXT
,
nMaxCount
,
(
LPARAM
)
lpString
);
return
(
INT
)
SendMessageW
(
hwnd
,
WM_GETTEXT
,
nMaxCount
,
(
LPARAM
)
lpString
);
...
...
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