Author: hbelusca
Date: Sun Nov 23 15:50:49 2014
New Revision: 65463
URL:
http://svn.reactos.org/svn/reactos?rev=65463&view=rev
Log:
[WINSRV]: Pave the way for proper ReactOS shutdown. Part 1/X
CORE-8322
Added:
trunk/reactos/win32ss/user/winsrv/consrv/shutdown.c (with props)
trunk/reactos/win32ss/user/winsrv/winsrv.h (with props)
Modified:
trunk/reactos/win32ss/user/winsrv/consrv.cmake
trunk/reactos/win32ss/user/winsrv/consrv/console.c
trunk/reactos/win32ss/user/winsrv/consrv/consrv.h
trunk/reactos/win32ss/user/winsrv/consrv/init.c
Modified: trunk/reactos/win32ss/user/winsrv/consrv.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv.cmake [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv.cmake [iso-8859-1] Sun Nov 23 15:50:49 2014
@@ -16,6 +16,7 @@
consrv/lineinput.c
consrv/popup.c
consrv/settings.c
+ consrv/shutdown.c
consrv/subsysreg.c
consrv/condrv/coninput.c
consrv/condrv/conoutput.c
Modified: trunk/reactos/win32ss/user/winsrv/consrv/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/console.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/console.c [iso-8859-1] Sun Nov 23 15:50:49
2014
@@ -11,8 +11,6 @@
/* INCLUDES *******************************************************************/
#include "consrv.h"
-
-#include <ndk/psfuncs.h>
/* This is for COM usage */
#define COBJMACROS
Modified: trunk/reactos/win32ss/user/winsrv/consrv/consrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/consrv.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/consrv.h [iso-8859-1] Sun Nov 23 15:50:49
2014
@@ -9,31 +9,21 @@
#ifndef __CONSRV_H__
#define __CONSRV_H__
+/* Main header */
+#include "../winsrv.h"
+
/* PSDK/NDK Headers */
-#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
-#include <windef.h>
-#include <winbase.h>
+
#include <winnls.h>
#include <winreg.h>
#include <wincon.h>
-#include <winuser.h>
+
#define NTOS_MODE_USER
#include <ndk/exfuncs.h>
#include <ndk/mmfuncs.h>
-#include <ndk/obfuncs.h>
-#include <ndk/rtlfuncs.h>
-
-/* Public Win32K Headers */
-#include <ntuser.h>
-
-/* PSEH for SEH Support */
-#include <pseh/pseh2.h>
-
-/* CSRSS Header */
-#include <csr/csrsrv.h>
/* CONSOLE Headers */
#include <win/conmsg.h>
@@ -82,4 +72,11 @@
#include "handle.h"
#include "lineinput.h"
+/* shutdown.c */
+ULONG
+NTAPI
+ConsoleClientShutdown(IN PCSR_PROCESS CsrProcess,
+ IN ULONG Flags,
+ IN BOOLEAN FirstPhase);
+
#endif /* __CONSRV_H__ */
Modified: trunk/reactos/win32ss/user/winsrv/consrv/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/init.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/init.c [iso-8859-1] Sun Nov 23 15:50:49 2014
@@ -548,7 +548,7 @@
LoadedServerDll->DisconnectCallback = ConSrvDisconnect;
LoadedServerDll->NewProcessCallback = ConSrvNewProcess;
// LoadedServerDll->HardErrorCallback = ConSrvHardError;
- LoadedServerDll->ShutdownProcessCallback = NULL;
+ LoadedServerDll->ShutdownProcessCallback = ConsoleClientShutdown;
ConSrvDllInstance = LoadedServerDll->ServerHandle;
Added: trunk/reactos/win32ss/user/winsrv/consrv/shutdown.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/shutdown.c (added)
+++ trunk/reactos/win32ss/user/winsrv/consrv/shutdown.c [iso-8859-1] Sun Nov 23 15:50:49
2014
@@ -0,0 +1,56 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Console Server DLL
+ * FILE: win32ss/user/winsrv/consrv/shutdown.c
+ * PURPOSE: Processes Shutdown
+ * PROGRAMMERS: Alex Ionescu
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include "consrv.h"
+
+#define NDEBUG
+#include <debug.h>
+
+/* FUNCTIONS ******************************************************************/
+
+// NOTE: See
http://blogs.msdn.com/b/ntdebugging/archive/2007/06/09/how-windows-shuts-do…
+ULONG
+NTAPI
+ConsoleClientShutdown(IN PCSR_PROCESS CsrProcess,
+ IN ULONG Flags,
+ IN BOOLEAN FirstPhase)
+{
+ PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess);
+
+ if ( ProcessData->ConsoleHandle != NULL ||
+ ProcessData->HandleTable != NULL )
+ {
+ DPRINT1("ConsoleClientShutdown(0x%p, 0x%x, %s) - Console process [0x%x,
0x%x]\n",
+ CsrProcess, Flags, FirstPhase ? "FirstPhase" :
"LastPhase",
+ CsrProcess->ClientId.UniqueProcess,
CsrProcess->ClientId.UniqueThread);
+
+ /* We are done with the process itself */
+ CsrDereferenceProcess(CsrProcess);
+ return CsrShutdownCsrProcess;
+ }
+ else
+ {
+ DPRINT1("ConsoleClientShutdown(0x%p, 0x%x, %s) - Non-console process [0x%x,
0x%x]\n",
+ CsrProcess, Flags, FirstPhase ? "FirstPhase" :
"LastPhase",
+ CsrProcess->ClientId.UniqueProcess,
CsrProcess->ClientId.UniqueThread);
+
+ /* On first pass, ignore the process since the GUI server should take it... */
+ if (FirstPhase) return CsrShutdownNonCsrProcess;
+
+ /* ... otherwise, call the generic handler */
+ // FIXME: Should call a generic shutdown handler!!
+ CsrDereferenceProcess(CsrProcess);
+ return CsrShutdownCsrProcess;
+ }
+
+ return CsrShutdownNonCsrProcess;
+}
+
+/* EOF */
Propchange: trunk/reactos/win32ss/user/winsrv/consrv/shutdown.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/win32ss/user/winsrv/winsrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/winsrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/winsrv.h (added)
+++ trunk/reactos/win32ss/user/winsrv/winsrv.h [iso-8859-1] Sun Nov 23 15:50:49 2014
@@ -0,0 +1,42 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS User API Server DLL
+ * FILE: win32ss/user/winsrv/winsrv.h
+ * PURPOSE: Main header - Definitions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+#ifndef __WINSRV_H__
+#define __WINSRV_H__
+
+#include <stdarg.h>
+
+/* PSDK/NDK Headers */
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#include <windef.h>
+#include <winbase.h>
+#include <wingdi.h>
+#include <winuser.h>
+/* Undocumented user definitions */
+#include <undocuser.h>
+
+#define NTOS_MODE_USER
+#include <ndk/cmfuncs.h>
+#include <ndk/obfuncs.h>
+#include <ndk/psfuncs.h>
+#include <ndk/rtlfuncs.h>
+
+/* Public Win32K Headers */
+#include <ntuser.h>
+
+/* PSEH for SEH Support */
+#include <pseh/pseh2.h>
+
+/* CSRSS Header */
+#include <csr/csrsrv.h>
+
+#endif /* __WINSRV_H__ */
Propchange: trunk/reactos/win32ss/user/winsrv/winsrv.h
------------------------------------------------------------------------------
svn:eol-style = native