bootstrap: Support use with older API versions (see #3935)

This commit is contained in:
Marshall Greenblatt
2025-06-02 13:22:20 -04:00
parent 2c411892e2
commit 667e23b91c
2 changed files with 28 additions and 2 deletions

View File

@@ -30,6 +30,8 @@
#ifndef CEF_INCLUDE_CEF_VERSION_INFO_H_ #ifndef CEF_INCLUDE_CEF_VERSION_INFO_H_
#define CEF_INCLUDE_CEF_VERSION_INFO_H_ #define CEF_INCLUDE_CEF_VERSION_INFO_H_
#include <stddef.h>
#include "include/cef_api_hash.h" #include "include/cef_api_hash.h"
#include "include/internal/cef_export.h" #include "include/internal/cef_export.h"
@@ -82,6 +84,26 @@ typedef struct _cef_version_info_t {
/// ///
CEF_EXPORT void cef_version_info_all(cef_version_info_t* info); CEF_EXPORT void cef_version_info_all(cef_version_info_t* info);
#elif !defined(GENERATING_CEF_API_HASH)
// Unversioned definition to support use of the bootstrap and
// CefScopedLibraryLoader with older API versions.
typedef struct _cef_version_info_t {
// Size of this structure.
size_t size;
int cef_version_major;
int cef_version_minor;
int cef_version_patch;
int cef_commit_number;
int chrome_version_major;
int chrome_version_minor;
int chrome_version_build;
int chrome_version_patch;
} cef_version_info_t;
#endif // !defined(GENERATING_CEF_API_HASH)
/// ///
/// Populate CEF version information for the client library. /// Populate CEF version information for the client library.
/// ///
@@ -96,8 +118,6 @@ CEF_EXPORT void cef_version_info_all(cef_version_info_t* info);
(info)->chrome_version_build = CHROME_VERSION_BUILD; \ (info)->chrome_version_build = CHROME_VERSION_BUILD; \
(info)->chrome_version_patch = CHROME_VERSION_PATCH (info)->chrome_version_patch = CHROME_VERSION_PATCH
#endif // CEF_API_ADDED(CEF_NEXT)
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -59,7 +59,13 @@ HMODULE Load(const std::wstring& dll_path,
// which non-matching versions are compatible. // which non-matching versions are compatible.
cef_version_info_t dll_info = {}; cef_version_info_t dll_info = {};
dll_info.size = sizeof(cef_version_info_t); dll_info.size = sizeof(cef_version_info_t);
#if CEF_API_ADDED(CEF_NEXT)
cef_version_info_all(&dll_info); cef_version_info_all(&dll_info);
#else
// Only populating the members that are used below.
dll_info.chrome_version_major = cef_version_info(4);
dll_info.chrome_version_patch = cef_version_info(7);
#endif
if (dll_info.chrome_version_major != version_info->chrome_version_major || if (dll_info.chrome_version_major != version_info->chrome_version_major ||
dll_info.chrome_version_patch != version_info->chrome_version_patch) { dll_info.chrome_version_patch != version_info->chrome_version_patch) {
LOG(FATAL) << "Failed libcef.dll version check; expected " LOG(FATAL) << "Failed libcef.dll version check; expected "