flat assembler
Message board for the users of flat assembler.
Index
> Main > Slow program? |
Author |
|
revolution 14 Jun 2018, 20:38
You haven't terminated the GVUN0 string. Maybe printf is busy processing some bad data.
ExitProcess takes one parameter as the exit code, but you don't have any value there so the exit value will be some random value. But the most serious problem is that you didn't restore the stack after calling printf. All of MSVCRT API calls are ccall, so you can use cinvoke. |
|||
14 Jun 2018, 20:38 |
|
Mino 14 Jun 2018, 21:00
Thank you for your answer,
so I changed the code as you advised, but it still has the same effect: Code: format PE entry main section '.idata' data readable import ; idata include 'INCLUDE\win32a.inc' library msvcrt, 'msvcrt.dll', \ kernel32, 'kernel32.dll' import kernel32, ExitProcess, 'ExitProcess' import msvcrt, printf, 'printf' section '.data' data readable writeable ; data GVUN0 db "Hello, world!", 10, 0 section '.code' code executable ; code main: push ebp mov ebp, esp mov DWORD [ebp-4], edi mov DWORD [ebp-16], esi cinvoke printf, GVUN0 mov esp, ebp pop ebp call _StopProgram ret _StopProgram: cinvoke ExitProcess, 0 ret |
|||
14 Jun 2018, 21:00 |
|
revolution 15 Jun 2018, 04:34
Well ExitProcess is not part of MSVCRT, it is stdcall so it should use invoke. But that won't matter here since it never returns.
But anyhow, you can do things like log the time stamp counter before and after each API call and print those value just before exiting to see where the main time usage is happening. Or try using a debugger. |
|||
15 Jun 2018, 04:34 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.