Skip to content

Commit

Permalink
Remove registry check for WindowsMediaVersion
Browse files Browse the repository at this point in the history
Instead move the check for the MF startup result to CheckDependencies. It was used only for logging, but the logging was configured *after* the constructor call so it never got logged.

The check also probably never applied, because the loading of ScreenRecorderLib already fails if MF.dll is missing.

Fixes #227
  • Loading branch information
hakito committed Feb 13, 2023
1 parent 1c425bc commit 14e2ad0
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions ScreenRecorderLibNative/RecordingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ RecordingManager::RecordingManager() :
{
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
m_MfStartupResult = MFStartup(MF_VERSION, MFSTARTUP_LITE);
if (SUCCEEDED(m_MfStartupResult)) {
LOG_INFO(L"Media Foundation started");
}
else {
LOG_ERROR("Media foundation failed to start: hr = 0x%08x", m_MfStartupResult);
}
TIMECAPS tc;
UINT targetResolutionMs = 1;
if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) == TIMERR_NOERROR)
Expand Down Expand Up @@ -834,8 +828,9 @@ bool RecordingManager::CheckDependencies(_Out_ std::wstring *error)
HKEY hk;
DWORD errorCode;

if (errorCode = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\WindowsFeatures\\WindowsMediaVersion", 0, KEY_READ, &hk) != ERROR_SUCCESS) {
errorText = L"Missing dependency: Windows Media Features.";
if (FAILED(m_MfStartupResult)) {
LOG_ERROR("Media Foundation failed to start: hr = 0x%08x", m_MfStartupResult);
errorText = L"Failed to start Media Foundation.";
result = false;
}
else {
Expand Down

0 comments on commit 14e2ad0

Please sign in to comment.