mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 10:28:45 +00:00
[WIN32K]: Move IntClientShutdown function to a dedicated file (that will contain other shutdown helper functions in the future). Part 3/X
CORE-8322 svn path=/trunk/; revision=65517
This commit is contained in:
parent
331ed663bf
commit
e10e14dcd4
7 changed files with 107 additions and 86 deletions
|
@ -130,6 +130,7 @@ list(APPEND SOURCE
|
|||
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
|
||||
|
|
|
@ -85,6 +85,7 @@ DBG_CHANNEL DbgChannels[DbgChCount]={
|
|||
{L"UserProcess", DbgChUserProcess},
|
||||
{L"UserProp", DbgChUserProp},
|
||||
{L"UserScrollbar", DbgChUserScrollbar},
|
||||
{L"UserShutdown", DbgChUserShutdown},
|
||||
{L"UserSysparams", DbgChUserSysparams},
|
||||
{L"UserTimer", DbgChUserTimer},
|
||||
{L"UserThread", DbgChUserThread},
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
#include <win32k.h>
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
DBG_DEFAULT_CHANNEL(UserDefwnd);
|
||||
|
@ -32,91 +31,6 @@ DBG_DEFAULT_CHANNEL(UserDefwnd);
|
|||
#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 @@ IntDefWindowProc(
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLIENTSHUTDOWN:
|
||||
return IntClientShutdown(Wnd, wParam, lParam);
|
||||
|
||||
|
|
96
reactos/win32ss/user/ntuser/shutdown.c
Normal file
96
reactos/win32ss/user/ntuser/shutdown.c
Normal file
|
@ -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 */
|
6
reactos/win32ss/user/ntuser/shutdown.h
Normal file
6
reactos/win32ss/user/ntuser/shutdown.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
LRESULT
|
||||
IntClientShutdown(IN PWND pWindow,
|
||||
IN WPARAM wParam,
|
||||
IN LPARAM lParam);
|
|
@ -109,6 +109,7 @@
|
|||
DbgChUserProcess,
|
||||
DbgChUserProp,
|
||||
DbgChUserScrollbar,
|
||||
DbgChUserShutdown,
|
||||
DbgChUserSysparams,
|
||||
DbgChUserThread,
|
||||
DbgChUserTimer,
|
||||
|
|
|
@ -75,6 +75,7 @@ typedef struct _DESKTOP *PDESKTOP;
|
|||
#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"
|
||||
|
|
Loading…
Reference in a new issue