C++ IsDebuggerPresent Help?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2009
Posts: 19
Reputation: dylank is an unknown quantity at this point 
Solved Threads: 0
dylank dylank is offline Offline
Newbie Poster

C++ IsDebuggerPresent Help?

 
0
  #1
Nov 10th, 2009
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:
  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <iostream>
  4. #include <ctime>
  5. using namespace std;
  6.  
  7. void debuggerPresent() {
  8. SYSTEMTIME st, lt;
  9.  
  10. GetSystemTime(&st);
  11. GetLocalTime(&lt);
  12. cout << "Application error or Debugger Present!!!" << endl;
  13. return;
  14. }
  15.  
  16. void noDebug(int mode){
  17. SYSTEMTIME st, lt;
  18.  
  19. GetSystemTime(&st);
  20. GetLocalTime(&lt);
  21. if(mode = st.wMonth) {
  22. //Do the main username/password thing here....
  23. }
  24. else {
  25. debuggerPresent();
  26. }
  27. return;
  28. }
  29.  
  30.  
  31.  
  32. int main() {
  33. BOOL WINAPI IsDebuggerPresent(void);
  34.  
  35. SYSTEMTIME st, lt;
  36.  
  37. GetSystemTime(&st);
  38. GetLocalTime(&lt);
  39.  
  40. int day = st.wMonth;
  41.  
  42. if(!IsDebuggerPresent) {
  43. noDebug(day);
  44. return 0;
  45. }
  46. if(IsDebuggerPresent) {
  47. debuggerPresent();
  48. system("pause");
  49. return 0;
  50. }
  51.  
  52. return 0;
  53. }

I am getting this error:
  1. 41 C:\Dev-Cpp\files\crackMes\debuggerPresent\ver1.cpp [Warning] the address of `BOOL IsDebuggerPresent()', will always evaluate as `true'
  2. 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.
Reply With Quote Quick reply to this message  
Reply

Tags
c++, error

Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for c++, error
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC