Click to See Complete Forum and Search --> : Change the value of a register?


Elden
December 13th, 2004, 07:22 AM
Hello,

is there a way to change the register value of a running program?

example: (from a debugger)

7C912927 84E4 TEST AL,AL


AL=0 and i want to change it to 1 and freeze the value so it always stay to 1. It's possible to do it with a debugger but i would like to learn how to code that in c++

Any advices, links?

Thx

kahlinor
December 14th, 2004, 12:06 AM
I don't understand what you mean. Registers can't be 'frozen' to a specific value, especially one that is used for return values (al).

The easiest way to preserve a register value is to constantly push and pop the register before and after any code that changes it. Alternatevely, you can store it into a variable and recover it later.

NoHero
December 15th, 2004, 01:53 PM
I don't understand what you mean. Registers can't be 'frozen' to a specific value, especially one that is used for return values (al).

The easiest way to preserve a register value is to constantly push and pop the register before and after any code that changes it. Alternatevely, you can store it into a variable and recover it later.

Correct. And changing registry values during runtime may cause damage because you may delete a value that is needed. So don't mess up with changing registry values. (Believe this: on an x86 there is no way to freeze and/or lock registrys and/or its value).

Maven
December 18th, 2004, 05:48 PM
Hello,

is there a way to change the register value of a running program?

example: (from a debugger)

7C912927 84E4 TEST AL,AL


AL=0 and i want to change it to 1 and freeze the value so it always stay to 1. It's possible to do it with a debugger but i would like to learn how to code that in c++

Any advices, links?

Thx

Trying to get rid of cd protection eh? LOL

psss you hex it from the exe file.