1 #ifndef _WIN32K_DESKTOP_H
2 #define _WIN32K_DESKTOP_H
7 typedef struct _DESKTOP
15 /* Pointer to the associated window station. */
16 struct _WINSTATION_OBJECT
*WindowStation
;
17 /* Pointer to the active queue. */
18 PVOID ActiveMessageQueue
;
19 /* Rectangle of the work area */
21 /* Handle of the desktop window. */
23 /* Thread blocking input */
24 PVOID BlockInputThread
;
26 LIST_ENTRY ShellHookWindows
;
28 PWIN32HEAP pheapDesktop
;
29 PSECTION_OBJECT DesktopHeapSection
;
30 PDESKTOPINFO DesktopInfo
;
34 extern PDESKTOP InputDesktop
;
35 extern HDESK InputDesktopHandle
;
36 extern PCLS DesktopWindowClass
;
37 extern HDC ScreenDeviceContext
;
38 extern BOOL g_PaintDesktopVersion
;
40 typedef struct _SHELL_HOOK_WINDOW
44 } SHELL_HOOK_WINDOW
, *PSHELL_HOOK_WINDOW
;
47 InitDesktopImpl(VOID
);
50 CleanupDesktopImpl(VOID
);
54 IntDesktopObjectParse(IN PVOID ParseObject
,
56 IN OUT PACCESS_STATE AccessState
,
57 IN KPROCESSOR_MODE AccessMode
,
59 IN OUT PUNICODE_STRING CompleteName
,
60 IN OUT PUNICODE_STRING RemainingName
,
61 IN OUT PVOID Context OPTIONAL
,
62 IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL
,
66 IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters
);
69 IntGetDesktopWorkArea(PDESKTOP Desktop
, RECTL
*Rect
);
72 IntDesktopWindowProc(HWND hWnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
);
78 IntGetDesktopWindow (VOID
);
80 PWINDOW_OBJECT FASTCALL
81 UserGetDesktopWindow(VOID
);
84 IntGetCurrentThreadDesktopWindow(VOID
);
86 PUSER_MESSAGE_QUEUE FASTCALL
87 IntGetFocusMessageQueue(VOID
);
90 IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue
);
93 IntGetActiveDesktop(VOID
);
96 co_IntShowDesktop(PDESKTOP Desktop
, ULONG Width
, ULONG Height
);
99 IntHideDesktop(PDESKTOP Desktop
);
102 IntGetDesktopObjectHandle(PDESKTOP DesktopObject
);
104 BOOL
IntSetThreadDesktop(IN PDESKTOP DesktopObject
,
105 IN BOOL FreeOnFailure
);
108 IntValidateDesktopHandle(
110 KPROCESSOR_MODE AccessMode
,
111 ACCESS_MASK DesiredAccess
,
114 IntParseDesktopPath(PEPROCESS Process
,
115 PUNICODE_STRING DesktopPath
,
118 BOOL FASTCALL
IntDesktopUpdatePerUserSettings(BOOL bEnable
);
119 VOID APIENTRY
UserRedrawDesktop(VOID
);
120 BOOL
IntRegisterShellHookWindow(HWND hWnd
);
121 BOOL
IntDeRegisterShellHookWindow(HWND hWnd
);
122 VOID
co_IntShellHookNotify(WPARAM Message
, LPARAM lParam
);
123 HDC FASTCALL
UserGetDesktopDC(ULONG
,BOOL
,BOOL
);
125 #define IntIsActiveDesktop(Desktop) \
126 ((Desktop)->WindowStation->ActiveDesktop == (Desktop))
128 #define GET_DESKTOP_NAME(d) \
129 OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d)) ? \
130 &(OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d))->Name) : \
133 HWND FASTCALL
IntGetMessageWindow(VOID
);
135 static __inline PVOID
136 DesktopHeapAlloc(IN PDESKTOP Desktop
,
139 return RtlAllocateHeap(Desktop
->pheapDesktop
,
145 DesktopHeapFree(IN PDESKTOP Desktop
,
148 return RtlFreeHeap(Desktop
->pheapDesktop
,
153 static __inline PVOID
154 DesktopHeapReAlloc(IN PDESKTOP Desktop
,
159 /* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
160 return RtlReAllocateHeap(Desktop
->pheapDesktop
,
168 PrevSize
= RtlSizeHeap(Desktop
->pheapDesktop
,
172 if (PrevSize
== Bytes
)
175 pNew
= RtlAllocateHeap(Desktop
->pheapDesktop
,
180 if (PrevSize
< Bytes
)
187 RtlFreeHeap(Desktop
->pheapDesktop
,
196 static __inline ULONG_PTR
197 DesktopHeapGetUserDelta(VOID
)
199 PW32HEAP_USER_MAPPING Mapping
;
201 PPROCESSINFO W32Process
;
202 PWIN32HEAP pheapDesktop
;
205 pti
= PsGetCurrentThreadWin32Thread();
209 pheapDesktop
= pti
->Desktop
->pheapDesktop
;
211 W32Process
= PsGetCurrentProcessWin32Process();
212 Mapping
= W32Process
->HeapMappings
.Next
;
213 while (Mapping
!= NULL
)
215 if (Mapping
->KernelMapping
== (PVOID
)pheapDesktop
)
217 Delta
= (ULONG_PTR
)Mapping
->KernelMapping
- (ULONG_PTR
)Mapping
->UserMapping
;
221 Mapping
= Mapping
->Next
;
227 static __inline PVOID
228 DesktopHeapAddressToUser(PVOID lpMem
)
230 PW32HEAP_USER_MAPPING Mapping
;
231 PPROCESSINFO W32Process
;
233 W32Process
= PsGetCurrentProcessWin32Process();
234 Mapping
= W32Process
->HeapMappings
.Next
;
235 while (Mapping
!= NULL
)
237 if ((ULONG_PTR
)lpMem
>= (ULONG_PTR
)Mapping
->KernelMapping
&&
238 (ULONG_PTR
)lpMem
< (ULONG_PTR
)Mapping
->KernelMapping
+ Mapping
->Limit
)
240 return (PVOID
)(((ULONG_PTR
)lpMem
- (ULONG_PTR
)Mapping
->KernelMapping
) +
241 (ULONG_PTR
)Mapping
->UserMapping
);
244 Mapping
= Mapping
->Next
;
250 #endif /* _WIN32K_DESKTOP_H */