From 621c6fcfd36381a2b43cf21a8b0a309fbc54d16c Mon Sep 17 00:00:00 2001 From: Bruce Date: Mon, 22 Dec 2025 23:58:53 +0800 Subject: [PATCH] Fix bugs. --- dlltest/main.cpp | 5 +++-- pkgread/pkgread.h | 17 ++++++++++++++++- shared/html/settings/appinstaller.html | 2 +- shared/html/settings/appinstaller/theme.html | 12 ++++++++++-- shared/html/settings/settings.html | 2 +- 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/dlltest/main.cpp b/dlltest/main.cpp index a61271b..6c97413 100644 --- a/dlltest/main.cpp +++ b/dlltest/main.cpp @@ -191,12 +191,13 @@ int main (int argc, char *argv []) { setlocale (LC_ALL, ""); std::wcout.imbue (std::locale ("", LC_CTYPE)); + CoInitializeEx (nullptr, COINIT_MULTITHREADED); std::wcout << L"Please enter the file path: " << std::endl; std::wcout << L"\\> "; std::wstring pkgPathStr = L"E:\\Profiles\\Bruce\\Desktop\\Discourse.appx"; - pkgPathStr = L"F:\\BaiduNetdiskDownload\\Collection4\\Microsoft.BingFinance_2015.709.2014.2069_neutral_~_8wekyb3d8bbwe\\FinanceApp_3.0.4.336_x86.appx"; + //pkgPathStr = L"F:\\BaiduNetdiskDownload\\Collection4\\Microsoft.BingFinance_2015.709.2014.2069_neutral_~_8wekyb3d8bbwe\\FinanceApp_3.0.4.336_x86.appx"; //pkgPathStr = L"F:\\BaiduNetdiskDownload\\Collection4\\Microsoft.BingFinance_2015.709.2014.2069_neutral_~_8wekyb3d8bbwe.appxbundle"; - //pkgPathStr = L""; + pkgPathStr = L"E:\\Profiles\\Bruce\\Desktop\\新建文件夹\\Microsoft.MSIXPackagingTool_2023.1212.538.0_neutral_~_8wekyb3d8bbwe.Msixbundle"; if (pkgPathStr.empty ()) std::getline (std::wcin, pkgPathStr); pkgPathStr.erase ( std::remove (pkgPathStr.begin (), pkgPathStr.end (), L'\"'), diff --git a/pkgread/pkgread.h b/pkgread/pkgread.h index b121f3a..39085cf 100644 --- a/pkgread/pkgread.h +++ b/pkgread/pkgread.h @@ -368,7 +368,14 @@ class package_reader { #ifdef _PRI_READER_CLI_HEADER_ pribundlereader.destroy (); - for (auto &it : prifilestreams) if (it != nullptr) DestroyAppxFileStream (it); + for (auto &it : prifilestreams) + { + if (it != nullptr) + { + DestroyAppxFileStream (it); + it = nullptr; + } + } prifilestreams.clear (); switch (this->package_type ()) { @@ -383,6 +390,7 @@ class package_reader case PKGTYPE_BUNDLE: { HANDLE hls = nullptr, hss = nullptr; destruct rel1 ([&hls, &hss] () { + if (hls == hss) hss = nullptr; if (hls) DestroyAppxFileStream (hls); if (hss) DestroyAppxFileStream (hss); }); @@ -423,6 +431,9 @@ class package_reader } } break; } + std::sort (prifilestreams.begin (), prifilestreams.end ()); + auto last = std::unique (prifilestreams.begin (), prifilestreams.end ()); + prifilestreams.erase (last, prifilestreams.end ()); try { std::vector resnames; @@ -598,6 +609,7 @@ class package_reader case PKGTYPE_BUNDLE: { HANDLE pkg = nullptr, pic = nullptr; destruct relp ([&pic, &pkg] () { + if (pic == pkg) pkg = nullptr; // 虽然来说这个代码永远无法达到,但是保险起见 if (pic) DestroyAppxFileStream (pic); if (pkg) DestroyAppxFileStream (pkg); pkg = nullptr; @@ -616,12 +628,14 @@ class package_reader if (lpstr) free (lpstr); HANDLE pkg1 = nullptr, pic1 = nullptr; destruct relp1 ([&pic1, &pkg1] () { + if (pic1 == pkg1) pkg1 = nullptr; // 虽然来说这个代码永远无法达到,但是保险起见 if (pic1) DestroyAppxFileStream (pic1); if (pkg1) DestroyAppxFileStream (pkg1); pkg1 = nullptr; pic1 = nullptr; }); pkg1 = GetAppxBundleApplicationPackageFile (hReader); + if (pkg1 == pkg) pkg = nullptr; if (pkg1) { pic1 = GetFileFromPayloadPackage (pkg1, logo ().c_str ()); @@ -782,6 +796,7 @@ class package_reader case PKGTYPE_BUNDLE: { HANDLE pkg = nullptr, pic = nullptr; destruct relp ([&pic, &pkg] () { + if (pic == pkg) pkg = nullptr; // 虽然来说这个代码永远无法达到,但是保险起见 if (pic) DestroyAppxFileStream (pic); if (pkg) DestroyAppxFileStream (pkg); pkg = nullptr; diff --git a/shared/html/settings/appinstaller.html b/shared/html/settings/appinstaller.html index 20dc201..d1e0c0e 100644 --- a/shared/html/settings/appinstaller.html +++ b/shared/html/settings/appinstaller.html @@ -74,7 +74,7 @@ - + diff --git a/shared/html/settings/appinstaller/theme.html b/shared/html/settings/appinstaller/theme.html index 717c05c..da37605 100644 --- a/shared/html/settings/appinstaller/theme.html +++ b/shared/html/settings/appinstaller/theme.html @@ -329,7 +329,15 @@ iframe.contentWindow.Theme.currentColor = color; iframe.contentWindow.Theme.currentTheme = id; };*/ - iframe.src = previewHtml + "?color=" + color + "&id=" + id; + setTimeout(function(iframenode, iframesrc) { + iframenode.src = iframesrc; + }, 0, iframe, previewHtml + "?color=" + color + "&id=" + id); + // iframe.src = previewHtml + "?color=" + color + "&id=" + id; + try { + iframe.defer = true; + iframe.loading = "lazy"; + iframe.async = true; + } catch (e) {} item.appendChild(iframe); var colorstr = "light"; if (color === Theme.ColorType.dark) colorstr = "dark"; @@ -467,7 +475,7 @@


- +