Heya,

I'd like to have some sentences defined in data referenced by a table for faster acces... Erm... Let's see:



.data
Text1 db "hello",0
Text2 db "wassup",0
Text3 db "welcome",0

TextTable dd <insert here addr/offset of Text1>,
dd <insert here addr/offset of Text2>,
etc


So I can just use a variable and multiply it by 4 to get the offset instead of having like a huge table of IF's...

Anyone knows how to do this?
TIA,
JimmyC
Posted on 2002-01-31 01:40:42 by JimmyClif
Yup is As Simple as that :



.data
Text1 db "hello",0
Text2 db "wassup",0
Text3 db "welcome",0

TextTable dd offset Text1
dd offset Text2
dd offset Text3
...etc...


A note:
offsets will not be the same on all OS/boxes just do not save the on file and reload later...ok?
Posted on 2002-01-31 02:17:38 by BogdanOntanu
(This thread) shows a more compact way using a macro - easier to edit, IMO.
Posted on 2002-01-31 09:50:23 by bitRAKE
Alright, I see...

but what about that Offsets who aren't the same on all OS/boxes mentionned by Bogdan ?

Doesn't that imply that I should compute the Offsets at Runtime just to make it compatible for every system?
Posted on 2002-01-31 11:22:20 by JimmyClif
Relocation information stored in the PE file does that for you.
Posted on 2002-01-31 12:11:56 by bitRAKE
heya BitRake,

I used Bogdan's suggestion in .data and it seems to work fine,
I tested it on WinME and 98SE...

Well, I use it as I couldn't figure out how your macro works... I just pasted that thing inside my macros file and called it from .data and then the error messages flood began...

Anyway... thanks a lot both of you.. :)

JClif
(PipeDreams v1.0 will be released in approx 1-2 week)
Posted on 2002-01-31 21:50:54 by JimmyClif