如何使用C ++从.exe读取/写入asm寄存器? [英] How can you read/write asm registers from an .exe using C++?

查看:103
本文介绍了如何使用C ++从.exe读取/写入asm寄存器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想修改某个程序中寄存器的值. 唯一的问题是,我不知道如何访问它.如果有办法,我该如何读写? (首选语言C ++)

I want to modify the value of a register that is in a certain program. The only problem is, I don't know how to access it. If there is a way, how do I read/write into it? (preferred language C++)

推荐答案

如果要在程序运行时一次修改特定的寄存器,则可以使用调试器(例如

If you want to modify a particular register one time while the program is running you can do so using a debugger, such as OllyDbg.

如果要在程序不运行时修改代码,以便将来在运行程序时其行为有所不同,则可以使用反汇编程序(例如 NAsm

If you want to modify the code while the program isn't running, such that in the future when you run the program it behaves differently, you can view the Assembly using a disassembler such as IDA. But you'll also need something that can reassemble the program with your modifications, such as NAsm

您还可以在Windows中使用OpenProcess()函数在两个程序都运行时将其附加到另一个程序.然后,您可以向其他进程读取和写入任意值,包括修改其代码.设置并正常工作是一件非常棘手的事情……这是调试器的工作方式,通常这是相当复杂的软件.最好是使用现有的而不是尝试自己编写一个!

You can also attach one program to another while both are running using the OpenProcess() function in windows. You can then read and write arbitrary values to the other process, including modifying it's code. This is a pretty tricky thing to set up and have work properly... It's how debuggers work, which are usually pretty complex pieces of software. Better to use an existing one than to try to write your own!

这篇关于如何使用C ++从.exe读取/写入asm寄存器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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