mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 08:30:21 +00:00
[NTOS:KDBG] Use KdbpSendCommandSerial() to send specific ANSI escape sequences.
Use this function instead of KdpDprintf(), otherwise, we send them to **ALL** the display providers, including for example dmesg. Replaying the listing with dmesg would then cause the terminal to misbehave later. For example, it would send the answer of a "Query Device Attributes" command, as the response to a query for terminal size...
This commit is contained in:
parent
29e147beca
commit
430d7ebb93
3 changed files with 22 additions and 12 deletions
|
@ -13,8 +13,17 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KdbpSendCommandSerial(
|
||||||
|
_In_ PCSTR Command)
|
||||||
|
{
|
||||||
|
while (*Command)
|
||||||
|
KdPortPutByteEx(&SerialPortInfo, *Command++);
|
||||||
|
}
|
||||||
|
|
||||||
CHAR
|
CHAR
|
||||||
KdbpTryGetCharSerial(ULONG Retry)
|
KdbpTryGetCharSerial(
|
||||||
|
_In_ ULONG Retry)
|
||||||
{
|
{
|
||||||
CHAR Result = -1;
|
CHAR Result = -1;
|
||||||
|
|
||||||
|
|
|
@ -294,13 +294,18 @@ KdbpSafeWriteMemory(OUT PVOID Dest,
|
||||||
IN PVOID Src,
|
IN PVOID Src,
|
||||||
IN ULONG Bytes);
|
IN ULONG Bytes);
|
||||||
|
|
||||||
#define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard(ScanCode, 0)
|
#define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard((ScanCode), 0)
|
||||||
CHAR
|
CHAR
|
||||||
KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry);
|
KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry);
|
||||||
|
|
||||||
#define KdbpGetCharSerial() KdbpTryGetCharSerial(0)
|
#define KdbpGetCharSerial() KdbpTryGetCharSerial(0)
|
||||||
CHAR
|
CHAR
|
||||||
KdbpTryGetCharSerial(ULONG Retry);
|
KdbpTryGetCharSerial(
|
||||||
|
_In_ ULONG Retry);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KdbpSendCommandSerial(
|
||||||
|
_In_ PCSTR Command);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
KbdDisableMouse(VOID);
|
KbdDisableMouse(VOID);
|
||||||
|
|
|
@ -2919,7 +2919,7 @@ KdbpPagerInternal(
|
||||||
TerminalInitialized = TRUE;
|
TerminalInitialized = TRUE;
|
||||||
|
|
||||||
/* Enable line-wrap */
|
/* Enable line-wrap */
|
||||||
KdpDprintf("\x1b[?7h");
|
KdbpSendCommandSerial("\x1b[?7h");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Query terminal type.
|
* Query terminal type.
|
||||||
|
@ -2928,7 +2928,7 @@ KdbpPagerInternal(
|
||||||
* string. Instead, use the VT52-compatible 'ESC Z' sequence or the
|
* string. Instead, use the VT52-compatible 'ESC Z' sequence or the
|
||||||
* VT100-compatible 'ESC[c' one.
|
* VT100-compatible 'ESC[c' one.
|
||||||
*/
|
*/
|
||||||
KdpDprintf("\x1b[c");
|
KdbpSendCommandSerial("\x1b[c");
|
||||||
KeStallExecutionProcessor(100000);
|
KeStallExecutionProcessor(100000);
|
||||||
|
|
||||||
Length = 0;
|
Length = 0;
|
||||||
|
@ -2967,7 +2967,7 @@ KdbpPagerInternal(
|
||||||
{
|
{
|
||||||
/* Try to query number of rows from terminal. A reply looks like "\x1b[8;24;80t" */
|
/* Try to query number of rows from terminal. A reply looks like "\x1b[8;24;80t" */
|
||||||
TerminalReportsSize = FALSE;
|
TerminalReportsSize = FALSE;
|
||||||
KdpDprintf("\x1b[18t");
|
KdbpSendCommandSerial("\x1b[18t");
|
||||||
KeStallExecutionProcessor(100000);
|
KeStallExecutionProcessor(100000);
|
||||||
|
|
||||||
c = KdbpTryGetCharSerial(5000);
|
c = KdbpTryGetCharSerial(5000);
|
||||||
|
@ -3122,7 +3122,8 @@ KdbpPagerInternal(
|
||||||
p = CountOnePageUp(Buffer, BufLength, pBufEnd);
|
p = CountOnePageUp(Buffer, BufLength, pBufEnd);
|
||||||
i = strcspn(p, "\n");
|
i = strcspn(p, "\n");
|
||||||
}
|
}
|
||||||
else if (ScanCode == KEYSC_PAGEUP || c == 'u')
|
else if (ScanCode == KEYSC_PAGEUP ||
|
||||||
|
ScanCode == KEYSC_ARROWUP || c == 'u')
|
||||||
{
|
{
|
||||||
p = CountOnePageUp(Buffer, BufLength, p);
|
p = CountOnePageUp(Buffer, BufLength, p);
|
||||||
i = strcspn(p, "\n");
|
i = strcspn(p, "\n");
|
||||||
|
@ -3132,11 +3133,6 @@ KdbpPagerInternal(
|
||||||
p = Buffer;
|
p = Buffer;
|
||||||
i = strcspn(p, "\n");
|
i = strcspn(p, "\n");
|
||||||
}
|
}
|
||||||
else if (ScanCode == KEYSC_ARROWUP)
|
|
||||||
{
|
|
||||||
p = CountOnePageUp(Buffer, BufLength, p);
|
|
||||||
i = strcspn(p, "\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KdbNumberOfRowsPrinted = 0;
|
KdbNumberOfRowsPrinted = 0;
|
||||||
|
|
Loading…
Reference in a new issue