Peach: Local-first video metadata scraper and media manager.
fix(runtime): 找源码托盘的窗口类名用 wintypes.LPWSTR
longmeidaoc3391b1d998e
diff --git a/src/peach/windows_restart.py b/src/peach/windows_restart.pyindex c77a2a7ca..efcd689bb 100644--- a/src/peach/windows_restart.py+++ b/src/peach/windows_restart.py@@ -161,7 +161,7 @@ def find_source_tray_windows() -> tuple[TrayWindow, ...]:user32.EnumWindows.argtypes = [callback_type, wintypes.LPARAM]user32.EnumWindows.restype = wintypes.BOOLuser32.GetWindowThreadProcessId.argtypes = [wintypes.HWND, ctypes.POINTER(wintypes.DWORD)]- user32.GetClassNameW.argtypes = [wintypes.HWND, ctypes.LPWSTR, ctypes.c_int]+ user32.GetClassNameW.argtypes = [wintypes.HWND, wintypes.LPWSTR, ctypes.c_int]@callback_typedef visit(window, _extra):diff --git a/tests/test_restart_windows_tray.py b/tests/test_restart_windows_tray.pyindex 0a8ecca00..81c0c9800 100644--- a/tests/test_restart_windows_tray.py+++ b/tests/test_restart_windows_tray.py@@ -64,6 +64,15 @@ class RestartWindowsTrayTests(unittest.TestCase):BOOTSTRAP = ("import os,runpy;os.environ['PEACH_DATA_ROOT']=r'X'"";runpy.run_module('peach.tray',run_name='__main__')")+ def test_the_source_search_runs_its_own_win32_declarations(self):+ """两步筛的第一步是一串 ctypes 声明,名字取错要到调用那一刻才炸。++ EnumWindows 是替换不掉的,那就真枚举一遍:非 Windows 上函数在开头就返回空,+ Windows 上把整串声明走完。命令行那步替掉,免得为一条判据起 PowerShell。+ """+ with mock.patch.object(windows_restart, "_command_lines", return_value={}):+ self.assertEqual(windows_restart.find_source_tray_windows(), ())+def test_windows_command_line_splits_the_source_bootstrap_intact(self):line = f'"{self.service.parent / "pythonw.exe"}" -c "{self.BOOTSTRAP}" --show'argv = windows_restart.parse_windows_command_line(line)