I am trying to find some way to 'debug' WoW from my in-process module/EndScene hook.
At first I thought I might just use VEHs plus VirtualProtect as a sort of 'virtual breakpoint'. However, I discovered that you can only change the protection attributes for an entire memory page, and couldn't see any way to single step through the entire page with a VEH.
So my second idea has been to use VEHs plus the debug registers with Get/SetThreadContext (aka hardware breakpoints). However, I've had little luck with this approach. It seems that once I login to WoW, the client or battle.net decides to set its own values to the debug registers, that point to ... frankly useless instructions.
Code:
dr0: 11857648 <--- my wanted bp
dr1: 0
dr2: 0
dr3: 0
dr0: 11857648
dr1: 0
dr2: 0
dr3: 0
dr0: 11857648
dr1: 0
dr2: 0
dr3: 0
// i login to wow here
VEH Raised at 5DD543EE <- exception_continue_search
EIP: 1574257646
EAX: 8
ESP: 3730868
VEH Raised at 5DD5444F <- exception_continue_search
EIP: 1574257743
EAX: 16
ESP: 3730864
VEH Raised at 5DD7731A <- exception_continue_search
EIP: 1574400794
EAX: 3730316
ESP: 3730292
dr0: 1567011328 <- utter garbage
dr1: 1567133824
dr2: 1567210160
dr3: 1567028000
Is it safe to overwrite these? Will WoW just write them back? Have I just missed an obvious way of doing what I would like (which is reading eax at a certain instruction without changing any opcodes T_T)