I have an API, and I have a parameter for it which refers to a
zero terminated string.
I have to use the api more than once, and I have to change
only ONE parameter.
I think it's more uptimated to write some procedure to change
the stringparameter, than to make four call to the same api, right ?

Take these four zeroterminated strings:

Title_1 db "Some String",0
Title_2 db "Some String",0
Title_3 db "Some String",0
Title_4 db "Some String",0

I could write the same code everytime I have to call that api,
or
I could have only ONE instance of the call, and then change
the parameter which is those four strings.

But how :confused:

I thought it was quite simple (of cause if you know it, it's simple),
but I couldn't come up with a solution :(


Thanks


The SharK
Posted on 2004-06-27 03:17:16 by The SharK
i suggest using OFFSET array with addresses for Titles....


TitAddr dd OFFSET Title_1,OFFSET Title_2 .......,0

xor ecx,ecx
mov edx,OFFSET TitAddr
@@:
mov eax,
inc ecx
push eax
push ecx
push edx
invoke APICALL(.......,eax,......)
pop edx
pop ecx
pop eax
or eax,eax
jnz @B

wasn't tested, and first Title must be != 0

OR this one (looks better) and first Title can be 0

xor ecx,ecx
mov edx,OFFSET TitAddr
@@:
mov eax,
cmp eax,0
jz @F
push ecx
push edx
invoke APICALL(...,eax,....)
pop edx
pop ecx
inc ecx
jmp @B
@@:
Posted on 2004-06-27 03:42:57 by AceEmbler
Some API's take a string list with an extra zero at the end. Check it out to see if that will work for you.

Someone like:
Title_1 db "Some String",0
Title_2 db "Some String",0
Title_3 db "Some String",0
Title_4 db "Some String",0,0

Regards, P1 :cool:
Posted on 2004-06-27 19:20:17 by Pone