Запущен ли Softice?

Материал из DRKB


// SoftIce in W9x
function IsSoftIce95Loaded: Boolean;
var
  hFile: THandle;
begin
  Result := False;
  hFile := CreateFileA('\.SICE', GENERIC_READ or GENERIC_WRITE,
    FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL, 0);
  if (hFile <> INVALID_HANDLE_VALUE) then
  begin
    CloseHandle(hFile);
    Result := TRUE;
  end;
end;

// SoftIce in NT OS
function IsSoftIceNTLoaded: Boolean;
var
  hFile: THandle;
begin
  Result := False;
  hFile := CreateFileA('\.NTICE', GENERIC_READ or GENERIC_WRITE,
    FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL, 0);
  if (hFile <> INVALID_HANDLE_VALUE) then
  begin
    CloseHandle(hFile);
    Result := TRUE;
  end;
end;

// to detect it
if IsSoftIce95Loaded or IsSoftIceNTLoaded then
  Application.Terminate;

{ if you insert a "Nag" (Message telling him he uses SoftIce) then a amatuer cracker w'll find this protection in notime }
// bestway of using this thing is in "project Unit"


Source: Delphi Knowledge Base: http://www.baltsoft.com/
ID: 04513