Sunday, October 08, 2006

away from data section!

Greetings miserable peopl
*[if you are not miserable you are not welocmed here :) ]

Couple of days ago I figured out a very distinctive way to use stack memory as your own data memory storage ,downsides that it will be a brainfuck to you in building large codes,and another thing each 'push' puts 4 bytes in the stack memory so for large sentences then you need more than one push ! .

;code sample provided by bug-code 2006
;demontrates how you can use stack memory to store some data in

;--------------------------------------------------------------------

.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib


.data
db "sample",0

.code

start:
push 0 ;putting zero ended string for MessageBoxA()
push "teel" ;reverse byte oder so it become leet :)
push 0
mov eax,esp
add eax,4
push eax
push eax
push 0
call MessageBox

invoke ExitProcess,0
end start

;---------------------------------------------------------------

the above example to be assembled by using masm32.

---------------------------------------------------------------
Edited -9 Oct.

Labels:

Smilar pages

0 Comments:

Post a Comment

<< Home