Author: hbelusca Date: Fri Nov 28 21:48:44 2014 New Revision: 65517
URL: http://svn.reactos.org/svn/reactos?rev=65517&view=rev Log: [WIN32K]: Move IntClientShutdown function to a dedicated file (that will contain other shutdown helper functions in the future). Part 3/X CORE-8322
Added: trunk/reactos/win32ss/user/ntuser/shutdown.c (with props) trunk/reactos/win32ss/user/ntuser/shutdown.h (with props) Modified: trunk/reactos/win32ss/CMakeLists.txt trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c trunk/reactos/win32ss/user/ntuser/defwnd.c trunk/reactos/win32ss/user/ntuser/win32kdebug.h trunk/reactos/win32ss/win32kp.h
Modified: trunk/reactos/win32ss/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/CMakeLists.txt?rev=... ============================================================================== --- trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/win32ss/CMakeLists.txt [iso-8859-1] Fri Nov 28 21:48:44 2014 @@ -130,6 +130,7 @@ user/ntuser/prop.c user/ntuser/scrollbar.c user/ntuser/session.c + user/ntuser/shutdown.c user/ntuser/simplecall.c user/ntuser/sysparams.c user/ntuser/timer.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/gdidbg.c [iso-8859-1] Fri Nov 28 21:48:44 2014 @@ -85,6 +85,7 @@ {L"UserProcess", DbgChUserProcess}, {L"UserProp", DbgChUserProp}, {L"UserScrollbar", DbgChUserScrollbar}, + {L"UserShutdown", DbgChUserShutdown}, {L"UserSysparams", DbgChUserSysparams}, {L"UserTimer", DbgChUserTimer}, {L"UserThread", DbgChUserThread},
Modified: trunk/reactos/win32ss/user/ntuser/defwnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/defwnd.... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] Fri Nov 28 21:48:44 2014 @@ -7,7 +7,6 @@ */
#include <win32k.h> - #include <windowsx.h>
DBG_DEFAULT_CHANNEL(UserDefwnd); @@ -31,91 +30,6 @@ (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT)) #define ON_BOTTOM_BORDER(hit) \ (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT)) - -// Client Shutdown messages -#define MCS_SHUTDOWNTIMERS 1 -#define MCS_QUERYENDSESSION 2 -// Client Shutdown returns -#define MCSR_GOODFORSHUTDOWN 1 -#define MCSR_SHUTDOWNFINISHED 2 -#define MCSR_DONOTSHUTDOWN 3 - -/* - * Based on CSRSS and described in pages 1115 - 1118 "Windows Internals, Fifth Edition". - * Apparently CSRSS sends out messages to do this w/o going into win32k internals. - */ -static -LRESULT FASTCALL -IntClientShutdown( - PWND pWindow, - WPARAM wParam, - LPARAM lParam -) -{ - LPARAM lParams; - BOOL KillTimers; - INT i; - LRESULT lResult = MCSR_GOODFORSHUTDOWN; - HWND *List; - - lParams = wParam & (ENDSESSION_LOGOFF|ENDSESSION_CRITICAL|ENDSESSION_CLOSEAPP); - KillTimers = wParam & MCS_SHUTDOWNTIMERS ? TRUE : FALSE; -/* - First, send end sessions to children. - */ - List = IntWinListChildren(pWindow); - - if (List) - { - for (i = 0; List[i]; i++) - { - PWND WndChild; - - if (!(WndChild = UserGetWindowObject(List[i]))) - continue; - - if (wParam & MCS_QUERYENDSESSION) - { - if (!co_IntSendMessage(WndChild->head.h, WM_QUERYENDSESSION, 0, lParams)) - { - lResult = MCSR_DONOTSHUTDOWN; - break; - } - } - else - { - co_IntSendMessage(WndChild->head.h, WM_ENDSESSION, KillTimers, lParams); - if (KillTimers) - { - DestroyTimersForWindow(WndChild->head.pti, WndChild); - } - lResult = MCSR_SHUTDOWNFINISHED; - } - } - ExFreePoolWithTag(List, USERTAG_WINDOWLIST); - } - if (List && (lResult == MCSR_DONOTSHUTDOWN)) return lResult; -/* - Send to the caller. - */ - if (wParam & MCS_QUERYENDSESSION) - { - if (!co_IntSendMessage(pWindow->head.h, WM_QUERYENDSESSION, 0, lParams)) - { - lResult = MCSR_DONOTSHUTDOWN; - } - } - else - { - co_IntSendMessage(pWindow->head.h, WM_ENDSESSION, KillTimers, lParams); - if (KillTimers) - { - DestroyTimersForWindow(pWindow->head.pti, pWindow); - } - lResult = MCSR_SHUTDOWNFINISHED; - } - return lResult; -}
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType) @@ -916,6 +830,7 @@ } } break; + case WM_CLIENTSHUTDOWN: return IntClientShutdown(Wnd, wParam, lParam);
Added: trunk/reactos/win32ss/user/ntuser/shutdown.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/shutdow... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/shutdown.c (added) +++ trunk/reactos/win32ss/user/ntuser/shutdown.c [iso-8859-1] Fri Nov 28 21:48:44 2014 @@ -0,0 +1,96 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Win32k subsystem + * PURPOSE: Shutdown routines + * FILE: subsystems/win32/win32k/ntuser/shutdown.c + * PROGRAMER: Hermes Belusca + */ + +#include <win32k.h> +// DBG_DEFAULT_CHANNEL(UserShutdown); + +// Client Shutdown messages +#define MCS_SHUTDOWNTIMERS 1 +#define MCS_QUERYENDSESSION 2 +// Client Shutdown returns +#define MCSR_GOODFORSHUTDOWN 1 +#define MCSR_SHUTDOWNFINISHED 2 +#define MCSR_DONOTSHUTDOWN 3 + +/* + * Based on CSRSS and described in pages 1115 - 1118 "Windows Internals, Fifth Edition". + * CSRSS sends WM_CLIENTSHUTDOWN messages to top-level windows, and it is our job + * to send WM_QUERYENDSESSION / WM_ENDSESSION messages in response. + */ +LRESULT +IntClientShutdown(IN PWND pWindow, + IN WPARAM wParam, + IN LPARAM lParam) +{ + LPARAM lParams; + BOOL KillTimers; + INT i; + LRESULT lResult = MCSR_GOODFORSHUTDOWN; + HWND *List; + + lParams = wParam & (ENDSESSION_LOGOFF|ENDSESSION_CRITICAL|ENDSESSION_CLOSEAPP); + KillTimers = wParam & MCS_SHUTDOWNTIMERS ? TRUE : FALSE; + + /* First, send end sessions to children */ + List = IntWinListChildren(pWindow); + + if (List) + { + for (i = 0; List[i]; i++) + { + PWND WndChild; + + if (!(WndChild = UserGetWindowObject(List[i]))) + continue; + + if (wParam & MCS_QUERYENDSESSION) + { + if (!co_IntSendMessage(WndChild->head.h, WM_QUERYENDSESSION, 0, lParams)) + { + lResult = MCSR_DONOTSHUTDOWN; + break; + } + } + else + { + co_IntSendMessage(WndChild->head.h, WM_ENDSESSION, KillTimers, lParams); + if (KillTimers) + { + DestroyTimersForWindow(WndChild->head.pti, WndChild); + } + lResult = MCSR_SHUTDOWNFINISHED; + } + } + ExFreePoolWithTag(List, USERTAG_WINDOWLIST); + } + + if (List && (lResult == MCSR_DONOTSHUTDOWN)) + return lResult; + + /* Send to the caller */ + if (wParam & MCS_QUERYENDSESSION) + { + if (!co_IntSendMessage(pWindow->head.h, WM_QUERYENDSESSION, 0, lParams)) + { + lResult = MCSR_DONOTSHUTDOWN; + } + } + else + { + co_IntSendMessage(pWindow->head.h, WM_ENDSESSION, KillTimers, lParams); + if (KillTimers) + { + DestroyTimersForWindow(pWindow->head.pti, pWindow); + } + lResult = MCSR_SHUTDOWNFINISHED; + } + + return lResult; +} + +/* EOF */
Propchange: trunk/reactos/win32ss/user/ntuser/shutdown.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/win32ss/user/ntuser/shutdown.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/shutdow... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/shutdown.h (added) +++ trunk/reactos/win32ss/user/ntuser/shutdown.h [iso-8859-1] Fri Nov 28 21:48:44 2014 @@ -0,0 +1,6 @@ +#pragma once + +LRESULT +IntClientShutdown(IN PWND pWindow, + IN WPARAM wParam, + IN LPARAM lParam);
Propchange: trunk/reactos/win32ss/user/ntuser/shutdown.h ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/win32ss/user/ntuser/win32kdebug.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/win32kd... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/win32kdebug.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/win32kdebug.h [iso-8859-1] Fri Nov 28 21:48:44 2014 @@ -109,6 +109,7 @@ DbgChUserProcess, DbgChUserProp, DbgChUserScrollbar, + DbgChUserShutdown, DbgChUserSysparams, DbgChUserThread, DbgChUserTimer,
Modified: trunk/reactos/win32ss/win32kp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/win32kp.h?rev=65517... ============================================================================== --- trunk/reactos/win32ss/win32kp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/win32kp.h [iso-8859-1] Fri Nov 28 21:48:44 2014 @@ -75,6 +75,7 @@ #include "user/ntuser/win32.h" #include "user/ntuser/object.h" #include "user/ntuser/ntuser.h" +#include "user/ntuser/shutdown.h" #include "user/ntuser/cursoricon.h" #include "user/ntuser/accelerator.h" #include "user/ntuser/hook.h"