mirror of
https://github.com/reactos/reactos.git
synced 2024-07-28 23:29:19 +00:00
[CONSRV]
Fix what I broke in revision r58447, namely at which process the terminal window belongs to. svn path=/branches/ros-csrss/; revision=58557
This commit is contained in:
parent
4bae574ebe
commit
fe98b9ea97
|
@ -106,6 +106,7 @@ typedef struct _TERMINAL_VTBL
|
|||
DWORD ShiftState,
|
||||
UINT VirtualKeyCode,
|
||||
BOOL Down);
|
||||
VOID (WINAPI *RefreshInternalInfo)(struct _CONSOLE* Console);
|
||||
|
||||
/*
|
||||
* External interface (functions corresponding to the Console API)
|
||||
|
@ -132,6 +133,10 @@ typedef struct _TERMINAL_VTBL
|
|||
#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
|
||||
{
|
||||
|
@ -195,25 +200,6 @@ typedef struct _CONSOLE
|
|||
|
||||
} 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
|
||||
#define CONSOLE_SELECTION_IN_PROGRESS 0x1
|
||||
|
|
|
@ -1034,7 +1034,7 @@ CSR_API(SrvGetConsoleWindow)
|
|||
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;
|
||||
|
|
|
@ -65,6 +65,27 @@ typedef struct _GUI_CONSOLE_DATA
|
|||
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;
|
||||
static HICON ghDefaultIconSm = NULL;
|
||||
|
@ -1619,8 +1640,6 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
WindowCount++;
|
||||
SetWindowLongW(hWnd, GWL_USERDATA, WindowCount);
|
||||
|
||||
// SetConsoleWndConsoleLeaderCID(Console);
|
||||
|
||||
DPRINT1("Set icons via PM_CREATE_CONSOLE\n");
|
||||
if (GuiData->hIcon == NULL)
|
||||
{
|
||||
|
@ -2065,6 +2084,15 @@ GuiProcessKeyCallback(PCONSOLE Console, MSG* msg, BYTE KeyStateMenu, DWORD Shift
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -2133,6 +2161,7 @@ static TERMINAL_VTBL GuiVtbl =
|
|||
GuiUpdateScreenInfo,
|
||||
GuiResizeBuffer,
|
||||
GuiProcessKeyCallback,
|
||||
GuiRefreshInternalInfo,
|
||||
GuiChangeTitle,
|
||||
GuiChangeIcon,
|
||||
GuiGetConsoleWindowHandle
|
||||
|
|
|
@ -449,6 +449,9 @@ ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
|||
/* 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 @@ ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData,
|
|||
/* 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 @@ ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData)
|
|||
/* 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);
|
||||
|
|
Loading…
Reference in a new issue