MASM Frame not in module the current stack frame was not found in a loaded module

37 views Asked by At

I'm currently learning MASM x64 and using Visual Studio 2022. To facilitate my learning process, I've attempted to create a simple WriteLine procedure that I can call from the main function to write a new line. (It might be worth mentioning that WriteLine and main are in different files.)

However, when WriteLine attempts to return, I encounter the following error:

"0xC0000005: Access violation executing location 0x0000000000000000."

Additionally, a new window pops up displaying the following message:

"Frame not in module - The current stack frame was not found in a loaded module. Source cannot be shown for this location."

Here is the WriteLine code:

extern GetStdHandle: proc
extern WriteFile: proc

.data

newLine db 13,10
written dq ?

.code

    WriteLine PROC

    mov rcx, -11
    call    GetStdHandle    
    mov rcx, rax           
    mov rdx, offset newLine  
    mov r8, 2            
    mov r9, written        
    call    WriteFile      

    ret 
    
    WriteLine ENDP
    END

And here is some sample code from main:

extern GetStdHandle: proc
extern WriteFile: proc
extern WriteLine: proc

.data
...
.code

main PROC

    ...
    call WriteLine
    ...

    ret

    main ENDP
    END

I've tried cleaning the solution and thought making WriteLine and/or main public would help, but it hasn't worked.

0

There are 0 answers