Author: hbelusca
Date: Sun Dec 20 02:53:30 2015
New Revision: 70404
URL:
http://svn.reactos.org/svn/reactos?rev=70404&view=rev
Log:
[NTOS:KDBG]: Sync back the code that I copied in FreeLdr (r70403) for COM port selection.
Modified:
trunk/reactos/ntoskrnl/kd/i386/kdbg.c
Modified: trunk/reactos/ntoskrnl/kd/i386/kdbg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kd/i386/kdbg.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/kd/i386/kdbg.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/kd/i386/kdbg.c [iso-8859-1] Sun Dec 20 02:53:30 2015
@@ -28,13 +28,14 @@
#error Unknown architecture
#endif
+#define MAX_COM_PORTS (sizeof(BaseArray) / sizeof(BaseArray[0]) - 1)
+
/* STATIC VARIABLES ***********************************************************/
// static CPPORT DefaultPort = {0, 0, 0};
/* The COM port must only be initialized once! */
// static BOOLEAN PortInitialized = FALSE;
-
/* REACTOS FUNCTIONS **********************************************************/
@@ -58,7 +59,6 @@
/*
* Find the port if needed
*/
- SIZE_T i;
if (!PortInitialized)
{
@@ -72,12 +72,11 @@
* If we reach the first element of the list, the invalid COM port,
* then it means that no valid port was found.
*/
- for (i = sizeof(BaseArray) / sizeof(BaseArray[0]) - 1; i > 0; i--)
+ for (ComPortNumber = MAX_COM_PORTS; ComPortNumber > 0; ComPortNumber--)
{
- if (CpDoesPortExist(UlongToPtr(BaseArray[i])))
+ if (CpDoesPortExist(UlongToPtr(BaseArray[ComPortNumber])))
{
- PortInformation->Address = DefaultPort.Address = BaseArray[i];
- ComPortNumber = (ULONG)i;
+ PortInformation->Address = DefaultPort.Address =
BaseArray[ComPortNumber];
break;
}
}