I'm having some trouble reading from an arbitrary memory address using Chez Scheme's FFI and the kernel32/user32.dll's ReadProcessMemory function. I got the process handle and everything fine, but I'm struggling with quite a few aspects of the read function itself:
(define (read-process-memory handle address size)
((foreign-procedure "ReadProcessMemory" (iptr iptr string int iptr) iptr)
handle address byte-array size output-ptr))
(define address (make-ftype-pointer iptr #x14a24d63660))
(read-process-memory process-handle address 4)
From this I get Exception in read-process-memory: invalid foreign-procedure argument #<ftype-pointer iptr 1417957226080>
, but I'm pretty sure I'm approaching a lot of things about this wrong.
Thanks in advance