;
; nasm/nasm -fwin32 hoge.asm
; alink/alink hoge.obj win32.lib -L /alink/lib -m -oPE -entry _start
;
bits 32
extern MessageBoxA
extern ExitProcess
section .text
global _start
_start:
push ebp
mov ebp, esp
mov eax, ds
mov es, eax
mov edi, msg
mov eax, 000000deH
push eax
call bin2hex
mov [edi], ah
inc edi
mov [edi], al
push dword 30H ; MB_ICONEXCLAMATION
push dword title
push dword msg
push dword 0
call MessageBoxA
push dword 0
call ExitProcess
mov eax, 0
mov esp, ebp
pop ebp
ret
b2a:
push ebp
mov ebp, esp
mov eax, [esp + 8]
and al, 0FH
or al, 30H
cmp al, 39H
jle skip
add al, 7
skip:
mov esp, ebp
pop ebp
ret
bin2hex:
push ebp
mov ebp, esp
mov eax, [esp + 8]
mov cl, 4
shr al, cl
push eax
call b2a
xor edx, edx
mov dh, al
mov eax, [esp + 12] ; shifted because first push eax
push eax
call b2a
mov ah, dh
mov esp, ebp
pop ebp
ret
section .data
title: db 'win32api', 0
msg: db '00', 0
Owo7IG5hc20vbmFzbSAtZndpbjMyIGhvZ2UuYXNtCjsgYWxpbmsvYWxpbmsgaG9nZS5vYmogd2luMzIubGliIC1MIC9hbGluay9saWIgLW0gLW9QRSAtZW50cnkgX3N0YXJ0CjsKICBiaXRzIDMyCmV4dGVybiBNZXNzYWdlQm94QQpleHRlcm4gRXhpdFByb2Nlc3MKCnNlY3Rpb24gLnRleHQKZ2xvYmFsIF9zdGFydApfc3RhcnQ6CiAgcHVzaCBlYnAKICBtb3YgZWJwLCBlc3AKCiAgbW92IGVheCwgZHMKICBtb3YgZXMsIGVheAogIG1vdiBlZGksIG1zZwogIG1vdiBlYXgsIDAwMDAwMGRlSAogIHB1c2ggZWF4CiAgY2FsbCBiaW4yaGV4CiAgbW92IFtlZGldLCBhaAogIGluYyBlZGkKICBtb3YgW2VkaV0sIGFsCgogIHB1c2ggZHdvcmQgMzBIIDsgTUJfSUNPTkVYQ0xBTUFUSU9OCiAgcHVzaCBkd29yZCB0aXRsZQ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