• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ r_core_seek函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中r_core_seek函数的典型用法代码示例。如果您正苦于以下问题:C++ r_core_seek函数的具体用法?C++ r_core_seek怎么用?C++ r_core_seek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了r_core_seek函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: r_core_yank_string

/* Copy a zero terminated string to the clipboard. Clamp to maxlen or blocksize. */
R_API int r_core_yank_string(RCore *core, ut64 addr, int maxlen) {
	ut64 curseek = core->offset;
	ut8 *buf = NULL;
	if (maxlen < 0) {
		eprintf ("r_core_yank_string: cannot yank negative bytes\n");
		return false;
	}
	if (addr != core->offset) {
		r_core_seek (core, addr, 1);
	}
	/* Ensure space and safe termination for largest possible string allowed */
	buf = calloc (1, core->blocksize + 1);
	if (!buf) {
		return false;
	}
	buf[core->blocksize] = 0;
	r_io_read_at (core->io, addr, buf, core->blocksize);
	if (maxlen == 0) {
		// Don't use strnlen, see: http://sourceforge.net/p/mingw/bugs/1912/
		maxlen = r_str_nlen ((const char *) buf, core->blocksize);
	} else if (maxlen > core->blocksize) {
		maxlen = core->blocksize;
	}
	r_core_yank_set (core, addr, buf, maxlen);
	if (curseek != addr) {
		r_core_seek (core, curseek, 1);
	}
	free (buf);
	return true;
}
开发者ID:csarn,项目名称:radare2,代码行数:31,代码来源:yank.c


示例2: r_core_yank_string

/* Copy a zero terminated string to the clipboard. Clamp to maxlen or blocksize. */
R_API int r_core_yank_string(RCore *core, ut64 addr, int maxlen) {
	ut64 curseek = core->offset;
	ut8 *buf = NULL;
	if (maxlen<0) {
		eprintf ("r_core_yank_string: cannot yank negative bytes\n");
		return R_FALSE;
	}
	if (addr != core->offset)
		r_core_seek (core, addr, 1);
	/* Ensure space and safe termination for largest possible string allowed */
	buf = malloc (core->blocksize + 1);
	if (!buf)
		return R_FALSE;
	buf[core->blocksize] = 0;
	r_core_read_at (core, addr, buf, core->blocksize);
	if (maxlen == 0) {
		maxlen = strnlen ((const char*)buf, core->blocksize);
	} else if (maxlen > core->blocksize) {
		maxlen = core->blocksize;
	}
	r_core_yank_set (core, addr, buf, maxlen);
	if (curseek != addr)
		r_core_seek (core, curseek, 1);
	free (buf);
	return R_TRUE;
}
开发者ID:t35t12345,项目名称:radare2,代码行数:27,代码来源:yank.c


示例3: r_core_yank

R_API int r_core_yank(struct r_core_t *core, ut64 addr, int len) {
	ut64 curseek = core->offset;
	ut8 *buf = NULL;
	if (len < 0) {
		eprintf ("r_core_yank: cannot yank negative bytes\n");
		return false;
	}
	if (len == 0) {
		len = core->blocksize;
	}
	buf = malloc (len);
	if (!buf) {
		return false;
	}
	if (addr != core->offset) {
		r_core_seek (core, addr, 1);
	}
	r_io_read_at (core->io, addr, buf, len);
	r_core_yank_set (core, addr, buf, len);
	if (curseek != addr) {
		r_core_seek (core, curseek, 1);
	}
	free (buf);
	return true;
}
开发者ID:csarn,项目名称:radare2,代码行数:25,代码来源:yank.c


示例4: r_core_visual_prompt_input

