News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

How do you trap a access denied error memory in Windows? help

Started by jj2007, October 17, 2017, 07:41:45 AM

Previous topic - Next topic

jj2007

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init tc
  Let esi="40000h"
  .While 1
    @@:         Let esi=Input$("address: ", esi)
        .Break .if !Len(esi)
        mov ecx, Val(esi)
        Print Str$("Dword at %i = ", ecx)
        Try
                mov eax, [ecx]
        Catch
                PrintLine "The OS reports:", CrLf$, LastEx(info)
                jmp @B
        Finally
                PrintLine Str$(eax)
  .Endw
EndOfCode

felipe


aw27

Quote from: smid1584 on October 17, 2017, 05:41:23 AM
I have a program that allows the user to ask for the value at any address, valid or invalid. So sometimes it can try to retrieve the value at an address the program does not have access to. An error is thrown ... how do I catch and handle such errors?
There is a post here. Currently, you will not be able to find much better in ASM, because I did a full research. However, the solution is clunky and basically wrong, but will work for easy cases like yours (probably). I am working on another approach, but will take some time because the subject is not easy.