c 库 x86/x64 汇编程序 [英] c library x86/x64 assembler

查看:45
本文介绍了c 库 x86/x64 汇编程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有用于将 x86/x64 汇编字符串组装为操作码的 C 库?

Is there a C library for assembling a x86/x64 assembly string to opcodes?

示例代码:

/* size_t assemble(char *string, int asm_flavor, char *out, size_t max_size); */

unsigned char bytes[32];
size_t size = assemble("xor eax, eax
"
                       "inc eax
"
                       "ret",
                       asm_x64, &bytes, 32);

for(int i = 0; i < size; i++) {
    printf("%02x ", bytes[i]);
}

/* Output: 31 C0 40 C3 */

我查看了 asmpure,但是它需要修改才能在非 Windows 机器上运行.

I have looked at asmpure, however it needs modifications to run on non-windows machines.

实际上我需要一个汇编器和一个反汇编器,有没有一个库可以同时提供两者?

I actually both need an assembler and a disassembler, is there a library which provides both?

推荐答案

Keystone 看起来像一个现在很好的选择,但是当我问这个问题时它不存在.

Keystone seems like a great choice now, however it didn't exist when I asked this question.

这篇关于c 库 x86/x64 汇编程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