0rp
August 25th, 2004, 04:59
hi,
i wrote a driver, which enables the GD (general detection) bit in the DR7 reg. if this bit is set, any access to one of the debugregs (like mov eax, dr2) results in an int 1 exception.
i also hook int 1 to catch these exceptions, and handle them my own way (i never write to the DR regs or return fake values from them).
this idea isn't new, it is based on yates' DRxLOG.
everything seems to work, a doom3 start looks like this (safedisc debug checks):
code=mov dr6, ebx, image=winlogon.exe, addr=804DDD26, fake=yes
code=mov dr7, ecx, image=winlogon.exe, addr=804DDD29, fake=yes
code=mov eax, dr1, image=Doom3.org.exe, addr=B29E88A4, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E88BA, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov dr7, ebx, image=winlogon.exe, addr=804DE049, fake=yes
code=mov dr0, esi, image=winlogon.exe, addr=804DE04C, fake=yes
code=mov dr1, edi, image=winlogon.exe, addr=804DE052, fake=yes
but i have a little problem (yates' driver too): if i start a random app (notepad) from ollly, no new exceptions are thrown.
it seems, that olly is able to set the DR7.GD bit to 0 and disables the GD exception.
but how? any access to DR7 should be faked through my handler ?!
the code of this driver is attached
i wrote a driver, which enables the GD (general detection) bit in the DR7 reg. if this bit is set, any access to one of the debugregs (like mov eax, dr2) results in an int 1 exception.
i also hook int 1 to catch these exceptions, and handle them my own way (i never write to the DR regs or return fake values from them).
this idea isn't new, it is based on yates' DRxLOG.
everything seems to work, a doom3 start looks like this (safedisc debug checks):
code=mov dr6, ebx, image=winlogon.exe, addr=804DDD26, fake=yes
code=mov dr7, ecx, image=winlogon.exe, addr=804DDD29, fake=yes
code=mov eax, dr1, image=Doom3.org.exe, addr=B29E88A4, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E88BA, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov eax, dr7, image=Doom3.org.exe, addr=B29E892B, fake=yes
code=mov dr7, ebx, image=winlogon.exe, addr=804DE049, fake=yes
code=mov dr0, esi, image=winlogon.exe, addr=804DE04C, fake=yes
code=mov dr1, edi, image=winlogon.exe, addr=804DE052, fake=yes
but i have a little problem (yates' driver too): if i start a random app (notepad) from ollly, no new exceptions are thrown.
it seems, that olly is able to set the DR7.GD bit to 0 and disables the GD exception.
but how? any access to DR7 should be faked through my handler ?!
the code of this driver is attached