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

ToDo: support reading default settings from HKLM registry key #2347

Open
clsid2 opened this issue Nov 17, 2023 · 0 comments
Open

ToDo: support reading default settings from HKLM registry key #2347

clsid2 opened this issue Nov 17, 2023 · 0 comments

Comments

@clsid2
Copy link
Owner

clsid2 commented Nov 17, 2023

This would be useful for sysadmins and installers.

Step 1:

Port profile code from MPC-BE to replace current profile functions implemented in CMPlayerCApp and WinAPI (such as GetProfileInt/WriteProfileInt). It is basically a custom implementation of that same functionality. We can extend it to do next steps.

Step 2:

Allow reading from HKLM until end of CAppSettings::LoadSettings(). Which in current code is signaled by bInitialized=true.

At application start do the following:

  1. Check if HKLM settings key exists. If it does then allow reading settings from HKLM. Whether it should be preferred over HKCU is determined below.
  2. Read value SettingsReset from HKLM and HKCU. Value is 0 if not existing. If value from HKLM is larger than 0 and larger than from HKCU, then delete whole HKCU key to reset user settings to internal defaults (or whatever is specified by HKLM). Set HKLM as preferred. Set HKCU as unavailable (since it is empty) until end of LoadSettings.
  3. Read value SettingsTimestamp from HKLM and HKCU. If HKLM value is larger, then it means that settings are read from HKLM first, and if not found, read from HKCU. Otherwise HKCU is tried first.
  4. At end of LoadSettings write updated SettingsReset and SettingsTimestamp values to HKCU so they are equal to HKLM.

An epoch value is logical for these two new registry key values. But a date in ISO format would work fine too. That is up to end users.

SettingsTimestamp allows pushing updated settings to individual user accounts.
SettingsReset allows doing a full settings reset.

Step 3:

When storing settings to INI file, redirect contents of MediaHistory section to a separate INI file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant