Regarding the previous posts, I finally figured it how to push arbitrary function parameters on the stack, and call a function on another system with those parameters. If anyone is interested:
http://www.rakkar.org/sourcecode/PureRPC.html I have the working solution inside RakNet Header: http://raknetjenkinsso.svn.sourceforge.net/viewvc/raknetjenkinsso/trunk/Source/AutoRPC.h?revision=100&view=markup Source: http://raknetjenkinsso.svn.sourceforge.net/viewvc/raknetjenkinsso/trunk/Source/AutoRPC.cpp?revision=102&view=markupOnly prob. right now is that I don't know how to do the equivalent assembly on Linux, so I have an #ifdef _WIN32 there
void AutoRPC::CallWithStack(const char *inputStack, unsigned int numBytes, void *functionPtr, void *lastParam, void *thisPtr)
{ const int loopCount = numBytes/MIN_FUNC_STACK_ALIGNMENT; #ifdef _WIN32 ASSEMBLY_BLOCK { // Push lastParam push lastParam // Allocate data stack sub esp,numBytes // Number of times to move MIN_FUNC_STACK_ALIGNMENT bytes mov ecx,loopCount // source is esi mov esi,inputStack // destination is esp, stored in edi mov edi,esp // Copy data to function stack, until ecx is 0 rep movs dword ptr es:[edi],dword ptr [esi] // Push this pointer if not 0 cmp thisPtr,0 // If passed thisPtr, do a class member call. je no_this_ptr push thisPtr call functionPtr pop thisPtr jmp done no_this_ptr: // Regular C call call functionPtr done: add esp,numBytes pop lastParam } #endif } --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html