1

I am using MASM to do some assembly programming. When I try to run my program it crashes immediately when it encounters "call myFunction", even after I've stripped out all the code from the procedure. Here is my code any help would be greatly appreciated.

    .486
    .model flat
    .stack 100h

    ExitProcess PROTO NEAR32 stdcall, dExitCode:DWORD

    .code
_start:

    call myFunction

    INVOKE ExitProcess,0
    PUBLIC _start

myFunction  proc  near32


myFunction  endp

END
2
  • Can you provide more complex example of your code? Commented Mar 25, 2011 at 16:12
  • Sorry Eugene but even code this simple crashes on me. Commented Mar 25, 2011 at 16:45

1 Answer 1

6

Change myFunction to

myFunction  proc  near32
     ret
myFunction  endp

to make it a stub. In your version, it has no instructions, so it executes whatever follows it in memory.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.