OpenVPN / openvpn-build

OpenVPN Build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Launch on user logon setting lost on upgrade

richardschuetz opened this issue · comments

OpenVPN GUI is not launched on Windows startup anymore after upgrading the previous version to OpenVPN 2.5.2. The relevant Active Setup configuration is not working as intended:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{E5931AF4-2A8F-48A5-AFC8-0E8A268358A0}
    (Default)    REG_SZ    OpenVPN 2.5.2-I601 amd64
    Version    REG_SZ    1
    IsInstalled    REG_DWORD    0x1
    DontAsk    REG_DWORD    0x2
    StubPath    REG_EXPAND_SZ    reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /f /v OPENVPN-GUI /t REG_SZ /d "C:\Program Files\OpenVPN\bin\openvpn-gui.exe"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{E5931AF4-2A8F-48A5-AFC8-CE9B79C4B19D}
    (Default)    REG_SZ    OpenVPN 2.5.1-I601 amd64
    Version    REG_SZ    1
    IsInstalled    REG_DWORD    0x0
    DontAsk    REG_DWORD    0x2
    StubPath    REG_SZ    reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v OPENVPN-GUI /f

{E5931AF4-2A8F-48A5-AFC8-CE9B79C4B19D} is processed after {E5931AF4-2A8F-48A5-AFC8-0E8A268358A0} and immediately deletes the Run registry key again. It looks like the keys are processed in alphanumeric order, so only specific GUID combinations trigger this behavior.

This seems to be still an issue - we ran into the same problem.

With the NSIS installer, this never happened because it only ever wrote to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\OpenVPN_UserSetup, but the MSI setup uses a different key with each version.

According to https://helgeklein.com/blog/active-setup-explained/, the reg delete command should never run because IsInstalled gets set to 0, but it looks like this is not true (anymore).

As there is no need for the Active Setup key to be a GUID, why not use the version for it (e.g. OpenVPN_UserSetup_2.5.8) which should be in alphanumeric order?

This does not reproduce for me.

I first installed 2.5.3 and then 2.6_rc1. After restart openvpn-gui was launched as expected. Here are relevant registry keys:

PS C:\Users\lev> reg query "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{8D1D2E66-7286-41B9-90EA-AB4393E575DF}"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{8D1D2E66-7286-41B9-90EA-AB4393E575DF}
    (Default)    REG_SZ    OpenVPN 2.6_rc1-I001 arm64
    Version    REG_SZ    1
    IsInstalled    REG_DWORD    0x1
    DontAsk    REG_DWORD    0x2
    StubPath    REG_EXPAND_SZ    reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /f /v OPENVPN-GUI /t REG_SZ /d "C:\Program Files\OpenVPN\bin\openvpn-gui.exe"

PS C:\Users\lev> reg query "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{E5931AF4-2A8F-48A5-AFC8-460348F480E8}"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{E5931AF4-2A8F-48A5-AFC8-460348F480E8}
    (Default)    REG_SZ    OpenVPN 2.5.3-I601 arm64
    Version    REG_SZ    1
    IsInstalled    REG_DWORD    0x0
    DontAsk    REG_DWORD    0x2
    StubPath    REG_SZ    reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v OPENVPN-GUI /f

I use Windows 11 22H2 ARM64.

I can still reproduce the problem (e.g. when upgrading from OpenVPN 2.5.8 to 2.6_rc1). You must restart your user session after each installation, otherwise the first Active Setup component is never marked as installed for your user account (see HKEY_CURRENT_USER\SOFTWARE\Microsoft\Active Setup\Installed Components).

Oh I see, I managed to reproduce it with logging off/on after each install.

Let me implement NSIS behavior from 68d9ebf

@richardschuetz Installer with the fix is coming here, may I ask you to test it?

I can confirm that the setting is now preserved when upgrading from OpenVPN 2.5.8 to the development version.