HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

What attributes does War3 /WorldEdit expect?

08-27-2004, 06:09 PM#1
Vexorian
I've been making my app to be able to open maps directly, using shadowflare's library, it is working great, however warcraft III / the world editor keep saying me that the Data File Is corrupt, This happened to me a lot in the past when adding files with a mpqeditor.

So what mpq file attributes they expect?
08-28-2004, 06:19 AM#2
Extrarius
The problem is a file named "(attributes)" {w/o quotes} in the MPQ. It stores information(checksums mostly, but also other stuff) about all the files inside the MPQ, so if you change a file the info won't match up and the game will say it is corrupted. I don't think anybody knows the formulas used in this file so it is probably best to just remove it from the MPQ if you modify any of the files it 'protects'.
08-28-2004, 02:04 PM#3
Vexorian
Quote:
Originally Posted by Extrarius
The problem is a file named "(attributes)" {w/o quotes} in the MPQ. It stores information(checksums mostly, but also other stuff) about all the files inside the MPQ, so if you change a file the info won't match up and the game will say it is corrupted. I don't think anybody knows the formulas used in this file so it is probably best to just remove it from the MPQ if you modify any of the files it 'protects'.
Actually I think I got it, and it was mostly because of extprotect's source, thanks for replying and releasing the source of your program.
10-07-2004, 07:33 PM#4
PitzerMike
Well for those who want to know it exactly here's the content of the (attributes) file (a long is a c++ 4-byte int):

- 1 long (unknown 1), set to 0x64000000
- 1 long (unknown 2), set to 0x03000000
- n times a file-definition structure, n is the number of used slots (=files) in the archive

File-definition structure:
- 1 long (CRC32), this is the CRC32 (cycling redundancy check) value of the file, wich is a sort of checksum, you can find functions that calculate the CRC32 of a file on the web
- 1 long (low date time)
- 1 long (high date time)
these two longs represent the time the file has been added, they include information about the year, month, day, hour, minute and second when it has been added, these 2 values represent a WinAPI file time structure and can be converted to the WinAPI system time type by using the SystemTimeToFileTime and FileTimeToSystemTime functions in kernel32.dll

These file-definition structures are in the same order as the files occur in the archive. Logically this means that the information of the last File-definition structure is the information about the (attributes) file, because it has to be added to the archive after all other files. This also means that the CRC32 of the last file is always 0, because you cannot calculate the CRC32 of the (attributes) file and then write it to the same file, because the CRC will be wrong then.
10-08-2004, 01:56 PM#5
BlacKDicK
PitzerMike you confused things a bit. Attributes is:

struct attributes
{
DWORD dwUnkA; // 0x64000000
DWORD dwUnkB; // 0x03000000
DWORD dwCrc32[n]; //Pseudo-code. I rather use LPDWORD and malloc/new
FILETIME lpFileTime[n]; // Pseudo-code. I rather use LPFILETIME and malloc/new.
};

Notice that is not the same as "n times a file-definition structure". It is not an array of "n file-definition structures" but 2 independent arrays instead, altough they have the same n size.
10-17-2004, 08:01 PM#6
Quantam
Quote:
Originally Posted by Extrarius
The problem is a file named "(attributes)" {w/o quotes} in the MPQ. It stores information(checksums mostly, but also other stuff) about all the files inside the MPQ, so if you change a file the info won't match up and the game will say it is corrupted. I don't think anybody knows the formulas used in this file so it is probably best to just remove it from the MPQ if you modify any of the files it 'protects'.
Yeah. The CRCs are deprecated; it's okay to just get rid of (attributes), for now.