News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Problems returning from a proc

Started by Lonewolff, April 15, 2018, 12:55:53 PM

Previous topic - Next topic

Lonewolff

Hi Guys,

I have my main program invoking a custom proc. I can 'ret' from it fine.

But if try to invoke another proc from inside the first proc the application seems to lose its way and crash if I also 'ret' from inside that.


; psuedo code

; a's proc
invoke b
ret

; b's proc
ret


; main program
invoke a
; program doesn't make it back to here


Hopefully this makes sense.

As always, any advice is considered truly awesome  8)



Lonewolff

My bad. It turns out I was using 'call' instead of 'invoke' somewhere along the line.

zedd151

When strange problems like that occur, I usually turn to olly(or other debugger) for help tracking down the bug.

:greensml:

Lonewolff

Good idea, I'll have to get familiar with OllyDebug  :t

zedd151

Then again, looking at your code...  :badgrin:


; psuedo code

; a's proc
invoke b
ret

; b's proc
ret


; main program
invoke a
; program doesn't make it back to here


Assuming linear flow, The code starts by invoking b, then returning to Neverland.    :greensml:

Lonewolff

Yeah, that's why I put 'pseudo code' in there.

I am making my procs as self contained functions. So it doesn't matter where they are getting called from or returning to.

zedd151

It's all good, I know that you apparently know what your doing.

I'm glad that got it all sorted out.   :t

Lonewolff

Hehe, I try.

Much to learn on the ASM from though.  :lol: