flat assembler
Message board for the users of flat assembler.

Index > Windows > something about 'strcall'

Author
Thread Post new topic Reply to topic
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 20 Mar 2004, 17:43
Greetings to all from Siberia!

First, sorry for my not so good English...
Second, I'm a beginner not only in fasm but in assembly at all.
I'm maker-up and poetry editor.

Third, I could overlook something but in fasm I can't find
'sizeof' or such. And this plunge me into deep despair.
But after reading about 50% of threads I think I found
a solution for my trouble.

Problem: if I wanna display some string only 1 time, but wan't
to declare them and wan't to call 'lstrlen' or 'wsprintf', e.g.

Code:
invoke WriteFile, [hout], 'abracadabra', ???, written
    


Such coding makes trouble to 'step over' debugging but not for
'step into'. And beginners may use this way of coding
'till they get more experience. And there is one more thing
which I want from fasm - listing. I'm lost all of symbols with
disassemblers (like 'hiew') or debugger (like 'ollydbg').
I need listing after all of macro parsing passes and before
assembling - with it I could fall deeper in assembler.

Solution: some kind of 'invoke'

Code:
macro sinvoke proc, [arg] { 
reverse 
  if arg eq 
  else if arg eqtype ''
    local .@string
    call .@string
    label raw byte
    db arg,0
    .size = $-raw-1
    .@string:
  else       
    pushd arg 
  end if    
common 
  call [proc]    
}
    


...used like...

Code:
sinvoke WriteFile, [hout], 'abracadabra', .size, written
    



It works! But...

Code:
sinvoke WriteFile, [hout], <'abracadabra',10,13>, .size, written
    


...alas

Question: can somebody explain me what happens, what's wrong?

_________________
O, tempora! O, mores!
Post 20 Mar 2004, 17:43
View user's profile Send private message ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 21 Mar 2004, 09:29
what happens is that
<'abracadabra',10,13> eqtype ''
isn't true condition, thus it isn't assembled as string
Post 21 Mar 2004, 09:29
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 21 Mar 2004, 10:55
Thanx, vid!
I play around the macro above and was confused with another bad thing. 'sinvoke' can be placed only one time. If there are more 'sinvoke''s - it fails. Well, I decide that this ability isn't so important for me and just forget it. I'm always can declare such string Smile
Post 21 Mar 2004, 10:55
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 21 Mar 2004, 11:08
To make it usable more than once, put the following lines at the beginning of macro:
Code:
common
 local ..sz,..str,..raw
 .size equ ..sz
 .@string equ ..str
 raw equ ..raw    
Post 21 Mar 2004, 11:08
View user's profile Send private message Visit poster's website Reply with quote
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 24 Mar 2004, 18:42
Thanks a lot, Privalov!
I couldn't do it by my hands 'cos fasm manual isn't clear for me yet... in some places... But now I'm trying to translate it into Russian to dive into fasm deeper.
I wrote simple and dirty dos16 disasm using nasm for training. Now I think to write simple asm using fasm, just to let me know how it works.
I need only free time...

_________________
O, tempora! O, mores!
Post 24 Mar 2004, 18:42
View user's profile Send private message ICQ Number Reply with quote
S.T.A.S.



Joined: 09 Jan 2004
Posts: 173
Location: Ru#27
S.T.A.S. 25 Mar 2004, 06:44
[offtop]
iklin,
you might want to take a look at this short FASM tutorial by pas and here for IceStudent's .chm
Post 25 Mar 2004, 06:44
View user's profile Send private message Reply with quote
iklin



Joined: 20 Mar 2004
Posts: 120
Location: Russia, Siberia
iklin 26 Mar 2004, 16:07
Thanx, S.T.A.S. I saw it. It's not bad, but can't cover all of things I want.

_________________
O, tempora! O, mores!
Post 26 Mar 2004, 16:07
View user's profile Send private message ICQ Number 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.