From 267277aab206df8b41798e96963ccc35158dfb64 Mon Sep 17 00:00:00 2001 From: lynnux Date: Sat, 19 Nov 2022 22:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DCreateWindowExA=20hook?= =?UTF-8?q?=E5=BD=93lpClassName=E4=B8=BAatom=E6=97=B6=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gui.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gui.rs b/src/gui.rs index 3731bcf..6795041 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -380,6 +380,21 @@ unsafe extern "system" fn CreateWindowExA_detour( lpParam, ); if !ret.is_null() { + // lpClassName可能是atom + if std::mem::size_of::() == 8 { + // 64位,判断高位DWORD是否是0,是的话再判断低DWORD的HIWORD是否是0,是0那就是atom + if (lpClassName as u64 >> 32) & 0xffffffff == 0 { + if winapi::shared::minwindef::HIWORD(lpClassName as DWORD) == 0 { + return ret; + } + } + } else { + // 32位判断HIWORD是否是0,是0那就是atom + if winapi::shared::minwindef::HIWORD(lpClassName as DWORD) == 0 { + return ret; + } + } + if 0 == lstrcmpiA(lpClassName, b"emacs\0".as_ptr() as _) || 0 == lstrcmpiA(lpClassName, b"ScrollBar\0".as_ptr() as _) {