diff options
Diffstat (limited to 'src/WixToolset.Core/CompilerCore.cs')
| -rw-r--r-- | src/WixToolset.Core/CompilerCore.cs | 64 |
1 files changed, 1 insertions, 63 deletions
diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs index 7cb7b703..651c80a3 100644 --- a/src/WixToolset.Core/CompilerCore.cs +++ b/src/WixToolset.Core/CompilerCore.cs | |||
| @@ -831,42 +831,6 @@ namespace WixToolset.Core | |||
| 831 | } | 831 | } |
| 832 | 832 | ||
| 833 | /// <summary> | 833 | /// <summary> |
| 834 | /// Gets a RegistryRoot value and displays an error for an illegal value. | ||
| 835 | /// </summary> | ||
| 836 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | ||
| 837 | /// <param name="attribute">The attribute containing the value to get.</param> | ||
| 838 | /// <param name="allowHkmu">Whether HKMU is considered a valid value.</param> | ||
| 839 | /// <returns>The attribute's RegisitryRootType value.</returns> | ||
| 840 | [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes")] | ||
| 841 | public Wix.RegistryRootType GetAttributeRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu) | ||
| 842 | { | ||
| 843 | Wix.RegistryRootType registryRoot = Wix.RegistryRootType.NotSet; | ||
| 844 | string value = this.GetAttributeValue(sourceLineNumbers, attribute); | ||
| 845 | |||
| 846 | if (0 < value.Length) | ||
| 847 | { | ||
| 848 | registryRoot = Wix.Enums.ParseRegistryRootType(value); | ||
| 849 | |||
| 850 | if (Wix.RegistryRootType.IllegalValue == registryRoot || (!allowHkmu && Wix.RegistryRootType.HKMU == registryRoot)) | ||
| 851 | { | ||
| 852 | // TODO: Find a way to expose the valid values programatically! | ||
| 853 | if (allowHkmu) | ||
| 854 | { | ||
| 855 | this.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value, | ||
| 856 | "HKMU", "HKCR", "HKCU", "HKLM", "HKU")); | ||
| 857 | } | ||
| 858 | else | ||
| 859 | { | ||
| 860 | this.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value, | ||
| 861 | "HKCR", "HKCU", "HKLM", "HKU")); | ||
| 862 | } | ||
| 863 | } | ||
| 864 | } | ||
| 865 | |||
| 866 | return registryRoot; | ||
| 867 | } | ||
| 868 | |||
| 869 | /// <summary> | ||
| 870 | /// Gets a RegistryRoot as a MsiInterop.MsidbRegistryRoot value and displays an error for an illegal value. | 834 | /// Gets a RegistryRoot as a MsiInterop.MsidbRegistryRoot value and displays an error for an illegal value. |
| 871 | /// </summary> | 835 | /// </summary> |
| 872 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> | 836 | /// <param name="sourceLineNumbers">Source line information about the owner element.</param> |
| @@ -876,33 +840,7 @@ namespace WixToolset.Core | |||
| 876 | [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes")] | 840 | [SuppressMessage("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes")] |
| 877 | public int GetAttributeMsidbRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu) | 841 | public int GetAttributeMsidbRegistryRootValue(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool allowHkmu) |
| 878 | { | 842 | { |
| 879 | Wix.RegistryRootType registryRoot = this.GetAttributeRegistryRootValue(sourceLineNumbers, attribute, allowHkmu); | 843 | return this.parseHelper.GetAttributeMsidbRegistryRootValue(sourceLineNumbers, attribute, allowHkmu); |
| 880 | |||
| 881 | switch (registryRoot) | ||
| 882 | { | ||
| 883 | case Wix.RegistryRootType.NotSet: | ||
| 884 | return CompilerConstants.IntegerNotSet; | ||
| 885 | case Wix.RegistryRootType.HKCR: | ||
| 886 | return Core.Native.MsiInterop.MsidbRegistryRootClassesRoot; | ||
| 887 | case Wix.RegistryRootType.HKCU: | ||
| 888 | return Core.Native.MsiInterop.MsidbRegistryRootCurrentUser; | ||
| 889 | case Wix.RegistryRootType.HKLM: | ||
| 890 | return Core.Native.MsiInterop.MsidbRegistryRootLocalMachine; | ||
| 891 | case Wix.RegistryRootType.HKU: | ||
| 892 | return Core.Native.MsiInterop.MsidbRegistryRootUsers; | ||
| 893 | case Wix.RegistryRootType.HKMU: | ||
| 894 | // This is gross, but there was *one* registry root parsing instance | ||
| 895 | // (in Compiler.ParseRegistrySearchElement()) that did not explicitly | ||
| 896 | // handle HKMU and it fell through to the default error case. The | ||
| 897 | // others treated it as -1, which is what we do here. | ||
| 898 | if (allowHkmu) | ||
| 899 | { | ||
| 900 | return -1; | ||
| 901 | } | ||
| 902 | break; | ||
| 903 | } | ||
| 904 | |||
| 905 | return CompilerConstants.IntegerNotSet; | ||
| 906 | } | 844 | } |
| 907 | 845 | ||
| 908 | /// <summary> | 846 | /// <summary> |
