6 typedef struct _DESKTOP
8 PDESKTOPINFO pDeskInfo
;
10 /* Pointer to the associated window station. */
11 struct _WINSTATION_OBJECT
*rpwinstaParent
;
16 PSECTION_OBJECT hsectionDesktop
;
17 PWIN32HEAP pheapDesktop
;
20 /* use for tracking mouse moves. */
24 DWORD dwMouseHoverTime
;
27 /* Pointer to the active queue. */
28 PVOID ActiveMessageQueue
;
29 /* Handle of the desktop window. */
31 /* Thread blocking input */
32 PVOID BlockInputThread
;
33 LIST_ENTRY ShellHookWindows
;
36 extern PDESKTOP InputDesktop
;
37 extern HDESK InputDesktopHandle
;
38 extern PCLS DesktopWindowClass
;
39 extern HDC ScreenDeviceContext
;
40 extern BOOL g_PaintDesktopVersion
;
42 typedef struct _SHELL_HOOK_WINDOW
46 } SHELL_HOOK_WINDOW
, *PSHELL_HOOK_WINDOW
;
51 InitDesktopImpl(VOID
);
54 CleanupDesktopImpl(VOID
);
58 IntDesktopObjectParse(IN PVOID ParseObject
,
60 IN OUT PACCESS_STATE AccessState
,
61 IN KPROCESSOR_MODE AccessMode
,
63 IN OUT PUNICODE_STRING CompleteName
,
64 IN OUT PUNICODE_STRING RemainingName
,
65 IN OUT PVOID Context OPTIONAL
,
66 IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL
,
70 IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters
);
73 IntDesktopWindowProc(HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
);
79 IntGetDesktopWindow (VOID
);
82 UserGetDesktopWindow(VOID
);
85 IntGetCurrentThreadDesktopWindow(VOID
);
87 PUSER_MESSAGE_QUEUE FASTCALL
88 IntGetFocusMessageQueue(VOID
);
91 IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue
);
94 IntGetActiveDesktop(VOID
);
97 co_IntShowDesktop(PDESKTOP Desktop
, ULONG Width
, ULONG Height
);
100 IntHideDesktop(PDESKTOP Desktop
);
103 IntGetDesktopObjectHandle(PDESKTOP DesktopObject
);
105 BOOL
IntSetThreadDesktop(IN PDESKTOP DesktopObject
,
106 IN BOOL FreeOnFailure
);
109 IntValidateDesktopHandle(
111 KPROCESSOR_MODE AccessMode
,
112 ACCESS_MASK DesiredAccess
,
115 IntParseDesktopPath(PEPROCESS Process
,
116 PUNICODE_STRING DesktopPath
,
119 BOOL FASTCALL
IntDesktopUpdatePerUserSettings(BOOL bEnable
);
120 VOID APIENTRY
UserRedrawDesktop(VOID
);
121 BOOL
IntRegisterShellHookWindow(HWND hWnd
);
122 BOOL
IntDeRegisterShellHookWindow(HWND hWnd
);
123 VOID
co_IntShellHookNotify(WPARAM Message
, LPARAM lParam
);
124 HDC FASTCALL
UserGetDesktopDC(ULONG
,BOOL
,BOOL
);
126 #define IntIsActiveDesktop(Desktop) \
127 ((Desktop)->rpwinstaParent->ActiveDesktop == (Desktop))
129 #define GET_DESKTOP_NAME(d) \
130 OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d)) ? \
131 &(OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d))->Name) : \
134 HWND FASTCALL
IntGetMessageWindow(VOID
);
136 static __inline PVOID
137 DesktopHeapAlloc(IN PDESKTOP Desktop
,
140 return RtlAllocateHeap(Desktop
->pheapDesktop
,
146 DesktopHeapFree(IN PDESKTOP Desktop
,
149 return RtlFreeHeap(Desktop
->pheapDesktop
,
154 static __inline PVOID
155 DesktopHeapReAlloc(IN PDESKTOP Desktop
,
160 /* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
161 return RtlReAllocateHeap(Desktop
->pheapDesktop
,
169 PrevSize
= RtlSizeHeap(Desktop
->pheapDesktop
,
173 if (PrevSize
== Bytes
)
176 pNew
= RtlAllocateHeap(Desktop
->pheapDesktop
,
181 if (PrevSize
< Bytes
)
188 RtlFreeHeap(Desktop
->pheapDesktop
,
197 static __inline ULONG_PTR
198 DesktopHeapGetUserDelta(VOID
)
200 PW32HEAP_USER_MAPPING Mapping
;
202 PPROCESSINFO W32Process
;
203 PWIN32HEAP pheapDesktop
;
206 pti
= PsGetCurrentThreadWin32Thread();
210 pheapDesktop
= pti
->rpdesk
->pheapDesktop
;
212 W32Process
= PsGetCurrentProcessWin32Process();
213 Mapping
= W32Process
->HeapMappings
.Next
;
214 while (Mapping
!= NULL
)
216 if (Mapping
->KernelMapping
== (PVOID
)pheapDesktop
)
218 Delta
= (ULONG_PTR
)Mapping
->KernelMapping
- (ULONG_PTR
)Mapping
->UserMapping
;
222 Mapping
= Mapping
->Next
;
228 static __inline PVOID
229 DesktopHeapAddressToUser(PVOID lpMem
)
231 PW32HEAP_USER_MAPPING Mapping
;
232 PPROCESSINFO W32Process
;
234 W32Process
= PsGetCurrentProcessWin32Process();
235 Mapping
= W32Process
->HeapMappings
.Next
;
236 while (Mapping
!= NULL
)
238 if ((ULONG_PTR
)lpMem
>= (ULONG_PTR
)Mapping
->KernelMapping
&&
239 (ULONG_PTR
)lpMem
< (ULONG_PTR
)Mapping
->KernelMapping
+ Mapping
->Limit
)
241 return (PVOID
)(((ULONG_PTR
)lpMem
- (ULONG_PTR
)Mapping
->KernelMapping
) +
242 (ULONG_PTR
)Mapping
->UserMapping
);
245 Mapping
= Mapping
->Next
;