我尝试使用
mov rdx, 4
push rdx
mov rsi, temp_str
push rsi
mov rdi, temp_str1
push rdi
call memmove
和
sub rsp, 24
mov [rsp + 16], rdx
mov [rsp + 8], rsi
mov [rsp], rdi
call memmove
add rsp, 24
和其他种类的魔术,但没有任何效果。该工作是哪个咒语?
(temp_str和temp_str1定义为
temp_str db "abc", 0
temp_str1 db "def", 0
,memmove来自msvcrt)
编辑:
sub rsp, 32
mov rcx, temp_str1
mov rdx, temp_str
mov r8, 4
call memmove
也崩溃。
编辑2:完整代码:
format PE64 console
entry prog
include "win64ax.inc"
section '.idata' import data readable writeable
library kernel32, 'kernel32.dll', msvcrt, 'msvcrt.dll'
import kernel32, ExitProcess,'ExitProcess'
import msvcrt, memmove, 'memmove'
section '.text' code readable executable
prog:
;;mov rdx, 4
;;push rdx
;;mov rsi, temp_str
;;push rsi
;;mov rdi, temp_str1
;;push rdi
;;call memmove
;;sub rsp, 24
;;mov [rsp + 16], rdx
;;mov [rsp + 8], rsi
;;mov [rsp], rdi
;;call memmove
;;add rsp, 24
;;push rbp
;;mov rbp, rsp
;;push rdx
;;push rsi
;;push rdi
;;call memmove
;;mov rsp, rbp
;;pop rbp
sub rsp, 32
mov rcx, temp_str1
mov rdx, temp_str
mov r8, 3
call memmove ; crash
add rsp, 32
end_prog:
invoke ExitProcess, 0
section '.data' data readable writeable
temp_str db "abc", 0
temp_str1 db "def", 0
无论出于什么原因,我的fasm
都无法汇编,但等效的nasm代码可以正常工作:
extern memmove
extern puts
extern exit
section .text
global WinMain
WinMain:
push rbp
mov rbp, rsp
sub rsp, 32
mov rcx, temp_str1
mov rdx, temp_str
mov r8, 4
call memmove
mov rcx, temp_str1
call puts
mov rsp, rbp
pop rbp
jmp exit
section .data
temp_str db "abc", 0
temp_str1 db "def", 0
board.flatassembler.net上的用户革命建议的解决方案:
call memmove
必须是
call [memmove]