我正在尝试调用sprintf
以格式化字符串并将结果存储在堆栈变量中。但是,我的尝试失败了,它立即崩溃了。
sub esp, 0x100 ;Allocate 256 bytes on the stack.
push dword[RequestedFile] ;push string2
push dword[Host] ;push string1
push dword[GetHeader] ;push format "String1: %s, String2: %s"
push dword[ebp - 0x04] ;push buffer/stack variable
call [sprintf] ;store string in buffer
add esp, 0x10 ;restore stack
push dword[ebp - 0x04] ;push the stack variable.
push StringFormat ;push the format
call [printf] ;print the new string.
add esp, 0x08 ;restore the stack
add esp, 0x100 ;destroy the stack variable.
任何想法我做错了什么?