home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Fravia / fravia / meltice.c < prev    next >
C/C++ Source or Header  |  2000-05-25  |  2KB  |  83 lines

  1. //////////////////////////////////////////////////////////////////////
  2. //
  3. // MeltICE - SoftICE '95 version 3 detection - Made by David Eriksson
  4. // ==================================================================
  5. //
  6. // Disclaimer
  7. // ~~~~~~~~~~
  8. // I take no responsibility for the authenticity of this information,
  9. // or the results of the use or misuse of the source code.
  10. // 
  11. // SoftICE is a trademark of NuMega Technologies, Inc.
  12. // 
  13. #include <stdio.h>
  14. #define WIN32_LEAN_AND_MEAN
  15. #include <windows.h>
  16.  
  17. //////////////////////////////////////////////////////////////////////
  18. //
  19. // See if SoftICE version 3.x for Windows 95 is loaded
  20. //
  21. BOOL IsSoftIce95Loaded()
  22. {
  23.     HANDLE hFile;  
  24.  
  25.     // "\\.\SICE" without escape stuff
  26.     hFile = CreateFile( "\\\\.\\SICE",    
  27.                         GENERIC_READ | GENERIC_WRITE,
  28.                         FILE_SHARE_READ | FILE_SHARE_WRITE,
  29.                         NULL,
  30.                         OPEN_EXISTING,
  31.                         FILE_ATTRIBUTE_NORMAL,
  32.                         NULL);
  33.  
  34.     if( hFile != INVALID_HANDLE_VALUE )
  35.     {
  36.         CloseHandle(hFile);
  37.         return TRUE;
  38.     }
  39.  
  40.     return FALSE;
  41. }
  42.  
  43. //////////////////////////////////////////////////////////////////////
  44. //
  45. // See if SoftICE version 3.x for Windows NT is loaded
  46. //
  47. BOOL IsSoftIceNTLoaded()
  48. {
  49.     HANDLE hFile;  
  50.  
  51.     // "\\.\NTICE" without escape stuff
  52.     hFile = CreateFile( "\\\\.\\NTICE",
  53.                         GENERIC_READ | GENERIC_WRITE,
  54.                         FILE_SHARE_READ | FILE_SHARE_WRITE,
  55.                         NULL,
  56.                         OPEN_EXISTING,
  57.                         FILE_ATTRIBUTE_NORMAL,
  58.                         NULL);
  59.  
  60.     if( hFile != INVALID_HANDLE_VALUE )
  61.     {
  62.         CloseHandle(hFile);
  63.         return TRUE;
  64.     }
  65.  
  66.     return FALSE;
  67. }
  68.  
  69. //////////////////////////////////////////////////////////////////////
  70. //
  71. // Example code for calling these functions
  72. //
  73. int main(void)
  74. {
  75.     if( IsSoftIce95Loaded() )
  76.         printf("SoftICE for Windows 95 is active!\n");
  77.     else if( IsSoftIceNTLoaded() )
  78.         printf("SoftICE for Windows NT is active!\n");
  79.     else
  80.         printf("Can't find SoftICE with this method!\n");
  81.  
  82.     return 0;
  83. }