• Welcome to Valhalla Legends Archive.
 

Automatic Version Check File Patching

Started by Ribose, September 18, 2008, 07:37 PM

Previous topic - Next topic

MyndFyre

Quote from: Ribose on September 18, 2008, 07:37 PM
I've been curious recently whether it would be feasable to make a C# bot download patch files and extract the version check files and replace the old ones using MBNCSutil's bnftp and mpq classes. I've already got it to successfully download the MPQ file using the name provided in the version check fail message, but I don't know how to find the hash files in there. (the only known files are exe and the (attributes), (listfile), and (signature) (according to the MPQ utility I'm using).

This is with the 1.15.3 patch for StarCraft: Broodwar.

Sorry I just saw this topic.

I've been toying with the diffpatch algorithm recently in an attempt to not have it for my upcoming bot but also to fix/update BNLS.  If my results are adequate they'll be rolled into MBNCSUtil.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

MyndFyre

Quote from: Hdx on September 23, 2008, 03:49 PM
From 5 mins of looking at it, 1 is extramly simple. [as you said]
(word) header len 0x18
(byte) unknown 0x04
(byte) ver
For 0, theres 8 bytes always 0, [checked 4 diffrent patches]
then u16 length of file data
and after that I have no clue what the data is, but i presume it's a crc or something knowing that bnupdate complains if the files dont match the old one, even on ver 1.
Havednt looked at 0 yet, but in the last patch only battle.snp was 0. So meh.
I'm dubious about a u16 for file length - that means the length is capped at 64KiB?
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Hdx

ive encountered a few 1 files that have unknown value in the 2 bytes following the length.
But I've never encountered a file using 1 that was larger then 0xf000
Which would make sense as they would probaly use 0, the dif function that would significantly decrease the size of the file in the archive. But this is pure speculation so dont mind me head. I still havent actually looked at bnupdate

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

UserLoser


typedef struct patchfileheader_t {
WORD SizeOfStructure; // Should always be 0x18 (24)
BYTE Version; // ? 4: Always seen to be 4
BYTE PatchType; // 0: Differential, 1: Direct Copy, 2/4: Binary sort differential
DWORD Checksum; // CRC32 checksum of filedata with length of GetFileSize() on old file
DWORD OldFileSize; // What old file size should be (if this is 0, ignore)
DWORD NewFileSize; // What new file size should be (if this is 0, ignore)
FILETIME NewFileTime; // What to set new FILETIME to
} PATCHFILEHEADER;

Barabajagal

I'm a bit confused on the Checksum... It's a check on the old file, on what the new file should be, or the data after the header? And what does "length of GetFileSize() on old file" mean?

bulletproof tiger

Quote from: Andy on September 27, 2008, 09:34 AM
I'm a bit confused on the Checksum... It's a check on the old file, on what the new file should be, or the data after the header? And what does "length of GetFileSize() on old file" mean?

Well, now that you have the patch file's header, it should be fairly easy to look at a patch file, and determine what exactly those mean.

Hdx

humm, filetime you say... Wow i'm stupid :P never thought to check that.
Dosent GetFileSize() return the same value as Right-click -> properties ->File Size
And GetCompressedFileSize() return Size on Disc?
If so... I must of gotten my reverted battle.snp file wrong. [extracted from stardat.mpq]
As mine is 239,870 bytes CRC32 0x5207A451, and according to the patch file it should be 282878 CRC32 0x6B8F7726
18 00 04 00 26 77 8F 6B FE 50 04 00 FE 80 08 00
A9 69 4B 0D AF EE C8 01
neh?

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

brew

Quote from: Andy on September 19, 2008, 11:19 PM
If you're gonna reverse engineer anything, wouldn't BNUpdate.exe be the file to look at?

Should look at storm's ordinal 120 as well
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

UserLoser

Quote from: brew on October 02, 2008, 05:23 PM
Quote from: Andy on September 19, 2008, 11:19 PM
If you're gonna reverse engineer anything, wouldn't BNUpdate.exe be the file to look at?

Should look at storm's ordinal 120 as well

why

brew

Quote from: UserLoser on October 16, 2008, 10:57 AM
Quote from: brew on October 02, 2008, 05:23 PM
Quote from: Andy on September 19, 2008, 11:19 PM
If you're gonna reverse engineer anything, wouldn't BNUpdate.exe be the file to look at?

Should look at storm's ordinal 120 as well

why

Because it's what actually extracts the patch, creates the bnupdate process, etc?
It doesn't hurt to look.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

UserLoser

dunno son, i never looked at that in my life

xpeh

Sry, my english was not good enough to read 2 pages :)

Do you want to download patch from BNET and get a fresh exe's? What do you need it for? AFAIK local hashing doesn't work anymore.

Barabajagal


xpeh

For BNET?

Can you give me a bot that works without extra connections?

Ribose

Er, what? I have been able to easily make a bot that does not use BNLS (your "remote connections"), with the help of MBNCSutil, which is just a dll.
I do agree that there aren't many public bots that connect on their own, due to recent patches (StealthBot, for example).  But adversely, I know many that do (Andy's RCB does IIRC, and ringo made that SCGP thing that does not use BNLS, or remote connections for Warden support either, for that matter).
~Ribose

|