just more spicy

Here you can talk about C++ And C# And Other languages programming.

just more spicy

Postby BattleStar-Galactica » Mon Jan 01, 2007 11:44 am


woowow masm32 for fun :lol: , I alway wonder how to code in asm, here is an example to show message box in asm


Code: Select all

.MODEL FLAT, STDCALL

OPTION CASEMAP:NONE

Include \masm32\include\windows.inc
Include \masm32\include\kernel32.inc
Include \masm32\include\user32.inc

IncludeLib \masm32\lib\user32.lib
IncludeLib \masm32\lib\kernel32.lib

.DATA

MsgCaption      DB "First Steps",0
MsgBoxText      DB "This is a bare bones exe application.",0

.CODE

Start:

   Invoke MessageBox, NULL,Offset MsgBoxText, Offset MsgCaption, MB_OK
   Invoke ExitProcess,NULL
   
End Start



nothing fancy, let try another one, a dialogue with a button and an event click on that button


Code: Select all

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

      .486                      ; create 32 bit code
      .model flat, stdcall      ; 32 bit memory model
      option casemap :none      ; case sensitive
 
;     include files
;     ~~~~~~~~~~~~~
      include \masm32\include\windows.inc
      include \masm32\include\masm32.inc
      include \masm32\include\gdi32.inc
      include \masm32\include\user32.inc
      include \masm32\include\kernel32.inc
      include \masm32\include\Comctl32.inc
      include \masm32\include\comdlg32.inc
      include \masm32\include\shell32.inc
      include \masm32\include\oleaut32.inc
      include \masm32\include\msvcrt.inc
      include \masm32\include\dialogs.inc
      include \masm32\macros\macros.asm

;     libraries
;     ~~~~~~~~~
      includelib \masm32\lib\masm32.lib
      includelib \masm32\lib\gdi32.lib
      includelib \masm32\lib\user32.lib
      includelib \masm32\lib\kernel32.lib
      includelib \masm32\lib\Comctl32.lib
      includelib \masm32\lib\comdlg32.lib
      includelib \masm32\lib\shell32.lib
      includelib \masm32\lib\oleaut32.lib
      includelib \masm32\lib\msvcrt.lib


      WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD

    .data?
        hInstance dd ?

    .code

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

start:
 
      mov hInstance, FUNC(GetModuleHandle,NULL)

      call main

      invoke ExitProcess,eax

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

main proc

    Dialog "Bare Bones Dialog", \           ; caption
           "MS Sans Serif",10, \            ; font,pointsize
            WS_OVERLAPPED or \              ; styles for
            WS_SYSMENU or DS_CENTER, \      ; dialog window
            2, \                            ; number of controls
            50,50,150,80, \                 ; x y co-ordinates
            1024                            ; memory buffer size

    DlgButton "Cancel",WS_TABSTOP,48,40,50,15,IDCANCEL
    DlgStatic "Bare Bones Dialog Written In MASM32", \
              SS_CENTER,2,20,140,9,100

    CallModalDialog hInstance,0,WndProc,NULL

    ret

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

WndProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD


    .if uMsg == WM_INITDIALOG
      invoke SendMessage,hWin,WM_SETICON,1,
                         FUNC(LoadIcon,NULL,IDI_ASTERISK)

    .elseif uMsg == WM_COMMAND
      .if wParam == IDCANCEL
        jmp quit_dialog
      .endif

    .elseif uMsg == WM_CLOSE
      quit_dialog:
       invoke EndDialog,hWin,0

    .endif

    xor eax, eax
    ret

WndProc endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start


wowo fun fun fun masm32 can be download freely on google and if you are interested, I will post a link for newbie to asm

btw I dont think you can code in it, it's to complicate for you :lol: :lol: my programming language is alway c++ and c# and I will code in asm just for fun to display something like hello world on my screen :D
Big math problem
2 - 1 = 0 = without you I'm nothing
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide

Postby Ponies » Mon Jan 01, 2007 8:56 pm

Wowz0r's Arnt you getting all big'.

"tear" He's growing up.
Ponies
BANNED
BANNED
 
Posts: 5322
Joined: Sun Apr 30, 2006 8:59 am

Postby Departure » Mon Jan 01, 2007 9:18 pm

Code: Select all
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib kernel32.lib
include \masm32\include\user32.inc
includelib user32.lib

.data
MsgCaption      db "Departure Rocks",0
MsgBoxText      db "Departures Hello World asm Code!",0

.code
start:
   invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
   invoke ExitProcess,NULL
end start


Arn'nt I cool, Yes asm is one language I always wanted to get right into, Unfortunly I only know some basic asm coding as I needed to know with reverse Engineering that i have done in the past (basic cracking)
User avatar
Departure
Global Moderator
Global Moderator
 
Posts: 996
Joined: Thu Mar 17, 2005 11:26 am
Location: Australia

Postby BattleStar-Galactica » Tue Jan 02, 2007 1:38 am

Big math problem
2 - 1 = 0 = without you I'm nothing
User avatar
BattleStar-Galactica
imFiles Master
imFiles Master
 
Posts: 565
Joined: Tue Sep 20, 2005 12:19 am
Location: safest place to hide


Return to C++, C# And Others Programming

Who is online

Users browsing this forum: No registered users and 0 guests