home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Fravia / fravia / melticed.txt < prev    next >
Encoding:
Text File  |  2000-05-25  |  2.5 KB  |  103 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.  
  14. Unit meltice;
  15.  
  16. Interface
  17.  
  18. //#include <stdio.h>
  19. //#define WIN32_LEAN_AND_MEAN
  20. //#include <windows.h>
  21.  
  22. //////////////////////////////////////////////////////////////////////
  23. //
  24. // See if SoftICE version 3.x for Windows 95 is loaded
  25. //
  26. Function IsSoftIce95Loaded: boolean;
  27.  
  28. ////////////////////////////////////////////////////////////////////
  29. //
  30. // See if SoftICE version 3.x for Windows NT is loaded
  31. //
  32. Function IsSoftIceNTLoaded: boolean;
  33.  
  34.  
  35. Implementation
  36. Uses sysUtils, Windows;
  37.  
  38. Function IsSoftIce95Loaded: boolean;
  39. Var
  40.     hFile: Thandle;
  41. Begin
  42.     result := false;
  43.  
  44.  // "\\.\SICE" without escape stuff
  45.  // hFile := CreateFileA('\\\\.\\SICE',
  46.  // Note: There is no need for the escapes in Pascal, therefore
  47.  
  48.     hFile := CreateFileA('\\.\SICE',
  49.                         GENERIC_READ or GENERIC_WRITE,
  50.                         FILE_SHARE_READ or FILE_SHARE_WRITE,
  51.                         nil,
  52.       OPEN_EXISTING,
  53.       FILE_ATTRIBUTE_NORMAL,
  54.                         0);
  55.  
  56.     if( hFile <> INVALID_HANDLE_VALUE ) then begin
  57.   CloseHandle(hFile);
  58.         result := TRUE;
  59.         end;
  60. End;
  61.  
  62. Function IsSoftIceNTLoaded: boolean;
  63. Var
  64.     hFile: Thandle;
  65. Begin
  66.     result := false;
  67.  
  68.  // "\\.\NTICE" without escape stuff
  69.  //   hFile := CreateFileA('\\\\.\\NTICE',
  70.  // Note: There is no need for the escapes in Pascal, therefore
  71.  
  72.     hFile := CreateFileA('\\.\NTICE',
  73.  
  74.                         GENERIC_READ or GENERIC_WRITE,
  75.                         FILE_SHARE_READ or FILE_SHARE_WRITE,
  76.                         nil,
  77.       OPEN_EXISTING,
  78.       FILE_ATTRIBUTE_NORMAL,
  79.                         0);
  80.  
  81.     if( hFile <> INVALID_HANDLE_VALUE ) then begin
  82.   CloseHandle(hFile);
  83.         result := TRUE;
  84.         end;
  85. End;
  86.  
  87. End.
  88.  
  89. //////////////////////////////////////////////////////////////////////
  90. //
  91. // Example code for calling these functions
  92. //
  93. (*$apptype console*)
  94. Procedure Test;
  95. Begin
  96.     if IsSoftIce95Loaded then
  97.         writeln('SoftICE for Windows 95 is active!')
  98.     else if IsSoftIceNTLoaded then
  99.         writeln('SoftICE for Windows NT is active!')
  100.  else
  101.         writeln('Can''t find SoftICE with this method!');
  102. End;
  103.