@@ -13,6 +13,7 @@ public class LocalDebugRegistryWriter : IRegistryWriter
13
13
{
14
14
public string Write ( IOrderedEnumerable < RegistryEntry > entries )
15
15
{
16
+ //System.Diagnostics.Debugger.Launch(); //uncomment if need to debug
16
17
var sb = new StringBuilder ( "Windows Registry Editor Version 5.00" + Environment . NewLine + Environment . NewLine ) ;
17
18
var distinctKeys = new List < string > ( ) ;
18
19
@@ -30,14 +31,16 @@ public string Write(IOrderedEnumerable<RegistryEntry> entries)
30
31
throw new InvalidOperationException ( "Unexpected registry entry: " + entry . Key ) ;
31
32
}
32
33
33
- var value = ReplacePlaceholder ( entry . Value , entry . Bitness ) ;
34
-
35
- var key = Registry . CurrentUser . CreateSubKey ( entry . Key ) ;
36
- if ( ! ( string . IsNullOrWhiteSpace ( entry . Name ) && string . IsNullOrWhiteSpace ( value ) ) )
34
+ if ( Environment . Is64BitOperatingSystem )
37
35
{
38
- key . SetValue ( entry . Name , value ) ;
36
+ MakeRegistryEntries ( entry , RegistryKey . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Registry32 ) ) ;
37
+ MakeRegistryEntries ( entry , RegistryKey . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Registry64 ) ) ;
39
38
}
40
-
39
+ else
40
+ {
41
+ MakeRegistryEntries ( entry , RegistryKey . OpenBaseKey ( RegistryHive . CurrentUser , RegistryView . Registry32 ) ) ;
42
+ }
43
+
41
44
if ( ! distinctKeys . Contains ( entry . Key ) )
42
45
{
43
46
distinctKeys . Add ( entry . Key ) ;
@@ -50,7 +53,19 @@ public string Write(IOrderedEnumerable<RegistryEntry> entries)
50
53
sb . AppendLine ( "[-HKEY_CURRENT_USER\\ " + key + "]" + Environment . NewLine ) ;
51
54
}
52
55
53
- return sb . ToString ( ) ;
56
+ return sb . ToString ( ) ; //FIXME: this is not printing reg redirections.
57
+ }
58
+
59
+ private void MakeRegistryEntries ( RegistryEntry entry , RegistryKey hKey )
60
+ {
61
+ var key = hKey . CreateSubKey ( entry . Key ) ;
62
+
63
+ var value = ReplacePlaceholder ( entry . Value , entry . Bitness ) ;
64
+
65
+ if ( ! ( string . IsNullOrWhiteSpace ( entry . Name ) && string . IsNullOrWhiteSpace ( value ) ) )
66
+ {
67
+ key . SetValue ( entry . Name , value ) ;
68
+ }
54
69
}
55
70
56
71
//Cache the string so we call the AssemblyDirectory only once
0 commit comments