Skip to content

Instantly share code, notes, and snippets.

@spnow
Forked from evernick/GetSystemTime.cpp
Created August 1, 2017 23:10
Show Gist options
  • Save spnow/7ea09f5a9b1671f38c872eef530bb39b to your computer and use it in GitHub Desktop.
Save spnow/7ea09f5a9b1671f38c872eef530bb39b to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <stdio.h>
BOOL anti_debug(SYSTEMTIME s_time1, FILETIME f_time1)
{
SYSTEMTIME s_time2;
FILETIME f_time2;
GetSystemTime(&s_time2);
SystemTimeToFileTime(&s_time2, &f_time2);
if ((f_time2.dwLowDateTime - f_time1.dwLowDateTime)/10000 > 1000) {
return 1;
}
return 0;
}
int main(int argc, char **argv)
{
SYSTEMTIME s_time1;
FILETIME f_time1;
GetSystemTime(&s_time1);
SystemTimeToFileTime(&s_time1, &f_time1);
if(anti_debug(s_time1,f_time1))
printf("Debugger Detected\n");
else
printf("No Debugger...\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment