Skip to content

UWP doesn't allow reading regkeys #594

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

Merged
merged 3 commits into from
Mar 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions absl/base/internal/sysinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ static int GetNumCPUs() {
#if defined(_WIN32)

static double GetNominalCPUFrequency() {
// UWP apps don't have access to the registry and currently don't provide an
// API informing about CPU nominal frequency.
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
return 1.0;
#else
#pragma comment(lib, "advapi32.lib") // For Reg* functions.
HKEY key;
// Use the Reg* functions rather than the SH functions because shlwapi.dll
Expand All @@ -95,6 +101,7 @@ static double GetNominalCPUFrequency() {
}
}
return 1.0;
#endif // WINAPI_PARTITION_APP && !WINAPI_PARTITION_DESKTOP
}

#elif defined(CTL_HW) && defined(HW_CPU_FREQ)
Expand Down