Author: sir_richard
Date: Wed Mar 10 04:35:18 2010
New Revision: 46048
URL: http://svn.reactos.org/svn/reactos?rev=46048&view=rev
Log:
[CSRSS]: Differentiate between first-try and second-try shutdown. In the first try, the console server should defer to the user/win32k server to attempt shutdown for a non-console app. However, if we end up with a second try because this did not happen, then the console server takes matters in its own hands and calls the CTRL-C handler (with some exceptions, such as system/service apps, or apps not belonging to the LUID).
Modified:
trunk/reactos/subsystems/win32/csrss/api/process.c
Modified: trunk/reactos/subsystems/win32/csrss/api/process.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/api…
==============================================================================
--- trunk/reactos/subsystems/win32/csrss/api/process.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/csrss/api/process.c [iso-8859-1] Wed Mar 10 04:35:18 2010
@@ -696,7 +696,7 @@
PLUID CallerLuid = RealContext[0];
PCSRSS_PROCESS_DATA CsrProcess = NULL;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
- BOOLEAN FirstTry = TRUE;
+ BOOLEAN FirstTry;
ULONG Result = 0;
ULONG Hash;
@@ -729,6 +729,7 @@
while (TRUE)
{
/* Find the next process to shutdown */
+ FirstTry = TRUE;
if (!(CsrProcess = FindProcessForShutdown(CallerLuid)))
{
/* Done, quit */
@@ -741,7 +742,7 @@
/* Release the lock, make the callback, and acquire it back */
DPRINT1("Found process: %lx\n", CsrProcess->ProcessId);
CsrReleaseProcessLock();
- Result = (ULONG)EnumProc(CsrProcess, Context);
+ Result = (ULONG)EnumProc(CsrProcess, (PVOID)((ULONG_PTR)Context | FirstTry));
CsrAcquireProcessLock();
/* Check the result */
@@ -754,7 +755,7 @@
else if (Result == CsrShutdownNonCsrProcess)
{
/* A non-CSR process, the callback didn't touch it */
- continue;
+ //continue;
}
else if (Result == CsrShutdownCancelled)
{
Author: sir_richard
Date: Wed Mar 10 04:32:17 2010
New Revision: 46047
URL: http://svn.reactos.org/svn/reactos?rev=46047&view=rev
Log:
[KERNEL32]: As indicated by the comment, kernel32 should always connect to the console server, even for non-console apps (the latter will just basically ignore the request). This is needed to (at minimum) setup the Ctrl-C handler, as otherwise, only "true console" apps will have a handler, even though internally, all apps have such a handler. This is what CSRSS needs to call internally for shutting down non-GUI apps, for example. (The default CTRL-C handler will just call ExitProcess).
Modified:
trunk/reactos/dll/win32/kernel32/misc/console.c
trunk/reactos/dll/win32/kernel32/misc/dllmain.c
Modified: trunk/reactos/dll/win32/kernel32/misc/console.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/co…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] Wed Mar 10 04:32:17 2010
@@ -39,6 +39,7 @@
WINAPI
DefaultConsoleCtrlHandler(DWORD Event)
{
+ DPRINT1("Default handler called: %lx\n", Event);
switch(Event)
{
case CTRL_C_EVENT:
@@ -75,7 +76,8 @@
DWORD nCode = CodeAndFlag & MAXLONG;
UINT i;
EXCEPTION_RECORD erException;
-
+
+ DPRINT1("Console Dispatcher Active: %lx %lx\n", CodeAndFlag, nCode);
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
switch(nCode)
@@ -152,6 +154,7 @@
(CodeAndFlag & MINLONG) &&
((nCode == CTRL_LOGOFF_EVENT) || (nCode == CTRL_SHUTDOWN_EVENT)))
{
+ DPRINT1("Skipping system/service apps\n");
break;
}
@@ -172,7 +175,6 @@
}
RtlLeaveCriticalSection(&ConsoleLock);
-
ExitThread(nExitCode);
}
Modified: trunk/reactos/dll/win32/kernel32/misc/dllmain.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/dl…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/dllmain.c [iso-8859-1] Wed Mar 10 04:32:17 2010
@@ -128,6 +128,7 @@
CSR_API_MESSAGE Request;
ULONG CsrRequest;
NTSTATUS Status;
+ BOOLEAN NotConsole = FALSE;
PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters;
WCHAR lpTest[MAX_PATH];
@@ -143,39 +144,41 @@
{
DPRINT("Image is not a console application\n");
Parameters->ConsoleHandle = NULL;
- return TRUE;
- }
-
- /* Assume one is needed */
- Request.Data.AllocConsoleRequest.ConsoleNeeded = TRUE;
-
- /* Handle the special flags given to us by BasepInitializeEnvironment */
- if (Parameters->ConsoleHandle == HANDLE_DETACHED_PROCESS)
- {
- /* No console to create */
- DPRINT("No console to create\n");
- Parameters->ConsoleHandle = NULL;
Request.Data.AllocConsoleRequest.ConsoleNeeded = FALSE;
}
- else if (Parameters->ConsoleHandle == HANDLE_CREATE_NEW_CONSOLE)
- {
- /* We'll get the real one soon */
- DPRINT("Creating new console\n");
- Parameters->ConsoleHandle = NULL;
- }
- else if (Parameters->ConsoleHandle == HANDLE_CREATE_NO_WINDOW)
- {
- /* We'll get the real one soon */
- DPRINT1("NOT SUPPORTED: HANDLE_CREATE_NO_WINDOW\n");
- Parameters->ConsoleHandle = NULL;
- }
else
{
- if (Parameters->ConsoleHandle == INVALID_HANDLE_VALUE)
- {
- Parameters->ConsoleHandle = 0;
- }
- DPRINT("Using existing console: %x\n", Parameters->ConsoleHandle);
+ /* Assume one is needed */
+ Request.Data.AllocConsoleRequest.ConsoleNeeded = TRUE;
+
+ /* Handle the special flags given to us by BasepInitializeEnvironment */
+ if (Parameters->ConsoleHandle == HANDLE_DETACHED_PROCESS)
+ {
+ /* No console to create */
+ DPRINT("No console to create\n");
+ Parameters->ConsoleHandle = NULL;
+ Request.Data.AllocConsoleRequest.ConsoleNeeded = FALSE;
+ }
+ else if (Parameters->ConsoleHandle == HANDLE_CREATE_NEW_CONSOLE)
+ {
+ /* We'll get the real one soon */
+ DPRINT("Creating new console\n");
+ Parameters->ConsoleHandle = NULL;
+ }
+ else if (Parameters->ConsoleHandle == HANDLE_CREATE_NO_WINDOW)
+ {
+ /* We'll get the real one soon */
+ DPRINT1("NOT SUPPORTED: HANDLE_CREATE_NO_WINDOW\n");
+ Parameters->ConsoleHandle = NULL;
+ }
+ else
+ {
+ if (Parameters->ConsoleHandle == INVALID_HANDLE_VALUE)
+ {
+ Parameters->ConsoleHandle = 0;
+ }
+ DPRINT("Using existing console: %x\n", Parameters->ConsoleHandle);
+ }
}
/* Initialize Console Ctrl Handler */
@@ -185,7 +188,7 @@
NrCtrlHandlers = 1;
CtrlHandlers = InitialHandler;
CtrlHandlers[0] = DefaultConsoleCtrlHandler;
-
+
/* Now use the proper console handle */
Request.Data.AllocConsoleRequest.Console = Parameters->ConsoleHandle;
@@ -194,9 +197,6 @@
* but we don't have one yet, so we will instead simply send a create
* console message to the Base Server. When we finally have a Console
* Server, this code should be changed to send connection data instead.
- *
- * Also note that this connection should be made for any console app, even
- * in the case above where -we- return.
*/
CsrRequest = MAKE_CSR_API(ALLOC_CONSOLE, CSR_CONSOLE);
Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher;
@@ -210,6 +210,8 @@
/* We're lying here, so at least the process can load... */
return TRUE;
}
+
+ if (NotConsole) return TRUE;
/* We got the handles, let's set them */
if ((Parameters->ConsoleHandle = Request.Data.AllocConsoleRequest.Console))
Author: tkreuzer
Date: Wed Mar 10 01:31:06 2010
New Revision: 46045
URL: http://svn.reactos.org/svn/reactos?rev=46045&view=rev
Log:
[ASM]
Don't check for _MSC_VER to decide if the assembly source is going to be compiled with ML or AS, instead check for _USE_ML
Fixes compiling .S files with AS, when using MSVC
Modified:
branches/header-work/include/reactos/asm.h
Modified: branches/header-work/include/reactos/asm.h
URL: http://svn.reactos.org/svn/reactos/branches/header-work/include/reactos/asm…
==============================================================================
--- branches/header-work/include/reactos/asm.h [iso-8859-1] (original)
+++ branches/header-work/include/reactos/asm.h [iso-8859-1] Wed Mar 10 01:31:06 2010
@@ -6,7 +6,7 @@
* PROGRAMMERS: Timo Kreuzer (timo.kreuzer(a)reactos.org)
*/
-#ifdef _MSC_VER
+#ifdef _USE_ML
/* Allow ".name" identifiers */
OPTION DOTNAME