Ver Mensaje Individual
  #2  
Antiguo 09-07-2024
Avatar de Casimiro Noteví
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.669
Reputación: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
¿Te refieres al firewall?
Algo así:
Código Delphi [-]
uses
  Winapi.Windows, Winapi.ShellAPI, System.SysUtils;

procedure AddFirewallRule;
var
  Command: string;
begin
  // Comando para agregar una regla al firewall de Windows
  Command := 'netsh advfirewall firewall add rule name="Firebird 3050" dir=in action=allow protocol=TCP localport=3050';

  // Ejecutar el comando usando ShellExecute
  ShellExecute(0, 'open', 'cmd.exe', PChar('/C ' + Command), nil, SW_HIDE);
end;

begin
  try
    AddFirewallRule;
    Writeln('Regla de firewall añadida.');
  except
    on E: Exception do
      Writeln('Error: ', E.Message);
  end;
end.
Responder Con Cita