How to Run Multiple WeChat Instances on Windows: Batch Script Trick & Deep Singleton Analysis
This article explains how a simple batch file can launch two or more simultaneous WeChat processes on Windows, and provides a detailed reverse‑engineering analysis of WeChat's singleton enforcement using mutexes, API monitoring, and IDA disassembly to reveal why the trick works.
The author demonstrates a straightforward method to run multiple WeChat instances on a Windows PC by creating a batch file that launches the executable multiple times, and then explains the underlying technical reasons.
Batch script solution
Creating a batch file with the following commands starts two independent WeChat processes:
start D:\WeChat\WeChat.exe
start D:\WeChat\WeChat.exeAdding another start line launches a third instance. Double‑clicking the batch file instantly creates the desired number of processes.
WeChat's singleton mechanism
WeChat normally enforces a global singleton by creating a named mutex. When a second instance is started, the program attempts to create the mutex _WeChat_App_Instance_Identity_Mutex_Name. The call to CreateMutex succeeds, but GetLastError returns 0x000000b7 (ERROR_ALREADY_EXISTS), indicating that another instance is already running.
Tools used for the analysis:
Process Explorer – to view kernel objects and locate the mutex.
API Monitor – to capture CreateMutex and GetLastError calls.
ID A – to disassemble WeChatWin.dll and locate the code that creates the mutex.
The mutex creation occurs in function sub_108e26d0, which is called by sub_108e2660. The decision logic can be expressed as:
if (CreateMutex() == SUCCESS) {
launch WeChat
} else {
if (FindWindow() == SUCCESS) {
BringWindowToTop(existing window)
} else {
launch WeChat
}
}If the mutex cannot be created, the program checks for the presence of either the main window ( WeChatMainWndForPC) or the login window ( WeChatLoginWndForPC). If found, it brings that window to the foreground and exits; otherwise it starts a new instance.
Why the batch script bypasses the singleton check
When the batch file launches multiple processes almost simultaneously, the second process attempts to create the mutex before the first process has finished creating its window. Consequently, the CreateMutex call fails, but the subsequent window‑search logic does not find an existing window yet, so the program proceeds to start a new instance, allowing multiple copies to run.
Additional observations
Inside WeChatWin.dll the exported function responsible for the startup is named StartWaChat, a likely typo of "WeChat". Later versions of the DLL have corrected this name.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Tech Enthusiast
Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
