flat assembler
Message board for the users of flat assembler.
Index
> Windows > Smallest fasm hello world |
Author |
|
revolution 07 Mar 2018, 09:18
moveax41h wrote: Out of curiosity, I'd like to construct the smallest possible "hello world" program in fasm. moveax41h wrote: Is there a way to print to the console without having to import that library on a modern Windows system in user-mode? |
|||
07 Mar 2018, 09:18 |
|
DimonSoft 07 Mar 2018, 10:53
moveax41h wrote: I can write a program that's only like 96 bytes in 16-bit mode. Why so large? A typical MS-DOS “Hello, world” program is around 30 bytes. As for your question, what is your purpose? Just making the tiniest possible “Hello, world” has already been done. But it is of little to no use when it comes to extending it to something more useful. |
|||
07 Mar 2018, 10:53 |
|
alexfru 07 Mar 2018, 16:34
moveax41h wrote: right now I've been using import msvcrt, printf, system (for pause>nul), and exit. You can import GetStdHandle, WriteFile, ExitProcess, etc from kernel32.dll instead and use those (that's what msvcrt.dll's routines end up doing). But it won't save size. moveax41h wrote: What about in kernel-mode? Indeed, what about it? Please elaborate. |
|||
07 Mar 2018, 16:34 |
|
moveax41h 08 Mar 2018, 04:27
This was more of a conceptual/education question than a need for an immediate real-world application. It didn't "click" until recently that even in asm you needed to call APIs on Windows. Of course I knew this in C but I was under the impression before (prob from 16-bit) that you could do something different in asm like revolution said. Perhaps a direct syscall as well..
|
|||
08 Mar 2018, 04:27 |
|
revolution 08 Mar 2018, 04:48
"syscall" and "int 0x28" are the same thing in Windows, it's just a different way to access the same kernel functions. But as stated above, the values and functions are not documented so you would have to reverse engineer things to make it work. Not an impossible task, but also not very useful.
|
|||
08 Mar 2018, 04:48 |
|
alexfru 08 Mar 2018, 07:03
The Windows system call interface is undocumented and it changes from one version of Windows to another. Your best bet is importing from system DLLs, which are in many cases just thin wrappers around int/syscall/sysenter. You can hack around this, but your app won't be portable. And it may get additional downvotes from scareware, which modern antiviruses appear to be.
|
|||
08 Mar 2018, 07:03 |
|
moveax41h 08 Mar 2018, 20:48
revolution wrote: "syscall" and "int 0x28" are the same thing in Windows, it's just a different way to access the same kernel functions. But as stated above, the values and functions are not documented so you would have to reverse engineer things to make it work. Not an impossible task, but also not very useful. That's fine, I do RE for a living. Actually, I am just beginning to do "forward" asm but for example, I've had to use WinDbg to RE the system service dispatch table before. I get what you're saying for practical, real-world applications that's a bad idea but I'm a weirdo like that. _________________ -moveax41h |
|||
08 Mar 2018, 20:48 |
|
shoorick 09 Mar 2018, 06:55
_________________ UNICODE forever! |
|||||||||||
09 Mar 2018, 06:55 |
|
Mikl___ 10 Mar 2018, 00:26
Hi, shoo!
Executable size with WinAPI? |
|||
10 Mar 2018, 00:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.