R_API void r_core_visual_prompt_input (RCore *core) {
	int ret;
	ut64 addr = core->offset;
	ut64 bsze = core->blocksize;

	r_cons_reset_colors();
	r_cons_printf("\nPress <enter> to return to Visual mode.\n");

	r_cons_show_cursor (true);
	core->vmode = false;
	ut64 newaddr = addr;
	if (curset) {
		if (ocursor != -1) {
			newaddr = core->offset + ocursor;
			r_core_block_size (core, cursor-ocursor);
		} else newaddr = core->offset + cursor;
		r_core_seek (core, newaddr, 1);
	}
	do {
		ret = r_core_visual_prompt (core);
		if (core->offset != newaddr) {
			// do not restore seek anymore
			newaddr = addr;
		}
	} while (ret);
	if (curset) {
		if (addr != newaddr) {
			r_core_seek (core, addr, 1);
			r_core_block_size (core, bsze);
		}
	}
	r_cons_show_cursor (false);
	core->vmode = true;
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:34,代码来源:visual.c


示例5: r_core_visual_seek_animation

R_API void r_core_visual_seek_animation (RCore *core, ut64 addr) {
	if (r_config_get_i (core->config, "scr.feedback")<1)
		return;
#if 0
	int i, ns = 90000;
	const char *scmd = (addr > core->offset)? "so": "s-4";
	for (i=0;i<5;i++) {
		r_core_cmd0 (core, scmd);
		r_core_visual_refresh (core);
		r_cons_flush();
		r_sys_usleep (ns);
		ns -= 1000;
	}
	r_core_seek (core, addr, 1);
#else
	if (core->offset == addr)
		return;
	r_cons_gotoxy (1, 2);
	if (addr>core->offset) {
		r_cons_printf (".----.\n");
		r_cons_printf ("| \\/ |\n");
		r_cons_printf ("'----'\n");
	} else {
		r_cons_printf (".----.\n");
		r_cons_printf ("| /\\ |\n");
		r_cons_printf ("'----'\n");
	}
	r_cons_flush();
	r_sys_usleep (90000);
#endif
	r_core_seek (core, addr, 1);
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:32,代码来源:visual.c


示例6: on_fcn_delete

static int on_fcn_delete (void *_anal, void* _user, RAnalFunction *fcn) {
	RCore *core = (RCore*)_user;
	const char *cmd = r_config_get (core->config, "cmd.fcn.delete");
	if (cmd && *cmd) {
		ut64 oaddr = core->offset;
		ut64 addr = fcn->addr;
		r_core_seek (core, addr, 1);
		r_core_cmd0 (core, cmd);
		r_core_seek (core, oaddr, 1);
	}
	return 0;
}
开发者ID:0x2F,项目名称:radare2,代码行数:12,代码来源:core.c


示例7: on_fcn_rename

static int on_fcn_rename(void *_anal, void* _user, RAnalFunction *fcn, const char *oname) {
	RCore *core = (RCore*)_user;
	const char *cmd = r_config_get (core->config, "cmd.fcn.rename");
	if (cmd && *cmd) {
// XXX: wat do with old name here?
		ut64 oaddr = core->offset;
		ut64 addr = fcn->addr;
		r_core_seek (core, addr, 1);
		r_core_cmd0 (core, cmd);
		r_core_seek (core, oaddr, 1);
	}
	return 0;
}
开发者ID:0x2F,项目名称:radare2,代码行数:13,代码来源:core.c


示例8: __seek_line_absolute

static void __seek_line_absolute(RCore *core, int numline) {
	if (numline < 1 || numline > core->print->lines_cache_sz - 1) {
		eprintf ("ERROR: Line must be between 1 and %d\n", core->print->lines_cache_sz - 1);
	} else {
		r_core_seek (core, core->print->lines_cache[numline - 1], 1);
	}
}
开发者ID:P4N74,项目名称:radare2,代码行数:7,代码来源:cmd_seek.c


示例9: r_core_visual_prompt

R_API int r_core_visual_prompt (RCore *core) {
    char buf[1024];
    int ret;
    ut64 oseek = core->offset;
#if __UNIX__
    r_line_set_prompt (Color_RESET":> ");
#else
    r_line_set_prompt (":> ");
#endif
    showcursor (core, R_TRUE);
    r_cons_fgets (buf, sizeof (buf), 0, NULL);
    if (*buf) {
        r_line_hist_add (buf);
        r_core_cmd (core, buf, 0);
        r_cons_flush ();
        ret = R_TRUE;
    } else {
        ret = R_FALSE;
        //r_cons_any_key ();
        r_cons_clear00 ();
        showcursor (core, R_FALSE);
    }
    if (curset) r_core_seek (core, oseek, 1);
    return ret;
}
开发者ID:revskills,项目名称:radare2,代码行数:25,代码来源:visual.c


示例10: r_core_magic

static void r_core_magic(RCore *core, const char *file, int v) {
	ut64 addr = core->offset;
	magicdepth = r_config_get_i (core->config, "magic.depth"); // TODO: do not use global var here
	r_core_magic_at (core, file, addr, magicdepth, v);
	if (addr != core->offset)
		r_core_seek (core, addr, R_TRUE);
}
开发者ID:commiebstrd,项目名称:radare2,代码行数:7,代码来源:cmd_magic.c


示例11: r_core_seek_delta

R_API int r_core_seek_delta(RCore *core, st64 addr) {
	ut64 tmp = core->offset;
	int ret;
	if (addr == 0) {
		return true;
	}
	if (addr > 0LL) {
		/* TODO: check end of file */
		addr += tmp;
	} else {
		/* check < 0 */
		if (-addr > tmp) {
			addr = 0;
		} else {
			addr += tmp;
		}
	}
	core->offset = addr;
	ret = r_core_seek (core, addr, 1);
	//ret = r_core_block_read (core);
	//if (ret == -1)
	//	memset (core->block, 0xff, core->blocksize);
	//	core->offset = tmp;
	return ret;
}
开发者ID:f0829,项目名称:radare2,代码行数:25,代码来源:cio.c


示例12: seek_to_register

static void seek_to_register(RCore *core, const char *input, bool is_silent) {
	ut64 off;
	if (core->io->debug) {
		off = r_debug_reg_get (core->dbg, input);
		if (!is_silent) {
			r_io_sundo_push (core->io, core->offset, r_print_get_cursor (core->print));
		}
		r_core_seek (core, off, 1);
	} else {
		RReg *orig = core->dbg->reg;
		core->dbg->reg = core->anal->reg;
		off = r_debug_reg_get (core->dbg, input);
		core->dbg->reg = orig;
		if (!is_silent) {
			r_io_sundo_push (core->io, core->offset, r_print_get_cursor (core->print));
		}
		r_core_seek (core, off, 1);
	}
}
开发者ID:P4N74,项目名称:radare2,代码行数:19,代码来源:cmd_seek.c


示例13: __seek_line_relative

static void __seek_line_relative(RCore *core, int numlines) {
	int curr = r_util_lines_getline (core->print->lines_cache, core->print->lines_cache_sz, core->offset);
	if (numlines > 0 && curr + numlines >= core->print->lines_cache_sz - 1) {
		eprintf ("ERROR: Line must be < %d\n", core->print->lines_cache_sz - 1);
	} else if (numlines < 0 && curr + numlines < 1) {
		eprintf ("ERROR: Line must be > 1\n");
	} else {
		r_core_seek (core, core->print->lines_cache[curr + numlines - 1], 1);
	}
}
开发者ID:P4N74,项目名称:radare2,代码行数:10,代码来源:cmd_seek.c


示例14: r_core_visual_mark_seek

static void r_core_visual_mark_seek(RCore *core, ut8 ch) {
	if (!marks_init) {
		int i;
		for (i=0;i<UT8_MAX;i++)
			marks[i] = 0;
		marks_init = 1;
	}
	if (marks[ch])
		r_core_seek (core, marks[ch], 1);
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:10,代码来源:visual.c


示例15: r_core_visual_prompt_input

R_API void r_core_visual_prompt_input (RCore *core) {
	int ret;
	eprintf ("Press <enter> to return to Visual mode.\n");
	do {
		ut64 addr = core->offset;
		ut64 bsze = core->blocksize;
		if (curset) {
			if (ocursor != -1) {
				r_core_block_size (core, cursor-ocursor);
				r_core_seek (core, core->offset + ocursor, 1);
			} else r_core_seek (core, core->offset + cursor, 1);
		}
		ret = r_core_visual_prompt (core);
		if (curset) {
			r_core_seek (core, addr, 1);
			r_core_block_size (core, bsze);
		}
	} while (ret);
}
开发者ID:dialeth,项目名称:radare2,代码行数:19,代码来源:visual.c


示例16: r_core_yank

R_API int r_core_yank(struct r_core_t *core, ut64 addr, int len) {
	ut64 oldbsz = 0LL;
	ut64 curseek = core->offset;
	free (core->yank_buf);
	core->yank_buf = (ut8 *)malloc (len);
	if (addr != core->offset)
		r_core_seek (core, addr, 1);
	if (len == 0)
		len = core->blocksize;
	if (len > core->blocksize) {
		oldbsz = core->blocksize;
		r_core_block_size (core, len);
	}
	memcpy (core->yank_buf, core->block, len);
	core->yank_off = addr;
	core->yank_len = len;
	if (curseek != addr)
		r_core_seek (core, curseek, 1);
	if (oldbsz)
		r_core_block_size (core, oldbsz);
	return R_TRUE;
}
开发者ID:0xroot,项目名称:radare2,代码行数:22,代码来源:yank.c


示例17: r_core_yank

R_API int r_core_yank(struct r_core_t *core, ut64 addr, int len) {
	ut64 curseek = core->offset;
	ut8 *buf = NULL;
	if (len<0) {
		eprintf ("r_core_yank: cannot yank negative bytes\n");
		return R_FALSE;
	}
	if (len == 0) len = core->blocksize;
	//free (core->yank_buf);
	buf = malloc (len);
	//core->yank_buf = (ut8 *)malloc (len);
	if (addr != core->offset)
		r_core_seek (core, addr, 1);

	r_core_read_at (core, addr, buf, len);
	r_core_yank_set (core, addr, buf, len);

	if (curseek != addr)
		r_core_seek (core, curseek, 1);
	free (buf);
	return R_TRUE;
}
开发者ID:t35t12345,项目名称:radare2,代码行数:22,代码来源:yank.c


示例18: r_core_visual_prompt

R_API void r_core_visual_prompt (RCore *core) {
	char buf[1024];
	ut64 oseek = core->offset;
#if __UNIX__
	r_line_set_prompt (Color_RESET":> ");
#else
	r_line_set_prompt (":> ");
#endif
	r_cons_show_cursor (R_TRUE);
	r_cons_fgets (buf, sizeof (buf), 0, NULL);
	r_line_hist_add (buf);
	r_core_cmd (core, buf, 0);
	r_cons_any_key ();
	r_cons_clear00 ();
	r_cons_show_cursor (R_FALSE);
	if (curset) r_core_seek (core, oseek, 1);
}
开发者ID:Missuniverse110,项目名称:radare2,代码行数:17,代码来源:visual.c


示例19: main

int main (int argc, char **argv) {
	r_anal_esil_set_pc (core->anal->esil, fcn ? fcn->addr : core->offset);
	switch (*input) {
	case '\0': // "aft"
	{
		seek = core->offset;
		r_anal_esil_set_pc (core->anal->esil, fcn ? fcn->addr : core->offset);
		r_core_anal_type_match (core, fcn);
		r_core_seek (core, seek, true);
		break;
	}
	case '?':
	default:
		r_core_cmd_help (core, help_msg_aft);
		break;
	}
	return 0;
}
开发者ID:aronsky,项目名称:radare2,代码行数:18,代码来源:indent-example.c


示例20: findNextWord

static void findNextWord (RCore *core) {
	int i, d = curset? cursor: 0;
	for (i = d+1; i<core->blocksize; i++) {
		switch (core->block[i]) {
		case ' ':
		case '.':
		case '\t':
		case '\n':
			if (curset) {
				cursor = i+1;
				ocursor = -1;
				showcursor (core, true);
			} else {
				r_core_seek (core, core->offset + i + 1, 1);
			}
			return;
		}
	}
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:19,代码来源:visual.c



注:本文中的r_core_seek函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ r_debug_is_dead函数代码示例发布时间:2022-05-30
下一篇:
C++ r_core_cmd_help函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap