mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 17:01:25 +00:00
[WIN32K]: Whitespace fix only.
svn path=/trunk/; revision=71444
This commit is contained in:
parent
2047efde02
commit
b68e07fbaa
1 changed files with 52 additions and 50 deletions
|
@ -60,7 +60,7 @@ IntDesktopObjectParse(IN PVOID ParseObject,
|
||||||
UNICODE_STRING DesktopName;
|
UNICODE_STRING DesktopName;
|
||||||
PBOOLEAN pContext = (PBOOLEAN) Context;
|
PBOOLEAN pContext = (PBOOLEAN) Context;
|
||||||
|
|
||||||
if(pContext)
|
if (pContext)
|
||||||
*pContext = FALSE;
|
*pContext = FALSE;
|
||||||
|
|
||||||
/* Set the list pointers and loop the window station */
|
/* Set the list pointers and loop the window station */
|
||||||
|
@ -111,7 +111,7 @@ IntDesktopObjectParse(IN PVOID ParseObject,
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we got here but this isn't a create, then fail */
|
/* If we got here but this isn't a create, just fail */
|
||||||
if (!Context) return STATUS_OBJECT_NAME_NOT_FOUND;
|
if (!Context) return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
|
|
||||||
/* Create the desktop object */
|
/* Create the desktop object */
|
||||||
|
@ -180,14 +180,14 @@ IntDesktopOkToClose(
|
||||||
PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS OkToCloseParameters = Parameters;
|
PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS OkToCloseParameters = Parameters;
|
||||||
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if( pti == NULL)
|
if (pti == NULL)
|
||||||
{
|
{
|
||||||
/* This happens when we leak desktop handles */
|
/* This happens when we leak desktop handles */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not allow the current desktop or the initial desktop to be closed */
|
/* Do not allow the current desktop or the initial desktop to be closed */
|
||||||
if( OkToCloseParameters->Handle == pti->ppi->hdeskStartup ||
|
if (OkToCloseParameters->Handle == pti->ppi->hdeskStartup ||
|
||||||
OkToCloseParameters->Handle == pti->hdesk)
|
OkToCloseParameters->Handle == pti->hdesk)
|
||||||
{
|
{
|
||||||
return STATUS_ACCESS_DENIED;
|
return STATUS_ACCESS_DENIED;
|
||||||
|
@ -292,7 +292,7 @@ IntParseDesktopPath(PEPROCESS Process,
|
||||||
*hWinSta = NULL;
|
*hWinSta = NULL;
|
||||||
*hDesktop = NULL;
|
*hDesktop = NULL;
|
||||||
|
|
||||||
if(DesktopPath->Buffer != NULL && DesktopPath->Length > sizeof(WCHAR))
|
if (DesktopPath->Buffer != NULL && DesktopPath->Length > sizeof(WCHAR))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Parse the desktop path string which can be in the form "WinSta\Desktop"
|
* Parse the desktop path string which can be in the form "WinSta\Desktop"
|
||||||
|
@ -300,7 +300,7 @@ IntParseDesktopPath(PEPROCESS Process,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pwstrDesktop = wcschr(DesktopPath->Buffer, L'\\');
|
pwstrDesktop = wcschr(DesktopPath->Buffer, L'\\');
|
||||||
if(pwstrDesktop != NULL)
|
if (pwstrDesktop != NULL)
|
||||||
{
|
{
|
||||||
*pwstrDesktop = 0;
|
*pwstrDesktop = 0;
|
||||||
pwstrDesktop++;
|
pwstrDesktop++;
|
||||||
|
@ -326,7 +326,7 @@ IntParseDesktopPath(PEPROCESS Process,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* We had no luck searching for opened handles, use WinSta0 now */
|
/* We had no luck searching for opened handles, use WinSta0 now */
|
||||||
if(!pwstrWinsta)
|
if (!pwstrWinsta)
|
||||||
pwstrWinsta = L"WinSta0";
|
pwstrWinsta = L"WinSta0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,11 +341,11 @@ IntParseDesktopPath(PEPROCESS Process,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* We had no luck searching for opened handles, use Desktop now */
|
/* We had no luck searching for opened handles, use Desktop now */
|
||||||
if(!pwstrDesktop)
|
if (!pwstrDesktop)
|
||||||
pwstrDesktop = L"Default";
|
pwstrDesktop = L"Default";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*hWinSta == NULL)
|
if (*hWinSta == NULL)
|
||||||
{
|
{
|
||||||
swprintf(wstrWinstaFullName, L"%wZ\\%ws", &gustrWindowStationsDir, pwstrWinsta);
|
swprintf(wstrWinstaFullName, L"%wZ\\%ws", &gustrWindowStationsDir, pwstrWinsta);
|
||||||
RtlInitUnicodeString( &ObjectName, wstrWinstaFullName);
|
RtlInitUnicodeString( &ObjectName, wstrWinstaFullName);
|
||||||
|
@ -367,7 +367,7 @@ IntParseDesktopPath(PEPROCESS Process,
|
||||||
NULL,
|
NULL,
|
||||||
(HANDLE*)hWinSta);
|
(HANDLE*)hWinSta);
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
ERR("Failed to reference window station %wZ PID: --!\n", &ObjectName );
|
ERR("Failed to reference window station %wZ PID: --!\n", &ObjectName );
|
||||||
|
@ -375,7 +375,7 @@ IntParseDesktopPath(PEPROCESS Process,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*hDesktop == NULL)
|
if (*hDesktop == NULL)
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&ObjectName, pwstrDesktop);
|
RtlInitUnicodeString(&ObjectName, pwstrDesktop);
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ IntParseDesktopPath(PEPROCESS Process,
|
||||||
NULL,
|
NULL,
|
||||||
(HANDLE*)hDesktop);
|
(HANDLE*)hDesktop);
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
*hDesktop = NULL;
|
*hDesktop = NULL;
|
||||||
NtClose(*hWinSta);
|
NtClose(*hWinSta);
|
||||||
|
@ -475,7 +475,7 @@ IntGetDesktopObjectHandle(PDESKTOP DesktopObject)
|
||||||
ExDesktopObjectType,
|
ExDesktopObjectType,
|
||||||
UserMode,
|
UserMode,
|
||||||
(PHANDLE)&Ret);
|
(PHANDLE)&Ret);
|
||||||
if(!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Unable to create a handle */
|
/* Unable to create a handle */
|
||||||
ERR("Unable to create a desktop handle\n");
|
ERR("Unable to create a desktop handle\n");
|
||||||
|
@ -512,9 +512,9 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
|
||||||
TRACE("No active desktop\n");
|
TRACE("No active desktop\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(NewQueue != NULL)
|
if (NewQueue != NULL)
|
||||||
{
|
{
|
||||||
if(NewQueue->Desktop != NULL)
|
if (NewQueue->Desktop != NULL)
|
||||||
{
|
{
|
||||||
TRACE("Message Queue already attached to another desktop!\n");
|
TRACE("Message Queue already attached to another desktop!\n");
|
||||||
return;
|
return;
|
||||||
|
@ -523,7 +523,7 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
|
||||||
(void)InterlockedExchangePointer((PVOID*)&NewQueue->Desktop, pdo);
|
(void)InterlockedExchangePointer((PVOID*)&NewQueue->Desktop, pdo);
|
||||||
}
|
}
|
||||||
Old = (PUSER_MESSAGE_QUEUE)InterlockedExchangePointer((PVOID*)&pdo->ActiveMessageQueue, NewQueue);
|
Old = (PUSER_MESSAGE_QUEUE)InterlockedExchangePointer((PVOID*)&pdo->ActiveMessageQueue, NewQueue);
|
||||||
if(Old != NULL)
|
if (Old != NULL)
|
||||||
{
|
{
|
||||||
(void)InterlockedExchangePointer((PVOID*)&Old->Desktop, 0);
|
(void)InterlockedExchangePointer((PVOID*)&Old->Desktop, 0);
|
||||||
gpqForegroundPrev = Old;
|
gpqForegroundPrev = Old;
|
||||||
|
@ -692,7 +692,7 @@ DesktopWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lRe
|
||||||
case WM_WINDOWPOSCHANGING:
|
case WM_WINDOWPOSCHANGING:
|
||||||
{
|
{
|
||||||
PWINDOWPOS pWindowPos = (PWINDOWPOS)lParam;
|
PWINDOWPOS pWindowPos = (PWINDOWPOS)lParam;
|
||||||
if((pWindowPos->flags & SWP_SHOWWINDOW) != 0)
|
if ((pWindowPos->flags & SWP_SHOWWINDOW) != 0)
|
||||||
{
|
{
|
||||||
HDESK hdesk = IntGetDesktopObjectHandle(gpdeskInputDesktop);
|
HDESK hdesk = IntGetDesktopObjectHandle(gpdeskInputDesktop);
|
||||||
IntSetThreadDesktop(hdesk, FALSE);
|
IntSetThreadDesktop(hdesk, FALSE);
|
||||||
|
@ -800,12 +800,12 @@ co_IntShowDesktop(PDESKTOP Desktop, ULONG Width, ULONG Height, BOOL bRedraw)
|
||||||
UINT flags = SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW;
|
UINT flags = SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW;
|
||||||
ASSERT(pwnd);
|
ASSERT(pwnd);
|
||||||
|
|
||||||
if(!bRedraw)
|
if (!bRedraw)
|
||||||
flags |= SWP_NOREDRAW;
|
flags |= SWP_NOREDRAW;
|
||||||
|
|
||||||
co_WinPosSetWindowPos(pwnd, NULL, 0, 0, Width, Height, flags);
|
co_WinPosSetWindowPos(pwnd, NULL, 0, 0, Width, Height, flags);
|
||||||
|
|
||||||
if(bRedraw)
|
if (bRedraw)
|
||||||
co_UserRedrawWindow( pwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_INVALIDATE );
|
co_UserRedrawWindow( pwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_INVALIDATE );
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -1050,7 +1050,7 @@ IntPaintDesktop(HDC hDC)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Find the upper left corner, can be negative if the bitmap is bigger then the screen */
|
/* Find the upper left corner, can be negative if the bitmap is bigger than the screen */
|
||||||
x = (sz.cx / 2) - (gspv.cxWallpaper / 2);
|
x = (sz.cx / 2) - (gspv.cxWallpaper / 2);
|
||||||
y = (sz.cy / 2) - (gspv.cyWallpaper / 2);
|
y = (sz.cy / 2) - (gspv.cyWallpaper / 2);
|
||||||
}
|
}
|
||||||
|
@ -1078,7 +1078,7 @@ IntPaintDesktop(HDC hDC)
|
||||||
|
|
||||||
if (gspv.WallpaperMode == wmStretch)
|
if (gspv.WallpaperMode == wmStretch)
|
||||||
{
|
{
|
||||||
if(Rect.right && Rect.bottom)
|
if (Rect.right && Rect.bottom)
|
||||||
NtGdiStretchBlt(hDC,
|
NtGdiStretchBlt(hDC,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
@ -1095,9 +1095,9 @@ IntPaintDesktop(HDC hDC)
|
||||||
else if (gspv.WallpaperMode == wmTile)
|
else if (gspv.WallpaperMode == wmTile)
|
||||||
{
|
{
|
||||||
/* Paint the bitmap across the screen then down */
|
/* Paint the bitmap across the screen then down */
|
||||||
for(y = 0; y < Rect.bottom; y += gspv.cyWallpaper)
|
for (y = 0; y < Rect.bottom; y += gspv.cyWallpaper)
|
||||||
{
|
{
|
||||||
for(x = 0; x < Rect.right; x += gspv.cxWallpaper)
|
for (x = 0; x < Rect.right; x += gspv.cxWallpaper)
|
||||||
{
|
{
|
||||||
NtGdiBitBlt(hDC,
|
NtGdiBitBlt(hDC,
|
||||||
x,
|
x,
|
||||||
|
@ -1137,6 +1137,7 @@ IntPaintDesktop(HDC hDC)
|
||||||
/* Black desktop background in Safe Mode */
|
/* Black desktop background in Safe Mode */
|
||||||
DesktopBrush = StockObjects[BLACK_BRUSH];
|
DesktopBrush = StockObjects[BLACK_BRUSH];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Background is set to none, clear the screen */
|
/* Background is set to none, clear the screen */
|
||||||
if (doPatBlt)
|
if (doPatBlt)
|
||||||
{
|
{
|
||||||
|
@ -1146,7 +1147,7 @@ IntPaintDesktop(HDC hDC)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display system version on the desktop background
|
* Display the system version on the desktop background
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (g_PaintDesktopVersion || UserGetSystemMetrics(SM_CLEANBOOT))
|
if (g_PaintDesktopVersion || UserGetSystemMetrics(SM_CLEANBOOT))
|
||||||
|
@ -1175,7 +1176,7 @@ IntPaintDesktop(HDC hDC)
|
||||||
align_old = IntGdiSetTextAlign(hDC, TA_RIGHT);
|
align_old = IntGdiSetTextAlign(hDC, TA_RIGHT);
|
||||||
mode_old = IntGdiSetBkMode(hDC, TRANSPARENT);
|
mode_old = IntGdiSetBkMode(hDC, TRANSPARENT);
|
||||||
|
|
||||||
if(!UserGetSystemMetrics(SM_CLEANBOOT))
|
if (!UserGetSystemMetrics(SM_CLEANBOOT))
|
||||||
{
|
{
|
||||||
GreExtTextOutW(hDC, rect.right - 16, rect.bottom - 48, 0, NULL, s_wszVersion, len, NULL, 0);
|
GreExtTextOutW(hDC, rect.right - 16, rect.bottom - 48, 0, NULL, s_wszVersion, len, NULL, 0);
|
||||||
}
|
}
|
||||||
|
@ -1204,6 +1205,7 @@ IntPaintDesktop(HDC hDC)
|
||||||
IntGdiSetTextColor(hDC, color_old);
|
IntGdiSetTextColor(hDC, color_old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,7 +1552,7 @@ NtUserOpenInputDesktop(
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
TRACE("Enter NtUserOpenInputDesktop gpdeskInputDesktop 0x%p\n",gpdeskInputDesktop);
|
TRACE("Enter NtUserOpenInputDesktop gpdeskInputDesktop 0x%p\n",gpdeskInputDesktop);
|
||||||
|
|
||||||
if(fInherit) HandleAttributes = OBJ_INHERIT;
|
if (fInherit) HandleAttributes = OBJ_INHERIT;
|
||||||
|
|
||||||
/* Create a new handle to the object */
|
/* Create a new handle to the object */
|
||||||
Status = ObOpenObjectByPointer(
|
Status = ObOpenObjectByPointer(
|
||||||
|
@ -1605,7 +1607,7 @@ NtUserCloseDesktop(HDESK hDesktop)
|
||||||
TRACE("NtUserCloseDesktop called (0x%p)\n", hDesktop);
|
TRACE("NtUserCloseDesktop called (0x%p)\n", hDesktop);
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
if( hDesktop == gptiCurrent->hdesk || hDesktop == gptiCurrent->ppi->hdeskStartup)
|
if (hDesktop == gptiCurrent->hdesk || hDesktop == gptiCurrent->ppi->hdeskStartup)
|
||||||
{
|
{
|
||||||
ERR("Attempted to close thread desktop\n");
|
ERR("Attempted to close thread desktop\n");
|
||||||
EngSetLastError(ERROR_BUSY);
|
EngSetLastError(ERROR_BUSY);
|
||||||
|
@ -1802,7 +1804,7 @@ NtUserSwitchDesktop(HDESK hdesk)
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pdesk == gpdeskInputDesktop)
|
if (pdesk == gpdeskInputDesktop)
|
||||||
{
|
{
|
||||||
ObDereferenceObject(pdesk);
|
ObDereferenceObject(pdesk);
|
||||||
WARN("NtUserSwitchDesktop called for active desktop\n");
|
WARN("NtUserSwitchDesktop called for active desktop\n");
|
||||||
|
@ -1813,7 +1815,7 @@ NtUserSwitchDesktop(HDESK hdesk)
|
||||||
* Don't allow applications switch the desktop if it's locked, unless the caller
|
* Don't allow applications switch the desktop if it's locked, unless the caller
|
||||||
* is the logon application itself
|
* is the logon application itself
|
||||||
*/
|
*/
|
||||||
if((pdesk->rpwinstaParent->Flags & WSS_LOCKED) &&
|
if ((pdesk->rpwinstaParent->Flags & WSS_LOCKED) &&
|
||||||
gpidLogon != PsGetCurrentProcessId())
|
gpidLogon != PsGetCurrentProcessId())
|
||||||
{
|
{
|
||||||
ObDereferenceObject(pdesk);
|
ObDereferenceObject(pdesk);
|
||||||
|
@ -1821,7 +1823,7 @@ NtUserSwitchDesktop(HDESK hdesk)
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pdesk->rpwinstaParent != InputWindowStation)
|
if (pdesk->rpwinstaParent != InputWindowStation)
|
||||||
{
|
{
|
||||||
ObDereferenceObject(pdesk);
|
ObDereferenceObject(pdesk);
|
||||||
ERR("Switching desktop 0x%p denied because desktop doesn't belong to the interactive winsta!\n", hdesk);
|
ERR("Switching desktop 0x%p denied because desktop doesn't belong to the interactive winsta!\n", hdesk);
|
||||||
|
@ -1837,9 +1839,9 @@ NtUserSwitchDesktop(HDESK hdesk)
|
||||||
bRedrawDesktop = FALSE;
|
bRedrawDesktop = FALSE;
|
||||||
|
|
||||||
/* The first time SwitchDesktop is called, gpdeskInputDesktop is NULL */
|
/* The first time SwitchDesktop is called, gpdeskInputDesktop is NULL */
|
||||||
if(gpdeskInputDesktop != NULL)
|
if (gpdeskInputDesktop != NULL)
|
||||||
{
|
{
|
||||||
if((gpdeskInputDesktop->pDeskInfo->spwnd->style & WS_VISIBLE) == WS_VISIBLE)
|
if ((gpdeskInputDesktop->pDeskInfo->spwnd->style & WS_VISIBLE) == WS_VISIBLE)
|
||||||
bRedrawDesktop = TRUE;
|
bRedrawDesktop = TRUE;
|
||||||
|
|
||||||
/* Hide the previous desktop window */
|
/* Hide the previous desktop window */
|
||||||
|
@ -1886,20 +1888,20 @@ NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
TRACE("Enter NtUserGetThreadDesktop\n");
|
TRACE("Enter NtUserGetThreadDesktop\n");
|
||||||
|
|
||||||
if(!dwThreadId)
|
if (!dwThreadId)
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
RETURN(0);
|
RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &Thread);
|
Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &Thread);
|
||||||
if(!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||||
RETURN(0);
|
RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Thread->ThreadsProcess == PsGetCurrentProcess())
|
if (Thread->ThreadsProcess == PsGetCurrentProcess())
|
||||||
{
|
{
|
||||||
/* Just return the handle, we queried the desktop handle of a thread running
|
/* Just return the handle, we queried the desktop handle of a thread running
|
||||||
in the same context */
|
in the same context */
|
||||||
|
@ -1909,7 +1911,7 @@ NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the desktop handle and the desktop of the thread */
|
/* Get the desktop handle and the desktop of the thread */
|
||||||
if(!(hThreadDesktop = ((PTHREADINFO)Thread->Tcb.Win32Thread)->hdesk) ||
|
if (!(hThreadDesktop = ((PTHREADINFO)Thread->Tcb.Win32Thread)->hdesk) ||
|
||||||
!(DesktopObject = ((PTHREADINFO)Thread->Tcb.Win32Thread)->rpdesk))
|
!(DesktopObject = ((PTHREADINFO)Thread->Tcb.Win32Thread)->rpdesk))
|
||||||
{
|
{
|
||||||
ObDereferenceObject(Thread);
|
ObDereferenceObject(Thread);
|
||||||
|
@ -1931,7 +1933,7 @@ NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
|
||||||
KeDetachProcess();
|
KeDetachProcess();
|
||||||
|
|
||||||
/* The handle couldn't be found, there's nothing to get... */
|
/* The handle couldn't be found, there's nothing to get... */
|
||||||
if(!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ObDereferenceObject(Thread);
|
ObDereferenceObject(Thread);
|
||||||
RETURN(NULL);
|
RETURN(NULL);
|
||||||
|
@ -2089,7 +2091,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
pci = pti->pClientInfo;
|
pci = pti->pClientInfo;
|
||||||
|
|
||||||
/* If the caller gave us a desktop, ensure it is valid */
|
/* If the caller gave us a desktop, ensure it is valid */
|
||||||
if(hDesktop != NULL)
|
if (hDesktop != NULL)
|
||||||
{
|
{
|
||||||
/* Validate the new desktop. */
|
/* Validate the new desktop. */
|
||||||
Status = IntValidateDesktopHandle( hDesktop, UserMode, 0, &pdesk);
|
Status = IntValidateDesktopHandle( hDesktop, UserMode, 0, &pdesk);
|
||||||
|
@ -2110,7 +2112,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
/* Make sure that we don't own any window in the current desktop */
|
/* Make sure that we don't own any window in the current desktop */
|
||||||
if (!IsListEmpty(&pti->WindowListHead))
|
if (!IsListEmpty(&pti->WindowListHead))
|
||||||
{
|
{
|
||||||
if(pdesk)
|
if (pdesk)
|
||||||
ObDereferenceObject(pdesk);
|
ObDereferenceObject(pdesk);
|
||||||
ERR("Attempted to change thread desktop although the thread has windows!\n");
|
ERR("Attempted to change thread desktop although the thread has windows!\n");
|
||||||
EngSetLastError(ERROR_BUSY);
|
EngSetLastError(ERROR_BUSY);
|
||||||
|
@ -2125,7 +2127,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Before doing the switch, map the new desktop heap and allocate the new pcti */
|
/* Before doing the switch, map the new desktop heap and allocate the new pcti */
|
||||||
if(pdesk != NULL)
|
if (pdesk != NULL)
|
||||||
{
|
{
|
||||||
Status = IntMapDesktopView(pdesk);
|
Status = IntMapDesktopView(pdesk);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -2137,7 +2139,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
}
|
}
|
||||||
|
|
||||||
pctiNew = DesktopHeapAlloc( pdesk, sizeof(CLIENTTHREADINFO));
|
pctiNew = DesktopHeapAlloc( pdesk, sizeof(CLIENTTHREADINFO));
|
||||||
if(pctiNew == NULL)
|
if (pctiNew == NULL)
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate new pcti\n");
|
ERR("Failed to allocate new pcti\n");
|
||||||
IntUnmapDesktopView(pdesk);
|
IntUnmapDesktopView(pdesk);
|
||||||
|
@ -2148,12 +2150,12 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free all classes or move them to the shared heap */
|
/* free all classes or move them to the shared heap */
|
||||||
if(pti->rpdesk != NULL)
|
if (pti->rpdesk != NULL)
|
||||||
{
|
{
|
||||||
if(!IntCheckProcessDesktopClasses(pti->rpdesk, FreeOnFailure))
|
if (!IntCheckProcessDesktopClasses(pti->rpdesk, FreeOnFailure))
|
||||||
{
|
{
|
||||||
ERR("Failed to move process classes to shared heap!\n");
|
ERR("Failed to move process classes to shared heap!\n");
|
||||||
if(pdesk)
|
if (pdesk)
|
||||||
{
|
{
|
||||||
DesktopHeapFree(pdesk, pctiNew);
|
DesktopHeapFree(pdesk, pctiNew);
|
||||||
IntUnmapDesktopView(pdesk);
|
IntUnmapDesktopView(pdesk);
|
||||||
|
@ -2171,7 +2173,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
pctiOld = NULL;
|
pctiOld = NULL;
|
||||||
|
|
||||||
/* do the switch */
|
/* do the switch */
|
||||||
if(pdesk != NULL)
|
if (pdesk != NULL)
|
||||||
{
|
{
|
||||||
pti->rpdesk = pdesk;
|
pti->rpdesk = pdesk;
|
||||||
pti->hdesk = hDesktop;
|
pti->hdesk = hDesktop;
|
||||||
|
@ -2183,7 +2185,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
pci->pClientThreadInfo = (PVOID)((ULONG_PTR)pti->pcti - pci->ulClientDelta);
|
pci->pClientThreadInfo = (PVOID)((ULONG_PTR)pti->pcti - pci->ulClientDelta);
|
||||||
|
|
||||||
/* initialize the new pcti */
|
/* initialize the new pcti */
|
||||||
if(pctiOld != NULL)
|
if (pctiOld != NULL)
|
||||||
{
|
{
|
||||||
RtlCopyMemory(pctiNew, pctiOld, sizeof(CLIENTTHREADINFO));
|
RtlCopyMemory(pctiNew, pctiOld, sizeof(CLIENTTHREADINFO));
|
||||||
}
|
}
|
||||||
|
@ -2206,7 +2208,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up the old desktop */
|
/* clean up the old desktop */
|
||||||
if(pdeskOld != NULL)
|
if (pdeskOld != NULL)
|
||||||
{
|
{
|
||||||
RemoveEntryList(&pti->PtiLink);
|
RemoveEntryList(&pti->PtiLink);
|
||||||
if (pctiOld) DesktopHeapFree(pdeskOld, pctiOld);
|
if (pctiOld) DesktopHeapFree(pdeskOld, pctiOld);
|
||||||
|
@ -2215,7 +2217,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
|
||||||
ZwClose(hdeskOld);
|
ZwClose(hdeskOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pdesk)
|
if (pdesk)
|
||||||
{
|
{
|
||||||
InsertTailList(&pdesk->PtiList, &pti->PtiLink);
|
InsertTailList(&pdesk->PtiList, &pti->PtiLink);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue