aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Firewall/test
diff options
context:
space:
mode:
authorchris_bednarski <Chris.Bednarski@minfos.com.au>2023-09-21 16:03:28 +1000
committerBob Arnson <github@bobs.org>2023-11-19 12:17:13 -0500
commitdfb7512b85536b7726080648f2228cf8d0153724 (patch)
treed053018ee47afe7e349dda6739a6580c771a1a3d /src/ext/Firewall/test
parent80e604761b4f43b9b79a4878fcae360b071a7c35 (diff)
downloadwix-dfb7512b85536b7726080648f2228cf8d0153724.tar.gz
wix-dfb7512b85536b7726080648f2228cf8d0153724.tar.bz2
wix-dfb7512b85536b7726080648f2228cf8d0153724.zip
add firewall extension decompiler, make msi modifications work, add all attributes
Diffstat (limited to 'src/ext/Firewall/test')
-rw-r--r--src/ext/Firewall/test/WixToolsetTest.Firewall/FirewallExtensionFixture.cs485
-rw-r--r--src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs39
-rw-r--r--src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/Package.en-us.wxl9
-rw-r--r--src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/Package.wxs15
-rw-r--r--src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/PackageComponents.wxs53
-rw-r--r--src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/example.txt1
-rw-r--r--src/ext/Firewall/test/WixToolsetTest.Firewall/WixToolsetTest.Firewall.csproj2
7 files changed, 574 insertions, 30 deletions
diff --git a/src/ext/Firewall/test/WixToolsetTest.Firewall/FirewallExtensionFixture.cs b/src/ext/Firewall/test/WixToolsetTest.Firewall/FirewallExtensionFixture.cs
index 7119e92d..df18f0e0 100644
--- a/src/ext/Firewall/test/WixToolsetTest.Firewall/FirewallExtensionFixture.cs
+++ b/src/ext/Firewall/test/WixToolsetTest.Firewall/FirewallExtensionFixture.cs
@@ -2,6 +2,7 @@
2 2
3namespace WixToolsetTest.Firewall 3namespace WixToolsetTest.Firewall
4{ 4{
5 using System.Data;
5 using System.IO; 6 using System.IO;
6 using System.Linq; 7 using System.Linq;
7 using System.Xml.Linq; 8 using System.Xml.Linq;
@@ -27,12 +28,27 @@ namespace WixToolsetTest.Firewall
27 "CustomAction:Wix5RollbackFirewallExceptionsUninstall_X86\t3329\tWix5FWCA_X86\tExecFirewallExceptions\t", 28 "CustomAction:Wix5RollbackFirewallExceptionsUninstall_X86\t3329\tWix5FWCA_X86\tExecFirewallExceptions\t",
28 "CustomAction:Wix5SchedFirewallExceptionsInstall_X86\t1\tWix5FWCA_X86\tSchedFirewallExceptionsInstall\t", 29 "CustomAction:Wix5SchedFirewallExceptionsInstall_X86\t1\tWix5FWCA_X86\tSchedFirewallExceptionsInstall\t",
29 "CustomAction:Wix5SchedFirewallExceptionsUninstall_X86\t1\tWix5FWCA_X86\tSchedFirewallExceptionsUninstall\t", 30 "CustomAction:Wix5SchedFirewallExceptionsUninstall_X86\t1\tWix5FWCA_X86\tSchedFirewallExceptionsUninstall\t",
30 "Wix5FirewallException:ExampleFirewall\tExampleApp\t*\t42\t6\t[#filNdJBJmq3UCUIwmXS8x21aAsvqzk]\t0\t2147483647\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tAn app-based firewall exception\t1", 31 "Wix5FirewallException:ExampleFirewall\tExampleApp\t*\t42\t6\t[#filNdJBJmq3UCUIwmXS8x21aAsvqzk]\t2\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tAn app-based firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
31 "Wix5FirewallException:fex_ZpDsnKyHlYiA24JHzvFxm3uLZ8\tExampleDefaultGatewayScope\tDefaultGateway\t4432\t6\t\t0\t2\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tdefaultGateway scope firewall exception\t1", 32 "Wix5FirewallException:fex.BGtyMRGAhxb2hG.49JvWYz7fM0\tLocalScopeExample2\t*\t\t-2147483648\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tRule with local scope property\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t[LOCALSCOPE_PROP]\t\t\t\t\t\t\t\t-2147483648",
32 "Wix5FirewallException:fex6bkfWwpiRGI.wVFx0T7W4LXIHxU\tExampleDHCPScope\tdhcp\t\t211\ttest.exe\t0\t4\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDHCP scope firewall exception\t1", 33 "Wix5FirewallException:fex0HTxATWjpC2PCoY6DB7f2D1WaKU\tLocalScopeExample1\t*\t\t-2147483648\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple rule with local scope\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\tLocalSubnet\t\t\t\t\t\t\t\t-2147483648",
33 "Wix5FirewallException:fex70IVsYNnbwiHQrEepmdTPKH8XYs\tExamplePort\tLocalSubnet\t42\t6\t\t0\t2147483647\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tA port-based firewall exception\t2", 34 "Wix5FirewallException:fex4FeP470wYcFpw.g7fbIKiLnZPzg\tExampleDNSScope\tdns\t356\t17\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDNS scope firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
34 "Wix5FirewallException:fexXxaXCXXFh.UxO_BjmZxi1B1du_Q\tExampleWINSScope\twins\t6573\t6\t\t0\t1\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tWINS scope firewall exception\t1", 35 "Wix5FirewallException:fex4zTcT0Iwu3dUtHIHXD5qfymvpcM\tdefertouser\t\t\t-2147483648\tfw.exe\t8\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDefer to user edge traversal\t1\t-2147483648\t3\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
35 "Wix5FirewallException:fexxY71H2ZBkPalv7uid1Yy4qaA_lA\tExampleDNSScope\tdns\t356\t17\t\t0\t2147483647\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDNS scope firewall exception\t1", 36 "Wix5FirewallException:fex8vMfBplrod4daEz3PqDTeX6olGE\tExampleDefaultGatewayScope\tDefaultGateway\t4432\t6\t\t0\t2\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tdefaultGateway scope firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
37 "Wix5FirewallException:fexAMmHzFDyQmubTOnKS1Cn0Y3q_Ug\tINetFwRule3 properties\t*\t\t-2147483648\t\t16\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tINetFwRule3 passed via properties\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t[PROP1]\t[PROP2]\t[PROP3]\t[PROP4]\t[PROP5]\t[PROP6]",
38 "Wix5FirewallException:fexArlOkFR7CAwVZ2wk8yNdiREydu0\tRemotePortExample2\t\t\t6\tfw.exe\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tRule with remote port property\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t[REMOTEPORT_PROP]\t\t\t\t\t\t\t-2147483648",
39 "Wix5FirewallException:fexaUTe2tRRcSYrPUTn44DAZhE.40Q\tExamplePort\tLocalSubnet\t42\t6\t\t4\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tA port-based firewall exception\t2\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
40 "Wix5FirewallException:fexD6w20c5HfNi4l1vHFj_eet4cC8I\tExampleWINSScope\twins\t6573\t6\t\t0\t1\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tWINS scope firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
41 "Wix5FirewallException:fexeD3yox6fMflfRy7sDwSN2CMCS2s\tExampleService\t\t12000\t6\t%windir%\\system32\\svchost.exe\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tA port-based service exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\tDHCP,WINS\t\tftpsrv\t\t\t\t\t\t-2147483648",
42 "Wix5FirewallException:fexeok6aI2_AlclZggec4d8PBLFXLw\tinterface property\t\t54671\t6\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tInterfaces with property\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t[INTERFACE_PROPERTY]\t\t\t\t\t\t\t\t\t\t-2147483648",
43 "Wix5FirewallException:fexEPvcf4iexD1mVQdvxm7tD02nZEc\tICMPExample1\t\t\t2\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple ICMP rule\t1\t-2147483648\t-2147483648\t-2147483648\t\t4:*,9:*,12:*\t\t\t\t\t\t\t\t\t\t\t-2147483648",
44 "Wix5FirewallException:fexfzjTQsWwZkHQpObtl0XaUosfcRk\tGroupingExample1\t\t\t-2147483648\tfw.exe\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple rule with grouping\t1\t-2147483648\t-2147483648\t-2147483648\t@yourresources.dll,-1005\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
45 "Wix5FirewallException:fexHx2xbwZYzAi0oYp4YGWevJQs5eM\tRemotePortExample1\t*\t\t6\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple rule with remote port\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t34560\t\t\t\t\t\t\t-2147483648",
46 "Wix5FirewallException:fexpWUzK53RVnaluW36gSmphPRY8VY\tExampleDHCPScope\tdhcp\t\t211\ttest.exe\t0\t4\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDHCP scope firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
47 "Wix5FirewallException:fexuanTga5xaaFzr9JsAnUmpCNediw\tICMPExample2\t\t\t2\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tRule with ICMP property\t1\t-2147483648\t-2147483648\t-2147483648\t\t[ICMP_PROP]\t\t\t\t\t\t\t\t\t\t\t-2147483648",
48 "Wix5FirewallException:fexv60s7u2Dmd1imH5vEFYKPgEWhG4\tinterface nested\t127.0.0.1\t54671\t6\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tInterfaces with nested elements\t1\t-2147483648\t-2147483648\t-2147483648\t\t\tWi-Fi|Local Area Connection\t\t\t\t\t\t\t\t\t\t-2147483648",
49 "Wix5FirewallException:fexVr6uHcOCak5MHuTLwujjh_oKtbI\tGroupingExample2\t\t8732\t6\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tRule with grouping property\t1\t-2147483648\t-2147483648\t-2147483648\t[GROUPING_PROP]\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
50 "Wix5FirewallException:fexwjf4OTFVE9SNiC4goVxBA6ENJBE\tINetFwRule3 values\t*\t\t-2147483648\t\t16\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple INetFwRule3 values\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\tS-1-15-2-1239072475-3687740317-1842961305-3395936705-4023953123-1525404051-2779347315\tO:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)\tS-1-5-21-1898747406-2352535518-1247798438-1914\t127.0.0.1\tO:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)\t3",
51 "Wix5FirewallException:ServiceInstall.nested\tExampleNestedService\tLocalSubnet\t3546-7890\t6\t\t1\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tA port-based firewall exception for a windows service\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\tLan,Wireless\t\t\tsvc1\t\t\t\t\t\t-2147483648",
36 }, results); 52 }, results);
37 } 53 }
38 54
@@ -51,12 +67,69 @@ namespace WixToolsetTest.Firewall
51 "CustomAction:Wix5RollbackFirewallExceptionsUninstall_A64\t3329\tWix5FWCA_A64\tExecFirewallExceptions\t", 67 "CustomAction:Wix5RollbackFirewallExceptionsUninstall_A64\t3329\tWix5FWCA_A64\tExecFirewallExceptions\t",
52 "CustomAction:Wix5SchedFirewallExceptionsInstall_A64\t1\tWix5FWCA_A64\tSchedFirewallExceptionsInstall\t", 68 "CustomAction:Wix5SchedFirewallExceptionsInstall_A64\t1\tWix5FWCA_A64\tSchedFirewallExceptionsInstall\t",
53 "CustomAction:Wix5SchedFirewallExceptionsUninstall_A64\t1\tWix5FWCA_A64\tSchedFirewallExceptionsUninstall\t", 69 "CustomAction:Wix5SchedFirewallExceptionsUninstall_A64\t1\tWix5FWCA_A64\tSchedFirewallExceptionsUninstall\t",
54 "Wix5FirewallException:ExampleFirewall\tExampleApp\t*\t42\t6\t[#filNdJBJmq3UCUIwmXS8x21aAsvqzk]\t0\t2147483647\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tAn app-based firewall exception\t1", 70 "Wix5FirewallException:ExampleFirewall\tExampleApp\t*\t42\t6\t[#filNdJBJmq3UCUIwmXS8x21aAsvqzk]\t2\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tAn app-based firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
55 "Wix5FirewallException:fex_ZpDsnKyHlYiA24JHzvFxm3uLZ8\tExampleDefaultGatewayScope\tDefaultGateway\t4432\t6\t\t0\t2\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tdefaultGateway scope firewall exception\t1", 71 "Wix5FirewallException:fex.BGtyMRGAhxb2hG.49JvWYz7fM0\tLocalScopeExample2\t*\t\t-2147483648\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tRule with local scope property\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t[LOCALSCOPE_PROP]\t\t\t\t\t\t\t\t-2147483648",
56 "Wix5FirewallException:fex6bkfWwpiRGI.wVFx0T7W4LXIHxU\tExampleDHCPScope\tdhcp\t\t211\ttest.exe\t0\t4\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDHCP scope firewall exception\t1", 72 "Wix5FirewallException:fex0HTxATWjpC2PCoY6DB7f2D1WaKU\tLocalScopeExample1\t*\t\t-2147483648\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple rule with local scope\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\tLocalSubnet\t\t\t\t\t\t\t\t-2147483648",
57 "Wix5FirewallException:fex70IVsYNnbwiHQrEepmdTPKH8XYs\tExamplePort\tLocalSubnet\t42\t6\t\t0\t2147483647\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tA port-based firewall exception\t2", 73 "Wix5FirewallException:fex4FeP470wYcFpw.g7fbIKiLnZPzg\tExampleDNSScope\tdns\t356\t17\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDNS scope firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
58 "Wix5FirewallException:fexXxaXCXXFh.UxO_BjmZxi1B1du_Q\tExampleWINSScope\twins\t6573\t6\t\t0\t1\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tWINS scope firewall exception\t1", 74 "Wix5FirewallException:fex4zTcT0Iwu3dUtHIHXD5qfymvpcM\tdefertouser\t\t\t-2147483648\tfw.exe\t8\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDefer to user edge traversal\t1\t-2147483648\t3\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
59 "Wix5FirewallException:fexxY71H2ZBkPalv7uid1Yy4qaA_lA\tExampleDNSScope\tdns\t356\t17\t\t0\t2147483647\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDNS scope firewall exception\t1", 75 "Wix5FirewallException:fex8vMfBplrod4daEz3PqDTeX6olGE\tExampleDefaultGatewayScope\tDefaultGateway\t4432\t6\t\t0\t2\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tdefaultGateway scope firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
76 "Wix5FirewallException:fexAMmHzFDyQmubTOnKS1Cn0Y3q_Ug\tINetFwRule3 properties\t*\t\t-2147483648\t\t16\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tINetFwRule3 passed via properties\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t[PROP1]\t[PROP2]\t[PROP3]\t[PROP4]\t[PROP5]\t[PROP6]",
77 "Wix5FirewallException:fexArlOkFR7CAwVZ2wk8yNdiREydu0\tRemotePortExample2\t\t\t6\tfw.exe\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tRule with remote port property\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t[REMOTEPORT_PROP]\t\t\t\t\t\t\t-2147483648",
78 "Wix5FirewallException:fexaUTe2tRRcSYrPUTn44DAZhE.40Q\tExamplePort\tLocalSubnet\t42\t6\t\t4\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tA port-based firewall exception\t2\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
79 "Wix5FirewallException:fexD6w20c5HfNi4l1vHFj_eet4cC8I\tExampleWINSScope\twins\t6573\t6\t\t0\t1\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tWINS scope firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
80 "Wix5FirewallException:fexeD3yox6fMflfRy7sDwSN2CMCS2s\tExampleService\t\t12000\t6\t%windir%\\system32\\svchost.exe\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tA port-based service exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\tDHCP,WINS\t\tftpsrv\t\t\t\t\t\t-2147483648",
81 "Wix5FirewallException:fexeok6aI2_AlclZggec4d8PBLFXLw\tinterface property\t\t54671\t6\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tInterfaces with property\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t[INTERFACE_PROPERTY]\t\t\t\t\t\t\t\t\t\t-2147483648",
82 "Wix5FirewallException:fexEPvcf4iexD1mVQdvxm7tD02nZEc\tICMPExample1\t\t\t2\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple ICMP rule\t1\t-2147483648\t-2147483648\t-2147483648\t\t4:*,9:*,12:*\t\t\t\t\t\t\t\t\t\t\t-2147483648",
83 "Wix5FirewallException:fexfzjTQsWwZkHQpObtl0XaUosfcRk\tGroupingExample1\t\t\t-2147483648\tfw.exe\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple rule with grouping\t1\t-2147483648\t-2147483648\t-2147483648\t@yourresources.dll,-1005\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
84 "Wix5FirewallException:fexHx2xbwZYzAi0oYp4YGWevJQs5eM\tRemotePortExample1\t*\t\t6\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple rule with remote port\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t34560\t\t\t\t\t\t\t-2147483648",
85 "Wix5FirewallException:fexpWUzK53RVnaluW36gSmphPRY8VY\tExampleDHCPScope\tdhcp\t\t211\ttest.exe\t0\t4\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tDHCP scope firewall exception\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
86 "Wix5FirewallException:fexuanTga5xaaFzr9JsAnUmpCNediw\tICMPExample2\t\t\t2\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tRule with ICMP property\t1\t-2147483648\t-2147483648\t-2147483648\t\t[ICMP_PROP]\t\t\t\t\t\t\t\t\t\t\t-2147483648",
87 "Wix5FirewallException:fexv60s7u2Dmd1imH5vEFYKPgEWhG4\tinterface nested\t127.0.0.1\t54671\t6\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tInterfaces with nested elements\t1\t-2147483648\t-2147483648\t-2147483648\t\t\tWi-Fi|Local Area Connection\t\t\t\t\t\t\t\t\t\t-2147483648",
88 "Wix5FirewallException:fexVr6uHcOCak5MHuTLwujjh_oKtbI\tGroupingExample2\t\t8732\t6\t\t0\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tRule with grouping property\t1\t-2147483648\t-2147483648\t-2147483648\t[GROUPING_PROP]\t\t\t\t\t\t\t\t\t\t\t\t-2147483648",
89 "Wix5FirewallException:fexwjf4OTFVE9SNiC4goVxBA6ENJBE\tINetFwRule3 values\t*\t\t-2147483648\t\t16\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tSimple INetFwRule3 values\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\t\t\t\t\tS-1-15-2-1239072475-3687740317-1842961305-3395936705-4023953123-1525404051-2779347315\tO:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)\tS-1-5-21-1898747406-2352535518-1247798438-1914\t127.0.0.1\tO:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)\t3",
90 "Wix5FirewallException:ServiceInstall.nested\tExampleNestedService\tLocalSubnet\t3546-7890\t6\t\t1\t-2147483648\tfilNdJBJmq3UCUIwmXS8x21aAsvqzk\tA port-based firewall exception for a windows service\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t\tLan,Wireless\t\t\tsvc1\t\t\t\t\t\t-2147483648",
91 }, results);
92 }
93
94 [Fact]
95 public void CanBuildWithProperties()
96 {
97 var folder = TestData.Get(@"TestData\UsingProperties");
98 var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder });
99
100 var results = build.BuildAndQuery(Build, "Wix5FirewallException", "CustomAction");
101 WixAssert.CompareLineByLine(new[]
102 {
103 "CustomAction:Wix5ExecFirewallExceptionsInstall_X86\t3073\tWix5FWCA_X86\tExecFirewallExceptions\t",
104 "CustomAction:Wix5ExecFirewallExceptionsUninstall_X86\t3073\tWix5FWCA_X86\tExecFirewallExceptions\t",
105 "CustomAction:Wix5RollbackFirewallExceptionsInstall_X86\t3329\tWix5FWCA_X86\tExecFirewallExceptions\t",
106 "CustomAction:Wix5RollbackFirewallExceptionsUninstall_X86\t3329\tWix5FWCA_X86\tExecFirewallExceptions\t",
107 "CustomAction:Wix5SchedFirewallExceptionsInstall_X86\t1\tWix5FWCA_X86\tSchedFirewallExceptionsInstall\t",
108 "CustomAction:Wix5SchedFirewallExceptionsUninstall_X86\t1\tWix5FWCA_X86\tSchedFirewallExceptionsUninstall\t",
109 "Wix5FirewallException:fexRrE4bS.DwUJQMvzX0ALEsx7jrZs\tSingle Nested properties\t[REMOTEADDRESS]\t\t-2147483648\t\t0\t-2147483648\tFirewallComponent\t\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t[INTERFACE]\t[INTERFACETYPE]\t[LOCALADDRESS]\t\t\t\t\t\t\t\t-2147483648",
110 "Wix5FirewallException:fexvEy1GfdOjHlKcvsguyqK6mvYKyk\t[NAME]\t[REMOTESCOPE]\t[LOCALPORT]\t[PROTOCOL]\t[PROGRAM]\t16\t[PROFILE]\tFirewallComponent\t[DESCRIPTION]\t1\t[ACTION]\t[EDGETRAVERSAL]\t[ENABLED]\t[GROUPING]\t[ICMPTYPES]\t[INTERFACE]\t[INTERFACETYPE]\t[LOCALSCOPE]\t[REMOTEPORT]\t[SERVICE]\t[PACKAGEID]\t[LOCALUSERS]\t[LOCALOWNER]\t[REMOTEMACHINES]\t[REMOTEUSERS]\t[SECUREFLAGS]",
111 "Wix5FirewallException:fexWywW3VGiEuG23FOv1YM6h7R6F5Q\tMultiple Nested properties\t[REMOTEADDRESS1],[REMOTEADDRESS2]\t\t-2147483648\t\t0\t-2147483648\tFirewallComponent\t\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t[INTERFACE1]|[INTERFACE2]\t[INTERFACETYPE1],[INTERFACETYPE2]\t[LOCALADDRESS1],[LOCALADDRESS2]\t\t\t\t\t\t\t\t-2147483648",
112 }, results);
113 }
114
115 [Fact]
116 public void CanBuildWithPropertiesUsingFirewallARM64()
117 {
118 var folder = TestData.Get(@"TestData\UsingProperties");
119 var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder });
120
121 var results = build.BuildAndQuery(BuildARM64, "Wix5FirewallException", "CustomAction");
122 WixAssert.CompareLineByLine(new[]
123 {
124 "CustomAction:Wix5ExecFirewallExceptionsInstall_A64\t3073\tWix5FWCA_A64\tExecFirewallExceptions\t",
125 "CustomAction:Wix5ExecFirewallExceptionsUninstall_A64\t3073\tWix5FWCA_A64\tExecFirewallExceptions\t",
126 "CustomAction:Wix5RollbackFirewallExceptionsInstall_A64\t3329\tWix5FWCA_A64\tExecFirewallExceptions\t",
127 "CustomAction:Wix5RollbackFirewallExceptionsUninstall_A64\t3329\tWix5FWCA_A64\tExecFirewallExceptions\t",
128 "CustomAction:Wix5SchedFirewallExceptionsInstall_A64\t1\tWix5FWCA_A64\tSchedFirewallExceptionsInstall\t",
129 "CustomAction:Wix5SchedFirewallExceptionsUninstall_A64\t1\tWix5FWCA_A64\tSchedFirewallExceptionsUninstall\t",
130 "Wix5FirewallException:fexRrE4bS.DwUJQMvzX0ALEsx7jrZs\tSingle Nested properties\t[REMOTEADDRESS]\t\t-2147483648\t\t0\t-2147483648\tFirewallComponent\t\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t[INTERFACE]\t[INTERFACETYPE]\t[LOCALADDRESS]\t\t\t\t\t\t\t\t-2147483648",
131 "Wix5FirewallException:fexvEy1GfdOjHlKcvsguyqK6mvYKyk\t[NAME]\t[REMOTESCOPE]\t[LOCALPORT]\t[PROTOCOL]\t[PROGRAM]\t16\t[PROFILE]\tFirewallComponent\t[DESCRIPTION]\t1\t[ACTION]\t[EDGETRAVERSAL]\t[ENABLED]\t[GROUPING]\t[ICMPTYPES]\t[INTERFACE]\t[INTERFACETYPE]\t[LOCALSCOPE]\t[REMOTEPORT]\t[SERVICE]\t[PACKAGEID]\t[LOCALUSERS]\t[LOCALOWNER]\t[REMOTEMACHINES]\t[REMOTEUSERS]\t[SECUREFLAGS]",
132 "Wix5FirewallException:fexWywW3VGiEuG23FOv1YM6h7R6F5Q\tMultiple Nested properties\t[REMOTEADDRESS1],[REMOTEADDRESS2]\t\t-2147483648\t\t0\t-2147483648\tFirewallComponent\t\t1\t-2147483648\t-2147483648\t-2147483648\t\t\t[INTERFACE1]|[INTERFACE2]\t[INTERFACETYPE1],[INTERFACETYPE2]\t[LOCALADDRESS1],[LOCALADDRESS2]\t\t\t\t\t\t\t\t-2147483648",
60 }, results); 133 }, results);
61 } 134 }
62 135
@@ -83,6 +156,59 @@ namespace WixToolsetTest.Firewall
83 "FirewallException", 156 "FirewallException",
84 "FirewallException", 157 "FirewallException",
85 "FirewallException", 158 "FirewallException",
159 "FirewallException",
160 "FirewallException",
161 "LocalAddress",
162 "LocalAddress",
163 "FirewallException",
164 "RemoteAddress",
165 "Interface",
166 "Interface",
167 "FirewallException",
168 "FirewallException",
169 "InterfaceType",
170 "InterfaceType",
171 "FirewallException",
172 "FirewallException",
173 "FirewallException",
174 "FirewallException",
175 "FirewallException",
176 "FirewallException",
177 "FirewallException",
178 "FirewallException",
179 "FirewallException",
180 "FirewallException",
181 }, actual.Select(a => a.Name).ToArray());
182 }
183
184 [Fact]
185 public void CanRoundtripFirewallExceptionsWithProperties()
186 {
187 var folder = TestData.Get(@"TestData", "UsingProperties");
188 var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder });
189 var output = Path.Combine(folder, "FirewallPropertiesDecompile.xml");
190
191 build.BuildAndDecompileAndBuild(Build, Decompile, output);
192
193 var doc = XDocument.Load(output);
194 var actual = doc.Descendants()
195 .Where(e => e.Name.Namespace == "http://wixtoolset.org/schemas/v4/wxs/firewall")
196 .Select(fe => new { Name = fe.Name.LocalName, Attributes = fe.Attributes().Select(a => $"{a.Name.LocalName}={a.Value}").ToArray() })
197 .ToArray();
198
199 WixAssert.CompareLineByLine(new[]
200 {
201 "FirewallException",
202 "FirewallException",
203 "FirewallException",
204 "RemoteAddress",
205 "RemoteAddress",
206 "Interface",
207 "Interface",
208 "InterfaceType",
209 "InterfaceType",
210 "LocalAddress",
211 "LocalAddress",
86 }, actual.Select(a => a.Name).ToArray()); 212 }, actual.Select(a => a.Name).ToArray());
87 } 213 }
88 214
@@ -98,9 +224,8 @@ namespace WixToolsetTest.Firewall
98 "Port=42", 224 "Port=42",
99 "Protocol=tcp", 225 "Protocol=tcp",
100 "Program=[#filNdJBJmq3UCUIwmXS8x21aAsvqzk]", 226 "Program=[#filNdJBJmq3UCUIwmXS8x21aAsvqzk]",
101 "Profile=all", 227 "OnUpdate=DoNothing",
102 "Description=An app-based firewall exception", 228 "Description=An app-based firewall exception",
103 "Outbound=no",
104 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall", 229 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
105 }, actual.Attributes); 230 }, actual.Attributes);
106 } 231 }
@@ -111,12 +236,12 @@ namespace WixToolsetTest.Firewall
111 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExamplePort"); 236 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExamplePort");
112 WixAssert.CompareLineByLine(new[] 237 WixAssert.CompareLineByLine(new[]
113 { 238 {
114 "Id=fex70IVsYNnbwiHQrEepmdTPKH8XYs", 239 "Id=fexaUTe2tRRcSYrPUTn44DAZhE.40Q",
115 "Name=ExamplePort", 240 "Name=ExamplePort",
116 "Scope=localSubnet", 241 "Scope=localSubnet",
117 "Port=42", 242 "Port=42",
118 "Protocol=tcp", 243 "Protocol=tcp",
119 "Profile=all", 244 "OnUpdate=EnableOnly",
120 "Description=A port-based firewall exception", 245 "Description=A port-based firewall exception",
121 "Outbound=yes", 246 "Outbound=yes",
122 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall", 247 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
@@ -129,14 +254,12 @@ namespace WixToolsetTest.Firewall
129 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExampleDNSScope"); 254 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExampleDNSScope");
130 WixAssert.CompareLineByLine(new[] 255 WixAssert.CompareLineByLine(new[]
131 { 256 {
132 "Id=fexxY71H2ZBkPalv7uid1Yy4qaA_lA", 257 "Id=fex4FeP470wYcFpw.g7fbIKiLnZPzg",
133 "Name=ExampleDNSScope", 258 "Name=ExampleDNSScope",
134 "Scope=DNS", 259 "Scope=DNS",
135 "Port=356", 260 "Port=356",
136 "Protocol=udp", 261 "Protocol=udp",
137 "Profile=all",
138 "Description=DNS scope firewall exception", 262 "Description=DNS scope firewall exception",
139 "Outbound=no",
140 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall", 263 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
141 }, actual.Attributes); 264 }, actual.Attributes);
142 } 265 }
@@ -147,14 +270,13 @@ namespace WixToolsetTest.Firewall
147 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExampleDHCPScope"); 270 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExampleDHCPScope");
148 WixAssert.CompareLineByLine(new[] 271 WixAssert.CompareLineByLine(new[]
149 { 272 {
150 "Id=fex6bkfWwpiRGI.wVFx0T7W4LXIHxU", 273 "Id=fexpWUzK53RVnaluW36gSmphPRY8VY",
151 "Name=ExampleDHCPScope", 274 "Name=ExampleDHCPScope",
152 "Scope=DHCP", 275 "Scope=DHCP",
153 "Protocol=211", 276 "Protocol=211",
154 "Program=test.exe", 277 "Program=test.exe",
155 "Profile=public", 278 "Profile=public",
156 "Description=DHCP scope firewall exception", 279 "Description=DHCP scope firewall exception",
157 "Outbound=no",
158 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall" 280 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall"
159 }, actual.Attributes); 281 }, actual.Attributes);
160 } 282 }
@@ -165,14 +287,13 @@ namespace WixToolsetTest.Firewall
165 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExampleWINSScope"); 287 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExampleWINSScope");
166 WixAssert.CompareLineByLine(new[] 288 WixAssert.CompareLineByLine(new[]
167 { 289 {
168 "Id=fexXxaXCXXFh.UxO_BjmZxi1B1du_Q", 290 "Id=fexD6w20c5HfNi4l1vHFj_eet4cC8I",
169 "Name=ExampleWINSScope", 291 "Name=ExampleWINSScope",
170 "Scope=WINS", 292 "Scope=WINS",
171 "Port=6573", 293 "Port=6573",
172 "Protocol=tcp", 294 "Protocol=tcp",
173 "Profile=domain", 295 "Profile=domain",
174 "Description=WINS scope firewall exception", 296 "Description=WINS scope firewall exception",
175 "Outbound=no",
176 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall", 297 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
177 }, actual.Attributes); 298 }, actual.Attributes);
178 } 299 }
@@ -183,18 +304,322 @@ namespace WixToolsetTest.Firewall
183 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExampleDefaultGatewayScope"); 304 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ExampleDefaultGatewayScope");
184 WixAssert.CompareLineByLine(new[] 305 WixAssert.CompareLineByLine(new[]
185 { 306 {
186 "Id=fex_ZpDsnKyHlYiA24JHzvFxm3uLZ8", 307 "Id=fex8vMfBplrod4daEz3PqDTeX6olGE",
187 "Name=ExampleDefaultGatewayScope", 308 "Name=ExampleDefaultGatewayScope",
188 "Scope=defaultGateway", 309 "Scope=defaultGateway",
189 "Port=4432", 310 "Port=4432",
190 "Protocol=tcp", 311 "Protocol=tcp",
191 "Profile=private", 312 "Profile=private",
192 "Description=defaultGateway scope firewall exception", 313 "Description=defaultGateway scope firewall exception",
193 "Outbound=no",
194 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall", 314 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
195 }, actual.Attributes); 315 }, actual.Attributes);
196 } 316 }
197 317
318 [Fact]
319 public void RoundtripAttributesAreCorrectForINetFwRule3Values()
320 {
321 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "INetFwRule3 values");
322 WixAssert.CompareLineByLine(new[]
323 {
324 "Id=fexwjf4OTFVE9SNiC4goVxBA6ENJBE",
325 "Name=INetFwRule3 values",
326 "Scope=any",
327 "Description=Simple INetFwRule3 values",
328 "LocalAppPackageId=S-1-15-2-1239072475-3687740317-1842961305-3395936705-4023953123-1525404051-2779347315",
329 "LocalUserAuthorizedList=O:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)",
330 "LocalUserOwner=S-1-5-21-1898747406-2352535518-1247798438-1914",
331 "RemoteMachineAuthorizedList=127.0.0.1",
332 "RemoteUserAuthorizedList=O:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)",
333 "IPSecSecureFlags=NegotiateEncryption",
334 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
335 }, actual.Attributes);
336 }
337
338 [Fact]
339 public void RoundtripAttributesAreCorrectForINetFwRule3Properties()
340 {
341 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "INetFwRule3 properties");
342 WixAssert.CompareLineByLine(new[]
343 {
344 "Id=fexAMmHzFDyQmubTOnKS1Cn0Y3q_Ug",
345 "Name=INetFwRule3 properties",
346 "Scope=any",
347 "Description=INetFwRule3 passed via properties",
348 "LocalAppPackageId=[PROP1]",
349 "LocalUserAuthorizedList=[PROP2]",
350 "LocalUserOwner=[PROP3]",
351 "RemoteMachineAuthorizedList=[PROP4]",
352 "RemoteUserAuthorizedList=[PROP5]",
353 "IPSecSecureFlags=[PROP6]",
354 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
355 }, actual.Attributes);
356 }
357
358 [Fact]
359 public void RoundtripAttributesAreCorrectForGroupingValue()
360 {
361 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "GroupingExample1");
362 WixAssert.CompareLineByLine(new[]
363 {
364 "Id=fexfzjTQsWwZkHQpObtl0XaUosfcRk",
365 "Name=GroupingExample1",
366 "Program=fw.exe",
367 "Description=Simple rule with grouping",
368 "Grouping=@yourresources.dll,-1005",
369 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
370 }, actual.Attributes);
371 }
372
373 [Fact]
374 public void RoundtripAttributesAreCorrectForGroupingProperty()
375 {
376 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "GroupingExample2");
377 WixAssert.CompareLineByLine(new[]
378 {
379 "Id=fexVr6uHcOCak5MHuTLwujjh_oKtbI",
380 "Name=GroupingExample2",
381 "Port=8732",
382 "Protocol=tcp",
383 "Description=Rule with grouping property",
384 "Grouping=[GROUPING_PROP]",
385 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
386 }, actual.Attributes);
387 }
388
389 [Fact]
390 public void RoundtripAttributesAreCorrectForIcmpValue()
391 {
392 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ICMPExample1");
393 WixAssert.CompareLineByLine(new[]
394 {
395 "Id=fexEPvcf4iexD1mVQdvxm7tD02nZEc",
396 "Name=ICMPExample1",
397 "Protocol=2",
398 "Description=Simple ICMP rule",
399 "IcmpTypesAndCodes=4:*,9:*,12:*",
400 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
401 }, actual.Attributes);
402 }
403
404 [Fact]
405 public void RoundtripAttributesAreCorrectForIcmpProperty()
406 {
407 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "ICMPExample2");
408 WixAssert.CompareLineByLine(new[]
409 {
410 "Id=fexuanTga5xaaFzr9JsAnUmpCNediw",
411 "Name=ICMPExample2",
412 "Protocol=2",
413 "Description=Rule with ICMP property",
414 "IcmpTypesAndCodes=[ICMP_PROP]",
415 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
416 }, actual.Attributes);
417 }
418
419 [Fact]
420 public void RoundtripAttributesAreCorrectForLocalScopeValue()
421 {
422 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "LocalScopeExample1");
423 WixAssert.CompareLineByLine(new[]
424 {
425 "Id=fex0HTxATWjpC2PCoY6DB7f2D1WaKU",
426 "Name=LocalScopeExample1",
427 "Scope=any",
428 "Description=Simple rule with local scope",
429 "LocalScope=localSubnet",
430 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
431 }, actual.Attributes);
432 }
433
434 [Fact]
435 public void RoundtripAttributesAreCorrectForLocalScopeProperty()
436 {
437 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "LocalScopeExample2");
438 WixAssert.CompareLineByLine(new[]
439 {
440 "Id=fex.BGtyMRGAhxb2hG.49JvWYz7fM0",
441 "Name=LocalScopeExample2",
442 "Scope=any",
443 "Description=Rule with local scope property",
444 "LocalScope=[LOCALSCOPE_PROP]",
445 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
446 }, actual.Attributes);
447 }
448
449 [Fact]
450 public void RoundtripAttributesAreCorrectForRemotePorts()
451 {
452 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "RemotePortExample1");
453 WixAssert.CompareLineByLine(new[]
454 {
455 "Id=fexHx2xbwZYzAi0oYp4YGWevJQs5eM",
456 "Name=RemotePortExample1",
457 "Scope=any",
458 "Protocol=tcp",
459 "Description=Simple rule with remote port",
460 "RemotePort=34560",
461 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
462 }, actual.Attributes);
463 }
464
465 [Fact]
466 public void RoundtripAttributesAreCorrectForRemotePortsProperty()
467 {
468 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "RemotePortExample2");
469 WixAssert.CompareLineByLine(new[]
470 {
471 "Id=fexArlOkFR7CAwVZ2wk8yNdiREydu0",
472 "Name=RemotePortExample2",
473 "Protocol=tcp",
474 "Program=fw.exe",
475 "Description=Rule with remote port property",
476 "RemotePort=[REMOTEPORT_PROP]",
477 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall",
478 }, actual.Attributes);
479 }
480
481 [Fact]
482 public void RoundtripAttributesAreCorrectWhenPropertiesAreUsed()
483 {
484 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "[NAME]", "UsingProperties");
485 WixAssert.CompareLineByLine(new[]
486 {
487 "Id=fexvEy1GfdOjHlKcvsguyqK6mvYKyk",
488 "Name=[NAME]",
489 "Scope=[REMOTESCOPE]",
490 "Port=[LOCALPORT]",
491 "Protocol=[PROTOCOL]",
492 "Program=[PROGRAM]",
493 "Profile=[PROFILE]",
494 "Description=[DESCRIPTION]",
495 "Action=[ACTION]",
496 "EdgeTraversal=[EDGETRAVERSAL]",
497 "Enabled=[ENABLED]",
498 "Grouping=[GROUPING]",
499 "IcmpTypesAndCodes=[ICMPTYPES]",
500 "Interface=[INTERFACE]",
501 "InterfaceType=[INTERFACETYPE]",
502 "LocalScope=[LOCALSCOPE]",
503 "RemotePort=[REMOTEPORT]",
504 "Service=[SERVICE]",
505 "LocalAppPackageId=[PACKAGEID]",
506 "LocalUserAuthorizedList=[LOCALUSERS]",
507 "LocalUserOwner=[LOCALOWNER]",
508 "RemoteMachineAuthorizedList=[REMOTEMACHINES]",
509 "RemoteUserAuthorizedList=[REMOTEUSERS]",
510 "IPSecSecureFlags=[SECUREFLAGS]",
511 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall"
512 }, actual.Attributes);
513
514 var folder = TestData.Get(@"TestData", "UsingProperties");
515 var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder });
516 var output = Path.Combine(folder, $"FirewallNothingNested.xml");
517
518 build.BuildAndDecompileAndBuild(Build, Decompile, output);
519
520 var doc = XDocument.Load(output);
521 var related = doc.Descendants()
522 .Where(e =>
523 {
524 return e.Name.Namespace == "http://wixtoolset.org/schemas/v4/wxs/firewall" &&
525 e.Parent.Attributes().Any(a => a.Name.LocalName == "Name" && a.Value == "[NAME]");
526 });
527
528 var nested = related.Select(e => e.Attributes().Single(a => a.Name.LocalName == "Name").Value);
529 Assert.False(nested.Any());
530 }
531
532 [Fact]
533 public void RoundtripAttributesAreCorrectWhenNestedPropertiesAreUsed()
534 {
535 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "Single Nested properties", "UsingProperties");
536 WixAssert.CompareLineByLine(new[]
537 {
538 "Id=fexRrE4bS.DwUJQMvzX0ALEsx7jrZs",
539 "Name=Single Nested properties",
540 "Scope=[REMOTEADDRESS]",
541 "Interface=[INTERFACE]",
542 "InterfaceType=[INTERFACETYPE]",
543 "LocalScope=[LOCALADDRESS]",
544 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall"
545 }, actual.Attributes);
546
547 var folder = TestData.Get(@"TestData", "UsingProperties");
548 var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder });
549 var output = Path.Combine(folder, $"FirewallSingleNested.xml");
550
551 build.BuildAndDecompileAndBuild(Build, Decompile, output);
552
553 var doc = XDocument.Load(output);
554 var related = doc.Descendants()
555 .Where(e =>
556 {
557 return e.Name.Namespace == "http://wixtoolset.org/schemas/v4/wxs/firewall" &&
558 e.Parent.Attributes().Any(a => a.Name.LocalName == "Name" && a.Value == "Single Nested properties");
559 });
560
561 var nested = related.Select(e => e.Attributes().Single(a => a.Name.LocalName == "Name").Value);
562 Assert.False(nested.Any());
563 }
564
565 [Fact]
566 public void RoundtripAttributesAreCorrectWhenMultipleNestedPropertiesAreUsed()
567 {
568 var actual = BuildAndDecompileAndBuild("http://wixtoolset.org/schemas/v4/wxs/firewall", "Multiple Nested properties", "UsingProperties");
569 WixAssert.CompareLineByLine(new[]
570 {
571 "Id=fexWywW3VGiEuG23FOv1YM6h7R6F5Q",
572 "Name=Multiple Nested properties",
573 "xmlns=http://wixtoolset.org/schemas/v4/wxs/firewall"
574 }, actual.Attributes);
575
576 var folder = TestData.Get(@"TestData", "UsingProperties");
577 var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder });
578 var output = Path.Combine(folder, $"FirewallMultipleNested.xml");
579
580 build.BuildAndDecompileAndBuild(Build, Decompile, output);
581
582 var doc = XDocument.Load(output);
583 var related = doc.Descendants()
584 .Where(e =>
585 {
586 return e.Name.Namespace == "http://wixtoolset.org/schemas/v4/wxs/firewall" &&
587 e.Parent.Attributes().Any(a => a.Name.LocalName == "Name" && a.Value == "Multiple Nested properties");
588 });
589
590 var interfaces = related.Where(e => e.Name.LocalName == "Interface")
591 .Select(e => e.Attributes().Single(a => a.Name.LocalName == "Name").Value);
592 WixAssert.CompareLineByLine(new[]
593 {
594 "[INTERFACE1]",
595 "[INTERFACE2]",
596 }, interfaces.ToArray());
597
598 var interfaceTypes = related.Where(e => e.Name.LocalName == "InterfaceType")
599 .Select(e => e.Attributes().Single(a => a.Name.LocalName == "Value").Value);
600 WixAssert.CompareLineByLine(new[]
601 {
602 "[INTERFACETYPE1]",
603 "[INTERFACETYPE2]",
604 }, interfaceTypes.ToArray());
605
606 var remotes = related.Where(e => e.Name.LocalName == "RemoteAddress")
607 .Select(e => e.Attributes().Single(a => a.Name.LocalName == "Value").Value);
608 WixAssert.CompareLineByLine(new[]
609 {
610 "[REMOTEADDRESS1]",
611 "[REMOTEADDRESS2]",
612 }, remotes.ToArray());
613
614 var locals = related.Where(e => e.Name.LocalName == "LocalAddress")
615 .Select(e => e.Attributes().Single(a => a.Name.LocalName == "Value").Value);
616 WixAssert.CompareLineByLine(new[]
617 {
618 "[LOCALADDRESS1]",
619 "[LOCALADDRESS2]",
620 }, locals.ToArray());
621 }
622
198 private static void Build(string[] args) 623 private static void Build(string[] args)
199 { 624 {
200 var result = WixRunner.Execute(args); 625 var result = WixRunner.Execute(args);
@@ -216,15 +641,16 @@ namespace WixToolsetTest.Firewall
216 var result = WixRunner.Execute(args); 641 var result = WixRunner.Execute(args);
217 result.AssertSuccess(); 642 result.AssertSuccess();
218 } 643 }
644
219 class AttributeVerifier 645 class AttributeVerifier
220 { 646 {
221 public string Name { get; set; } 647 public string Name { get; set; }
222 public string[] Attributes { get; set; } 648 public string[] Attributes { get; set; }
223 } 649 }
224 650
225 private static AttributeVerifier BuildAndDecompileAndBuild(string nameSpace, string ruleName) 651 private static AttributeVerifier BuildAndDecompileAndBuild(string nameSpace, string ruleName, string path = "UsingFirewall")
226 { 652 {
227 var folder = TestData.Get(@"TestData", "UsingFirewall"); 653 var folder = TestData.Get(@"TestData", path);
228 var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder }); 654 var build = new Builder(folder, typeof(FirewallExtensionFactory), new[] { folder });
229 var output = Path.Combine(folder, $"Firewall{ruleName}.xml"); 655 var output = Path.Combine(folder, $"Firewall{ruleName}.xml");
230 656
@@ -232,7 +658,10 @@ namespace WixToolsetTest.Firewall
232 658
233 var doc = XDocument.Load(output); 659 var doc = XDocument.Load(output);
234 var actual = doc.Descendants() 660 var actual = doc.Descendants()
235 .Where(e => e.Name.Namespace == nameSpace) 661 .Where(e =>
662 {
663 return e.Name.Namespace == nameSpace && e.Name.LocalName == "FirewallException";
664 })
236 .Select(fe => new AttributeVerifier 665 .Select(fe => new AttributeVerifier
237 { 666 {
238 Name = fe.Attributes().Single(a => a.Name.LocalName == "Name").Value, 667 Name = fe.Attributes().Single(a => a.Name.LocalName == "Name").Value,
diff --git a/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs
index 957aa642..4bb2e192 100644
--- a/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs
+++ b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs
@@ -6,16 +6,51 @@
6 <Component> 6 <Component>
7 <File Name="fw.exe" Source="example.txt"> 7 <File Name="fw.exe" Source="example.txt">
8 <Shortcut Id="FwShortcut" Directory="INSTALLFOLDER" Name="Firewall" /> 8 <Shortcut Id="FwShortcut" Directory="INSTALLFOLDER" Name="Firewall" />
9 <fw:FirewallException Id="ExampleFirewall" Description="An app-based firewall exception" Name="ExampleApp" Port="42"> 9 <fw:FirewallException Id="ExampleFirewall" Description="An app-based firewall exception" Name="ExampleApp" Port="42" OnUpdate="DoNothing" >
10 <fw:RemoteAddress Value="*" /> 10 <fw:RemoteAddress Value="*" />
11 </fw:FirewallException> 11 </fw:FirewallException>
12 </File> 12 </File>
13 13
14 <fw:FirewallException Description="A port-based firewall exception" Name="ExamplePort" Port="42" Outbound="yes" Scope="localSubnet" /> 14 <fw:FirewallException Description="A port-based firewall exception" Name="ExamplePort" Port="42" Outbound="yes" Scope="localSubnet" OnUpdate="EnableOnly" />
15 <fw:FirewallException Description="DNS scope firewall exception" Name="ExampleDNSScope" Port="356" Protocol="udp" Scope="DNS" /> 15 <fw:FirewallException Description="DNS scope firewall exception" Name="ExampleDNSScope" Port="356" Protocol="udp" Scope="DNS" />
16 <fw:FirewallException Description="DHCP scope firewall exception" Name="ExampleDHCPScope" Program="test.exe" Protocol="211" Scope="DHCP" Profile="public" /> 16 <fw:FirewallException Description="DHCP scope firewall exception" Name="ExampleDHCPScope" Program="test.exe" Protocol="211" Scope="DHCP" Profile="public" />
17 <fw:FirewallException Description="WINS scope firewall exception" Name="ExampleWINSScope" Port="6573" Scope="WINS" Profile="domain"/> 17 <fw:FirewallException Description="WINS scope firewall exception" Name="ExampleWINSScope" Port="6573" Scope="WINS" Profile="domain"/>
18 <fw:FirewallException Description="defaultGateway scope firewall exception" Name="ExampleDefaultGatewayScope" Port="4432" Scope="defaultGateway" Profile="private" /> 18 <fw:FirewallException Description="defaultGateway scope firewall exception" Name="ExampleDefaultGatewayScope" Port="4432" Scope="defaultGateway" Profile="private" />
19
20 <fw:FirewallException Description="Defer to user edge traversal" Name="defertouser" Program="fw.exe" EdgeTraversal="DeferToUser" />
21 <fw:FirewallException Description="A port-based service exception" Name="ExampleService" Port="12000" Service="ftpsrv" Program="%windir%\system32\svchost.exe" >
22 <fw:LocalAddress Value="DHCP"/>
23 <fw:LocalAddress Value="WINS"/>
24 </fw:FirewallException>
25
26 <fw:FirewallException Description="Interfaces with nested elements" Name="interface nested" Port="54671" >
27 <fw:RemoteAddress Value="127.0.0.1"/>
28 <fw:Interface Name="Wi-Fi" />
29 <fw:Interface Name="Local Area Connection" />
30 </fw:FirewallException>
31 <fw:FirewallException Description="Interfaces with property" Name="interface property" Port="54671" Interface="[INTERFACE_PROPERTY]" />
32
33 <ServiceInstall Name="svc1" Type="ownProcess" Start="disabled" ErrorControl="ignore" >
34 <fw:FirewallException Id="ServiceInstall.nested" IgnoreFailure="true" Description="A port-based firewall exception for a windows service" Name="ExampleNestedService" Port="3546-7890" Scope="localSubnet" >
35 <fw:InterfaceType Value="Lan" />
36 <fw:InterfaceType Value="Wireless" />
37 </fw:FirewallException>
38 </ServiceInstall>
39
40 <fw:FirewallException Description="Simple INetFwRule3 values" Name="INetFwRule3 values" Scope="any" LocalAppPackageId="S-1-15-2-1239072475-3687740317-1842961305-3395936705-4023953123-1525404051-2779347315" LocalUserAuthorizedList="O:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)" LocalUserOwner="S-1-5-21-1898747406-2352535518-1247798438-1914" RemoteMachineAuthorizedList="127.0.0.1" RemoteUserAuthorizedList="O:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)" IPSecSecureFlags="NegotiateEncryption" />
41 <fw:FirewallException Description="INetFwRule3 passed via properties" Name="INetFwRule3 properties" Scope="any" LocalAppPackageId="[PROP1]" LocalUserAuthorizedList="[PROP2]" LocalUserOwner="[PROP3]" RemoteMachineAuthorizedList="[PROP4]" RemoteUserAuthorizedList="[PROP5]" IPSecSecureFlags="[PROP6]" />
42
43 <fw:FirewallException Description="Simple rule with grouping" Name="GroupingExample1" Program="fw.exe" Grouping="@yourresources.dll,-1005" />
44 <fw:FirewallException Description="Rule with grouping property" Name="GroupingExample2" Port="8732" Grouping="[GROUPING_PROP]" />
45
46 <fw:FirewallException Description="Simple ICMP rule" Name="ICMPExample1" Protocol="2" IcmpTypesAndCodes="4:*,9:*,12:*" />
47 <fw:FirewallException Description="Rule with ICMP property" Name="ICMPExample2" Protocol="2" IcmpTypesAndCodes="[ICMP_PROP]" />
48
49 <fw:FirewallException Description="Simple rule with local scope" Name="LocalScopeExample1" Scope="any" LocalScope="localSubnet" />
50 <fw:FirewallException Description="Rule with local scope property" Name="LocalScopeExample2" Scope="any" LocalScope="[LOCALSCOPE_PROP]" />
51
52 <fw:FirewallException Description="Simple rule with remote port" Name="RemotePortExample1" Scope="any" RemotePort="34560" />
53 <fw:FirewallException Description="Rule with remote port property" Name="RemotePortExample2" Program="fw.exe" RemotePort="[REMOTEPORT_PROP]" />
19 </Component> 54 </Component>
20 </ComponentGroup> 55 </ComponentGroup>
21 </Fragment> 56 </Fragment>
diff --git a/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/Package.en-us.wxl b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/Package.en-us.wxl
new file mode 100644
index 00000000..f1df1234
--- /dev/null
+++ b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/Package.en-us.wxl
@@ -0,0 +1,9 @@
1<!--
2This file contains the declaration of all the localizable strings.
3-->
4<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
5
6 <String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
7 <String Id="FeatureTitle" Value="MsiPackage" />
8
9</WixLocalization>
diff --git a/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/Package.wxs b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/Package.wxs
new file mode 100644
index 00000000..814becd1
--- /dev/null
+++ b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/Package.wxs
@@ -0,0 +1,15 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="BB4E61B3-EBE5-4DE7-B3E0-8699B5901D2E">
3 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
4
5 <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
6 <ComponentGroupRef Id="ProductComponents" />
7 </Feature>
8 </Package>
9
10 <Fragment>
11 <StandardDirectory Id="ProgramFilesFolder">
12 <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
13 </StandardDirectory>
14 </Fragment>
15</Wix>
diff --git a/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/PackageComponents.wxs b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/PackageComponents.wxs
new file mode 100644
index 00000000..05c3ea8a
--- /dev/null
+++ b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/PackageComponents.wxs
@@ -0,0 +1,53 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
3 xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall">
4 <Fragment>
5 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
6 <Component Id="FirewallComponent" Guid="28DF3387-F30E-4DBE-90E2-D2C760CB4DD9">
7 <fw:FirewallException
8 Name="[NAME]"
9 Port="[LOCALPORT]"
10 Protocol="[PROTOCOL]"
11 Program="[PROGRAM]"
12 Profile="[PROFILE]"
13 Description="[DESCRIPTION]"
14 Scope="[REMOTESCOPE]"
15 Action="[ACTION]"
16 EdgeTraversal="[EDGETRAVERSAL]"
17 Enabled="[ENABLED]"
18 Grouping="[GROUPING]"
19 IcmpTypesAndCodes="[ICMPTYPES]"
20 Interface="[INTERFACE]"
21 InterfaceType="[INTERFACETYPE]"
22 LocalScope="[LOCALSCOPE]"
23 RemotePort="[REMOTEPORT]"
24 Service="[SERVICE]"
25 LocalAppPackageId="[PACKAGEID]"
26 LocalUserAuthorizedList="[LOCALUSERS]"
27 LocalUserOwner="[LOCALOWNER]"
28 RemoteMachineAuthorizedList="[REMOTEMACHINES]"
29 RemoteUserAuthorizedList="[REMOTEUSERS]"
30 IPSecSecureFlags="[SECUREFLAGS]"
31 />
32
33 <fw:FirewallException Name="Single Nested properties" >
34 <fw:RemoteAddress Value="[REMOTEADDRESS]" />
35 <fw:LocalAddress Value="[LOCALADDRESS]" />
36 <fw:InterfaceType Value="[INTERFACETYPE]" />
37 <fw:Interface Name="[INTERFACE]" />
38 </fw:FirewallException>
39
40 <fw:FirewallException Name="Multiple Nested properties" >
41 <fw:RemoteAddress Value="[REMOTEADDRESS1]" />
42 <fw:RemoteAddress Value="[REMOTEADDRESS2]" />
43 <fw:LocalAddress Value="[LOCALADDRESS1]" />
44 <fw:LocalAddress Value="[LOCALADDRESS2]" />
45 <fw:InterfaceType Value="[INTERFACETYPE1]" />
46 <fw:InterfaceType Value="[INTERFACETYPE2]" />
47 <fw:Interface Name="[INTERFACE1]" />
48 <fw:Interface Name="[INTERFACE2]" />
49 </fw:FirewallException>
50 </Component>
51 </ComponentGroup>
52 </Fragment>
53</Wix>
diff --git a/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/example.txt b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/example.txt
new file mode 100644
index 00000000..1b4ffe8a
--- /dev/null
+++ b/src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingProperties/example.txt
@@ -0,0 +1 @@
This is example.txt. \ No newline at end of file
diff --git a/src/ext/Firewall/test/WixToolsetTest.Firewall/WixToolsetTest.Firewall.csproj b/src/ext/Firewall/test/WixToolsetTest.Firewall/WixToolsetTest.Firewall.csproj
index e46020a6..68acfe52 100644
--- a/src/ext/Firewall/test/WixToolsetTest.Firewall/WixToolsetTest.Firewall.csproj
+++ b/src/ext/Firewall/test/WixToolsetTest.Firewall/WixToolsetTest.Firewall.csproj
@@ -5,6 +5,8 @@
5 <PropertyGroup> 5 <PropertyGroup>
6 <TargetFramework>net6.0</TargetFramework> 6 <TargetFramework>net6.0</TargetFramework>
7 <IsWixTestProject>true</IsWixTestProject> 7 <IsWixTestProject>true</IsWixTestProject>
8 <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
9 <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
8 </PropertyGroup> 10 </PropertyGroup>
9 11
10 <ItemGroup> 12 <ItemGroup>