{
DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql());
Win32Process->W32PF_flags |= W32PF_TERMINATED;
+
if (Win32Process->InputIdleEvent)
{
EngFreeMem((PVOID)Win32Process->InputIdleEvent);
{
LogonProcess = NULL;
}
+
+ UserSetProcessWindowStation(NULL);
+
}
RETURN( STATUS_SUCCESS);
{
if(hWinSta != NULL)
{
- if(Process != CsrProcess)
+ if(!UserSetProcessWindowStation(hWinSta))
{
- HWINSTA hProcessWinSta = (HWINSTA)InterlockedCompareExchangePointer((PVOID)&Process->Win32WindowStation, (PVOID)hWinSta, NULL);
- if(hProcessWinSta != NULL)
- {
- /* our process is already assigned to a different window station, we don't need the handle anymore */
- NtClose(hWinSta);
- }
- }
- else
- {
- NtClose(hWinSta);
+ DPRINT1("Failed to set process window station\n");
}
}
if (hDesk != NULL)
{
- PDESKTOP DesktopObject;
- Win32Thread->rpdesk = NULL;
- Status = ObReferenceObjectByHandle(hDesk,
- 0,
- ExDesktopObjectType,
- KernelMode,
- (PVOID*)&DesktopObject,
- NULL);
- NtClose(hDesk);
- if(NT_SUCCESS(Status))
+ if (!IntSetThreadDesktop(hDesk, FALSE))
{
- if (!IntSetThreadDesktop(DesktopObject,
- FALSE))
- {
DPRINT1("Unable to set thread desktop\n");
- }
- }
- else
- {
- DPRINT1("Unable to reference thread desktop handle 0x%x\n", hDesk);
}
}
}
CalloutData.ProcessCallout = Win32kProcessCallback;
CalloutData.ThreadCallout = Win32kThreadCallback;
CalloutData.BatchFlushRoutine = NtGdiFlushUserBatch;
+ CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
+ CalloutData.WindowStationOkToCloseProcedure = IntWinstaOkToClose;
/* Register our per-process and per-thread structures. */
PsEstablishWin32Callouts((PWIN32_CALLOUTS_FPNS)&CalloutData);