MCPcopy Create free account
hub / github.com/NoMercy-ac/NoMercy / ClearDebugRegisters

Method ClearDebugRegisters

Source/Client/NM_Engine/ThreadHelper.cpp:104–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void CThread::ClearDebugRegisters()
105{
106 auto registerCleaner = [](LPVOID lpParam) -> DWORD
107 {
108 auto hThread = (HANDLE)lpParam;
109
110 CONTEXT ctx = { 0 };
111 ctx.ContextFlags = CONTEXT_ALL;
112
113 if (LI_FIND(SuspendThread)(hThread) == (DWORD)-1)
114 {
115 DEBUG_LOG(LL_ERR, xorstr("C!g_winapiApiTable->SuspendThread").crypt_get());
116 return 0;
117 }
118
119 if (!LI_FIND(GetThreadContext)(hThread, &ctx))
120 {
121 DEBUG_LOG(LL_ERR, xorstr("C!g_winapiApiTable->GetThreadContext").crypt_get());
122 return 0;
123 }
124
125 if (ctx.Dr0)
126 {
127 DEBUG_LOG(LL_DEV, "Cctx.Dr0: %p cleaned!", ctx.Dr0);
128 ctx.Dr0 = 0;
129 }
130 if (ctx.Dr1)
131 {
132 DEBUG_LOG(LL_DEV, "Cctx.Dr1: %p cleaned!", ctx.Dr1);
133 ctx.Dr1 = 0;
134 }
135 if (ctx.Dr2)
136 {
137 DEBUG_LOG(LL_DEV, xorstr("Cctx.Dr2: %p cleaned!").crypt_get(), ctx.Dr2);
138 ctx.Dr2 = 0;
139 }
140 if (ctx.Dr3)
141 {
142 DEBUG_LOG(LL_DEV, xorstr("Cctx.Dr3: %p cleaned!").crypt_get(), ctx.Dr3);
143 ctx.Dr3 = 0;
144 }
145 if (ctx.Dr7)
146 {
147 DEBUG_LOG(LL_DEV, xorstr("Cctx.Dr7: %p cleaned!").crypt_get(), ctx.Dr7);
148 ctx.Dr7 = 0;
149 }
150
151 if (!LI_FIND(SetThreadContext)(hThread, &ctx))
152 {
153 DEBUG_LOG(LL_ERR, xorstr("C!g_winapiApiTable->SetThreadContext").crypt_get());
154 return 0;
155 }
156
157 if (LI_FIND(ResumeThread)(hThread) == (DWORD)-1)
158 {
159 DEBUG_LOG(LL_ERR, xorstr("!g_winapiApiTable->ResumeThread").crypt_get());
160 return 0;
161 }

Callers 1

OnThreadCreatedMethod · 0.80

Calls 1

CreateThreadMethod · 0.45

Tested by

no test coverage detected