is there a way to add to firewall and uac exception list for XP,Vista,Win7?
Printable View
is there a way to add to firewall and uac exception list for XP,Vista,Win7?
I don't believe there is a way to add anything to the Firewall exception list and there is not an exception list for UAC. If any application could add themselves to the Firewall's exception list, it would become mute.
As for UAC, you can change the UAC settings in your project properties so that when your app runs, it automatically requests admin privileges. However, if your app will not always need admin privileges, then it is best to only call it when needed.
What are you trying to do exactly? Perhaps if you told us, we could provide a better way of doing it that would not require the User to add your application as an exception to Windows Firewall.
My application connects to net to check for updates and downloads the new files but uca blocks that and firewall doesnt allow to connect
I wouldn't know exactly what needs to be done when it comes to connecting to the internet and downloading files... but I see people wanting to do that type of thing all of the time and them not running into the type of issues you are.
I told you how you can elevate permissions. Can you show us how you're connecting to the specific site?
You can add firewall exceptions for your application, but you need to have administrator rights to do so, so you will need to get your UAC problem figured out to get it to work. To add a firewall exception, add a reference to %systemroot%\system32\FirewallAPI.dll to your application. Then you can do something like this:
Code:Imports NetFwTypeLib
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim appType As Type = Type.GetTypeFromProgID("HnetCfg.FwAuthorizedApplication")
Dim app As INetFwAuthorizedApplication
app = DirectCast(Activator.CreateInstance(appType), INetFwAuthorizedApplication)
app.Name = "Negative0's Sandbox"
app.ProcessImageFileName = "C:\Users\Negative0\Documents\Visual Studio 2008\Projects\VBSandbox2\VBSandbox2\bin\Debug\vbsandbox2.exe"
app.Enabled = True
Dim apps As INetFwAuthorizedApplications
Dim fwMgrType As Type = Type.GetTypeFromProgID("HnetCfg.FwMgr")
Dim fwMgr As INetFwMgr
fwMgr = DirectCast(Activator.CreateInstance(fwMgrType), INetFwMgr)
apps = fwMgr.LocalPolicy.CurrentProfile.AuthorizedApplications
apps.Add(app)
End Sub
End Class