diff --git a/modules/desktop_capture/win/window_capture_utils.cc b/modules/desktop_capture/win/window_capture_utils.cc index 845463372d..ef60c9fad6 100644 --- a/modules/desktop_capture/win/window_capture_utils.cc +++ b/modules/desktop_capture/win/window_capture_utils.cc @@ -186,9 +186,8 @@ bool WindowCaptureHelperWin::IsWindowChromeNotification(HWND hwnd) { const size_t kClassLength = 256; WCHAR class_name[kClassLength]; const int class_name_length = GetClassNameW(hwnd, class_name, kClassLength); - RTC_DCHECK(class_name_length) - << "Error retrieving the application's class name"; - if (wcsncmp(class_name, kChromeWindowClassPrefix, + if (class_name_length < 1 || + wcsncmp(class_name, kChromeWindowClassPrefix, wcsnlen_s(kChromeWindowClassPrefix, kClassLength)) != 0) { return false; } diff --git a/modules/desktop_capture/window_capturer_win.cc b/modules/desktop_capture/window_capturer_win.cc index 4ab1feb3ed..3dbec83423 100644 --- a/modules/desktop_capture/window_capturer_win.cc +++ b/modules/desktop_capture/window_capturer_win.cc @@ -54,8 +54,8 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) { const size_t kClassLength = 256; WCHAR class_name[kClassLength]; const int class_name_length = GetClassNameW(hwnd, class_name, kClassLength); - RTC_DCHECK(class_name_length) - << "Error retrieving the application's class name"; + if (class_name_length < 1) + return TRUE; // Skip Program Manager window and the Start button. This is the same logic // that's used in Win32WindowPicker in libjingle. Consider filtering other