section .text global _start _start: mov eax,4 mov ebx,1 mov ecx,ms mov edx,len int 80h mov eax,0 mov ebx,1 int 80h section .data ms: db "hello world", 10 len: equ 13
I have no idea, what's wrong here. Oh, and I try to run it using Windows.
section .text global _start _start: mov eax,4 mov ebx,1 mov ecx,ms mov edx,len int 80h mov eax,0 mov ebx,1 int 80h section .data ms: db "hello world", 10 len: equ 13
|
|
|
- MessageBoxA from user32.dll (tell the PE Loader to load the address of the function MessageBoxA (ANSI version of MessageBox; unicode version would be MessageBoxW), which is located inside the user32.dll DLL file, to this location.)
- ExitProcess from kernel32.dll (tell the PE Loader to load the address of the function ExitProcess (doesn't have ANSI or Unicode versions - no need for that), which is inside the kernel32.dll DLL, to this location.)
(Then we can call those functions, loaded above, from our code.)
- the codethe program's code...
push dword 0 push dword the_title push dword the_message push dword 0 call [MessageBoxA] ;; Call the code at the address that is loaded to the symbol 'MessageBoxA' in the symbol import table. push dword 0 call [ExitProcess] ;; Same idea.- the data
the initialized data goes here...
the_title db "This is the message itself.", 0 the_message db "This is the title of the message box.", 0- the bss (initialized to 0; not part of the .exe file, added later by the Windows PE loader)
.....
extern MessageBoxA extern ExitProcess import MessageBoxA user32.dll import ExitProcess kernel32.dll ;; This is the code section now; use 32-bit code: section .text use32 ;; Start the program's execution here: ..start: ...some code... push dword ...whatever the program's exit code should be... call [ExitProcess] section .data msg db "hello world", 0 ...etc... section .bss just_an_array resd 8 some_string resb 512 an_integer resd 1 ...etc...
0 members, 1 guests, 0 anonymous users