Things are about to get complicated. I finally made it down here to the fun parts.. I did not think i be back so soon...If you want to make a call to a PROC and you don't yet know the name of that PROC but you need to create the name for that PROC as the program is running right before that PROC is called... The name will change depening on what the program is doing and came up with at that time....Here is a rough example to give you an idea of what i am trying to do.. The message box will show only a1 or a2 or a3 just to let you know that you made it there. In my setup i already got a way to get the PROC name and build them up right before the call to it.... It's set up just the way i need it but i don't know how to MAKE the CALL to it because this is not working the way i expected...

I been hearing about jump tables and labels in memory. Do this has something to do with this...Any suggestion will help. Thanks in advance. All of my stuff is .data? ... i just wrote it this way to give an general idea of it.


LeadBuffer db "a ",0
String1 db "1",0
String2 db "2",0
String3 db "3",0
String4 db "4",0


; ..............
invoke lstrcat,ADDR LeadBuffer,ADDR String2
; ..............

CALL LeadBuffer

I number my PROC here: no var needed... Just need to get to whatever is in the LeadBuffer at that time...

; ....................................
invoke MessageBox,0, offset LeadBuffer,0,0

; ....................................
invoke MessageBox,0, offset LeadBuffer,0,0
; ....................................
invoke MessageBox,0, offset LeadBuffer,0,0
; ....................................
invoke MessageBox,0, offset LeadBuffer,0,0

I have no problem with PTR's if that what it takes for this part :)
Posted on 2002-06-30 17:55:56 by cmax
There are numerous problems with your code. Like, your
lstrcat will overwrite the data in String1 - and if you
do this code more than once, you will get even more data

What you want to do is not too hard... but the way you're
trying to do it is rather... well, I won't do more than a :rolleyes:.
It reminds me of stuff I tried to do back in pascal after one
week experience with the language.

Once your program is assembled and linked, there isn't any
information about label names in your executable, unless of
course you have included debug info.

What you want to do is either a jumptable, a switch statement,
or a lot of IF/ELSE statements. If you *must* call a proc by
matching strings, build a table where each entry has two DWORDs:
one is a pointer to stringname, the other is the offset of the
proc. Something like this:

proctable LABEL dword
dd CTEXT("proc1"), offset proc1
dd CTEXT("proc2"), offset proc2
; ... and so on
dd 0, 0 ; terminate table

At runtime, loop through the table doing string compares until
you either find a match or reach the end of the table.
Posted on 2002-06-30 18:08:28 by f0dder
I just wrote it that way because i do all un-initialized data, Marcos, and Push's and forgot (invoke) how to write the other way.

YES..... i will try this. It may seem crazy but that is where my code lead me to.... This is going to be all FUN now. I like building new parts for it... This is going to be the best part... AGAIN ... I am going to use that jump Buffer for something Tooooo.

Thanks f0dder

PS: Posted on 2002-06-30 18:26:48 by cmax
I just thought about what you said " there isn't any information about label names in your executable"

Posted on 2002-06-30 19:00:58 by cmax
Having a table of names and func offsets makes your app easy prey -
unless you use names that are totally different from what the code
actually does. Still, I wouldn't use such a table unless I had to,
for instance, reference functions from a script or the like.
Switch is good if you have a lot of funcs with a more or less even
distribution of call frequency.
Posted on 2002-06-30 19:06:32 by f0dder
I see, I just looked at it in mem and the @ sign is right up there. Well another idea down the tubes...I got to use it anyway but at lease i can do some wild stuff down there just for the heck of it, might get lucky...besides the worse is over... i just make a little fun down in the PiT with it...By the way it will not be using any API down there anyway. All M32 opt string mulipination stuff so i might still get lucky... Between my new moving job and this i should be quite busy for sometime now... My 10 year printing business hit an all time low last month....I had it made for a while, now i can't play with ASM when i feel like it any more for some while :(

Thanks again f0dder

Posted on 2002-06-30 20:37:31 by cmax