ReactOS 0.4.15-dev-8076-g06e89b2
defwnd.c File Reference
#include <user32.h>
#include <immdev.h>
Include dependency graph for defwnd.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
DWORD WINAPI DECLSPEC_HOTPATCH GetSysColor (int nIndex)
 
HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush (int nIndex)
 
BOOL WINAPI SetSysColors (int cElements, CONST INT *lpaElements, CONST COLORREF *lpaRgbValues)
 
BOOL FASTCALL DefSetText (HWND hWnd, PCWSTR String, BOOL Ansi)
 
HWND FASTCALL IntFindChildWindowToOwner (HWND hRoot, HWND hOwner)
 
static VOID DefWndTrackScrollBar (HWND Wnd, WPARAM wParam, POINT Pt)
 
LRESULT WINAPI DoAppSwitch (WPARAM wParam, LPARAM lParam)
 
LRESULT DefWndHandleSysCommand (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
HBRUSH DefWndControlColor (HDC hDC, UINT ctlType)
 
static BOOL CALLBACK UserSendUiUpdateMsg (HWND hwnd, LPARAM lParam)
 
static void UserPaintCaption (PWND pwnd, INT Flags)
 
LRESULT FASTCALL DefWndGetIcon (PWND pWnd, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI User32DefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
 
LRESULT WINAPI RealDefWindowProcA (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI RealDefWindowProcW (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI DefWindowProcA (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI DefWindowProcW (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ DefSetText()

BOOL FASTCALL DefSetText ( HWND  hWnd,
PCWSTR  String,
BOOL  Ansi 
)

Definition at line 61 of file defwnd.c.

62{
63 BOOL Ret;
64 LARGE_STRING lsString;
65
66 if ( String )
67 {
68 if ( Ansi )
70 else
72 }
73 Ret = NtUserDefSetText(hWnd, (String ? &lsString : NULL));
74
75 return Ret;
76}
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID NTAPI RtlInitLargeAnsiString(IN OUT PLARGE_ANSI_STRING, IN PCSZ, IN INT)
Definition: rtlstr.c:17
BOOL NTAPI NtUserDefSetText(HWND WindowHandle, PLARGE_STRING WindowText)
Definition: window.c:4453
VOID NTAPI RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING, IN PCWSTR, IN INT)
Definition: rtlstr.c:42
CONST char * PCSZ
Definition: umtypes.h:125
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433

◆ DefWindowProcA()

LRESULT WINAPI DefWindowProcA ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1237 of file defwnd.c.

1238{
1239 BOOL Hook, msgOverride = FALSE;
1240 LRESULT Result = 0;
1241
1243
1244 Hook = BeginIfHookedUserApiHook();
1245 if (Hook)
1246 {
1247 msgOverride = IsMsgOverride(Msg, &guah.DefWndProcArray);
1248 if(msgOverride == FALSE)
1249 {
1251 }
1252 }
1253
1254 /* Bypass SEH and go direct. */
1255 if (!Hook || !msgOverride)
1257
1258 _SEH2_TRY
1259 {
1261 }
1263 {
1264 ERR("Got exception in hooked DefWindowProcA\n");
1265 }
1266 _SEH2_END;
1267
1269
1270 return Result;
1271}
#define ERR(fmt,...)
Definition: debug.h:113
struct @1636 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define FALSE
Definition: types.h:117
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
UAHOWP DefWndProcArray
Definition: undocuser.h:341
WNDPROC DefWindowProcA
Definition: undocuser.h:339
LRESULT WINAPI RealDefWindowProcA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:813
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
BOOL FASTCALL IsMsgOverride(UINT, PUAHOWP)
Definition: usrapihk.c:63
USERAPIHOOK guah
Definition: usrapihk.c:344
static __inline void LoadUserApiHook()
Definition: user_x.h:85
LONG_PTR LRESULT
Definition: windef.h:209
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

◆ DefWindowProcW()

LRESULT WINAPI DefWindowProcW ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1274 of file defwnd.c.

1275{
1276 BOOL Hook, msgOverride = FALSE;
1277 LRESULT Result = 0;
1278
1280
1281 Hook = BeginIfHookedUserApiHook();
1282 if (Hook)
1283 {
1284 msgOverride = IsMsgOverride(Msg, &guah.DefWndProcArray);
1285 if(msgOverride == FALSE)
1286 {
1288 }
1289 }
1290
1291 /* Bypass SEH and go direct. */
1292 if (!Hook || !msgOverride)
1294
1295 _SEH2_TRY
1296 {
1298 }
1300 {
1301 ERR("Got exception in hooked DefWindowProcW\n");
1302 }
1303 _SEH2_END;
1304
1306
1307 return Result;
1308}
WNDPROC DefWindowProcW
Definition: undocuser.h:340
LRESULT WINAPI RealDefWindowProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:1037

◆ DefWndControlColor()

HBRUSH DefWndControlColor ( HDC  hDC,
UINT  ctlType 
)

Definition at line 208 of file defwnd.c.

209{
210 if (ctlType == CTLCOLOR_SCROLLBAR)
211 {
215 SetBkColor(hDC, bk);
216
217 /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
218 * we better use 0x55aa bitmap brush to make scrollbar's background
219 * look different from the window background.
220 */
221 if ( bk == GetSysColor(COLOR_WINDOW))
222 return gpsi->hbrGray;
223
224 UnrealizeObject( hb );
225 return hb;
226 }
227
229
230 if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
231 {
233 }
234 else
235 {
238 }
239
241}
static HDC hDC
Definition: 3dtext.c:33
PSERVERINFO gpsi
Definition: imm.c:18
DWORD WINAPI DECLSPEC_HOTPATCH GetSysColor(int nIndex)
Definition: defwnd.c:19
HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush(int nIndex)
Definition: defwnd.c:36
DWORD COLORREF
Definition: windef.h:300
BOOL WINAPI UnrealizeObject(_In_ HGDIOBJ)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define CTLCOLOR_SCROLLBAR
Definition: winuser.h:956
#define COLOR_WINDOW
Definition: winuser.h:918
#define COLOR_SCROLLBAR
Definition: winuser.h:912
#define COLOR_WINDOWTEXT
Definition: winuser.h:921
#define CTLCOLOR_LISTBOX
Definition: winuser.h:953
#define CTLCOLOR_EDIT
Definition: winuser.h:952
#define COLOR_3DHILIGHT
Definition: winuser.h:937
#define COLOR_3DFACE
Definition: winuser.h:929

◆ DefWndGetIcon()

LRESULT FASTCALL DefWndGetIcon ( PWND  pWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 287 of file defwnd.c.

288{
289 HICON hIconRet;
290 if ( wParam > ICON_SMALL2 )
291 {
293 return 0;
294 }
295 switch(wParam)
296 {
297 case ICON_BIG:
298 hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp, TRUE);
299 break;
300 case ICON_SMALL:
301 case ICON_SMALL2:
303 break;
304 default:
305 break;
306 }
307 return (LRESULT)hIconRet;
308}
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
static HICON
Definition: imagelist.c:84
ATOM atomIconProp
Definition: ntuser.h:1066
ATOM atomIconSmProp
Definition: ntuser.h:1065
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46

◆ DefWndHandleSysCommand()

LRESULT DefWndHandleSysCommand ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 140 of file defwnd.c.

141{
142 POINT Pt;
143 LRESULT lResult;
144
145 if (!IsWindowEnabled( hWnd )) return 0;
146
147 switch (wParam & 0xfff0)
148 {
149 case SC_MOVE:
150 case SC_SIZE:
151// case SC_DEFAULT:
152 case SC_MOUSEMENU:
153 case SC_KEYMENU:
154 case SC_SCREENSAVE:
155 case SC_MINIMIZE:
156 case SC_MAXIMIZE:
157 case SC_RESTORE:
158 case SC_CLOSE:
159 case SC_HOTKEY:
161 return 0;
162
163 default:
164 break;
165 }
166
167 if (ISITHOOKED(WH_CBT))
168 {
170 if (lResult) return 0;
171 }
172
173 switch (wParam & 0xfff0)
174 {
175 case SC_VSCROLL:
176 case SC_HSCROLL:
177 {
178 Pt.x = (short)LOWORD(lParam);
179 Pt.y = (short)HIWORD(lParam);
181 }
182 break;
183
184 case SC_TASKLIST:
185 WinExec( "taskman.exe", SW_SHOWNORMAL );
186 break;
187
188
189 case SC_NEXTWINDOW:
190 case SC_PREVWINDOW:
192 break;
193
194 default:
195 FIXME("Unimplemented DefWndHandleSysCommand wParam 0x%x\n",wParam);
196 break;
197 }
198
199 return(0);
200}
#define FIXME(fmt,...)
Definition: debug.h:114
UINT WINAPI DECLSPEC_HOTPATCH WinExec(LPCSTR lpCmdLine, UINT uCmdShow)
Definition: proc.c:4773
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define ISITHOOKED(HookId)
Definition: hook.h:6
BOOL NTAPI NtUserMessageCall(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, ULONG_PTR ResultInfo, DWORD dwType, BOOL Ansi)
Definition: message.c:2490
#define FNID_DEFWINDOWPROC
Definition: ntuser.h:863
#define SC_SCREENSAVE
Definition: mmsystem.h:933
#define LOWORD(l)
Definition: pedump.c:82
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define HIWORD(l)
Definition: typedefs.h:247
LRESULT WINAPI DoAppSwitch(WPARAM wParam, LPARAM lParam)
Definition: appswitch.c:584
static VOID DefWndTrackScrollBar(HWND Wnd, WPARAM wParam, POINT Pt)
Definition: defwnd.c:114
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define SC_HSCROLL
Definition: winuser.h:2594
#define SC_MOUSEMENU
Definition: winuser.h:2595
#define WM_SYSCOMMAND
Definition: winuser.h:1741
#define SC_KEYMENU
Definition: winuser.h:2596
#define SC_PREVWINDOW
Definition: winuser.h:2591
#define SC_VSCROLL
Definition: winuser.h:2593
#define SC_TASKLIST
Definition: winuser.h:2599
#define WH_CBT
Definition: winuser.h:35
#define SC_SIZE
Definition: winuser.h:2584
#define SC_MINIMIZE
Definition: winuser.h:2586
#define SC_NEXTWINDOW
Definition: winuser.h:2590
#define SC_HOTKEY
Definition: winuser.h:2601
#define SC_CLOSE
Definition: winuser.h:2592
#define SC_MOVE
Definition: winuser.h:2585
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define SC_RESTORE
Definition: winuser.h:2598
#define SC_MAXIMIZE
Definition: winuser.h:2588

◆ DefWndTrackScrollBar()

static VOID DefWndTrackScrollBar ( HWND  Wnd,
WPARAM  wParam,
POINT  Pt 
)
static

Definition at line 114 of file defwnd.c.

115{
116 INT ScrollBar;
117
118 if (SC_HSCROLL == (wParam & 0xfff0))
119 {
120 if (HTHSCROLL != (wParam & 0x0f))
121 {
122 return;
123 }
124 ScrollBar = SB_HORZ;
125 }
126 else /* SC_VSCROLL */
127 {
128 if (HTVSCROLL != (wParam & 0x0f))
129 {
130 return;
131 }
132 ScrollBar = SB_VERT;
133 }
134 ScrollTrackScrollBar(Wnd, ScrollBar, Pt );
135}
int32_t INT
Definition: typedefs.h:58
VOID FASTCALL ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt)
Definition: scrollbar.c:1155
#define SB_VERT
Definition: winuser.h:553
#define HTVSCROLL
Definition: winuser.h:2482
#define HTHSCROLL
Definition: winuser.h:2481
#define SB_HORZ
Definition: winuser.h:552

Referenced by DefWndHandleSysCommand().

◆ DoAppSwitch()

LRESULT WINAPI DoAppSwitch ( WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 584 of file appswitch.c.

585{
586 HWND hwndActive;
587 MSG msg;
588
589 // FIXME: Is loading timing OK?
591
592 if (!CoolSwitch)
593 return 0;
594
595 // Already in the loop.
596 if (switchdialog || Esc) return 0;
597
598 if (lParam == VK_ESCAPE)
599 {
600 Esc = TRUE;
601
602 windowCount = 0;
604
605 if (windowCount < 2)
606 return 0;
607
609
610 hwndActive = GetActiveWindow();
611
612 if (hwndActive == NULL)
613 {
614 Esc = FALSE;
615 return 0;
616 }
617 }
618
619 // Capture current active window.
620 hwndActive = GetActiveWindow();
621 if (hwndActive)
622 SetCapture(hwndActive);
623
624 switch (lParam)
625 {
626 case VK_TAB:
627 if (!GetDialogFont() || !ProcessHotKey())
628 goto Exit;
629 break;
630
631 case VK_ESCAPE:
632 break;
633
634 default:
635 goto Exit;
636 }
637
638 if (!hwndActive)
639 goto Exit;
640
641 // Main message loop:
642 while (1)
643 {
644 for (;;)
645 {
646 if (PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ))
647 {
648 if (!CallMsgFilterW( &msg, MSGF_NEXTWINDOW )) break;
649 /* remove the message from the queue */
650 PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
651 }
652 else
653 WaitMessage();
654 }
655
656 switch (msg.message)
657 {
658 case WM_KEYUP:
659 {
660 PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
661 if (msg.wParam == VK_MENU)
662 {
664 }
665 else if (msg.wParam == VK_RETURN)
666 {
668 }
669 else if (msg.wParam == VK_ESCAPE)
670 {
671 TRACE("DoAppSwitch VK_ESCAPE 2\n");
673 }
674 goto Exit; //break;
675 }
676
677 case WM_SYSKEYDOWN:
678 {
679 PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
680 if (HIWORD(msg.lParam) & KF_ALTDOWN)
681 {
682 if ( msg.wParam == VK_TAB )
683 {
684 if (Esc) break;
685 if (GetKeyState(VK_SHIFT) < 0)
686 {
687 MoveLeft();
688 }
689 else
690 {
691 MoveRight();
692 }
693 }
694 else if ( msg.wParam == VK_ESCAPE )
695 {
696 if (!Esc) break;
698 }
699 else if ( msg.wParam == VK_LEFT )
700 {
701 MoveLeft();
702 }
703 else if ( msg.wParam == VK_RIGHT )
704 {
705 MoveRight();
706 }
707 else if ( msg.wParam == VK_UP )
708 {
709 MoveUp();
710 }
711 else if ( msg.wParam == VK_DOWN )
712 {
713 MoveDown();
714 }
715 }
716 break;
717 }
718
719 case WM_LBUTTONUP:
720 PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
721 ProcessMouseMessage(msg.message, msg.lParam);
722 goto Exit;
723
724 default:
725 if (PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE ))
726 {
729 }
730 break;
731 }
732 }
733Exit:
736 if (Esc) DestroyAppWindows();
738 selectedWindow = 0;
739 windowCount = 0;
740 Esc = FALSE;
741 return 0;
742}
static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
Definition: appswitch.c:267
static void MoveLeft(void)
Definition: appswitch.c:527
static void MoveUp(void)
Definition: appswitch.c:541
void ProcessMouseMessage(UINT message, LPARAM lParam)
Definition: appswitch.c:277
static void MoveRight(void)
Definition: appswitch.c:535
void CompleteSwitch(BOOL doSwitch)
Definition: appswitch.c:113
DWORD GetDialogFont(VOID)
Definition: appswitch.c:418
void RotateTasks(BOOL bShift)
Definition: appswitch.c:490
BOOL ProcessHotKey(VOID)
Definition: appswitch.c:455
BOOL CoolSwitch
Definition: appswitch.c:66
int windowCount
Definition: appswitch.c:53
VOID DestroyAppWindows(VOID)
Definition: appswitch.c:572
BOOL LoadCoolSwitchSettings(void)
Definition: appswitch.c:74
HWND switchdialog
Definition: appswitch.c:42
static void MoveDown(void)
Definition: appswitch.c:556
int selectedWindow
Definition: appswitch.c:44
BOOL Esc
Definition: appswitch.c:64
#define msg(x)
Definition: auth_time.c:54
static void Exit(void)
Definition: sock.c:1330
#define TRACE(s)
Definition: solgame.cpp:4
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
HWND WINAPI SetCapture(_In_ HWND hWnd)
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138
#define VK_TAB
Definition: winuser.h:2199
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define WM_KEYUP
Definition: winuser.h:1716
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define KF_ALTDOWN
Definition: winuser.h:2449
#define VK_UP
Definition: winuser.h:2225
BOOL WINAPI CallMsgFilterW(_In_ LPMSG, _In_ INT)
#define VK_RETURN
Definition: winuser.h:2201
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define MSGF_NEXTWINDOW
Definition: winuser.h:1179
#define PM_REMOVE
Definition: winuser.h:1196
BOOL WINAPI WaitMessage(void)
Definition: ntwrapper.h:350
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define VK_DOWN
Definition: winuser.h:2227
#define VK_SHIFT
Definition: winuser.h:2202
SHORT WINAPI GetAsyncKeyState(_In_ int)
#define VK_ESCAPE
Definition: winuser.h:2214
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PM_NOREMOVE
Definition: winuser.h:1195
#define WM_SYSKEYDOWN
Definition: winuser.h:1719
SHORT WINAPI GetKeyState(_In_ int)
#define VK_MENU
Definition: winuser.h:2204

Referenced by DefWndHandleSysCommand().

◆ GetSysColor()

DWORD WINAPI DECLSPEC_HOTPATCH GetSysColor ( int  nIndex)

Definition at line 19 of file defwnd.c.

20{
21 if(nIndex >= 0 && nIndex < NUM_SYSCOLORS)
22 {
23 return gpsi->argbSystem[nIndex];
24 }
25
27 return 0;
28}
#define NUM_SYSCOLORS
Definition: SetSysColors.c:10

Referenced by DefWndControlColor().

◆ GetSysColorBrush()

HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush ( int  nIndex)

Definition at line 36 of file defwnd.c.

37{
38 if(nIndex >= 0 && nIndex < NUM_SYSCOLORS)
39 {
40 return gpsi->ahbrSystem[nIndex];
41 }
42
43 return NULL;
44}

Referenced by DefWndControlColor(), FillRect(), IntDrawRectEdge(), IntDrawState(), UITOOLS95_DFC_ButtonPush(), and UITOOLS_DrawCheckedRect().

◆ IntFindChildWindowToOwner()

HWND FASTCALL IntFindChildWindowToOwner ( HWND  hRoot,
HWND  hOwner 
)

Definition at line 79 of file defwnd.c.

80{
81 HWND Ret;
82 PWND Child, OwnerWnd, Root, Owner;
83
85 Owner = ValidateHwnd(hOwner);
86
87 for( Child = Root->spwndChild ? DesktopPtrToUser(Root->spwndChild) : NULL;
88 Child;
89 Child = Child->spwndNext ? DesktopPtrToUser(Child->spwndNext) : NULL )
90 {
91 OwnerWnd = Child->spwndOwner ? DesktopPtrToUser(Child->spwndOwner) : NULL;
92 if(!OwnerWnd)
93 continue;
94
95 if (!(Child->style & WS_POPUP) || !(Child->style & WS_VISIBLE))
96 continue;
97
98 if(OwnerWnd == Owner)
99 {
100 Ret = Child->head.h;
101 return Ret;
102 }
103 }
104 ERR("IDCWTO Nothing found\n");
105 return NULL;
106}
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
static PVOID FASTCALL DesktopPtrToUser(PVOID ptr)
Definition: utils.c:324
static HTREEITEM hRoot
Definition: treeview.c:381
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1597
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
root entry for file system trees
Definition: entries.h:148
Definition: ntuser.h:694
struct _WND * spwndOwner
Definition: ntuser.h:715
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536

◆ RealDefWindowProcA()

LRESULT WINAPI RealDefWindowProcA ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 813 of file defwnd.c.

817{
818 LRESULT Result = 0;
819 PWND Wnd;
820
821 Wnd = ValidateHwnd(hWnd);
822
823 if ( !Wnd &&
825 Msg != WM_CTLCOLORBTN &&
826 Msg != WM_CTLCOLORDLG &&
828 return 0;
829
831 switch (Msg)
832 {
833 case WM_NCCREATE:
834 {
835 if ( Wnd &&
836 Wnd->style & (WS_HSCROLL | WS_VSCROLL) )
837 {
838 if (!Wnd->pSBInfo)
839 {
840 SCROLLINFO si = {sizeof si, SIF_ALL, 0, 100, 0, 0, 0};
843 }
844 }
845
846 if (lParam)
847 {
849 /* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP)
850 * may have child window IDs instead of window name */
851 if (HIWORD(cs->lpszName))
852 {
853 DefSetText(hWnd, (PCWSTR)cs->lpszName, TRUE);
854 }
855 Result = 1;
856 }
857 break;
858 }
859
860 case WM_GETTEXTLENGTH:
861 {
862 PWSTR buf;
863 ULONG len;
864
865 if (Wnd != NULL && Wnd->strName.Length != 0)
866 {
868 if (buf != NULL &&
870 buf,
871 Wnd->strName.Length)))
872 {
873 Result = (LRESULT) len;
874 }
875 }
876 else Result = 0L;
877
878 break;
879 }
880
881 case WM_GETTEXT:
882 {
883 PWSTR buf = NULL;
884 PSTR outbuf = (PSTR)lParam;
885 SIZE_T copy;
886
887 if (Wnd != NULL && wParam != 0)
888 {
889 if (Wnd->strName.Buffer != NULL)
891 else
892 outbuf[0] = L'\0';
893
894 if (buf != NULL)
895 {
896 if (Wnd->strName.Length != 0)
897 {
898 copy = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
900 0,
901 buf,
902 copy,
903 outbuf,
904 wParam,
905 NULL,
906 NULL);
907 outbuf[Result] = '\0';
908 }
909 else
910 outbuf[0] = '\0';
911 }
912 }
913 break;
914 }
915
916 case WM_SETTEXT:
917 {
919
921 {
923 IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, hWnd, OBJID_WINDOW, CHILDID_SELF, 0);
924 }
925 Result = 1;
926 break;
927 }
928
929 case WM_IME_KEYDOWN:
930 {
932 break;
933 }
934
935 case WM_IME_KEYUP:
936 {
938 break;
939 }
940
941 case WM_IME_CHAR:
942 {
943 if (HIBYTE(wParam))
946 break;
947 }
948
949 case WM_IME_COMPOSITION:
950 if (lParam & GCS_RESULTSTR)
951 {
952 LONG size, i;
953 unsigned char lead = 0;
954 char *buf = NULL;
955 HIMC himc = IMM_FN(ImmGetContext)( hWnd );
956
957 if (himc)
958 {
960 {
961 if (!(buf = HeapAlloc( GetProcessHeap(), 0, size ))) size = 0;
963 }
964 IMM_FN(ImmReleaseContext)( hWnd, himc );
965
966 for (i = 0; i < size; i++)
967 {
968 unsigned char c = buf[i];
969 if (!lead)
970 {
971 if (IsDBCSLeadByte( c ))
972 lead = c;
973 else
975 }
976 else
977 {
978 SendMessageA( hWnd, WM_IME_CHAR, MAKEWORD(c, lead), 1 );
979 lead = 0;
980 }
981 }
982 HeapFree( GetProcessHeap(), 0, buf );
983 }
984 }
985 /* fall through */
986 case WM_IME_STARTCOMPOSITION:
987 case WM_IME_ENDCOMPOSITION:
988 case WM_IME_SELECT:
989 case WM_IME_NOTIFY:
990 case WM_IME_CONTROL:
992NormalImeMsgHandling:
993 {
994 HWND hwndIME;
995
996 if (GetWin32ClientInfo()->dwTIFlags & TIF_DISABLEIME)
997 {
998 TRACE("This thread's IME is disabled\n");
999 break;
1000 }
1001
1002 hwndIME = IMM_FN(ImmGetDefaultIMEWnd)(hWnd);
1003 if (!hwndIME)
1004 {
1005 ERR("hwndIME was NULL\n");
1006 break;
1007 }
1008
1009 if (hwndIME == hWnd)
1010 {
1012 break;
1013 }
1014
1015 Result = SendMessageA(hwndIME, Msg, wParam, lParam);
1016 break;
1017 }
1018
1019 case WM_IME_SYSTEM:
1020 {
1021 if (wParam == 4)
1022 break;
1023
1024 goto NormalImeMsgHandling;
1025 }
1026
1027 default:
1029 }
1030
1032 return Result;
1033}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
LONG WINAPI ImmGetCompositionStringA(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:856
DWORD HIMC
Definition: dimm.idl:75
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WideCharToMultiByte
Definition: compat.h:111
HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
Definition: ime.c:890
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1044
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1085
BOOL WINAPI IsDBCSLeadByte(BYTE testchar)
Definition: locale.c:2123
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define cs
Definition: i386-dis.c:442
#define GCS_RESULTSTR
Definition: imm.h:234
#define TIF_DISABLEIME
Definition: ntuser.h:288
#define GetWin32ClientInfo()
Definition: ntuser.h:352
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define min(a, b)
Definition: monoChain.cc:55
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:398
#define L(x)
Definition: ntvdm.h:50
#define LRESULT
Definition: ole.h:14
#define WS_CAPTION
Definition: pedump.c:624
#define WS_VSCROLL
Definition: pedump.c:627
long LONG
Definition: pedump.c:60
#define WS_HSCROLL
Definition: pedump.c:628
LRESULT WINAPI ImeWndProc_common(HWND, UINT, WPARAM, LPARAM, BOOL)
Definition: imm.c:935
DWORD style
Definition: ntuser.h:706
PSBINFO pSBInfo
Definition: ntuser.h:726
LARGE_UNICODE_STRING strName
Definition: ntuser.h:736
uint16_t * PWSTR
Definition: typedefs.h:56
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define MAKEWORD(a, b)
Definition: typedefs.h:248
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
#define WM_IME_SYSTEM
Definition: undocuser.h:60
LRESULT WINAPI User32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL bUnicode)
Definition: defwnd.c:312
void SPY_EnterMessage(INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: spy.c:2593
#define IMM_FN(name)
Definition: user32p.h:56
#define SPY_RESULT_DEFWND
Definition: user32p.h:72
void SPY_ExitMessage(INT iFlag, HWND hwnd, UINT msg, LRESULT lReturn, WPARAM wParam, LPARAM lParam)
Definition: spy.c:2648
#define SPY_DEFWNDPROC
Definition: user32p.h:69
BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText)
Definition: window.c:4372
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
#define WM_IME_KEYUP
Definition: winuser.h:1839
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1772
#define WM_GETTEXTLENGTH
Definition: winuser.h:1619
#define GetWindowLongPtrW
Definition: winuser.h:4829
#define WM_IME_NOTIFY
Definition: winuser.h:1830
#define WM_IME_KEYDOWN
Definition: winuser.h:1838
struct tagCREATESTRUCTA * LPCREATESTRUCTA
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_GETTEXT
Definition: winuser.h:1618
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1766
#define WM_NCCREATE
Definition: winuser.h:1683
#define WM_IME_SETCONTEXT
Definition: winuser.h:1829
#define WM_CTLCOLORBTN
Definition: winuser.h:1769
#define WM_SETTEXT
Definition: winuser.h:1617
#define WM_IME_CHAR
Definition: winuser.h:1834
#define SIF_ALL
Definition: winuser.h:1232
#define DC_TEXT
Definition: winuser.h:430
#define WM_CHAR
Definition: winuser.h:1717
#define WM_IME_CONTROL
Definition: winuser.h:1831
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
#define WM_IME_SELECT
Definition: winuser.h:1833
#define WM_KEYDOWN
Definition: winuser.h:1715
#define GWL_STYLE
Definition: winuser.h:852
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CTLCOLORDLG
Definition: winuser.h:1770
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DefWindowProcA(), and ResetUserApiHook().

