flat assembler
Message board for the users of flat assembler.
Index
> Windows > symbol 'sprintf' out of scope |
Author |
|
l4m2 16 Oct 2015, 23:33
and this one can be successfully compiled but runtime error
Code: ; Simple text editor - fasm example program format PE GUI 4.0 entry start include 'win32a.inc' IDM_NEW = 101 IDM_EXIT = 102 IDM_ABOUT = 901 section '.text' code readable executable start: invoke sprintf, ddd, "%d", 3 invoke MessageBox,HWND_DESKTOP,ddd,"",MB_OK invoke ExitProcess,0 section '.data' data readable writeable ddd db 32 dup 0 section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL',\ mscvrt,'msvcrt.DLL' import kernel,\ ExitProcess,'ExitProcess' import user,\ MessageBox,'MessageBoxA' import mscvrt,sprintf,'sprintf' |
|||
16 Oct 2015, 23:33 |
|
revolution 17 Oct 2015, 00:20
If you want to put string pointers in invoke calls then you need to use win32ax.inc.
And sprintf is a ccall function so you need to use cinvoke. |
|||
17 Oct 2015, 00:20 |
|
l4m2 17 Oct 2015, 02:01
So why does the function 1 complied failed?
cinvoke should be used but here even if you use invoke it runs successfully and just there'd be some rubbish on the stack (but still thank you for your answering about this!) |
|||
17 Oct 2015, 02:01 |
|
revolution 17 Oct 2015, 02:57
There is a difference between a string pointer and a string constant:
Code: push "AB" ;push 0x00004241 <--- string constant org 0x12345678 AB: db "AB",0 push AB ;push 0x12345678 <--- pointer to string |
|||
17 Oct 2015, 02:57 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.