[USER32]
[reactos.git] / reactos / win32ss / include / ntuser.h
index 5e7bf2c..e1ed160 100644 (file)
@@ -5,6 +5,7 @@ typedef struct _PROCESSINFO *PPROCESSINFO;
 typedef struct _THREADINFO *PTHREADINFO;
 struct _DESKTOP;
 struct _WND;
+struct tagPOPUPMENU;
 
 #define FIRST_USER_HANDLE 0x0020  /* first possible value for low word of user handle */
 #define LAST_USER_HANDLE  0xffef  /* last possible value for low word of user handle */
@@ -33,32 +34,33 @@ typedef struct _USER_HANDLE_TABLE
    int allocated_handles;
 } USER_HANDLE_TABLE, * PUSER_HANDLE_TABLE;
 
-typedef enum _USER_OBJECT_TYPE
+typedef enum _HANDLE_TYPE
 {
-  otFree = 0,
-  otWindow,
-  otMenu,
-  otCursorIcon,
-  otSMWP,
-  otHook,
-  otClipBoardData,
-  otCallProc,
-  otAccel,
-  otDDEaccess,
-  otDDEconv,
-  otDDExact,
-  otMonitor,
-  otKBDlayout,
-  otKBDfile,
-  otEvent,
-  otTimer,
-  otInputContext,
-  otHidData,
-  otDeviceInfo,
-  otTouchInput,
-  otGestureInfo,
-  USER_HANDLE_TYPE_COUNT
-} USER_OBJECT_TYPE;
+    TYPE_FREE = 0,
+    TYPE_WINDOW = 1,
+    TYPE_MENU = 2,
+    TYPE_CURSOR = 3,
+    TYPE_SETWINDOWPOS = 4,
+    TYPE_HOOK = 5,
+    TYPE_CLIPDATA = 6,
+    TYPE_CALLPROC = 7,
+    TYPE_ACCELTABLE = 8,
+    TYPE_DDEACCESS = 9,
+    TYPE_DDECONV = 10,
+    TYPE_DDEXACT = 11,
+    TYPE_MONITOR = 12,
+    TYPE_KBDLAYOUT = 13,
+    TYPE_KBDFILE = 14,
+    TYPE_WINEVENTHOOK = 15,
+    TYPE_TIMER = 16,
+    TYPE_INPUTCONTEXT = 17,
+    TYPE_HIDDATA = 18,
+    TYPE_DEVICEINFO = 19,
+    TYPE_TOUCHINPUTINFO = 20,
+    TYPE_GESTUREINFOOBJ = 21,
+    TYPE_CTYPES,
+    TYPE_GENERIC = 255
+} HANDLE_TYPE, *PHANDLE_TYPE;
 
 typedef enum _USERTHREADINFOCLASS
 {
@@ -68,6 +70,7 @@ typedef enum _USERTHREADINFOCLASS
     UserThreadWOWInformation,
     UserThreadHungStatus,
     UserThreadInitiateShutdown,
+
     UserThreadEndShutdown,
     UserThreadUseActiveDesktop,
     UserThreadUseDesktop,
@@ -118,6 +121,7 @@ typedef struct _DESKTOPINFO
     HWND hTaskManWindow;
     HWND hProgmanWindow;
     HWND hShellWindow;
+    struct _WND * spwndShell;
 
     PPROCESSINFO ppiShellProcess;
 
@@ -310,7 +314,7 @@ typedef struct tagITEM
     struct tagMENU* spSubMenu; /* Pop-up menu. */
     HANDLE hbmpChecked;
     HANDLE hbmpUnchecked;
-    USHORT* lpstr; /* Item text pointer. */
+    USHORT* Xlpstr; /* Item text pointer. */
     ULONG cch;
     DWORD_PTR dwItemData;
     ULONG xItem;   /* Item position. left */
@@ -323,6 +327,9 @@ typedef struct tagITEM
     HBITMAP hbmp;  /* bitmap */
     INT cxBmp;     /* Width Maximum size of the bitmap items in MIIM_BITMAP state */
     INT cyBmp;     /* Height " */
+    //// ReactOS
+    UNICODE_STRING lpstr;
+    struct tagITEM *Next;
 } ITEM, *PITEM;
 
 typedef struct tagMENULIST
