mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:53:40 +00:00
[USER32] Fix GetWindowTextLength() blocking call using the same technique as in GetWindowText(). Fix indentation in GetWindowText().
This commit is contained in:
parent
69acbe905a
commit
68430db462
1 changed files with 54 additions and 24 deletions
|
@ -1306,20 +1306,22 @@ GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
|
||||||
|
|
||||||
lpString[0] = '\0';
|
lpString[0] = '\0';
|
||||||
|
|
||||||
if (!TestWindowProcess( Wnd))
|
if (!TestWindowProcess(Wnd))
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
Length = DefWindowProcA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
|
Length = DefWindowProcA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
Length = 0;
|
Length = 0;
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Length = SendMessageA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
|
{
|
||||||
|
Length = SendMessageA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
|
||||||
|
}
|
||||||
//ERR("GWTA Len %d : %s\n",Length,lpString);
|
//ERR("GWTA Len %d : %s\n",Length,lpString);
|
||||||
return Length;
|
return Length;
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1332,20 @@ GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
|
||||||
int WINAPI
|
int WINAPI
|
||||||
GetWindowTextLengthA(HWND hWnd)
|
GetWindowTextLengthA(HWND hWnd)
|
||||||
{
|
{
|
||||||
return(SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0));
|
PWND Wnd;
|
||||||
|
|
||||||
|
Wnd = ValidateHwnd(hWnd);
|
||||||
|
if (!Wnd)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!TestWindowProcess(Wnd))
|
||||||
|
{
|
||||||
|
return DefWindowProcA(hWnd, WM_GETTEXTLENGTH, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1339,7 +1354,20 @@ GetWindowTextLengthA(HWND hWnd)
|
||||||
int WINAPI
|
int WINAPI
|
||||||
GetWindowTextLengthW(HWND hWnd)
|
GetWindowTextLengthW(HWND hWnd)
|
||||||
{
|
{
|
||||||
return(SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0));
|
PWND Wnd;
|
||||||
|
|
||||||
|
Wnd = ValidateHwnd(hWnd);
|
||||||
|
if (!Wnd)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!TestWindowProcess(Wnd))
|
||||||
|
{
|
||||||
|
return DefWindowProcW(hWnd, WM_GETTEXTLENGTH, 0, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return SendMessageW(hWnd, WM_GETTEXTLENGTH, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1360,20 +1388,22 @@ GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
|
||||||
|
|
||||||
lpString[0] = L'\0';
|
lpString[0] = L'\0';
|
||||||
|
|
||||||
if (!TestWindowProcess( Wnd))
|
if (!TestWindowProcess(Wnd))
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
Length = DefWindowProcW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
|
Length = DefWindowProcW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
Length = 0;
|
Length = 0;
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Length = SendMessageW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
|
{
|
||||||
|
Length = SendMessageW(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString);
|
||||||
|
}
|
||||||
//ERR("GWTW Len %d : %S\n",Length,lpString);
|
//ERR("GWTW Len %d : %S\n",Length,lpString);
|
||||||
return Length;
|
return Length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue