20130622

lasterror (prg06)

format PE GUI 4.0

include 'win32a.inc'

entry start

errnum dd 0h

start:

invoke GetLastError
invoke FormatMessageA,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,NULL,eax,0,errnum,0,NULL
invoke MessageBoxA,NULL,[errnum],0,MB_OK

invoke ExitProcess,0

data import
   library \
      user32,'USER32.DLL',\
      kernel32,'KERNEL32.DLL'


   import user32,\
      MessageBoxA,'MessageBoxA'


   import kernel32,\
      FormatMessageA,'FormatMessageA',\
      GetLastError,'GetLastError',\
      ExitProcess,'ExitProcess'
end data

No comments: