将 OMF16 转换为 OBJ32
有没有办法将 OMF 16 位目标文件格式转换为 COFF 32 位目标文件格式?
Is there a way to convert from OMF 16 bit object file format to COFF 32 bit object file format?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我严重怀疑是否存在这样的人。设计在 16 位环境中运行的代码与 32 位模式二进制不兼容。例如,有一条指令告诉 CPU 为即将到来的指令翻转位大小。在 16 位模式下,需要这样的指令才能使用 32 位指令。然而,在 32 位模式下使用 16 位指令需要相同的操作码。
一系列操作码是否假定为 16 位或 32 位在段描述符中指定。
无论如何,如果您想在 32 位模式下使用 16 位代码,并且没有操作系统依赖性,您可以通过使用 IDA 反汇编它来使用它,然后使用 32 位汇编器重新编译它。当然,前提是其许可证允许。 (虽然这可能是合理使用,但 IANAL)。
如果代码也与底层操作系统绑定,这可能会困难得多,并且可能需要重写代码的重要部分。
I seriously doubt there would exist one. Code designed to be ran in 16 bit environment is binary incompatible with 32 bit mode. For example there's an instruction that tells the CPU to flip bit sizes for the upcoming instruction. In 16 bit mode such an instruction is needed to use 32 bit instructions. However the same opcode is needed to use 16 bit instructions in 32 bit mode.
Whether a series of opcodes are to be assumed to be 16 or 32 bits is specified in the segment descriptor.
Anyway, if you have 16 bit code that you'd like to use in 32 bit mode, that has no OS dependencies, you can use that by disaassembling it using IDA, then recompile it with a 32bit assembler. Of course only if that's permitted by its license. (although this could be fair use, but IANAL).
If the code is also tied to the underlying OS, this could be a lot more difficult, and would require to rewrite perhaps significant portions of the code.
大概 OMF16 代码的目标是 16 位 x86 实模式或 286 保护模式?既然如此,目标文件格式并不是真正的问题,代码本身完全不兼容,因为它使用不同的寄存器大小和不同的寻址方案。
此外,如果代码针对 DOS、Win16 或 OS/2(即使用 OMF16 的系统),那么将其针对 32 位目标不仅仅是转换目标文件格式的情况。
您需要从源代码重建,该源代码为问题提供标签是 C 还是 C++?要么您手上有一项重要的逆向工程任务!
Presumably the OMF16 code targets 16 bit x86 real-mode or 286 protected mode? That being the case, the object file format is not really your issue, the code itself is entirely incompatible since it uses different register sizes and a different addressing scheme.
Moreover if the code is targetted for DOS, Win16 or OS/2 (i.e. systems that used OMF16), then targeting it to a 32 bit target is not just a case of converting the object file format.
You need to rebuild from the source which give the tags to the question is either C or C++? Either that or you have a significant reverse engineering task on your hands!
我在网上搜索了一下,发现了这些链接:
第一个是工具集合:
http://sourceware.org/binutils/
第二个是我认为你需要的工具:
http://sourceware.org/binutils/docs/binutils/objcopy.html
它们并非在所有情况下都有效(上面的 bazsi77),只需测试一下即可。
I've searched on the net, and found these links:
The first one is a collection of tools:
http://sourceware.org/binutils/
The second one is a tool I think you need:
http://sourceware.org/binutils/docs/binutils/objcopy.html
They are not work in all cases(bazsi77 above), just test it.