@@ -344,7 +351,7 @@ typedef struct tagMENU
 {
     PROCDESKHEAD head;
     ULONG fFlags;             /* [Style flags | Menu flags] */
-    INT iItem;                /* nPos of selected item, if -1 not selected. */
+    INT iItem;                /* nPos of selected item, if -1 not selected. AKA focused item */
     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 */
@@ -360,8 +367,54 @@ typedef struct tagMENU
     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. */
+    //// ReactOS
+    LIST_ENTRY ListEntry;
+    HWND hWnd;           /* Window containing the menu */
+    BOOL TimeToHide;
 } MENU, *PMENU;
 
+typedef struct tagPOPUPMENU
+{
+ ULONG  fIsMenuBar:1;
+ ULONG  fHasMenuBar:1;
+ ULONG  fIsSysMenu:1;
+ ULONG  fIsTrackPopup:1;
+ ULONG  fDroppedLeft:1;
+ ULONG  fHierarchyDropped:1;
+ ULONG  fRightButton:1;
+ ULONG  fToggle:1;
+ ULONG  fSynchronous:1;
+ ULONG  fFirstClick:1;
+ ULONG  fDropNextPopup:1;
+ ULONG  fNoNotify:1;
+ ULONG  fAboutToHide:1;
+ ULONG  fShowTimer:1;
+ ULONG  fHideTimer:1;
+ ULONG  fDestroyed:1;
+ ULONG  fDelayedFree:1;
+ ULONG  fFlushDelayedFree:1;
+ ULONG  fFreed:1;
+ ULONG  fInCancel:1;
+ ULONG  fTrackMouseEvent:1;
+ ULONG  fSendUninit:1;
+ ULONG  fRtoL:1;
+//  ULONG  fDesktopMenu:1;
+ ULONG  iDropDir:5;
+ ULONG  fUseMonitorRect:1;
+ struct _WND *spwndNotify;
+ struct _WND *spwndPopupMenu;
+ struct _WND *spwndNextPopup;
+ struct _WND *spwndPrevPopup;
+ PMENU  spmenu;
+ PMENU  spmenuAlternate;
+ struct _WND *spwndActivePopup; 
+ struct tagPOPUPMENU *ppopupmenuRoot;
+ struct tagPOPUPMENU *ppmDelayedFree;
+ UINT   posSelectedItem;
+ UINT   posDropped;
+} POPUPMENU, *PPOPUPMENU;
+
+
 typedef struct _REGISTER_SYSCLASS
 {
     /* This is a reactos specific class used to initialize the
@@ -475,6 +528,9 @@ typedef struct _CLS
     HANDLE hIconSm; /* FIXME - Use pointer! */
     //PCURSOR spicnSm;
 
+    //// ReactOS dosn't suppot cache icons.
+    HICON hIconSmIntern; /* Internal small icon, derived from hIcon */
+    ////
     UINT Unicode : 1; // !CSF_ANSIPROC
     UINT Global : 1;  // CS_GLOBALCLASS or CSF_SERVERSIDEPROC
     UINT MenuNameIsString : 1;
@@ -513,8 +569,8 @@ typedef struct _SBINFOEX
 #define WNDS_HASPALETTE              0x00200000
 #define WNDS_PAINTNOTPROCESSED       0x00400000
 #define WNDS_SYNCPAINTPENDING        0x00800000
-#define WNDS_RECIEVEDQUERYSUSPENDMSG 0x01000000
-#define WNDS_RECIEVEDSUSPENDMSG      0x02000000
+#define WNDS_RECEIVEDQUERYSUSPENDMSG 0x01000000
+#define WNDS_RECEIVEDSUSPENDMSG      0x02000000
 #define WNDS_TOGGLETOPMOST           0x04000000
 #define WNDS_REDRAWIFHUNG            0x08000000
 #define WNDS_REDRAWFRAMEIFHUNG       0x10000000
@@ -651,6 +707,12 @@ typedef struct _SBWND
   SBCALC SBCalc;
 } SBWND, *PSBWND;
 
