hey everyone firdt i would like to thank tomasz for creating FASM (keep up the good work) first am new to asm read alot about it but still got problems anyway i searched for some examples in FASM but didnt find any if anyone can help it would be really appreciaited so what i want is some examples of varioous API used in FASM just eome examples so i can read them and understand them nothing complicated and any other usefull examples too thanks anyway and please try to help

20 Apr 2004, 11:18

JohnFound

Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria

JohnFound

You can download FASMW package. It come with very handy editor and some base Windows examples. After that you can search the board for posts of Imagineer - He post Iczelion's tutorials, translated to FASM syntax.

Regards.

20 Apr 2004, 11:38

Stcherbatchenko

Joined: 20 Apr 2004
Posts: 13

Stcherbatchenko

actually i read alot about it actually i know abuot asm but i wanted to get some specific samples that will help me alot if you have any please let me know, and i do have FASM and Fresh, if i didn't have it would i be posting here after all its the official FASM board and i like it and see that FASM is really great much better thatn others.

20 Apr 2004, 12:35

JohnFound

Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria

JohnFound

Hm-m-m-m. Well, actually I missed something. What kind of examples you need? These in FASMW package are actually are very basic for beginers. Maybe some more advanced? Maybe you have to describe it more detailed. But in all cases searching the board should be helpful.

Regards.

20 Apr 2004, 13:01

Stcherbatchenko

Joined: 20 Apr 2004
Posts: 13

Stcherbatchenko

thanks for the fast reply but what i want to see is how to use API's as the examples i downloaded for FASM are not very getting into all what i need, and i do surf the board but i dont find what i want maybe if you can help me with those samples i would be very glad here are more exmaples that i wanted to see:
1) how to use api's and write them in the code
2) some samples to demonastrate them
thats all
thanks again

20 Apr 2004, 13:36

vidVerbosity in development

Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia

vid

that IS shown in examples.

example of using api is

Code:

invoke MessageBox,0,"text","caption", MB_OK

but you must have imported all APIs (or better API procedures) you use. To import API procedure you must know in which DLL is it located. For example MessageBox is in USER32.dll, so importing it is

thanks very much for your fast reply and for keeping up with me anyway that was an easy one but i was looking for someinth like www.allapi.net has like they show you the api's and gives you a working demo examples so you can get to know what is happening but anyway thanks

20 Apr 2004, 18:50

coconut

Joined: 02 Apr 2004
Posts: 326
Location: usa

coconut

translating VB and C code to assembly is not hard - for example, setting caption of a window can be done like so:

Code:

invoke SendMessage,WM_SETTEXT,[hwnd],0,_text

where [hwnd] holds the window handle, and _text is the caption. if you need help translating a specific example from allapi.net, just post it here, we'll be glad to help

Last edited by coconut on 21 Apr 2004, 02:43; edited 1 time in total

20 Apr 2004, 20:53

Stcherbatchenko

Joined: 20 Apr 2004
Posts: 13

Stcherbatchenko

thanks coconut for your reply and your help but i was asking generally coz actually i kinda wanted to know how to use all api's and to know how to write em in ASM as am new to it only been reading alot about it for along time, anyway it would be nice to know why the '[]' in the 'hwnd' like if i wrote that in C/C++ i dont have to use any pointers please correct me if am wrong and it yould be appreciated to see some examples or prorams of your own to learn from.

20 Apr 2004, 20:57

Stcherbatchenko

Joined: 20 Apr 2004
Posts: 13

Stcherbatchenko

heh another question, am not a complete idiot but ASM is really big so i have to use your help so i have noticed in calling API's we use 'INVOKE' which i know is a macro anyway and i know something abuot asm too but not good in coding really
so what i wanted to know if i can use the pure old ASM style coding but in win32asm coz i like to learn it from the begining not search for an easy solution, i dont know but i like to llearn things well so i can then actually learn something better than not learn at all so if you can guide me to stuff like this you can really help also can you help me with doing the hex numbers as i only grab the calculaotr and use it i wanna know how to convert hex to deciman and vice vers in the old fashioned way "BRAIN POWER" thats enough for now i think i have been such a pain for now.

we access the value of the variable by enclosing it in brackets: [num]. if we wanted to send the memory location, a pointer, we wouldnt write the [] just num. you may see in other assemblers they use ADDR or OFFSET keywords to achieve this

etc.
First, you list which dlls are you using with "library" macro. For each library, there are 2 macro arguments, first is symbol that remepresents library (used for "import" macro) and second is string holding name of library.
Then, for each DLL, you list procedures from it using "import" macro. First argument is symbol asociated to DLL with "library", then following groups of two macro arguments identify one procedure. First of two arguments is name of dword variable that will be filled with address of procedure, second is string holding name of procedure. For example, when you use

Code:

library user32,'USER32.DLL'
import user32,
MessageBox,'MessageBoxA'

you get declared dword variable "MessageBox" which holds address of procedure "MessageBoxA" from "USER32.DLL". For that reason, to call
it, you must use

Code:

call [MessageBox]

btw: These macros are declared in "%FASMINC%\macro\import.inc", you have to include it to use them.

Code:

include "%FASMINC%\macro\import.inc"

Last edited by vid on 22 Apr 2004, 08:38; edited 1 time in total

22 Apr 2004, 08:26

Stcherbatchenko

Joined: 20 Apr 2004
Posts: 13

Stcherbatchenko

well thanks for your help vod that really haelped me out now i know what is it used for thanks, but i want to know abuot those sections like '.code' '.import' and the other code you write in the same line like readble writable etc...
how can i make my own sections if possible and how to use them etc.. stuff like that would help me more

22 Apr 2004, 08:33

vidVerbosity in development

Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia

vid

only meaning of section is to restrict access to parts of memory.
For example, if you have some data that needs only to be read (like strings), you put then into section marked as "readable", not as "writable", so if you mistakenly, because of some bug, write to it, you will get error (general protection failure, GPF).

import table (table of pointers to procedures imported from DLLs) is usually stored in own section marked with "import". But it can as well be in any section, just marked with "data import" and "end data". Sections are just some standard, in my opinion not very useful.

FASM allows you to create file with only one section, on that all operations can be performed (writable readable executable), where you have everything you need. Such file is created if you dont' use any "section" directive in whole file.

You can also use "%FASMINC%\win32axp.inc" that contains macro which create section for you: ".data", ".code", ".end <entry label>"

I suggest using only one section, and using "data import" for import table

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum