From f9c203a816e3e0ab89cab2321a4e698318c3ca6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Wed, 13 Mar 2024 11:30:21 +0800 Subject: [PATCH] Update python.cpp --- LunaHook/engines/python/python.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/LunaHook/engines/python/python.cpp b/LunaHook/engines/python/python.cpp index 3959b4d..f155579 100644 --- a/LunaHook/engines/python/python.cpp +++ b/LunaHook/engines/python/python.cpp @@ -84,16 +84,13 @@ std::unordered_map loadfontfiles() { auto lpLogfonts = std::make_unique(dwFontsLoaded); DWORD cbBuffer = dwFontsLoaded * sizeof(LOGFONTW); - if (!GetFontResourceInfo(fontfile.c_str(), &cbBuffer, lpLogfonts.get(), QFR_LOGFONT)) { - RemoveFontResourceExW(fontfile.c_str(), FR_PRIVATE, 0); - continue; - } + auto succ=GetFontResourceInfo(fontfile.c_str(), &cbBuffer, lpLogfonts.get(), QFR_LOGFONT); + RemoveFontResourceExW(fontfile.c_str(), FR_PRIVATE, 0); + if (!succ)continue; for (int k = 0; k < dwFontsLoaded; k++) fntss[i].insert(std::make_pair(lpLogfonts[k].lfFaceName, fontfile)); - RemoveFontResourceExW(fontfile.c_str(), FR_PRIVATE, 0); - } - }; + }; for (int i = 0; i < LOADFONTTHREADNUM; i++) { ts.emplace_back(std::thread(singletask,i)); }