[WIN32K, USER32]
[reactos.git] / reactos / include / reactos / win32k / ntuser.h
index 1f4081d..f07263a 100644 (file)
@@ -6,6 +6,21 @@ typedef struct _THREADINFO *PTHREADINFO;
 struct _DESKTOP;
 struct _WND;
 
+typedef enum _USERTHREADINFOCLASS
+{
+    UserThreadShutdownInformation,
+    UserThreadFlags,
+    UserThreadTaskName,
+    UserThreadWOWInformation,
+    UserThreadHungStatus,
+    UserThreadInitiateShutdown,
+    UserThreadEndShutdown,
+    UserThreadUseActiveDesktop,
+    UserThreadUseDesktop,
+    UserThreadRestoreDesktop,
+    UserThreadCsrApiPort,
+} USERTHREADINFOCLASS;
+
 typedef struct _LARGE_UNICODE_STRING
 {
   ULONG Length;
@@ -40,13 +55,13 @@ typedef struct _DESKTOPINFO
 {
     PVOID pvDesktopBase;
     PVOID pvDesktopLimit;
+    struct _WND *spwnd;
+    DWORD fsHooks;
+    struct tagHOOK * aphkStart[16];
 
-    HANDLE hKernelHeap;
-    ULONG_PTR HeapLimit;
     HWND hTaskManWindow;
     HWND hProgmanWindow;
     HWND hShellWindow;
-    struct _WND *Wnd;
 
     union
     {
@@ -94,13 +109,19 @@ typedef struct _THRDESKHEAD
 
 typedef struct _PROCDESKHEAD
 {
-  HANDLE h;
-  DWORD  cLockObj;  
+  HEAD;
   DWORD hTaskWow;
   struct _DESKTOP *rpdesk;
   PVOID       pSelf;
 } PROCDESKHEAD, *PPROCDESKHEAD;
 
+typedef struct _PROCMARKHEAD
+{
+  HEAD;
+  ULONG hTaskWow;
+  PPROCESSINFO ppi;
+} PROCMARKHEAD, *PPROCMARKHEAD;
+
 #define UserHMGetHandle(obj) ((obj)->head.h)
 
 /* Window Client Information structure */
@@ -118,13 +139,50 @@ typedef struct tagHOOK
   UNICODE_STRING ModuleName; /* Module name for global hooks */
 } HOOK, *PHOOK;
 
+/* THREADINFO Flags */
+#define TIF_INCLEANUP               0x00000001
+#define TIF_16BIT                   0x00000002
+#define TIF_SYSTEMTHREAD            0x00000004
+#define TIF_CSRSSTHREAD             0x00000008
+#define TIF_TRACKRECTVISIBLE        0x00000010
+#define TIF_ALLOWFOREGROUNDACTIVATE 0x00000020
+#define TIF_DONTATTACHQUEUE         0x00000040
+#define TIF_DONTJOURNALATTACH       0x00000080
+#define TIF_WOW64                   0x00000100
+#define TIF_INACTIVATEAPPMSG        0x00000200
+#define TIF_SPINNING                0x00000400
+#define TIF_PALETTEAWARE            0x00000800
+#define TIF_SHAREDWOW               0x00001000
+#define TIF_FIRSTIDLE               0x00002000
+#define TIF_WAITFORINPUTIDLE        0x00004000
+#define TIF_MOVESIZETRACKING        0x00008000
+#define TIF_VDMAPP                  0x00010000
+#define TIF_DOSEMULATOR             0x00020000
+#define TIF_GLOBALHOOKER            0x00040000
+#define TIF_DELAYEDEVENT            0x00080000
+#define TIF_MSGPOSCHANGED           0x00100000
+#define TIF_SHUTDOWNCOMPLETE        0x00200000
+#define TIF_IGNOREPLAYBACKDELAY     0x00400000
+#define TIF_ALLOWOTHERACCOUNTHOOK   0x00800000
+#define TIF_GUITHREADINITIALIZED    0x02000000
+#define TIF_DISABLEIME              0x04000000
+#define TIF_INGETTEXTLENGTH         0x08000000
+#define TIF_ANSILENGTH              0x10000000
+#define TIF_DISABLEHOOKS            0x20000000
+
 typedef struct _CALLBACKWND
 {
      HWND hWnd;
      PVOID pvWnd;
 } CALLBACKWND, *PCALLBACKWND;
 
-#define CI_CURTHPRHOOK    0x00000010
+#define CI_TRANSACTION       0x00000001
+#define CI_QUEUEMSG          0x00000002
+#define CI_WOW               0x00000004
+#define CI_INITTHREAD        0x00000008
+#define CI_CURTHPRHOOK       0x00000010
+#define CI_CLASSESREGISTERED 0x00000020
+#define CI_IMMACTIVATE       0x00000040
 
 typedef struct _CLIENTINFO
 {
@@ -133,7 +191,7 @@ typedef struct _CLIENTINFO
     DWORD dwExpWinVer;
     DWORD dwCompatFlags;
     DWORD dwCompatFlags2;
-    DWORD dwTIFlags;
+    DWORD dwTIFlags; // ThreadInfo TIF_Xxx flags for User space.
     PDESKTOPINFO pDeskInfo;
     ULONG_PTR ulClientDelta;
     PHOOK phkCurrent;
@@ -158,11 +216,74 @@ typedef struct _CLIENTINFO
     PPROCESSINFO ppi;
 } CLIENTINFO, *PCLIENTINFO;
 
-/* Make sure it fits exactly into the TEB */
-C_ASSERT(sizeof(CLIENTINFO) == FIELD_OFFSET(TEB, glDispatchTable) - FIELD_OFFSET(TEB, Win32ClientInfo));
+/* Make sure it fits into the TEB */
+C_ASSERT(sizeof(CLIENTINFO) <= sizeof(((PTEB)0)->Win32ClientInfo));
 
 #define GetWin32ClientInfo() ((PCLIENTINFO)(NtCurrentTeb()->Win32ClientInfo))
 
+/* Menu Item fType. */
+#define MFT_RTOL 0x6000
+
+typedef struct tagITEM
+{
+    UINT fType;
+    UINT fState;
+    UINT wID;
+    struct tagMENU* spSubMenu; /* Pop-up menu. */
+    HANDLE hbmpChecked;
+    HANDLE hbmpUnchecked;
+    USHORT* lpstr; /* Item text pointer. */
+    ULONG cch;
+    DWORD_PTR dwItemData;
+    ULONG xItem;   /* Item position. left */
+    ULONG yItem;   /*     "          top */
+    ULONG cxItem;  /* Item Size Width */
+    ULONG cyItem;  /*     "     Height */
+    ULONG dxTab;   /* X position of text after Tab */
+    ULONG ulX;     /* underline.. start position */
+    ULONG ulWidth; /* underline.. width */
+    HBITMAP hbmp;  /* bitmap */
+    INT cxBmp;     /* Width Maximum size of the bitmap items in MIIM_BITMAP state */
+    INT cyBmp;     /* Height " */
+} ITEM, *PITEM;
+
+typedef struct tagMENULIST
+{
+   struct tagMENULIST* pNext;
+   struct tagMENU*     pMenu;
+} MENULIST, *PMENULIST;
+
+/* Menu fFlags, upper byte is MNS_X style flags. */
+#define MNF_POPUP       0x0001
+#define MNF_UNDERLINE   0x0004
+#define MNF_INACTIVE    0x0010
+#define MNF_RTOL        0x0020
+#define MNF_DESKTOPMN   0x0040
+#define MNF_SYSDESKMN   0x0080
+#define MNF_SYSSUBMENU  0x0100
+
+typedef struct tagMENU
+{
+    PROCDESKHEAD head;
+    ULONG fFlags;             /* [Style flags | Menu flags] */
+    INT iItem;                /* nPos of selected item, if -1 not selected. */
+    UINT cAlloced;            /* Number of allocated items. Inc's of 8 */
+    UINT cItems;              /* Number of items in the menu */
+    ULONG cxMenu;             /* Width of the whole menu */
+    ULONG cyMenu;             /* Height of the whole menu */
+    ULONG cxTextAlign;        /* Offset of text when items have both bitmaps and text */
+    struct _WND *spwndNotify; /* window receiving the messages for ownerdraw */
+    PITEM rgItems;            /* Array of menu items */
+    struct tagMENULIST* pParentMenus; /* If this is SubMenu, list of parents. */
+    DWORD dwContextHelpId;
+    ULONG cyMax;              /* max height of the whole menu, 0 is screen height */
+    DWORD_PTR dwMenuData;     /* application defined value */
+    HBRUSH hbrBack;           /* brush for menu background */
+    INT iTop;                 /* Current scroll position Top */
+    INT iMaxTop;              /* Current scroll position Max Top */
+    DWORD dwArrowsOn:2;       /* Arrows: 0 off, 1 on, 2 to the top, 3 to the bottom. */
+} MENU, *PMENU;
+
 typedef struct _REGISTER_SYSCLASS
 {
     /* This is a reactos specific class used to initialize the
@@ -393,7 +514,7 @@ typedef struct _WND
     HRGN hrgnClip;
     HRGN hrgnNewFrame;
     /* Window name. */
-    UNICODE_STRING strName;
+    LARGE_UNICODE_STRING strName;
     /* Size of the extra data associated with the window. */
     ULONG cbwndExtra;
     HWND hWndLastActive;
@@ -732,6 +853,8 @@ typedef struct _USERCONNECT
 //
 #define DCX_USESTYLE     0x00010000
 #define DCX_KEEPCLIPRGN  0x00040000
+#define DCX_KEEPLAYOUT   0x40000000
+#define DCX_PROCESSOWNED 0x80000000
 
 //
 // Non SDK Queue message types.
@@ -1209,22 +1332,22 @@ NtUserCallNextHookEx(
   LPARAM lParam,
   BOOL Ansi);
 
-DWORD
+DWORD_PTR
 NTAPI
 NtUserCallNoParam(
   DWORD Routine);
 
-DWORD
+DWORD_PTR
 NTAPI
 NtUserCallOneParam(
-  DWORD Param,
+  DWORD_PTR Param,
   DWORD Routine);
 
-DWORD
+DWORD_PTR
 NTAPI
 NtUserCallTwoParam(
-  DWORD Param1,
-  DWORD Param2,
+  DWORD_PTR Param1,
+  DWORD_PTR Param2,
   DWORD Routine);
 
 BOOL
@@ -1346,31 +1469,12 @@ NtUserCreateLocalMemHandle(
   DWORD Unknown2,
   DWORD Unknown3);
 
-HWND
-NTAPI
-NtUserCreateWindowEx(
-  DWORD dwExStyle,
-  PUNICODE_STRING lpClassName,
-  PUNICODE_STRING lpWindowName,
-  DWORD dwStyle,
-  LONG x,
-  LONG y,
-  LONG nWidth,
-  LONG nHeight,
-  HWND hWndParent,
-  HMENU hMenu,
-  HINSTANCE hInstance,
-  LPVOID lpParam,
-  DWORD dwShowMode,
-  BOOL bUnicodeWindow,
-  DWORD dwUnknown);
-#if 0
 HWND
 NTAPI
 NtUserCreateWindowEx(
   DWORD dwExStyle, // |= 0x80000000 == Ansi used to set WNDS_ANSICREATOR
   PLARGE_STRING plstrClassName,
-  PLARGE_STRING plstrClsVesrion,
+  PLARGE_STRING plstrClsVersion,
   PLARGE_STRING plstrWindowName,
   DWORD dwStyle,
   int x,
@@ -1383,7 +1487,6 @@ NtUserCreateWindowEx(
   LPVOID lpParam,
   DWORD dwFlags,
   PVOID acbiBuffer);
-#endif
 
 HWINSTA
 NTAPI
@@ -1503,6 +1606,15 @@ NtUserDrawCaptionTemp(
   const PUNICODE_STRING str,
   UINT uFlags);
 
+// Used with NtUserDrawIconEx, last parameter.
+typedef struct _DRAWICONEXDATA
+{
+  HBITMAP hbmMask;
+  HBITMAP hbmColor;
+  int cx;
+  int cy;
+} DRAWICONEXDATA, *PDRAWICONEXDATA;
+
 BOOL
 NTAPI
 NtUserDrawIconEx(
@@ -1515,8 +1627,8 @@ NtUserDrawIconEx(
   UINT istepIfAniCur,
   HBRUSH hbrFlickerFreeDraw,
   UINT diFlags,
-  DWORD Unknown0,
-  DWORD Unknown1);
+  BOOL bMetaHDC,
+  PVOID pDIXData);
 
 DWORD
 NTAPI
@@ -1973,7 +2085,7 @@ enum ThreadStateRoutines
     THREADSTATE_GETINPUTSTATE
 };
 
-DWORD
+DWORD_PTR
 NTAPI
 NtUserGetThreadState(
   DWORD Routine);
@@ -2422,13 +2534,13 @@ NTAPI
 NtUserResolveDesktopForWOW(
   DWORD Unknown0);
 
-DWORD
+BOOL
 NTAPI
 NtUserSBGetParms(
-  DWORD Unknown0,
-  DWORD Unknown1,
-  DWORD Unknown2,
-  DWORD Unknown3);
+  HWND hwnd,
+  int fnBar,
+  PSBDATA pSBData,
+  LPSCROLLINFO lpsi);
 
 BOOL
 NTAPI
@@ -2564,13 +2676,14 @@ NtUserSetInformationProcess(
     DWORD dwUnknown3,
     DWORD dwUnknown4);
 
-DWORD
+NTSTATUS
 NTAPI
 NtUserSetInformationThread(
-    DWORD dwUnknown1,
-    DWORD dwUnknown2,
-    DWORD dwUnknown3,
-    DWORD dwUnknown4);
+    IN HANDLE ThreadHandle,
+    IN USERTHREADINFOCLASS ThreadInformationClass,
+    IN PVOID ThreadInformation,
+    IN ULONG ThreadInformationLength
+);
 
 DWORD
 NTAPI
@@ -2844,7 +2957,7 @@ BOOL
 NTAPI
 NtUserTranslateMessage(
   LPMSG lpMsg,
-  HKL dwhkl );
+  UINT flags );
 
 BOOL
 NTAPI
