mirror of
https://github.com/reactos/reactos.git
synced 2024-07-05 12:15:46 +00:00
NtUserBuildHwndList() returns NTSTATUS, not ULONG. More correct fix than 33483 to some of the winetest problems. Pass return value as out parameter instead.
svn path=/trunk/; revision=33500
This commit is contained in:
parent
8efa2c983f
commit
9736840986
|
@ -133,12 +133,11 @@ HWND* WIN_ListChildren (HWND hWndparent)
|
|||
DWORD dwCount = 0;
|
||||
HWND* pHwnd = NULL;
|
||||
HANDLE hHeap;
|
||||
NTSTATUS Status;
|
||||
|
||||
SetLastError(0);
|
||||
Status = NtUserBuildHwndList ( NULL, hWndparent, FALSE, 0, 0, NULL, &dwCount );
|
||||
|
||||
dwCount = NtUserBuildHwndList ( NULL, hWndparent, FALSE, 0, 0, NULL, 0 );
|
||||
|
||||
if ( !dwCount || GetLastError() )
|
||||
if ( !NT_SUCCESS( Status ) )
|
||||
return 0;
|
||||
|
||||
/* allocate buffer to receive HWND handles */
|
||||
|
@ -152,12 +151,12 @@ HWND* WIN_ListChildren (HWND hWndparent)
|
|||
}
|
||||
|
||||
/* now call kernel again to fill the buffer this time */
|
||||
dwCount = NtUserBuildHwndList (NULL, hWndparent, FALSE, 0, 0, pHwnd, dwCount );
|
||||
Status = NtUserBuildHwndList (NULL, hWndparent, FALSE, 0, 0, pHwnd, &dwCount );
|
||||
|
||||
if ( !dwCount || GetLastError() )
|
||||
if ( !NT_SUCCESS( Status ) )
|
||||
{
|
||||
if ( pHwnd )
|
||||
HeapFree ( hHeap, 0, pHwnd );
|
||||
HeapFree ( hHeap, 0, pHwnd );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -558,6 +558,7 @@ User32EnumWindows (
|
|||
DWORD i, dwCount = 0;
|
||||
HWND* pHwnd = NULL;
|
||||
HANDLE hHeap;
|
||||
NTSTATUS Status;
|
||||
|
||||
if ( !lpfn )
|
||||
{
|
||||
|
@ -569,9 +570,9 @@ User32EnumWindows (
|
|||
sort of persistent buffer and only grow it ( requiring a 2nd
|
||||
call ) when the buffer wasn't already big enough? */
|
||||
/* first get how many window entries there are */
|
||||
dwCount = NtUserBuildHwndList (
|
||||
hDesktop, hWndparent, bChildren, dwThreadId, lParam, NULL, 0 );
|
||||
if ( !dwCount )
|
||||
Status = NtUserBuildHwndList (
|
||||
hDesktop, hWndparent, bChildren, dwThreadId, lParam, NULL, &dwCount );
|
||||
if ( !NT_SUCCESS( Status ) )
|
||||
return FALSE;
|
||||
|
||||
/* allocate buffer to receive HWND handles */
|
||||
|
@ -584,9 +585,9 @@ User32EnumWindows (
|
|||
}
|
||||
|
||||
/* now call kernel again to fill the buffer this time */
|
||||
dwCount = NtUserBuildHwndList (
|
||||
hDesktop, hWndparent, bChildren, dwThreadId, lParam, pHwnd, dwCount );
|
||||
if ( !dwCount )
|
||||
Status = NtUserBuildHwndList (
|
||||
hDesktop, hWndparent, bChildren, dwThreadId, lParam, pHwnd, &dwCount );
|
||||
if ( !NT_SUCCESS( Status ) )
|
||||
{
|
||||
if ( pHwnd )
|
||||
HeapFree ( hHeap, 0, pHwnd );
|
||||
|
|
|
@ -481,7 +481,7 @@ NTAPI
|
|||
NtUserBlockInput(
|
||||
BOOL BlockIt);
|
||||
|
||||
ULONG
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtUserBuildHwndList(
|
||||
HDESK hDesktop,
|
||||
|
@ -490,7 +490,7 @@ NtUserBuildHwndList(
|
|||
ULONG dwThreadId,
|
||||
ULONG lParam,
|
||||
HWND* pWnd,
|
||||
ULONG nBufSize);
|
||||
ULONG* nBufSize);
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NtUserBuildNameList(
|
||||
|
|
|
@ -1212,7 +1212,7 @@ NtUserAlterWindowStyle(DWORD Unknown0,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
ULONG
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtUserBuildHwndList(
|
||||
HDESK hDesktop,
|
||||
|
@ -1221,11 +1221,14 @@ NtUserBuildHwndList(
|
|||
ULONG dwThreadId,
|
||||
ULONG lParam,
|
||||
HWND* pWnd,
|
||||
ULONG nBufSize)
|
||||
ULONG* pBufSize)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG dwCount = 0;
|
||||
|
||||
if (pBufSize == 0)
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (hwndParent || !dwThreadId)
|
||||
{
|
||||
PDESKTOP_OBJECT Desktop;
|
||||
|
@ -1235,8 +1238,7 @@ NtUserBuildHwndList(
|
|||
{
|
||||
if(hDesktop == NULL && !(Desktop = IntGetActiveDesktop()))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
return ERROR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if(hDesktop)
|
||||
|
@ -1247,8 +1249,7 @@ NtUserBuildHwndList(
|
|||
&Desktop);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
return ERROR_INVALID_HANDLE;
|
||||
}
|
||||
}
|
||||
hwndParent = Desktop->DesktopWindow;
|
||||
|
@ -1268,7 +1269,7 @@ NtUserBuildHwndList(
|
|||
{
|
||||
if (bGoDown)
|
||||
{
|
||||
if(dwCount++ < nBufSize && pWnd)
|
||||
if(dwCount++ < *pBufSize && pWnd)
|
||||
{
|
||||
_SEH_TRY
|
||||
{
|
||||
|
@ -1323,15 +1324,13 @@ NtUserBuildHwndList(
|
|||
Status = PsLookupThreadByThreadId((HANDLE)dwThreadId, &Thread);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
if(!(W32Thread = (PW32THREAD)Thread->Tcb.Win32Thread))
|
||||
{
|
||||
ObDereferenceObject(Thread);
|
||||
DPRINT("Thread is not a GUI Thread!\n");
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Current = W32Thread->WindowListHead.Flink;
|
||||
|
@ -1342,7 +1341,7 @@ NtUserBuildHwndList(
|
|||
|
||||
if(bChildren || Window->hOwner != NULL)
|
||||
{
|
||||
if(dwCount < nBufSize && pWnd)
|
||||
if(dwCount < *pBufSize && pWnd)
|
||||
{
|
||||
Status = MmCopyToCaller(pWnd++, &Window->hSelf, sizeof(HWND));
|
||||
if(!NT_SUCCESS(Status))
|
||||
|
@ -1359,7 +1358,8 @@ NtUserBuildHwndList(
|
|||
ObDereferenceObject(Thread);
|
||||
}
|
||||
|
||||
return dwCount;
|
||||
*pBufSize = dwCount;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue