diff --git a/reactos/dll/win32/user32/controls/button.c b/reactos/dll/win32/user32/controls/button.c index 5dd03c0aeda..4eb8bc66547 100644 --- a/reactos/dll/win32/user32/controls/button.c +++ b/reactos/dll/win32/user32/controls/button.c @@ -102,8 +102,8 @@ static void GB_Paint( HWND hwnd, HDC hDC, UINT action ); static void UB_Paint( HWND hwnd, HDC hDC, UINT action ); static void OB_Paint( HWND hwnd, HDC hDC, UINT action ); static void BUTTON_CheckAutoRadioButton( HWND hwnd ); -static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); -static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); #define MAX_BTN_TYPE 12 @@ -249,8 +249,8 @@ static BOOL button_update_uistate(HWND hwnd, BOOL unicode) /*********************************************************************** * ButtonWndProc_common */ -static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, - WPARAM wParam, LPARAM lParam, BOOL unicode ) +LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, + WPARAM wParam, LPARAM lParam, BOOL unicode ) { RECT rect; POINT pt; @@ -591,7 +591,7 @@ static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, * the passed HWND and calls the real window procedure (with a WND* * pointer pointing to the locked windowstructure). */ -static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if (!IsWindow( hWnd )) return 0; return ButtonWndProc_common( hWnd, uMsg, wParam, lParam, TRUE ); @@ -601,7 +601,7 @@ static LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA /*********************************************************************** * ButtonWndProcA */ -static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if (!IsWindow( hWnd )) return 0; return ButtonWndProc_common( hWnd, uMsg, wParam, lParam, FALSE ); diff --git a/reactos/dll/win32/user32/controls/combo.c b/reactos/dll/win32/user32/controls/combo.c index 5594858c183..8d3ef3350d1 100644 --- a/reactos/dll/win32/user32/controls/combo.c +++ b/reactos/dll/win32/user32/controls/combo.c @@ -74,8 +74,8 @@ static UINT CBitHeight, CBitWidth; #define COMBO_EDITBUTTONSPACE() 0 #define EDIT_CONTROL_PADDING() 1 -static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); -static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); /********************************************************************* * combo class descriptor @@ -1836,8 +1836,8 @@ static char *strdupA(LPCSTR str) /*********************************************************************** * ComboWndProc_common */ -static LRESULT ComboWndProc_common( HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam, BOOL unicode ) +LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam, BOOL unicode ) { LPHEADCOMBO lphc = (LPHEADCOMBO)GetWindowLongPtrW( hwnd, 0 ); @@ -2361,7 +2361,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message, * This is just a wrapper for the real ComboWndProc which locks/unlocks * window structs. */ -static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { if (!IsWindow(hwnd)) return 0; return ComboWndProc_common( hwnd, message, wParam, lParam, FALSE ); @@ -2370,7 +2370,7 @@ static LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPA /*********************************************************************** * ComboWndProcW */ -static LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { if (!IsWindow(hwnd)) return 0; return ComboWndProc_common( hwnd, message, wParam, lParam, TRUE ); diff --git a/reactos/dll/win32/user32/controls/edit.c b/reactos/dll/win32/user32/controls/edit.c index bfc07c1f6da..9f0d9c1d47b 100644 --- a/reactos/dll/win32/user32/controls/edit.c +++ b/reactos/dll/win32/user32/controls/edit.c @@ -4816,7 +4816,7 @@ static inline LRESULT DefWindowProcT(HWND hwnd, UINT msg, WPARAM wParam, LPARAM * names). * */ -static LRESULT EditWndProc_common( HWND hwnd, UINT msg, +LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode ) { EDITSTATE *es = (EDITSTATE *)GetWindowLongPtrW( hwnd, 0 ); diff --git a/reactos/dll/win32/user32/controls/icontitle.c b/reactos/dll/win32/user32/controls/icontitle.c index 617f3bae91b..01231cdd03c 100644 --- a/reactos/dll/win32/user32/controls/icontitle.c +++ b/reactos/dll/win32/user32/controls/icontitle.c @@ -30,7 +30,7 @@ static BOOL bMultiLineTitle; static HFONT hIconTitleFont; -static LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); /********************************************************************* * icon title class descriptor diff --git a/reactos/dll/win32/user32/controls/listbox.c b/reactos/dll/win32/user32/controls/listbox.c index f332f40fa21..d46c1bb81ba 100644 --- a/reactos/dll/win32/user32/controls/listbox.c +++ b/reactos/dll/win32/user32/controls/listbox.c @@ -138,8 +138,8 @@ typedef enum static TIMER_DIRECTION LISTBOX_Timer = LB_TIMER_NONE; -static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); -static LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam,LPARAM lParam ); +//static LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); static LRESULT LISTBOX_GetItemRect( const LB_DESCR *descr, INT index, RECT *rect ); @@ -2659,8 +2659,8 @@ static BOOL LISTBOX_Destroy( LB_DESCR *descr ) /*********************************************************************** * ListBoxWndProc_common */ -static LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, BOOL unicode ) +LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam, BOOL unicode ) { LB_DESCR *descr = (LB_DESCR *)GetWindowLongPtrW( hwnd, 0 ); LPHEADCOMBO lphc = 0; @@ -3446,7 +3446,7 @@ static LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, /*********************************************************************** * ListBoxWndProcA */ -static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { return ListBoxWndProc_common( hwnd, msg, wParam, lParam, FALSE ); } @@ -3454,7 +3454,7 @@ static LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARA /*********************************************************************** * ListBoxWndProcW */ -static LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { return ListBoxWndProc_common( hwnd, msg, wParam, lParam, TRUE ); } diff --git a/reactos/dll/win32/user32/controls/regcontrol.c b/reactos/dll/win32/user32/controls/regcontrol.c index fa355d3decb..0cc49e7a2ed 100644 --- a/reactos/dll/win32/user32/controls/regcontrol.c +++ b/reactos/dll/win32/user32/controls/regcontrol.c @@ -13,6 +13,10 @@ #include +static PFNCLIENT pfnClientA; +static PFNCLIENT pfnClientW; +static PFNCLIENTWORKER pfnClientWorker; + static const struct { const struct builtin_class_descr *desc; @@ -61,46 +65,57 @@ BOOL WINAPI RegisterSystemControls(VOID) return NtUserRegisterSystemClasses(sizeof(cls) / sizeof(cls[0]), cls); } +LRESULT +WINAPI +MsgWindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + if (message == WM_NCCREATE) return TRUE; + return 0; +} - -static PFNCLIENT pfnClientA; -static PFNCLIENT pfnClientW; -static PFNCLIENTWORKER pfnClientWorker; +LRESULT +WINAPI +DialogWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode) +{ + if (unicode) + return DefDlgProcW( hwnd, uMsg, wParam, lParam); + return DefDlgProcA( hwnd, uMsg, wParam, lParam); +} BOOL WINAPI RegisterClientPFN(VOID) { NTSTATUS Status; -// pfnClientA.pfnScrollBarWndProc = ScrollBarWndProcA; -// pfnClientW.pfnScrollBarWndProc = ScrollBarWndProcW; -// pfnClientA.pfnTitleWndProc = IconTitleWndProc; -// pfnClientW.pfnTitleWndProc = IconTitleWndProc; -// pfnClientA.pfnMenuWndProc = PopupMenuWndProcA; -// pfnClientW.pfnMenuWndProc = PopupMenuWndProcW; - pfnClientA.pfnDesktopWndProc = DesktopWndProc; // Fixme! + pfnClientA.pfnScrollBarWndProc = ScrollBarWndProcA; + pfnClientW.pfnScrollBarWndProc = ScrollBarWndProcW; + pfnClientA.pfnTitleWndProc = IconTitleWndProc; + pfnClientW.pfnTitleWndProc = IconTitleWndProc; + pfnClientA.pfnMenuWndProc = PopupMenuWndProcA; + pfnClientW.pfnMenuWndProc = PopupMenuWndProcW; + pfnClientA.pfnDesktopWndProc = DesktopWndProc; pfnClientW.pfnDesktopWndProc = DesktopWndProc; pfnClientA.pfnDefWindowProc = DefWindowProcA; pfnClientW.pfnDefWindowProc = DefWindowProcW; - pfnClientA.pfnMessageWindowProc = DefWindowProcA; - pfnClientW.pfnMessageWindowProc = DefWindowProcW; + pfnClientA.pfnMessageWindowProc = MsgWindowProc; + pfnClientW.pfnMessageWindowProc = MsgWindowProc; pfnClientA.pfnSwitchWindowProc = DefWindowProcA; pfnClientW.pfnSwitchWindowProc = DefWindowProcW; -// pfnClientA.pfnButtonWndProc = ButtonWndProcA; -// pfnClientW.pfnButtonWndProc = ButtonWndProcW -// pfnClientA.pfnComboBoxWndProc = ComboWndProcA; -// pfnClientW.pfnComboBoxWndProc = ComboWndProcW; -// pfnClientA.pfnComboListBoxProc = ListBoxWndProcA; -// pfnClientW.pfnComboListBoxProc = ListBoxWndProcW; -// pfnClientA.pfnDialogWndProc = DefDlgProcA; -// pfnClientW.pfnDialogWndProc = DefDlgProcW; -// pfnClientA.pfnEditWndProc = EditWndProcA; -// pfnClientW.pfnEditWndProc = EditWndProcW; -// pfnClientA.pfnListBoxWndProc = ListBoxWndProcA; -// pfnClientW.pfnListBoxWndProc = ListBoxWndProcW; -// pfnClientA.pfnMDIClientWndProc = MDIClientWndProcA; -// pfnClientW.pfnMDIClientWndProc = MDIClientWndProcW; -// pfnClientA.pfnStaticWndProc = StaticWndProcA; -// pfnClientW.pfnStaticWndProc = StaticWndProcW; + pfnClientA.pfnButtonWndProc = ButtonWndProcA; + pfnClientW.pfnButtonWndProc = ButtonWndProcW; + pfnClientA.pfnComboBoxWndProc = ComboWndProcA; + pfnClientW.pfnComboBoxWndProc = ComboWndProcW; + pfnClientA.pfnComboListBoxProc = ListBoxWndProcA; + pfnClientW.pfnComboListBoxProc = ListBoxWndProcW; + pfnClientA.pfnDialogWndProc = DefDlgProcA; + pfnClientW.pfnDialogWndProc = DefDlgProcW; + pfnClientA.pfnEditWndProc = EditWndProcA; + pfnClientW.pfnEditWndProc = EditWndProcW; + pfnClientA.pfnListBoxWndProc = ListBoxWndProcA; + pfnClientW.pfnListBoxWndProc = ListBoxWndProcW; + pfnClientA.pfnMDIClientWndProc = MDIClientWndProcA; + pfnClientW.pfnMDIClientWndProc = MDIClientWndProcW; + pfnClientA.pfnStaticWndProc = StaticWndProcA; + pfnClientW.pfnStaticWndProc = StaticWndProcW; pfnClientA.pfnImeWndProc = DefWindowProcA; pfnClientW.pfnImeWndProc = DefWindowProcW; pfnClientA.pfnGhostWndProc = DefWindowProcA; @@ -118,14 +133,14 @@ BOOL WINAPI RegisterClientPFN(VOID) pfnClientA.pfnMDIActivateDlgProc = DefWindowProcA; pfnClientW.pfnMDIActivateDlgProc = DefWindowProcW; -// pfnClientWorker.pfnButtonWndProc = ButtonWndProc_common; -// pfnClientWorker.pfnComboBoxWndProc = ComboWndProc_common; -// pfnClientWorker.pfnComboListBoxProc = ListBoxWndProc_common; -//// pfnClientWorker.pfnDialogWndProc = DefDlgProc_common; -// pfnClientWorker.pfnEditWndProc = EditWndProc_common; -// pfnClientWorker.pfnListBoxWndProc = ListBoxWndProc_common; -// pfnClientWorker.pfnMDIClientWndProc = MDIClientWndProc_common; -// pfnClientWorker.pfnStaticWndProc = StaticWndProc_common; + pfnClientWorker.pfnButtonWndProc = ButtonWndProc_common; + pfnClientWorker.pfnComboBoxWndProc = ComboWndProc_common; + pfnClientWorker.pfnComboListBoxProc = ListBoxWndProc_common; + pfnClientWorker.pfnDialogWndProc = DialogWndProc_common; + pfnClientWorker.pfnEditWndProc = EditWndProc_common; + pfnClientWorker.pfnListBoxWndProc = ListBoxWndProc_common; + pfnClientWorker.pfnMDIClientWndProc = MDIClientWndProc_common; + pfnClientWorker.pfnStaticWndProc = StaticWndProc_common; pfnClientWorker.pfnImeWndProc = User32DefWindowProc; pfnClientWorker.pfnGhostWndProc = User32DefWindowProc; pfnClientWorker.pfnCtfHookProc = User32DefWindowProc; diff --git a/reactos/dll/win32/user32/controls/scrollbar.c b/reactos/dll/win32/user32/controls/scrollbar.c index 0bafefe0573..671e638c932 100644 --- a/reactos/dll/win32/user32/controls/scrollbar.c +++ b/reactos/dll/win32/user32/controls/scrollbar.c @@ -69,8 +69,8 @@ static BOOL ScrollTrackVertical; HBRUSH DefWndControlColor(HDC hDC, UINT ctlType); -static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); -static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); UINT WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC); BOOL WINAPI KillSystemTimer(HWND,UINT_PTR); @@ -1248,7 +1248,7 @@ ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt) /*********************************************************************** * ScrollBarWndProc */ -static LRESULT WINAPI +LRESULT WINAPI ScrollBarWndProc(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) { if (! IsWindow(Wnd)) @@ -1457,13 +1457,13 @@ ScrollBarWndProc(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARA return 0; } -static LRESULT WINAPI +LRESULT WINAPI ScrollBarWndProcW(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) { return ScrollBarWndProc(DefWindowProcW, Wnd, Msg, wParam, lParam); } -static LRESULT WINAPI +LRESULT WINAPI ScrollBarWndProcA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) { return ScrollBarWndProc(DefWindowProcA, Wnd, Msg, wParam, lParam); diff --git a/reactos/dll/win32/user32/controls/static.c b/reactos/dll/win32/user32/controls/static.c index 75d19a0f61a..bd36a423627 100644 --- a/reactos/dll/win32/user32/controls/static.c +++ b/reactos/dll/win32/user32/controls/static.c @@ -55,8 +55,8 @@ static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintBitmapfn( HWND hwnd, HDC hdc, DWORD style ); //static void STATIC_PaintEnhMetafn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style ); -static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); -static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); static COLORREF color_3dshadow, color_3ddkshadow, color_3dhighlight; @@ -436,7 +436,7 @@ static BOOL hasTextStyle( DWORD style ) /*********************************************************************** * StaticWndProc_common */ -static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, +LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode ) { LRESULT lResult = 0; @@ -663,7 +663,7 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, /*********************************************************************** * StaticWndProcA */ -static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if (!IsWindow( hWnd )) return 0; return StaticWndProc_common(hWnd, uMsg, wParam, lParam, FALSE); @@ -672,7 +672,7 @@ static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA /*********************************************************************** * StaticWndProcW */ -static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if (!IsWindow( hWnd )) return 0; return StaticWndProc_common(hWnd, uMsg, wParam, lParam, TRUE); diff --git a/reactos/dll/win32/user32/include/controls.h b/reactos/dll/win32/user32/include/controls.h index 5de02831e44..71528c3a6dc 100644 --- a/reactos/dll/win32/user32/include/controls.h +++ b/reactos/dll/win32/user32/include/controls.h @@ -110,5 +110,24 @@ extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL ); LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); LRESULT WINAPI User32DefWindowProc(HWND,UINT,WPARAM,LPARAM,BOOL); BOOL WINAPI RegisterClientPFN(VOID); +LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI ButtonWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode); +LRESULT WINAPI ComboWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI ComboWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode); +LRESULT WINAPI EditWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +LRESULT WINAPI EditWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode); +LRESULT WINAPI ListBoxWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI ListBoxWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,WPARAM wParam, LPARAM lParam, BOOL unicode); +LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI MDIClientWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode); +LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode); #endif /* _ROS_CONTROLS_H */ diff --git a/reactos/dll/win32/user32/include/menu.h b/reactos/dll/win32/user32/include/menu.h index 223c12655da..bc039184e09 100644 --- a/reactos/dll/win32/user32/include/menu.h +++ b/reactos/dll/win32/user32/include/menu.h @@ -19,4 +19,7 @@ MenuTrackMouseMenuBar(HWND hWnd, ULONG Ht, POINT Pt); VOID MenuTrackKbdMenuBar(HWND hWnd, UINT wParam, WCHAR wChar); +LRESULT WINAPI PopupMenuWndProcA(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam); +LRESULT WINAPI PopupMenuWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + #endif /* __LIB_USER32_INCLUDE_MENU_H */ diff --git a/reactos/dll/win32/user32/include/scroll.h b/reactos/dll/win32/user32/include/scroll.h index 2f35a21e7ae..e543f518409 100644 --- a/reactos/dll/win32/user32/include/scroll.h +++ b/reactos/dll/win32/user32/include/scroll.h @@ -9,6 +9,8 @@ #ifndef USER32_SCROLL_H_INCLUDED #define USER32_SCROLL_H_INCLUDED -extern VOID FASTCALL ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt); +LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT uMsg, WPARAM wParam,LPARAM lParam ); +LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT uMsg, WPARAM wParam,LPARAM lParam ); +VOID FASTCALL ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt); #endif diff --git a/reactos/dll/win32/user32/misc/misc.c b/reactos/dll/win32/user32/misc/misc.c index 97a86e0acbf..9f5938637f5 100644 --- a/reactos/dll/win32/user32/misc/misc.c +++ b/reactos/dll/win32/user32/misc/misc.c @@ -270,10 +270,10 @@ BOOL FASTCALL TestWindowProcess(PWND Wnd) { - if (Wnd->pti == (PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo) + if (Wnd->head.pti == (PW32THREADINFO)NtCurrentTeb()->Win32ThreadInfo) return TRUE; else - return (NtUserQueryWindow(Wnd->hdr.Handle, QUERY_WINDOW_UNIQUE_PROCESS_ID) == + return (NtUserQueryWindow(Wnd->head.h, QUERY_WINDOW_UNIQUE_PROCESS_ID) == (DWORD)NtCurrentTeb()->ClientId.UniqueProcess ); } diff --git a/reactos/dll/win32/user32/windows/mdi.c b/reactos/dll/win32/user32/windows/mdi.c index 0f2eec77987..6372255fba6 100644 --- a/reactos/dll/win32/user32/windows/mdi.c +++ b/reactos/dll/win32/user32/windows/mdi.c @@ -123,8 +123,8 @@ static LONG MDI_ChildActivate( HWND, HWND ); static LRESULT MDI_RefreshMenu(MDICLIENTINFO *); static HWND MDI_MoreWindowsDialog(HWND); -static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); -static LRESULT WINAPI MDIClientWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); +//static LRESULT WINAPI MDIClientWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ); HWND* WIN_ListChildren (HWND hWndparent) { @@ -1057,8 +1057,8 @@ static void MDI_UpdateFrameText( HWND frame, HWND hClient, LPCWSTR lpTitle ) /********************************************************************** * MDIClientWndProc_common */ -static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam, BOOL unicode ) +LRESULT WINAPI MDIClientWndProc_common( HWND hwnd, UINT message, + WPARAM wParam, LPARAM lParam, BOOL unicode ) { MDICLIENTINFO *ci = NULL; @@ -1319,7 +1319,7 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, /*********************************************************************** * MDIClientWndProcA */ -static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { if (!IsWindow(hwnd)) return 0; return MDIClientWndProc_common( hwnd, message, wParam, lParam, FALSE ); @@ -1328,7 +1328,7 @@ static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam, /*********************************************************************** * MDIClientWndProcW */ -static LRESULT WINAPI MDIClientWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +LRESULT WINAPI MDIClientWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) { if (!IsWindow(hwnd)) return 0; return MDIClientWndProc_common( hwnd, message, wParam, lParam, TRUE ); diff --git a/reactos/dll/win32/user32/windows/menu.c b/reactos/dll/win32/user32/windows/menu.c index 37d62035d5e..101c55bf702 100644 --- a/reactos/dll/win32/user32/windows/menu.c +++ b/reactos/dll/win32/user32/windows/menu.c @@ -72,8 +72,8 @@ typedef struct POINT Pt; } MTRACKER; -static LRESULT WINAPI PopupMenuWndProcA(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam); -static LRESULT WINAPI PopupMenuWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +//static LRESULT WINAPI PopupMenuWndProcA(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam); +//static LRESULT WINAPI PopupMenuWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); /********************************************************************* * PopupMenu class descriptor @@ -972,7 +972,7 @@ MenuDrawPopupMenu(HWND Wnd, HDC Dc, HMENU Menu) } } -static LRESULT WINAPI +LRESULT WINAPI PopupMenuWndProcA(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam) { TRACE("YES! hwnd=%x msg=0x%04x wp=0x%04lx lp=0x%08lx\n", Wnd, Message, wParam, lParam); @@ -1036,7 +1036,7 @@ PopupMenuWndProcA(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam) return 0; } -static LRESULT WINAPI +LRESULT WINAPI PopupMenuWndProcW(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam) { TRACE("hwnd=%x msg=0x%04x wp=0x%04lx lp=0x%08lx\n", Wnd, Message, wParam, lParam); diff --git a/reactos/dll/win32/user32/windows/message.c b/reactos/dll/win32/user32/windows/message.c index 9132245e1da..c1dc1f7cd6b 100644 --- a/reactos/dll/win32/user32/windows/message.c +++ b/reactos/dll/win32/user32/windows/message.c @@ -1340,7 +1340,7 @@ DispatchMessageA(CONST MSG *lpmsg) if (lpmsg->hwnd != NULL) { Wnd = ValidateHwnd(lpmsg->hwnd); - if (!Wnd || SharedPtrToUser(Wnd->pti) != GetW32ThreadInfo()) + if (!Wnd || SharedPtrToUser(Wnd->head.pti) != GetW32ThreadInfo()) return 0; } else @@ -1401,7 +1401,7 @@ DispatchMessageW(CONST MSG *lpmsg) if (lpmsg->hwnd != NULL) { Wnd = ValidateHwnd(lpmsg->hwnd); - if (!Wnd || SharedPtrToUser(Wnd->pti) != GetW32ThreadInfo()) + if (!Wnd || SharedPtrToUser(Wnd->head.pti) != GetW32ThreadInfo()) return 0; } else @@ -1801,7 +1801,7 @@ SendMessageW(HWND Wnd, PW32THREADINFO ti = GetW32ThreadInfo(); Window = ValidateHwnd(Wnd); - if (Window != NULL && SharedPtrToUser(Window->pti) == ti && !IsThreadHooked(GetWin32ClientInfo())) + if (Window != NULL && SharedPtrToUser(Window->head.pti) == ti && !IsThreadHooked(GetWin32ClientInfo())) { /* NOTE: We can directly send messages to the window procedure if *all* the following conditions are met: @@ -1865,7 +1865,7 @@ SendMessageA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) PW32THREADINFO ti = GetW32ThreadInfo(); Window = ValidateHwnd(Wnd); - if (Window != NULL && SharedPtrToUser(Window->pti) == ti && !IsThreadHooked(GetWin32ClientInfo())) + if (Window != NULL && SharedPtrToUser(Window->head.pti) == ti && !IsThreadHooked(GetWin32ClientInfo())) { /* NOTE: We can directly send messages to the window procedure if *all* the following conditions are met: diff --git a/reactos/dll/win32/user32/windows/window.c b/reactos/dll/win32/user32/windows/window.c index ed464dea7fd..4bd9a19c3f0 100644 --- a/reactos/dll/win32/user32/windows/window.c +++ b/reactos/dll/win32/user32/windows/window.c @@ -1268,7 +1268,7 @@ GetWindowThreadProcessId(HWND hWnd, if (!pWnd) return Ret; - ti = SharedPtrToUser(pWnd->pti); + ti = SharedPtrToUser(pWnd->head.pti); if (ti) { diff --git a/reactos/include/reactos/win32k/ntgdityp.h b/reactos/include/reactos/win32k/ntgdityp.h index 79e5fc36307..42bd035c059 100644 --- a/reactos/include/reactos/win32k/ntgdityp.h +++ b/reactos/include/reactos/win32k/ntgdityp.h @@ -451,7 +451,8 @@ typedef struct _PATRECT RECT r; HBRUSH hBrush; } PATRECT, * PPATRECT; - +#endif +#ifndef __WIN32K_NTUSER_H typedef struct _W32CLIENTINFO { ULONG CI_flags; @@ -462,7 +463,6 @@ typedef struct _W32CLIENTINFO ULONG W32ClientInfo[57]; } W32CLIENTINFO, *PW32CLIENTINFO; #endif - typedef struct _GDIBSPPATBLT { GDIBATCHHDR gbHdr; diff --git a/reactos/include/reactos/win32k/ntuser.h b/reactos/include/reactos/win32k/ntuser.h index 4c9526971e1..89c9edc2bdb 100644 --- a/reactos/include/reactos/win32k/ntuser.h +++ b/reactos/include/reactos/win32k/ntuser.h @@ -2,7 +2,6 @@ #define __WIN32K_NTUSER_H typedef struct _PROCESSINFO *PPROCESSINFO; -struct _W32THREADINFO; struct _DESKTOP; struct _WND; @@ -36,36 +35,6 @@ VOID NTAPI RtlInitLargeAnsiString(IN OUT PLARGE_ANSI_STRING,IN PCSZ,IN INT); VOID NTAPI RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING,IN PCWSTR,IN INT); BOOL NTAPI RtlLargeStringToUnicodeString( PUNICODE_STRING, PLARGE_STRING); -/* FIXME: UserHMGetHandle needs to be updated once the new handle manager is implemented */ -#define UserHMGetHandle(obj) ((obj)->hdr.Handle) - -typedef struct _REGISTER_SYSCLASS -{ - /* This is a reactos specific class used to initialize the - system window classes during user32 initialization */ - UNICODE_STRING ClassName; - UINT Style; - WNDPROC ProcW; - WNDPROC ProcA; - UINT ExtraBytes; - HICON hCursor; - HBRUSH hBrush; - UINT ClassId; -} REGISTER_SYSCLASS, *PREGISTER_SYSCLASS; - -typedef struct _CLSMENUNAME -{ - LPSTR pszClientAnsiMenuName; - LPWSTR pwszClientUnicodeMenuName; - PUNICODE_STRING pusMenuName; -} CLSMENUNAME, *PCLSMENUNAME; - -typedef struct _USER_OBJHDR -{ - /* This is the common header for all user handle objects */ - HANDLE Handle; -} USER_OBJHDR, PUSER_OBJHDR; - typedef struct _DESKTOPINFO { PVOID pvDesktopBase; @@ -90,6 +59,132 @@ typedef struct _DESKTOPINFO WCHAR szDesktopName[1]; } DESKTOPINFO, *PDESKTOPINFO; +#define CTI_INSENDMESSAGE 0x0002 + +typedef struct _CLIENTTHREADINFO +{ + DWORD CTI_flags; + WORD fsChangeBits; + WORD fsWakeBits; + WORD fsWakeBitsJournal; + WORD fsWakeMask; + ULONG tickLastMsgChecked; + DWORD dwcPumpHook; +} CLIENTTHREADINFO, *PCLIENTTHREADINFO; + +typedef struct _W32THREADINFO +{ + PPROCESSINFO ppi; /* [KERNEL] */ + PDESKTOPINFO pDeskInfo; + ULONG fsHooks; +} W32THREADINFO, *PW32THREADINFO; + +typedef struct _HEAD +{ + HANDLE h; + DWORD cLockObj; +} HEAD, *PHEAD; + +typedef struct _THRDESKHEAD +{ + HANDLE h; + DWORD cLockObj; + PW32THREADINFO pti; + struct _DESKTOP *rpdesk; + PVOID pSelf; +} THRDESKHEAD, *PTHRDESKHEAD; + +typedef struct _PROCDESKHEAD +{ + HANDLE h; + DWORD cLockObj; + DWORD hTaskWow; + struct _DESKTOP *rpdesk; + PVOID pSelf; +} PROCDESKHEAD, *PPROCDESKHEAD; + +#define UserHMGetHandle(obj) ((obj)->head.h) + +/* Window Client Information structure */ +struct _ETHREAD; + +typedef struct tagHOOK +{ + THRDESKHEAD head; + LIST_ENTRY Chain; /* Hook chain entry */ + struct _ETHREAD* Thread; /* Thread owning the hook */ + int HookId; /* Hook table index */ + HOOKPROC Proc; /* Hook function */ + BOOLEAN Ansi; /* Is it an Ansi hook? */ + ULONG Flags; /* Some internal flags */ + UNICODE_STRING ModuleName; /* Module name for global hooks */ +} HOOK, *PHOOK; + +typedef struct _CALLBACKWND +{ + HWND hWnd; + PVOID pvWnd; +} CALLBACKWND, *PCALLBACKWND; + +#define CI_CURTHPRHOOK 0x00000010 + +typedef struct _CLIENTINFO +{ + ULONG CI_flags; + ULONG cSpins; + DWORD dwExpWinVer; + DWORD dwCompatFlags; + DWORD dwCompatFlags2; + DWORD dwTIFlags; + PDESKTOPINFO pDeskInfo; + ULONG_PTR ulClientDelta; + PHOOK phkCurrent; + ULONG fsHooks; + CALLBACKWND CallbackWnd; + DWORD dwHookCurrent; + INT cInDDEMLCallback; + PCLIENTTHREADINFO pClientThreadInfo; + ULONG_PTR dwHookData; + DWORD dwKeyCache; + DWORD afKeyState[2]; + DWORD dwAsyncKeyCache; + DWORD afAsyncKeyState[2]; + DWORD afAsyncKeyStateRecentDow[2]; + HKL hKL; + USHORT CodePage; + USHORT achDbcsCF; + MSG msgDbcsCB; + ULONG Win32ClientInfo3[28]; +/* It's just a pointer reference not to be used w the structure in user space. */ + PPROCESSINFO ppi; +} CLIENTINFO, *PCLIENTINFO; + +/* Make sure it fits exactly into the TEB */ +C_ASSERT(sizeof(CLIENTINFO) == FIELD_OFFSET(TEB, glDispatchTable) - FIELD_OFFSET(TEB, Win32ClientInfo)); + +#define GetWin32ClientInfo() ((PCLIENTINFO)(NtCurrentTeb()->Win32ClientInfo)) + +typedef struct _REGISTER_SYSCLASS +{ + /* This is a reactos specific class used to initialize the + system window classes during user32 initialization */ + UNICODE_STRING ClassName; + UINT Style; + WNDPROC ProcW; + WNDPROC ProcA; + UINT ExtraBytes; + HICON hCursor; + HBRUSH hBrush; + UINT ClassId; +} REGISTER_SYSCLASS, *PREGISTER_SYSCLASS; + +typedef struct _CLSMENUNAME +{ + LPSTR pszClientAnsiMenuName; + LPWSTR pwszClientUnicodeMenuName; + PUNICODE_STRING pusMenuName; +} CLSMENUNAME, *PCLSMENUNAME; + typedef enum _GETCPD { UserGetCPDU2A = 0x01, @@ -102,9 +197,7 @@ typedef enum _GETCPD typedef struct _CALLPROCDATA { -// PROCDESKHEAD head; // Use this once new handle manager is implemented!!! - USER_OBJHDR hdr; /* FIXME: Move out of the structure once new handle manager is implemented */ -// + PROCDESKHEAD head; struct _CALLPROCDATA *spcpdNext; WNDPROC pfnClientPrevious; union @@ -257,15 +350,7 @@ typedef struct _CLS typedef struct _WND { - //THRDESKHEAD head; // head.h == handle - USER_OBJHDR hdr; /* FIXME: Move out of the structure once new handle manager is implemented */ - /* NOTE: This structure is located in the desktop heap and will - eventually replace WINDOW_OBJECT. Right now WINDOW_OBJECT - keeps a reference to this structure until all the information - is moved to this structure */ - struct _W32THREADINFO *pti; // head.pti - struct _DESKTOP *rpdesk; // head.rpdesk - + THRDESKHEAD head; DWORD state; DWORD state2; /* Extended style. */ @@ -388,6 +473,7 @@ typedef LONG_PTR (NTAPI *PFN_FNID)(PWND, UINT, WPARAM, LPARAM, ULONG_PTR); #define FNID_MENU 0x029C #define FNID_DESKTOP 0x029D #define FNID_DEFWINDOWPROC 0x029E +#define FNID_MESSAGEWND 0x029F #define FNID_SWITCH 0x02A0 #define FNID_BUTTON 0x02A1 #define FNID_COMBOBOX 0x02A2 @@ -398,17 +484,20 @@ typedef LONG_PTR (NTAPI *PFN_FNID)(PWND, UINT, WPARAM, LPARAM, ULONG_PTR); #define FNID_MDICLIENT 0x02A7 #define FNID_STATIC 0x02A8 #define FNID_IME 0x02A9 -#define FNID_CALLWNDPROC 0x02AA -#define FNID_CALLWNDPROCRET 0x02AB -#define FNID_HKINLPCWPEXSTRUCT 0x02AC -#define FNID_HKINLPCWPRETEXSTRUCT 0x02AD -#define FNID_SENDMESSAGE 0x02B0 +#define FNID_GHOST 0x02AA +#define FNID_CALLWNDPROC 0x02AB +#define FNID_CALLWNDPROCRET 0x02AC +#define FNID_HKINLPCWPEXSTRUCT 0x02AD +#define FNID_HKINLPCWPRETEXSTRUCT 0x02AE +#define FNID_MB_DLGPROC 0x02AF +#define FNID_MDIACTIVATEDLGPROC 0x02B0 +#define FNID_SENDMESSAGE 0x02B1 +#define FNID_SENDMESSAGEFF 0x02B2 // Kernel has option to use TimeOut or normal msg send, based on type of msg. -#define FNID_SENDMESSAGEWTOOPTION 0x02B1 -#define FNID_SENDMESSAGETIMEOUT 0x02B2 -#define FNID_BROADCASTSYSTEMMESSAGE 0x02B4 -#define FNID_TOOLTIPS 0x02B5 -#define FNID_UNKNOWN 0x02B6 +#define FNID_SENDMESSAGEWTOOPTION 0x02B3 +#define FNID_SENDMESSAGETIMEOUT 0x02B4 +#define FNID_BROADCASTSYSTEMMESSAGE 0x02B5 +#define FNID_TOOLTIPS 0x02B6 #define FNID_SENDNOTIFYMESSAGE 0x02B7 #define FNID_SENDMESSAGECALLBACK 0x02B8 #define FNID_LAST 0x02B9 @@ -551,85 +640,6 @@ typedef struct tagSERVERINFO PERUSERSERVERINFO; } SERVERINFO, *PSERVERINFO; -#define CTI_INSENDMESSAGE 0x0002 - -typedef struct _CLIENTTHREADINFO -{ - DWORD CTI_flags; - WORD fsChangeBits; - WORD fsWakeBits; - WORD fsWakeBitsJournal; - WORD fsWakeMask; - ULONG tickLastMsgChecked; - DWORD dwcPumpHook; -} CLIENTTHREADINFO, *PCLIENTTHREADINFO; - -typedef struct _W32THREADINFO -{ - PPROCESSINFO ppi; /* [KERNEL] */ - PDESKTOPINFO pDeskInfo; - ULONG fsHooks; -} W32THREADINFO, *PW32THREADINFO; - -/* Window Client Information structure */ -struct _ETHREAD; - - -typedef struct tagHOOK -{ - LIST_ENTRY Chain; /* Hook chain entry */ - HHOOK Self; /* user handle for this hook */ - struct _ETHREAD* Thread; /* Thread owning the hook */ - int HookId; /* Hook table index */ - HOOKPROC Proc; /* Hook function */ - BOOLEAN Ansi; /* Is it an Ansi hook? */ - ULONG Flags; /* Some internal flags */ - UNICODE_STRING ModuleName; /* Module name for global hooks */ -} HOOK, *PHOOK; - -typedef struct _CALLBACKWND -{ - HWND hWnd; - PVOID pvWnd; -} CALLBACKWND, *PCALLBACKWND; - -#define CI_CURTHPRHOOK 0x00000010 - -typedef struct _CLIENTINFO -{ - ULONG CI_flags; - ULONG cSpins; - DWORD dwExpWinVer; - DWORD dwCompatFlags; - DWORD dwCompatFlags2; - DWORD dwTIFlags; - PDESKTOPINFO pDeskInfo; - ULONG_PTR ulClientDelta; - PHOOK phkCurrent; - ULONG fsHooks; - CALLBACKWND CallbackWnd; - DWORD dwHookCurrent; - INT cInDDEMLCallback; - PCLIENTTHREADINFO pClientThreadInfo; - ULONG_PTR dwHookData; - DWORD dwKeyCache; - DWORD afKeyState[2]; - DWORD dwAsyncKeyCache; - DWORD afAsyncKeyState[2]; - DWORD afAsyncKeyStateRecentDow[2]; - HKL hKL; - USHORT CodePage; - USHORT achDbcsCF; - MSG msgDbcsCB; - ULONG Win32ClientInfo3[28]; -/* It's just a pointer reference not to be used w the structure in user space. */ - PPROCESSINFO ppi; -} CLIENTINFO, *PCLIENTINFO; - -/* Make sure it fits exactly into the TEB */ -C_ASSERT(sizeof(CLIENTINFO) == FIELD_OFFSET(TEB, glDispatchTable) - FIELD_OFFSET(TEB, Win32ClientInfo)); - -#define GetWin32ClientInfo() ((PCLIENTINFO)(NtCurrentTeb()->Win32ClientInfo)) // Server event activity bits. #define SRV_EVENT_MENU 0x0001 diff --git a/reactos/subsystems/win32/win32k/include/hook.h b/reactos/subsystems/win32/win32k/include/hook.h index 9f71f25505d..2042b1f7e41 100644 --- a/reactos/subsystems/win32/win32k/include/hook.h +++ b/reactos/subsystems/win32/win32k/include/hook.h @@ -2,19 +2,6 @@ #define _WIN32K_HOOK_H #define HOOK_THREAD_REFERENCED (0x1) -#if 0 -typedef struct tagHOOK -{ - LIST_ENTRY Chain; /* Hook chain entry */ - HHOOK Self; /* user handle for this hook */ - PETHREAD Thread; /* Thread owning the hook */ - int HookId; /* Hook table index */ - HOOKPROC Proc; /* Hook function */ - BOOLEAN Ansi; /* Is it an Ansi hook? */ - ULONG Flags; /* Some internal flags */ - UNICODE_STRING ModuleName; /* Module name for global hooks */ -} HOOK, *PHOOK; -#endif #define NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1) #define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK) #define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1)) @@ -29,7 +16,6 @@ typedef struct tagHOOKTABLE typedef struct tagEVENTHOOK { LIST_ENTRY Chain; /* Event chain entry */ - HWINEVENTHOOK Self; /* user handle for this event */ PETHREAD Thread; /* Thread owning the event */ UINT eventMin; UINT eventMax; @@ -39,6 +25,7 @@ typedef struct tagEVENTHOOK ULONG Flags; /* Some internal flags */ ULONG_PTR offPfn; INT ihmod; + THRDESKHEAD head; // FIXME When on top it creates problems UNICODE_STRING ModuleName; /* Module name for global events */ } EVENTHOOK, *PEVENTHOOK; diff --git a/reactos/subsystems/win32/win32k/include/window.h b/reactos/subsystems/win32/win32k/include/window.h index 239103714ac..16537c1448b 100644 --- a/reactos/subsystems/win32/win32k/include/window.h +++ b/reactos/subsystems/win32/win32k/include/window.h @@ -169,7 +169,7 @@ IntShowOwnedPopups( PWINDOW_OBJECT owner, BOOL fShow ); LRESULT FASTCALL IntDefWindowProc( PWINDOW_OBJECT Window, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi); -VOID FASTCALL IntNotifyWinEvent(DWORD, HWND, LONG, LONG); +VOID FASTCALL IntNotifyWinEvent(DWORD, PWND, LONG, LONG); PWND APIENTRY co_IntCreateWindowEx(DWORD,PUNICODE_STRING,PUNICODE_STRING,DWORD,LONG,LONG,LONG,LONG,HWND,HMENU,HINSTANCE,LPVOID,DWORD,BOOL); #endif /* _WIN32K_WINDOW_H */ diff --git a/reactos/subsystems/win32/win32k/ntuser/callproc.c b/reactos/subsystems/win32/win32k/ntuser/callproc.c index 42ce855eea6..e7f3c2ca900 100644 --- a/reactos/subsystems/win32/win32k/ntuser/callproc.c +++ b/reactos/subsystems/win32/win32k/ntuser/callproc.c @@ -48,7 +48,7 @@ CloneCallProc(IN PDESKTOPINFO Desktop, sizeof(CALLPROCDATA)); if (NewCallProc != NULL) { - NewCallProc->hdr.Handle = Handle; /* FIXME: Remove hack */ + NewCallProc->head.h = Handle; NewCallProc->pfnClientPrevious = CallProc->pfnClientPrevious; NewCallProc->Unicode = CallProc->Unicode; NewCallProc->spcpdNext = NULL; @@ -73,7 +73,7 @@ CreateCallProc(IN PDESKTOPINFO Desktop, sizeof(CALLPROCDATA)); if (NewCallProc != NULL) { - NewCallProc->hdr.Handle = Handle; /* FIXME: Remove hack */ + NewCallProc->head.h = Handle; NewCallProc->pfnClientPrevious = WndProc; NewCallProc->Unicode = Unicode; NewCallProc->spcpdNext = NULL; diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index e6ae2fee7fe..d7010f99031 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -566,7 +566,7 @@ HWND FASTCALL IntGetMessageWindow(VOID) DPRINT("No active desktop\n"); return NULL; } - return pdo->spwndMessage->hdr.Handle; + return pdo->spwndMessage->head.h; } HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID) @@ -1119,7 +1119,7 @@ NtUserCreateDesktop( wc.cbSize = sizeof(wc); wc.style = 0; - wc.lpfnWndProc = gpsi->apfnClientW.pfnDesktopWndProc; // Use pfnMessageWindowProc + wc.lpfnWndProc = gpsi->apfnClientW.pfnMessageWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hModClient; diff --git a/reactos/subsystems/win32/win32k/ntuser/event.c b/reactos/subsystems/win32/win32k/ntuser/event.c index 0b85dded343..c84037ca610 100644 --- a/reactos/subsystems/win32/win32k/ntuser/event.c +++ b/reactos/subsystems/win32/win32k/ntuser/event.c @@ -4,6 +4,9 @@ #define NDEBUG #include +#define WINEVENT_INIT 0x40000000 +#define WINEVENT_DESTROYED 0x80000000 + typedef struct _EVENTPACK { PEVENTHOOK pEH; @@ -126,10 +129,13 @@ IntRemoveEvent(PEVENTHOOK pEH) { if (pEH) { + DPRINT("IntRemoveEvent pEH 0x%x\n",pEH); + KeEnterCriticalRegion(); RemoveEntryList(&pEH->Chain); GlobalEvents->Counts--; if (!GlobalEvents->Counts) gpsi->dwInstalledEventHooks = 0; - UserDeleteObject(pEH->Self, otEvent); + UserDeleteObject(pEH->head.h, otEvent); + KeLeaveCriticalRegion(); return TRUE; } return FALSE; @@ -150,14 +156,14 @@ co_EVENT_CallEvents( DWORD event, pEH = pEP->pEH; - Result = co_IntCallEventProc( pEH->Self, - event, - hwnd, - pEP->idObject, - pEP->idChild, + Result = co_IntCallEventProc( pEH->head.h, + event, + hwnd, + pEP->idObject, + pEP->idChild, (DWORD)(NtCurrentTeb()->ClientId).UniqueThread, - (DWORD)EngGetTickCount(), - pEH->Proc); + (DWORD)EngGetTickCount(), + pEH->Proc); return Result; } @@ -165,19 +171,32 @@ VOID FASTCALL IntNotifyWinEvent( DWORD Event, - HWND hWnd, + PWND pWnd, LONG idObject, LONG idChild) { PEVENTHOOK pEH; LRESULT Result; + DPRINT("IntNotifyWinEvent GlobalEvents = 0x%x pWnd 0x%x\n",GlobalEvents, pWnd); + + if (!pWnd) return; + + if (pWnd && pWnd->state & WNDS_DESTROYED) return; + if (!GlobalEvents || !GlobalEvents->Counts) return; - pEH = (PEVENTHOOK)GlobalEvents->Events.Flink; + if (!UserIsEntered()) return; + pEH = (PEVENTHOOK)GlobalEvents->Events.Flink; + DPRINT("IntNotifyWinEvent pEH 0x%x\n",pEH); do { + if (pEH->Flags & WINEVENT_INIT) + { + DPRINT("IntNotifyWinEvent is still in INIT MODE!! pEH 0x%x\n",pEH); + } + UserReferenceObject(pEH); // Must be inside the event window. if ( (pEH->eventMin <= Event) && (pEH->eventMax >= Event)) @@ -187,7 +206,7 @@ IntNotifyWinEvent( if (!(pEH->idProcess) || !(pEH->idThread) || (NtCurrentTeb()->ClientId.UniqueProcess == (PVOID)pEH->idProcess)) { - Result = IntCallLowLevelEvent(pEH, Event, hWnd, idObject, idChild); + Result = IntCallLowLevelEvent(pEH, Event, UserHMGetHandle(pWnd), idObject, idChild); } }// if ^skip own thread && ((Pid && CPid == Pid && ^skip own process) || all process) else if ( !(pEH->Flags & WINEVENT_SKIPOWNTHREAD) && @@ -196,14 +215,16 @@ IntNotifyWinEvent( !(pEH->Flags & WINEVENT_SKIPOWNPROCESS)) || !pEH->idProcess ) ) { - Result = co_IntCallEventProc( pEH->Self, - Event, - hWnd, - idObject, - idChild, + + Result = co_IntCallEventProc( pEH->head.h, + Event, + UserHMGetHandle(pWnd), + idObject, + idChild, PtrToUint(NtCurrentTeb()->ClientId.UniqueThread), - (DWORD)EngGetTickCount(), - pEH->Proc); + (DWORD)EngGetTickCount(), + pEH->Proc); + } } UserDereferenceObject(pEH); @@ -234,7 +255,7 @@ NtUserNotifyWinEvent( if (gpsi->dwInstalledEventHooks & GetMaskFromEvent(Event)) { UserRefObjectCo(Window, &Ref); - IntNotifyWinEvent( Event, Window->hSelf, idObject, idChild); + IntNotifyWinEvent( Event, Window->Wnd, idObject, idChild); UserDerefObjectCo(Window); } UserLeave(); @@ -309,7 +330,10 @@ NtUserSetWinEventHook( InsertTailList(&GlobalEvents->Events, &pEH->Chain); GlobalEvents->Counts++; - pEH->Self = Handle; + pEH->Flags = dwflags|WINEVENT_INIT; + pEH->head.h = Handle; +// pEH->head.pti =? +// pEH->head.rpdesk if (Thread) pEH->Thread = Thread; else @@ -318,8 +342,6 @@ NtUserSetWinEventHook( pEH->eventMax = eventMax; pEH->idProcess = idProcess; pEH->idThread = idThread; - pEH->Flags = dwflags; - if (NULL != hmodWinEventProc) { @@ -371,6 +393,8 @@ NtUserSetWinEventHook( else pEH->Proc = lpfnWinEventProc; + pEH->Flags &= ~WINEVENT_INIT; + UserDereferenceObject(pEH); Ret = Handle; diff --git a/reactos/subsystems/win32/win32k/ntuser/hook.c b/reactos/subsystems/win32/win32k/ntuser/hook.c index 4263352e742..6c476489ae5 100644 --- a/reactos/subsystems/win32/win32k/ntuser/hook.c +++ b/reactos/subsystems/win32/win32k/ntuser/hook.c @@ -104,7 +104,9 @@ IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinSt return NULL; } - Hook->Self = Handle; +// Hook->head.pti =? +// Hook->head.rpdesk + Hook->head.h = Handle; Hook->Thread = Thread; Hook->HookId = HookId; @@ -218,7 +220,7 @@ IntFreeHook(PHOOKTABLE Table, PHOOK Hook, PWINSTATION_OBJECT WinStaObj) } /* Close handle */ - UserDeleteObject(Hook->Self, otHook); + UserDeleteObject(Hook->head.h, otHook); } /* remove a hook, freeing it if the chain is not in use */ @@ -1282,7 +1284,7 @@ NtUserSetWindowsHookEx(HINSTANCE Mod, Hook->Proc = HookProc; Hook->Ansi = Ansi; - Handle = Hook->Self; + Handle = Hook->head.h; /* Clear the client threads next hook. */ ClientInfo->phkCurrent = 0; @@ -1333,7 +1335,7 @@ NtUserUnhookWindowsHookEx(HHOOK Hook) RETURN( FALSE); } - ASSERT(Hook == HookObj->Self); + ASSERT(Hook == HookObj->head.h); IntRemoveHook(HookObj, WinStaObj, FALSE); diff --git a/reactos/subsystems/win32/win32k/ntuser/object.c b/reactos/subsystems/win32/win32k/ntuser/object.c index a05b86db21d..0221c57ce50 100644 --- a/reactos/subsystems/win32/win32k/ntuser/object.c +++ b/reactos/subsystems/win32/win32k/ntuser/object.c @@ -382,7 +382,7 @@ BOOL FASTCALL UserDereferenceObject(PVOID obj) if (!hdr->destroyed && hdr->RefCount == 0) { hdr->RefCount++; // BOUNCE!!!!! - DPRINT1("warning! Dereference to zero without deleting!\n"); + DPRINT1("warning! Dereference to zero without deleting! Obj -> 0x%x\n", obj); } if (hdr->RefCount == 0 && hdr->destroyed) diff --git a/reactos/subsystems/win32/win32k/ntuser/windc.c b/reactos/subsystems/win32/win32k/ntuser/windc.c index c94544e5aa2..fffe387d368 100644 --- a/reactos/subsystems/win32/win32k/ntuser/windc.c +++ b/reactos/subsystems/win32/win32k/ntuser/windc.c @@ -418,7 +418,7 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags) // Window nz, check to see if we still own this or it is just cheap wine tonight. if (!(Flags & DCX_CACHE)) { - if ( Wnd->pti != GetW32ThreadInfo()) + if ( Wnd->head.pti != GetW32ThreadInfo()) Flags |= DCX_CACHE; // Ah~ Not Powned! Forced to be cheap~ } diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 43b513a8e2d..386d0a888e7 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -329,12 +329,12 @@ UserFreeWindowInfo(PW32THREADINFO ti, PWINDOW_OBJECT WindowObject) { Wnd->strName.Length = 0; Wnd->strName.MaximumLength = 0; - DesktopHeapFree(Wnd->rpdesk, + DesktopHeapFree(Wnd->head.rpdesk, Wnd->strName.Buffer); Wnd->strName.Buffer = NULL; } - DesktopHeapFree(Wnd->rpdesk, Wnd); + DesktopHeapFree(Wnd->head.rpdesk, Wnd); WindowObject->Wnd = NULL; } @@ -370,6 +370,9 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window, } Window->Status |= WINDOWSTATUS_DESTROYING; Wnd->style &= ~WS_VISIBLE; + + IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Wnd, OBJID_WINDOW, 0); + /* remove the window already at this point from the thread window list so we don't get into trouble when destroying the thread windows while we're still in IntDestroyWindow() */ @@ -379,8 +382,6 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window, IntDeRegisterShellHookWindow(Window->hSelf); - IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Window->hSelf, OBJID_WINDOW, 0); - if(SendMessages) { /* Send destroy messages */ @@ -428,6 +429,8 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window, /* from now on no messages can be sent to this window anymore */ Window->Status |= WINDOWSTATUS_DESTROYED; + Wnd->state |= WNDS_DESTROYED; + /* don't remove the WINDOWSTATUS_DESTROYING bit */ /* reset shell window handles */ @@ -569,10 +572,10 @@ IntGetWindowProc(IN PWINDOW_OBJECT Window, Wnd->Unicode); if (NewCallProc == NULL) { - NewCallProc = CreateCallProc(Wnd->pti->pDeskInfo, + NewCallProc = CreateCallProc(Wnd->head.pti->pDeskInfo, Wnd->lpfnWndProc, Wnd->Unicode, - Wnd->pti->ppi); + Wnd->head.pti->ppi); if (NewCallProc == NULL) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); @@ -1669,11 +1672,11 @@ co_IntCreateWindowEx(DWORD dwExStyle, goto AllocErr; RtlZeroMemory(Window->Wnd, sizeof(WND) + Class->cbwndExtra); - Window->Wnd->hdr.Handle = hWnd; /* FIXME: Remove hack , are you sure?*/ + Window->Wnd->head.h = hWnd; Wnd = Window->Wnd; - Wnd->pti = ti; - Wnd->rpdesk = pti->Desktop; + Wnd->head.pti = ti; + Wnd->head.rpdesk = pti->Desktop; Wnd->hWndLastActive = hWnd; } @@ -1769,7 +1772,7 @@ AllocErr: if ( NULL != WindowName->Buffer && WindowName->Length > 0 ) { - Wnd->strName.Buffer = DesktopHeapAlloc(Wnd->rpdesk, + Wnd->strName.Buffer = DesktopHeapAlloc(Wnd->head.rpdesk, WindowName->Length + sizeof(UNICODE_NULL)); if (Wnd->strName.Buffer == NULL) { @@ -2122,7 +2125,7 @@ AllocErr: RETURN((PWND)0); } - IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window->hSelf, OBJID_WINDOW, 0); + IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window->Wnd, OBJID_WINDOW, 0); /* Send move and size messages. */ if (!(Window->Flags & WINDOWOBJECT_NEED_SIZE)) @@ -2240,7 +2243,7 @@ AllocErr: { PCALLPROCDATA CallProc; //CallProc = CreateCallProc(NULL, Wnd->lpfnWndProc, bUnicodeWindow, Wnd->ti->ppi); - CallProc = CreateCallProc(NULL, Wnd->lpfnWndProc, Wnd->Unicode , Wnd->pti->ppi); + CallProc = CreateCallProc(NULL, Wnd->lpfnWndProc, Wnd->Unicode , Wnd->head.pti->ppi); if (!CallProc) { @@ -2363,7 +2366,7 @@ NtUserCreateWindowEx(DWORD dwExStyle, dwShowMode, bUnicodeWindow); - if (pNewWindow) NewWindow = pNewWindow->hdr.Handle; + if (pNewWindow) NewWindow = UserHMGetHandle(pNewWindow); if (WindowName.Buffer) { @@ -3729,7 +3732,7 @@ IntSetWindowProc(PWINDOW_OBJECT Window, CallProc = CreateCallProc(NULL, Wnd->lpfnWndProc, Wnd->Unicode, - Wnd->pti->ppi); + Wnd->head.pti->ppi); if (CallProc == NULL) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); @@ -4819,10 +4822,10 @@ NtUserDefSetText(HWND hWnd, PLARGE_STRING WindowText) Wnd->strName.Buffer = NULL; if (buf != NULL) { - DesktopHeapFree(Wnd->rpdesk, buf); + DesktopHeapFree(Wnd->head.rpdesk, buf); } - Wnd->strName.Buffer = DesktopHeapAlloc(Wnd->rpdesk, + Wnd->strName.Buffer = DesktopHeapAlloc(Wnd->head.rpdesk, UnicodeString.Length + sizeof(UNICODE_NULL)); if (Wnd->strName.Buffer != NULL) {