xref: /reactos/win32ss/user/ntuser/userfuncs.h (revision 84344399)
1 #pragma once
2 
3 // Win: ValidateHmenu
4 FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
5 {
6    PMENU pMenu = UserGetObject(gHandleTable, hMenu, TYPE_MENU);
7    if (!pMenu)
8    {
9       EngSetLastError(ERROR_INVALID_MENU_HANDLE);
10    }
11    return pMenu;
12 }
13 
14 #define ASSERT_REFS_CO(_obj_) \
15 { \
16    LONG ref = ((PHEAD)_obj_)->cLockObj;\
17    if (!(ref >= 1)){ \
18       ERR_CH(UserObj, "ASSERT: obj 0x%p, refs %ld\n", _obj_, ref); \
19       ASSERT(FALSE); \
20    } \
21 }
22 
23 #if 0
24 #define ASSERT_REFS_CO(_obj_) \
25 { \
26    PSINGLE_LIST_ENTRY e; \
27    BOOL gotit=FALSE; \
28    LONG ref = ((PHEAD)_obj_)->cLockObj;\
29    if (!(ref >= 1)){ \
30       ERR_CH(UserObj, "obj 0x%p, refs %i\n", _obj_, ref); \
31       ASSERT(FALSE); \
32    } \
33    \
34    e = PsGetCurrentThreadWin32Thread()->ReferencesList.Next; \
35    while (e) \
36    { \
37       PUSER_REFERENCE_ENTRY ref = CONTAINING_RECORD(e, USER_REFERENCE_ENTRY, Entry); \
38       if (ref->obj == _obj_){ gotit=TRUE; break; } \
39       e = e->Next; \
40    } \
41    ASSERT(gotit); \
42 }
43 #endif
44 
45 #define DUMP_REFS(obj) TRACE_CH(UserObj,"obj 0x%x, refs %i\n",obj, ((PHEAD)obj)->cLockObj)
46 
47 PWND FASTCALL IntGetWindowObject(HWND hWnd);
48 
49 /*************** DDE.C ****************/
50 
51 BOOL FASTCALL IntDdeSendMessageHook(PWND,UINT,WPARAM,LPARAM);
52 BOOL APIENTRY IntDdePostMessageHook(IN PWND,IN UINT,IN WPARAM,IN OUT LPARAM*,IN OUT LONG_PTR*);
53 BOOL APIENTRY IntDdeGetMessageHook(PMSG,LONG_PTR);
54 
55 /*************** MAIN.C ***************/
56 
57 NTSTATUS NTAPI InitThreadCallback(PETHREAD Thread);
58 
59 /*************** WINSTA.C ***************/
60 
61 HWINSTA FASTCALL UserGetProcessWindowStation(VOID);
62 
63 /*************** FOCUS.C ***************/
64 
65 HWND FASTCALL UserGetActiveWindow(VOID);
66 
67 HWND FASTCALL UserGetForegroundWindow(VOID);
68 
69 HWND FASTCALL co_UserSetFocus(PWND Window);
70 
71 /*************** WINDC.C ***************/
72 
73 INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint);
74 HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags);
75 HDC FASTCALL UserGetWindowDC(PWND Wnd);
76 
77 /*************** SESSION.C ***************/
78 
79 extern PRTL_ATOM_TABLE gAtomTable;
80 NTSTATUS FASTCALL InitSessionImpl(VOID);
81 
82 /*************** METRIC.C ***************/
83 
84 BOOL NTAPI InitMetrics(VOID);
85 LONG NTAPI UserGetSystemMetrics(ULONG Index);
86 BOOL FASTCALL UserIsDBCSEnabled(VOID);
87 BOOL FASTCALL UserIsIMMEnabled(VOID);
88 BOOL FASTCALL UserIsCiceroEnabled(VOID);
89 
90 /*************** KEYBOARD.C ***************/
91 
92 DWORD FASTCALL UserGetKeyState(DWORD key);
93 DWORD FASTCALL UserGetKeyboardType(DWORD TypeFlag);
94 HKL FASTCALL UserGetKeyboardLayout(DWORD dwThreadId);
95 
96 
97 /*************** MISC.C ***************/
98 
99 int
100 __cdecl
101 _scwprintf(
102     const wchar_t *format,
103     ...);
104 
105 BOOL FASTCALL
106 UserSystemParametersInfo(
107   UINT uiAction,
108   UINT uiParam,
109   PVOID pvParam,
110   UINT fWinIni);
111 
112 VOID FASTCALL IntSetWindowState(PWND, UINT);
113 VOID FASTCALL IntClearWindowState(PWND, UINT);
114 PTHREADINFO FASTCALL IntTID2PTI(HANDLE);
115 HBRUSH FASTCALL GetControlBrush(PWND,HDC,UINT);
116 HBRUSH FASTCALL GetControlColor(PWND,PWND,HDC,UINT);
117 
118 NTSTATUS
119 GetProcessLuid(
120     IN PETHREAD Thread OPTIONAL,
121     IN PEPROCESS Process OPTIONAL,
122     OUT PLUID Luid);
123 
124 /*************** MESSAGE.C ***************/
125 
126 BOOL FASTCALL UserPostMessage(HWND Wnd,UINT Msg, WPARAM wParam, LPARAM lParam);
127 
128 /*************** WINDOW.C ***************/
129 
130 PWND FASTCALL UserGetWindowObject(HWND hWnd);
131 VOID FASTCALL co_DestroyThreadWindows(struct _ETHREAD *Thread);
132 HWND FASTCALL UserGetShellWindow(VOID);
133 HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags);
134 BOOLEAN co_UserDestroyWindow(PVOID Object);
135 PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type);
136 BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText);
137 DWORD FASTCALL IntGetWindowContextHelpId( PWND pWnd );
138 
139 /*************** MENU.C ***************/
140 
141 HMENU FASTCALL UserCreateMenu(PDESKTOP Desktop, BOOL PopupMenu);
142 BOOL FASTCALL UserSetMenuDefaultItem(PMENU Menu, UINT uItem, UINT fByPos);
143 BOOL FASTCALL UserDestroyMenu(HMENU hMenu);
144 
145 /************** NONCLIENT **************/
146 
147 VOID FASTCALL DefWndDoSizeMove(PWND pwnd, WORD wParam);
148 LRESULT NC_DoNCPaint(PWND,HDC,INT);
149 void FASTCALL NC_GetSysPopupPos(PWND, RECT *);
150 LRESULT NC_HandleNCActivate( PWND Wnd, WPARAM wParam, LPARAM lParam );
151 LRESULT NC_HandleNCCalcSize( PWND wnd, WPARAM wparam, RECTL *winRect, BOOL Suspended );
152 VOID NC_DrawFrame( HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle);
153 VOID UserDrawCaptionBar( PWND pWnd, HDC hDC, INT Flags);
154 void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect);
155 LRESULT NC_HandleNCLButtonDown(PWND Wnd, WPARAM wParam, LPARAM lParam);
156 LRESULT NC_HandleNCLButtonDblClk(PWND Wnd, WPARAM wParam, LPARAM lParam);
157 LRESULT NC_HandleNCRButtonDown( PWND wnd, WPARAM wParam, LPARAM lParam );
158 
159 /************** DEFWND **************/
160 
161 HBRUSH FASTCALL DefWndControlColor(HDC hDC,UINT ctlType);
162 BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down);
163 BOOL UserPaintCaption(PWND pWnd, INT Flags);
164 
165 /************** LAYERED **************/
166 
167 BOOL FASTCALL SetLayeredStatus(PWND pWnd, BYTE set);
168 BOOL FASTCALL GetLayeredStatus(PWND pWnd);
169 
170 /************** INPUT CONTEXT **************/
171 
172 PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData);
173 VOID UserFreeInputContext(PVOID Object);
174 BOOLEAN UserDestroyInputContext(PVOID Object);
175 PVOID AllocInputContextObject(PDESKTOP pDesk, PTHREADINFO pti, SIZE_T Size, PVOID* HandleOwner);
176 
177 /* EOF */
178