The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Slugsnack on June 08, 2008, 12:50:46 PM

Title: Toggling bits in FLAGS ?
Post by: Slugsnack on June 08, 2008, 12:50:46 PM
I was curious as to how I might read and write bits from the EFLAGS register after a certain instruction had executed (at a given virtual address).

I was thinking GetThreadContext/SetThreadContext, have I got my head turned in the right direction ?
Title: Re: Toggling bits in FLAGS ?
Post by: jj2007 on June 08, 2008, 03:30:48 PM
pushfd
pop eax
bt eax, n
Title: Re: Toggling bits in FLAGS ?
Post by: Slugsnack on June 08, 2008, 05:30:14 PM
Thanks, I have not come across bit instructions like this before so I'll need to do a bit of reading  ::)

Do you have any idea how I could do this for another thread without "hooking" it with a JMP ?
Title: Re: Toggling bits in FLAGS ?
Post by: jj2007 on June 08, 2008, 05:39:56 PM
OllyDbg shows the flags.
Title: Re: Toggling bits in FLAGS ?
Post by: Slugsnack on June 08, 2008, 05:59:34 PM
Yeap, that's exactly what I want to reproduce.  Olly is able to step onto any instruction and then you can change flag states at that point.  I was hoping to do the same thing but not sure how to go about doing it.