59b099759fc03af2a0c3b6a823af05b8eadb3380
[reactos.git] / reactos / win32ss / user / winsrv / consrv / shutdown.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: consrv/shutdown.c
5 * PURPOSE: Processes Shutdown
6 * PROGRAMMERS: Alex Ionescu
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #include "consrv.h"
12
13 #define NDEBUG
14 #include <debug.h>
15
16 /* FUNCTIONS ******************************************************************/
17
18 // NOTE: See http://blogs.msdn.com/b/ntdebugging/archive/2007/06/09/how-windows-shuts-down.aspx
19 ULONG
20 NTAPI
21 ConsoleClientShutdown(IN PCSR_PROCESS CsrProcess,
22 IN ULONG Flags,
23 IN BOOLEAN FirstPhase)
24 {
25 PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(CsrProcess);
26
27 UNIMPLEMENTED;
28
29 if ( ProcessData->ConsoleHandle != NULL ||
30 ProcessData->HandleTable != NULL )
31 {
32 DPRINT1("ConsoleClientShutdown(0x%p, 0x%x, %s) - Console process [0x%x, 0x%x]\n",
33 CsrProcess, Flags, FirstPhase ? "FirstPhase" : "LastPhase",
34 CsrProcess->ClientId.UniqueProcess, CsrProcess->ClientId.UniqueThread);
35
36 /* We are done with the process itself */
37 CsrDereferenceProcess(CsrProcess);
38 return CsrShutdownCsrProcess;
39 }
40 else
41 {
42 DPRINT1("ConsoleClientShutdown(0x%p, 0x%x, %s) - Non-console process [0x%x, 0x%x]\n",
43 CsrProcess, Flags, FirstPhase ? "FirstPhase" : "LastPhase",
44 CsrProcess->ClientId.UniqueProcess, CsrProcess->ClientId.UniqueThread);
45
46 /* On first pass, ignore the process since the GUI server should take it... */
47 if (FirstPhase) return CsrShutdownNonCsrProcess;
48
49 /* ... otherwise, call the generic handler */
50 // FIXME: Should call a generic shutdown handler!!
51 CsrDereferenceProcess(CsrProcess);
52 return CsrShutdownCsrProcess;
53 }
54
55 return CsrShutdownNonCsrProcess;
56 }
57
58 /* EOF */