/* INCLUDES ******************************************************************/
-#include <w32k.h>
+#include <win32k.h>
#define NDEBUG
#include <debug.h>
/* Initialize shell hook window list and set the parent */
RtlZeroMemory(Desktop, sizeof(DESKTOP));
InitializeListHead(&Desktop->ShellHookWindows);
- Desktop->WindowStation = (PWINSTATION_OBJECT)ParseObject;
+ Desktop->rpwinstaParent = (PWINSTATION_OBJECT)ParseObject;
/* Put the desktop on the window station's list of associated desktops */
- InsertTailList(&Desktop->WindowStation->DesktopListHead,
+ InsertTailList(&Desktop->rpwinstaParent->DesktopListHead,
&Desktop->ListEntry);
/* Set the desktop object and return success */
return Status;
}
-VOID FASTCALL
-IntGetDesktopWorkArea(PDESKTOP Desktop, RECTL *Rect)
-{
- RECTL *Ret;
-
- ASSERT(Desktop);
-
- Ret = &Desktop->WorkArea;
- if((Ret->right == -1) && ScreenDeviceContext)
- {
- PDC dc;
- SURFACE *psurf;
- dc = DC_LockDc(ScreenDeviceContext);
- /* FIXME - Handle dc == NULL!!!! */
- psurf = dc->dclevel.pSurface;
- if (psurf)
- {
- Ret->right = psurf->SurfObj.sizlBitmap.cx;
- Ret->bottom = psurf->SurfObj.sizlBitmap.cy;
- }
- DC_UnlockDc(dc);
- }
-
- if(Rect)
- {
- *Rect = *Ret;
- }
-}
-
PDESKTOP FASTCALL
IntGetActiveDesktop(VOID)
{
return pdo->DesktopWindow;
}
-PWINDOW_OBJECT FASTCALL UserGetDesktopWindow(VOID)
+PWND FASTCALL UserGetDesktopWindow(VOID)
{
PDESKTOP pdo = IntGetActiveDesktop();
HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
{
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
- PDESKTOP pdo = pti->Desktop;
+ PDESKTOP pdo = pti->rpdesk;
if (NULL == pdo)
{
DPRINT1("Thread doesn't have a desktop\n");
HDC FASTCALL
UserGetDesktopDC(ULONG DcType, BOOL EmptyDC, BOOL ValidatehWnd)
{
- PWINDOW_OBJECT DesktopObject = 0;
+ PWND DesktopObject = 0;
HDC DesktopHDC = 0;
if (DcType == DC_TYPE_DIRECT)
VOID APIENTRY
UserRedrawDesktop()
{
- PWINDOW_OBJECT Window = NULL;
-
- UserEnterExclusive();
+ PWND Window = NULL;
Window = UserGetDesktopWindow();
RDW_ERASE |
RDW_INVALIDATE |
RDW_ALLCHILDREN);
- UserLeave();
}
return NotifyCsrss(&Request, &Reply);
#else
- PWINDOW_OBJECT DesktopWindow;
PWND DesktopWnd;
- DesktopWindow = IntGetWindowObject(Desktop->DesktopWindow);
- if (! DesktopWindow)
+ DesktopWnd = IntGetWindowObject(Desktop->DesktopWindow);
+ if (! DesktopWnd)
{
return ERROR_INVALID_WINDOW_HANDLE;
}
- DesktopWnd = DesktopWindow->Wnd;
DesktopWnd->style &= ~WS_VISIBLE;
return STATUS_SUCCESS;
if (!entries) return NULL;
- list = ExAllocatePool(PagedPool, sizeof(HWND) * (entries + 1)); /* alloc one extra for nullterm */
+ list = ExAllocatePoolWithTag(PagedPool, sizeof(HWND) * (entries + 1), USERTAG_WINDOWLIST); /* alloc one extra for nullterm */
if (list)
{
HWND* cursor = list;
BOOL IntRegisterShellHookWindow(HWND hWnd)
{
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
- PDESKTOP Desktop = pti->Desktop;
+ PDESKTOP Desktop = pti->rpdesk;
PSHELL_HOOK_WINDOW Entry;
DPRINT("IntRegisterShellHookWindow\n");
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
{
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
- PDESKTOP Desktop = pti->Desktop;
+ PDESKTOP Desktop = pti->rpdesk;
PSHELL_HOOK_WINDOW Current;
LIST_FOR_EACH(Current, &Desktop->ShellHookWindows, SHELL_HOOK_WINDOW, ListEntry)
ULONG_PTR HeapSize = 4 * 1024 * 1024; /* FIXME */
HWINSTA hWindowStation = NULL ;
PUNICODE_STRING lpszDesktopName = NULL;
- UNICODE_STRING ClassName, WindowName, MenuName;
+ UNICODE_STRING ClassName, MenuName;
+ LARGE_STRING WindowName;
PWND pWnd = NULL;
+ CREATESTRUCTW Cs;
+ INT i;
DECLARE_RETURN(HDESK);
DPRINT("Enter NtUserCreateDesktop: %wZ\n", lpszDesktopName);
lpszDesktopName->Buffer,
lpszDesktopName->Length);
- // init desktop area
- DesktopObject->WorkArea.left = 0;
- DesktopObject->WorkArea.top = 0;
- DesktopObject->WorkArea.right = -1;
- DesktopObject->WorkArea.bottom = -1;
- IntGetDesktopWorkArea(DesktopObject, NULL);
-
/* Initialize some local (to win32k) desktop state. */
InitializeListHead(&DesktopObject->PtiList);
DesktopObject->ActiveMessageQueue = NULL;
+ /* Setup Global Hooks. */
+ for (i = 0; i < NB_HOOKS; i++)
+ {
+ InitializeListHead(&DesktopObject->pDeskInfo->aphkStart[i]);
+ }
ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING);
if (! NT_SUCCESS(Status))
W32Thread = PsGetCurrentThreadWin32Thread();
- if (!W32Thread->Desktop) IntSetThreadDesktop(DesktopObject,FALSE);
+ if (!W32Thread->rpdesk) IntSetThreadDesktop(DesktopObject,FALSE);
/*
Based on wine/server/window.c in get_desktop_window.
RtlZeroMemory(&MenuName, sizeof(MenuName));
RtlZeroMemory(&WindowName, sizeof(WindowName));
- pWnd = co_IntCreateWindowEx( 0,
- &ClassName,
- &WindowName,
- (WS_POPUP|WS_CLIPCHILDREN),
- 0,
- 0,
- 100,
- 100,
- NULL,
- NULL,
- hModClient,
- NULL,
- 0,
- TRUE);
+ RtlZeroMemory(&Cs, sizeof(Cs));
+ Cs.cx = Cs.cy = 100;
+ Cs.style = WS_POPUP|WS_CLIPCHILDREN;
+ Cs.hInstance = hModClient;
+ Cs.lpszName = (LPCWSTR) &WindowName;
+ Cs.lpszClass = (LPCWSTR) &ClassName;
+
+ pWnd = co_UserCreateWindowEx(&Cs, &ClassName, &WindowName);
if (!pWnd)
{
DPRINT1("Failed to create Message window handle\n");
HBRUSH DesktopBrush, PreviousBrush;
HWND hWndDesktop;
BOOL doPatBlt = TRUE;
- PWINDOW_OBJECT WndDesktop;
+ PWND WndDesktop;
int len;
COLORREF color_old;
UINT align_old;
int mode_old;
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
- PWINSTATION_OBJECT WinSta = pti->Desktop->WindowStation;
+ PWINSTATION_OBJECT WinSta = pti->rpdesk->rpwinstaParent;
DECLARE_RETURN(BOOL);
UserEnterExclusive();
RETURN(FALSE);
}
- DesktopBrush = (HBRUSH)UserGetClassLongPtr(WndDesktop->Wnd->pcls, GCL_HBRBACKGROUND, FALSE);
+ DesktopBrush = (HBRUSH)WndDesktop->pcls->hbrBackground;
/*
if (WinSta->hbmWallpaper != NULL)
{
- PWINDOW_OBJECT DeskWin;
+ PWND DeskWin;
DeskWin = UserGetWindowObject(hWndDesktop);
int x, y;
HDC hWallpaperDC;
- sz.cx = DeskWin->Wnd->rcWindow.right - DeskWin->Wnd->rcWindow.left;
- sz.cy = DeskWin->Wnd->rcWindow.bottom - DeskWin->Wnd->rcWindow.top;
+ sz.cx = DeskWin->rcWindow.right - DeskWin->rcWindow.left;
+ sz.cy = DeskWin->rcWindow.bottom - DeskWin->rcWindow.top;
if (WinSta->WallpaperMode == wmStretch ||
WinSta->WallpaperMode == wmTile)
* Don't allow applications switch the desktop if it's locked, unless the caller
* is the logon application itself
*/
- if((DesktopObject->WindowStation->Flags & WSS_LOCKED) &&
+ if((DesktopObject->rpwinstaParent->Flags & WSS_LOCKED) &&
LogonProcess != NULL && LogonProcess != PsGetCurrentProcessWin32Process())
{
ObDereferenceObject(DesktopObject);
RETURN(FALSE);
}
- if(DesktopObject->WindowStation != InputWindowStation)
+ if(DesktopObject->rpwinstaParent != InputWindowStation)
{
ObDereferenceObject(DesktopObject);
DPRINT1("Switching desktop 0x%x denied because desktop doesn't belong to the interactive winsta!\n", hDesktop);
{
/* just return the handle, we queried the desktop handle of a thread running
in the same context */
- Ret = ((PTHREADINFO)Thread->Tcb.Win32Thread)->hDesktop;
+ Ret = ((PTHREADINFO)Thread->Tcb.Win32Thread)->hdesk;
ObDereferenceObject(Thread);
RETURN(Ret);
}
/* get the desktop handle and the desktop of the thread */
- if(!(hThreadDesktop = ((PTHREADINFO)Thread->Tcb.Win32Thread)->hDesktop) ||
- !(DesktopObject = ((PTHREADINFO)Thread->Tcb.Win32Thread)->Desktop))
+ if(!(hThreadDesktop = ((PTHREADINFO)Thread->Tcb.Win32Thread)->hdesk) ||
+ !(DesktopObject = ((PTHREADINFO)Thread->Tcb.Win32Thread)->rpdesk))
{
ObDereferenceObject(Thread);
DPRINT1("Desktop information of thread 0x%x broken!?\n", dwThreadId);
MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess);
W32Thread = PsGetCurrentThreadWin32Thread();
- if (W32Thread->Desktop != DesktopObject)
+ if (W32Thread->rpdesk != DesktopObject)
{
- OldDesktop = W32Thread->Desktop;
+ OldDesktop = W32Thread->rpdesk;
if (!IsListEmpty(&W32Thread->WindowListHead))
{
return FALSE;
}
- W32Thread->Desktop = DesktopObject;
+ W32Thread->rpdesk = DesktopObject;
if (MapHeap && DesktopObject != NULL)
{