diff options
author | Bob Arnson <bob@firegiant.com> | 2025-06-17 22:12:41 -0400 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2025-06-17 22:12:41 -0400 |
commit | 19632223ee00a8305acadc90a52828ddeb0bfaa4 (patch) | |
tree | 2deb0b32cf492e2106a601b02a69536e9cd82de4 | |
parent | 390ee54c29d050ba393ff431115308bdb2aaf4ca (diff) | |
download | wix-bob/DecompileMsiLockPermissionsEx.tar.gz wix-bob/DecompileMsiLockPermissionsEx.tar.bz2 wix-bob/DecompileMsiLockPermissionsEx.zip |
Fix MsiLockPermissionsEx decompilation.bob/DecompileMsiLockPermissionsEx
Fixes https://github.com/wixtoolset/issues/issues/9096
8 files changed, 120 insertions, 3 deletions
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 7e28df5d..9cc3d88e 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | |||
@@ -1444,12 +1444,13 @@ namespace WixToolset.Core.WindowsInstaller.Decompile | |||
1444 | /// </remarks> | 1444 | /// </remarks> |
1445 | private void FinalizePermissionsTable(TableIndexedCollection tables, string tableName) | 1445 | private void FinalizePermissionsTable(TableIndexedCollection tables, string tableName) |
1446 | { | 1446 | { |
1447 | var createFoldersById = this.IndexTableOneToMany(tables, tableName); | 1447 | var createFoldersById = this.IndexTableOneToMany(tables, "CreateFolder"); |
1448 | var msiLockPermissionsEx = tableName == "MsiLockPermissionsEx"; | ||
1448 | 1449 | ||
1449 | foreach (var row in tables[tableName]?.Rows ?? Enumerable.Empty<Row>()) | 1450 | foreach (var row in tables[tableName]?.Rows ?? Enumerable.Empty<Row>()) |
1450 | { | 1451 | { |
1451 | var id = row.FieldAsString(0); | 1452 | var id = row.FieldAsString(msiLockPermissionsEx ? 1 : 0); |
1452 | var table = row.FieldAsString(1); | 1453 | var table = row.FieldAsString(msiLockPermissionsEx ? 2 : 1); |
1453 | var xPermission = this.DecompilerHelper.GetIndexedElement(row); | 1454 | var xPermission = this.DecompilerHelper.GetIndexedElement(row); |
1454 | 1455 | ||
1455 | if ("CreateFolder" == table) | 1456 | if ("CreateFolder" == table) |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index 86da7ebd..b9d14ed9 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs | |||
@@ -108,6 +108,18 @@ namespace WixToolsetTest.CoreIntegration | |||
108 | } | 108 | } |
109 | 109 | ||
110 | [Fact] | 110 | [Fact] |
111 | public void CanDecompileMsiLockPermissionsEx() | ||
112 | { | ||
113 | DecompileAndCompare("MsiLockPermissionsEx.msi", extract: false, "MsiLockPermissionsEx_expected.wxs", "TestData", "Decompile"); | ||
114 | } | ||
115 | |||
116 | [Fact] | ||
117 | public void CanDecompileLockPermissions() | ||
118 | { | ||
119 | DecompileAndCompare("LockPermissions.msi", extract: false, "LockPermissions_expected.wxs", "TestData", "Decompile"); | ||
120 | } | ||
121 | |||
122 | [Fact] | ||
111 | public void CanDecompileMergeModuleWithKeepModularizationIds() | 123 | public void CanDecompileMergeModuleWithKeepModularizationIds() |
112 | { | 124 | { |
113 | using (var fs = new DisposableFileSystem()) | 125 | using (var fs = new DisposableFileSystem()) |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions.msi b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions.msi new file mode 100644 index 00000000..510990ac --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions.msi | |||
Binary files differ | |||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions_expected.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions_expected.wxs new file mode 100644 index 00000000..253f2cda --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions_expected.wxs | |||
@@ -0,0 +1,30 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Package Codepage="65001" Id="Acme.HelloWorld" Manufacturer="Acme" ProductCode="{AC257DA2-5CFB-42E6-9392-E96BFE70EBBE}" Language="0" Name="HelloWorld" Version="6.0.0" UpgradeCode="{002C7487-6DD2-5C30-9445-8D02984AC904}"> | ||
4 | <StandardDirectory Id="ProgramFiles6432Folder"> | ||
5 | <Directory Id="INSTALLFOLDER" ShortName="fwpsjck5" Name="Acme HelloWorld"> | ||
6 | <Directory Id="dRmny_KvyDONxhM5Hhb1TRAHxI2Y" Name="Blargh" /> | ||
7 | <Component Id="nkf88TB7NualpER94lroZ5_cgKEJZk" Guid="{F89F8234-8CBF-5EB3-AE62-71C2F5EA966C}" Bitness="always32" Condition="INSTALLCOOLFONTS"> | ||
8 | <File Id="nkf88TB7NualpER94lroZ5_cgKEJZk" ShortName="uj0jcrbw.wxs" Name="LockPermissions_src.wxs" FontTitle="Helvetibob Bold Oblique" KeyPath="yes" Source="SourceDir\File\nkf88TB7NualpER94lroZ5_cgKEJZk"> | ||
9 | <Permission User="Bob" Write="yes" WriteAttributes="yes" Delete="yes" /> | ||
10 | </File> | ||
11 | </Component> | ||
12 | <Component Id="Permissions" Guid="{9E0E9393-9F96-48D1-991E-A99EDAE3F345}" Bitness="always32"> | ||
13 | <CreateFolder Directory="dRmny_KvyDONxhM5Hhb1TRAHxI2Y"> | ||
14 | <Permission User="Bob" CreateFile="yes" CreateChild="yes" Delete="yes" /> | ||
15 | </CreateFolder> | ||
16 | <RegistryValue Id="regWNla9n07njmsmnBd7dVCQVPibZM" Key="SOFTWARE\Acme\HelloWorld" Name="EnvironmentVariables" Root="HKLM" Type="integer" Value="1" KeyPath="yes"> | ||
17 | <Permission User="Bob" Write="yes" Delete="yes" /> | ||
18 | </RegistryValue> | ||
19 | </Component> | ||
20 | </Directory> | ||
21 | </StandardDirectory> | ||
22 | <StandardDirectory Id="ProgramFilesFolder" /> | ||
23 | <Feature Id="WixDefaultFeature" Level="1" Display="hidden"> | ||
24 | <ComponentRef Id="nkf88TB7NualpER94lroZ5_cgKEJZk" /> | ||
25 | <ComponentRef Id="Permissions" /> | ||
26 | </Feature> | ||
27 | <Media Id="1" EmbedCab="yes" Cabinet="cab1.cab" /> | ||
28 | <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> | ||
29 | </Package> | ||
30 | </Wix> \ No newline at end of file | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions_src.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions_src.wxs new file mode 100644 index 00000000..dcb2fd50 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/LockPermissions_src.wxs | |||
@@ -0,0 +1,22 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Package Id="Acme.HelloWorld" Name="HelloWorld" Version="6.0.0" Manufacturer="Acme"> | ||
4 | <MediaTemplate EmbedCab="yes" /> | ||
5 | |||
6 | <File Source="$(sys.SOURCEFILEPATH)" FontTitle="Helvetibob Bold Oblique" Condition="INSTALLCOOLFONTS"> | ||
7 | <Permission User="Bob" Write="yes" WriteAttributes="yes" Delete="yes" /> | ||
8 | </File> | ||
9 | |||
10 | <Component Id="Permissions" Guid="{9E0E9393-9F96-48D1-991E-A99EDAE3F345}"> | ||
11 | <RegistryKey Root="HKLM" Key="SOFTWARE\Acme\HelloWorld"> | ||
12 | <RegistryValue Name="EnvironmentVariables" Value="1" Type="integer" KeyPath="yes"> | ||
13 | <Permission User="Bob" Write="yes" Delete="yes" /> | ||
14 | </RegistryValue> | ||
15 | </RegistryKey> | ||
16 | |||
17 | <CreateFolder Subdirectory="Blargh"> | ||
18 | <Permission User="Bob" CreateChild="yes" CreateFile="yes" Delete="yes" /> | ||
19 | </CreateFolder> | ||
20 | </Component> | ||
21 | </Package> | ||
22 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx.msi b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx.msi new file mode 100644 index 00000000..e117dcc3 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx.msi | |||
Binary files differ | |||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx_expected.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx_expected.wxs new file mode 100644 index 00000000..7cf9df67 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx_expected.wxs | |||
@@ -0,0 +1,30 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Package Codepage="65001" Id="Acme.HelloWorld" Manufacturer="Acme" ProductCode="{6068AC19-D69C-4862-8A30-05EDBDA2AE84}" Language="0" Name="HelloWorld" Version="6.0.0" UpgradeCode="{002C7487-6DD2-5C30-9445-8D02984AC904}"> | ||
4 | <StandardDirectory Id="ProgramFiles6432Folder"> | ||
5 | <Directory Id="INSTALLFOLDER" ShortName="fwpsjck5" Name="Acme HelloWorld"> | ||
6 | <Directory Id="dRmny_KvyDONxhM5Hhb1TRAHxI2Y" Name="Blargh" /> | ||
7 | <Component Id="nkf.QewusgIMYDSgIl11WJ5JrljyXg" Guid="{98E2424B-98B4-5561-AAFF-87374A41B6DA}" Bitness="always32" Condition="INSTALLCOOLFONTS"> | ||
8 | <File Id="nkf.QewusgIMYDSgIl11WJ5JrljyXg" ShortName="kot60v3u.wxs" Name="MsiLockPermissionsEx_src.wxs" FontTitle="Helvetibob Bold Oblique" KeyPath="yes" Source="SourceDir\File\nkf.QewusgIMYDSgIl11WJ5JrljyXg"> | ||
9 | <PermissionEx Id="pmeWXloTBzPOCqmZnvaF6EFmtnWGyg" Sddl="asdf" Condition="INSTALLCOOLFONTSWITHPERMISSIONS" /> | ||
10 | </File> | ||
11 | </Component> | ||
12 | <Component Id="Permissions" Guid="{9E0E9393-9F96-48D1-991E-A99EDAE3F345}" Bitness="always32"> | ||
13 | <CreateFolder Directory="dRmny_KvyDONxhM5Hhb1TRAHxI2Y"> | ||
14 | <PermissionEx Id="pmeIGYDv2CC.loRcT25hwAabyEVb1k" Sddl="zxcv" /> | ||
15 | </CreateFolder> | ||
16 | <RegistryValue Id="regWNla9n07njmsmnBd7dVCQVPibZM" Key="SOFTWARE\Acme\HelloWorld" Name="EnvironmentVariables" Root="HKLM" Type="integer" Value="1" KeyPath="yes"> | ||
17 | <PermissionEx Id="pmeAxeHnEF3Y.VKHIK5m8RywpU1Jz0" Sddl="qwer" /> | ||
18 | </RegistryValue> | ||
19 | </Component> | ||
20 | </Directory> | ||
21 | </StandardDirectory> | ||
22 | <StandardDirectory Id="ProgramFilesFolder" /> | ||
23 | <Feature Id="WixDefaultFeature" Level="1" Display="hidden"> | ||
24 | <ComponentRef Id="nkf.QewusgIMYDSgIl11WJ5JrljyXg" /> | ||
25 | <ComponentRef Id="Permissions" /> | ||
26 | </Feature> | ||
27 | <Media Id="1" EmbedCab="yes" Cabinet="cab1.cab" /> | ||
28 | <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> | ||
29 | </Package> | ||
30 | </Wix> \ No newline at end of file | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx_src.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx_src.wxs new file mode 100644 index 00000000..9ffc7b56 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Decompile/MsiLockPermissionsEx_src.wxs | |||
@@ -0,0 +1,22 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Package Id="Acme.HelloWorld" Name="HelloWorld" Version="6.0.0" Manufacturer="Acme"> | ||
4 | <MediaTemplate EmbedCab="yes" /> | ||
5 | |||
6 | <File Source="$(sys.SOURCEFILEPATH)" FontTitle="Helvetibob Bold Oblique" Condition="INSTALLCOOLFONTS"> | ||
7 | <PermissionEx Condition="INSTALLCOOLFONTSWITHPERMISSIONS" Sddl="asdf" /> | ||
8 | </File> | ||
9 | |||
10 | <Component Id="Permissions" Guid="{9E0E9393-9F96-48D1-991E-A99EDAE3F345}"> | ||
11 | <RegistryKey Root="HKLM" Key="SOFTWARE\Acme\HelloWorld"> | ||
12 | <RegistryValue Name="EnvironmentVariables" Value="1" Type="integer" KeyPath="yes"> | ||
13 | <PermissionEx Sddl="qwer" /> | ||
14 | </RegistryValue> | ||
15 | </RegistryKey> | ||
16 | |||
17 | <CreateFolder Subdirectory="Blargh"> | ||
18 | <PermissionEx Sddl="zxcv" /> | ||
19 | </CreateFolder> | ||
20 | </Component> | ||
21 | </Package> | ||
22 | </Wix> | ||