Thanks, Bryant! I'm not able (okay, I'm not willing) to test this, but I'm getting warnings from Alink (with the help of a poster on this forum, I've got Alink running in Linux).
I believe that the problem is that "-f obj" is, by default, a 16-bit format. The "[BITS 32]" may help to override this, but I'm not sure it's enough. I believe that the section declarations also(?) need to be specified as "use32". Further, it seems to help if the code section is marked "class=CODE" (Agner's "objconv" thinks it's "noexecute" without it and doesn't disassemble it, and as I recall Ollydbg likes it better with it). It may help to specify an "align=" as well - default alignment seems to be "align=1" (Although it comes out on an even alignment anyway)
; Build with:
; nasm -f obj nwin32.asm
; alink -c -oPE -subsys gui nwin32
[BITS 32]
[CPU 486]
EXTERN ExitProcess
EXTERN MessageBoxA
IMPORT ExitProcess kernel32.dll
IMPORT MessageBoxA user32.dll
[SECTION .data use32] ; aint got no class? :)
strCaption: db "Hi!", 0
strMessage: db "Win32 NASM Application", 0
[SECTION .text use32 class=CODE]
..start:
push dword 0 ; uType
push dword strCaption ; lpCaption
push dword strMessage ; lpText
push dword 0 ; hWnd
call [MessageBoxA]
push dword 0 ; uExitCode
call [ExitProcess]
That's based on my shakey memory, and on examination of the code. It would be really nice if someone who is actually running the bloody virus, Windows, would test the thing - both ways - and report back...
Best,
Frank