Patching Files: Difference between revisions

From wowdev
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 27: Line 27:
inside it are "patch" files.
inside it are "patch" files.


Followings are for binary/new patch header:
Followings are for new file patch header:


   0x0000 2 bytes: Size of the patch header (I've only seen 0x18)
   0x0000 2 bytes: Size of the patch header (I've only seen 0x18)
   0x0002 2 bytes: signature,
   0x0002 2 bytes: Flags
          * 0x0104 means binary patch
                  * 0x0004 seems always set
   0x0004 8 bytes: unknown, always 8 bytes 0x00
                  * 0x0100 unknown, set when new file patch
   0x000C 4 bytes: file size n
                  * 0x0400 means BSDIFF40 patch
   0x0010 8 bytes: timestamp
   0x0004 4 bytes: Looks like CRC
  0x0008 4 bytes: unknown
   0x000C 4 bytes: file size (only if Flags = 0x0100)
   0x0010 8 bytes: timestamp as FILETIME
   ---- body ----
   ---- body ----
   0x0018 n bytes: the real thing
   0x0018 n bytes: the real thing


Followings are for plain text patch header:
Followings are for BSDIFF40 patch header:


   0x0000 2 bytes: Size of the patch header (I've only seen 0x18)
   0x0000 2 bytes: Size of the patch header (I've only seen 0x18)
   0x0002 2 bytes: signature,
   0x0002 2 bytes: Flags
          * 0x0404 means plain text patch
                  * 0x0004 seems always set
   0x0004 8 bytes: maybe timestamp
                  * 0x0100 unknown
   0x000C 4 bytes: file size
                  * 0x0400 means BSDIFF40 patch
   0x0004 4 bytes: Looks like CRC
  0x0008 4 bytes: unknown
   0x000C 4 bytes:  
   0x0010 8 bytes: timestamp
   0x0010 8 bytes: timestamp
   ---- body ----
   ---- body ----
Line 54: Line 60:
For the new files, I can skip heading 24 bytes and get the real
For the new files, I can skip heading 24 bytes and get the real
thing! But I still can't understand the things after BSDIFF40.
thing! But I still can't understand the things after BSDIFF40.
-- chuanhsing
-----------------------------
As about patch files in MPQs, I found this structure so far:
  0x0000 (2 bytes) Size of the patch header (I've only seen 0x18)
  0x0002 (2 bytes) Flags.
  - 0x0004 - Seems to be always set
  - 0x0100 - Unknown
  - 0x0400 - The patch file is made by bin patch generator)
  0x0004 (4 bytes) Looks like CRC
  0x0008 (4 bytes) Unknown
  (looks like size of something when 0x0100 flag set)
  0x000C (4 bytes) File size (only if Flags = 0x0104)
  0x0010 (8 bytes) Time stamp as FILETIME
  ---- body ----


-- chuanhsing
-- chuanhsing

Revision as of 04:37, 23 July 2009

For updating files WoW uses bsdiff. Have a look at "http://www.daemonology.net/bsdiff/" or "http://www.pokorra.de/coding/bsdiff.html"


I had try bsdiff, but it doesn't work.

 1. extract achievement.dbc from enUS\DBFilesClient in Patches\WoW-3.1.3-to-3.2.0-enUS-Win-patch\wow-partial-1.MPQ
 2. rename it to achievement.dbc.patch (45K)
 3. extract achievement.dbc from DBFilesClient in Data\enUS\patch-enUS-2.MPQ
 4. rename it to achievement.dbc.old
 5. bsdiff
   usage: bspatch.exe oldfile newfile patchfile
 6. bsdiff chievement.dbc.old achievement.dbc achievement.dbc.patch
   Corrupt patch
 7. extract achievement.dbc from DBFilesClient in PTR:Data\enUS\patch-enUS-2.MPQ
 8. rename it to achievement.dbc.ptr
 9. bsdiff achievement.dbc.old achievement.dbc.ptr achievement.dbc.patch-ptr (20K)

althought it shows "BSDIFF40" in it's header, but it is not a bsdiff?

-- chuanhsing


I got some information about files in pre-download mpq. All files inside it are "patch" files.

Followings are for new file patch header:

 0x0000 2 bytes: Size of the patch header (I've only seen 0x18)
 0x0002 2 bytes: Flags
                 * 0x0004 seems always set
                 * 0x0100 unknown, set when new file patch
                 * 0x0400 means BSDIFF40 patch
 0x0004 4 bytes: Looks like CRC
 0x0008 4 bytes: unknown
 0x000C 4 bytes: file size (only if Flags = 0x0100)
 0x0010 8 bytes: timestamp as FILETIME
 ---- body ----
 0x0018 n bytes: the real thing

Followings are for BSDIFF40 patch header:

 0x0000 2 bytes: Size of the patch header (I've only seen 0x18)
 0x0002 2 bytes: Flags
                 * 0x0004 seems always set
                 * 0x0100 unknown
                 * 0x0400 means BSDIFF40 patch
 0x0004 4 bytes: Looks like CRC
 0x0008 4 bytes: unknown
 0x000C 4 bytes: 
 0x0010 8 bytes: timestamp
 ---- body ----
 0x0018 4 bytes: file size
 0x001C 1 byte: unknown
 0x001D 8 bytes: signature, "BSDIFF40"
 0x0025 n bytes: unknown

For the new files, I can skip heading 24 bytes and get the real thing! But I still can't understand the things after BSDIFF40.

-- chuanhsing