This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: Blizzard Installer Customisation  (Read 16827 times)

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: Blizzard Installer Customisation
« Reply #60 on: April 05, 2013, 02:31:49 pm »
Copied the 3.3.5 to 3.3.5a installer contents.

Changed everything from 3.3.5 to 3.3.5a inside (components, etc).

Replaced battle.net.dll and WoW.exe and runonce.wtf with own values.

Changed patch index to 4.

When I assemble then run:
Code: [Select]
The update could not be applied.
  Blizzard Updater was unable to read the file "C:WoW 3.3.5DataenGBbackup-enGB.MPQ". This error may be caused by problems with the media or drive at C:--for example, a scratched or dirty CD-ROM/DVD-ROM, hard drive corruption, or a networking problem while downloading the update. (The data being read was "Battle.net.dll", and the error code was 0.) If this problem persists, you may be able to solve it by uninstalling and then reinstalling the game. If you are unable to correct this problem, please contact Blizzard Technical Support. (Converter::Load)
  To check this installation for problems, click the "Repair" button. The Repair tool can automatically fix many update errors.

Not figured what could cause this yet. If I remove the battle.net.dll installation from the patch.lst, then I get this error:
Code: [Select]
The update could not be applied.
  Blizzard Updater was unable to read the file "C:WoW 3.3.5DataenGBbackup-enGB.MPQ". This error may be caused by problems with the media or drive at C:--for example, a scratched or dirty CD-ROM/DVD-ROM, hard drive corruption, or a networking problem while downloading the update. (The data being read was "Wow.exe", and the error code was 0.) If this problem persists, you may be able to solve it by uninstalling and then reinstalling the game. If you are unable to correct this problem, please contact Blizzard Technical Support. (Converter::Load)
  To check this installation for problems, click the "Repair" button. The Repair tool can automatically fix many update errors.
So then it is doing the same error with the Wow.exe.

After removing all the base moves from patch.lst, it seems it has the same error with every file:
Code: [Select]
The update could not be applied.
  Blizzard Updater was unable to read the file "C:WoW 3.3.5DataenGBbackup-enGB.MPQ". This error may be caused by problems with the media or drive at C:--for example, a scratched or dirty CD-ROM/DVD-ROM, hard drive corruption, or a networking problem while downloading the update. (The data being read was "DataenGBDocumentationReadMeEULA.html", and the error code was 0.) If this problem persists, you may be able to solve it by uninstalling and then reinstalling the game. If you are unable to correct this problem, please contact Blizzard Technical Support. (Converter::Load)
  To check this installation for problems, click the "Repair" button. The Repair tool can automatically fix many update errors.

I removed the backup MPQ from my WoW directory and ran it again:
Code: [Select]
The update could not be applied.
  The patch "pc-game-hdfilesWTFRunOnce.wtf" could not be applied. (Invalid header: size 17747, version 84.) If this problem persists, you may be able to solve it by uninstalling and then reinstalling the game. If you are unable to correct this problem, please contact Blizzard Technical Support. (BNUpdate::PTCApply)
  To check this installation for problems, click the "Repair" button. The Repair tool can automatically fix many update errors.

It seems there is some sort of verification upon each file inside the patch or something?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: Blizzard Installer Customisation
« Reply #61 on: April 06, 2013, 03:25:48 am »
Quote from: "stoneharry"
Blizzard Updater was unable to read the file "C:WoW 3.3.5DataenGBbackup-enGB.MPQ".
i never got that error, u did something wrong.

Quote from: "stoneharry"
The patch "pc-game-hdfilesWTFRunOnce.wtf" could not be applied. (Invalid header: size 17747, version 84.)
Actually, here is the problem :

"base\component.wow-data.txt" and all "component.*.txt" files have extra data at the beginning of the file. A kind of header 24 bytes large (not sure if 24).
My mpq editor doesnt export this header.... strange, but as I export it, the resulting file just contain the text data.
(Try to export "base\component.wow-data.txt" and, then import it back in the .mpq, then rebuild the updater and run it, u will probably get an error)

But reading the file with stormlib library, I get all the data. Then if I replace the file then now run the updater, it will work.

Actually, i think all file except these in the main folder ("hdfiles.lst", "delete.lst", "patch.cmd", ect...) have this header.

Quote from: "happyhack"
.exe inside of the .mpq are not working exe, they seems to be bsdiff patch, have to confirm this too.
All file, except "component.*.txt" and the files in the main folder seems to be bsdiff patches. That mean u cannot just add some file to the .mpq and hope that work. It won't. u should make a bsdiff patch from this file, then add the header at the beginning.

The header is something like this :

edit: updated