◆ RealDefWindowProcW()

LRESULT WINAPI RealDefWindowProcW ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1037 of file defwnd.c.

1041{
1042 LRESULT Result = 0;
1043 PWND Wnd;
1044
1045 Wnd = ValidateHwnd(hWnd);
1046
1047 if ( !Wnd &&
1049 Msg != WM_CTLCOLORBTN &&
1050 Msg != WM_CTLCOLORDLG &&
1052 return 0;
1053
1055 switch (Msg)
1056 {
1057 case WM_NCCREATE:
1058 {
1059 if ( Wnd &&
1060 Wnd->style & (WS_HSCROLL | WS_VSCROLL) )
1061 {
1062 if (!Wnd->pSBInfo)
1063 {
1064 SCROLLINFO si = {sizeof si, SIF_ALL, 0, 100, 0, 0, 0};
1065 if (Wnd->style & WS_HSCROLL)
1067 if (Wnd->style & WS_VSCROLL)
1069 }
1070 }
1071
1072 if (lParam)
1073 {
1075 /* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP)
1076 * may have child window IDs instead of window name */
1077 if (HIWORD(cs->lpszName))
1078 {
1079 DefSetText(hWnd, cs->lpszName, FALSE);
1080 }
1081 Result = 1;
1082 }
1083 break;
1084 }
1085
1086 case WM_GETTEXTLENGTH:
1087 {
1088 PWSTR buf;
1089 ULONG len;
1090
1091 if (Wnd != NULL && Wnd->strName.Length != 0)
1092 {
1094 if (buf != NULL &&
1096 buf,
1097 Wnd->strName.Length)))
1098 {
1099 Result = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
1100 }
1101 }
1102 else Result = 0L;
1103
1104 break;
1105 }
1106
1107 case WM_GETTEXT:
1108 {
1109 PWSTR buf = NULL;
1110 PWSTR outbuf = (PWSTR)lParam;
1111
1112 if (Wnd != NULL && wParam != 0)
1113 {
1114 if (Wnd->strName.Buffer != NULL)
1116 else
1117 outbuf[0] = L'\0';
1118
1119 if (buf != NULL)
1120 {
1121 if (Wnd->strName.Length != 0)
1122 {
1123 Result = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
1124 RtlCopyMemory(outbuf,
1125 buf,
1126 Result * sizeof(WCHAR));
1127 outbuf[Result] = L'\0';
1128 }
1129 else
1130 outbuf[0] = L'\0';
1131 }
1132 }
1133 break;
1134 }
1135
1136 case WM_SETTEXT:
1137 {
1139
1142 Result = 1;
1143 break;
1144 }
1145
1146 case WM_IME_CHAR:
1147 {
1149 Result = 0;
1150 break;
1151 }
1152
1153 case WM_IME_KEYDOWN:
1154 {
1156 break;
1157 }
1158
1159 case WM_IME_KEYUP:
1160 {
1162 break;
1163 }
1164
1165 case WM_IME_COMPOSITION:
1166 if (lParam & GCS_RESULTSTR)
1167 {
1168 LONG size, i;
1169 WCHAR *buf = NULL;
1170 HIMC himc = IMM_FN(ImmGetContext)( hWnd );
1171
1172 if (himc)
1173 {
1175 {
1176 if (!(buf = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) ))) size = 0;
1177 else size = IMM_FN(ImmGetCompositionStringW)( himc, GCS_RESULTSTR, buf, size * sizeof(WCHAR) );
1178 }
1179 IMM_FN(ImmReleaseContext)( hWnd, himc );
1180
1181 for (i = 0; i < size / sizeof(WCHAR); i++)
1183 HeapFree( GetProcessHeap(), 0, buf );
1184 }
1185 }
1186 /* fall through */
1187 case WM_IME_STARTCOMPOSITION:
1188 case WM_IME_ENDCOMPOSITION:
1189 case WM_IME_SELECT:
1190 case WM_IME_NOTIFY:
1191 case WM_IME_CONTROL:
1192 case WM_IME_SETCONTEXT:
1193NormalImeMsgHandling:
1194 {
1195 HWND hwndIME;
1196
1197 if (GetWin32ClientInfo()->dwTIFlags & TIF_DISABLEIME)
1198 {
1199 TRACE("This thread's IME is disabled\n");
1200 break;
1201 }
1202
1203 hwndIME = IMM_FN(ImmGetDefaultIMEWnd)(hWnd);
1204 if (!hwndIME)
1205 {
1206 ERR("hwndIME was NULL\n");
1207 break;
1208 }
1209
1210 if (hwndIME == hWnd)
1211 {
1212 ImeWndProc_common(hwndIME, Msg, wParam, lParam, TRUE);
1213 break;
1214 }
1215
1216 Result = SendMessageW(hwndIME, Msg, wParam, lParam);
1217 break;
1218 }
1219
1220 case WM_IME_SYSTEM:
1221 {
1222 if (wParam == 4)
1223 break;
1224
1225 goto NormalImeMsgHandling;
1226 }
1227
1228 default:
1230 }
1232
1233 return Result;
1234}
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:899
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct tagCREATESTRUCTW * LPCREATESTRUCTW
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DefWindowProcW(), and ResetUserApiHook().

