ReactOS 0.4.15-dev-7931-gfd331f1
win32.h
Go to the documentation of this file.
1#pragma once
2
3/* W32PROCESS flags */
4#define W32PF_CONSOLEAPPLICATION 0x00000001
5#define W32PF_FORCEOFFFEEDBACK 0x00000002
6#define W32PF_STARTGLASS 0x00000004
7#define W32PF_WOW 0x00000008
8#define W32PF_READSCREENACCESSGRANTED 0x00000010
9#define W32PF_INITIALIZED 0x00000020
10#define W32PF_APPSTARTING 0x00000040
11#define W32PF_WOW64 0x00000080
12#define W32PF_ALLOWFOREGROUNDACTIVATE 0x00000100
13#define W32PF_OWNDCCLEANUP 0x00000200
14#define W32PF_SHOWSTARTGLASSCALLED 0x00000400
15#define W32PF_FORCEBACKGROUNDPRIORITY 0x00000800
16#define W32PF_TERMINATED 0x00001000
17#define W32PF_CLASSESREGISTERED 0x00002000
18#define W32PF_THREADCONNECTED 0x00004000
19#define W32PF_PROCESSCONNECTED 0x00008000
20#define W32PF_SETFOREGROUNDALLOWED 0x00008000
21#define W32PF_WAKEWOWEXEC 0x00010000
22#define W32PF_WAITFORINPUTIDLE 0x00020000
23#define W32PF_IOWINSTA 0x00040000
24#define W32PF_CONSOLEFOREGROUND 0x00080000
25#define W32PF_OLELOADED 0x00100000
26#define W32PF_SCREENSAVER 0x00200000
27#define W32PF_IDLESCREENSAVER 0x00400000
28#define W32PF_DISABLEIME 0x00800000
29#define W32PF_ICONTITLEREGISTERED 0x10000000
30#define W32PF_DPIAWARE 0x20000000
31// ReactOS
32#define W32PF_NOWINDOWGHOSTING (0x01000000)
33#define W32PF_MANUALGUICHECK (0x02000000)
34#define W32PF_CREATEDWINORDC (0x04000000)
35#define W32PF_APIHOOKLOADED (0x08000000)
36
37#define QSIDCOUNTS 7
38
39typedef enum _QS_ROS_TYPES
40{
49
50extern BOOL ClientPfnInit;
52extern HANDLE hModuleWin; // This Win32k Instance.
53extern struct _CLS *SystemClassList;
55
56struct _TL;
57typedef struct _TL *PTL;
58
59typedef struct _W32THREAD
60{
72
73struct tagIMC;
74
75/*
76 * THREADINFO structure.
77 * See also: https://reactos.org/wiki/Techwiki:Win32k/THREADINFO
78 */
79#ifdef __cplusplus
80typedef struct _THREADINFO : _W32THREAD
81{
82#else
83typedef struct _THREADINFO
84{
86#endif
99 /* Queue of messages sent to the queue. */
101 /* Last message time and ID */
104 /* True if a WM_QUIT message is pending. */
106 /* The quit exit code. */
108 HDESK hdesk;
109 UINT cPaintsReady; /* Count of paints pending. */
110 UINT cTimersReady; /* Count of timers pending. */
122 /* Set if there are new messages specified by WakeMask in any of the queues. */
124 /* Handle for the above event (in the context of the process owning the queue). */
128 /* Last message cursor position */
130 /* Input context-related */
134
136 /* Queue of messages posted to the queue. */
142#ifndef __cplusplus
144 CLIENTTHREADINFO cti; // Used only when no Desktop or pcti NULL.
145
146 /* ReactOS */
147
148 /* Thread Queue state tracking */
149 // Send list QS_SENDMESSAGE
150 // Post list QS_POSTMESSAGE|QS_HOTKEY|QS_PAINT|QS_TIMER|QS_KEY
151 // Hard list QS_MOUSE|QS_KEY only
152 // Accounting of queue bit sets, the rest are flags. QS_TIMER QS_PAINT counts are handled in thread information.
153 DWORD nCntsQBits[QSIDCOUNTS]; // QS_KEY QS_MOUSEMOVE QS_MOUSEBUTTON QS_POSTMESSAGE QS_SENDMESSAGE QS_HOTKEY
154
159#if DBG
160 USHORT acExclusiveLockCount[GDIObjTypeTotal + 1];
161#endif
162#endif // __cplusplus
164
165
166#define IntReferenceThreadInfo(pti) \
167 InterlockedIncrement(&(pti)->RefCount)
168
170
171#define IntDereferenceThreadInfo(pti) \
172do { \
173 if (InterlockedDecrement(&(pti)->RefCount) == 0) \
174 { \
175 ASSERT(((pti)->TIF_flags & (TIF_INCLEANUP|TIF_DONTATTACHQUEUE)) == (TIF_INCLEANUP|TIF_DONTATTACHQUEUE)); \
176 UserDeleteW32Thread(pti); \
177 } \
178} while(0)
179
180
181#define IntReferenceProcessInfo(ppi) \
182 InterlockedIncrement((volatile LONG*)(&(ppi)->RefCount))
183
185
186#define IntDereferenceProcessInfo(ppi) \
187do { \
188 if (InterlockedDecrement((volatile LONG*)(&(ppi)->RefCount)) == 0) \
189 { \
190 ASSERT(((ppi)->W32PF_flags & W32PF_TERMINATED) != 0); \
191 UserDeleteW32Process(ppi); \
192 } \
193} while(0)
194
195
197{
204
205
206/*
207 * Information from STARTUPINFOW, psdk/winbase.h.
208 * Set from PsGetCurrentProcess()->Peb->ProcessParameters.
209 * See also: https://reactos.org/wiki/Techwiki:Win32k/PROCESSINFO
210*/
211typedef struct tagUSERSTARTUPINFO
212{
214 DWORD dwX; // STARTF_USEPOSITION StartupInfo->dwX/Y
216 DWORD dwXSize; // STARTF_USESIZE StartupInfo->dwX/YSize
218 DWORD dwFlags; // STARTF_ StartupInfo->dwFlags
219 WORD wShowWindow; // StartupInfo->wShowWindow
222
223typedef struct _W32PROCESS
224{
236 PEX_PUSH_LOCK GDIPushLock; /* Locking Process during access to structure. */
237 RTL_AVL_TABLE GDIEngUserMemAllocTable; /* Process AVL Table. */
241
242#define CLIBS 32
243
244/*
245 * PROCESSINFO structure.
246 * See also: https://reactos.org/wiki/Techwiki:Win32k/PROCESSINFO
247 */
248#ifdef __cplusplus
249typedef struct _PROCESSINFO : _W32PROCESS
250{
251#else
252typedef struct _PROCESSINFO
253{
255#endif
265 HANDLE ahmodLibLoaded[CLIBS];
267 HWINSTA hwinsta;
281
282 /* ReactOS */
287
294
295#if DBG
296 BYTE DbgChannelLevel[DbgChCount];
297#ifndef __cplusplus
298 DWORD DbgHandleCount[TYPE_CTYPES];
299#endif // __cplusplus
300#endif // DBG
302
303#if DBG
304void NTAPI UserDbgPreServiceHook(ULONG ulSyscallId, PULONG_PTR pulArguments);
306#endif
307
308/* Helper function used by some wine code */
309
310__forceinline
311int
313 _In_ LPCWSTR lpString)
314{
315 size_t size = wcslen(lpString);
317 return (int)size;
318}
319
320#define strlenW lstrlenW
unsigned char BOOLEAN
#define lstrlenW
Definition: compat.h:750
#define __drv_freesMem(kind)
Definition: driverspecs.h:272
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizeiptr size
Definition: glext.h:5919
#define ULONG_MAX
Definition: limits.h:44
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
@ TYPE_CTYPES
Definition: ntuser.h:62
#define NB_HOOKS
Definition: ntuser.h:127
#define _Pre_notnull_
Definition: ms_sal.h:680
#define _In_
Definition: ms_sal.h:308
UINT_PTR HKL
Definition: msctf.idl:143
unsigned int UINT
Definition: ndis.h:50
ULONG ACCESS_MASK
Definition: nt_native.h:40
unsigned long FLONG
Definition: ntbasedef.h:366
@ GDIObjTypeTotal
Definition: ntgdityp.h:152
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
Definition: ntuser.h:566
Definition: typedefs.h:120
INT cThreads
Definition: win32.h:262
UINT iClipSerialNumber
Definition: win32.h:271
PVOID pW32Job
Definition: win32.h:275
PPROCESSINFO ppiNext
Definition: win32.h:261
PVOID pClientBase
Definition: win32.h:273
HWINSTA hwinsta
Definition: win32.h:267
USERSTARTUPINFO usi
Definition: win32.h:278
HDESK hdeskStartup
Definition: win32.h:263
LIST_ENTRY PrivateMemFontListHead
Definition: win32.h:285
W32HEAP_USER_MAPPING HeapMappings
Definition: win32.h:290
DWORD dwhmodLibLoadedMask
Definition: win32.h:264
LUID luidSession
Definition: win32.h:277
DWORD dwRegisteredClasses
Definition: win32.h:280
HMONITOR hMonitor
Definition: win32.h:270
FAST_MUTEX PrivateFontListLock
Definition: win32.h:283
struct _CLS * pclsPrivateList
Definition: win32.h:259
struct _GDI_POOL * pPoolRgnAttr
Definition: win32.h:293
struct _CURICON_OBJECT * pCursorCache
Definition: win32.h:272
DWORD dwLpkEntryPoints
Definition: win32.h:274
struct _GDI_POOL * pPoolBrushAttr
Definition: win32.h:292
DWORD dwImeCompatFlags
Definition: win32.h:276
LIST_ENTRY DriverObjListHead
Definition: win32.h:289
PTHREADINFO ptiList
Definition: win32.h:256
struct _CLS * pclsPublicList
Definition: win32.h:260
struct _DESKTOP * rpdeskStartup
Definition: win32.h:258
FAST_MUTEX DriverObjListLock
Definition: win32.h:288
DWORD dwHotkey
Definition: win32.h:269
UINT PrivateMemFontHandleCount
Definition: win32.h:286
DWORD dwLayout
Definition: win32.h:279
LIST_ENTRY PrivateFontListHead
Definition: win32.h:284
ACCESS_MASK amwinsta
Definition: win32.h:268
struct _GDI_POOL * pPoolDcAttr
Definition: win32.h:291
PTHREADINFO ptiMainThread
Definition: win32.h:257
struct _WINSTATION_OBJECT * prpwinsta
Definition: win32.h:266
Definition: ntbasedef.h:628
struct _USER_MESSAGE_QUEUE * pqAttach
Definition: win32.h:115
struct _USER_SENT_MESSAGE * pusmCurrent
Definition: win32.h:98
PPROCESSINFO ppi
Definition: win32.h:88
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
struct tagMENUSTATE * pMenuState
Definition: win32.h:111
ULONG_PTR idLast
Definition: win32.h:103
DWORD dwExpWinVer
Definition: win32.h:112
INT cEnterCount
Definition: win32.h:135
UINT cVisWindows
Definition: win32.h:141
PTHREADINFO ptiSibling
Definition: win32.h:116
WPARAM wParamHkCurrent
Definition: win32.h:120
INT exitCode
Definition: win32.h:107
struct tagHOOK * sphkCurrent
Definition: win32.h:118
ULONG fsHooks
Definition: win32.h:117
LIST_ENTRY PostedMessagesListHead
Definition: win32.h:137
LPARAM lParamHkCurrent
Definition: win32.h:119
POINT ptLast
Definition: win32.h:129
CLIENTTHREADINFO cti
Definition: win32.h:144
ULONG cExclusiveLocks
Definition: win32.h:158
UINT cWindows
Definition: win32.h:140
DWORD nCntsQBits[QSIDCOUNTS]
Definition: win32.h:153
struct _USER_SENT_MESSAGE * pusmSent
Definition: win32.h:97
struct _CLIENTINFO * pClientInfo
Definition: win32.h:94
WORD fsChangeBitsRemoved
Definition: win32.h:138
HDESK hdesk
Definition: win32.h:108
PKEVENT pEventQueueServer
Definition: win32.h:125
LIST_ENTRY W32CallbackListHead
Definition: win32.h:156
DWORD dwCompatFlags
Definition: win32.h:113
BOOLEAN QuitPosted
Definition: win32.h:105
INT iCursorLevel
Definition: win32.h:127
struct tagIMC * spDefaultImc
Definition: win32.h:132
HKL hklPrev
Definition: win32.h:133
struct tagKL * KeyboardLayout
Definition: win32.h:90
LONG timeLast
Definition: win32.h:102
LIST_ENTRY aphkStart[NB_HOOKS]
FIXME!
Definition: win32.h:143
struct _CLIENTTHREADINFO * pcti
Definition: win32.h:91
UINT cTimersReady
Definition: win32.h:110
HANDLE hEventQueueClient
Definition: win32.h:123
PUNICODE_STRING pstrAppName
Definition: win32.h:96
FLONG TIF_flags
Definition: win32.h:95
SINGLE_LIST_ENTRY ReferencesList
Definition: win32.h:157
PTL ptl
Definition: win32.h:87
LIST_ENTRY SentMessagesListHead
Definition: win32.h:100
DWORD dwCompatFlags2
Definition: win32.h:114
struct _DESKTOP * rpdesk
Definition: win32.h:92
WCHAR wchInjected
Definition: win32.h:139
UINT cPaintsReady
Definition: win32.h:109
struct tagSBTRACK * pSBTrack
Definition: win32.h:121
struct _WND * spwndDefaultIme
Definition: win32.h:131
LIST_ENTRY WindowListHead
Definition: win32.h:155
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
LIST_ENTRY PtiLink
Definition: win32.h:126
Definition: ntuser.h:10
struct _W32HEAP_USER_MAPPING * Next
Definition: win32.h:198
ULONG_PTR Limit
Definition: win32.h:201
DWORD RefCount
Definition: win32.h:226
PVOID pDCAttrList
Definition: win32.h:231
DWORD W32Pid
Definition: win32.h:233
PKEVENT InputIdleEvent
Definition: win32.h:228
struct _W32PROCESS * NextStart
Definition: win32.h:230
PEPROCESS peProcess
Definition: win32.h:225
ULONG W32PF_flags
Definition: win32.h:227
LONG GDIHandleCount
Definition: win32.h:234
LIST_ENTRY GDIDcAttrFreeList
Definition: win32.h:238
LONG UserHandleCount
Definition: win32.h:235
RTL_AVL_TABLE GDIEngUserMemAllocTable
Definition: win32.h:237
LIST_ENTRY GDIBrushAttrFreeList
Definition: win32.h:239
DWORD StartCursorHideTime
Definition: win32.h:229
PVOID pBrushAttrList
Definition: win32.h:232
PEX_PUSH_LOCK GDIPushLock
Definition: win32.h:236
PVOID pUMPDObjs
Definition: win32.h:66
PVOID pgdiDcattr
Definition: win32.h:64
PTL ptlW32
Definition: win32.h:63
PVOID pUMPDObj
Definition: win32.h:70
PVOID pUMPDHeap
Definition: win32.h:67
PETHREAD pEThread
Definition: win32.h:61
PVOID pSemTable
Definition: win32.h:69
DWORD dwEngAcquireCount
Definition: win32.h:68
LONG RefCount
Definition: win32.h:62
PVOID pgdiBrushAttr
Definition: win32.h:65
Definition: ntuser.h:694
Definition: ntuser.h:199
Definition: input.h:27
WORD wShowWindow
Definition: win32.h:219
USHORT cbReserved2
Definition: win32.h:220
uint32_t * PULONG_PTR
Definition: typedefs.h:65
#define NTAPI
Definition: typedefs.h:36
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
VOID UserDeleteW32Thread(PTHREADINFO)
Definition: main.c:411
struct _W32THREAD W32THREAD
BOOL RegisteredSysClasses
struct _W32HEAP_USER_MAPPING * PW32HEAP_USER_MAPPING
HINSTANCE hModClient
Definition: ntuser.c:25
VOID UserDeleteW32Process(_Pre_notnull_ __drv_freesMem(Mem) PPROCESSINFO)
Definition: main.c:95
struct _TL * PTL
Definition: win32.h:57
struct tagUSERSTARTUPINFO * PUSERSTARTUPINFO
HANDLE hModuleWin
Definition: main.c:16
struct _CLS * SystemClassList
#define CLIBS
Definition: win32.h:242
struct _W32PROCESS * PW32PROCESS
struct tagUSERSTARTUPINFO USERSTARTUPINFO
enum _QS_ROS_TYPES * PQS_ROS_TYPES
BOOL ClientPfnInit
Definition: ntuser.c:26
_QS_ROS_TYPES
Definition: win32.h:40
@ QSRosMouseMove
Definition: win32.h:42
@ QSRosKey
Definition: win32.h:41
@ QSRosEvent
Definition: win32.h:47
@ QSRosHotKey
Definition: win32.h:46
@ QSRosSendMessage
Definition: win32.h:45
@ QSRosPostMessage
Definition: win32.h:44
@ QSRosMouseButton
Definition: win32.h:43
struct _THREADINFO THREADINFO
enum _QS_ROS_TYPES QS_ROS_TYPES
struct _W32HEAP_USER_MAPPING W32HEAP_USER_MAPPING
struct _PROCESSINFO PROCESSINFO
struct _W32PROCESS W32PROCESS
struct _W32THREAD * PW32THREAD
#define QSIDCOUNTS
Definition: win32.h:37
void NTAPI UserDbgPreServiceHook(ULONG ulSyscallId, PULONG_PTR pulArguments)
Definition: misc.c:779
ULONG_PTR NTAPI UserDbgPostServiceHook(ULONG ulSyscallId, ULONG_PTR ulResult)
Definition: misc.c:786
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
FAST_MUTEX
Definition: extypes.h:17
#define FAST_FAIL_RANGE_CHECK_FAILURE
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193