I've got this function, which consists mostly of inline asm.
long *toarrayl(int members, ...){
__asm{
push esp
mov eax, members
imul eax, 4
push eax
call malloc
mov edx, eax
mov edi, eax
xor ecx, ecx
xor esi, esi
loopx:
cmp ecx, members
je done
mov esi, 4
imul esi, ecx
add esi, ebp
mov eax, [esi+0xC]
mov [edi], eax
inc ecx
add edi, 4
jmp loopx
done:
mov eax, edx
pop esp
ret
}
}
And upon running, I get an access violation on the return instruction.
I'm using VC++ 6, and it can sometimes mean to point at the line above, so possible on 'pop esp'. If you could help me out, it'd be great. Thanks, iDomo.
eax
) off the stack after callingmalloc
. And leaveret
out of your code, let the compiler handle that part. - DCoderret
crashes? Stack smashing. flies away - user529758ESI
,EDI
,EBX
,EBP
, andESP
at the beginning (if you modify them) withpush
es, and restore at the end withpop
s - Gunner