From 35dedc452dbfe224aa084d3afc935fa16f3fbb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 2 Dec 2012 15:30:59 +0000 Subject: [PATCH] [NTOSKRNL] - Skip other spaces preceding a command option instead of increasing the reading pointer of a constant (should fix KDSERIAL). - Use a macro for representing length in chars of constant strings instead of putting magic values. svn path=/trunk/; revision=57787 --- reactos/ntoskrnl/kdbg/kdb.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/reactos/ntoskrnl/kdbg/kdb.c b/reactos/ntoskrnl/kdbg/kdb.c index b13384cd930..75fd5a55575 100644 --- a/reactos/ntoskrnl/kdbg/kdb.c +++ b/reactos/ntoskrnl/kdbg/kdb.c @@ -1705,30 +1705,29 @@ INIT_FUNCTION KdbpGetCommandLineSettings( PCHAR p1) { - PCHAR p2; +#define CONST_STR_LEN(x) (sizeof(x)/sizeof(x[0])) - while (p1 && (p2 = strchr(p1, ' '))) + while (p1 && (p1 = strchr(p1, ' '))) { - p2 += 2; + /* Skip other spaces */ + while (*p1 == ' ') ++p1; - if (!_strnicmp(p2, "KDSERIAL", 8)) + if (!_strnicmp(p1, "KDSERIAL", CONST_STR_LEN("KDSERIAL"))) { - p2 += 8; + p1 += CONST_STR_LEN("KDSERIAL"); KdbDebugState |= KD_DEBUG_KDSERIAL; KdpDebugMode.Serial = TRUE; } - else if (!_strnicmp(p2, "KDNOECHO", 8)) + else if (!_strnicmp(p1, "KDNOECHO", CONST_STR_LEN("KDNOECHO"))) { - p2 += 8; + p1 += CONST_STR_LEN("KDNOECHO"); KdbDebugState |= KD_DEBUG_KDNOECHO; } - else if (!_strnicmp(p2, "FIRSTCHANCE", 11)) + else if (!_strnicmp(p1, "FIRSTCHANCE", CONST_STR_LEN("FIRSTCHANCE"))) { - p2 += 11; + p1 += CONST_STR_LEN("FIRSTCHANCE"); KdbpSetEnterCondition(-1, TRUE, KdbEnterAlways); } - - p1 = p2; } }