FASM的天堂之门(无法调用64位代码)

时间:2018-09-29 06:35:38

标签: windows assembly x86 32bit-64bit fasm

我正在尝试在FASM中实现heaven's gate。这意味着我想将64位代码执行到32位程序中。

您可以在下面看到我的代码:

format PE GUI 4.0
entry start

include 'C:\fasm\INCLUDE\win32ax.inc'

section '.rdata' data readable writeable
    test64_other     db "test64_other", 0

section '.idata' import data readable ; writeable
    library kernel32, 'KERNEL32.DLL',\
            user32, 'USER32.DLL'

    import kernel32,    ExitProcess, 'ExitProcess'

    import user32,      MessageBoxW, 'MessageBoxW'

section '.code' code readable executable
start:

     call       $33:bits64
     push       0
     push       eax
     push       eax
     push       0
     call       [MessageBoxW]

     call       $33:bits64_other    

exit:
    invoke      ExitProcess, 0

proc bits64
    use64
        call        @f
        du          'test64',0
@@:                     
        pop         rax 

    use32
        retf
endp

proc bits64_other
    use64
        xor         rcx, rcx
        lea         rdx, [test64_other]
        lea         r8, [test64_other]
        xor         r9, r9
        call        [MessageBoxW]

    use32
        retf
endp

第一个MessageBox(调用[MessageBoxW] )工作良好,但另一个 proc bits64_other 中的消息框不起作用。 当我调用此过程时,代码甚至无法编译!

我可能在某个地方错了。如果您有个很棒的主意,您能帮我解决吗?

0 个答案:

没有答案