Run multiple D2R instances


by Antoine - categories : Games Diablo

The following method will let you run two Diablo 2 Resurrected instances at once on the same machine. No need to struggle with a sandbox or a virtual machine, the trick is to close a handle within the game (D2R.exe) process. This handle is the one that checks if any D2R instances already exists. If closed, another D2R.exe process will be able to start.

Prerequisites

Setup and configure D2R/bnet

Setup the multi-instances hack

# Run multiples D2R clients

# This script closes Diablo 2 Resurrected following thread handles in order to run multiples D2R clients on the same computer :
#   - Event "DiabloII Check For Other Instances"
#   - Section "windows_shell_global_counters"


if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
    Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit
}

& "$PSScriptRoot\handle64.exe" -accepteula -a -p D2R.exe > $PSScriptRoot\d2r_handles.txt

$proc_id_populated = ""
$handle_id_populated = ""

foreach($line in Get-Content $PSScriptRoot\d2r_handles.txt)
{
    $proc_id = $line | Select-String -Pattern '^D2R.exe pid\: (?<g1>.+) ' | %{$_.Matches.Groups[1].value}

    if ($proc_id)
    {
        $proc_id_populated = $proc_id
    }

    $handle_id = $line | Select-String -Pattern '^(?<g2>.+): Event.*DiabloII Check For Other Instances' | %{$_.Matches.Groups[1].value}

    if ($handle_id)
    {
        $handle_id_populated = $handle_id
    }

    if ($handle_id)
    {
        Write-Host "Closing" $proc_id_populated $handle_id_populated
        & "$PSScriptRoot\handle64.exe" -p $proc_id_populated -c $handle_id_populated -y
    }
}

read-host "Press ENTER to continue..."
Closing 17140   7D4

Nthandle v5.0 - Handle viewer
Copyright (C) 1997-2022 Mark Russinovich
Sysinternals - www.sysinternals.com

  7D4: Event         \Sessions\1\BaseNamedObjects\DiabloII Check For Other Instances

Handle closed.
Press ENTER to continue...:

How to use

Two D2R instances are now running from two differents accounts running at the same time. Technically, this method should work for more than 2 accounts.


Be the first to comment 🡮

1