<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Hexing</title><link>https://sourceforge.net/p/hercules/wiki/Hexing/</link><description>Recent changes to Hexing</description><atom:link href="https://sourceforge.net/p/hercules/wiki/Hexing/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 20 Feb 2023 05:04:31 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/hercules/wiki/Hexing/feed" rel="self" type="application/rss+xml"/><item><title>Hexing modified by Brynner</title><link>https://sourceforge.net/p/hercules/wiki/Hexing/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,9 +1,9 @@
-{{Outdated}} {{Incomplete}} As **hexing** is considered the process of
-modifying raw contents of a file on byte-level with a [Hex Editor](hex
-editor), regardless of the actual purpose of the file (text, image or another
-application). Such modifications may require exact knowledge of the files'
-format for the modification to succeed, as opposed to a high-level editing
-application such as an image editor.
+{{Incomplete}} As **hexing** is considered the process of modifying raw
+contents of a file on byte-level with a [Hex Editor](Hex Editor), regardless
+of the actual purpose of the file (text, image or another application). Such
+modifications may require exact knowledge of the files' format for the
+modification to succeed, as opposed to a high-level editing application such
+as an image editor.

 [TOC]

@@ -15,9 +15,11 @@
 Although it is possible to use an unmodified client with Hercules (up to
 2010/08/04), it is typically modified using a DIFF patcher.

-Each new client requires [Shin's Diff
-Patcher](http://rathena.org/board/topic/53420-shins-diff-patcher/) and the
-[Wee Diff Gen plugin](http://rathena.org/board/topic/53421-weediffgen/2).
+Each new client requires [Wee Diff Gen plugin/Shins Diff
+Patcher](http://herc.ws/board/topic/827-weediff-aka-shins-diff-patcher-
+weediffgen-continuation/) OR
+[xDiffPatcher](http://herc.ws/board/topic/852-xdiffpatcher-xdiffgen2-packet-
+parser-and-packet-extractor/).

 ### Diffing your client

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Brynner</dc:creator><pubDate>Mon, 20 Feb 2023 05:04:31 -0000</pubDate><guid>https://sourceforge.net3f322fbeb18f15d880726bbb5751714ed734b137</guid></item><item><title>Hexing modified by Brynner</title><link>https://sourceforge.net/p/hercules/wiki/Hexing/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;{{Outdated}} {{Incomplete}} As &lt;strong&gt;hexing&lt;/strong&gt; is considered the process of&lt;br/&gt;
modifying raw contents of a file on byte-level with a &lt;a class="" href="../hex
editor"&gt;Hex Editor&lt;/a&gt;, regardless of the actual purpose of the file (text, image or another&lt;br/&gt;
application). Such modifications may require exact knowledge of the files'&lt;br/&gt;
format for the modification to succeed, as opposed to a high-level editing&lt;br/&gt;
application such as an image editor.&lt;/p&gt;
&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#creating-custom-ragre-client-using-a-diff-patcher"&gt;Creating custom RagRE client using a DIFF patcher&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#diffing-your-client"&gt;Diffing your client&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#download-your-client"&gt;Download your client&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#diffing"&gt;Diffing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#follow-up-modifications-to-diffed-clients"&gt;Follow-up modifications to diffed clients&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#custom-window-title"&gt;Custom Window Title&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#custom-dataini"&gt;Custom data.ini&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#custom-clientinfoxml"&gt;Custom clientinfo.xml&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#find-replace-hexing"&gt;Find-Replace Hexing&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#application"&gt;Application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#variable-codes"&gt;Variable Codes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#low-level-hexing"&gt;Low-Level Hexing&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#programs-needed"&gt;Programs needed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#loading-the-sakexe"&gt;Loading the Sakexe&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#finding-winmain-function"&gt;Finding WinMain function&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#2010-08-10aragexere-and-older-visual-c-60"&gt;2010-08-10aRagexeRE and older (Visual C++ 6.0)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h2 id="creating-custom-ragre-client-using-a-diff-patcher"&gt;Creating custom RagRE client using a DIFF patcher&lt;/h2&gt;
&lt;p&gt;RagRE is the abbreviation for Ragnarok Renewal client (ragexeRE.exe), which is&lt;br/&gt;
normally updated by Gravity weekly, to add new items or features, to fix bugs&lt;br/&gt;
and the like. This is also the client, which is currently used for Hercules.&lt;br/&gt;
Although it is possible to use an unmodified client with Hercules (up to&lt;br/&gt;
2010/08/04), it is typically modified using a DIFF patcher.&lt;/p&gt;
&lt;p&gt;Each new client requires &lt;a class="" href="http://rathena.org/board/topic/53420-shins-diff-patcher/" rel="nofollow"&gt;Shin's Diff&lt;br/&gt;
Patcher&lt;/a&gt; and the&lt;br/&gt;
&lt;a class="" href="http://rathena.org/board/topic/53421-weediffgen/2" rel="nofollow"&gt;Wee Diff Gen plugin&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="diffing-your-client"&gt;Diffing your client&lt;/h3&gt;
&lt;h4 id="download-your-client"&gt;Download your client&lt;/h4&gt;
&lt;p&gt;Download a client from&lt;br/&gt;
&lt;a class="" href="http://subversion.assembla.com/svn/weetools/clients/" rel="nofollow"&gt;here&lt;/a&gt;. Extract the&lt;br/&gt;
executable from the zip file, extracting requires&lt;br/&gt;
&lt;a class="" href="http://www.7-zip.org/download.html" rel="nofollow"&gt;7zip&lt;/a&gt;. I recommend making a folder and&lt;br/&gt;
naming it "RagRe Exes" and in that folder create a folder with the name being&lt;br/&gt;
your client's date. For example if my RagRe exe was "2011-04-27aRagexeRE", I&lt;br/&gt;
would name the folder I am extracting it to "2011-04-27a", this is just to be&lt;br/&gt;
organized and makes your exe easy to find.&lt;/p&gt;
&lt;h4 id="diffing"&gt;Diffing&lt;/h4&gt;
&lt;p&gt;Download Shin's Diff Patcher and the Wee Diff Gen plugin located above. If you&lt;br/&gt;
did not download the Plain Diff Plugin, ignore the following sentence, as&lt;br/&gt;
WeeDiffGenerator will be the main plugin. From the drop down menu under&lt;br/&gt;
"Select patch engine" select "WeeDiffGenerator". For "Source Executable" click&lt;br/&gt;
"Select" and navigate to your RagRe exe's location, then select the&lt;br/&gt;
executable. It will ask if you want it to auto-select recommended patches,&lt;br/&gt;
click yes. Now a list of diffs will show up, with check boxes to the left.&lt;br/&gt;
Simply decide what diff you would like to apply to your client, and click the&lt;br/&gt;
check box. For some diffs like "Fix camera angles" you can select more than&lt;br/&gt;
one, but its recommended that you only select one. This may change in the&lt;br/&gt;
future. Some diffs like "Increase Headgear View ID" will have a text box pop&lt;br/&gt;
up prompting you to enter a value. Once you are done selecting what diffs you&lt;br/&gt;
would like to apply, make sure the "Output executable" location is alright&lt;br/&gt;
with you, you only need to change it if you want the output executable to be&lt;br/&gt;
saved somewhere other than the folder of the source executable's location.&lt;br/&gt;
Click "Patch it!" and your diffed exe will now appear in either the folder&lt;br/&gt;
where your source executable is, or where you chose to save it.&lt;/p&gt;
&lt;h3 id="follow-up-modifications-to-diffed-clients"&gt;Follow-up modifications to diffed clients&lt;/h3&gt;
&lt;p&gt;These modifications are usually applied to already DIFFed clients for finer&lt;br/&gt;
customization, which is not possible with a DIFF by itself.&lt;/p&gt;
&lt;h4 id="custom-window-title"&gt;Custom Window Title&lt;/h4&gt;
&lt;p&gt;Requires a client, which has been patched to allow custom window title and&lt;br/&gt;
&lt;a class="" href="http://mh-nexus.de/en/hxd/" rel="nofollow"&gt;HxD&lt;/a&gt;, or any other hex editor.&lt;/p&gt;
&lt;p&gt;Steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, you need to know what the current &lt;em&gt;window title&lt;/em&gt; is. &lt;/li&gt;
&lt;li&gt;Start your client in Windowed mode to check. &lt;/li&gt;
&lt;li&gt;After closing the client, load it inside the hex editor. &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When the file loads, it should look something like this:&lt;br/&gt;
&lt;a class="" href="../Editing%20a%20ragexeRE%20with%20HxD"&gt;Image:Hxd-main.png&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Press &lt;strong&gt;Ctrl+F&lt;/strong&gt; to open the Find window and input the window title. As the window title is usually stored at the beginning of the hexed client, a partial title will do. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When you find the section, it will look something like this: &lt;br/&gt;
&lt;a class="" href="../Current%20Window%20Title"&gt;Image:Hxd-custtitle.png&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now, on the &lt;strong&gt;right&lt;/strong&gt; side (ASCII text), start where the current Window Title starts and begin overwriting it with your NEW window title. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;If there are leftover words after you have typed your NEW window title, switch to the &lt;strong&gt;left&lt;/strong&gt; side (Hexadecimal) and over-write the rest of the title with 00 (zeros). &lt;/li&gt;
&lt;li&gt;Save. &lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id="custom-dataini"&gt;Custom data.ini&lt;/h4&gt;
&lt;p&gt;{{EntirePage|DATA.INI#Other Names}} You can rename the &lt;a class="alink" href="/p/hercules/wiki/DATA.INI/"&gt;[DATA.INI]&lt;/a&gt; file to&lt;br/&gt;
any name that is 8 characters long (including the extension). Then, just edit&lt;br/&gt;
your client with a Hex Editor. Find DATA.INI and replace with your new&lt;br/&gt;
filename.&lt;/p&gt;
&lt;h4 id="custom-clientinfoxml"&gt;Custom clientinfo.xml&lt;/h4&gt;
&lt;p&gt;You can rename the &lt;a class="alink" href="/p/hercules/wiki/Clientinfo.xml/"&gt;[Clientinfo.xml]&lt;/a&gt; file to any name that is 15 characters&lt;br/&gt;
long (including the extension). Then, just edit your client with a Hex Editor.&lt;br/&gt;
Find clientinfo.xml and replace with your new filename. Note, that for newer&lt;br/&gt;
and non-&lt;span&gt;[Sakray]&lt;/span&gt; clients, this file is called clientinfo.xml.&lt;/p&gt;
&lt;h2 id="find-replace-hexing"&gt;Find-Replace Hexing&lt;/h2&gt;
&lt;p&gt;This technique is used for single features, rather than a collection of&lt;br/&gt;
features, and is often applicable across different client versions. Such edits&lt;br/&gt;
are distributed as a single or a set of two line edits, which specify what&lt;br/&gt;
should be &lt;em&gt;found&lt;/em&gt; and what should the found character sequence be &lt;em&gt;replaced&lt;/em&gt;&lt;br/&gt;
with, and mostly retain the length (both lines specify same amount of&lt;br/&gt;
characters).&lt;/p&gt;
&lt;p&gt;The character sequences are applied using a hex editor and represented by&lt;br/&gt;
hexadecimal values of bytes, optionally each byte (two hexadecimal numbers)&lt;br/&gt;
separated by a space. A typical find-replace hex looks like this (anti-quake&lt;br/&gt;
patch for certain client&lt;br/&gt;
versions&lt;a class="" href="http://www.eathena.ws/board/index.php?showtopic=249328" rel="nofollow"&gt;http://www.eathena.ws/board/index.php?showtopic=249328...&lt;/a&gt;):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;C390909090558BEC8B4508568BF1894604&lt;/span&gt;
&lt;span class="n"&gt;R&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;C390909090C214008B4508568BF1894604&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="application"&gt;Application&lt;/h3&gt;
&lt;p&gt;&lt;a class="" href="../thumb"&gt;Image:Hxd-findreplace.png&lt;/a&gt;The first one is copied and pasted into hex editor&lt;br/&gt;
find/replace window's &lt;em&gt;find&lt;/em&gt; field, the latter is pasted into the &lt;em&gt;replace&lt;br/&gt;
with&lt;/em&gt; field. The search is set to be case-sensitive and then all occurrences&lt;br/&gt;
are replaced.&lt;/p&gt;
&lt;p&gt;The author of such &lt;strong&gt;hex&lt;/strong&gt; may want to specify the correct amount of hits for&lt;br/&gt;
verification. If the search does not yield any result, the hex is&lt;br/&gt;
incompatible. The hex must &lt;strong&gt;never be applied partially&lt;/strong&gt; , such as omitting&lt;br/&gt;
first two bytes, as that can lead to undefined behavior.&lt;/p&gt;
&lt;h3 id="variable-codes"&gt;Variable Codes&lt;/h3&gt;
&lt;p&gt;In some instances the hex requires some variable bytes, whose value is either&lt;br/&gt;
adjustable (replace line only) or varying among clients (both lines). This&lt;br/&gt;
kind of &lt;em&gt;wild card&lt;/em&gt; is expressed with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;XX - more common for adjustable values &lt;/li&gt;
&lt;li&gt;?? - is recognized as wild card in some hex editors &lt;/li&gt;
&lt;li&gt;Description of the bytes in &amp;lt;BBGGRR&amp;gt; for little-endian RGB color values &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example (vending max. sell price unlocking):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="n"&gt;DF1B9F505&lt;/span&gt;
&lt;span class="n"&gt;R&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="n"&gt;DXXXXXXXX&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="low-level-hexing"&gt;Low-Level Hexing&lt;/h2&gt;
&lt;p&gt;Low-Level Hexing is an Ultimate Hexing Sakexe by using OllyDbg. This is&lt;br/&gt;
Advanced technique. You need some x86 Assembly language knowledge for using&lt;br/&gt;
this technique in order to discern the runtime order of the EXE you're looking&lt;br/&gt;
at. The more Assembly you know, the better, as you'll be more adept at seeing&lt;br/&gt;
what is going on.&lt;/p&gt;
&lt;p&gt;It's necessarily quite apt to point out that in more recent times, the EXEs&lt;br/&gt;
Gravity has put out have made things a little harder. As an example, a recent&lt;br/&gt;
EXE, 2012-10-17bRagexeRE includes&lt;br/&gt;
&lt;a class="" href="http://anonym.to/?http://www.oreans.com/themida.php" rel="nofollow"&gt;Themida&lt;/a&gt; protection,&lt;br/&gt;
which includes anti-debugger measures. Fortunately, these anti-debugging&lt;br/&gt;
measures aren't wholly preventative, but still provide an additional&lt;br/&gt;
challenge; StrongOD and Phant0m allow for skipping of the anti-debug&lt;br/&gt;
challenge, however, the other features of Themida mean that someone without&lt;br/&gt;
experience in assembly language would be incredibly confused about the output.&lt;/p&gt;
&lt;h3 id="programs-needed"&gt;Programs needed&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class="" href="http://www.ollydbg.de/" rel="nofollow"&gt;OllyDbg&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="http://tuts4you.com/download.php?view.2028" rel="nofollow"&gt;StrongOD&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="http://tuts4you.com/download.php?view.1276" rel="nofollow"&gt;Phant0m&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="loading-the-sakexe"&gt;Loading the Sakexe&lt;/h3&gt;
&lt;p&gt;Run &lt;em&gt;OLLYDBG.EXE&lt;/em&gt; and select menu File &amp;gt; Open. Then choose the Sakexe you want&lt;br/&gt;
to Hex. If your Sakexe needs some parameters to launch (ex: 1sak1). Enter that&lt;br/&gt;
parameter in &lt;em&gt;Arguments&lt;/em&gt; field. Then press Open Button.&lt;/p&gt;
&lt;h3 id="finding-winmain-function"&gt;Finding WinMain function&lt;/h3&gt;
&lt;p&gt;WinMain is an entry point in Windows GUI ( &lt;strong&gt;G&lt;/strong&gt; raphical &lt;strong&gt;U&lt;/strong&gt; ser &lt;strong&gt;I&lt;/strong&gt;&lt;br/&gt;
nterface) applications, that is, where an application's code starts executing.&lt;br/&gt;
This applies to the Ragnarok client as well, thus it is important to know it's&lt;br/&gt;
location. Different compilers produce different WinMain locations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you have the Windows platform SDK installed, scan the import&lt;br/&gt;
libraries first to resolve names of a lot of common functions, such as&lt;br/&gt;
WinMain, before hexing. This will make things easier, because you do not have&lt;br/&gt;
to deal with plain addresses. To scan the libraries, press &lt;strong&gt;Ctrl+O&lt;/strong&gt; , browse&lt;br/&gt;
for the *.lib files, and then click scan. Analyze (Ctrl+A) the client&lt;br/&gt;
afterwards, to apply the scan results.&lt;/p&gt;
&lt;h4 id="2010-08-10aragexere-and-older-visual-c-60"&gt;2010-08-10aRagexeRE and older (Visual C++ 6.0)&lt;/h4&gt;
&lt;p&gt;All clients before 2010-08-18aRagexeRE (this includes all Sakexe clients) are&lt;br/&gt;
compiled with Visual C++ 6.0 and their WinMain can be found as a CALL after&lt;br/&gt;
the first CALL to GetModuleHandle. You can find it by a scroll down 10 - 20&lt;br/&gt;
lines from current position after loading Sakexe.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;PUSH    ESI
CALL    DWORD PTR DS:[
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Brynner</dc:creator><pubDate>Mon, 20 Feb 2023 05:01:49 -0000</pubDate><guid>https://sourceforge.netb9d755256a143b0c3057106fbe5a507f835fde04</guid></item></channel></rss>