3 typedef struct _DESKTOP
5 PDESKTOPINFO pDeskInfo
;
7 /* Pointer to the associated window station. */
8 struct _WINSTATION_OBJECT
*rpwinstaParent
;
14 PSECTION_OBJECT hsectionDesktop
;
15 PWIN32HEAP pheapDesktop
;
18 /* use for tracking mouse moves. */
22 DWORD dwMouseHoverTime
;
25 /* Pointer to the active queue. */
26 PVOID ActiveMessageQueue
;
27 /* Handle of the desktop window. */
29 /* Thread blocking input */
30 PVOID BlockInputThread
;
31 LIST_ENTRY ShellHookWindows
;
35 #define DF_TME_HOVER 0x00000400
36 #define DF_TME_LEAVE 0x00000800
37 #define DF_HOTTRACK 0x00004000
38 #define DF_DESTROYED 0x00008000
39 #define DF_DESKWNDDESTROYED 0x00010000
40 #define DF_DYING 0x00020000
42 extern PDESKTOP InputDesktop
;
43 extern HDESK InputDesktopHandle
;
44 extern PCLS DesktopWindowClass
;
45 extern HDC ScreenDeviceContext
;
46 extern BOOL g_PaintDesktopVersion
;
48 typedef struct _SHELL_HOOK_WINDOW
52 } SHELL_HOOK_WINDOW
, *PSHELL_HOOK_WINDOW
;
57 InitDesktopImpl(VOID
);
60 CleanupDesktopImpl(VOID
);
64 IntDesktopObjectParse(IN PVOID ParseObject
,
66 IN OUT PACCESS_STATE AccessState
,
67 IN KPROCESSOR_MODE AccessMode
,
69 IN OUT PUNICODE_STRING CompleteName
,
70 IN OUT PUNICODE_STRING RemainingName
,
71 IN OUT PVOID Context OPTIONAL
,
72 IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL
,
76 IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters
);
79 IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters
);
85 IntGetDesktopWindow (VOID
);
88 UserGetDesktopWindow(VOID
);
91 IntGetCurrentThreadDesktopWindow(VOID
);
93 PUSER_MESSAGE_QUEUE FASTCALL
94 IntGetFocusMessageQueue(VOID
);
97 IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue
);
100 IntGetActiveDesktop(VOID
);
103 co_IntShowDesktop(PDESKTOP Desktop
, ULONG Width
, ULONG Height
);
106 IntHideDesktop(PDESKTOP Desktop
);
108 BOOL
IntSetThreadDesktop(IN HDESK hDesktop
,
109 IN BOOL FreeOnFailure
);
112 IntValidateDesktopHandle(
114 KPROCESSOR_MODE AccessMode
,
115 ACCESS_MASK DesiredAccess
,
119 IntParseDesktopPath(PEPROCESS Process
,
120 PUNICODE_STRING DesktopPath
,
124 BOOL FASTCALL
IntDesktopUpdatePerUserSettings(BOOL bEnable
);
125 VOID APIENTRY
UserRedrawDesktop(VOID
);
126 BOOL
IntRegisterShellHookWindow(HWND hWnd
);
127 BOOL
IntDeRegisterShellHookWindow(HWND hWnd
);
128 VOID
co_IntShellHookNotify(WPARAM Message
, LPARAM lParam
);
129 HDC FASTCALL
UserGetDesktopDC(ULONG
,BOOL
,BOOL
);
131 #define IntIsActiveDesktop(Desktop) \
132 ((Desktop)->rpwinstaParent->ActiveDesktop == (Desktop))
134 #define GET_DESKTOP_NAME(d) \
135 OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d)) ? \
136 &(OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d))->Name) : \
139 HWND FASTCALL
IntGetMessageWindow(VOID
);
141 static __inline PVOID
142 DesktopHeapAlloc(IN PDESKTOP Desktop
,
145 return RtlAllocateHeap(Desktop
->pheapDesktop
,
151 DesktopHeapFree(IN PDESKTOP Desktop
,
154 return RtlFreeHeap(Desktop
->pheapDesktop
,
159 static __inline PVOID
160 DesktopHeapReAlloc(IN PDESKTOP Desktop
,
165 /* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
166 return RtlReAllocateHeap(Desktop
->pheapDesktop
,
174 PrevSize
= RtlSizeHeap(Desktop
->pheapDesktop
,
178 if (PrevSize
== Bytes
)
181 pNew
= RtlAllocateHeap(Desktop
->pheapDesktop
,
186 if (PrevSize
< Bytes
)
193 RtlFreeHeap(Desktop
->pheapDesktop
,
202 static __inline ULONG_PTR
203 DesktopHeapGetUserDelta(VOID
)
205 PW32HEAP_USER_MAPPING Mapping
;
207 PPROCESSINFO W32Process
;
208 PWIN32HEAP pheapDesktop
;
211 pti
= PsGetCurrentThreadWin32Thread();
215 pheapDesktop
= pti
->rpdesk
->pheapDesktop
;
217 W32Process
= PsGetCurrentProcessWin32Process();
218 Mapping
= W32Process
->HeapMappings
.Next
;
219 while (Mapping
!= NULL
)
221 if (Mapping
->KernelMapping
== (PVOID
)pheapDesktop
)
223 Delta
= (ULONG_PTR
)Mapping
->KernelMapping
- (ULONG_PTR
)Mapping
->UserMapping
;
227 Mapping
= Mapping
->Next
;
233 static __inline PVOID
234 DesktopHeapAddressToUser(PVOID lpMem
)
236 PW32HEAP_USER_MAPPING Mapping
;
237 PPROCESSINFO W32Process
;
239 W32Process
= PsGetCurrentProcessWin32Process();
240 Mapping
= W32Process
->HeapMappings
.Next
;
241 while (Mapping
!= NULL
)
243 if ((ULONG_PTR
)lpMem
>= (ULONG_PTR
)Mapping
->KernelMapping
&&
244 (ULONG_PTR
)lpMem
< (ULONG_PTR
)Mapping
->KernelMapping
+ Mapping
->Limit
)
246 return (PVOID
)(((ULONG_PTR
)lpMem
- (ULONG_PTR
)Mapping
->KernelMapping
) +
247 (ULONG_PTR
)Mapping
->UserMapping
);
250 Mapping
= Mapping
->Next
;