Skip to content

Commit c6a54d0

Browse files
committed
win,msi: correct installation path registry keys
This is a port of 14db629. Original commit message: Since install is per machine only, installation path should be stored in local machine instead of current user. The registry stores HKLM in different places for 32 and 64 bit applications, so the installer will not suggest the old path when upgrading from 32 to 64 bit version. Fixes nodejs/node-v0.x-archive#5592 Fixes nodejs/node-v0.x-archive#25087 PR-URL: nodejs/node-v0.x-archive#25640 Reviewed-By: Alexis Campailla <alexis@janeasystems.com> Reviewed-By: Bert Belder <bertbelder@gmail.com> PR-URL: #2565 Reviewed-By: Alexis Campailla <alexis@janeasystems.com>
1 parent 4cfe5eb commit c6a54d0

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

tools/msvs/msi/product.wxs

+31-11
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@
4444

4545
<Property Id="INSTALLDIR">
4646
<RegistrySearch Id="InstallPathRegistry"
47+
Type="raw"
48+
Root="HKLM"
49+
Key="$(var.RegistryKeyPath)"
50+
Name="InstallPath"/>
51+
<!-- Also need to search under HKCU to support upgrading from old
52+
versions. If we wanted to disable backward compatibility, this
53+
second search could be deleted. -->
54+
<RegistrySearch Id="InstallPathRegistryCU"
4755
Type="raw"
4856
Root="HKCU"
4957
Key="$(var.RegistryKeyPath)"
@@ -56,8 +64,9 @@
5664
Description="!(loc.NodeRuntime_Description)"
5765
Absent="disallow">
5866
<ComponentRef Id="NodeExecutable"/>
67+
<ComponentRef Id="NodeRegistryEntries"/>
5968
<ComponentRef Id="NodeVarsScript"/>
60-
<ComponentRef Id="NodeStartMenuAndRegistryEntries"/>
69+
<ComponentRef Id="NodeStartMenu"/>
6170
<ComponentRef Id="AppData" />
6271
<ComponentGroupRef Id="Product.Generated"/>
6372

@@ -129,6 +138,20 @@
129138
<File Id="node.exe" KeyPath="yes" Source="$(var.SourceDir)\node.exe"/>
130139
</Component>
131140

141+
<Component Id="NodeRegistryEntries">
142+
<RegistryValue Root="HKLM"
143+
Key="$(var.RegistryKeyPath)"
144+
Name="InstallPath"
145+
Type="string"
146+
Value="[INSTALLDIR]"
147+
KeyPath="yes"/>
148+
<RegistryValue Root="HKLM"
149+
Key="$(var.RegistryKeyPath)"
150+
Name="Version"
151+
Type="string"
152+
Value="$(var.ProductVersion)"/>
153+
</Component>
154+
132155
<Component Id="NodeVarsScript">
133156
<File Id="nodevars.bat" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodevars.bat"/>
134157
</Component>
@@ -151,18 +174,15 @@
151174
</DirectoryRef>
152175

153176
<DirectoryRef Id="ApplicationProgramsFolder">
154-
<Component Id="NodeStartMenuAndRegistryEntries">
177+
<Component Id="NodeStartMenu">
178+
<!-- RegistryValue needed because every Component must have a KeyPath.
179+
Because of ICE43, the Root must be HKCU. -->
155180
<RegistryValue Root="HKCU"
156-
Key="$(var.RegistryKeyPath)"
157-
Name="InstallPath"
158-
Type="string"
159-
Value="[INSTALLDIR]"
181+
Key="$(var.RegistryKeyPath)\Components"
182+
Name="NodeStartMenuShortcuts"
183+
Type="integer"
184+
Value="1"
160185
KeyPath="yes"/>
161-
<RegistryValue Root="HKCU"
162-
Key="$(var.RegistryKeyPath)"
163-
Name="Version"
164-
Type="string"
165-
Value="$(var.ProductVersion)"/>
166186
<Shortcut Id="NodeVarsScriptShortcut"
167187
Name="Node.js command prompt"
168188
Target="[%ComSpec]"

0 commit comments

Comments
 (0)