Code: [Select]
struct UpdateFileHeader
{
UINT16 HdrSize; // always 0x0018
UINT8 version; // always 0x04
UINT8 override; // 0x01 => override with new file; 0x04 => update file (bsdiff)
UINT32 crc32; // of the file before update
UINT32 OldFileSize; // file size before the update (uncompressed)
UINT32 NewFileSize; // size of the entire file after the update is applied (uncompressed)
UINT32 unknown6;
UINT32 unknown7;
};
« Last Edit: April 06, 2013, 06:53:29 pm by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: Blizzard Installer Customisation
« Reply #62 on: April 06, 2013, 10:43:15 am »
It should not need to be a bsdiff. Iirc, if the installer sees a bsdiff-header, it automatically applies it as patch. If it does not, it should just overwrite the file.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: Blizzard Installer Customisation
« Reply #63 on: April 06, 2013, 02:31:27 pm »
Quote from: "schlumpf"
It should not need to be a bsdiff. Iirc, if the installer sees a bsdiff-header, it automatically applies it as patch. If it does not, it should just overwrite the file.
right, can add a normal file (not bsdiff patch), but need to modify the header accordingly.
Header updated.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: Blizzard Installer Customisation
« Reply #64 on: April 06, 2013, 03:22:20 pm »
Hacked together a little program to copy the contents of the extracted patch to a new folder, with the header applied for every file:

http://pastebin.com/byTHJB2i

I'm not very good at C++. :) At the moment folder structure is not maintained, and old file size I left as 0.



Whoop whoop!

Code: [Select]
This patch upgrades World of Warcraft from version 3.3.5.12340 to version 3.3.5.12341.
Installing World of Warcraft Update at "C:WoW 3.3.5" on Sat Apr 06 14:40:29 2013.
Created folder "C:WoW 3.3.5Cache".
Created folder "C:WoW 3.3.5CacheWDB".
Created folder "C:WoW 3.3.5CacheWDBenGB".
Created folder "C:WoW 3.3.5Logs".
Created file "C:WoW 3.3.5DataenGBbackup-enGB.MPQ".
Created file "C:WoW 3.3.5DataenGBpatch-enGB-4.MPQ".
Created file "C:WoW 3.3.5Datapatch-4.MPQ".
Created file "C:WoW 3.3.5LogsBlizzard Updater Log.html".
Created file "C:WoW 3.3.5Patch.html".
Created file "C:WoW 3.3.5Patch.txt".
Created file "C:WoW 3.3.5WTFRunOnce.wtf".
Created file "C:WoW 3.3.5Battle.net.dll".
Created file "C:WoW 3.3.5Wow.exe".
<Win32_UnableToAddWorld of Warcraft UpdateToGamesExplorer>
The update was successful.

edit: Updated my pastebin link.

I'm getting:
Code: [Select]
The patch "pc-battlenet-hdfilesBattle.net.dll" could not be applied. (Invalid header: size 24, version 1.)
When I specify overwrite instead of 0x04 (backup first), as backup needs the original actual file size.

My header is:
18 00 01 04 00 00 00 00 00 00 00 00 80 DB ED 00 00 00 00 00 00 00 00 00
Which looks correct to me.

