Skip to content

Commit 05633cc

Browse files
committed
- Issue #1171: RegFileImporter does not support hex(b): REG_QWORD
Partial fix as WiX still does not support REG_QWORD===integer64
1 parent 0ff5afb commit 05633cc

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

Source/src/WixSharp.Test/IssueFixesTest.cs

+22
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,28 @@ public void Fix_Issue_1114()
6161
project.BuildWxs();
6262
}
6363

64+
[Fact]
65+
[Description("Issue #1171")]
66+
public void Fix_Issue_1171()
67+
{
68+
var tempFile = System.IO.Path.GetTempFileName();
69+
try
70+
{
71+
System.IO.File.WriteAllLines(tempFile, new[]
72+
{
73+
"Windows Registry Editor Version 5.00",
74+
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Test]",
75+
"\"New Value #1\"=dword:00000001",
76+
"\"New Value #2\"=hex(b):02,00,00,00,00,00,00,00",
77+
});
78+
var values = WixSharp.RegFileImporter.ImportFrom(tempFile);
79+
}
80+
finally
81+
{
82+
tempFile.DeleteIfExists();
83+
}
84+
}
85+
6486
[Fact]
6587
[Description("Issue #1132")]
6688
public void Fix_Issue_1132()

Source/src/WixSharp.Test/RegFileTest.cs

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public void Should_Create_RegValue_From_String()
2626
Assert.IsType<string>(value);
2727
Assert.Equal(value, "%PATH%");
2828

29+
value = RegFileImporter.Deserialize("hex(b):02,00,00,00,00,00,00,00", Encoding.Unicode);
30+
Assert.IsType<long>(value);
31+
Assert.Equal(value, 2L);
32+
2933
value = RegFileImporter.Deserialize(@"hex(7):6f,00,6e,00,65,00,00,00,74,00,77,00,6f,00,00,00,74,00,68,\
3034
00,72,00,65,00,65,00,00,00,00,00", Encoding.Unicode);
3135
Assert.IsType<string>(value);

Source/src/WixSharp/RegFileImporter.cs

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ THE SOFTWARE.
2323

2424
#endregion Licence...
2525

26-
using Microsoft.Win32;
2726
using System;
2827
using System.Collections.Generic;
29-
using System.Text;
3028
using System.Linq;
29+
using System.Text;
3130
using System.Text.RegularExpressions;
31+
using Microsoft.Win32;
3232

3333
namespace WixSharp
3434
{
@@ -103,6 +103,13 @@ public static object Deserialize(string text, Encoding encoding)
103103
if (isPreffix("hex(4):") || isPreffix("dword:"))
104104
return Convert.ToInt32(rawValue, 16);
105105

106+
//WiX '64 integer'
107+
if (isPreffix("hex(b):"))
108+
{
109+
byte[] data = rawValue.Unescape().DecodeFromRegHex();
110+
return BitConverter.ToInt64(data, 0);
111+
}
112+
106113
//WiX 'multiString'
107114
if (isPreffix("hex(7):"))
108115
{

0 commit comments

Comments
 (0)