Skip to content

Commit bb24c4a

Browse files
joaocgreisrvagg
authored andcommitted
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 <[email protected]> Reviewed-By: Bert Belder <[email protected]> PR-URL: #2565 Reviewed-By: Alexis Campailla <[email protected]> Cherry picked to v3.x by @rvagg, PR: #2608
1 parent 752977b commit bb24c4a

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

tools/msvs/msi/product.wxs

+32-12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535

3636
<Property Id="INSTALLDIR">
3737
<RegistrySearch Id="InstallPathRegistry"
38+
Type="raw"
39+
Root="HKLM"
40+
Key="$(var.RegistryKeyPath)"
41+
Name="InstallPath"/>
42+
<!-- Also need to search under HKCU to support upgrading from old
43+
versions. If we wanted to disable backward compatibility, this
44+
second search could be deleted. -->
45+
<RegistrySearch Id="InstallPathRegistryCU"
3846
Type="raw"
3947
Root="HKCU"
4048
Key="$(var.RegistryKeyPath)"
@@ -47,8 +55,9 @@
4755
Description="!(loc.NodeRuntime_Description)"
4856
Absent="disallow">
4957
<ComponentRef Id="NodeExecutable"/>
58+
<ComponentRef Id="NodeRegistryEntries"/>
5059
<ComponentRef Id="NodeVarsScript"/>
51-
<ComponentRef Id="NodeStartMenuAndRegistryEntries"/>
60+
<ComponentRef Id="NodeStartMenu"/>
5261
<ComponentRef Id="AppData" />
5362
<ComponentGroupRef Id="Product.Generated"/>
5463

@@ -133,6 +142,20 @@
133142
<RemoveFile Id="node.exe" Name="node.exe" On="both" />
134143
</Component>
135144

145+
<Component Id="NodeRegistryEntries">
146+
<RegistryValue Root="HKLM"
147+
Key="$(var.RegistryKeyPath)"
148+
Name="InstallPath"
149+
Type="string"
150+
Value="[INSTALLDIR]"
151+
KeyPath="yes"/>
152+
<RegistryValue Root="HKLM"
153+
Key="$(var.RegistryKeyPath)"
154+
Name="Version"
155+
Type="string"
156+
Value="$(var.ProductVersion)"/>
157+
</Component>
158+
136159
<Component Id="NodeVarsScript">
137160
<File Id="nodevars.bat" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodevars.bat"/>
138161
</Component>
@@ -155,18 +178,15 @@
155178
</DirectoryRef>
156179

157180
<DirectoryRef Id="ApplicationProgramsFolder">
158-
<Component Id="NodeStartMenuAndRegistryEntries">
181+
<Component Id="NodeStartMenu">
182+
<!-- RegistryValue needed because every Component must have a KeyPath.
183+
Because of ICE43, the Root must be HKCU. -->
159184
<RegistryValue Root="HKCU"
160-
Key="$(var.RegistryKeyPath)"
161-
Name="InstallPath"
162-
Type="string"
163-
Value="[INSTALLDIR]"
185+
Key="$(var.RegistryKeyPath)\Components"
186+
Name="NodeStartMenuShortcuts"
187+
Type="integer"
188+
Value="1"
164189
KeyPath="yes"/>
165-
<RegistryValue Root="HKCU"
166-
Key="$(var.RegistryKeyPath)"
167-
Name="Version"
168-
Type="string"
169-
Value="$(var.ProductVersion)"/>
170190
<Shortcut Id="NodeVarsScriptShortcut"
171191
Name="io.js command prompt"
172192
Target="[%ComSpec]"
@@ -292,10 +312,10 @@
292312
</InstallUISequence>
293313

294314
<InstallExecuteSequence>
315+
<Custom Action='SetInstallScope' Before='FindRelatedProducts'/>
295316
<Custom Action="LinkNodeExeToIojsExe" After="InstallFiles">
296317
$NodeAlias = 3
297318
</Custom>
298-
<Custom Action='SetInstallScope' Before='FindRelatedProducts'/>
299319
<Custom Action='BroadcastEnvironmentUpdate' After='InstallFinalize'/>
300320
</InstallExecuteSequence>
301321

0 commit comments

Comments
 (0)