2003-12-07 19:29:33 +00:00
|
|
|
#ifndef _WIN32K_DESKTOP_H
|
|
|
|
#define _WIN32K_DESKTOP_H
|
|
|
|
|
|
|
|
#include "msgqueue.h"
|
|
|
|
#include "window.h"
|
|
|
|
|
2005-06-25 20:05:56 +00:00
|
|
|
typedef struct _DESKTOP_OBJECT
|
|
|
|
{
|
|
|
|
CSHORT Type;
|
|
|
|
CSHORT Size;
|
|
|
|
LIST_ENTRY ListEntry;
|
2005-09-24 02:50:02 +00:00
|
|
|
|
2005-06-25 20:05:56 +00:00
|
|
|
/* Pointer to the associated window station. */
|
|
|
|
struct _WINSTATION_OBJECT *WindowStation;
|
|
|
|
/* Pointer to the active queue. */
|
|
|
|
PVOID ActiveMessageQueue;
|
|
|
|
/* Rectangle of the work area */
|
|
|
|
RECT WorkArea;
|
|
|
|
/* Handle of the desktop window. */
|
|
|
|
HANDLE DesktopWindow;
|
|
|
|
/* Thread blocking input */
|
|
|
|
PVOID BlockInputThread;
|
|
|
|
|
|
|
|
LIST_ENTRY ShellHookWindows;
|
2006-04-05 08:05:55 +00:00
|
|
|
|
|
|
|
HANDLE hDesktopHeap;
|
|
|
|
PSECTION_OBJECT DesktopHeapSection;
|
2008-10-17 10:40:04 +00:00
|
|
|
PDESKTOPINFO DesktopInfo;
|
2005-06-25 20:05:56 +00:00
|
|
|
} DESKTOP_OBJECT, *PDESKTOP_OBJECT;
|
|
|
|
|
2003-12-07 19:29:33 +00:00
|
|
|
extern PDESKTOP_OBJECT InputDesktop;
|
2005-05-08 02:11:54 +00:00
|
|
|
extern HDESK InputDesktopHandle;
|
2006-04-05 08:05:55 +00:00
|
|
|
extern PWINDOWCLASS DesktopWindowClass;
|
2003-12-07 19:29:33 +00:00
|
|
|
extern HDC ScreenDeviceContext;
|
2004-12-06 02:23:05 +00:00
|
|
|
extern BOOL g_PaintDesktopVersion;
|
2003-12-07 19:29:33 +00:00
|
|
|
|
2005-03-13 23:08:51 +00:00
|
|
|
typedef struct _SHELL_HOOK_WINDOW
|
|
|
|
{
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
HWND hWnd;
|
|
|
|
} SHELL_HOOK_WINDOW, *PSHELL_HOOK_WINDOW;
|
|
|
|
|
2003-12-07 19:29:33 +00:00
|
|
|
NTSTATUS FASTCALL
|
|
|
|
InitDesktopImpl(VOID);
|
|
|
|
|
|
|
|
NTSTATUS FASTCALL
|
|
|
|
CleanupDesktopImpl(VOID);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2006-05-25 19:30:09 +00:00
|
|
|
NTSTATUS
|
|
|
|
STDCALL
|
|
|
|
IntDesktopObjectParse(IN PVOID ParseObject,
|
|
|
|
IN PVOID ObjectType,
|
|
|
|
IN OUT PACCESS_STATE AccessState,
|
|
|
|
IN KPROCESSOR_MODE AccessMode,
|
|
|
|
IN ULONG Attributes,
|
|
|
|
IN OUT PUNICODE_STRING CompleteName,
|
|
|
|
IN OUT PUNICODE_STRING RemainingName,
|
|
|
|
IN OUT PVOID Context OPTIONAL,
|
|
|
|
IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
|
|
|
|
OUT PVOID *Object);
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-03-12 14:15:49 +00:00
|
|
|
VOID STDCALL
|
2006-05-25 20:03:13 +00:00
|
|
|
IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters);
|
2005-03-12 14:15:49 +00:00
|
|
|
|
2004-05-08 12:42:46 +00:00
|
|
|
VOID FASTCALL
|
|
|
|
IntGetDesktopWorkArea(PDESKTOP_OBJECT Desktop, PRECT Rect);
|
2003-12-26 00:58:33 +00:00
|
|
|
|
2003-12-07 19:29:33 +00:00
|
|
|
LRESULT CALLBACK
|
|
|
|
IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
HDC FASTCALL
|
|
|
|
IntGetScreenDC(VOID);
|
|
|
|
|
2003-12-12 18:18:21 +00:00
|
|
|
HWND FASTCALL
|
|
|
|
IntGetDesktopWindow (VOID);
|
|
|
|
|
2007-10-19 23:21:45 +00:00
|
|
|
PWINDOW_OBJECT FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
UserGetDesktopWindow(VOID);
|
|
|
|
|
2004-07-09 20:57:38 +00:00
|
|
|
HWND FASTCALL
|
|
|
|
IntGetCurrentThreadDesktopWindow(VOID);
|
|
|
|
|
2003-12-07 19:29:33 +00:00
|
|
|
PUSER_MESSAGE_QUEUE FASTCALL
|
|
|
|
IntGetFocusMessageQueue(VOID);
|
|
|
|
|
|
|
|
VOID FASTCALL
|
|
|
|
IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue);
|
|
|
|
|
|
|
|
PDESKTOP_OBJECT FASTCALL
|
|
|
|
IntGetActiveDesktop(VOID);
|
|
|
|
|
2003-12-07 23:02:57 +00:00
|
|
|
NTSTATUS FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntShowDesktop(PDESKTOP_OBJECT Desktop, ULONG Width, ULONG Height);
|
2003-12-07 23:02:57 +00:00
|
|
|
|
|
|
|
NTSTATUS FASTCALL
|
|
|
|
IntHideDesktop(PDESKTOP_OBJECT Desktop);
|
|
|
|
|
2004-05-05 22:47:06 +00:00
|
|
|
HDESK FASTCALL
|
|
|
|
IntGetDesktopObjectHandle(PDESKTOP_OBJECT DesktopObject);
|
|
|
|
|
2006-04-15 10:41:58 +00:00
|
|
|
BOOL IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject,
|
|
|
|
IN BOOL FreeOnFailure);
|
2006-04-05 08:05:55 +00:00
|
|
|
|
2004-05-05 22:47:06 +00:00
|
|
|
NTSTATUS FASTCALL
|
|
|
|
IntValidateDesktopHandle(
|
|
|
|
HDESK Desktop,
|
|
|
|
KPROCESSOR_MODE AccessMode,
|
|
|
|
ACCESS_MASK DesiredAccess,
|
|
|
|
PDESKTOP_OBJECT *Object);
|
|
|
|
|
2004-11-20 16:46:06 +00:00
|
|
|
NTSTATUS FASTCALL
|
|
|
|
IntParseDesktopPath(PEPROCESS Process,
|
|
|
|
PUNICODE_STRING DesktopPath,
|
|
|
|
HWINSTA *hWinSta,
|
|
|
|
HDESK *hDesktop);
|
|
|
|
|
2004-12-10 16:52:04 +00:00
|
|
|
BOOL FASTCALL
|
|
|
|
IntDesktopUpdatePerUserSettings(BOOL bEnable);
|
|
|
|
|
2008-05-05 17:45:20 +00:00
|
|
|
VOID APIENTRY UserRedrawDesktop(VOID);
|
|
|
|
|
2005-03-13 23:08:51 +00:00
|
|
|
BOOL IntRegisterShellHookWindow(HWND hWnd);
|
|
|
|
BOOL IntDeRegisterShellHookWindow(HWND hWnd);
|
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
VOID co_IntShellHookNotify(WPARAM Message, LPARAM lParam);
|
2005-03-13 23:08:51 +00:00
|
|
|
|
2004-04-29 20:26:35 +00:00
|
|
|
#define IntIsActiveDesktop(Desktop) \
|
|
|
|
((Desktop)->WindowStation->ActiveDesktop == (Desktop))
|
|
|
|
|
2006-05-25 19:30:09 +00:00
|
|
|
#define GET_DESKTOP_NAME(d) \
|
|
|
|
OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d)) ? \
|
|
|
|
&(OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(d))->Name) : \
|
|
|
|
NULL
|
|
|
|
|
|
|
|
|
2006-04-05 08:05:55 +00:00
|
|
|
static __inline PVOID
|
2008-10-17 10:40:04 +00:00
|
|
|
DesktopHeapAlloc(IN PDESKTOPINFO Desktop,
|
2006-04-05 08:05:55 +00:00
|
|
|
IN SIZE_T Bytes)
|
|
|
|
{
|
|
|
|
return RtlAllocateHeap(Desktop->hKernelHeap,
|
|
|
|
HEAP_NO_SERIALIZE,
|
|
|
|
Bytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline BOOL
|
2008-10-17 10:40:04 +00:00
|
|
|
DesktopHeapFree(IN PDESKTOPINFO Desktop,
|
2006-04-05 08:05:55 +00:00
|
|
|
IN PVOID lpMem)
|
|
|
|
{
|
|
|
|
return RtlFreeHeap(Desktop->hKernelHeap,
|
|
|
|
HEAP_NO_SERIALIZE,
|
|
|
|
lpMem);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline PVOID
|
2008-10-17 10:40:04 +00:00
|
|
|
DesktopHeapReAlloc(IN PDESKTOPINFO Desktop,
|
2006-04-05 08:05:55 +00:00
|
|
|
IN PVOID lpMem,
|
|
|
|
IN SIZE_T Bytes)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
/* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
|
|
|
|
return RtlReAllocateHeap(Desktop->hKernelHeap,
|
|
|
|
HEAP_NO_SERIALIZE,
|
|
|
|
lpMem,
|
|
|
|
Bytes);
|
|
|
|
#else
|
|
|
|
SIZE_T PrevSize;
|
|
|
|
PVOID pNew;
|
|
|
|
|
|
|
|
PrevSize = RtlSizeHeap(Desktop->hKernelHeap,
|
|
|
|
HEAP_NO_SERIALIZE,
|
|
|
|
lpMem);
|
|
|
|
|
|
|
|
if (PrevSize == Bytes)
|
|
|
|
return lpMem;
|
|
|
|
|
|
|
|
pNew = RtlAllocateHeap(Desktop->hKernelHeap,
|
|
|
|
HEAP_NO_SERIALIZE,
|
|
|
|
Bytes);
|
|
|
|
if (pNew != NULL)
|
|
|
|
{
|
|
|
|
if (PrevSize < Bytes)
|
|
|
|
Bytes = PrevSize;
|
|
|
|
|
|
|
|
RtlCopyMemory(pNew,
|
|
|
|
lpMem,
|
|
|
|
Bytes);
|
|
|
|
|
|
|
|
RtlFreeHeap(Desktop->hKernelHeap,
|
|
|
|
HEAP_NO_SERIALIZE,
|
|
|
|
lpMem);
|
|
|
|
}
|
|
|
|
|
|
|
|
return pNew;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline ULONG_PTR
|
|
|
|
DesktopHeapGetUserDelta(VOID)
|
|
|
|
{
|
|
|
|
PW32HEAP_USER_MAPPING Mapping;
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2006-04-05 08:05:55 +00:00
|
|
|
HANDLE hDesktopHeap;
|
|
|
|
ULONG_PTR Delta = 0;
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ASSERT(pti->Desktop != NULL);
|
|
|
|
hDesktopHeap = pti->Desktop->hDesktopHeap;
|
2006-04-05 08:05:55 +00:00
|
|
|
|
2006-07-20 14:53:47 +00:00
|
|
|
Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
|
2006-04-05 08:05:55 +00:00
|
|
|
while (Mapping != NULL)
|
|
|
|
{
|
2007-11-15 19:42:41 +00:00
|
|
|
if (Mapping->KernelMapping == (PVOID)hDesktopHeap)
|
2006-04-05 08:05:55 +00:00
|
|
|
{
|
|
|
|
Delta = (ULONG_PTR)Mapping->KernelMapping - (ULONG_PTR)Mapping->UserMapping;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Mapping = Mapping->Next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
static __inline PVOID
|
2007-11-15 19:42:41 +00:00
|
|
|
DesktopHeapAddressToUser(PVOID lpMem)
|
2006-04-05 08:05:55 +00:00
|
|
|
{
|
|
|
|
PW32HEAP_USER_MAPPING Mapping;
|
|
|
|
|
2006-07-20 14:53:47 +00:00
|
|
|
Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
|
2006-04-05 08:05:55 +00:00
|
|
|
while (Mapping != NULL)
|
|
|
|
{
|
2007-11-15 19:42:41 +00:00
|
|
|
if ((ULONG_PTR)lpMem >= (ULONG_PTR)Mapping->KernelMapping &&
|
|
|
|
(ULONG_PTR)lpMem < (ULONG_PTR)Mapping->KernelMapping + Mapping->Limit)
|
2006-04-05 08:05:55 +00:00
|
|
|
{
|
2007-11-15 19:42:41 +00:00
|
|
|
return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)Mapping->KernelMapping) +
|
2006-04-05 08:05:55 +00:00
|
|
|
(ULONG_PTR)Mapping->UserMapping);
|
|
|
|
}
|
|
|
|
|
|
|
|
Mapping = Mapping->Next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-12-07 19:29:33 +00:00
|
|
|
#endif /* _WIN32K_DESKTOP_H */
|
|
|
|
|
|
|
|
/* EOF */
|