so i downloaded the PC demo thingy of a game that used to be called Colin McRae DiRT(from somewhere else i didnt have to suffer through slooooooooooooooooooooooooooooooooooow download speeds for), unpacked the demo's contents(it was an .exe) and then i was faced with a bunch of .cab/.hdr files i tried to handle with my own
what i did was take this script and modify it into something like this
# InstallShield (version?) HDR/CAB (script 0.2) # original struct information by wattostudios # https://zenhax.com/viewtopic.php?t=4279&p=23854#p23854 # script for QuickBMS http://quickbms.aluigi.org
comtype deflatex
open FDDE "hdr" 0 HDR_EXISTS if HDR_EXISTS == 0 open FDDE "cab" endif open FDDE "cab" 1
idstring "ISc(" get VER long xmath max_ver "VER >> 16" get ZERO long get INFO_OFF long get INFO_SIZE long get HDR_SIZE long
goto INFO_OFF get OFFSET long get ZERO long get DUMMY1 long get SIZE long get ZERO long get DUMMY_SIZE long get DUMMY_SIZE long get FOLDERS long get ZERO long get DUMMY2 long get FILES long get DUMMY3 long
# at 0x230 there is a lot of info pertaining to string offsets, info offsets and the like # what the script is supposed to do here is to reach these offsets so it can parse them completely # what comes below is just stuff that doesnt involve the target directory of all things
math INFO_OFF + SIZE goto INFO_OFF
for i = 0 < FOLDERS get directory_name_offset long savepos TMP math directory_name_offset + INFO_OFF goto directory_name_offset get directory_name_string string goto TMP putarray 1 i directory_name_string next i
for i = 0 < FILES get cab_01 short get cab_02 longlong get cab_03 longlong get cab_04 longlong getdstring cab_05 0x10 getdstring cab_06 0x10 get file_name_offset long savepos TMP math file_name_offset + INFO_OFF goto file_name_offset get file_name_offset string goto TMP get cab_08 short getarray directory_name_string 1 cab_08 get cab_09 long get cab_number_01 long get cab_11 long get cab_12 long get cab_13 long get cab_14 byte get cab_number_02 short next i
here are the samples by the way data1_hdr_cab.7z if any of you need the exe let me know
. . 0000000000000802 . 00000000000310bc get TYPE 0x0000000000000004 2 . 00000000000310be get SIZE 0x000000000022daf8 8 . 00000000000310c6 get ZSIZE 0x000000000021dbe4 8 . 00000000000310ce get OFFSET 0x0000000003d4f09c 8 . 00000000000310d6 getdstr HASH "" 16 70 6d 41 3c cb 3b c8 43 ee 14 4a 59 1b 16 d4 0a pmA<.;.C..JY.... . 00000000000310e6 get DUMMY 0x0000000000000000 2 . 00000000000310e8 get DUMMY 0x0000000000000000 2 . 00000000000310ea get DUMMY 0x0000000000000000 2 . 00000000000310ec get DUMMY 0x0000000000000000 2 . 00000000000310ee get ZERO 0x0000000000000000 8 . 00000000000310f6 get NAME_OFF 0x000000000003f553 4 . 00000000000310fa get ZERO 0x0000000000000000 2 . 00000000000310fc get FLAGS 0x0000000000000021 4 . 0000000000031100 get DUMMY 0x00000000621b36aa 4 . 0000000000031104 get FOLDER 0x0000000000000008 4 . 0000000000031108 getdstr DUMMY "" 9 00 00 00 00 00 00 00 00 00 ......... . 0000000000031111 get SOMETHING 0x0000000000000008 2
but something that contains actual information(like what these two snippets of quickbms "debugging" are proving) isnt parsed for some insane reason - yes its that same sample i posted in the first post of this very thread
math CHUNK_SIZE = 0x8000 for i = 0 < FILES get TYPE short get SIZE longlong get ZSIZE longlong get OFFSET longlong getdstring HASH 16 get DUMMY short # 0 or 1 get DUMMY short # 0 or 0xa get DUMMY short # 0 or 0xee get DUMMY short # 0 get ZERO longlong get NAME_OFF long get ZERO short get FLAGS long get DUMMY long get FOLDER long math FOLDER = 0 # there is no FOLDER field getdstring DUMMY 9 get SOMETHING short
if SOMETHING <= 1 # 2 is wrong callfunction DUMP 1 endif next i cleanexit
math CHUNK_SIZE = 0x8000 for i = 0 < FILES get TYPE short get SIZE longlong get ZSIZE longlong get OFFSET longlong getdstring HASH 16 get DUMMY short # 0 or 1 get DUMMY short # 0 or 0xa get DUMMY short # 0 or 0xee get DUMMY short # 0 get ZERO longlong get NAME_OFF long get FOLDER short get FLAGS long get DUMMY long get CAB_PART_01 long getdstring DUMMY 9 get CAB_PART_02 short
callfunction DUMP 1 next i cleanexit
with that said the FOLDER field can get messy at times(i used the installed Colin McRae DiRT PC demo directory as a reference) but thats just me
yaa but what about that one sample from the first post of this thread? i used that file most of the time for testing the script youre right, it does do its job (kinda) but based on what i actually saw about the .hdr format a cloud of doubt came into my head
for example, i just found out that that SOMETHING field could very well be the actually the number of .cab files, not to mention there are a lot of referenced files that are stored in anything beyond data1.cab too
sorry i didnt tell you this from the beginning but yeah that was exactly what i had in mind(thanks for the update anyway!), heck i even tried to tell you this but you went all close-minded for some insane reason
still there is quite a lot of stuff your script hasnt had it covered yet so if i see anything unusual ill let you know
The script is doing the correct thing but there is something wrong in the data file.
We have: SIZE 0x0000000000058e67 ZSIZE 0x0000000000001a92 OFFSET 0x00000000069bc0f4
So the script opens the new data7.cab (DATA_ID 7), goes to offset 69bc0f4 and reads the 16bit chunk size which is going to be expected being <= than ZSIZE. ZSIZE is 0x1a92 while the chunk size is 0x6ff7 (bigger?!) and decompression fails.
The other fields are not much different than those of the previously successful file. Maybe I will try downloading the demo and check by myself but from the log I don't see errors made by the script.