+typedef struct _MENUWND
+{
+   WND wnd;
+   PPOPUPMENU ppopupmenu;
+} MENUWND, *PMENUWND;
+
 typedef struct _PFNCLIENT
 {
     WNDPROC pfnScrollBarWndProc;
@@ -853,7 +915,7 @@ typedef struct _PERUSERSERVERINFO
     TEXTMETRICW   tmSysFont;
     DPISERVERINFO dpiSystem;
     HICON         hIconSmWindows;
-    HICON         hIcoWindows;
+    HICON         hIconWindows;
     DWORD         dwKeyCache;
     DWORD         dwAsyncKeyCache;
     ULONG         cCaptures;
@@ -976,6 +1038,43 @@ typedef struct tagSETCLIPBDATA
     BOOL fIncSerialNumber;
 } SETCLIPBDATA, *PSETCLIPBDATA;
 
+// Used with NtUserSetCursorIconData, last parameter.
+typedef struct tagCURSORDATA
+{
+   LPWSTR lpName;
+   LPWSTR lpModName;
+   USHORT rt;
+   USHORT dummy;
+   ULONG CURSORF_flags;
+   SHORT xHotspot;
+   SHORT yHotspot;
+   HBITMAP hbmMask;
+   HBITMAP hbmColor;
+   HBITMAP hbmAlpha;
+   RECT rcBounds;
+   HBITMAP hbmUserAlpha; // Could be in W7U, not in W2k
+   ULONG bpp;
+   ULONG cx;
+   ULONG cy;
+   INT cpcur;
+   INT cicur;
+   struct tagCURSORDATA * aspcur;
+   DWORD * aicur;
+   INT * ajifRate;
+   INT iicur;
+} CURSORDATA, *PCURSORDATA; /* !dso CURSORDATA */
+
+// CURSORF_flags:
+#define CURSORF_FROMRESOURCE 0x0001
+#define CURSORF_GLOBAL       0x0002
+#define CURSORF_LRSHARED     0x0004
+#define CURSORF_ACON         0x0008
+#define CURSORF_WOWCLEANUP   0x0010
+#define CURSORF_ACONFRAME    0x0040
+#define CURSORF_SECRET       0x0080
+#define CURSORF_LINKED       0x0100
+#define CURSORF_CURRENT      0x0200
+
 DWORD
 NTAPI
 NtUserAssociateInputContext(
@@ -1524,12 +1623,20 @@ NTAPI
 NtUserCloseWindowStation(
   HWINSTA hWinSta);
 
-DWORD
-NTAPI
+/* Console commands for NtUserConsoleControl */
+typedef enum _CONSOLECONTROL
+{
+    GuiConsoleWndClassAtom,
+    ConsoleMakePalettePublic = 5,
+    ConsoleAcquireDisplayOwnership,
+} CONSOLECONTROL, *PCONSOLECONTROL;
+
+NTSTATUS
+APIENTRY
 NtUserConsoleControl(
-  DWORD dwUnknown1,
-  DWORD dwUnknown2,
-  DWORD dwUnknown3);
+    IN CONSOLECONTROL ConsoleCtrl,
+    IN PVOID ConsoleCtrlInfo,
+    IN ULONG ConsoleCtrlInfoLength);
 
 HANDLE
 NTAPI
@@ -1856,11 +1963,13 @@ NTAPI
 NtUserGetAsyncKeyState(
   INT Key);
 
-DWORD
-NTAPI
+_Success_(return!=0)
+_At_(pustrName->Buffer, _Out_z_bytecap_post_bytecount_(pustrName->MaximumLength, return*2+2))
+ULONG
+APIENTRY
 NtUserGetAtomName(
-    ATOM nAtom,
-    PUNICODE_STRING pBuffer);
+    _In_ ATOM atom,
+    _Inout_ PUNICODE_STRING pustrName);
 
 UINT
 NTAPI
