diff --git a/reactos/win32ss/user/user32/windows/window.c b/reactos/win32ss/user/user32/windows/window.c index 4c79dcc91c7..75dc96e616e 100644 --- a/reactos/win32ss/user/user32/windows/window.c +++ b/reactos/win32ss/user/user32/windows/window.c @@ -674,6 +674,14 @@ User32EnumWindows(HDESK hDesktop, if (!NT_SUCCESS(Status)) return FALSE; + if (!dwCount) + { + if (!dwThreadId) + return FALSE; + else + return TRUE; + } + /* allocate buffer to receive HWND handles */ hHeap = GetProcessHeap(); pHwnd = HeapAlloc(hHeap, 0, sizeof(HWND)*(dwCount+1)); @@ -698,14 +706,6 @@ User32EnumWindows(HDESK hDesktop, return FALSE; } - if (!dwCount) - { - if (!dwThreadId) - return FALSE; - else - return TRUE; - } - /* call the user's callback function until we're done or they tell us to quit */ for ( i = 0; i < dwCount; i++ )