When I set it to 0x04 but set the old file size as the same as the current file size (which it should be since both my Battle.net.dll's are exactly the same file size:
Code: [Select]
The patch "pc-battlenet-hdfilesBattle.net.dll" could not be applied. (CRC mismatch: expected 0x00000000, actual 0xb58429b0.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: Blizzard Installer Customisation
« Reply #65 on: April 06, 2013, 06:21:27 pm »
error from me, sorry. Updated
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: Blizzard Installer Customisation
« Reply #66 on: April 06, 2013, 07:10:25 pm »
Updated my messy code from the pastebin link.

I am getting CRC mismatch still:
Code: [Select]
The patch "pc-battlenet-hdfilesBattle.net.dll" could not be applied. (CRC mismatch: expected 0x00000000, actual 0xb58429b0.)
I am guessing that the header is saying it should be 0 and the other is the actual value retrieved.

The CRC returned from battle.net.dll in my function is:
Code: [Select]
3045337520
So I don't know why it is seeing 0 unless I am writing the header in the wrong order.

I set unknown 6 and 7 to crc just to see what would happen:
Code: [Select]
The patch "pc-battlenet-hdfilesBattle.net.dll" could not be applied. (PTCApply_BSDiff flunked.)
So I set override to 0x01 instead of 0x04 and the patching process fully worked! o_0 So unknown 6 or 7 must be the CRC not unknown 3.

So this is the code where it all works: http://pastebin.com/yuLAHvsK
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: Blizzard Installer Customisation
« Reply #67 on: April 06, 2013, 09:57:14 pm »
Yup, it's all working perfectly now. :) Ran many tests and compiled a 5000+ file installer that runs successfully.

Note that empty files will cause the installer to throw an error. I'm not sure if this is because the header becomes corrupt because the file size is empty or what, but I had to remove a few empty files from my Glue and Frame XML folders.

Cheers, I'll try to type up the entire process clearly and formally at some point.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

iindigo

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 198
    • View Profile
Re: Blizzard Installer Customisation
« Reply #68 on: April 06, 2013, 10:03:36 pm »
Great work guys, this is a huge step forward in providing an A++ custom server experience :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

happyhack

  • Contributors
  • Race Changer
  • *****
  • Posts: 38
    • View Profile
Re: Blizzard Installer Customisation
« Reply #69 on: April 07, 2013, 03:28:07 am »
Quote from: "stoneharry"
So unknown 6 or 7 must be the CRC not unknown 3.
no no... ^^ header is correct

hdr => 18 00 04 04 01 00 00 00 80 DB ED 00 80 DB ED 00 02 00 00 00 03 00 00 00
error => CRC mismatch: expected 0x00000001, actual 0x0527e254

Quote from: "stoneharry"
So I set override to 0x01 instead of 0x04 and the patching process fully worked!
yes, its ok.

Quote from: "schlumpf"
It should not need to be a bsdiff.
battle.net.dll is not a bsdiff patch. Its a fully working dll, i was wrong at 1st.
In its original header its override field was set to 0x01. If u extract files from an update .mpq, be sure to keep the header unharmed.

Note that the crc32 field is only checked if override field is set to 0x04.
Still the last 2 field of the header are unknown... be carefull about that.

Quote from: "stoneharry"
I'm not very good at C++.
Code: [Select]
OutFile.write(reinterpret_cast<const char*>(&test.HdrSize), sizeof(UINT16));
OutFile.write(reinterpret_cast<const char*>(&test.version), sizeof(UINT8));
OutFile.write(reinterpret_cast<const char*>(&test.override), sizeof(UINT8));
OutFile.write(reinterpret_cast<const char*>(&test.crc32), sizeof(UINT32));
OutFile.write(reinterpret_cast<const char*>(&test.OldFileSize), sizeof(UINT32));
OutFile.write(reinterpret_cast<const char*>(&test.NewFileSize), sizeof(UINT32));
OutFile.write(reinterpret_cast<const char*>(&test.crc32), sizeof(UINT32));
OutFile.write(reinterpret_cast<const char*>(&test.crc32), sizeof(UINT32));
:lol: (no offend ^^)

Code: [Select]
OutFile.write(reinterpret_cast<const char*>(&test), sizeof(UpdateFileHeader));
;)

Quote
Great work guys, this is a huge step forward in providing an A++ custom server experience
yep good job about the extractor wich was the most of the work.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

d3vil1234

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 4
    • View Profile
Re: Blizzard Installer Customisation
« Reply #70 on: July 28, 2013, 03:45:19 pm »
Hello guys maybe  can create a little tutorial for newcomers?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: Blizzard Installer Customisation
« Reply #71 on: July 28, 2013, 06:15:36 pm »
Quote from: "d3vil1234"
Hello guys maybe  can create a little tutorial for newcomers?

No not really. I was going to make a tutorial that shows all the steps and documents each part but I ran out of free time and it won't exactly be fun to do.

If you get stuck you can ask questions here. If you don't know where to start, maybe this is too advanced for you. Try reading through the pages of this thread.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

d3vil1234

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 4
    • View Profile
Re: Blizzard Installer Customisation
« Reply #72 on: July 28, 2013, 07:59:14 pm »
The error i came when i try to install modified update from 335 to 335a to patch to 336.12341. When i open 335a update with ladik mpqeditor i update files and when i open appended installer and open i see installer data. What is wrong. I try to open my test updater i run to this:(

Quote
The file "pc-game-hdfilesWow.exe" could not be opened. If this problem persists, you may be able to solve it by uninstalling and then reinstalling the game. If you are unable to correct this problem, please contact Blizzard Technical Support. (InstallerFile::Open)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: Blizzard Installer Customisation
« Reply #73 on: July 28, 2013, 08:55:10 pm »
Quote from: "d3vil1234"
The error i came when i try to install modified update from 335 to 335a to patch to 336.12341. When i open 335a update with ladik mpqeditor i update files and when i open appended installer and open i see installer data. What is wrong. I try to open my test updater i run to this:(

Quote
The file "pc-game-hdfilesWow.exe" could not be opened. If this problem persists, you may be able to solve it by uninstalling and then reinstalling the game. If you are unable to correct this problem, please contact Blizzard Technical Support. (InstallerFile::Open)

Not sure what you are trying to say because your English is poor (sorry!).

The primary steps are:
  • Extract contents of a old patch (I used 3.3.5 to 3.3.5a)
  • Modify contents to your patch
  • Update the patch.lst file
  • Write the installer header binary data to the beginning of every file in the base folder and the WoW binary and the battle.net.dll if you are writing that and the WTF run once file.
  • Create a MPQ from this data.
  • Extract installer data.
  • Use append to take installer data and the MPQ created to write a new executable installer.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

d3vil1234

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 4
    • View Profile
Re: Blizzard Installer Customisation
« Reply #74 on: July 28, 2013, 09:35:17 pm »
it is normal to have size of wow executable around 24bytes?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »