Fundamentals 6 min read

Bypassing WeChat’s Singleton Check: Run Multiple Instances on Windows

This guide explains how a simple batch file can launch two or more WeChat instances on Windows by analyzing the app’s global mutex mechanism, reverse‑engineering the related DLL functions, and showing why the rapid start‑up bypasses the built‑in single‑instance guard.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Bypassing WeChat’s Singleton Check: Run Multiple Instances on Windows

Running multiple WeChat instances with a batch file

On Windows, WeChat enforces a global singleton by creating a named mutex. A simple batch file can start several instances because the processes are launched almost simultaneously, before the first instance creates the mutex or its main window.

start D:\WeChat\WeChat.exe
start D:\WeChat\WeChat.exe
rem add more lines to start additional instances

Singleton implementation in WeChat

When WeChat starts it calls CreateMutex with the name _WeChat_App_Instance_Identity_Mutex_Name. If the call succeeds, the process continues. If the mutex already exists, GetLastError returns 0x000000b7 (ERROR_ALREADY_EXISTS).

Process Explorer can show the mutex; API Monitor can capture the CreateMutex and GetLastError calls.

Location of the mutex creation

Static analysis of WeChatWin.dll (the main UI DLL) shows the mutex creation at offset 0x8e271b inside function sub_108e26d0, which is called by sub_108e2660.

Decision logic after mutex creation

If CreateMutex succeeds, the process proceeds to start the UI.

If it fails, the code searches for windows named WeChatMainWndForPC or WeChatLoginWndForPC. If either is found, BringWindowToTop is invoked to activate the existing instance, and the new process exits.

If no such windows are found, the process falls back to launching a new instance.

if (CreateMutex() == SUCCESS) {
    // launch WeChat
} else {
    if (FindWindow("WeChatMainWndForPC") || FindWindow("WeChatLoginWndForPC")) {
        BringWindowToTop(existingWindow);
        // exit current process
    } else {
        // launch WeChat
    }
}

Why the batch script bypasses the singleton check

The start commands in a batch file are executed asynchronously. The second (or later) process begins before the first has created the mutex and before its main window appears. Consequently the CreateMutex call in the later process succeeds, allowing multiple processes to run concurrently.

Additional observations

Reverse‑engineering reveals that the exported entry point used to start the UI is named StartWaChat (a typo for StartWeChat) in older versions; newer releases have corrected the name.

WeChat mutex and window detection
WeChat mutex and window detection
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BatchWindowsreverse engineeringSingletonWeChat
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.