Hello! Surely there are some ways to add * .exe file to the list of allowed Windows firewalls. Maybe you know how? Thank you =)

UPD: To do this in principle is real! Here is the implementation in PHP:

passthru("netsh firewall add allowedprogram %WINDIR%\system32\myapp.exe TCPInfrastructure>nul 2>&1"); 

And how to do the same, but in Delphi, the desktop language?

  • So when you first start the dialogue is issued - "allow" or "ban." Taking actions for the user is not correct. - Alex Kapustin pm
  • It doesn’t roll like that, because communication with any resource of the outside world from the local is considered potentially dangerous ... - AseN

1 answer 1

Um ...

In the legal form ... designers of installation packages can do this (Wise - for sure).

In the other view, it can probably be done via API calls or manipulating the registry. But for this you just need a minimum of admin rights. And most likely UAC won't do it on the sly, and it will be right))

  • Has added the question above. This is really done, for example, in PHP! - AseN
  • Probably something like: ShellExecute (Handle, 'open', 'netsh', 'firewall add allowedprogram% WINDIR% \ system32 \ myapp.exe TCPInfrastructure> nul 2> & 1', nil, SW_SHOWNORMAL); - SilverIce
  • @SilverIce Already very likely. Do not forget that this is all WinApi, respectively, you need to connect ShellApi - stck
  • These are Delphi troubles. I have nothing to do with it) But this is all garbage. You will get a lot of fun when you find that you’re still going over networks for NAT (you don’t pick the firewall for it to be outgoing (they are all allowed by default), but for incoming to this machine and your prog). Although, if the software is local, then there should be no problems. By the way. Without admin rights works? - SilverIce