I was playing with a shellcode example and put some code on the stack. Here is a relevant fragment from it, as seen in the memory view of VS2013:
Memory view:
0x0018FEB4 90 90 90 83 ec 28 eb 0b e8 66 2a 1a 75 50 e8 9d 80 18 75
Now, when I see the same code in the disassembly view, interpreted in x86 machine language, all goes as expected, except for the addresses( in little endian) I see for the call instructions (opcode E8):
Disassembly view:
0018FEB4 nop
0018FEB5 nop
0018FEB6 nop
0018FEB7 sub esp,28h
0018FEBA jmp 0018FEC7
0018FEBC call 75332927
0018FEC1 push eax
0018FEC2 call 75317F64
If I change the view to disassembly with code bytes, I get the same type of delta between the address that I have written to memory and the address that gets called:
Disassembly view, with code bytes as well:
0018FEBC E8 66 2A 1A 75 call 75332927
I think I may be missing some big theoretical fact with this one, but could some one explain it to me? The addresses I wanted to call are specific function addresses from kernel32.dll, but I had to make some arithmetic on them to actually make the code execute and call the correct addresses.