Advertisement
waliedassar

SystemFunction0035

Jan 14th, 2013
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. //http://waleedassar.blogspot.com
  2. //http://www.twitter.com/waleedassar
  3.  
  4. //On windows 7, the cryptsp.dll exports a function called "SystemFunction035"
  5. //This function Silently detects kernel debuggers. It wraps up call to the
  6. //"ZwQuerySystemInformation" function with the "SystemInformationClass" parameter set
  7. //to SystemKernelDebuggerInformation (0x23).
  8. //If a kernel debugger is detected, the function returns 1.
  9.  
  10.  
  11. typedef unsigned long(__stdcall *SysFunc0035)(wchar_t*);
  12.  
  13. void main()
  14. {
  15.     HMODULE hM=LoadLibrary("cryptsp.dll");
  16.     if(hM)
  17.     {
  18.           SysFunc0035 SystemFunction035=(SysFunc0035)GetProcAddress(hM,"SystemFunction035");
  19.           if(SystemFunction035)
  20.           {
  21.               //This silently wraps up a call to the "ZwQuerySystemInformation" function.
  22.               unsigned long ret=SystemFunction035(L"xxxsxxxx::AnyThing::xxxxxxxxxd");
  23.               if(ret==1)
  24.               {
  25.                   printf("Kernel debugger detected!!\r\n");
  26.                   ExitProcess(-1);
  27.               }
  28.               else printf("Expected\r\n");
  29.           }
  30.           FreeLibrary(hM);
  31.     }
  32.     return;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement