When selecting "Start Bitcoin Core on system login" in the settings, it will unselect itself after closing the dialog.

Tested with current master (e8ffec6) on Windows 7.

{
    std::lock_guard<std::mutex> ulock(cs_dir_locks);
    fs::path pathLockFile = directory / lockfile_name;
    
    if (dir_locks.count(pathLockFile.string())) {
        return true;
    }
    
    FILE* file = fsbridge::fopen(pathLockFile, "a");
    if (file) fclose(file);
    try {
        auto lock = MakeUnique<boost::interprocess::file_lock>(pathLockFile.string().c_str());
        if (!lock->try_lock()) {
            return false;
        }
        if (!probe_only) {
            
            dir_locks.emplace(pathLockFile.string(), std::move(lock));
        }
    } catch (const boost::interprocess::interprocess_exception& e) {
        return error("Error while attempting to lock directory %s: %s", directory.string(), e.what());
    }
    return true;
}
void ReleaseDirectoryLocks()
{
    std::lock_guard<std::mutex> ulock(cs_dir_locks);
    dir_locks.clear();
}
bool DirIsWritable(const fs::path& directory)