# Windows installers no longer write registry keys

**URL:** <https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991>\
**Category:** Installing\
**Created:** [July 25, 2019, 12:32pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991 "2019-07-25T12:32:18Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmoura](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/pmoura/32/11_2.png) [@pmoura](https://swi-prolog.discourse.group/u/pmoura)\
**Post date:** [July 25, 2019, 12:32pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/1 "2019-07-25T12:32:18Z")

</div>

Hi,

Got a bug report from a user running Windows that the Logtalk installer no longer finds the SWI-Prolog installation performed using the Windows installers. After deleting my Windows SWI-Prolog installation and trying both stable and devel installers, I found that these no longer write the registry keys that the Logtalk installer have always depend on to provide integration with SWI-Prolog. With the SWI-Prolog installers defaulting to not add the executables paths to the Windows system path and the users being able to chose an arbitrary directory for the installation, there’s no longer any sensible automated way of providing the integration. I assume this isn issue caused by the switch to cmake-based installers? Is it possible to restore writing the registry keys?

Thanks,  
Paulo

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [July 25, 2019, 1:02pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/2 "2019-07-25T13:02:37Z")

</div>

It is surely caused by the switch as I (happy me) have no longer to write the NSIS builder program but this is done by CPack. I have no clue how simple it is to add some additional scripting to this. I’m happy to have a look, but if someone knows the answer, please propose a patch!

---

<div class="post-metadata">

**Author:** ![pmoura](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/pmoura/32/11_2.png) [@pmoura](https://swi-prolog.discourse.group/u/pmoura)\
**Post date:** [July 25, 2019, 1:07pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/3 "2019-07-25T13:07:27Z")

</div>

Found this answer:

> <https://stackoverflow.com/questions/44394194/how-add-registry-keys-with-cpack-package-install-registry-key>

Relavant?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [July 25, 2019, 1:10pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/4 "2019-07-25T13:10:46Z")

</div>

> [@pmoura](#):
>
> Relevant

I think so. Thanks. I’m not behind a Windows machine now 🙂

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [July 25, 2019, 7:45pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/5 "2019-07-25T19:45:07Z")

</div>

Pushed a fix. You can try tomorrows daily (if it builds).

---

<div class="post-metadata">

**Author:** ![pmoura](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/pmoura/32/11_2.png) [@pmoura](https://swi-prolog.discourse.group/u/pmoura)\
**Post date:** [July 25, 2019, 8:06pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/6 "2019-07-25T20:06:02Z")

</div>

Thanks for the quick fix! I will try the daily build tomorrow and report back.

Do you remember the first version number that used CPack instead of the old NSIS installer?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [July 26, 2019, 6:37am UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/7 "2019-07-26T06:37:58Z")

</div>

I don’t remember exactly. Somewhere around 7.7.20 I think.

---

<div class="post-metadata">

**Author:** ![pmoura](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/pmoura/32/11_2.png) [@pmoura](https://swi-prolog.discourse.group/u/pmoura)\
**Post date:** [July 26, 2019, 6:32pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/8 "2019-07-26T18:32:59Z")

</div>

Download today’s 64 bit build. The fix you commit works. Could you also apply the fix to the stable branch? Thanks.

Minor issue: the names of the daily build files seem to be invalid due to the asterisk in the name. Deleting it allowed me to copy the file to the Windows file system.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [July 28, 2019, 7:54am UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/9 "2019-07-28T07:54:38Z")

</div>

Good.

> [@pmoura](#):
>
> Could you also apply the fix to the stable branch?

Hmm. It isn’t really time for a new stable. There are hardly relevant patches. There might be an alternative fix. The CPack installer also contains:

```
WriteRegStr SHCTX "Software\SWI-Prolog\swipl" "" $INSTDIR

```

`SHCTX` is the _shell context_, which using a default installation seems to be the same as `HKLM`. Don’t aske me …

> [@pmoura](#):
>
> asterisk in the name

Good catch. Changed to `-`.

---

<div class="post-metadata">

**Author:** ![pmoura](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/pmoura/32/11_2.png) [@pmoura](https://swi-prolog.discourse.group/u/pmoura)\
**Post date:** [July 28, 2019, 1:54pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/10 "2019-07-28T13:54:56Z")

</div>

> [@jan](#):
>
> ![](https://global.discourse-cdn.com/free1/uploads/swiprolog/original/1X/919b58d6abd25e404a29a79678bb170fc6ba0770.png) pmoura:
> 
> > Could you also apply the fix to the stable branch?
> 
> Hmm. It isn’t really time for a new stable. There are hardly relevant patches.

I don’t mean releasing a new stable version, just committing the same patch to the stable branch or repo.

> [@jan](#):
>
> There might be an alternative fix. The CPack installer also contains:
> 
> ```prolog
> WriteRegStr SHCTX "Software\SWI-Prolog\swipl" "" $INSTDIR
> 
> ```
> 
> `SHCTX` is the _shell context_ , which using a default installation seems to be the same as `HKLM` . Don’t aske me …

`SHCTX` is `HKLM` when installing for all users and `HKCU` when installing for the current user. But I don’t think that `WriteRegStr` call is correct. It likely should be `"home"` instead of `""`. That bug may explain why there’s no `HKLM` or `HKCU` entries when running the current released installers for 8.0.3 and 8.1.10.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [July 28, 2019, 3:07pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/11 "2019-07-28T15:07:26Z")

</div>

> [@pmoura](#):
>
> committing the same patch to the stable branch or repo.

Done.

> [@pmoura](#):
>
> It likely should be `"home"` instead of `""` .

Seems fine. I can find this key nicely alongside SWI\Prolog. Regedit says the installation directory is the default value of the key. I think that is used by the generated uninstaller.

---

<div class="post-metadata">

**Author:** ![pmoura](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/pmoura/32/11_2.png) [@pmoura](https://swi-prolog.discourse.group/u/pmoura)\
**Post date:** [July 28, 2019, 7:31pm UTC](https://swi-prolog.discourse.group/t/windows-installers-no-longer-write-registry-keys/991/12 "2019-07-28T19:31:31Z")

</div>

> [@jan](#):
>
> > It likely should be `"home"` instead of `""` .
> 
> Seems fine. I can find this key nicely alongside SWI\Prolog. Regedit says the installation directory is the default value of the key. I think that is used by the generated uninstaller.

I uninstalled SWI-Prolog, delete all its registry key (written by pre-7.7.20 versions) and tried both 8.0.3 and 8.1.10 installers. Searching for SWI registry keys after the installs found none. Are you sure the key you found in the registry was not one written by an old installer?

Using `"home"` instead of `""` still sounds problematic: there are other entries besides the installation directory. Using `"home"` means that there’s no ambiguity when you need to retrieve the installation directory.
