Eric Pouech : dbghelp: Improve error handling in SymSetContext().

Alexandre Julliard julliard at winehq.org
Tue Oct 19 16:07:48 CDT 2021


Module: wine
Branch: master
Commit: 8b4d5e6eeff54190cf5601fa401875aef5e9622b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8b4d5e6eeff54190cf5601fa401875aef5e9622b

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Tue Oct 19 15:51:43 2021 +0200

dbghelp: Improve error handling in SymSetContext().

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbghelp/dbghelp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c
index 585fc9cada5..00f02423fef 100644
--- a/dlls/dbghelp/dbghelp.c
+++ b/dlls/dbghelp/dbghelp.c
@@ -609,6 +609,8 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
     struct process* pcs = process_find_by_handle(hProcess);
     if (!pcs) return FALSE;
 
+    if (!module_find_by_addr(pcs, StackFrame->InstructionOffset, DMT_UNKNOWN))
+        return FALSE;
     if (pcs->ctx_frame.ReturnOffset == StackFrame->ReturnOffset &&
         pcs->ctx_frame.FrameOffset  == StackFrame->FrameOffset  &&
         pcs->ctx_frame.StackOffset  == StackFrame->StackOffset)
@@ -618,12 +620,12 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
               pcs->ctx_frame.FrameOffset,
               pcs->ctx_frame.StackOffset);
         pcs->ctx_frame.InstructionOffset = StackFrame->InstructionOffset;
-        SetLastError(ERROR_ACCESS_DENIED); /* latest MSDN says ERROR_SUCCESS */
+        SetLastError(ERROR_SUCCESS);
         return FALSE;
     }
 
     pcs->ctx_frame = *StackFrame;
-    /* MSDN states that Context is not (no longer?) used */
+    /* Context is not (no longer?) used */
     return TRUE;
 }
 




More information about the wine-cvs mailing list