flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > error macro that able to return it proc name or blabla: name

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 13336
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 18 Jun 2012, 17:04
idk how hard this could be or how easy it might be,

i saw something like below eg.

Code:
.no_zero_return:
  mov eax,NO_ZERO_RETURN
  jmp somewhere
    


then in the somewhere
cinvoke wsprintf,buff,<'the return error is : %i'>,eax
msgbox, or printf buff

i am thinking,
why not a macro that able to return current scope name

eg.
Code:
; global variable
errscope db 0xFF dup(0)

.no_zero_return:
  error here
  jmp somewhere
    

after error here or whatever magic name, errscope would have ".no_zero_return:"

so we skip the double naming job.

then user can choose to output those error using printf or debug.print or etc mechanism.
Post 18 Jun 2012, 17:04
View user's profile Send private message Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode 19 Jun 2012, 09:17
Hi sleepsleep,
i wrote once macros for that at compile time to enable
logging,ondebugging, output to console or file of
symbols,addresses,module names,regs etc.
they store names/functions only if LOG/DEBUG=TRUE
it was very effective, iirc
bad is that i cannot find them at the moment, perhaps
in the develop\macro\mrk_macrow.inc of x32lab

Cheers,

_________________
⠓⠕⠏⠉⠕⠙⠑
Post 19 Jun 2012, 09:17
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20623
Location: In your JS exploiting you and your system
revolution 19 Jun 2012, 10:25
If you don't mind losing the colon you can use a struc:
Code:
struc error somewhere {
    .:                                       ;define the label name
      local   .skip
       call    .skip                   ;put error text address on stack
    db      `.                      ;place the error text
    .skip:
     pop     eax                     ;retrieve the error text address
    jmp     somewhere               ;jump to error handler
}

;some dummy test code
       test    ecx,ecx
     jnz     .no_zero_return
;...

.no_zero_return error err_handler

err_handler:
;   cinvoke wsprintf,buff,<'the return error is : %s'>,eax
;...    
Post 19 Jun 2012, 10:25
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.