I actually meant something like this:
DoSomething is function exported from other DLL.
In my application:
{
...
int nDataType = 0;
int nCount = ListBox.GetCount();
for ( int i = 0; i < nCount; i++)
{
nDataType = GetDataType(ListBox.GetText(i, someCString);
switch(nDataType)
{
}
}
...
}
I cannot modify the code of DoSomething. I just need to call it with various informations, which are collected from ListBox. I hope it's more clear what I'm trying to achieve now.
It's something like
for(blahblah)
{
switch(TYPE)
case DWORD:
mov eax, CurSelData;
push eax;
break;
case BYTE:
mov eax, CurSelData:
push eax;
break;
...
}
// I know I highly abstracted that
and then after the loop the stack would be looking for example like:
ptrToFormat // "dbds"
data1 //(DWORD)
data2 //(BYTE)
data3 //(DWORD)
data4 //(STRING)
and then
call DoSomething
EDIT:
One guy told me, that it's not possible to do it with C++. So I made it with combining C++ and ASM.