All pastes #24432 Raw Edit

Miscellany

public text v1 · immutable
#24432 ·published 2005-10-02 12:17 UTC
rendered paste body
function DetectBT : PChar; stdcall;
var
  R : TRegistry; T,P : string;
begin
  R := TRegistry.Create;
  R.RootKey := HKEY_CLASSES_ROOT;
  if (R.KeyExists('bittorrent\shell\open\command\') = TRUE) then
  begin
    R.OpenKey('bittorrent\shell\open\command\',FALSE);
    if (R.ReadString('') <> '') then
    begin
      T := R.ReadString('');
      T := Copy(T,2,Length(T)-1);
      T := Copy(T,1,Pos('"',T)-1);
      P := T;
      T := ExtractFileName(T);
      if (LowerCase(T) = 'btdownloadgui.exe') then
        result := PChar('1|'+P)
      else
        result := '2|?';
    end
    else
    begin
      result := '2|?';
    end;
  end
  else
  begin
    result := '2|?';
  end;
  FreeAndNil(R);
end;