判断自身代码是否有int3断点

  // Debug版本本身代码已有很多int3, 所以仅限Release版本 #include #include DWORD g_dwStart; DWORD g_dwEnd; void GetStartAddress(void) { _asm { start: lea eax, start mov g_dwStart, eax } } void GetEndAddress(void); int main(int argc, char* argv[]) { GetStartAddress(); GetEndAddress(); char *pszFormat = "%s/n"; char *pszNothing = "Have no int3."; //printf("Start %x, End %x/n", g_dwStart, g_dwEnd); // 扫描是否有int3指令 _asm { mov eax, g_dwStart mov ebx, g_dwEnd xor edx, edx mov dl, 102 add dl, 102 nextCmp: cmp eax, ebx ja _exit cmp dl, [eax] je HaveInt3 inc eax jmp nextCmp HaveInt3: ; 有int3断点则直接退出 lea esi, ExitProcess call [esi] _exit: push pszNothing push pszFormat call printf add esp, 8 } return 0; } void GetEndAddress(void) { _asm { End: lea eax, End mov g_dwEnd, eax } }

你可能感兴趣的:(判断自身代码是否有int3断点)