flat assembler
Message board for the users of flat assembler.

Index > DOS > String handling in assembly (Dos/Windows)

Author
Thread Post new topic Reply to topic
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 24 Jun 2003, 07:43
Hi!

Ok, this is a kind of a newbie question, but I haven't studied this part of assembly programming before - so can someone help me?? How to handle strings in assembly the best way? What's the fastest way? Memory allocation?? Some tutorials?

Vortex, I've seen your scanner....That's fantastic!! There you have to handle long strings etc....What method do you use - with memory allocation etc.?

Once again, I know this may seem to be easy, but I really need a tutorial or something like that to learn.....I haven't programmed in assembly for so long....

Thanks!
Regards,
Tommy
Post 24 Jun 2003, 07:43
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 24 Jun 2003, 08:25
I just found out a little bit by testing myself, but I would really like a tutorial on how to use such string-tables as in FASM....I don't really now what it's called.... But here's an example (DOS):

Code:
db "string1",0
dw label1
db "string2",0
dw label2    

Well, I'm not sure if this is set up correctly, but the thing I want, is if a string = for instance "string1" then jump to label1 ...etc.

Sorry, I'm stupid with it Sad....
So long!
Tommy
Post 24 Jun 2003, 08:25
View user's profile Send private message Visit poster's website Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 24 Jun 2003, 09:41
something like

Code:
lea si, buffer
cmp word ptr[si], 'ts'
jnz _out
cmp word ptr[si+2],'ir'
jnz _out
cmp word ptr[si+4],'g1'
jnz _out
cmp byte ptr[si+6],'1'
jz label1
cmp byte ptr[si+6],'2'
jz label2
_out:
    

Untested
Post 24 Jun 2003, 09:41
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 318
Vortex 24 Jun 2003, 09:53
Tommy,

Firt of all,thanks for your kind words.I am glad to see that my little
application can be usefull.

Actually,I use the GlobalAlloc function for my scanner.There are
other memory allocation functions such as HeapAlloc,HeapCreate,
CoGetMalloc from ole32.dll etc... There are alot of discussions about
memory allocation strategies/functions;you can find them in the win32
message board. f0dder has a nice article about this subject on his
website.

A nice thread about string manipulation:

http://board.win32asmcommunity.net/showthread.php?s=&threadid=13659

I think this thread can answer some of your questions.
You need to use an array of pointers to access your strings;the thread
explains all about it.

My scanner reads the asm source file and checks if every line
contains the substring "invoke". If the scanner finds an "invoke" command, then the API function coming after "invoke" is compared
with all the exported names from the required DLLs.The rest is easy,the
output is directed to a file with the "imp" extension.

Regards,

Vortex

_________________
Code it... That's all...
Post 24 Jun 2003, 09:53
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 24 Jun 2003, 10:39
Thanks a lot!! I'm sure this will be helpful .... Wink Thanks again! ....and...keep up the good work Vortex!!

So long! Take care!
Tommy
Post 24 Jun 2003, 10:39
View user's profile Send private message Visit poster's website Reply with quote
Tommy



Joined: 17 Jun 2003
Posts: 489
Location: Norway
Tommy 24 Jun 2003, 10:40
...and thanks to you too roticv....Nice example.... Smile
Post 24 Jun 2003, 10:40
View user's profile Send private message Visit poster's website Reply with quote
The Lightning Stalker



Joined: 07 Jun 2006
Posts: 11
The Lightning Stalker 07 Nov 2006, 02:00
Error 404 not found. ;-(
Post 07 Nov 2006, 02:00
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.