This article goes into the great details of function IsDebuggerPresent and explains how it actually works in order to get the expected results. Worth a read if you've always wanted to know more about this function and how it works. https://xorl.wordpress.com/2017/11/20/reverse-engineering-isdebuggerpresent/
Malware Analysis for Incident Response