Call/Ret in x86 assembly embedded in C++
- by SP658
This is probably trivial, but for some reason I can't it to work. Its supposed to be a simple function that changes the last byte of a dword to 'AA' (10101010), but nothing happens when I call the function. It just returns my original dword
__declspec(naked) long
function(unsigned long inputDWord, unsigned long *outputDWord)
{
_asm{
mov ebx, dword ptr[esp+4]
push ebx
call SET_AA
pop ebx
mov eax, dword ptr[esp+8]
mov dword ptr[eax], ebx
}
}
__declspec(naked) unsigned long
SET_AA( unsigned long inputDWord )
{
__asm{
mov eax, [esp+4]
mov al, 0xAA
ret
}
}