Created
November 3, 2019 20:43
-
-
Save jaburns/8d7fce3bb0481bf87293745c00b6f9aa to your computer and use it in GitHub Desktop.
Win32 assembly hello messagebox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _mainCRTStartup | |
extern _ExitProcess@4 | |
extern _MessageBoxA@16 ; Value after @ is size of args on stack | |
section .text | |
_mainCRTStartup: | |
; Setup stack to give us 4 bytes to play with | |
; push ebp | |
; sub esp, 4 | |
; MessageBoxA( NULL, str_message, "", 0 ); | |
push 0 | |
push str_empty | |
push str_message | |
push 0 | |
call _MessageBoxA@16 | |
; ExitProcess( 0 ); | |
push 0 | |
call _ExitProcess@4 | |
section .data | |
str_message db "Hello world", 0 | |
str_empty db 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://yasm.tortall.net/Download.html | |
.\yasm-1.3.0-win64.exe -fwin32 .\hello.asm | |
&"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe" ` | |
/OUT:hello.exe ` | |
# Replace with whatever Windows SDK path | |
/LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x86" ` | |
/MACHINE:X86 ` | |
/SUBSYSTEM:CONSOLE ` | |
kernel32.lib user32.lib ` | |
hello.obj |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment