I am currently programming a windows-firewallmanager for a company.
Problem is, that I can only delete an entry by name and not by an INetFwRule object or something.
There are entries, that have the same name two times where one is for TCP and the other one for UDP and we might want to delete only one of them.
I could delete both and create one of them afterwards again, but I would not like to use that workaround.
Does anyone have an easy solution to this?
You can only delete rules by name using the INetFwRules
interface which seems to be a badly designed API because different rules can have the same name. A workaround is to filter the rules not only by name by also by the other properties that specifies the rule you want to delete. When you have found the rule to delete you can then rename the rule to a unique name using the INetFwRule
interface.
You can then delete the rule using this unique temporary name.