dylank 0 Junior Poster in Training

Hi, I am creating a crackme (or possibly keygenme, if i feel like it) that realys on a IsDebuggerPresent call to see if the user has olly or another debugger open analyzing it. My current code reads as follows:

#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <ctime>
using namespace std;

void debuggerPresent() {
         SYSTEMTIME st, lt;
    
    GetSystemTime(&st);
    GetLocalTime(&lt);
     cout << "Application error or Debugger Present!!!" << endl;
     return;
     }

void noDebug(int mode){
         SYSTEMTIME st, lt;
    
    GetSystemTime(&st);
    GetLocalTime(&lt);
     if(mode = st.wMonth) {
             //Do the main username/password thing here....
     }
     else {
          debuggerPresent();
     }
     return;
}
     
     

int main() {
    BOOL WINAPI IsDebuggerPresent(void);

    SYSTEMTIME st, lt;
    
    GetSystemTime(&st);
    GetLocalTime(&lt);

    int day = st.wMonth;
    
    if(!IsDebuggerPresent) {
         noDebug(day);
         return 0;
         }
    if(IsDebuggerPresent) {
         debuggerPresent();
         system("pause");
         return 0;
         }
    
    return 0;
}

I am getting this error:

41 C:\Dev-Cpp\files\crackMes\debuggerPresent\ver1.cpp [Warning] the address of `BOOL IsDebuggerPresent()', will always evaluate as `true' 
45 C:\Dev-Cpp\files\crackMes\debuggerPresent\ver1.cpp [Warning] the address of `BOOL IsDebuggerPresent()', will always evaluate as `true'

Why is IsDebuggerPresent always returning true?
Also, for those wondering, the date is there to make sure they dont just patch the program to just JMP to the main code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.