On 3/22/08, Kevin Jenkins <gameprogrammer@xxxxxxxxxx> wrote: > > 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? > > // Load variable source address for movsd instruction. > lea esi,stack Assuming that your 'stack' variable is just a pointer to where you store parameters for next call, you should use 'mov esi, stack', instead of 'lea esi, stack'. The latter will grab the pointer to your pointer. Anyway, I've tried to emulate what you are doing and it works fine for me. Here's the code: #include <malloc.h> void _cdecl func(char b, unsigned long long a) { printf("Int: %lli, Char %c\n", a, b); } void call_with_asm(unsigned long long a, char b) { int stack_size = sizeof(unsigned long long) + sizeof(int); int loop_count = stack_size / 4; char *stack = (char *) _alloca(stack_size); int *p = (int *) stack; *p ++ = (int) b; *p ++ = (int) (a); *p = (int) (a >> 32); __asm { push esi push edi push ecx sub esp, stack_size mov esi, stack mov edi, esp mov ecx, loop_count cld rep movsd call func add esp, stack_size pop ecx pop edi pop esi } } int _tmain(int argc, _TCHAR* argv[]) { unsigned long long d = 100000000000; func('J', d); call_with_asm(d, 'Y'); return 0; } -- Ed