@@ -3005,8 +3118,8 @@ typedef struct tagKMDDELPARAM
     {
       struct
         {
-          UINT uiLo;
-          UINT uiHi;
+          UINT_PTR uiLo;
+          UINT_PTR uiHi;
         } Packed;
       LPARAM Unpacked;
     } Value;
@@ -3022,13 +3135,11 @@ typedef struct tagKMDDELPARAM
 
 #define NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO   0xffff0005
 #define NOPARAM_ROUTINE_ANYPOPUP              0xffff0006
-#define NOPARAM_ROUTINE_CSRSS_INITIALIZED     0xffff0007
 #define ONEPARAM_ROUTINE_CSRSS_GUICHECK       0xffff0008
 #define ONEPARAM_ROUTINE_SWITCHCARETSHOWING   0xfffe0008
 #define ONEPARAM_ROUTINE_ISWINDOWINDESTROY    0xfffe000c
 #define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0xfffe000d
 #define ONEPARAM_ROUTINE_GETDESKTOPMAPPING    0xfffe000e
-#define ONEPARAM_ROUTINE_CREATECURICONHANDLE  0xfffe0025 // CREATE_EMPTY_CURSOR_OBJECT ?
 #define ONEPARAM_ROUTINE_MSQSETWAKEMASK       0xfffe0027
 #define ONEPARAM_ROUTINE_GETCURSORPOSITION    0xfffe0048 // use ONEPARAM_ or TWOPARAM routine ?
 #define TWOPARAM_ROUTINE_GETWINDOWRGNBOX    0xfffd0048 // user mode
