THE RESURRECTION OF ASSEMBLY PROGRAMMING - 0
-
-----=========-----
-------==========================================----------
--------=====_masta_'s Tutorial on Win95 ASM Coding Part 0=====---------
-------==========================================----------
--==INTRO==--
Hi, after unsuccessfully searching the for an assembly tutorial on
Win95 I decided to contribute a little one of my own and I hope this
is just one of many to come.
--==WHAT IS NEEDED?==--
1. Brain ;)
2. A(n Intel compatible) Computer with Win95
3. TASM 5.0 (with Tlink, libfiles, etc ...)
4. An API-Reference (Win32.HLP)
---> most of it can be found on
lõRD ÇÅLïGø'$ fâÑtÃ$tï© wøRLÐ øF ¢RAcKïñG
[>Cracking.home.ml.org NEVER!!!: "messageboxa"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--==WHAT WILL WE LEARN IN THIS TUT?==--
Simple!: The popular "Hello World" - Demo :-).
--==HELLO WORLD !!==--
These are two words, that every coder has already seen ...
So first we should think about, how we want to show it on the
screen. So what I do, is just use a MessageBox and since we
work in Win95 and we want to use FULL 32bit Power, the command
will be "MessageBoxA".
So we switch over to our Api-Reference (Win32.hlp) and search
for "MessageBoxA". This is what we should find:
---------------------------------------------------------------------
int MessageBox(
HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
);
---------------------------------------------------------------------
- Since we don't ahve a window, that calles our MessageBox we set
"hWnd" to zero.
- "lpText" will be the offset of our text (where it is stored)
- "lpCaption" ---> offset of the Caption
- "uType" we set to "0" also, which corresponds to a "normal"
MessageBox with a nice OK-button (Type mb_ok)
So now let's get started and see the source in ASM ...
;-------------------------------START--------------------------tut.asm
; set some options for the assembler
.386P
Locals
jumps
.Model Flat ,StdCall
mb_ok equ 0 ;mb_ok gets the value "0"
hWnd equ 0
lpText equ offset text ;set a pointer to the text
lpCaption equ offset caption ;set a pointer to the caption
; declaration of all used API-functions
extrn ExitProcess : PROC ;procedure to shut down a process
extrn MessageBoxA : PROC ;procedure to show a MessageBox
; here begins our Data
.Data
text db "Hello World",13,10 ; first row of the text(with word-wrap)
db "_masta_ greets everybody who reads this tut",0
; second row, terminated with "0"
caption db "Hello",0 ;Captionstring, 0-terminated
; and here we start with our code
.Code
Main:
; lets greet the world :))
push mb_ok ;PUSH value for uType
push lpCaption ;PUSH Pointer to Caption
push lpText ;PUSH Pointer to Text
push hWnd ;PUSH Masterhandle
call MessageBoxA ;CALL MessageBoxA
CALL ExitProcess ;End (exit) program
End Main ;End of code, Main is the entrypoint
;-----------------------------------END------------------------tut.asm
You can compile this source with the following "MAKE.BAT"
------------------------cut here--------------
tasm32 /mx /m3 /z /q tut
tlink32 -x /Tpe /ap /c tut,tut,, import32.lib
------------------------cut here--------------
and the "import32.lib".
Well as you see, it is not much, but I hope it it can be a good start to
Windows-coding in ASM for you.
--==FINAL WORDS==--
This is my first, but surely not my last Tutorial on Assembly-coding for
windows ...
Ok, hope to CyA all at the next one ....
--==GREETINX==--
VucoeT (Translator [ :) ]), |Caligo| (kewl Page), fravia+ (best on the web),
stone (for the inspiration), not4you, fungus, |Quest|,
Silvio (where are you ?), Vantmas and every Cracker on this planet ...
-------=====================================================--------
------======everybody was a lamer, before they become ELITE======-------
-------=====================================================--------
-----=========-----
-
homepage
links
anonymity
+ORC
students' essays
academy database
antismut
tools
cocktails
javascript wars
search_forms
mail_fravia
Is reverse engineering illegal?