fix(desktop-wake): never inject SearchResultWindow2 (1.2.9)
All checks were successful
Publish Python Package to Gitea / publish (push) Successful in 32s

Soft-wake search popup only; n2-wake on float crashed WeCom via wecom_wake.dll.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-02 21:32:23 +08:00
parent 17ac1b4e11
commit 24384d70ba
11 changed files with 69 additions and 24 deletions

View File

@@ -169,6 +169,21 @@ namespace JiangchangDesktopWake
if (!doWakeProvider)
EnableScreenReaderFlag();
// 1.2.9:SearchResultWindow2 禁止 n2 注入(wecom_wake.dll 子类化/DuiLib 会崩企微)
if (doN2 && IsSearchResultPopup(hwnd))
{
SendGetObject(hwnd);
TryMsaa(hwnd);
bool responsivePopup = CheckUiResponsive(hwnd);
method = "popup_soft_only";
WriteJson(
responsivePopup, false, responsivePopup,
profile, hwnd, 0, 0, new string[0],
"search_popup_no_inject|soft_getobject_msaa",
mode, method);
return responsivePopup ? 0 : 6;
}
if (doN2)
{
string n2Detail;
@@ -582,6 +597,17 @@ namespace JiangchangDesktopWake
return new IntPtr(Convert.ToInt64(s, 16));
}
private static bool IsSearchResultPopup(IntPtr hwnd)
{
try
{
var sb = new StringBuilder(256);
if (GetClassName(hwnd, sb, sb.Capacity) <= 0) return false;
return string.Equals(sb.ToString(), "SearchResultWindow2", StringComparison.Ordinal);
}
catch { return false; }
}
/// <summary>
/// 主窗可 Maximize;SearchResultWindow2 等浮层禁止 Maximize(会撑爆/关掉浮层)。
/// </summary>