xref: /reactos/win32ss/user/ntuser/userfuncs.h (revision 08d10098)
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 
87 /*************** KEYBOARD.C ***************/
88 
89 DWORD FASTCALL UserGetKeyState(DWORD key);
90 DWORD FASTCALL UserGetKeyboardType(DWORD TypeFlag);
91 HKL FASTCALL UserGetKeyboardLayout(DWORD dwThreadId);
92 
93 
94 /*************** MISC.C ***************/
95 
96 int
97 __cdecl
98 _scwprintf(
99     const wchar_t *format,
100     ...);
101 
102 BOOL FASTCALL
103 UserSystemParametersInfo(
104   UINT uiAction,
105   UINT uiParam,
106   PVOID pvParam,
107   UINT fWinIni);
108 
109 VOID FASTCALL IntSetWindowState(PWND, UINT);
110 VOID FASTCALL IntClearWindowState(PWND, UINT);
111 PTHREADINFO FASTCALL IntTID2PTI(HANDLE);
112 HBRUSH FASTCALL GetControlBrush(PWND,HDC,UINT);
113 HBRUSH FASTCALL GetControlColor(PWND,PWND,HDC,UINT);
114 
115 NTSTATUS
116 GetProcessLuid(
117     IN PETHREAD Thread OPTIONAL,
118     IN PEPROCESS Process OPTIONAL,
119     OUT PLUID Luid);
120 
121 /*************** MESSAGE.C ***************/
122 
123 BOOL FASTCALL UserPostMessage(HWND Wnd,UINT Msg, WPARAM wParam, LPARAM lParam);
124 
125 /*************** WINDOW.C ***************/
126 
127 PWND FASTCALL UserGetWindowObject(HWND hWnd);
128 VOID FASTCALL co_DestroyThreadWindows(struct _ETHREAD *Thread);
129 HWND FASTCALL UserGetShellWindow(VOID);
130 HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags);
131 BOOLEAN co_UserDestroyWindow(PVOID Object);
132 PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type);
133 BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText);
134 DWORD FASTCALL IntGetWindowContextHelpId( PWND pWnd );
135 
136 /*************** MENU.C ***************/
137 
138 HMENU FASTCALL UserCreateMenu(PDESKTOP Desktop, BOOL PopupMenu);
139 BOOL FASTCALL UserSetMenuDefaultItem(PMENU Menu, UINT uItem, UINT fByPos);
140 BOOL FASTCALL UserDestroyMenu(HMENU hMenu);
141 
142 /************** NONCLIENT **************/
143 
144 VOID FASTCALL DefWndDoSizeMove(PWND pwnd, WORD wParam);
145 LRESULT NC_DoNCPaint(PWND,HDC,INT);
146 void FASTCALL NC_GetSysPopupPos(PWND, RECT *);
147 LRESULT NC_HandleNCActivate( PWND Wnd, WPARAM wParam, LPARAM lParam );
148 LRESULT NC_HandleNCCalcSize( PWND wnd, WPARAM wparam, RECTL *winRect, BOOL Suspended );
149 VOID NC_DrawFrame( HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle);
150 VOID UserDrawCaptionBar( PWND pWnd, HDC hDC, INT Flags);
151 void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect);
152 LRESULT NC_HandleNCLButtonDown(PWND Wnd, WPARAM wParam, LPARAM lParam);
153 LRESULT NC_HandleNCLButtonDblClk(PWND Wnd, WPARAM wParam, LPARAM lParam);
154 LRESULT NC_HandleNCRButtonDown( PWND wnd, WPARAM wParam, LPARAM lParam );
155 
156 /************** DEFWND **************/
157 
158 HBRUSH FASTCALL DefWndControlColor(HDC hDC,UINT ctlType);
159 BOOL UserDrawSysMenuButton(PWND pWnd, HDC hDC, LPRECT Rect, BOOL Down);
160 BOOL UserPaintCaption(PWND pWnd, INT Flags);
161 
162 /************** LAYERED **************/
163 
164 BOOL FASTCALL SetLayeredStatus(PWND pWnd, BYTE set);
165 BOOL FASTCALL GetLayeredStatus(PWND pWnd);
166 
167 /************** INPUT CONTEXT **************/
168 
169 PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData);
170 VOID UserFreeInputContext(PVOID Object);
171 BOOLEAN UserDestroyInputContext(PVOID Object);
172 PVOID AllocInputContextObject(PDESKTOP pDesk, PTHREADINFO pti, SIZE_T Size, PVOID* HandleOwner);
173 
174 /* EOF */
175