About my second question - here is an example.
Code: Select all
set memory_file binary "\xEB\x06\x90\x90\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x58\x83\xC0\xF7\xC7\x00\x78\x56\x34\x12\xC3"
calldll memory_file 0 stdcall ""
exit
Asm code source:
Code: Select all
jmp testproc
align 4
my_static_variable dd 0
align 4
proc testproc
; this block calculates virtual address of variable
call @f
@@:
pop eax
add eax, (my_static_variable - @b)
mov dword [eax], 0x12345678
ret
endp
Function causes "access violation" exception.
It is happens because the memory page which contains my code doesn't have a permission to be written.