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