@@ -3053,13 +3164,6 @@ NtUserBuildMenuItemList(
  ULONG nBufSize,
  DWORD Reserved);
 
-/* Use ONEPARAM_ROUTINE_CREATEEMPTYCURSOROBJECT (0x21) ? */
-HANDLE
-NTAPI
-NtUserCreateCursorIconHandle(
-  PICONINFO IconInfo,
-  BOOL Indirect);
-
 
 /* Should be done in usermode and use NtUserGetCPD. */
 ULONG_PTR
@@ -3092,22 +3196,6 @@ NtUserGetMonitorInfo(
   OUT LPMONITORINFO pMonitorInfo);
 
 /* Should be done in usermode */
-BOOL
-NTAPI
-NtUserGetScrollInfo(
-  HWND hwnd,
-  int fnBar,
-  LPSCROLLINFO lpsi);
-
-HWND
-NTAPI
-NtUserGetWindow(HWND hWnd, UINT Relationship);
-
-/* Should be done in usermode and use NtUserGetCPD. */
-LONG
-NTAPI
-NtUserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi);
-
 
 /* (other FocusedItem values give the position of the focused item) */
 #define NO_SELECTED_ITEM  0xffff
@@ -3162,8 +3250,8 @@ typedef struct tagROSMENUITEMINFO
     HBITMAP hbmpItem;
     /* ----------- Extra ----------- */
     RECT Rect;      /* Item area (relative to menu window) */
-    UINT XTab;      /* X position of text after Tab */
-    LPWSTR Text;    /* Copy of the text pointer in MenuItem->Text */
+    UINT dxTab;      /* X position of text after Tab */
+    LPWSTR lpstr;    /* Copy of the text pointer in MenuItem->Text */
 } ROSMENUITEMINFO, *PROSMENUITEMINFO;
 
 BOOL