Embedded binary example does not work
Posted: Mon Mar 13, 2006 2:20 pm
Hi,
Trying the code shown here:
http://www.newlisp.org/index.cgi?page=Embedded_Binary
...with newLisp 8.8 delivers errors....? However, I got it running with the following change:
1) the line
changed into
2) The resume at the end is incomplete, the line changing the type is missing.
Peter
Trying the code shown here:
http://www.newlisp.org/index.cgi?page=Embedded_Binary
...with newLisp 8.8 delivers errors....? However, I got it running with the following change:
1) the line
Code: Select all
(cpymem (pack "ld" 265) (first (dump foo)) 4)
Code: Select all
(cpymem (pack "ld" 264) (first (dump foo)) 4)
Regards6. Putting it all together
; set code
(set 'bindata (pack "ccccccccccc"
0x55 0x8B 0xEC 0x8B 0x45 0x08 0x03 0x45 0x0C 0x5D 0xC3))
; get function template
(set 'foo print)
; change type
(cpymem (pack "ld" 264) (first (dump foo)) 4)
; set code pointer
(cpymem (pack "ld" (address bindata)) (+ (first (dump foo)) 12) 4)
; execute
(foo 3 4) => 7
Peter