* Fix RCore.read_at vapi and partial reads

This commit is contained in:
pancake 2011-04-25 20:09:09 +02:00
parent 0cd30e9a24
commit e4094a0cee
2 changed files with 7 additions and 3 deletions

View File

@ -132,8 +132,12 @@ R_API int r_core_read_at(RCore *core, ut64 addr, ut8 *buf, int size) {
return R_FALSE;
r_io_set_fd (core->io, core->file->fd); // XXX ignore ret? -- ultra slow method.. inverse resolution of io plugin brbrb
ret = r_io_read_at (core->io, addr, buf, size);
if (ret != size) {
if (ret<size && ret>0)
memset (buf+ret, 0xff, size-ret);
else memset (buf, 0xff, size);
}
if (addr>=core->offset && addr<=core->offset+core->blocksize)
r_core_block_read (core, 0);
else memset (buf, 0xff, size);
return (ret!=UT64_MAX);
}

View File

@ -75,8 +75,8 @@ public class RCore {
public void rtr_session(string input);
public void rtr_cmd(string input);
/* io */
public int read_at(uint64 addr, uint8 *buf, int size);
public int write_at(uint64 addr, uint8 *buf, int size);
public bool read_at(uint64 addr, uint8 *buf, int size);
public bool write_at(uint64 addr, uint8 *buf, int size);
//public int write_op(uint64 addr, string arg, char op);
public int block_read(bool next);
public int block_size(int size);