Almost got my variadic RPC working. But pushing on the stack isn't working for me. If anyone knows assembly, can they tell me what I'm doing wrong?
char a=1; unsigned long long e=5;(I serialize this into an array in reverse order, and expand the char to 4 bytes)
- out 0x0012fd0c "" char [256] [0] 5 '?' char [1] 0 char [2] 0 char [3] 0 char [4] 0 char [5] 0 char [6] 0 char [7] 0 char [8] 1 '?' char [9] 0 char [10] 0 char [11] 0 charI then push that array onto the stack, and do the function call. numBytes in this case is 12:
int loopCount = numBytes/4; __asm { // Allocate stack sub esp,numBytes // Number of times to move MIN_FUNC_STACK_ALIGNMENT bytes mov ecx,loopCount // Load variable source address for movsd instruction. lea esi,stack // Load variable dest address mov edi,esp // Copy data to stack, 4 bytes at a time, until ecx is 0 rep movsd // Call function call functionPtr // Deallocate stack add esp,numBytes } Here's the function I'm calling: void _cdecl func2(char a, unsigned long long e) { // Test param injection, optional in parameter list printf("%i %i\n", a, (int) e); } --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html