Jump to content

TASM32 MessageBoxA

- - - - -

  • Please log in to reply
2 replies to this topic

#1
JMC31337

JMC31337

    Learning Programmer

  • Members
  • PipPipPip
  • 32 posts
Demontration of how to call MessageBoxA.
1 way is through predefined text in the .Data
the other is through command line...
i found the GetCommandLineA from a Phrack exploit code
many thnx to them.... :)
NEW.ASM
.386P   
Locals
jumps 
.Model Flat ,StdCall
include windows.inc
mb_ok     equ 0             
hWnd      equ 0   
lpText    equ offset Text
lpCaption equ offset caption
lpBlnk    equ offset Blnk
extrn     ExitProcess      : PROC
extrn     MessageBoxA      : PROC
extern    GetCommandLineA  :proc
.Data                                        
text     db "Hello_World",13,10,0
caption  db "",0 
Blnk     db "",0
.Code                                  
Main:
        call OPEN_PROGRAM 
        push mb_ok              
        push lpCaption          
        push lpText             
        push hWnd               
        call MessageBoxA        
        call ExitProcess        
 
OPEN_PROGRAM   PROC
      ARG    szP:DWORD
      call   GetCommandLineA 
      mov    szP,eax
      add    szP,4               ;add bytes to remove the new from msgbox
      PUSH   MB_OK
      push   lpBlnk
      PUSH   szP
      push   hWnd
      CALL   MessageBoxA
      ret
OPEN_PROGRAM   ENDP
End Main
compile with
tasm32 /mx /m3 /z /q new
tlink32 -x /Tpe /aa /c new,new,, import32.lib
if you want a dll then change /Tpe to /Tpd and also change
add szP,4 -> add szP,16
rename the file change the add szP according to filename_length

use rundll32 new.dll MESSAGE! for DLL example
"Your Life Is Your Crime, It's Punishment Time"

#2
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,705 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
This should be in the Tutorials forum; there's a subsection there for ASM tutorials. Good intro, though. :)
sudo rm -rf /

#3
Guest_vansci123_*

Guest_vansci123_*
  • Guests
there's a subsection there for ASM tutorials. Good intro, though.

Read more: TASM TASM32 MessageBoxA




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users