Mitch Denny has written some sample code that lets developers more easily interact with the new firewall design that is part of Windows XP Service Pack 2 (SP2). Denny said that his code, FirewallPermission, "is a custom permission and associated declaritive security attribute which uses the Windows Firewall COM interfaces to check whether a program has inbound access on a port enabled."
Tony Goodhew, a Microsoft employee who works with the XP SP2 team, explained that Denny's code is basically the creation of custom attributes that can be used by an application to tell the firewall to open a given port number or to authorize an application for access through the firewall. Goodhew added that Denny's code simplifies working with the new firewall design.
Denny's code was written with Microsoft Visual Studio .NET. He said that if there is interest in the code then he will add to it by extending its capabilities for more fine-grained control over the firewall access permissions. Interested developers can download a copy at Denny's Web site.