-
Notifications
You must be signed in to change notification settings - Fork 3
/
HelloWorld.asm
41 lines (32 loc) · 1.02 KB
/
HelloWorld.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
global _main
extern _GetStdHandle@4
extern _WriteFile@20
section .text
_main:
mov ebp, esp; for correct debugging
mov ecx, (message_end - start)
start:
push ebx
push 0 ; local var written byte count
mov ebx, esp
; hStdOut = GetstdHandle(STD_OUTPUT_HANDLE)
push -11
call _GetStdHandle@4
; WriteFile( hstdOut, message, length(message), &bytes, 0);
push 0 ; unused parameter
push 0 ; &bytes
push message_end - message ; length
call foo
foo:
pop ebx
add ebx, message - foo
push ebx ; message address
push eax ; handle to stdout
call _WriteFile@20
pop ebx ; destroy written
pop ebx ; restore ebx
jmp exit
message: db 'Im a virus, motherfucker!', 10, 'GET HACKED!!!', 10
message_end:
exit:
ret