News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

runtime memory copy problem

Started by stbfish, September 18, 2009, 01:39:11 AM

Previous topic - Next topic

stbfish

stub for inject dll to target

LoadDll proc
    push 0DEADBEEFh      ;retun address
   pushfd
    pushad               
   push 0DEADBEEFh      ;Dll dir
   mov eax, 0DEADBEEFh  ;LoadLibrary address
    call eax
    popad
    popfd
    ret
LoadDll endp
Loadend::

i need to copy this proc to target process,but before write to target process memory space, i need to  initialize the 0DEADBEEFh to right value at runtime. i tried like below
;...
;...
mov eax, OFFSET LoadDll
add eax, 1h
invoke memcpy, eax, stubret, 4
mov eax, OFFSET LoadDll
add eax, 8h
invoke memcpy, eax, stubdlldir, 4
mov eax, OFFSET LoadDll
add eax, 0Dh
invoke memcpy, eax, dwLoadLibrary, 4


now problem is memcpy not working in masm, no define. any other way to sort out this problem.
Thanks!

z941998

I saw a way to solve your question in the Masm32 examples\01\dll area.  Check it out.  I also recall seeing an alternative approach in other examples.

MichaelW

stbfish,

Did you bother to read the forum rules and then attempt to understand the intent of the rules? This looks to me like a clear violation, so I'm locking this thread.
eschew obfuscation