Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updater: Check for write permissions in directory of Updater.exe. #11281

Merged
merged 2 commits into from Nov 22, 2022

Conversation

AdmiralCurtiss
Copy link
Contributor

ie, don't blindly assume working directory is directory Updater.exe is in.

This should fix the weird issue where a chain of Dolphin.exe -> Updater.exe -> Dolphin.exe -> Updater.exe requests UAC because it tries to open Updater.log in C:\Windows\System32 (which is the working directory inherited from the permissions downgrade via explorer.exe).

Technically the arguments could request a different path to write the update to, but that shouldn't really happen in practice I think...?

@shuffle2
Copy link
Contributor

shuffle2 commented Nov 21, 2022

maybe the MessageBox calls in this file can be changed to UI::Error?

I think the filename used for permission check should be changed to something else and then deleted (FILE_FLAG_DELETE_ON_CLOSE). Updater.log is actually stored in dolphin's user/Logs folder, and not next to the binary - so having two files named the same yet used for different purposes is confusing.

@AdmiralCurtiss
Copy link
Contributor Author

Like that?

@shuffle2
Copy link
Contributor

basically yes. could be like this tho:

const auto test_fh = CreateFileW(
      std::filesystem::path(*path).replace_filename("directory_writable_check.tmp").c_str(),
      GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE,
      nullptr);

@AdmiralCurtiss AdmiralCurtiss merged commit 5e442f6 into dolphin-emu:master Nov 22, 2022
11 checks passed
@AdmiralCurtiss AdmiralCurtiss deleted the updater-admin-check branch November 22, 2022 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants