winapi - Set an x86 register in Python to be used in a called DLL function -


background

to use python call non-exported dll function. function called assumes 1 of general registers set location of buffer - not set through stack variables. buffer owned python script. ideally, solution should run stand-alone, rather within context of debugger.

problem

is possible use python set 1 of x86 registers, in case ecx, memory location of python variable prior calling dll function? (and without process of obtaining/storing register trashing it).

considered approaches

i have looked @ several approaches, of seem relatively heavyweight, , reach extent of knowledge:

  • using getthreadcontext - presume require running dll function in separate thread, obtaining , updating thread context - if way go, have high-level approach
  • using form of corepy/pyasm build small program - may risk trashing registers prior calling dll function.
  • using python script within debugger such immunity debugger - solve of issues, ideally script run stand-alone.

i grateful suggestions on how approach this.

i think practical way write code calls function in asm. controlling @ level can sure no other party modify register.

one way statically , have compiler/linker build dll can call python code, passing whatever information needed. function address , parameters needed pass function.

another way generate code @ runtime sort of jitter dynamic code generator. approach harder right, although offers prospect of greater flexibility.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -