title: Call/Ret in x86 assembly embedded in C++
body: <p>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.</p>
  
  <pre><code>__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 //10101010 didn't work either 
                  ret
               }
  }
  </code></pre>