06 Feb

Updated Molebox unpacker

During last year, the most common complaint on this blog was "your Molebox unpacker cannot unpack this crazy big EXE of MMORPG game X, Y or Z."

Sounds like an easy problem to fix, right? Well, that's not true - but I finally did it!

TL;DR - new version of unpacker is here: https://www.mediafire.com/?t3xw46s554it5fp

In the rest of the post I'll describe the obstacles I had to overcome while solving this seemingly simple problem.

Delphi TMemoryStream limitation

First, unpacker is written using classic (non-.NET) Delphi and compiled as x86 executable. And standard Delphi streams are retarded. TMemoryStream uses GetMem - which ends up somewhere in Delphi memory manager and VirtualAlloc. That doesn't work well with 800+MB files.

I ended up with implementing custom stream backed by temporary file (CreateFile with FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE).

Pointer magic

Since the original unpacker was using TMemoryStream, the whole file was loaded in memory as a continuous memory block and I could easily read/write each byte of file using pointers. Something like this:

Guess what? Files don't work that way.. sad I had to do a full and complete rewrite of all those methods.

Zlib conflicts

Original unpacker was compiled with Delphi 3. Delphi 3 didn't have Zlib library, so you had to supply your own Zlib implementation. But it won't compile with new versions of Delphi, giving error message

Unit Graphutil was compiled with a different version of zlib.TZDecompressionStream.

The solution was to get rid of my Zlib implementation and rewrite all methods that deal with decompression.

ANSI strings

In Delphi 3 all strings were ANSI. Starting from Delphi 2007, strings are Unicode. Since Molebox internally uses ANSI, it required changing quite a few structure definitions and rewriting several string manipulation routines. It's a lot of fun (and source of the most obscure bugs), trust me!


I hope you find this unpacker useful. But if it doesn't work for you, please send me an error report with all the details you can and I'll try to fix it. Have fun!

Download link: https://www.mediafire.com/?t3xw46s554it5fp

31 thoughts on “Updated Molebox unpacker

  1. hello!
    this unpacker helps me alot! however, i find that it can't process Japanese and chinese character correctly. it just put out some meaningless lines in logs, and the file name was replaced by underlines("____.jpg",etc.). because of this, some files was overwritten and missing, can you fix this?
    here are part of logs:

    [i] Extracting Graphics\Maps\Mazes\570_ÎåÖØÊÔÁ¶ËÀÍöÂÝÐý.png
    [i] Extracting Graphics\Maps\Mazes\571_ÁùÖØÊÔÁ¶±±·ç±ùÔ­.png
    [i] Extracting Graphics\Maps\Mazes\572_ÁùÖØÊÔÁ¶±±·ç±ùÔ­.png
    [i] Extracting Graphics\Maps\Mazes\573_ÁùÖØÊÔÁ¶±±·ç±ùÔ­.png
    [i] Extracting Graphics\Maps\Mazes\574_ÆßÖØÊÔÁ¶Ä§»ÃÉ­ÁÖ.png
    [i] Extracting Graphics\Maps\Mazes\575_ÆßÖØÊÔÁ¶Ä§»ÃÉ­ÁÖ.png
    [i] Extracting Graphics\Maps\Mazes\576_°ËÖØÊÔÁ¶¹âÖ®½×ÌÝ.png

    • Molebox 2.x doesn't support Unicode properly, so the non-English filenames are usually badly damaged anyway.

      Could you please upload your files to mega.co.nz or mediafire.com and send me the link? I will try to improve my unpacker and will let you know when it's done.

        • I wasn't able to run your file, it keeps giving error messages in some language I don't understand (Chinese?).

          Please try the hotfix version: https://www.mediafire.com/?t4acraaxas6pact - it should work "better".

          But if it still doesn't work correctly, please help me to get your file running on Windows 7 or Windows XP inside VMWare. I'm specifically interested in regional settings, installed languages, etc.

  2. Hello, Mr. Kao, thank you for the program, it works for me, it works great! * - * emm if not a lot of hassle .. can you help me with a program I have this packaged with UPX you know of ollbyg can help me thanks :)

  3. Hey Kao I just wanted to say that I've been spending a bunch of time reading your blog recently and wanted to thank you for all the info you put out there.

  4. Hello can you help me please !! I want to unpack an .exe file but it is packaged with aspacker and searched for programs all over google and not found eh and as you did for molebox I was wondering if you can create a program that will unpack aspack programs please!

    • My unpacker works only for Molebox v2.x.

      Molebox Virtualization Solution is completely different program. I have an unpacker for it but it is not public yet.

  5. Out of interest, why did you decide to use Delphi at all - is that just what you built v1 in, or is it more suitable for the task than .NET?

    • Plenty of reasons:
      * 10 years ago .NET wasn't that popular. It wasn't preinstalled on WinXP, etc, etc.
      * When you're dealing with custom data structures/encryption/compression algorithms, it's much easier to reimplement them in native code.
      * To make unpackers, you need some sort of PE file manipulation library. I happened to have written one for Delphi already. :)

  6. kao - 2017-03-16 at 09:30
    I have an unpacker for it but it is not public yet.

    hey kao You can contact me? {email_removed}
    I need unpacker in these files so I can set up my online mu server...
    I want you to help me out of unpack this main.exe

    I'm new to this cracker area xD

  7. hi,kao

    i send file to your email,please check it,thanks
    i think the file is pack with molebox virtualization solution
    can you unpack it and give me unpack files?

  8. Hello, Kao. I have a program now, use your program can unpack data successfully. However, there is a problem, the file name contains "_". I am sure that these underscores are Chinese characters, is there a way to solve this problem?
    Thank you

Leave a Reply

Your email address will not be published.