Просмотр исходного кода

libobs: Remove Qt5 module check

Partial revert of a0eae6f33cda382b72eb39fd9fb06176449a1d4d.
Partial revert of 23c3ad4d02053029fa4ce68167abc0dfaabb2725.
Partial revert of 97b34ebb76010eb8e2c3fa4c298fa4857d2afb70.

Keep all of the get_plugin_info stuff, remove the Qt5 checks.
Ryan Foster 1 месяц назад
Родитель
Сommit
3afc2577d3
4 измененных файлов с 6 добавлено и 91 удалено
  1. 0 4
      libobs/CMakeLists.txt
  2. 2 11
      libobs/obs-module.c
  3. 1 2
      libobs/util/platform-nix.c
  4. 3 74
      libobs/util/platform-windows.c

+ 0 - 4
libobs/CMakeLists.txt

@@ -15,10 +15,6 @@ find_package(FFmpeg 6.1 REQUIRED avformat avutil swscale swresample OPTIONAL_COM
 find_package(ZLIB REQUIRED)
 find_package(Uthash REQUIRED)
 
-if(ENABLE_UI)
-  find_package(Qt6 REQUIRED Core)
-endif()
-
 find_package(jansson REQUIRED)
 if(NOT TARGET OBS::caption)
   add_subdirectory("${CMAKE_SOURCE_DIR}/deps/libcaption" "${CMAKE_BINARY_DIR}/deps/libcaption")

+ 2 - 11
libobs/obs-module.c

@@ -442,7 +442,7 @@ void obs_add_disabled_module(const char *name)
 	da_push_back(obs->disabled_modules, &item);
 }
 
-extern void get_plugin_info(const char *path, bool *is_obs_plugin, bool *can_load);
+extern void get_plugin_info(const char *path, bool *is_obs_plugin);
 
 struct fail_info {
 	struct dstr fail_modules;
@@ -497,9 +497,8 @@ static void load_all_callback(void *param, const struct obs_module_info2 *info)
 	obs_module_t *disabled_module;
 
 	bool is_obs_plugin;
-	bool can_load_obs_plugin;
 
-	get_plugin_info(info->bin_path, &is_obs_plugin, &can_load_obs_plugin);
+	get_plugin_info(info->bin_path, &is_obs_plugin);
 
 	if (!is_obs_plugin) {
 		blog(LOG_WARNING, "Skipping module '%s', not an OBS plugin", info->bin_path);
@@ -518,14 +517,6 @@ static void load_all_callback(void *param, const struct obs_module_info2 *info)
 		return;
 	}
 
-	if (!can_load_obs_plugin) {
-		blog(LOG_WARNING,
-		     "Skipping module '%s' due to possible "
-		     "import conflicts",
-		     info->bin_path);
-		goto load_failure;
-	}
-
 	int code = obs_open_module(&module, info->bin_path, info->data_path);
 	switch (code) {
 	case MODULE_MISSING_EXPORTS:

+ 1 - 2
libobs/util/platform-nix.c

@@ -104,10 +104,9 @@ void os_dlclose(void *module)
 		dlclose(module);
 }
 
-void get_plugin_info(const char *path, bool *is_obs_plugin, bool *can_load)
+void get_plugin_info(const char *path, bool *is_obs_plugin)
 {
 	*is_obs_plugin = true;
-	*can_load = true;
 	UNUSED_PARAMETER(path);
 }
 

+ 3 - 74
libobs/util/platform-windows.c

@@ -27,7 +27,6 @@
 #include "platform.h"
 #include "darray.h"
 #include "dstr.h"
-#include "obsconfig.h"
 #include "util_uint64.h"
 #include "windows/win-registry.h"
 #include "windows/win-version.h"
@@ -134,65 +133,6 @@ void os_dlclose(void *module)
 	FreeLibrary(module);
 }
 
-#if OBS_QT_VERSION == 6
-static bool has_qt5_import(VOID *base, PIMAGE_NT_HEADERS nt_headers)
-{
-	__try {
-		PIMAGE_DATA_DIRECTORY data_dir;
-		data_dir = &nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT];
-
-		if (data_dir->Size == 0)
-			return false;
-
-		PIMAGE_SECTION_HEADER section, last_section;
-		section = IMAGE_FIRST_SECTION(nt_headers);
-		last_section = section;
-
-		/* find the section that contains the export directory */
-		int i;
-		for (i = 0; i < nt_headers->FileHeader.NumberOfSections; i++) {
-			if (section->VirtualAddress <= data_dir->VirtualAddress) {
-				last_section = section;
-				section++;
-				continue;
-			} else {
-				break;
-			}
-		}
-
-		/* double check in case we exited early */
-		if (last_section->VirtualAddress > data_dir->VirtualAddress ||
-		    section->VirtualAddress <= data_dir->VirtualAddress)
-			return false;
-
-		section = last_section;
-
-		/* get a pointer to the import directory */
-		PIMAGE_IMPORT_DESCRIPTOR import;
-		import = (PIMAGE_IMPORT_DESCRIPTOR)((byte *)base + data_dir->VirtualAddress - section->VirtualAddress +
-						    section->PointerToRawData);
-
-		while (import->Name != 0) {
-			char *name = (char *)((byte *)base + import->Name - section->VirtualAddress +
-					      section->PointerToRawData);
-
-			/* qt5? bingo, reject this library */
-			if (astrcmpi_n(name, "qt5", 3) == 0) {
-				return true;
-			}
-
-			import++;
-		}
-
-	} __except (EXCEPTION_EXECUTE_HANDLER) {
-		/* we failed somehow, for compatibility assume no qt5 import */
-		return false;
-	}
-
-	return false;
-}
-#endif
-
 static bool has_obs_export(VOID *base, PIMAGE_NT_HEADERS nt_headers)
 {
 	__try {
@@ -258,7 +198,7 @@ static bool has_obs_export(VOID *base, PIMAGE_NT_HEADERS nt_headers)
 	return false;
 }
 
-void get_plugin_info(const char *path, bool *is_obs_plugin, bool *can_load)
+void get_plugin_info(const char *path, bool *is_obs_plugin)
 {
 	struct dstr dll_name;
 	wchar_t *wpath;
@@ -271,7 +211,6 @@ void get_plugin_info(const char *path, bool *is_obs_plugin, bool *can_load)
 	PIMAGE_NT_HEADERS nt_headers;
 
 	*is_obs_plugin = false;
-	*can_load = false;
 
 	if (!path)
 		return;
@@ -314,19 +253,10 @@ void get_plugin_info(const char *path, bool *is_obs_plugin, bool *can_load)
 
 		*is_obs_plugin = has_obs_export(base, nt_headers);
 
-#if OBS_QT_VERSION == 6
-		if (*is_obs_plugin) {
-			*can_load = !has_qt5_import(base, nt_headers);
-		}
-#else
-		*can_load = true;
-#endif
-
 	} __except (EXCEPTION_EXECUTE_HANDLER) {
 		/* we failed somehow, for compatibility let's assume it
 		 * was a valid plugin and let the loader deal with it */
 		*is_obs_plugin = true;
-		*can_load = true;
 		goto cleanup;
 	}
 
@@ -344,11 +274,10 @@ cleanup:
 bool os_is_obs_plugin(const char *path)
 {
 	bool is_obs_plugin;
-	bool can_load;
 
-	get_plugin_info(path, &is_obs_plugin, &can_load);
+	get_plugin_info(path, &is_obs_plugin);
 
-	return is_obs_plugin && can_load;
+	return is_obs_plugin;
 }
 
 union time_data {