Make winkd somewhat portable.
[reactos.git] / reactos / ntoskrnl / kd64 / kdlock.c
index 179115b..7a3acbf 100644 (file)
@@ -30,6 +30,41 @@ KdpPortUnlock(VOID)
     KiReleaseSpinLock(&KdpDebuggerLock);\r
 }\r
 \r
+BOOLEAN\r
+NTAPI\r
+KdpPollBreakInWithPortLock(VOID)\r
+{\r
+    BOOLEAN DoBreak = FALSE;\r
+\r
+    /* First make sure that KD is enabled */\r
+    if (KdDebuggerEnabled)\r
+    {\r
+        /* Check if a CTRL-C is in the queue */\r
+        if (KdpContext.KdpControlCPending)\r
+        {\r
+            /* Set it and prepare for break */\r
+            DoBreak = TRUE;\r
+            KdpContext.KdpControlCPending = FALSE;\r
+        }\r
+        else\r
+        {\r
+            /* Now get a packet */\r
+            if (!KdReceivePacket(PACKET_TYPE_KD_POLL_BREAKIN,\r
+                                 NULL,\r
+                                 NULL,\r
+                                 NULL,\r
+                                 NULL))\r
+            {\r
+                /* Successful breakin */\r
+                DoBreak = TRUE;\r
+            }\r
+        }\r
+    }\r
+\r
+    /* Tell the caller to do a break */\r
+    return DoBreak;\r
+}\r
+\r
 /* PUBLIC FUNCTIONS **********************************************************/\r
 \r
 /*\r
@@ -40,7 +75,7 @@ NTAPI
 KdPollBreakIn(VOID)\r
 {\r
     BOOLEAN DoBreak = FALSE;\r
-    ULONG Flags;\r
+    ULONG_PTR Flags = 0;\r
 \r
     /* First make sure that KD is enabled */\r
     if (KdDebuggerEnabled)\r
@@ -51,12 +86,12 @@ KdPollBreakIn(VOID)
         _disable();\r
 \r
         /* Check if a CTRL-C is in the queue */\r
-        if (KdpControlCWaiting)\r
+        if (KdpContext.KdpControlCPending)\r
         {\r
             /* Set it and prepare for break */\r
             KdpControlCPressed = TRUE;\r
             DoBreak = TRUE;\r
-            KdpControlCWaiting = FALSE;\r
+            KdpContext.KdpControlCPending = FALSE;\r
         }\r
         else\r
         {\r