Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Question: Nops and ZF

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
cryptickxx
Newbie cheater
Reputation: 0

Joined: 03 Feb 2007
Posts: 23

PostPosted: Tue Jan 29, 2008 4:28 am    Post subject: Question: Nops and ZF Reply with quote

Sorry if this is a noob question. I would search, but the concept is too broad and gives me too many unwanted results that do not answer my question.

Well anyways. Is there a relationship between nops and ticking ZF flags? Like if ZF flags or to make it zeroes at that address then should it be the same as changing bytes to no operations?

Or am I completely off track? lol.
Back to top
View user's profile Send private message
Labyrnth
Moderator
Reputation: 10

Joined: 28 Nov 2006
Posts: 6301

PostPosted: Tue Jan 29, 2008 8:22 am    Post subject: Reply with quote

Off track.

Nops is not zeros like some think.

nop = 90 in bytes
ZF = zero flag

Ticking the flag sets it from 1 to 0 or 0 to 1 depending on the situation.
So if the flag was for je and you ticked the z flag it would be like doing jnz.
ZF = 1 yes im going to jump/ 0 no im not going to jump or the other way around as well. * Depending on situation.
je = jump if equal/ Bytes =74
jnz = jump if not zero/ Bytes = 75
nop = 90


Last edited by Labyrnth on Tue Jan 29, 2008 12:48 pm; edited 2 times in total
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Jan 29, 2008 12:37 pm    Post subject: Reply with quote

Expanding on that a little bit, when the processor sees the NOP instruction, it will do "no operation". As Labyrnth said, NOP has the bytes 90.

ZF is one of the flags from the EFLAGS 32 bit register. Code execution in the assembly language is nearly controlled categorically by the state of certain flags. ZF or the Zero Flag is set when the last instruction resulted in a 0. For example, this instruction:

CMP EAX,0

If EAX = 0, then the difference is 0 therefore the compare results in the zero flag being set. Otherwise the Zero Flag will not be set. The flag's status in this case is known as "clear".

In terms of any particular relationship between the two.. Both are used to varying extents in reverse engineering. Ticking/changing the state of ZF will often let you temporarily change the flow of the code and help you know where to patch the code. NOP can be used to get rid of functions you don't want to occur. Let's say we had the following instructions:

PUSH 0
PUSH [XXXXXXXX]
PUSH [XXXXXXXX]
PUSH 0
CALL user32.MessageBoxA

If we overwrote the last instruction (the call) with NOPs, then the message box would never pop up.

Was there any particular context you were thinking of ?
Back to top
View user's profile Send private message
Labyrnth
Moderator
Reputation: 10

Joined: 28 Nov 2006
Posts: 6301

PostPosted: Tue Jan 29, 2008 1:00 pm    Post subject: Reply with quote

Real world example of removing something.
TeamSpeak

Here is a function in Team Speak that controls how many copies of TS you can run. [PolyGamy] So to fix the application you can remove the custom function completely and it will work.


Nop the whole function.


Now Team Speak will load as many times as you execute it.
Back to top
View user's profile Send private message
cryptickxx
Newbie cheater
Reputation: 0

Joined: 03 Feb 2007
Posts: 23

PostPosted: Tue Jan 29, 2008 5:55 pm    Post subject: Reply with quote

Wow this explained a lot. Thank you very much, it was really helpful and I'm starting to understand the concepts better overall.

But it doesn't really help in what I was trying to accomplish... Would there be any way of modifying the bytes to 90/Nop via debug registers like Flag Ticking or changing the EIP/EAX/ etc?

I cannot directly change the array of bytes into nop strings since the memory region I am trying to modify is protected.



Edit:

OHHH NEVERMIND! I think I know what to do... do I just right click -> assemble -> type in nop?

Edit2: Never mind that didn't work too well either. lol
Back to top
View user's profile Send private message
Labyrnth
Moderator
Reputation: 10

Joined: 28 Nov 2006
Posts: 6301

PostPosted: Wed Jan 30, 2008 9:46 pm    Post subject: Reply with quote

You can write a script so you can toggle it as well.
Instead of having to find it every time and doing that.
Back to top
View user's profile Send private message
Spawnfestis
GO Moderator
Reputation: 0

Joined: 02 Nov 2007
Posts: 1746
Location: Pakistan

PostPosted: Thu Jan 31, 2008 7:30 am    Post subject: Reply with quote

Labyrnth wrote:
You can write a script so you can toggle it as well.
Instead of having to find it every time and doing that.

Code:

[ENABLE]
Address:
nop
[DISABLE]
Address:
originalinstructionbeforeyounoppedit

_________________

CLICK TO HAX MAPLESTORAY ^ !!!!
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Labyrnth
Moderator
Reputation: 10

Joined: 28 Nov 2006
Posts: 6301

PostPosted: Thu Jan 31, 2008 12:00 pm    Post subject: Reply with quote

Yes something like that, Might ned more then 1 nop tho Wink.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites