D3Inferno

Bypassing the Diablo 3 Game Client Patching Process

A couple of weeks ago, I wrote an article about Patching the Diablo 3 Game Client. This article will assume that you are familiar with the basic patching concepts, and will walk you through the steps necessary to bypass the standard patching process.

If you start the "Diablo III.exe" program (rather than the Launcher) with the "-launch" command line argument, the game client will actually check for D3 patch files, but not acutally download or install them. This does require an Internet connection because the game client will abort if it cannot contact the patch servers.

The approach described in this article allows you to start the game client without an Internet connection. It does this by impersonating the Battle.net patch servers and the Akamai content server. This approach requires that you install and configure a web server such as Apache and a server-side scripting engine such as PHP (for processing POST requests).

Table of Contents

Here is the outline of the steps required to bypass the patching process and allow the game client to work offline:

Update the "hosts" File to redirect the patch servers to localhost.
Configure the Web Server to listen to the patching ports and to serve the patching content.
Locally Host Patching Files so that the game client thinks can obtain the information it needs to start properly.

Update the "hosts" File

The "hosts" file must be updated to redirect the patch servers to localhost. The "hosts" file allows you to override the DNS and provide the IP address for a given server name. On Windows systems, the "hosts" file can be found in the following directory: C:\Windows\System32\drivers\etc

Add the following three entries to this file. Note that on Windows, you will need Administrator privileges to modify this file.

# Redirect patch traffic to localhost (127.0.0.1)
127.0.0.1 enUS.patch.battle.net
127.0.0.1 public-test.patch.battle.net
127.0.0.1 ak.worldofwarcraft.com.edgesuite.net

Configure the Web Server

Configure the web server to listen to the patching ports and to serve the patching content. There are several ways that you can configure the web server depending on personal preference. I will detail two approaches below. The first is simple and will serve all the content from a single directory. The second uses VirtualHosts, and will serve the content from different directories based on target server name and port.

The configuration sections below are for an Apache web server. If you are using a different web server, please modify the configuration settings accordingly. By default, the Apache configuration file is called "httpd.conf" and is located in the "conf" directory beneath the Apache root installation directory ("C:\Apache2" by default on Windows).

Add the following to the Apache web server configuration file:

# Bnet port is 1119
# Bnet file port is 1120
# Akamai HTTP port is 80
Listen 1119
Listen 1120
Listen 80

If you want to use VirtualHosts, you can set them up as follows (modify the directory names to suit your needs):

# Name the VirtualHosts
NameVirtualHost localhost:80
NameVirtualHost localhost:1119
NameVirtualHost localhost:1120

# Define the VirtualHosts.
<VirtualHost localhost:80>
DocumentRoot "c:/Apache2/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost localhost:80>
DocumentRoot "c:/Apache2/htdocs/ak.worldofwarcraft.com.edgesuite.net"
ServerName ak.worldofwarcraft.com.edgesuite.net
</VirtualHost>

<VirtualHost localhost:1119>
DocumentRoot "c:/Apache2/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost localhost:1119>
DocumentRoot "c:/Apache2/htdocs/enUS.patch.battle.net"
ServerName enUS.patch.battle.net
</VirtualHost>
<VirtualHost localhost:1119>
DocumentRoot "c:/Apache2/htdocs/public-test.patch.battle.net"
ServerName public-test.patch.battle.net
</VirtualHost>

<VirtualHost localhost:1120>
DocumentRoot "c:/Apache2/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost localhost:1120>
DocumentRoot "c:/Apache2/htdocs/enUS.patch.battle.net"
ServerName enUS.patch.battle.net
</VirtualHost>
<VirtualHost localhost:1120>
DocumentRoot "c:/Apache2/htdocs/public-test.patch.battle.net"
ServerName public-test.patch.battle.net
</VirtualHost>

The above configuration will serve the content for each VirtualHost from a different directory.

You can use the following command (from the Apache root directory) to test that the config file is syntactically correct:
bin\httpd.exe -t -f conf/httpd.conf

Locally Host Patching Files

You will need to host the required patching files on the web server. This will allow the game client to obtain the information it needs to start properly.

The Battle.net requests from the game client to port 1119 are submitted as HTTP POSTs to "/patch". As such, you cannot just host a response file; you will need some kind of server-side script to handle the POST and construct the response.

If you want to hard-code the response (rather than fetch it from a file), you can write a simple PHP script called "patch.php":

<?php
// Set the response headers.
header('Server: Protocol HTTP');
header('Connection: close');
header('Content-Type: application/xml');

print
"<patch>\r\n".
"<record program=\"D3B\" component=\"enUS\">\r\n".
"http://ak.worldofwarcraft.com.edgesuite.net/d3-pod/20FB5BE9/NA/d3b-8392-D06777069202ACA0C804BC5BCC99909F.xml;8CC45BC01698F0A0857852875CD075F1;B5B8EBBA53C362322E1D90D965DAE796;8392\r\n".
"</record>\r\n".
"</patch>";
<>

Note that the target of the POST is "/patch", but that our PHP script name is "patch.php". By default, Apache will only interpret .php files as PHP scripts. This is determined by the following Apache configuration statement:
AddType application/x-httpd-php .php

Rather than modifying this configuration, we can use a simple ".htaccess" file in the appropriate htdocs directory:

RewriteEngine on
# Map requests for "/patch" to "/patch.php".
# This will cause our PHP script to handle the request.
RewriteRule ^patch$ /patch.php

The request for the Akamai content file will be for a file with a name such as "/d3-pod/20FB5BE9/NA/7162.direct/d3b-8296-941A7BD6BAF437A7A7773644DA9B795B.mfil". For simplicity, we can remap the directory portion of the request so that any file that starts with "d3-pod" will be mapped into our root htdocs directory. This is done by creating an ".htaccess" file in the appropriate htdocs directory for the Akamai content:

RewriteEngine on
# Map mfil files (intended for Akamai).
RewriteRule ^d3-pod/.*/(.*mfil)$ /$1

Please note that the game client will check the MD5 of the .mfil file above. The MD5 is embedded in the filename; in the example above, the MD5 is "941A7BD6BAF437A7A7773644DA9B795B". The best way to make sure that you have an exact binary copy of this file is to download it directly from Akamai and copy it over to the htdocs folder. Do not edit this file by hand since making any change will cause MD5 validation to fail, and the game client will abort.

If everything is configured properly, the Diablo 3 game client should now start, even without an Internet connection.

Email Contact:

contact_email