Yuriy Sidorov <jura@cp-lab.com>

- Fix BSOD in NtUserWaitForInputIdle because KeWaitForMultipleObjects expects actual pointers to objects, not handles.
- Fix failure branches to have UserLeave and/or object dereference where needed.
See issue #3522 for more details.

svn path=/trunk/; revision=34525
This commit is contained in:
Aleksey Bragin 2008-07-15 14:00:37 +00:00
parent fa443b5f5b
commit 81c0fbc19f

View file

@ -1898,6 +1898,7 @@ NtUserWaitForInputIdle(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
UserLeave();
SetLastNtError(Status); SetLastNtError(Status);
return WAIT_FAILED; return WAIT_FAILED;
} }
@ -1906,16 +1907,22 @@ NtUserWaitForInputIdle(
if (!W32Process) if (!W32Process)
{ {
ObDereferenceObject(Process); ObDereferenceObject(Process);
UserLeave();
SetLastWin32Error(ERROR_INVALID_PARAMETER); SetLastWin32Error(ERROR_INVALID_PARAMETER);
return WAIT_FAILED; return WAIT_FAILED;
} }
EngCreateEvent((PEVENT *)&W32Process->InputIdleEvent); EngCreateEvent((PEVENT *)&W32Process->InputIdleEvent);
Handles[0] = hProcess; Handles[0] = Process;
Handles[1] = W32Process->InputIdleEvent; Handles[1] = W32Process->InputIdleEvent;
if (!Handles[1]) return STATUS_SUCCESS; /* no event to wait on */ if (!Handles[1])
{
ObDereferenceObject(Process);
UserLeave();
return STATUS_SUCCESS; /* no event to wait on */
}
StartTime = ((ULONGLONG)SharedUserData->TickCountLowDeprecated * StartTime = ((ULONGLONG)SharedUserData->TickCountLowDeprecated *
SharedUserData->TickCountMultiplier / 16777216); SharedUserData->TickCountMultiplier / 16777216);