Skip to content

Commit 14db629

Browse files
joaocgreisorangemocha
authored andcommitted
win,msi: correct installation path registry keys
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 #5592 Fixes #25087 PR-URL: nodejs/node-v0.x-archive#25640 Reviewed-By: Alexis Campailla <alexis@janeasystems.com> Reviewed-By: Bert Belder <bertbelder@gmail.com>
1 parent 8e80528 commit 14db629

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
@@ -32,6 +32,14 @@
3232

3333
<Property Id="INSTALLDIR">
3434
<RegistrySearch Id="InstallPathRegistry"
35+
Type="raw"
36+
Root="HKLM"
37+
Key="$(var.RegistryKeyPath)"
38+
Name="InstallPath"/>
39+
<!-- Also need to search under HKCU to support upgrading from old
40+
versions. If we wanted to disable backward compatibility, this
41+
second search could be deleted. -->
42+
<RegistrySearch Id="InstallPathRegistryCU"
3543
Type="raw"
3644
Root="HKCU"
3745
Key="$(var.RegistryKeyPath)"
@@ -44,8 +52,9 @@
4452
Description="Install the core Node.js runtime (node.exe)."
4553
Absent="disallow">
4654
<ComponentRef Id="NodeExecutable"/>
55+
<ComponentRef Id="NodeRegistryEntries"/>
4756
<ComponentRef Id="NodeVarsScript"/>
48-
<ComponentRef Id="NodeStartMenuAndRegistryEntries"/>
57+
<ComponentRef Id="NodeStartMenu"/>
4958
<ComponentRef Id="AppData" />
5059
<ComponentGroupRef Id="Product.Generated"/>
5160

@@ -117,6 +126,20 @@
117126
<File Id="node.exe" KeyPath="yes" Source="$(var.SourceDir)\node.exe"/>
118127
</Component>
119128

129+
<Component Id="NodeRegistryEntries">
130+
<RegistryValue Root="HKLM"
131+
Key="$(var.RegistryKeyPath)"
132+
Name="InstallPath"
133+
Type="string"
134+
Value="[INSTALLDIR]"
135+
KeyPath="yes"/>
136+
<RegistryValue Root="HKLM"
137+
Key="$(var.RegistryKeyPath)"
138+
Name="Version"
139+
Type="string"
140+
Value="$(var.ProductVersion)"/>
141+
</Component>
142+
120143
<Component Id="NodeVarsScript">
121144
<File Id="nodevars.bat" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodevars.bat"/>
122145
</Component>
@@ -139,18 +162,15 @@
139162
</DirectoryRef>
140163

141164
<DirectoryRef Id="ApplicationProgramsFolder">
142-
<Component Id="NodeStartMenuAndRegistryEntries">
165+
<Component Id="NodeStartMenu">
166+
<!-- RegistryValue needed because every Component must have a KeyPath.
167+
Because of ICE43, the Root must be HKCU. -->
143168
<RegistryValue Root="HKCU"
144-
Key="$(var.RegistryKeyPath)"
145-
Name="InstallPath"
146-
Type="string"
147-
Value="[INSTALLDIR]"
169+
Key="$(var.RegistryKeyPath)\Components"
170+
Name="NodeStartMenuShortcuts"
171+
Type="integer"
172+
Value="1"
148173
KeyPath="yes"/>
149-
<RegistryValue Root="HKCU"
150-
Key="$(var.RegistryKeyPath)"
151-
Name="Version"
152-
Type="string"
153-
Value="$(var.ProductVersion)"/>
154174
<Shortcut Id="NodeVarsScriptShortcut"
155175
Name="Node.js command prompt"
156176
Target="[%ComSpec]"

0 commit comments

Comments
 (0)