- Fix KiDispatchException to unmask KI_EXCEPTION_INTERNAL when setting the exception...
[reactos.git] / reactos / lib / rtl / debug.c
index 6bae07a..16d091b 100644 (file)
@@ -40,8 +40,8 @@ DebugPrint(IN PANSI_STRING DebugString,
 
 NTSTATUS
 NTAPI
-DebugPrompt(IN PANSI_STRING Output,
-            IN PANSI_STRING Input)
+DebugPrompt(IN PCSTRING Output,
+            IN PSTRING Input)
 {
     /* Call the INT2D Service */
     return DebugService(BREAKPOINT_PROMPT,
@@ -270,20 +270,20 @@ DbgPrintReturnControlC(PCH Format,
  */
 ULONG
 NTAPI
-DbgPrompt(PCH OutputString,
-          PCH InputString,
-          ULONG InputSize)
+DbgPrompt(IN PCCH Prompt,
+          OUT PCH Response,
+          IN ULONG MaximumResponseLength)
 {
-    ANSI_STRING Output;
-    ANSI_STRING Input;
+    CSTRING Output;
+    STRING Input;
 
     /* Setup the input string */
-    Input.MaximumLength = InputSize;
-    Input.Buffer = InputString;
+    Input.MaximumLength = MaximumResponseLength;
+    Input.Buffer = Response;
 
     /* Setup the output string */
-    Output.Length = strlen (OutputString);
-    Output.Buffer = OutputString;
+    Output.Length = strlen (Prompt);
+    Output.Buffer = Prompt;
 
     /* Call the system service */
     return DebugPrompt(&Output, &Input);
@@ -315,15 +315,58 @@ DbgSetDebugFilterState(IN ULONG ComponentId,
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
 NTSTATUS
 NTAPI
-DbgLoadImageSymbols(IN PUNICODE_STRING Name,
-                    IN ULONG Base,
-                    IN ULONG Unknown3)
+DbgLoadImageSymbols(IN PANSI_STRING Name,
+                    IN PVOID Base,
+                    IN ULONG ProcessId)
+{
+    PIMAGE_NT_HEADERS NtHeader;
+    KD_SYMBOLS_INFO SymbolInfo;
+
+    /* Setup the symbol data */
+    SymbolInfo.BaseOfDll = Base;
+    SymbolInfo.ProcessId = (ULONG)ProcessId;
+
+    /* Get NT Headers */
+    NtHeader = NULL; //RtlImageNtHeader(Base);
+    if (NtHeader)
+    {
+        /* Get the rest of the data */
+        SymbolInfo.CheckSum = NtHeader->OptionalHeader.CheckSum;
+        SymbolInfo.SizeOfImage = NtHeader->OptionalHeader.SizeOfImage;
+    }
+    else
+    {
+        /* No data available */
+        SymbolInfo.CheckSum = SymbolInfo.SizeOfImage = 0;
+    }
+
+    /* Load the symbols */
+    DebugService2(Name, &SymbolInfo, BREAKPOINT_LOAD_SYMBOLS);
+    return STATUS_SUCCESS;
+}
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+DbgUnLoadImageSymbols(IN PANSI_STRING Name,
+                      IN PVOID Base,
+                      IN ULONG_PTR ProcessId)
 {
-    UNIMPLEMENTED;
-    return STATUS_NOT_IMPLEMENTED;
+    KD_SYMBOLS_INFO SymbolInfo;
+
+    /* Setup the symbol data */
+    SymbolInfo.BaseOfDll = Base;
+    SymbolInfo.ProcessId = (ULONG)ProcessId;
+    SymbolInfo.CheckSum = SymbolInfo.SizeOfImage = 0;
+
+    /* Load the symbols */
+    DebugService2(Name, &SymbolInfo, BREAKPOINT_UNLOAD_SYMBOLS);
 }
+
 /* EOF */