flat assembler
Message board for the users of flat assembler.

Index > Windows > odd error

Author
Thread Post new topic Reply to topic
blacky



Joined: 06 Apr 2006
Posts: 32
Location: JA
blacky
I dont understand why im getting an error here..

Code:
section '.idata' import readable writeable

        library kernel32,'KERNEL32.DLL', user32,'USER32.DLL'
        include 'apia/kernel32.inc'
        include 'apia/user32.inc'
    


Loader.asm [75]:
library kernel32,'KERNEL32.DLL', user32,'USER32.DLL'
error: illegal instruction.


Whats wrong?
Post 04 May 2006, 14:31
View user's profile Send private message MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you need to
Code:
include '%fasminc%/MACRO/import32.inc'    


"library" is not directive, it's just macro defined in this file
Post 04 May 2006, 14:41
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
blacky



Joined: 06 Apr 2006
Posts: 32
Location: JA
blacky
IS theres omething about using 'call' and invoke that makes using the words OFFSET or ADDR not work?

why do i get undefined symbol for this:
Code:
         push offset pinfo
         push offset sinfo
         push 0
         push 0
         push CREATE_NEW_CONSOLE
         push 0
         push 0
         push 0
         push offset wmoname
         push 0
         call [CreateProcess]
    


pinfo PROCESS_INFORMATION
sinfo STARTUPINFO are defined in .data section.

And it also wont let me do things like
push pinfo.dwProcessID
Post 04 May 2006, 15:53
View user's profile Send private message MSN Messenger Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
blacky, "offset" is a relic from MASM. You should just do "push pinfo" and "push sinfo" to store the addresses of those variables.

When accessing memory, you need "indirection brackets" - like "push [pinfo.dwProcessID]".

Also, why are you using manual pushpushpushpushcall instead of invoke? Smile
Post 04 May 2006, 16:26
View user's profile Send private message Visit poster's website Reply with quote
blacky



Joined: 06 Apr 2006
Posts: 32
Location: JA
blacky
yea , f0dder thanks i just took a look at a very good asm reference and i used the formal way. (push pinfo)

I dont know why but the push push call just makes sense to me and it helps me understand how 'real' assembly works, i use invoke whenever my fingers feel like typing it heh..
thx.
Post 04 May 2006, 17:12
View user's profile Send private message MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
f0dder wrote:
Also, why are you using manual pushpushpushpushcall instead of invoke? Smile

you can comment code better then
Post 04 May 2006, 17:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
blacky



Joined: 06 Apr 2006
Posts: 32
Location: JA
blacky
so stupid i just had to erase it..


Last edited by blacky on 04 May 2006, 18:29; edited 1 time in total
Post 04 May 2006, 18:13
View user's profile Send private message MSN Messenger Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
vid wrote:
f0dder wrote:
Also, why are you using manual pushpushpushpushcall instead of invoke? Smile

you can comment code better then

Do you really need a comment for each parameter passed to a function? :-s

Blacky, MB_OK is a symbolic constant for 0 - so you *could* just "push 0", but you *should* "push MB_OK". Anyway, you're forgetting the 'hwnd' parameter to MessageBox, use 0.

_________________
Image - carpe noctem
Post 04 May 2006, 18:19
View user's profile Send private message Visit poster's website Reply with quote
blacky



Joined: 06 Apr 2006
Posts: 32
Location: JA
blacky
yea just noticed.. dumbest mistake ive done..how careless.
Post 04 May 2006, 18:28
View user's profile Send private message MSN Messenger Reply with quote
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi
vid wrote:
f0dder wrote:
Also, why are you using manual pushpushpushpushcall instead of invoke? Smile

you can comment code better then



yep, it helps, sometimes when using api not used to and pushing temp vars i put comment after it what it is supposed to be, and when i was starting with fasm it helped me to see what i do and where in ollydbg easier...

_________________
When We Ride On Our Enemies
support reverse smileys |:
Post 04 May 2006, 19:59
View user's profile Send private message MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7801
Location: Kraków, Poland
Tomasz Grysztar
You can put a comment next to each parameter with "invoke", too (just split it to multiple lines).
Post 05 May 2006, 03:01
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
tomasz: of course, but indenting makes problem then. it just "looks bad"
Post 05 May 2006, 08:34
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
i use push/call not invoke aswell, and it does allower a cleaner syntax for commenting specific parameters
Post 06 May 2006, 03:57
View user's profile Send private message AIM Address MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.