don't crash if no thread desktop set

svn path=/trunk/; revision=9246
This commit is contained in:
Thomas Bluemel 2004-04-29 20:41:03 +00:00
parent ddcbbf2e8d
commit 0f0200e106

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: input.c,v 1.28 2004/04/29 20:26:35 weiden Exp $ /* $Id: input.c,v 1.29 2004/04/29 20:41:03 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -477,7 +477,7 @@ IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt)
PW32THREAD OldBlock; PW32THREAD OldBlock;
ASSERT(W32Thread); ASSERT(W32Thread);
if(W32Thread->IsExiting && BlockIt) if(!W32Thread->Desktop || (W32Thread->IsExiting && BlockIt))
{ {
/* /*
* fail blocking if exiting the thread * fail blocking if exiting the thread
@ -541,8 +541,17 @@ NtUserSendInput(
LPINPUT pInput, LPINPUT pInput,
INT cbSize) INT cbSize)
{ {
PW32THREAD W32Thread;
UINT cnt; UINT cnt;
W32Thread = PsGetWin32Thread();
ASSERT(W32Thread);
if(!W32Thread->Desktop)
{
return 0;
}
if(!nInputs || !pInput || (cbSize != sizeof(INPUT))) if(!nInputs || !pInput || (cbSize != sizeof(INPUT)))
{ {
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
@ -554,7 +563,7 @@ NtUserSendInput(
* e.g. services running in the service window station cannot block input * e.g. services running in the service window station cannot block input
*/ */
if(!ThreadHasInputAccess(W32Thread) || if(!ThreadHasInputAccess(W32Thread) ||
!IntIsActiveDesktop(PsGetWin32Thread()->Desktop)) !IntIsActiveDesktop(W32Thread->Desktop))
{ {
SetLastWin32Error(ERROR_ACCESS_DENIED); SetLastWin32Error(ERROR_ACCESS_DENIED);
return 0; return 0;