Commit 4cc3b97e authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

Check for a NULL pointer in GetWindowTextA/W.

parent bfec8c22
......@@ -2771,6 +2771,15 @@ void test_scroll()
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)
{
......@@ -2810,6 +2819,8 @@ START_TEST(win)
assert( hwndMain );
assert( hwndMain2 );
test_params();
test_capture_1();
test_capture_2();
test_capture_3(hwndMain, hwndMain2);
......
......@@ -2223,6 +2223,8 @@ INT WINAPI GetWindowTextA( HWND hwnd, LPSTR lpString, INT nMaxCount )
{
WCHAR *buffer;
if (!lpString) return 0;
if (WIN_IsCurrentProcess( hwnd ))
return (INT)SendMessageA( hwnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString );
......@@ -2266,6 +2268,8 @@ INT WINAPI InternalGetWindowText(HWND hwnd,LPWSTR lpString,INT nMaxCount )
*/
INT WINAPI GetWindowTextW( HWND hwnd, LPWSTR lpString, INT nMaxCount )
{
if (!lpString) return 0;
if (WIN_IsCurrentProcess( hwnd ))
return (INT)SendMessageW( hwnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment