From bfa91cbd9535c2edba914a48fd81eec6c7c2ce0f Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 9 Nov 2021 17:14:54 +0100 Subject: [PATCH] Windows: Include blacklisted libraries in SendSystemInfo data --- src/slic3r/GUI/SendSystemInfoDialog.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/slic3r/GUI/SendSystemInfoDialog.cpp b/src/slic3r/GUI/SendSystemInfoDialog.cpp index da6e57f88..4b11347e2 100644 --- a/src/slic3r/GUI/SendSystemInfoDialog.cpp +++ b/src/slic3r/GUI/SendSystemInfoDialog.cpp @@ -1,6 +1,7 @@ #include "SendSystemInfoDialog.hpp" #include "libslic3r/AppConfig.hpp" +#include "libslic3r/BlacklistedLibraryCheck.hpp" #include "libslic3r/Platform.hpp" #include "libslic3r/Utils.hpp" @@ -479,6 +480,29 @@ static std::string generate_system_info_json() hw_node.add_child("Monitors", monitors_node); data_node.add_child("Hardware", hw_node); +#ifdef _WIN32 + { + pt::ptree blacklisted_node; + std::vector blacklisted_libraries; + BlacklistedLibraryCheck::get_instance().get_blacklisted(blacklisted_libraries); + for (const std::wstring& str : blacklisted_libraries) { + std::string utf8; + const size_t num_bytes = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.size(), utf8.data(), 0, 0, 0); + utf8.resize(num_bytes); + if (WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.size(), utf8.data(), num_bytes, 0, 0)) { + if (size_t last_bs_pos = utf8.find_last_of("\\"); last_bs_pos < utf8.size() - 1) { + // Remove anything before last backslash so we don't send the path to the DLL. + utf8.erase(0, last_bs_pos + 1); + } + pt::ptree node; // Create an unnamed node containing the value + node.put("", utf8); + blacklisted_node.push_back(std::make_pair("", node)); // Add this node to the list. + } + } + data_node.add_child("Blacklisted libraries", blacklisted_node); + } +#endif // _WIN32 + pt::ptree opengl_node; opengl_node.put("Version", OpenGLManager::get_gl_info().get_version()); opengl_node.put("GLSLVersion", OpenGLManager::get_gl_info().get_glsl_version());