From 0903491df31b295a626027599520d4f32c011da3 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Mon, 19 Oct 2026 16:12:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(extern):=20=E4=BB=8E=20temp=5Fdir=20?= =?UTF-8?q?=E5=85=A8=E9=87=8F=20.vpi=20=E6=94=B6=E9=9B=86=20extern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sig_files 键集合不含 include 模块(win32process 等);直接扫描 temp_dir/*.vpi 补全 export_extern_funcs,确保 ReadProcessMemory/StackWalk64 裸名。 --- lib/Projectrans/Phase2Translator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Projectrans/Phase2Translator.py b/lib/Projectrans/Phase2Translator.py index 2b5e6f2..f557709 100644 --- a/lib/Projectrans/Phase2Translator.py +++ b/lib/Projectrans/Phase2Translator.py @@ -2398,7 +2398,13 @@ class Phase2Translator: # 共享集合可能因 sig_files 过滤而缺少 include 模块的 extern 声明; # 这里从本 translator 的 sig_files 合并补全(跨模块 extern 必须裸名)。 _combined_extern: dict[str, str] = dict(self._shared_export_extern_funcs) - for _sha1_key, _sig_path in self.sig_files.items(): + _sig_paths: list[tuple[str, str]] = list(self.sig_files.items()) + _temp_vpi_dir: str = getattr(self, 'temp_dir', '') or '' + if _temp_vpi_dir and os.path.isdir(_temp_vpi_dir): + for _fn in os.listdir(_temp_vpi_dir): + if _fn.endswith('.vpi'): + _sig_paths.append((_fn[:-4], os.path.join(_temp_vpi_dir, _fn))) + for _sha1_key, _sig_path in _sig_paths: try: _, _sig_tree = parse_python_file(_sig_path) if _sig_tree is None: