Author: ion
Date: Sat Feb 18 22:29:46 2012
New Revision: 55684
URL: http://svn.reactos.org/svn/reactos?rev=55684&view=rev
Log:
[KERNEL32]: Try to connect to the Console Server when initializing console support. For normal apps, won't do anything since ConnectionInfo == NULL (to hack around the fact there's no server in ReactOS for this), but for DLLs running inside of CSRSS, because we now support Server-to-Server, the call will detect that and not fail. This fixes the "failed to give us console" error when kernel32 inside of csrss tries to get a console (which it shouldn't). There's still user32 to cleanup.
Modified:
trunk/reactos/dll/win32/kernel32/client/dllmain.c
Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] Sat Feb 18 22:29:46 2012
@@ -68,7 +68,10 @@
PRTL_USER_PROCESS_PARAMETERS Parameters = NtCurrentPeb()->ProcessParameters;
LPCWSTR ExeName;
STARTUPINFO si;
-
+ WCHAR SessionDir[256];
+ ULONG SessionId = NtCurrentPeb()->SessionId;
+ BOOLEAN InServer;
+
WCHAR lpTest[MAX_PATH];
GetModuleFileNameW(NULL, lpTest, MAX_PATH);
DPRINT("BasepInitConsole for : %S\n", lpTest);
@@ -136,6 +139,38 @@
/* Now use the proper console handle */
Request.Data.AllocConsoleRequest.Console = Parameters->ConsoleHandle;
+
+ /* Setup the right Object Directory path */
+ if (!SessionId)
+ {
+ /* Use the raw path */
+ wcscpy(SessionDir, WIN_OBJ_DIR);
+ }
+ else
+ {
+ /* Use the session path */
+ swprintf(SessionDir,
+ L"%ws\\%ld%ws",
+ SESSION_DIR,
+ SessionId,
+ WIN_OBJ_DIR);
+ }
+
+ /* Connect to the base server */
+ DPRINT("Connecting to CSR...\n");
+ Status = CsrClientConnectToServer(SessionDir,
+ 2,
+ NULL,
+ NULL,
+ &InServer);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to connect to CSR (Status %lx)\n", Status);
+ return FALSE;
+ }
+
+ /* Nothing to do for server-to-server */
+ if (InServer) return TRUE;
/*
* Normally, we should be connecting to the Console CSR Server...
@@ -156,6 +191,7 @@
return TRUE;
}
+ /* Nothing to do if not a console app */
if (NotConsole) return TRUE;
/* We got the handles, let's set them */
Author: sginsberg
Date: Sat Feb 18 13:39:08 2012
New Revision: 55680
URL: http://svn.reactos.org/svn/reactos?rev=55680&view=rev
Log:
[NTOSKRNL]
KdInitSystem may be called after system set up if /CRASHDEBUG is enabled and a bugcheck or NMI occurs. With the INIT discard/delete now implemented, and KdInitSystem marked for INIT, this would have resulted in a crash...during a system crash, if /CRASHDEBUG had been enabled. Fun.
Modified:
trunk/reactos/ntoskrnl/kd/kdinit.c
trunk/reactos/ntoskrnl/kd64/kdinit.c
Modified: trunk/reactos/ntoskrnl/kd/kdinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/kdinit.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/kd/kdinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd/kdinit.c [iso-8859-1] Sat Feb 18 13:39:08 2012
@@ -10,11 +10,6 @@
#include <ntoskrnl.h>
#define NDEBUG
#include <debug.h>
-
-#if defined (ALLOC_PRAGMA)
-#pragma alloc_text(INIT, KdInitSystem)
-#endif
-
/* Make bochs debug output in the very early boot phase available */
//#define AUTO_ENABLE_BOCHS
@@ -172,7 +167,6 @@
}
BOOLEAN
-INIT_FUNCTION
NTAPI
KdInitSystem(ULONG BootPhase,
PLOADER_PARAMETER_BLOCK LoaderBlock)
Modified: trunk/reactos/ntoskrnl/kd64/kdinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd64/kdinit.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/kd64/kdinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd64/kdinit.c [iso-8859-1] Sat Feb 18 13:39:08 2012
@@ -70,7 +70,6 @@
BOOLEAN
NTAPI
-INIT_FUNCTION
KdInitSystem(IN ULONG BootPhase,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{