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

reg.cpp: check for guid format #172

Merged
merged 5 commits into from
Jul 9, 2021
Merged

Conversation

Artoria2e5
Copy link
Contributor

If this complies this should fix #171

@DDoSolitary
Copy link
Owner

DDoSolitary commented Jun 30, 2021

Thanks. Some suggestions:

  • Pass the string as const ref (crwstr)
  • Also skip if the string is too long (code == ERROR_MORE_DATA)
  • Add a corresponding unit test in test_reg.cpp

@Artoria2e5
Copy link
Contributor Author

I think I should really grab a compiler before I do all that...

@Artoria2e5
Copy link
Contributor Author

Artoria2e5 commented Jul 1, 2021

Oh by the way, I don't think the thing needs a length check. The calling buffer is supposed to only be that long anyways, and I don't find the regex particularly complex.

(Yes I am deleting War Thunder high-res assets and googling MSVC community)

@DDoSolitary
Copy link
Owner

I mean, as Microsoft is adding other "non-distro" subkeys under the Lxss key, it's possible that they add something whose name is longer than a GUID. In that case, the current code will simply throw an exception and exit immediately

else if (code) throw lro_error::from_win32(err_msg::err_enum_key, { reg_base_path }, code);

This is not very ideal and we need to make it skip the subkey instead.

- Fix build errors
- Make the regex object static
- Pass string as const ref
- Also check if key is too long
@DDoSolitary DDoSolitary merged commit bdc6d7d into DDoSolitary:master Jul 9, 2021
@Artoria2e5
Copy link
Contributor Author

many thanks for cleaning my shit up…

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

Successfully merging this pull request may close these issues.

Couldn't get the value "DistributionName" on Windows 11
2 participants