Advertisement
Guest User

Untitled

a guest
Oct 16th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     .model flat, stdcall        ; Simplified with Windows conventions, please.
  2.     .radix 16                   ; Hex by default, please.
  3.     option casemap :none        ; Case sensitive identifiers, please.
  4.  
  5.     ; Declarations of Windows API functions:
  6.                 extern  ExitProcess@4       : proc
  7.                 extern  MessageBoxW@16      : proc
  8.  
  9.     ; Declaration of this program's entry point symbol:
  10.                 public  startup
  11.  
  12.     .const
  13.     ; Data:
  14. titleString     dw  0054, 0068, 0065, 0020, 006D, 0061, 0063, 0068, 0069, 006E, 0065
  15.                 dw  0020, 0063, 006F, 0064, 0065, 0020, 0073, 0061, 0079, 0073, 003A
  16.                 dw  0000
  17.  
  18. helloString     dw  0048, 0065, 006C, 006C, 006F, 002C, 0020, 0077, 006F, 0072, 006C
  19.                 dw  0064, 0021, 0009, 0000
  20.  
  21.     .code
  22.     ; Call forwarders, to be able to use the API function addresses directly.
  23. exitProcessJump:
  24.                 db  68                          ; push ...
  25.                 dd  offset ExitProcess@4                ; address of ExitProcess
  26.                 db  0C3                         ; ret
  27. messageBoxJump:
  28.                 db  68                          ; push ...
  29.                 dd  offset MessageBoxW@16               ; address of MessageBox
  30.                 db  0C3                         ; ret
  31.  
  32.     ; Main program:
  33. startup:
  34.                 ; Present a message box:
  35.                 db  68, 40, 00, 01, 00          ; push flags argument 00010040
  36.                 db  68                          ; push ...
  37.                 dd  offset titleString                  ; offset titleString
  38.                 db  68                          ; push ...
  39.                 dd  offset helloString                  ; offset helloString
  40.                 db  6A, 00                      ; push parent window handle, 0 = none.
  41.                 db  0E8                         ; call ...
  42.                 dd  (offset messageBoxJump) - ($ + 4)   ; MessageBox
  43.  
  44.                 ; Exit process:
  45.                 db  6A, 00                      ; push exit code argument, 0 = success.
  46.                 db  0E8                         ; call ...
  47.                 dd  (offset exitProcessJump) - ($ + 4)  ; ExitProcess
  48.  
  49.     ; This end directive has no effect, it's just required to mark the end of the source code.
  50.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement