Author: hbelusca
Date: Wed Mar 20 00:41:47 2013
New Revision: 58557
URL:
http://svn.reactos.org/svn/reactos?rev=58557&view=rev
Log:
[CONSRV]
Fix what I broke in revision r58447, namely at which process the terminal window belongs
to.
Modified:
branches/ros-csrss/win32ss/user/consrv/conio.h
branches/ros-csrss/win32ss/user/consrv/console.c
branches/ros-csrss/win32ss/user/consrv/guiconsole.c
branches/ros-csrss/win32ss/user/consrv/handle.c
Modified: branches/ros-csrss/win32ss/user/consrv/conio.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Wed Mar 20 00:41:47 2013
@@ -106,6 +106,7 @@
DWORD ShiftState,
UINT VirtualKeyCode,
BOOL Down);
+ VOID (WINAPI *RefreshInternalInfo)(struct _CONSOLE* Console);
/*
* External interface (functions corresponding to the Console API)
@@ -132,6 +133,10 @@
#define ConioResizeBuffer(Console, Buff, Size)
(Console)->TermIFace.Vtbl->ResizeBuffer((Console), (Buff), (Size))
#define ConioProcessKeyCallback(Console, Msg, KeyStateMenu, ShiftState, VirtualKeyCode,
Down) \
(Console)->TermIFace.Vtbl->ProcessKeyCallback((Console), (Msg),
(KeyStateMenu), (ShiftState), (VirtualKeyCode), (Down))
+#define ConioGetConsoleWindowHandle(Console) \
+ (Console)->TermIFace.Vtbl->GetConsoleWindowHandle((Console))
+#define ConioRefreshInternalInfo(Console) \
+ (Console)->TermIFace.Vtbl->RefreshInternalInfo((Console))
typedef struct _TERMINAL_IFACE
{
@@ -194,25 +199,6 @@
COLORREF Colors[16]; /* Colour palette */
} CONSOLE, *PCONSOLE;
-
-/**************************************************************\
-\** Define the Console Leader Process for the console window **/
-#define GWLP_CONSOLEWND_ALLOC (2 * sizeof(LONG_PTR))
-#define GWLP_CONSOLE_LEADER_PID 0
-#define GWLP_CONSOLE_LEADER_TID 4
-
-#define SetConsoleWndConsoleLeaderCID(GuiData) \
-do { \
- PCONSOLE_PROCESS_DATA ProcessData; \
- CLIENT_ID ConsoleLeaderCID; \
- ProcessData = CONTAINING_RECORD((GuiData)->Console->ProcessList.Blink, \
- CONSOLE_PROCESS_DATA, \
- ConsoleLink); \
- ConsoleLeaderCID = ProcessData->Process->ClientId; \
- SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_PID,
(LONG_PTR)(ConsoleLeaderCID.UniqueProcess)); \
- SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_TID,
(LONG_PTR)(ConsoleLeaderCID.UniqueThread )); \
-} while(0)
-/**************************************************************/
/* CONSOLE_SELECTION_INFO dwFlags values */
#define CONSOLE_NO_SELECTION 0x0
Modified: branches/ros-csrss/win32ss/user/consrv/console.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] Wed Mar 20 00:41:47
2013
@@ -1034,7 +1034,7 @@
Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
&Console, TRUE);
if (!NT_SUCCESS(Status)) return Status;
- GetWindowRequest->WindowHandle =
Console->TermIFace.Vtbl->GetConsoleWindowHandle(Console);
+ GetWindowRequest->WindowHandle = ConioGetConsoleWindowHandle(Console);
ConSrvReleaseConsole(Console, TRUE);
return STATUS_SUCCESS;
Modified: branches/ros-csrss/win32ss/user/consrv/guiconsole.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/g…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/guiconsole.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/guiconsole.c [iso-8859-1] Wed Mar 20 00:41:47
2013
@@ -64,6 +64,27 @@
PCONSOLE Console; /* Pointer to the owned console */
GUI_CONSOLE_INFO GuiInfo; /* GUI terminal settings */
} GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA;
+
+
+/**************************************************************\
+\** Define the Console Leader Process for the console window **/
+#define GWLP_CONSOLEWND_ALLOC (2 * sizeof(LONG_PTR))
+#define GWLP_CONSOLE_LEADER_PID 0
+#define GWLP_CONSOLE_LEADER_TID 4
+
+#define SetConsoleWndConsoleLeaderCID(GuiData) \
+do { \
+ PCONSOLE_PROCESS_DATA ProcessData; \
+ CLIENT_ID ConsoleLeaderCID; \
+ ProcessData = CONTAINING_RECORD((GuiData)->Console->ProcessList.Blink, \
+ CONSOLE_PROCESS_DATA, \
+ ConsoleLink); \
+ ConsoleLeaderCID = ProcessData->Process->ClientId; \
+ SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_PID,
(LONG_PTR)(ConsoleLeaderCID.UniqueProcess)); \
+ SetWindowLongPtrW((GuiData)->hWindow, GWLP_CONSOLE_LEADER_TID,
(LONG_PTR)(ConsoleLeaderCID.UniqueThread )); \
+} while(0)
+/**************************************************************/
+
static BOOL ConsInitialized = FALSE;
static HICON ghDefaultIcon = NULL;
@@ -1619,8 +1640,6 @@
WindowCount++;
SetWindowLongW(hWnd, GWL_USERDATA, WindowCount);
- // SetConsoleWndConsoleLeaderCID(Console);
-
DPRINT1("Set icons via PM_CREATE_CONSOLE\n");
if (GuiData->hIcon == NULL)
{
@@ -2066,6 +2085,15 @@
}
static VOID WINAPI
+GuiRefreshInternalInfo(PCONSOLE Console)
+{
+ PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data;
+
+ /* Update the console leader information held by the window */
+ SetConsoleWndConsoleLeaderCID(GuiData);
+}
+
+static VOID WINAPI
GuiChangeTitle(PCONSOLE Console)
{
PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data;
@@ -2133,6 +2161,7 @@
GuiUpdateScreenInfo,
GuiResizeBuffer,
GuiProcessKeyCallback,
+ GuiRefreshInternalInfo,
GuiChangeTitle,
GuiChangeIcon,
GuiGetConsoleWindowHandle
Modified: branches/ros-csrss/win32ss/user/consrv/handle.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] Wed Mar 20 00:41:47 2013
@@ -449,6 +449,9 @@
/* Add a reference count because the process is tied to the console */
_InterlockedIncrement(&ProcessData->Console->ReferenceCount);
+ /* Update the internal info of the terminal */
+ ConioRefreshInternalInfo(ProcessData->Console);
+
return STATUS_SUCCESS;
}
@@ -501,6 +504,9 @@
/* Add a reference count because the process is tied to the console */
_InterlockedIncrement(&ProcessData->Console->ReferenceCount);
+ /* Update the internal info of the terminal */
+ ConioRefreshInternalInfo(ProcessData->Console);
+
return STATUS_SUCCESS;
}
@@ -528,8 +534,8 @@
/* Remove ourselves from the console's list of processes */
RemoveEntryList(&ProcessData->ConsoleLink);
- /* Update the console leader process */
- // SetConsoleWndConsoleLeaderCID(Console);
+ /* Update the internal info of the terminal */
+ ConioRefreshInternalInfo(Console);
/* Release the console */
ConSrvReleaseConsole(Console, TRUE);