Skip to content

Commit

Permalink
(hopefully) fixed the second bug kao pointed out at http://lifeinhex.…
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Mar 21, 2015
1 parent 6eefe91 commit 32d72ab
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions TitanHide/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,10 @@ static NTSTATUS NTAPI HookNtSetContextThread(
Log("[TITANHIDE] NtSetContextThread by %d\n", pid);
__try
{
ProbeForWrite(&Context->ContextFlags, sizeof(ULONG), 1);
ProbeForRead(&Context->ContextFlags, sizeof(ULONG), 1);
OriginalContextFlags = Context->ContextFlags;
Context->ContextFlags &= ~0x10; //CONTEXT_DEBUG_REGISTERS ^ CONTEXT_AMD64/CONTEXT_i386
ULONG NewContextFlags = OriginalContextFlags & ~0x10; //CONTEXT_DEBUG_REGISTERS ^ CONTEXT_AMD64/CONTEXT_i386
RtlSuperCopyMemory(&Context->ContextFlags, &NewContextFlags, sizeof(ULONG));
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
Expand All @@ -214,8 +215,8 @@ static NTSTATUS NTAPI HookNtSetContextThread(
{
__try
{
ProbeForWrite(&Context->ContextFlags, sizeof(ULONG), 1);
Context->ContextFlags = OriginalContextFlags;
ProbeForRead(&Context->ContextFlags, sizeof(ULONG), 1);
RtlSuperCopyMemory(&Context->ContextFlags, &OriginalContextFlags, sizeof(ULONG));
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
Expand Down

0 comments on commit 32d72ab

Please sign in to comment.