Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you detect a debugger attached to your process using Div by Zero

Can you detect whether or not a debugger is attached to your native Windows process by using a high precision timer to time how long it takes to divide an integer by zero?

The rationale is that if no debugger is attached, you get a hard fault, which is handled by hardware and is very fast. If a debugger is attached, you instead get a soft fault, which is percolated up to the OS and eventually the debugger. This is relatively slow.

like image 658
John Shedletsky Avatar asked Jan 20 '12 01:01

John Shedletsky


1 Answers

Since there is absolutely nothing you can do to prevent a determined person from reverse engineering your code, no clever approach you find will be significantly better than calling IsDebuggerPresent()

like image 173
MK. Avatar answered Sep 20 '22 06:09

MK.