◆ SetSysColors()

BOOL WINAPI SetSysColors ( int  cElements,
CONST INT lpaElements,
CONST COLORREF lpaRgbValues 
)

Definition at line 51 of file defwnd.c.

55{
56 return NtUserSetSysColors(cElements, lpaElements, lpaRgbValues, 0);
57}
BOOL NTAPI NtUserSetSysColors(int cElements, IN CONST INT *lpaElements, IN CONST COLORREF *lpaRgbValues, FLONG Flags)
Definition: ntstubs.c:288

◆ User32DefWindowProc()

LRESULT WINAPI User32DefWindowProc ( HWND  hWnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  bUnicode 
)

Definition at line 312 of file defwnd.c.

317{
318 PWND pWnd = NULL;
319 if (hWnd)
320 {
321 pWnd = ValidateHwnd(hWnd);
322 if (!pWnd) return 0;
323 }
324
325 switch (Msg)
326 {
327 case WM_DEVICECHANGE:
328 return TRUE;
329
331 {
332 /* This is an undocumented message used by the windows taskbar to
333 display the system menu of windows that belong to other processes. */
334 HMENU menu = GetSystemMenu(hWnd, FALSE);
335 ERR("WM_POPUPSYSTEMMENU\n");
336 if (menu)
337 {
341 }
342 return 0;
343 }
344
345 case WM_RBUTTONUP:
346 {
347 POINT Pt;
348 Pt.x = GET_X_LPARAM(lParam);
349 Pt.y = GET_Y_LPARAM(lParam);
350 ClientToScreen(hWnd, &Pt);
351 lParam = MAKELPARAM(Pt.x, Pt.y);
352 if (bUnicode)
353 {
355 }
356 else
357 {
359 }
360 break;
361 }
362
363 case WM_NCRBUTTONUP:
364 /*
365 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
366 * in Windows), but what _should_ we do? According to MSDN :
367 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
368 * message to the window". When is it appropriate?
369 */
370 ERR("WM_NCRBUTTONUP\n");
371 break;
372
373 case WM_XBUTTONUP:
374 case WM_NCXBUTTONUP:
375 if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
376 {
378 MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
379 }
380 break;
381
382 case WM_CONTEXTMENU:
383 {
385 {
386 if (bUnicode)
387 {
389 }
390 else
391 {
393 }
394 }
395 else
396 {
397 goto GoSS;
398 }
399 break;
400 }
401
402 case WM_CLOSE:
404 return (0);
405
406 case WM_MOUSEACTIVATE:
408 {
410 if (Ret) return (Ret);
411 }
413
414 case WM_ACTIVATE:
415 /* The default action in Windows is to set the keyboard focus to
416 * the window, if it's being activated and not minimized */
417 if (LOWORD(wParam) != WA_INACTIVE &&
419 {
420 //ERR("WM_ACTIVATE %p\n",hWnd);
421 SetFocus(hWnd);
422 }
423 break;
424
425 case WM_MOUSEWHEEL:
428 break;
429
430 case WM_ERASEBKGND:
432 {
433 RECT Rect;
434 HBRUSH hBrush = (HBRUSH)GetClassLongPtrW(hWnd, GCL_HBRBACKGROUND);
435
436 if (NULL == hBrush)
437 {
438 return 0;
439 }
441 {
442 /* can't use GetClipBox with a parent DC or we fill the whole parent */
444 DPtoLP((HDC)wParam, (LPPOINT)&Rect, 2);
445 }
446 else
447 {
449 }
450 FillRect((HDC)wParam, &Rect, hBrush);
451 return (1);
452 }
453
455 case WM_CTLCOLOREDIT:
457 case WM_CTLCOLORBTN:
458 case WM_CTLCOLORDLG:
462
463 case WM_CTLCOLOR:
465
466 case WM_SYSCOMMAND:
468
469 case WM_VKEYTOITEM:
470 case WM_CHARTOITEM:
471 return (-1);
472/*
473 case WM_DROPOBJECT:
474 return DRAG_FILE;
475*/
477 {
479 {
480 return(1);
481 }
482 break;
483 }
484
485 case WM_QUERYDRAGICON:
486 {
487 UINT Len;
488 HICON hIcon;
489
491 if (hIcon)
492 {
493 return ((LRESULT)hIcon);
494 }
495 for (Len = 1; Len < 64; Len++)
496 {
498 {
499 return((LRESULT)hIcon);
500 }
501 }
502 return ((LRESULT)LoadIconW(0, IDI_APPLICATION));
503 }
504
505 case WM_ISACTIVEICON:
506 {
507 BOOL isai;
508 isai = (pWnd->state & WNDS_ACTIVEFRAME) != 0;
509 return isai;
510 }
511
512 case WM_NOTIFYFORMAT:
513 {
514 if (lParam == NF_QUERY)
516 break;
517 }
518
519 case WM_GETICON:
520 {
521 return DefWndGetIcon(pWnd, wParam, lParam);
522 }
523
524 case WM_HELP:
525 {
526 if (bUnicode)
527 {
529 }
530 else
531 {
533 }
534 break;
535 }
536
537 case WM_QUERYOPEN:
539 {
540 return (1);
541 }
542
543 case WM_INPUTLANGCHANGEREQUEST:
544 {
545 HKL hNewKL;
546 HWND hwndFocus;
547
548 if ((wParam & INPUTLANGCHANGE_BACKWARD) && (wParam & INPUTLANGCHANGE_FORWARD))
549 return FALSE;
550
551 hwndFocus = GetFocus();
552 if (hwndFocus && hwndFocus != hWnd &&
554 {
555 return SendMessageW(hwndFocus, Msg, wParam, lParam);
556 }
557
558 if (wParam & INPUTLANGCHANGE_FORWARD)
559 hNewKL = (HKL)UlongToHandle(HKL_NEXT);
560 else if (wParam & INPUTLANGCHANGE_BACKWARD)
561 hNewKL = (HKL)UlongToHandle(HKL_PREV);
562 else
563 hNewKL = (HKL)lParam;
564
566 return TRUE;
567 }
568
569 case WM_INPUTLANGCHANGE:
570 {
571 int count = 0;
572 HWND *win_array = WIN_ListChildren( hWnd );
573
574 if (!win_array)
575 break;
576 while (win_array[count])
577 SendMessageW( win_array[count++], WM_INPUTLANGCHANGE, wParam, lParam);
578 HeapFree(GetProcessHeap(),0,win_array);
579 break;
580 }
581
582 case WM_QUERYUISTATE:
583 {
584 LRESULT Ret = 0;
585 PWND Wnd = ValidateHwnd(hWnd);
586 if (Wnd != NULL)
587 {
588 if (Wnd->HideFocus)
589 Ret |= UISF_HIDEFOCUS;
590 if (Wnd->HideAccel)
591 Ret |= UISF_HIDEACCEL;
592 }
593 return Ret;
594 }
595
596 case WM_CHANGEUISTATE:
597 {
598 BOOL AlwaysShowCues = FALSE;
601 PWND Wnd;
602
603 SystemParametersInfoW(SPI_GETKEYBOARDCUES, 0, &AlwaysShowCues, 0);
604 if (AlwaysShowCues)
605 break;
606
607 Wnd= ValidateHwnd(hWnd);
608 if (!Wnd || lParam != 0)
609 break;
610
611 if (Flags & ~(UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE))
612 break;
613
614 if (Flags & UISF_ACTIVE)
615 {
616 WARN("WM_CHANGEUISTATE does not yet support UISF_ACTIVE\n");
617 }
618
619 if (Action == UIS_INITIALIZE)
620 {
622 if (Desk == NULL)
623 break;
624
625 Action = Desk->LastInputWasKbd ? UIS_CLEAR : UIS_SET;
626 Flags = UISF_HIDEFOCUS | UISF_HIDEACCEL;
627
628 /* We need to update wParam in case we need to send out messages */
630 }
631
632 switch (Action)
633 {
634 case UIS_SET:
635 /* See if we actually need to change something */
636 if ((Flags & UISF_HIDEFOCUS) && !Wnd->HideFocus)
637 break;
638 if ((Flags & UISF_HIDEACCEL) && !Wnd->HideAccel)
639 break;
640
641 /* Don't need to do anything... */
642 return 0;
643
644 case UIS_CLEAR:
645 /* See if we actually need to change something */
646 if ((Flags & UISF_HIDEFOCUS) && Wnd->HideFocus)
647 break;
648 if ((Flags & UISF_HIDEACCEL) && Wnd->HideAccel)
649 break;
650
651 /* Don't need to do anything... */
652 return 0;
653
654 default:
655 WARN("WM_CHANGEUISTATE: Unsupported Action 0x%x\n", Action);
656 break;
657 }
658
659 if ((Wnd->style & WS_CHILD) && Wnd->spwndParent != NULL)
660 {
661 /* We're a child window and we need to pass this message down until
662 we reach the root */
664 }
665 else
666 {
667 /* We're a top level window, we need to change the UI state */
668 Msg = WM_UPDATEUISTATE;
669 }
670
671 if (bUnicode)
672 return SendMessageW(hWnd, Msg, wParam, lParam);
673 else
674 return SendMessageA(hWnd, Msg, wParam, lParam);
675 }
676
677 case WM_UPDATEUISTATE:
678 {
679 BOOL Change = TRUE;
680 BOOL AlwaysShowCues = FALSE;
683 PWND Wnd;
684
685 SystemParametersInfoW(SPI_GETKEYBOARDCUES, 0, &AlwaysShowCues, 0);
686 if (AlwaysShowCues)
687 break;
688
689 Wnd = ValidateHwnd(hWnd);
690 if (!Wnd || lParam != 0)
691 break;
692
693 if (Flags & ~(UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE))
694 break;
695
696 if (Flags & UISF_ACTIVE)
697 {
698 WARN("WM_UPDATEUISTATE does not yet support UISF_ACTIVE\n");
699 }
700
701 if (Action == UIS_INITIALIZE)
702 {
704 if (Desk == NULL)
705 break;
706
707 Action = Desk->LastInputWasKbd ? UIS_CLEAR : UIS_SET;
708 Flags = UISF_HIDEFOCUS | UISF_HIDEACCEL;
709
710 /* We need to update wParam for broadcasting the update */
712 }
713
714 switch (Action)
715 {
716 case UIS_SET:
717 /* See if we actually need to change something */
718 if ((Flags & UISF_HIDEFOCUS) && !Wnd->HideFocus)
719 break;
720 if ((Flags & UISF_HIDEACCEL) && !Wnd->HideAccel)
721 break;
722
723 /* Don't need to do anything... */
724 Change = FALSE;
725 break;
726
727 case UIS_CLEAR:
728 /* See if we actually need to change something */
729 if ((Flags & UISF_HIDEFOCUS) && Wnd->HideFocus)
730 break;
731 if ((Flags & UISF_HIDEACCEL) && Wnd->HideAccel)
732 break;
733
734 /* Don't need to do anything... */
735 Change = FALSE;
736 break;
737
738 default:
739 WARN("WM_UPDATEUISTATE: Unsupported Action 0x%x\n", Action);
740 return 0;
741 }
742
743 /* Pack the information and call win32k */
744 if (Change)
745 {
746 if (!NtUserxUpdateUiState(hWnd, Flags | ((DWORD)Action << 3)))
747 break;
748 }
749
750 /* Always broadcast the update to all children */
753 (LPARAM)wParam);
754
755 break;
756 }
757
759 {
760 TRACE("WM_COPYGLOBALDATA hGlobal %p Size %d Flags 0x%x\n",lParam,wParam,GlobalFlags((HGLOBAL)lParam));
761 return lParam;
762 }
763
764/* Move to Win32k !*/
765 case WM_SHOWWINDOW:
766 if (!lParam) break; // Call when it is necessary.
767 case WM_LBUTTONDOWN:
768 case WM_RBUTTONDOWN:
769 case WM_MBUTTONDOWN:
770 case WM_NCLBUTTONDOWN:
771 case WM_NCRBUTTONDOWN:
772 case WM_LBUTTONDBLCLK:
774 case WM_KEYF1:
775 case WM_KEYUP:
776 case WM_SYSKEYUP:
777 case WM_KEYDOWN:
778 case WM_SYSKEYDOWN:
779 case WM_SYSCHAR:
780 case WM_CANCELMODE:
781 case WM_PAINTICON:
782 case WM_PAINT:
783 case WM_PRINT:
784 case WM_SETICON:
788 case WM_NCPAINT:
789 case WM_NCACTIVATE:
790 case WM_NCCALCSIZE:
791 case WM_NCHITTEST:
792 case WM_SYNCPAINT:
793 case WM_SETREDRAW:
795 case WM_GETHOTKEY:
796 case WM_SETHOTKEY:
799 case WM_APPCOMMAND:
800 case WM_SETCURSOR:
801GoSS:
802 {
803 LRESULT lResult;
805 return lResult;
806 }
807 }
808 return 0;
809}
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define WARN(fmt,...)
Definition: debug.h:115
#define Len
Definition: deflate.h:82
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
UINT NTAPI GlobalFlags(HGLOBAL hMem)
Definition: heapmem.c:520
HKL NTAPI NtUserActivateKeyboardLayout(HKL hKL, ULONG Flags)
Definition: kbdlayout.c:1263
#define WNDS_ACTIVEFRAME
Definition: ntuser.h:611
static HDC
Definition: imagelist.c:92
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define WM_KEYF1
Definition: msg.c:47
HICON hIcon
Definition: msconfig.c:44
UINT_PTR HKL
Definition: msctf.idl:143
unsigned int UINT
Definition: ndis.h:50
LRESULT FASTCALL DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:476
LRESULT FASTCALL DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:125
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:32
EXTINLINE BOOL NtUserxUpdateUiState(HWND hWnd, DWORD Param)
Definition: ntwrapper.h:686
#define WS_CHILD
Definition: pedump.c:617
#define WS_EX_ACCEPTFILES
Definition: pedump.c:648
#define WS_MINIMIZE
Definition: pedump.c:622
#define WM_CONTEXTMENU
Definition: richedit.h:64
UINT LastInputWasKbd
Definition: ntuser.h:154
UINT HideFocus
Definition: ntuser.h:758
UINT HideAccel
Definition: ntuser.h:759
DWORD state
Definition: ntuser.h:701
struct _WND * spwndParent
Definition: ntuser.h:713
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define WM_COPYGLOBALDATA
Definition: undocuser.h:36
#define TPM_SYSTEM_MENU
Definition: undocuser.h:73
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:46
#define WM_QUERYDROPOBJECT
Definition: undocuser.h:55
#define WM_ISACTIVEICON
Definition: undocuser.h:33
#define WM_CLIENTSHUTDOWN
Definition: undocuser.h:35
#define WM_POPUPSYSTEMMENU
Definition: undocuser.h:61
#define WC_DIALOG
Definition: undocuser.h:11
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:47
static BOOL CALLBACK UserSendUiUpdateMsg(HWND hwnd, LPARAM lParam)
Definition: defwnd.c:244
HWND * WIN_ListChildren(HWND hWndparent)
Definition: mdi.c:139
static __inline PDESKTOPINFO GetThreadDesktopInfo(VOID)
Definition: user_x.h:43
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define WM_CTLCOLOR
Definition: windowsx.h:29
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WM_PAINT
Definition: winuser.h:1620
HWND WINAPI GetFocus(void)
Definition: window.c:1893
#define WM_ERASEBKGND
Definition: winuser.h:1625
#define WM_GETHOTKEY
Definition: winuser.h:1653
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
#define WM_CLOSE
Definition: winuser.h:1621
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#define KLF_SETFORPROCESS
Definition: winuser.h:117
#define WM_CHARTOITEM
Definition: winuser.h:1649
#define HTCAPTION
Definition: winuser.h:2476
#define WM_QUERYOPEN
Definition: winuser.h:1624
#define WM_SETHOTKEY
Definition: winuser.h:1652
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
#define WM_SYNCPAINT
Definition: winuser.h:1690
#define WM_CANCELMODE
Definition: winuser.h:1635
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1778
#define MA_ACTIVATE
Definition: winuser.h:2501
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define WM_APPCOMMAND
Definition: winuser.h:1882
#define HKL_PREV
Definition: winuser.h:110
#define WM_NCHITTEST
Definition: winuser.h:1686
#define WM_RBUTTONUP
Definition: winuser.h:1780
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1771
#define WA_INACTIVE
Definition: winuser.h:2622
#define MA_NOACTIVATE
Definition: winuser.h:2503
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
#define WM_DEVICECHANGE
Definition: winuser.h:1811
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define WM_QUERYDRAGICON
Definition: winuser.h:1654
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1694
#define IDI_APPLICATION
Definition: winuser.h:704
#define WM_ACTIVATE
Definition: winuser.h:1612
#define WM_SHOWWINDOW
Definition: winuser.h:1628
#define WM_RBUTTONDOWN
Definition: winuser.h:1779
BOOL WINAPI IsWindowUnicode(_In_ HWND)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_NCACTIVATE
Definition: winuser.h:1688
#define WM_SYSCHAR
Definition: winuser.h:1721
#define HKL_NEXT
Definition: winuser.h:109
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_QUERYENDSESSION
Definition: winuser.h:1622
#define WM_SYSKEYUP
Definition: winuser.h:1720
#define GCL_HBRBACKGROUND
Definition: winuser.h:664
#define WM_MOUSEACTIVATE
Definition: winuser.h:1637
#define TPM_LEFTBUTTON
Definition: winuser.h:2379
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
HWND WINAPI GetParent(_In_ HWND)
#define GetClassLongPtrW
Definition: winuser.h:4564
#define NFR_ANSI
Definition: winuser.h:2458
#define WM_SETCURSOR
Definition: winuser.h:1636
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1768
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define WM_NCRBUTTONUP
Definition: winuser.h:1696
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define WM_ICONERASEBKGND
Definition: winuser.h:1642
#define WM_PRINT
Definition: winuser.h:1880
#define NFR_UNICODE
Definition: winuser.h:2459
#define GCL_HICON
Definition: winuser.h:666
#define WM_NCCALCSIZE
Definition: winuser.h:1685
#define CS_PARENTDC
Definition: winuser.h:656
#define WM_CTLCOLOREDIT
Definition: winuser.h:1767
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2106
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1692
#define GCW_ATOM
Definition: winuser.h:661
#define GCL_STYLE
Definition: winuser.h:670
#define WM_PAINTICON
Definition: winuser.h:1641
#define NF_QUERY
Definition: winuser.h:2460
#define WM_MBUTTONDOWN
Definition: winuser.h:1782
#define WM_NCPAINT
Definition: winuser.h:1687
#define WM_VKEYTOITEM
Definition: winuser.h:1648
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1695
#define GWL_EXSTYLE
Definition: winuser.h:851
#define WM_SETREDRAW
Definition: winuser.h:1616
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by RealDefWindowProcA(), RealDefWindowProcW(), and RegisterClientPFN().

◆ UserPaintCaption()

static void UserPaintCaption ( PWND  pwnd,
INT  Flags 
)
static

Definition at line 254 of file defwnd.c.

255{
256 if ( pwnd->style & WS_VISIBLE && (pwnd->style & WS_CAPTION) == WS_CAPTION )
257 {
259 Flags |= DC_ACTIVE;
260 /*
261 * When themes are not enabled we can go on and paint the non client area.
262 * However if we do that with themes enabled we will draw a classic frame.
263 * This is solved by sending a themes specific message to notify the themes
264 * engine that the caption needs to be redrawn
265 */
267 {
268 /*
269 * This will cause uxtheme to either paint the themed caption or call
270 * RealUserDrawCaption in order to draw the classic caption when themes
271 * are disabled but the themes service is enabled
272 */
274 }
275 else
276 {
277 RECT rc = {0,0,0,0};
281 }
282 }
283 //NtUserCallTwoParam((DWORD_PTR)UserHMGetHandle(pwnd),Flags,TWOPARAM_ROUTINE_REDRAWTITLE)
284}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define DC_ACTIVE
Definition: dc21x4.h:120
BOOL NTAPI NtUserDrawCaption(HWND hWnd, HDC hDc, LPCRECT lpRc, UINT uFlags)
Definition: painting.c:2456
#define QUERY_WINDOW_FOREGROUND
Definition: ntuser.h:2833
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4189
#define SRVINFO_APIHOOK
Definition: ntuser.h:950
#define WNDS_HASCAPTION
Definition: ntuser.h:608
DWORD dwSRVIFlags
Definition: ntuser.h:1051
#define DC_DRAWCAPTIONMD
Definition: undocuser.h:151
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define DCX_WINDOW
Definition: winuser.h:2113
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)

◆ UserSendUiUpdateMsg()

static BOOL CALLBACK UserSendUiUpdateMsg ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 244 of file defwnd.c.

245{
246 SendMessageW(hwnd, WM_UPDATEUISTATE, (WPARAM)lParam, 0);
247 return TRUE;
248}
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by User32DefWindowProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )