[NTOS:KD]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 14 Nov 2015 08:55:46 +0000 (08:55 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 14 Nov 2015 08:55:46 +0000 (08:55 +0000)
- Actually write back the response to the user buffer in KdpPrompt

svn path=/trunk/; revision=69883

reactos/ntoskrnl/kd64/kdprint.c

index 9fccf74..71a681d 100644 (file)
@@ -212,7 +212,7 @@ USHORT
 NTAPI
 KdpPrompt(IN LPSTR PromptString,
           IN USHORT PromptLength,
-          OUT LPSTR ResponseString,
+          OUT PCHAR ResponseString,
           IN USHORT MaximumResponseLength,
           IN KPROCESSOR_MODE PreviousMode,
           IN PKTRAP_FRAME TrapFrame,
@@ -220,7 +220,8 @@ KdpPrompt(IN LPSTR PromptString,
 {
     STRING PromptBuffer, ResponseBuffer;
     BOOLEAN Enable, Resend;
-    PVOID CapturedPrompt, CapturedResponse;
+    PVOID CapturedPrompt;
+    PCHAR SafeResponseString;
 
     /* Normalize the lengths */
     PromptLength = min(PromptLength,
@@ -250,8 +251,7 @@ KdpPrompt(IN LPSTR PromptString,
             ProbeForWrite(ResponseString,
                           MaximumResponseLength,
                           1);
-            CapturedResponse = _alloca(MaximumResponseLength);
-            ResponseString = CapturedResponse;
+            SafeResponseString = _alloca(MaximumResponseLength);
         }
         _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
         {
@@ -260,11 +260,15 @@ KdpPrompt(IN LPSTR PromptString,
         }
         _SEH2_END;
     }
+    else
+    {
+        SafeResponseString = ResponseString;
+    }
 
     /* Setup the prompt and response  buffers */
     PromptBuffer.Buffer = PromptString;
     PromptBuffer.Length = PromptLength;
-    ResponseBuffer.Buffer = ResponseString;
+    ResponseBuffer.Buffer = SafeResponseString;
     ResponseBuffer.Length = 0;
     ResponseBuffer.MaximumLength = MaximumResponseLength;