Log in

View Full Version : code injection problem


razzytaz
September 19th, 2004, 04:06
hi, this is not exactly a crack

I'm trying to change a program that is similar to weatherbug. it displays the temperature in the systray but I want it in Celsius and it only displays it in Faerenheit

So I disassembled the program and found the spot where I want to change something. I tested it out so that if I changed the eax register to any temperature, it would display that, which is good.

The problem is when I want to insert something like:
isub eax, 32h
imul eax, 5h
idiv eax, 9h
in order to convert the temperature, there isn't any space because this needs to be changed between these two lines:
.text:00404E5C call sub_403B95
.text:00404E61 cmp eax, 0B4h

So I read some tutorials about code injection, and can't find any good place to put my code. Then I decided to remove some useless messagebox function in some other part of the code and put my code there. But when I try to replace the code in hiew, hiew says "operand size do not match or missing". Now I understand it's because I want to change:
push 0
to
isub 20h
and the sizes are different, but how do I get around this?

And my other question is, is there a better way to do this without code injection?

Thanks for reading my lengthy post

zombie8
September 19th, 2004, 04:26
Why don't you add another section to the executable and put your code there? I think "code snippet creator" can do that. Then replace "cmp eax, 0B4h" with a jump to your code. And don't forget to put "cmp eax, 0B4h" at the end of the "patcher", just before returning to the instruction after 00404E61. This should work... if the program has no CRC check.

zombie

gook
September 19th, 2004, 05:16
Hello Razzytaz,

The message you get in hiew saying the sizes do not match is a syntax problem. For example, try assembling "mov eax, al". It will give you that exact same error.

Just "sub 20h" won't work by the way. What you probably want is "sub eax, 20h"

razzytaz
September 19th, 2004, 19:15
ah, that was the problem. hiew recognizes sub eax, 20h

I finally got it after hours of work today I kept forgetting certain instructions or jmp ing to the wrong place, or messing up the stack but now it works!

thanks for the help guys