6 typedef struct _DESKTOP
8 PDESKTOPINFO pDeskInfo
;
10 /* Pointer to the associated window station. */
11 struct _WINSTATION_OBJECT
*rpwinstaParent
;
17 PSECTION_OBJECT hsectionDesktop
;
18 PWIN32HEAP pheapDesktop
;
21 /* use for tracking mouse moves. */
25 DWORD dwMouseHoverTime
;
28 /* Pointer to the active queue. */
29 PVOID ActiveMessageQueue
;
30 /* Handle of the desktop window. */
32 /* Thread blocking input */
33 PVOID BlockInputThread
;
34 LIST_ENTRY ShellHookWindows
;
38 #define DF_TME_HOVER 0x00000400
39 #define DF_TME_LEAVE 0x00000800
40 #define DF_DESTROYED 0x00008000
41 #define DF_DESKWNDDESTROYED 0x00010000
42 #define DF_DYING 0x00020000
45 extern PDESKTOP InputDesktop
;
46 extern HDESK InputDesktopHandle
;
47 extern PCLS DesktopWindowClass
;
48 extern HDC ScreenDeviceContext
;
49 extern BOOL g_PaintDesktopVersion
;
51 typedef struct _SHELL_HOOK_WINDOW
55 } SHELL_HOOK_WINDOW
, *PSHELL_HOOK_WINDOW
;
60 InitDesktopImpl(VOID
);
63 CleanupDesktopImpl(VOID
);
67 IntDesktopObjectParse(IN PVOID ParseObject
,
69 IN OUT PACCESS_STATE AccessState
,
70 IN KPROCESSOR_MODE AccessMode
,
72 IN OUT PUNICODE_STRING CompleteName
,
73 IN OUT PUNICODE_STRING RemainingName
,
74 IN OUT PVOID Context OPTIONAL
,
75 IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL
,
79 IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters
);
82 IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters
);
85 IntDesktopWindowProc(HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
);
91 IntGetDesktopWindow (VOID
);
94 UserGetDesktopWindow(VOID
);
97 IntGetCurrentThreadDesktopWindow(VOID
);
99 PUSER_MESSAGE_QUEUE FASTCALL
100 IntGetFocusMessageQueue(VOID
);
103 IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue
);
106 IntGetActiveDesktop(VOID
);
109 co_IntShowDesktop(PDESKTOP Desktop
, ULONG Width
, ULONG Height
);
112 IntHideDesktop(PDESKTOP Desktop
);
115 IntGetDesktopObjectHandle(PDESKTOP DesktopObject
);
117 BOOL
IntSetThreadDesktop(IN HDESK hDesktop
,
118 IN BOOL FreeOnFailure
);
121 IntValidateDesktopHandle(
123 KPROCESSOR_MODE AccessMode
,
124 ACCESS_MASK DesiredAccess
,
127 IntParseDesktopPath(PEPROCESS Process
,
128 PUNICODE_STRING DesktopPath
,
131 BOOL FASTCALL
IntDesktopUpdatePerUserSettings(BOOL bEnable
);
132 VOID APIENTRY
UserRedrawDesktop(VOID
);
133 BOOL
IntRegisterShellHookWindow(HWND hWnd
);
134 BOOL
IntDeRegisterShellHookWindow(HWND hWnd
);
135 VOID
co_IntShellHookNotify(WPARAM Message
, LPARAM lParam
);
136 HDC FASTCALL
UserGetDesktopDC(ULONG
,BOOL
,BOOL
);
137 BOOL FASTCALL
IntPaintDesktop(HDC hDC
);
139 #define IntIsActiveDesktop(Desktop) \
140 ((Desktop)->rpwinstaParent->ActiveDesktop == (Desktop))
142 #define GET_DESKTOP_NAME(d) \
143 OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d)) ? \
144 &(OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d))->Name) : \
147 HWND FASTCALL
IntGetMessageWindow(VOID
);
149 static __inline PVOID
150 DesktopHeapAlloc(IN PDESKTOP Desktop
,
153 return RtlAllocateHeap(Desktop
->pheapDesktop
,
159 DesktopHeapFree(IN PDESKTOP Desktop
,
162 return RtlFreeHeap(Desktop
->pheapDesktop
,
167 static __inline PVOID
168 DesktopHeapReAlloc(IN PDESKTOP Desktop
,
173 /* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
174 return RtlReAllocateHeap(Desktop
->pheapDesktop
,
182 PrevSize
= RtlSizeHeap(Desktop
->pheapDesktop
,
186 if (PrevSize
== Bytes
)
189 pNew
= RtlAllocateHeap(Desktop
->pheapDesktop
,
194 if (PrevSize
< Bytes
)
201 RtlFreeHeap(Desktop
->pheapDesktop
,
210 static __inline ULONG_PTR
211 DesktopHeapGetUserDelta(VOID
)
213 PW32HEAP_USER_MAPPING Mapping
;
215 PPROCESSINFO W32Process
;
216 PWIN32HEAP pheapDesktop
;
219 pti
= PsGetCurrentThreadWin32Thread();
223 pheapDesktop
= pti
->rpdesk
->pheapDesktop
;
225 W32Process
= PsGetCurrentProcessWin32Process();
226 Mapping
= W32Process
->HeapMappings
.Next
;
227 while (Mapping
!= NULL
)
229 if (Mapping
->KernelMapping
== (PVOID
)pheapDesktop
)
231 Delta
= (ULONG_PTR
)Mapping
->KernelMapping
- (ULONG_PTR
)Mapping
->UserMapping
;
235 Mapping
= Mapping
->Next
;
241 static __inline PVOID
242 DesktopHeapAddressToUser(PVOID lpMem
)
244 PW32HEAP_USER_MAPPING Mapping
;
245 PPROCESSINFO W32Process
;
247 W32Process
= PsGetCurrentProcessWin32Process();
248 Mapping
= W32Process
->HeapMappings
.Next
;
249 while (Mapping
!= NULL
)
251 if ((ULONG_PTR
)lpMem
>= (ULONG_PTR
)Mapping
->KernelMapping
&&
252 (ULONG_PTR
)lpMem
< (ULONG_PTR
)Mapping
->KernelMapping
+ Mapping
->Limit
)
254 return (PVOID
)(((ULONG_PTR
)lpMem
- (ULONG_PTR
)Mapping
->KernelMapping
) +
255 (ULONG_PTR
)Mapping
->UserMapping
);
258 Mapping
= Mapping
->Next
;