ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2023
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
89 discussions
Start a n
N
ew thread
[reactos] 01/03: [NTOS:KDBG] Introduce local versions of KdpPrintString, KdpDprintf and KdpPromptString...
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f620ce7705225f7ece924…
commit f620ce7705225f7ece92427db09a1659758f3c93 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Wed Mar 29 19:38:10 2023 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Wed Apr 12 19:30:54 2023 +0200 [NTOS:KDBG] Introduce local versions of KdpPrintString, KdpDprintf and KdpPromptString... ... since the original ones are internal to the kernel and won't be available once KDBG is moved out of it. Use these functions in the pager/prompt support. --- ntoskrnl/kd/kdio.c | 7 +- ntoskrnl/kdbg/kdb.h | 33 ++++++++ ntoskrnl/kdbg/kdb_cli.c | 65 ++++++++-------- ntoskrnl/kdbg/kdb_print.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++ ntoskrnl/ntos.cmake | 1 + 5 files changed, 259 insertions(+), 38 deletions(-) diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 3e94c1f0ac6..82a1ade1ed7 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -597,7 +597,7 @@ KdIoPrintf( } -extern STRING KdbPromptString; +extern const CSTRING KdbPromptStr; VOID NTAPI @@ -706,7 +706,6 @@ KdReceivePacket( _Inout_ PKD_CONTEXT Context) { #ifdef KDBG - STRING NewLine = RTL_CONSTANT_STRING("\n"); STRING ResponseString; PDBGKD_DEBUG_IO DebugIo; CHAR MessageBuffer[512]; @@ -768,8 +767,8 @@ KdReceivePacket( /* The prompt string has been printed by KdSendPacket; go to * new line and print the kdb prompt -- for SYSREG2 support. */ - KdpPrintString(&NewLine); - KdpPrintString(&KdbPromptString); // Alternatively, use "Input> " + KdIoPrintString("\n", 1); + KdIoPuts(KdbPromptStr.Buffer); // Alternatively, use "Input> " if (!(KdbDebugState & KD_DEBUG_KDSERIAL)) KbdDisableMouse(); diff --git a/ntoskrnl/kdbg/kdb.h b/ntoskrnl/kdbg/kdb.h index 4e2c04e7e3c..2170be54f9f 100644 --- a/ntoskrnl/kdbg/kdb.h +++ b/ntoskrnl/kdbg/kdb.h @@ -287,3 +287,36 @@ KbdDisableMouse(VOID); VOID KbdEnableMouse(VOID); + + +/* From kdb_print.c */ + +VOID +KdbPrintString( + _In_ const CSTRING* Output); + +USHORT +KdbPromptString( + _In_ const CSTRING* PromptString, + _Inout_ PSTRING ResponseString); + +VOID +KdbPutsN( + _In_ PCCH String, + _In_ USHORT Length); + +VOID +KdbPuts( + _In_ PCSTR String); + +VOID +__cdecl +KdbPrintf( + _In_ PCSTR Format, + ...); + +SIZE_T +KdbPrompt( + _In_ PCSTR Prompt, + _Out_ PCHAR Buffer, + _In_ SIZE_T Size); diff --git a/ntoskrnl/kdbg/kdb_cli.c b/ntoskrnl/kdbg/kdb_cli.c index 4dde1487a08..7ad4cc275ee 100644 --- a/ntoskrnl/kdbg/kdb_cli.c +++ b/ntoskrnl/kdbg/kdb_cli.c @@ -145,7 +145,7 @@ static volatile ULONG KdbDmesgTotalWritten = 0; static volatile BOOLEAN KdbpIsInDmesgMode = FALSE; static KSPIN_LOCK KdpDmesgLogSpinLock; -STRING KdbPromptString = RTL_CONSTANT_STRING("kdb:> "); +const CSTRING KdbPromptStr = RTL_CONSTANT_STRING("kdb:> "); // // Debug Filter Component Table @@ -491,7 +491,7 @@ KdbpCmdEvalExpression( } /* Evaluate the expression */ - Ok = KdbpEvaluateExpression(Argv[1], KdbPromptString.Length + (Argv[1]-Argv[0]), &Result); + Ok = KdbpEvaluateExpression(Argv[1], KdbPromptStr.Length + (Argv[1]-Argv[0]), &Result); if (Ok) { if (Result > 0x00000000ffffffffLL) @@ -849,7 +849,7 @@ KdbpCmdDisassembleX( /* Evaluate the expression */ if (Argc > 1) { - if (!KdbpEvaluateExpression(Argv[1], KdbPromptString.Length + (Argv[1]-Argv[0]), &Result)) + if (!KdbpEvaluateExpression(Argv[1], KdbPromptStr.Length + (Argv[1]-Argv[0]), &Result)) return TRUE; if (Result > (ULONGLONG)(~((ULONG_PTR)0))) @@ -1271,7 +1271,7 @@ KdbpCmdBackTrace( Argv[1]++; /* Evaluate the expression */ - if (!KdbpEvaluateExpression(Argv[1], KdbPromptString.Length + (Argv[1]-Argv[0]), &Result)) + if (!KdbpEvaluateExpression(Argv[1], KdbPromptStr.Length + (Argv[1]-Argv[0]), &Result)) return TRUE; if (Result > (ULONGLONG)(~((ULONG_PTR)0))) @@ -1680,7 +1680,7 @@ KdbpCmdBreakPoint(ULONG Argc, PCHAR Argv[]) /* Evaluate the address expression */ if (!KdbpEvaluateExpression(Argv[AddressArgIndex], - KdbPromptString.Length + (Argv[AddressArgIndex]-Argv[0]), + KdbPromptStr.Length + (Argv[AddressArgIndex]-Argv[0]), &Result)) { return TRUE; @@ -2046,7 +2046,7 @@ KdbpCmdMod( Argv[Argc][strlen(Argv[Argc])] = ' '; /* Evaluate the expression */ - if (!KdbpEvaluateExpression(Argv[1], KdbPromptString.Length + (Argv[1]-Argv[0]), &Result)) + if (!KdbpEvaluateExpression(Argv[1], KdbPromptStr.Length + (Argv[1]-Argv[0]), &Result)) { return TRUE; } @@ -2880,7 +2880,7 @@ KdpFilterEscapes( * \note Doesn't correctly handle \\t and terminal escape sequences when calculating the * number of lines required to print a single line from the Buffer in the terminal. * Maximum length of buffer is limited only by memory size. - * Uses KdpDprintf internally (NOT DbgPrint!). Callers must already hold the debugger lock. + * Uses KdbPrintf internally. * * Note: BufLength should be greater than (KdTermSize.cx * KdTermSize.cy). */ @@ -2925,7 +2925,7 @@ KdbpPagerInternal( { if (p > Buffer + BufLength) { - KdpDprintf("Dmesg: error, p > Buffer+BufLength,d=%d", p - (Buffer + BufLength)); + KdbPrintf("Dmesg: error, p > Buffer+BufLength,d=%d", p - (Buffer + BufLength)); return; } } @@ -2948,39 +2948,33 @@ KdbpPagerInternal( if (p[i] == '\n') RowsPrintedByTerminal++; - //KdpDprintf("!%d!%d!%d!%d!", KdbNumberOfRowsPrinted, KdbNumberOfColsPrinted, i, RowsPrintedByTerminal); + //KdbPrintf("!%d!%d!%d!%d!", KdbNumberOfRowsPrinted, KdbNumberOfColsPrinted, i, RowsPrintedByTerminal); /* Display a prompt if we printed one screen full of text */ if (KdTermSize.cy > 0 && (LONG)(KdbNumberOfRowsPrinted + RowsPrintedByTerminal) >= KdTermSize.cy) { + PCSTR Prompt; + /* Disable the repetition of previous command with long many-page output */ KdbRepeatLastCommand = FALSE; if (KdbNumberOfColsPrinted > 0) - KdpDprintf("\n"); + KdbPuts("\n"); if (DoPage) - { - KdpDprintf("--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---"); - } + Prompt = "--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---"; else - { - KdpDprintf("--- Press q to abort, any other key to continue ---"); - } - RowsPrintedByTerminal++; + Prompt = "--- Press q to abort, any other key to continue ---"; + KdbPuts(Prompt); c = KdpReadTermKey(&ScanCode); - - if (DoPage) - { - //KdpDprintf("\n"); // Concise version: don't show pressed key - KdpDprintf(" '%c'/scan=%04x\n", c, ScanCode); // Shows pressed key - } + if (DoPage) // Show pressed key + KdbPrintf(" '%c'/scan=%04x\n", c, ScanCode); else - { - KdpDprintf("\n"); - } + KdbPuts("\n"); + + RowsPrintedByTerminal++; if (c == 'q') { @@ -3030,7 +3024,7 @@ KdbpPagerInternal( KdpFilterEscapes(p); /* Print the current line */ - KdpDprintf("%s", p); + KdbPuts(p); /* Restore not null char with saved */ if (c != '\0') @@ -3062,7 +3056,7 @@ KdbpPagerInternal( * \note Doesn't correctly handle \\t and terminal escape sequences when calculating the * number of lines required to print a single line from the Buffer in the terminal. * Maximum length of buffer is limited only by memory size. - * Uses KdpDprintf internally (NOT DbgPrint!). Callers must already hold the debugger lock. + * Uses KdbPrintf internally. * * Note: BufLength should be greater than (KdTermSize.cx * KdTermSize.cy). */ @@ -3300,15 +3294,18 @@ KdbpCliMainLoop( /* Reset the number of rows/cols printed */ KdbNumberOfRowsPrinted = KdbNumberOfColsPrinted = 0; - /* Print the prompt */ - KdpDprintf(KdbPromptString.Buffer); - /* - * Read a command. Repeat the last one if the user pressed Enter. + * Print the prompt and read a command. + * Repeat the last one if the user pressed Enter. * This reduces the risk of RSI when single-stepping! */ - CmdLen = KdIoReadLine(Command, sizeof(Command)); - if (CmdLen > 0) // i.e. (*Command != ANSI_NULL) + CmdLen = KdbPrompt(KdbPromptStr.Buffer, Command, sizeof(Command)); + if (CmdLen == 0) + { + /* Nothing received but the user didn't press Enter, retry */ + continue; + } + else if (CmdLen > 1) // i.e. (*Command != ANSI_NULL) { /* Save this new last command */ KdbRepeatLastCommand = TRUE; diff --git a/ntoskrnl/kdbg/kdb_print.c b/ntoskrnl/kdbg/kdb_print.c new file mode 100644 index 00000000000..257b37e1225 --- /dev/null +++ b/ntoskrnl/kdbg/kdb_print.c @@ -0,0 +1,191 @@ +/* + * PROJECT: ReactOS KDBG Kernel Debugger + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: IO interface for KDBG. Provides local KDBG versions + * of KdpPrintString, KdpPromptString and KdpDprintf. + * COPYRIGHT: Copyright 2023 Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> + */ + +/* INCLUDES ******************************************************************/ + +#include <ntoskrnl.h> +#include "kdb.h" + +/* FUNCTIONS *****************************************************************/ + +static VOID +KdbPrintStringWorker( + _In_ const CSTRING* Output, + _In_ ULONG ApiNumber, + _Inout_ PDBGKD_DEBUG_IO DebugIo, + _Inout_ PSTRING Header, + _Inout_ PSTRING Data) +{ + USHORT Length; + C_ASSERT(PACKET_MAX_SIZE >= sizeof(*DebugIo)); + + ASSERT((ApiNumber == DbgKdPrintStringApi) || + (ApiNumber == DbgKdGetStringApi)); + + /* Make sure we don't exceed the KD Packet size */ + Length = min(Output->Length, PACKET_MAX_SIZE - sizeof(*DebugIo)); + + /* Build the packet header */ + DebugIo->ApiNumber = ApiNumber; + DebugIo->ProcessorLevel = 0; // (USHORT)KeProcessorLevel; + DebugIo->Processor = KeGetCurrentPrcb()->Number; + + if (ApiNumber == DbgKdPrintStringApi) + DebugIo->u.PrintString.LengthOfString = Length; + else // if (ApiNumber == DbgKdGetStringApi) + DebugIo->u.GetString.LengthOfPromptString = Length; + + Header->Length = sizeof(*DebugIo); + Header->Buffer = (PCHAR)DebugIo; + + /* Build the data */ + Data->Length = Length; + Data->Buffer = (PCHAR)Output->Buffer; + + /* Send the packet */ + KdSendPacket(PACKET_TYPE_KD_DEBUG_IO, Header, Data, &KdpContext); +} + +VOID +KdbPrintString( + _In_ const CSTRING* Output) +{ + DBGKD_DEBUG_IO DebugIo; + STRING Header, Data; + + KdbPrintStringWorker(Output, DbgKdPrintStringApi, + &DebugIo, &Header, &Data); +} + +static BOOLEAN +KdbPromptStringWorker( + _In_ const CSTRING* PromptString, + _Inout_ PSTRING ResponseString) +{ + DBGKD_DEBUG_IO DebugIo; + STRING Header, Data; + ULONG Length; + KDSTATUS Status; + + /* Print the prompt */ + // DebugIo.u.GetString.LengthOfPromptString = Length; + DebugIo.u.GetString.LengthOfStringRead = ResponseString->MaximumLength; + KdbPrintStringWorker(PromptString, DbgKdGetStringApi, + &DebugIo, &Header, &Data); + + /* Set the maximum lengths for the receive */ + Header.MaximumLength = sizeof(DebugIo); + Data.MaximumLength = ResponseString->MaximumLength; + /* Build the data */ + Data.Buffer = ResponseString->Buffer; + + /* Enter receive loop */ + do + { + /* Get our reply */ + Status = KdReceivePacket(PACKET_TYPE_KD_DEBUG_IO, + &Header, + &Data, + &Length, + &KdpContext); + + /* Return TRUE if we need to resend */ + if (Status == KdPacketNeedsResend) + return TRUE; + + /* Loop until we succeed */ + } while (Status != KdPacketReceived); + + /* Don't copy back a larger response than there is room for */ + Length = min(Length, ResponseString->MaximumLength); + + /* We've got the string back; return the length */ + ResponseString->Length = (USHORT)Length; + + /* Success; we don't need to resend */ + return FALSE; +} + +USHORT +KdbPromptString( + _In_ const CSTRING* PromptString, + _Inout_ PSTRING ResponseString) +{ + /* Enter prompt loop: send the prompt and receive the response */ + ResponseString->Length = 0; + while (KdbPromptStringWorker(PromptString, ResponseString)) + { + /* Loop while we need to resend */ + } + return ResponseString->Length; +} + + +VOID +KdbPutsN( + _In_ PCCH String, + _In_ USHORT Length) +{ + CSTRING Output; + + Output.Buffer = String; + Output.Length = Output.MaximumLength = Length; + KdbPrintString(&Output); +} + +VOID +KdbPuts( + _In_ PCSTR String) +{ + KdbPutsN(String, (USHORT)strnlen(String, MAXUSHORT - sizeof(ANSI_NULL))); +} + +VOID +__cdecl +KdbPrintf( + _In_ PCSTR Format, + ...) +{ + va_list ap; + SIZE_T Length; + CHAR Buffer[1024]; + + /* Format the string */ + va_start(ap, Format); + Length = _vsnprintf(Buffer, + sizeof(Buffer), + Format, + ap); + Length = min(Length, MAXUSHORT - sizeof(ANSI_NULL)); + va_end(ap); + + /* Send it to the debugger directly */ + KdbPutsN(Buffer, (USHORT)Length); +} + +SIZE_T +KdbPrompt( + _In_ PCSTR Prompt, + _Out_ PCHAR Buffer, + _In_ SIZE_T Size) +{ + CSTRING PromptString; + STRING ResponseBuffer; + + PromptString.Buffer = Prompt; + PromptString.Length = PromptString.MaximumLength = + (USHORT)strnlen(Prompt, MAXUSHORT - sizeof(ANSI_NULL)); + + ResponseBuffer.Buffer = Buffer; + ResponseBuffer.Length = 0; + ResponseBuffer.MaximumLength = (USHORT)min(Size, MAXUSHORT); + + return KdbPromptString(&PromptString, &ResponseBuffer); +} + +/* EOF */ diff --git a/ntoskrnl/ntos.cmake b/ntoskrnl/ntos.cmake index 8f3b6c8abbf..60d4436a438 100644 --- a/ntoskrnl/ntos.cmake +++ b/ntoskrnl/ntos.cmake @@ -407,6 +407,7 @@ if(NOT _WINKD_) ${REACTOS_SOURCE_DIR}/ntoskrnl/kdbg/kdb_cli.c ${REACTOS_SOURCE_DIR}/ntoskrnl/kdbg/kdb_cmdhist.c ${REACTOS_SOURCE_DIR}/ntoskrnl/kdbg/kdb_expr.c + ${REACTOS_SOURCE_DIR}/ntoskrnl/kdbg/kdb_print.c ${REACTOS_SOURCE_DIR}/ntoskrnl/kdbg/kdb_symbols.c) endif()
1 year, 8 months
1
0
0
0
[reactos] 02/02: [NTOS:KDBG] Correctly balance KeStackAttachProcess with KeUnstackDetachProcess, instead of KeDetachProcess.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fdf4814ebb38d32634929…
commit fdf4814ebb38d32634929766dd53c06a6873d399 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Thu Apr 6 03:55:20 2023 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Apr 11 00:44:11 2023 +0200 [NTOS:KDBG] Correctly balance KeStackAttachProcess with KeUnstackDetachProcess, instead of KeDetachProcess. --- ntoskrnl/kdbg/kdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntoskrnl/kdbg/kdb.c b/ntoskrnl/kdbg/kdb.c index 3c663cbddbc..c1ed2d0a9d7 100644 --- a/ntoskrnl/kdbg/kdb.c +++ b/ntoskrnl/kdbg/kdb.c @@ -202,7 +202,7 @@ KdbpOverwriteInstruction( /* Detach from process */ if (CurrentProcess != Process) { - KeDetachProcess(); + KeUnstackDetachProcess(&ApcState); } return Status;
1 year, 8 months
1
0
0
0
[reactos] 01/02: [NTOS] Include kdbg/kdb.h only in the files that really need it.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=579eab8a31951b0fef566…
commit 579eab8a31951b0fef56624c62066d38af12dd63 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Tue Apr 4 23:38:32 2023 +0200 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Tue Apr 11 00:44:10 2023 +0200 [NTOS] Include kdbg/kdb.h only in the files that really need it. --- ntoskrnl/cc/view.c | 6 +++++- ntoskrnl/ex/handle.c | 6 +++++- ntoskrnl/include/internal/ntoskrnl.h | 3 --- ntoskrnl/kd/kdio.c | 3 +++ ntoskrnl/kd64/kdapi.c | 9 +++++++-- ntoskrnl/kdbg/i386/i386-dis.c | 2 ++ ntoskrnl/kdbg/kdb.c | 2 ++ ntoskrnl/kdbg/kdb_cli.c | 1 + ntoskrnl/kdbg/kdb_expr.c | 2 ++ ntoskrnl/kdbg/kdb_symbols.c | 1 + ntoskrnl/ke/bug.c | 4 ++++ ntoskrnl/mm/ARM3/expool.c | 4 ++++ ntoskrnl/mm/ARM3/kdbg.c | 4 +++- 13 files changed, 39 insertions(+), 8 deletions(-) diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 97d675c2b04..a40272f8f34 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -1388,6 +1388,9 @@ CcInitView ( } #if DBG && defined(KDBG) + +#include <kdbg/kdb.h> + BOOLEAN ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[]) { @@ -1478,6 +1481,7 @@ ExpKdbgExtDefWrites(ULONG Argc, PCHAR Argv[]) return TRUE; } -#endif + +#endif // DBG && defined(KDBG) /* EOF */ diff --git a/ntoskrnl/ex/handle.c b/ntoskrnl/ex/handle.c index e932ca2efbd..b844635b34f 100644 --- a/ntoskrnl/ex/handle.c +++ b/ntoskrnl/ex/handle.c @@ -1320,6 +1320,9 @@ ExEnumHandleTable(IN PHANDLE_TABLE HandleTable, } #if DBG && defined(KDBG) + +#include <kdbg/kdb.h> + BOOLEAN ExpKdbgExtHandle(ULONG Argc, PCHAR Argv[]) { USHORT i; @@ -1495,4 +1498,5 @@ BOOLEAN ExpKdbgExtHandle(ULONG Argc, PCHAR Argv[]) return TRUE; } -#endif + +#endif // DBG && defined(KDBG) diff --git a/ntoskrnl/include/internal/ntoskrnl.h b/ntoskrnl/include/internal/ntoskrnl.h index a49bfb9b57e..5bb1b90f652 100644 --- a/ntoskrnl/include/internal/ntoskrnl.h +++ b/ntoskrnl/include/internal/ntoskrnl.h @@ -68,9 +68,6 @@ #include "fsrtl.h" #include "lpc.h" #include "rtl.h" -#ifdef KDBG -#include <kdbg/kdb.h> -#endif #include "dbgk.h" #include "spinlock.h" #include "test.h" diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index a196b905113..3e94c1f0ac6 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -13,6 +13,9 @@ #include <reactos/buildno.h> #include "kd.h" #include "kdterminal.h" +#ifdef KDBG +#include "../kdbg/kdb.h" +#endif #define NDEBUG #include <debug.h> diff --git a/ntoskrnl/kd64/kdapi.c b/ntoskrnl/kd64/kdapi.c index e91d76d982e..3295d3b256c 100644 --- a/ntoskrnl/kd64/kdapi.c +++ b/ntoskrnl/kd64/kdapi.c @@ -10,6 +10,11 @@ /* INCLUDES ******************************************************************/ #include <ntoskrnl.h> + +#ifdef KDBG +#include <kdbg/kdb.h> +#endif + #define NDEBUG #include <debug.h> @@ -2209,13 +2214,13 @@ KdSystemDebugControl( KeRosDumpStackFrames((PULONG_PTR)InputBuffer, InputBufferLength); break; } -#if defined(KDBG) +#ifdef KDBG /* Register KDBG CLI callback */ case 'RbdK': { return KdbRegisterCliCallback(InputBuffer, InputBufferLength); } -#endif /* KDBG */ +#endif // KDBG #endif default: break; diff --git a/ntoskrnl/kdbg/i386/i386-dis.c b/ntoskrnl/kdbg/i386/i386-dis.c index c60470aa436..86b2e9dac9a 100644 --- a/ntoskrnl/kdbg/i386/i386-dis.c +++ b/ntoskrnl/kdbg/i386/i386-dis.c @@ -8,6 +8,8 @@ */ #include <ntoskrnl.h> +#include "../kdb.h" + #define NDEBUG #include <debug.h> diff --git a/ntoskrnl/kdbg/kdb.c b/ntoskrnl/kdbg/kdb.c index 8fd5b6675d8..3c663cbddbc 100644 --- a/ntoskrnl/kdbg/kdb.c +++ b/ntoskrnl/kdbg/kdb.c @@ -10,6 +10,8 @@ /* INCLUDES ******************************************************************/ #include <ntoskrnl.h> +#include "kdb.h" + #define NDEBUG #include <debug.h> diff --git a/ntoskrnl/kdbg/kdb_cli.c b/ntoskrnl/kdbg/kdb_cli.c index f889bd850a7..4dde1487a08 100644 --- a/ntoskrnl/kdbg/kdb_cli.c +++ b/ntoskrnl/kdbg/kdb_cli.c @@ -29,6 +29,7 @@ /* INCLUDES ******************************************************************/ #include <ntoskrnl.h> +#include "kdb.h" #include "../kd/kdterminal.h" #define NDEBUG diff --git a/ntoskrnl/kdbg/kdb_expr.c b/ntoskrnl/kdbg/kdb_expr.c index 73bff96cde1..f868d6df376 100644 --- a/ntoskrnl/kdbg/kdb_expr.c +++ b/ntoskrnl/kdbg/kdb_expr.c @@ -34,6 +34,8 @@ /* INCLUDES ******************************************************************/ #include <ntoskrnl.h> +#include "kdb.h" + #define NDEBUG #include <debug.h> diff --git a/ntoskrnl/kdbg/kdb_symbols.c b/ntoskrnl/kdbg/kdb_symbols.c index 69861f23ed8..b8491fefa4b 100644 --- a/ntoskrnl/kdbg/kdb_symbols.c +++ b/ntoskrnl/kdbg/kdb_symbols.c @@ -11,6 +11,7 @@ /* INCLUDES *****************************************************************/ #include <ntoskrnl.h> +#include "kdb.h" #define NDEBUG #include <debug.h> diff --git a/ntoskrnl/ke/bug.c b/ntoskrnl/ke/bug.c index 16862193986..2eea78d0fba 100644 --- a/ntoskrnl/ke/bug.c +++ b/ntoskrnl/ke/bug.c @@ -10,6 +10,10 @@ #include <ntoskrnl.h> +#ifdef KDBG +#include <kdbg/kdb.h> +#endif + #define NDEBUG #include <debug.h> diff --git a/ntoskrnl/mm/ARM3/expool.c b/ntoskrnl/mm/ARM3/expool.c index 74393137162..3e5630bd1ac 100644 --- a/ntoskrnl/mm/ARM3/expool.c +++ b/ntoskrnl/mm/ARM3/expool.c @@ -479,6 +479,10 @@ ExpComputePartialHashForAddress(IN PVOID BaseAddress) #define ExpTagAllowPrint(Tag) \ ((Tag) >= 0x20 /* Space */ && (Tag) <= 0x7E /* Tilde */) +#ifdef KDBG +#include <kdbg/kdb.h> +#endif + #ifdef KDBG #define MiDumperPrint(dbg, fmt, ...) \ if (dbg) KdbpPrint(fmt, ##__VA_ARGS__); \ diff --git a/ntoskrnl/mm/ARM3/kdbg.c b/ntoskrnl/mm/ARM3/kdbg.c index d568c42b45f..141beadc43f 100644 --- a/ntoskrnl/mm/ARM3/kdbg.c +++ b/ntoskrnl/mm/ARM3/kdbg.c @@ -44,6 +44,8 @@ VOID MiDumpPoolConsumers(BOOLEAN CalledFromDbg, ULONG Tag, ULONG Mask, ULONG Fla #if DBG && defined(KDBG) +#include <kdbg/kdb.h> + BOOLEAN ExpKdbgExtPool( ULONG Argc, @@ -620,6 +622,6 @@ ExpKdbgExtIrpFind( return TRUE; } -#endif // DBG && KDBG +#endif // DBG && defined(KDBG) /* EOF */
1 year, 8 months
1
0
0
0
[reactos] 01/01: [COMCTL32][USER32] EDIT: Fix caret position for IME
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8f2c2c1defb56aa4f559c…
commit 8f2c2c1defb56aa4f559c75b5d0e0746db877f5a Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Apr 10 08:27:50 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Mon Apr 10 08:27:50 2023 +0900 [COMCTL32][USER32] EDIT: Fix caret position for IME CORE-11700 --- dll/win32/comctl32/edit.c | 4 ++++ win32ss/user/user32/controls/edit.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dll/win32/comctl32/edit.c b/dll/win32/comctl32/edit.c index b37bf8cffb5..d17c7f20d30 100644 --- a/dll/win32/comctl32/edit.c +++ b/dll/win32/comctl32/edit.c @@ -4392,7 +4392,11 @@ static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es) { if (CompFlag & GCS_COMPSTR) EDIT_GetCompositionStr(hIMC, CompFlag, es); +#ifdef __REACTOS__ + cursor = 0; +#else cursor = ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, 0, 0); +#endif } ImmReleaseContext(hwnd, hIMC); EDIT_SetCaretPos(es, es->selection_start + cursor, es->flags & EF_AFTER_WRAP); diff --git a/win32ss/user/user32/controls/edit.c b/win32ss/user/user32/controls/edit.c index 9a38353eb59..bfe910c8cde 100644 --- a/win32ss/user/user32/controls/edit.c +++ b/win32ss/user/user32/controls/edit.c @@ -4617,7 +4617,11 @@ static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es) { if (CompFlag & GCS_COMPSTR) EDIT_GetCompositionStr(hIMC, CompFlag, es); +#ifdef __REACTOS__ + cursor = 0; +#else cursor = ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, 0, 0); +#endif } ImmReleaseContext(hwnd, hIMC); EDIT_SetCaretPos(es, es->selection_start + cursor, es->flags & EF_AFTER_WRAP);
1 year, 8 months
1
0
0
0
[reactos] 01/01: [NTUSER] IntImmActivateLayout: Set CI_IMMACTIVATE if not pImeWnd (#5231)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ff0ef403e3299541da55…
commit 5ff0ef403e3299541da55da4b6e025bc57883423 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Apr 9 15:19:47 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Apr 9 15:19:47 2023 +0900 [NTUSER] IntImmActivateLayout: Set CI_IMMACTIVATE if not pImeWnd (#5231) In IntImmActivateLayout function, if pImeWnd was NULL and pti->spDefaultImc was non-NULL, then set CI_IMMACTIVATE flag. CORE-11700 --- win32ss/user/ntuser/kbdlayout.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/win32ss/user/ntuser/kbdlayout.c b/win32ss/user/ntuser/kbdlayout.c index 2f9ea599ab7..f3971cf5c67 100644 --- a/win32ss/user/ntuser/kbdlayout.c +++ b/win32ss/user/ntuser/kbdlayout.c @@ -650,6 +650,11 @@ IntImmActivateLayout( co_IntSendMessage(hImeWnd, WM_IME_SYSTEM, IMS_ACTIVATELAYOUT, (LPARAM)pKL->hkl); UserDerefObjectCo(pImeWnd); } + else if (pti->spDefaultImc) + { + /* IME Activation is needed */ + pti->pClientInfo->CI_flags |= CI_IMMACTIVATE; + } UserAssignmentLock((PVOID*)&(pti->KeyboardLayout), pKL); pti->pClientInfo->hKL = pKL->hkl;
1 year, 8 months
1
0
0
0
[reactos] 01/01: [COMCTL32][USER32] EDIT: CompForm and CandForm (#5226)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=66c8ded4548bd1d886431…
commit 66c8ded4548bd1d886431152bc8a7e5cacc411d1 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Apr 9 15:19:19 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Apr 9 15:19:19 2023 +0900 [COMCTL32][USER32] EDIT: CompForm and CandForm (#5226) The changes of this PR are on EDIT controls. - Delete composition_len and composition_start members. - Add EDIT_ImmSetCompositionWindow helper function. - At EDIT_SetCaretPos, set the position of the composition window. - We don't use internal composition string. Rely on the composition window. - Improve WM_IME_STARTCOMPOSITION, WM_IME_COMPOSITION and WM_IME_ENDCOMPOSITION message handling. CORE-11700 --- dll/win32/comctl32/edit.c | 71 +++++++++++++++++++++++++++++++-- win32ss/user/user32/controls/edit.c | 79 ++++++++++++++++++++++++++++++++++--- 2 files changed, 141 insertions(+), 9 deletions(-) diff --git a/dll/win32/comctl32/edit.c b/dll/win32/comctl32/edit.c index 2e7322077fa..b37bf8cffb5 100644 --- a/dll/win32/comctl32/edit.c +++ b/dll/win32/comctl32/edit.c @@ -150,8 +150,10 @@ typedef struct /* * IME Data */ +#ifndef __REACTOS__ /* Rely on the composition window */ UINT composition_len; /* length of composition, 0 == no composition */ int composition_start; /* the character position for the composition */ +#endif /* * Uniscribe Data */ @@ -1711,6 +1713,33 @@ static LRESULT EDIT_EM_Scroll(EDITSTATE *es, INT action) } +#ifdef __REACTOS__ +static void EDIT_ImmSetCompositionWindow(EDITSTATE *es, POINT pt) +{ + COMPOSITIONFORM CompForm; + HIMC hIMC = ImmGetContext(es->hwndSelf); + if (!hIMC) + { + ERR("!hIMC\n"); + return; + } + + CompForm.ptCurrentPos = pt; + if (es->style & ES_MULTILINE) + { + CompForm.dwStyle = CFS_RECT; + CompForm.rcArea = es->format_rect; + } + else + { + CompForm.dwStyle = CFS_POINT; + SetRectEmpty(&CompForm.rcArea); + } + + ImmSetCompositionWindow(hIMC, &CompForm); + ImmReleaseContext(es->hwndSelf, hIMC); +} +#endif /********************************************************************* * * EDIT_SetCaretPos @@ -1720,8 +1749,19 @@ static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap) { LRESULT res = EDIT_EM_PosFromChar(es, pos, after_wrap); +#ifdef __REACTOS__ + HKL hKL = GetKeyboardLayout(0); + POINT pt = { (short)LOWORD(res), (short)HIWORD(res) }; + SetCaretPos(pt.x, pt.y); + + if (!ImmIsIME(hKL)) + return; + + EDIT_ImmSetCompositionWindow(es, pt); +#else TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res)); SetCaretPos((short)LOWORD(res), (short)HIWORD(res)); +#endif } @@ -2076,7 +2116,11 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col BkColor = GetBkColor(dc); TextColor = GetTextColor(dc); if (rev) { +#ifdef __REACTOS__ + if (TRUE) +#else if (es->composition_len == 0) +#endif { SetBkColor(dc, GetSysColor(COLOR_HIGHLIGHT)); SetTextColor(dc, GetSysColor(COLOR_HIGHLIGHTTEXT)); @@ -2101,7 +2145,11 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col ret = size.cx; } if (rev) { +#ifdef __REACTOS__ + if (TRUE) +#else if (es->composition_len == 0) +#endif { SetBkColor(dc, BkColor); SetTextColor(dc, TextColor); @@ -4256,6 +4304,7 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) } } +#ifndef __REACTOS__ /* We don't use internal composition string. Rely on the composition window */ /* check for change in composition start */ if (es->selection_end < es->composition_start) es->composition_start = es->selection_end; @@ -4273,6 +4322,7 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) es->selection_start = es->composition_start; es->selection_end = es->selection_start + es->composition_len; +#endif heap_free(lpCompStrAttr); heap_free(lpCompStr); @@ -4298,6 +4348,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, lpResultStr, buflen); +#ifndef __REACTOS__ /* check for change in composition start */ if (es->selection_end < es->composition_start) es->composition_start = es->selection_end; @@ -4307,6 +4358,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) EDIT_EM_ReplaceSel(es, TRUE, lpResultStr, buflen / sizeof(WCHAR), TRUE, TRUE); es->composition_start = es->selection_end; es->composition_len = 0; +#endif heap_free(lpResultStr); } @@ -4316,11 +4368,16 @@ static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es) HIMC hIMC; int cursor; +#ifdef __REACTOS__ + if (es->selection_start != es->selection_end) + EDIT_EM_ReplaceSel(es, TRUE, NULL, 0, TRUE, TRUE); +#else if (es->composition_len == 0 && es->selection_start != es->selection_end) { EDIT_EM_ReplaceSel(es, TRUE, NULL, 0, TRUE, TRUE); es->composition_start = es->selection_end; } +#endif hIMC = ImmGetContext(hwnd); if (!hIMC) @@ -5015,26 +5072,34 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break; case WM_IME_STARTCOMPOSITION: - es->composition_start = es->selection_end; - es->composition_len = 0; #ifdef __REACTOS__ if (FALSE) /* FIXME: Condition */ return TRUE; - result = DefWindowProcW(hwnd, WM_IME_STARTCOMPOSITION, wParam, lParam); + result = DefWindowProcW(hwnd, msg, wParam, lParam); +#else + es->composition_start = es->selection_end; + es->composition_len = 0; #endif break; case WM_IME_COMPOSITION: EDIT_ImeComposition(hwnd, lParam, es); +#ifdef __REACTOS__ + result = DefWindowProcW(hwnd, msg, wParam, lParam); +#endif break; case WM_IME_ENDCOMPOSITION: +#ifdef __REACTOS__ + result = DefWindowProcW(hwnd, msg, wParam, lParam); +#else if (es->composition_len > 0) { EDIT_EM_ReplaceSel(es, TRUE, NULL, 0, TRUE, TRUE); es->selection_end = es->selection_start; es->composition_len= 0; } +#endif break; case WM_IME_COMPOSITIONFULL: diff --git a/win32ss/user/user32/controls/edit.c b/win32ss/user/user32/controls/edit.c index c9e4faaed53..9a38353eb59 100644 --- a/win32ss/user/user32/controls/edit.c +++ b/win32ss/user/user32/controls/edit.c @@ -47,14 +47,16 @@ #include <usp10.h> #ifdef __REACTOS__ #include <immdev.h> -#define ImmGetContext IMM_FN(ImmGetContext) #define ImmGetCompositionStringW IMM_FN(ImmGetCompositionStringW) -#define ImmReleaseContext IMM_FN(ImmReleaseContext) +#define ImmGetCompositionWindow IMM_FN(ImmGetCompositionWindow) +#define ImmGetContext IMM_FN(ImmGetContext) +#define ImmIsIME IMM_FN(ImmIsIME) #define ImmLockIMC IMM_FN(ImmLockIMC) -#define ImmUnlockIMC IMM_FN(ImmUnlockIMC) #define ImmNotifyIME IMM_FN(ImmNotifyIME) -#define ImmIsIME IMM_FN(ImmIsIME) +#define ImmReleaseContext IMM_FN(ImmReleaseContext) #define ImmSetCompositionFontW IMM_FN(ImmSetCompositionFontW) +#define ImmSetCompositionWindow IMM_FN(ImmSetCompositionWindow) +#define ImmUnlockIMC IMM_FN(ImmUnlockIMC) #endif WINE_DEFAULT_DEBUG_CHANNEL(edit); @@ -154,8 +156,10 @@ typedef struct /* * IME Data */ +#ifndef __REACTOS__ /* Rely on the composition window */ UINT composition_len; /* length of composition, 0 == no composition */ int composition_start; /* the character position for the composition */ +#endif /* * Uniscribe Data */ @@ -1864,6 +1868,33 @@ static LRESULT EDIT_EM_Scroll(EDITSTATE *es, INT action) } +#ifdef __REACTOS__ +static void EDIT_ImmSetCompositionWindow(EDITSTATE *es, POINT pt) +{ + COMPOSITIONFORM CompForm; + HIMC hIMC = ImmGetContext(es->hwndSelf); + if (!hIMC) + { + ERR("!hIMC\n"); + return; + } + + CompForm.ptCurrentPos = pt; + if (es->style & ES_MULTILINE) + { + CompForm.dwStyle = CFS_RECT; + CompForm.rcArea = es->format_rect; + } + else + { + CompForm.dwStyle = CFS_POINT; + SetRectEmpty(&CompForm.rcArea); + } + + ImmSetCompositionWindow(hIMC, &CompForm); + ImmReleaseContext(es->hwndSelf, hIMC); +} +#endif /********************************************************************* * * EDIT_SetCaretPos @@ -1873,8 +1904,19 @@ static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap) { LRESULT res = EDIT_EM_PosFromChar(es, pos, after_wrap); +#ifdef __REACTOS__ + HKL hKL = GetKeyboardLayout(0); + POINT pt = { (short)LOWORD(res), (short)HIWORD(res) }; + SetCaretPos(pt.x, pt.y); + + if (!ImmIsIME(hKL)) + return; + + EDIT_ImmSetCompositionWindow(es, pt); +#else TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res)); SetCaretPos((short)LOWORD(res), (short)HIWORD(res)); +#endif } @@ -2229,7 +2271,11 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col BkColor = GetBkColor(dc); TextColor = GetTextColor(dc); if (rev) { +#ifdef __REACTOS__ + if (TRUE) +#else if (es->composition_len == 0) +#endif { SetBkColor(dc, GetSysColor(COLOR_HIGHLIGHT)); SetTextColor(dc, GetSysColor(COLOR_HIGHLIGHTTEXT)); @@ -2254,7 +2300,11 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col ret = size.cx; } if (rev) { +#ifdef __REACTOS__ + if (TRUE) +#else if (es->composition_len == 0) +#endif { SetBkColor(dc, BkColor); SetTextColor(dc, TextColor); @@ -4478,6 +4528,7 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) } } +#ifndef __REACTOS__ /* We don't use internal composition string. Rely on the composition window */ /* check for change in composition start */ if (es->selection_end < es->composition_start) es->composition_start = es->selection_end; @@ -4495,6 +4546,7 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) es->selection_start = es->composition_start; es->selection_end = es->selection_start + es->composition_len; +#endif HeapFree(GetProcessHeap(),0,lpCompStrAttr); HeapFree(GetProcessHeap(),0,lpCompStr); @@ -4521,6 +4573,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, lpResultStr, buflen); lpResultStr[buflen/sizeof(WCHAR)] = 0; +#ifndef __REACTOS__ /* check for change in composition start */ if (es->selection_end < es->composition_start) es->composition_start = es->selection_end; @@ -4530,6 +4583,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) EDIT_EM_ReplaceSel(es, TRUE, lpResultStr, TRUE, TRUE); es->composition_start = es->selection_end; es->composition_len = 0; +#endif HeapFree(GetProcessHeap(),0,lpResultStr); } @@ -4539,11 +4593,16 @@ static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es) HIMC hIMC; int cursor; +#ifdef __REACTOS__ + if (es->selection_start != es->selection_end) + EDIT_EM_ReplaceSel(es, TRUE, empty_stringW, TRUE, TRUE); +#else if (es->composition_len == 0 && es->selection_start != es->selection_end) { EDIT_EM_ReplaceSel(es, TRUE, empty_stringW, TRUE, TRUE); es->composition_start = es->selection_end; } +#endif hIMC = ImmGetContext(hwnd); if (!hIMC) @@ -5333,26 +5392,34 @@ LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP break; case WM_IME_STARTCOMPOSITION: - es->composition_start = es->selection_end; - es->composition_len = 0; #ifdef __REACTOS__ if (FALSE) /* FIXME: Condition */ return TRUE; result = DefWindowProcT(hwnd, msg, wParam, lParam, unicode); +#else + es->composition_start = es->selection_end; + es->composition_len = 0; #endif break; case WM_IME_COMPOSITION: EDIT_ImeComposition(hwnd, lParam, es); +#ifdef __REACTOS__ + result = DefWindowProcT(hwnd, msg, wParam, lParam, unicode); +#endif break; case WM_IME_ENDCOMPOSITION: +#ifdef __REACTOS__ + result = DefWindowProcT(hwnd, msg, wParam, lParam, unicode); +#else if (es->composition_len > 0) { EDIT_EM_ReplaceSel(es, TRUE, empty_stringW, TRUE, TRUE); es->selection_end = es->selection_start; es->composition_len= 0; } +#endif break; case WM_IME_COMPOSITIONFULL:
1 year, 8 months
1
0
0
0
[reactos] 01/01: [MSPAINT] Fix handle leaks about memory bitmap
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a9284b566482e18962209…
commit a9284b566482e18962209c642b0e22aacaf1d2fa Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Apr 9 11:15:51 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Sun Apr 9 11:17:17 2023 +0900 [MSPAINT] Fix handle leaks about memory bitmap This fixes CORE-18919. CORE-18867 --- base/applications/mspaint/canvas.cpp | 2 +- base/applications/mspaint/palette.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp index 3b260b8a5b3..4ce162aa18a 100644 --- a/base/applications/mspaint/canvas.cpp +++ b/base/applications/mspaint/canvas.cpp @@ -164,7 +164,7 @@ VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint) rcPaint.right - rcPaint.left, rcPaint.bottom - rcPaint.top, hdcMem, rcPaint.left, rcPaint.top, SRCCOPY); - ::SelectObject(hdcMem, hbmOld); + ::DeleteObject(::SelectObject(hdcMem, hbmOld)); ::DeleteDC(hdcMem); } diff --git a/base/applications/mspaint/palette.cpp b/base/applications/mspaint/palette.cpp index 920af27d250..acd5552defc 100644 --- a/base/applications/mspaint/palette.cpp +++ b/base/applications/mspaint/palette.cpp @@ -121,7 +121,7 @@ LRESULT CPaletteWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b /* Transfer bits (hDC <-- hMemDC) */ ::BitBlt(hDC, 0, 0, rcClient.right, rcClient.bottom, hMemDC, 0, 0, SRCCOPY); - ::SelectObject(hMemDC, hbmOld); + ::DeleteObject(::SelectObject(hMemDC, hbmOld)); ::DeleteDC(hMemDC); EndPaint(&ps); return 0;
1 year, 8 months
1
0
0
0
[reactos] 01/01: [ADVAPI32] Do not fail on creating a registry key if the security attributes have an invalid length. (#5230)
by Doug Lyons
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bfc6a119c57c367f8cb6a…
commit bfc6a119c57c367f8cb6a8e782ec2c81901719a0 Author: Doug Lyons <douglyons(a)douglyons.com> AuthorDate: Sat Apr 8 21:04:04 2023 -0500 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Apr 9 04:04:04 2023 +0200 [ADVAPI32] Do not fail on creating a registry key if the security attributes have an invalid length. (#5230) Provide graceful handling of RegCreateKeyExW when lpSecurityAttributes->nLength is zero. This reverts commit cc0716b65 (SVN r24491). JIRA issue: CORE-15471 --- dll/win32/advapi32/reg/reg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/dll/win32/advapi32/reg/reg.c b/dll/win32/advapi32/reg/reg.c index 904ca010eca..58515793c4e 100644 --- a/dll/win32/advapi32/reg/reg.c +++ b/dll/win32/advapi32/reg/reg.c @@ -1108,9 +1108,6 @@ RegCreateKeyExW( TRACE("RegCreateKeyExW() called\n"); - if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES)) - return ERROR_INVALID_USER_BUFFER; - /* get the real parent key */ Status = MapDefaultKey(&ParentKey, hKey);
1 year, 8 months
1
0
0
0
[reactos] 01/01: [MSPAINT] Fix Copy and Paste
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=96c7fe4ccd336c9cb82bb…
commit 96c7fe4ccd336c9cb82bb800451ec3cd5c17c2f2 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Apr 9 09:14:32 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Sun Apr 9 09:14:32 2023 +0900 [MSPAINT] Fix Copy and Paste Call GetSelectionContents in SelectionModel::GetBitmap. CORE-18920, CORE-18867 --- base/applications/mspaint/selectionmodel.cpp | 4 +++- base/applications/mspaint/selectionmodel.h | 2 +- base/applications/mspaint/winproc.cpp | 10 ++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/base/applications/mspaint/selectionmodel.cpp b/base/applications/mspaint/selectionmodel.cpp index 59aaa382ac9..56d74ce877e 100644 --- a/base/applications/mspaint/selectionmodel.cpp +++ b/base/applications/mspaint/selectionmodel.cpp @@ -349,8 +349,10 @@ void SelectionModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int NotifyRefreshNeeded(); } -HBITMAP SelectionModel::GetBitmap() const +HBITMAP SelectionModel::GetBitmap() { + if (m_hbmColor == NULL) + GetSelectionContents(imageModel.GetDC()); return m_hbmColor; } diff --git a/base/applications/mspaint/selectionmodel.h b/base/applications/mspaint/selectionmodel.h index fc1420de7fd..af285e380d8 100644 --- a/base/applications/mspaint/selectionmodel.h +++ b/base/applications/mspaint/selectionmodel.h @@ -34,7 +34,7 @@ public: BOOL TakeOff(); void Landing(); - HBITMAP GetBitmap() const; + HBITMAP GetBitmap(); void GetSelectionContents(HDC hDCImage); void DrawFramePoly(HDC hDCImage); void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg); diff --git a/base/applications/mspaint/winproc.cpp b/base/applications/mspaint/winproc.cpp index 828bf0855ff..857eedd81ae 100644 --- a/base/applications/mspaint/winproc.cpp +++ b/base/applications/mspaint/winproc.cpp @@ -648,10 +648,12 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH canvasWindow.Invalidate(FALSE); break; case IDM_EDITCOPY: - OpenClipboard(); - EmptyClipboard(); - SetClipboardData(CF_BITMAP, CopyDIBImage(selectionModel.GetBitmap())); - CloseClipboard(); + if (OpenClipboard()) + { + EmptyClipboard(); + SetClipboardData(CF_BITMAP, CopyDIBImage(selectionModel.GetBitmap())); + CloseClipboard(); + } break; case IDM_EDITCUT: /* Copy */
1 year, 8 months
1
0
0
0
[reactos] 01/01: [MSPAINT] Fix SelectionModel::InsertFromHBITMAP bug
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=639739a7cd915a3f63976…
commit 639739a7cd915a3f63976a4b2c356b54a5005985 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Apr 9 09:01:14 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Sun Apr 9 09:01:14 2023 +0900 [MSPAINT] Fix SelectionModel::InsertFromHBITMAP bug CORE-18867, CORE-18920 --- base/applications/mspaint/selectionmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/applications/mspaint/selectionmodel.cpp b/base/applications/mspaint/selectionmodel.cpp index 3609632f63b..59aaa382ac9 100644 --- a/base/applications/mspaint/selectionmodel.cpp +++ b/base/applications/mspaint/selectionmodel.cpp @@ -199,8 +199,8 @@ void SelectionModel::Landing() void SelectionModel::InsertFromHBITMAP(HBITMAP hBm, INT x, INT y) { - m_hbmColor = CopyDIBImage(hBm); ::DeleteObject(m_hbmColor); + m_hbmColor = CopyDIBImage(hBm); m_rc.left = x; m_rc.top = y;
1 year, 8 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
Results per page:
10
25
50
100
200