{"action":"opened","issue":{"url":"https://api.github.com/repos/Tyrrrz/LightBulb/issues/120","repository_url":"https://api.github.com/repos/Tyrrrz/LightBulb","labels_url":"https://api.github.com/repos/Tyrrrz/LightBulb/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/Tyrrrz/LightBulb/issues/120/comments","events_url":"https://api.github.com/repos/Tyrrrz/LightBulb/issues/120/events","html_url":"https://github.com/Tyrrrz/LightBulb/issues/120","id":524659900,"node_id":"MDU6SXNzdWU1MjQ2NTk5MDA=","number":120,"title":"Installer does not respect 'Start with Windows' setting.","user":{"login":"NomDeMorte","id":45681208,"node_id":"MDQ6VXNlcjQ1NjgxMjA4","avatar_url":"https://avatars0.githubusercontent.com/u/45681208?v=4","gravatar_id":"","url":"https://api.github.com/users/NomDeMorte","html_url":"https://github.com/NomDeMorte","followers_url":"https://api.github.com/users/NomDeMorte/followers","following_url":"https://api.github.com/users/NomDeMorte/following{/other_user}","gists_url":"https://api.github.com/users/NomDeMorte/gists{/gist_id}","starred_url":"https://api.github.com/users/NomDeMorte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NomDeMorte/subscriptions","organizations_url":"https://api.github.com/users/NomDeMorte/orgs","repos_url":"https://api.github.com/users/NomDeMorte/repos","events_url":"https://api.github.com/users/NomDeMorte/events{/privacy}","received_events_url":"https://api.github.com/users/NomDeMorte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-11-18T22:34:45Z","updated_at":"2019-11-18T22:34:45Z","closed_at":null,"author_association":"NONE","body":"If I set the 'Start with Windows' option off, then install a new version, the installer always creates a new startup option.\r\n\r\nThe UI will still show that the option is off, when it is in fact on.\r\n\r\nSince I have the startup entry, but it is disabled via task manager's 'Start-up' tab, This also means I can have a startup setting that is disabled, but enabled, but disabled, but enabled, but disabled. LOL. To be clear:\r\n\r\nDisabled in the application settings\r\nEnabled by recreating the entry with the installer\r\nStill disabled in the application UI and settings file\r\nEnabled as in the entry exists in task manager\r\nDisabled as in that entry is disabled\r\n\r\nFun! hahaha\r\n\r\nPerhaps the best way to handle this, would be to check when the app starts, that the appropriate startup setting is applied. \r\n\r\nEither way it is set, there is the chance that it could behave opposite to the setting, if it is reinstalled/updated, and then rebooted - the only way I can imagine around that, would be to have the installer parse existing settings files, which sounds overly complex for a corner case. \r\n\r\nAlthough, there's also Computer\\HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved\\Run perhaps if you wanted to use the approach of disabling the startup entry (as I do manually) rather than removing it? \r\nThat way, when the installer creates the startup entry, it remains disabled as previously set by the user, and the application can just manage that entry - although it should probably ensure that the entry there, and in the settings file, match up, when the app starts.\r\n\r\nThe user has perms to that key, I'm unsure if there's an API to use it, but searching around I see a lot of people saying that setting it to anything other than 02 00 00 00  00 00 00 00  00 00  00 00 seems to disable it. There's some more info [here ](https://stackoverflow.com/questions/24257104/how-to-store-and-retrieve-date-time-in-windows-registry-with-reg-binary-type-in) suggesting that the strange numbers there are filetimes, I can't find any official docs at a first glance. \r\n\r\nObserving the behaviour, it appears that whenever I enable and then re-disabled it, that timestamp changes, so I'm pretty sure that it's actually using the current time when it is disabled. \r\n\r\nI've also found [evidence ](https://social.msdn.microsoft.com/Forums/en-US/0393869b-6f0d-494b-9606-59c249c2303a/how-to-get-the-status-of-the-startup-programms)of numbers other than 02 00.... enabling, and other than 03 00 .... disabling. Since this is a binary value, it got me to thinking bitwise, and I noticed I can change anything with a 02 to any other even number, and it will appear as enabled, and any odd number and it will appear as disabled.\r\n\r\n![image](https://user-images.githubusercontent.com/45681208/69099275-79118500-0aae-11ea-88d4-2350f83f6988.png)\r\n\r\nAdditionally, I have observed that when disabling it via the UI, it adds 1 to the highest byte, and then appends the current timestamp to the lowest 8, eg:\r\n\r\n![image](https://user-images.githubusercontent.com/45681208/69099372-b70ea900-0aae-11ea-9d3f-2b105711b710.png)\r\n\r\nAnd then disabling it likewise subtracts 1 from the highest byte and clears the lowest 8 bytes.\r\nThe 2nd, 3rd, and 4th highest bytes are always 0.\r\n\r\nHopefully you know of an API to change this behaviour officially, but I imagine that's enough for you to get it working if you would like to. It would probably be more elegant than modding the installer and less messy for the user in that corner case, but certainly looks annoying for you to make :( Gotta love undocumented regkeys.\r\n"}}
{"actor":{"display_login":"NomDeMorte"}}