Dear list,
As per the earlier message, sent yesterday, here is some sort of solution
I've gathered by reading fifty thousand assembler manuals that are mostly
written by people who're so proud of their knowledge, they are sharing it
in a manner that requires enigma decoding team to understand it:))))
(Well, Microsoft does it better, after all, and I've worked with their
stuff for a while:)))
Anyhow, this code works more or less cleanly inside a test program and it
allows me to call functions through pointers, building up their
parameter-pointer list according to a definition taken from (let's say) a
text file. (Do I have to explain what is this good for?)
What I had in mind, besides sharing this joyful moment with You all (and
jolly me, what a joy it is to finaly get somewhere!), is that I would like
to hear comments from ASM-literate (not like me) people around here.... I
mean - this code may in fact be dangerous, it may be optimized, it may be
replaced by three lines of something else.... All suggestions & comments
are welcome. Thank You!
(BTW: The quoted code is free to be used and quoted, but at Your own
risk:)))
void caller2(void* pfn, void* params, unsigned int nArgs)
{
/*
* Stack layout:
*
* 8(%ebp) pfn
* 12(%ebp) params
* 16(%ebp) nArgs
*/
asm("
# Set the counter to zero
movl $0,%edx
# Save the starting point from the params
movl 12(%ebp), %ecx
# Are there params?
cmpl $0, 16(%ebp)
jz _call
loop:
# Push the parameter
pushl (%ecx)
# Add 4 to it (move to the next param pointer)
addl $4,%ecx
# Increment the counter
incl %edx
# Compare
cmpl %edx, 16(%ebp)
# Jump if not zero
jnz loop
_call:
# Perform the call
call *8(%ebp)
");
}
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]