@@ -1947,8 +2056,8 @@ NTAPI
 NtUserGetCursorFrameInfo(
   HCURSOR hCursor,
   DWORD istep,
-  PDWORD rate_jiffies,
-  INT *num_steps);
+  INT* rate_jiffies,
+  DWORD* num_steps);
 
 BOOL
 NTAPI
@@ -1987,13 +2096,14 @@ NtUserGetGUIThreadInfo(
   DWORD idThread,
   LPGUITHREADINFO lpgui);
 
+_Success_(return!=FALSE)
 BOOL
 NTAPI
 NtUserGetIconInfo(
    _In_      HANDLE hCurIcon,
    _Out_opt_ PICONINFO IconInfo,
-   _Out_opt_ PUNICODE_STRING lpInstName,
-   _Out_opt_ PUNICODE_STRING lpResName,
+   _Inout_opt_ PUNICODE_STRING lpInstName,
+   _Inout_opt_ PUNICODE_STRING lpResName,
    _Out_opt_ LPDWORD pbpp,
    _In_      BOOL bInternal);
 
@@ -2388,13 +2498,13 @@ NtUserNotifyIMEStatus(
   DWORD Unknown1,
   DWORD Unknown2);
 
-DWORD
+BOOL
 NTAPI
 NtUserNotifyProcessCreate(
-    DWORD dwUnknown1,
-    DWORD dwUnknown2,
-    DWORD dwUnknown3,
-    DWORD dwUnknown4);
+    HANDLE NewProcessId,
+    HANDLE SourceThreadId,
+    DWORD dwUnknown,
+    ULONG CreateFlags);
 
 VOID
 NTAPI
@@ -2737,15 +2847,21 @@ NtUserSetCursorIconData(
   _In_ HCURSOR hCursor,
   _In_ PUNICODE_STRING pustrModule,
   _In_ PUNICODE_STRING puSrcName,
-  _In_ PICONINFO pii);
-  
+  _In_ const CURSORDATA* pCursorData);
+
+typedef struct _tagFINDEXISTINGCURICONPARAM
+{
+    BOOL bIcon;
+    LONG cx;
+    LONG cy;
+} FINDEXISTINGCURICONPARAM;
+
 HICON
 NTAPI
 NtUserFindExistingCursorIcon(
   _In_  PUNICODE_STRING pustrModule,
   _In_  PUNICODE_STRING pustrRsrc,
-  _In_  LONG cxDesired,
-  _In_  LONG cyDesired);
+  _In_  FINDEXISTINGCURICONPARAM* param);
 #else
 BOOL
 NTAPI
@@ -2756,7 +2872,7 @@ NtUserSetCursorIconData(
   HMODULE hModule,
   HRSRC hRsrc,
   HRSRC hGroupRsrc);
