Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I add some ports on the firewall

17 views
Skip to first unread message

Bob D

unread,
Oct 24, 2006, 4:23:19 AM10/24/06
to
Hello,

how can I determinate if the firewall is enabled on Windows XP?
And then, to add two ports? One TCP, one UDP?

As long as my software is 100% legal, Im doing this to make user's life
easier. Also, I dont care to make it silently. If windows will display a
warning for firewall changes, its ok with me!

Thanks


Brian Evans

unread,
Oct 24, 2006, 10:13:50 AM10/24/06
to

The command line utility NETSH can be used to do this.
http://www.microsoft.com/technet/prodtechnol/winxppro/deploy/depfwset/wfsp2apb.mspx

Brian

Bob D

unread,
Oct 24, 2006, 10:53:10 AM10/24/06
to
Unfortunatelly, netsh is a windows tool and it uses different language
according to windows installation, so in my case its

C:\>netsh firewall show state

Firewall status:
-------------------------------------------------------------------
Profile = Standard
Operational mode = Disable
Exception mode = Enable

...

but for a German windows its going to be different. So its very difficult or
impossible to handle it like this.

any delphi-hardcore way to handle firewall rules?

Thanks


"Brian Evans" <NOS...@rogers.com> wrote in message
news:453e1fa4$1...@newsgroups.borland.com...

Kevin Powick

unread,
Oct 24, 2006, 11:14:11 AM10/24/06
to
Bob D wrote:

> Hello,
>
> how can I determinate if the firewall is enabled on Windows XP?
> And then, to add two ports? One TCP, one UDP?

I think you just try to access the ports with your app, and if Windows
Firewall is blocking, it tells the user that your app is trying to
access and asks should Win Firewall keep blocking or allow this app.

That happens on my machine all the time with new software that needs
port access.


--
Kevin Powick

GrandmasterB

unread,
Oct 24, 2006, 1:31:40 PM10/24/06
to
"Bob D" <bo...@demo.it> wrote in message
news:453dcd91$1...@newsgroups.borland.com...

> how can I determinate if the firewall is enabled on Windows XP?
> And then, to add two ports? One TCP, one UDP?

In WinXP SP2 or later windows will detect that a program wants to listen on
a port and ask the user if they want to allow it to do so. Most other up to
date software firewalls do this too. Before that I believe it needs to be
opened manually by the user.

The real tricky problem is routers. Look around for info on using Universal
Plug and Play to configure the routers from within your program (if the
router supports UPnP - most new ones do). IIRC, it wasnt too difficult -
there's a com interface you can use.

Markus Landwehr

unread,
Oct 24, 2006, 4:18:33 PM10/24/06
to
Look in borland.public.attachments for "XP Firewall for Bob D". It's a litle
console app with german comments.

HTH

Markus

"Bob D" <bo...@demo.it> schrieb im Newsbeitrag
news:453dcd91$1...@newsgroups.borland.com...

Bob D

unread,
Oct 24, 2006, 4:25:39 PM10/24/06
to
Thanks!

But, I run it and nothing happens. Not even a single message !
Whats wrong?

Thanks

"Markus Landwehr" <Markus....@uni.de> wrote in message
news:453e...@newsgroups.borland.com...

Markus Landwehr

unread,
Oct 24, 2006, 5:07:38 PM10/24/06
to
It's a program, that add's some ports to the firewall. Before that, it
checks if XP-Firewall is active and so on. It does not show messages, if the
needed ports are already open (for example if the firewall is off)

Its not a program that you can call with parameters. The ports are hard
coded. I use it to open ports, that are needed by an other program. I can
sipply start it and now my customers don't need to change something in the
xp-Firewall.

Please look at
const
DCNFirewallItems : Array [0..4] of ....

That array can be extended/changed. For each entry you can set Name,
Protocol and Port. These are registered as "exception" in the xp-Firewall.

If you compiled the program (i use Delphi 5) and started it, then look in
your xp-Firewall. You should find some entrys with "DCN ...".

Markus

"Bob D" <bo...@demo.it> schrieb im Newsbeitrag

news:453e...@newsgroups.borland.com...

Remy Lebeau (TeamB)

unread,
Oct 24, 2006, 5:10:43 PM10/24/06
to

"Bob D" <bo...@demo.it> wrote in message
news:453dcd91$1...@newsgroups.borland.com...

> how can I determinate if the firewall is enabled on Windows XP?


> And then, to add two ports? One TCP, one UDP?

Windows XP SP2 introduced a COM-based API for accessing the firewall.

Windows Firewall and Windows Firewall with Advanced Security

http://msdn.microsoft.com/library/en-us/ics/ics/windows_firewall_start_page.asp

In particular, look at the INetFwProfile::FirewallEnabled property, and the
INetFwOpenPorts::Add() method.


Gambit


Bob D

unread,
Oct 24, 2006, 6:17:11 PM10/24/06
to
Yes, I got that but my firewall was OFF. Thats why.

Now it works!

Stefan Meisner

unread,
Oct 25, 2006, 7:17:16 PM10/25/06
to
Hallo Markus!
Habe das im Betreff genante Attachment von Dir gesehen.
Erlaubst Du mir, den Code für meine Shareware 'DDObjects'
zu adaptieren? Selbstverständlich mit Nennung Deines Namens
oder anderer von Dir gewünschter Infos in der ReadMe ;-)
Viele Grüsse
Stefan Meisner

www.delphi-online.at


Markus Landwehr

unread,
Oct 26, 2006, 8:07:54 AM10/26/06
to
Hallo Stefan,

kein Problem.

Gruß, Markus

"Stefan Meisner" <stefan....@chello.at> schrieb im Newsbeitrag
news:453f...@newsgroups.borland.com...

0 new messages