VS1928
VS1928

Reputation: 67

NSIS installer defaults to previous startup preferences

Im able to install application with NSIS installer and later I update TaskManager->Startup preferences to disabled. After I uninstall and reinstall the application, Startup preferences defaults to previous user preference of "disabled". I want the installer to enforce Enabled always after new install, so application startups on reboot. How to achieve this with NSIS coding.

Thanks

Upvotes: 0

Views: 169

Answers (1)

Nutty
Nutty

Reputation: 83

I believe Microsoft wants this to be a purely user-controlled setting, but in any case the method Task Manager uses is to modify the appropriate REG_BINARY value in the following registry locations in either HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE, as appropriate:

SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run
SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32
SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder

Enabled items contain the data:

02 00 00 00 00 00 00 00 00 00 00 00

or

06 00 00 00 00 00 00 00 00 00 00 00

Disabled items contain data starting with 03000000... or 07000000... and followed by some hex values [perhaps it's a timestamp?], e.g.:

03 00 00 00 F4 0B 28 C9 9D 79 D1 01

I'm unclear what the distinction is between the ones that start with 02 and 06, but it seems 02s become 03s and 06s becomes 07s when disabled.

To ensure your startup item is enabled, either use WriteRegBin to set it back to 020000000000000000000000 or 060000000000000000000000, or just use DeleteRegValue and delete the value entirely.

Upvotes: 2

Related Questions