-  
+
 HICON
 NTAPI
 NtUserFindExistingCursorIcon(
@@ -3217,11 +3333,6 @@ NtUserWin32PoolAllocationStats(
   DWORD Unknown4,
   DWORD Unknown5);
 
-HWND
-NTAPI
-NtUserWindowFromPhysicalPoint(
-  POINT Point);
-
 HWND
 NTAPI
 NtUserWindowFromPoint(
@@ -3254,13 +3365,16 @@ typedef struct tagKMDDELPARAM
  * ReactOS-specific NtUser calls and their related structures, both which shouldn't exist.
  */
 
+#define NOPARAM_ROUTINE_ISCONSOLEMODE         0xffff0001
 #define NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO   0xffff0005
 #define ONEPARAM_ROUTINE_CSRSS_GUICHECK       0xffff0008
 #define ONEPARAM_ROUTINE_SWITCHCARETSHOWING   0xfffe0008
 #define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0xfffe000d
 #define ONEPARAM_ROUTINE_GETDESKTOPMAPPING    0xfffe000e
 #define TWOPARAM_ROUTINE_SETMENUBARHEIGHT   0xfffd0050
+#define TWOPARAM_ROUTINE_EXITREACTOS        0xfffd0051
 #define TWOPARAM_ROUTINE_SETGUITHRDHANDLE   0xfffd0052
+#define HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOWMOUSE 0xfffd0053
   #define MSQ_STATE_CAPTURE    0x1
   #define MSQ_STATE_ACTIVE     0x2
   #define MSQ_STATE_FOCUS      0x3
@@ -3271,21 +3385,6 @@ typedef struct tagKMDDELPARAM
 #define TWOPARAM_ROUTINE_ROS_UPDATEUISTATE  0x1004
 #define HWNDPARAM_ROUTINE_ROS_NOTIFYWINEVENT 0x1005
 
-DWORD
-NTAPI
-NtUserBuildMenuItemList(
- HMENU hMenu,
- PVOID Buffer,
- ULONG nBufSize,
- DWORD Reserved);
-
-UINT
-NTAPI
-NtUserGetMenuDefaultItem(
-  HMENU hMenu,
-  UINT fByPos,
-  UINT gmdiFlags);
-
 BOOL
 NTAPI
 NtUserGetMonitorInfo(
@@ -3308,26 +3407,22 @@ typedef struct tagROSMENUINFO
     DWORD dwContextHelpID;
     ULONG_PTR dwMenuData;
     /* ----------- Extra ----------- */
+    ULONG fFlags;       /* Menu flags (MF_POPUP, MF_SYSMENU) */
+    UINT iItem;         /* Currently focused item */
+    UINT cItems;        /* Number of items in the menu */
+    WORD cxMenu;        /* Width of the whole menu */
+    WORD cyMenu;        /* Height of the whole menu */
+    ULONG cxTextAlign;
+    PWND spwndNotify;     /* window receiving the messages for ownerdraw */
+    INT iTop;
+    INT iMaxTop;
+    DWORD dwArrowsOn:2;
+
     HMENU Self;         /* Handle of this menu */
-    WORD Flags;         /* Menu flags (MF_POPUP, MF_SYSMENU) */
-    UINT FocusedItem;   /* Currently focused item */
-    UINT MenuItemCount; /* Number of items in the menu */
     HWND Wnd;           /* Window containing the menu */
-    WORD Width;         /* Width of the whole menu */
-    WORD Height;        /* Height of the whole menu */
-    HWND WndOwner;     /* window receiving the messages for ownerdraw */
-    BOOL TimeToHide;   /* Request hiding when receiving a second click in the top-level menu item */
-    SIZE maxBmpSize;   /* Maximum size of the bitmap items in MIIM_BITMAP state */
+    BOOL TimeToHide;    /* Request hiding when receiving a second click in the top-level menu item */
 } ROSMENUINFO, *PROSMENUINFO;
 
-BOOL
-NTAPI
-NtUserMenuInfo(
- HMENU hmenu,
- PROSMENUINFO lpmi,
- BOOL fsog
-);
-
 typedef struct tagROSMENUITEMINFO
 {
     /* ----------- MENUITEMINFOW ----------- */
@@ -3347,18 +3442,9 @@ typedef struct tagROSMENUITEMINFO
     RECT Rect;      /* Item area (relative to menu window) */
     UINT dxTab;      /* X position of text after Tab */
     LPWSTR lpstr;    /* Copy of the text pointer in MenuItem->Text */
+    SIZE maxBmpSize;   /* Maximum size of the bitmap items in MIIM_BITMAP state */
 } ROSMENUITEMINFO, *PROSMENUITEMINFO;
 
-BOOL
-NTAPI
-NtUserMenuItemInfo(
- HMENU hMenu,
- UINT uItem,
- BOOL fByPosition,
- PROSMENUITEMINFO lpmii,
- BOOL fsog
-);
-
 HMONITOR
 NTAPI
 NtUserMonitorFromPoint(