Difference between revisions of "Uodemo.dat"

From UODemo Wiki
Jump to: navigation, search
Line 5: Line 5:
 
   data area (dynanamic in size)
 
   data area (dynanamic in size)
  
It consists if minimum 1 header and can contain up to 3000 files.  More files are simply not supported by the code.
+
The header area consists of minimum 1 header and can contain up to 3000 files.  More files are simply not supported by the code. If the filename in the header is equal to "@@@.@@@" then the end of the header area is reached.  The end of the header area marks the beginning of the data area.
If the filename in the header is equal to "@@@.@@@" then the end of the header area is reached.
 
  
 
The file is encrypted using the GOST block cipher.
 
The file is encrypted using the GOST block cipher.
Line 17: Line 16:
 
{
 
{
 
   char filename[260];      // 260 is MAX_PATH in Windows
 
   char filename[260];      // 260 is MAX_PATH in Windows
   int32 filepointer;      // this pointer is relative from the end of the header area
+
   int32 filepointer;      // this pointer is relative from the beginning of the data area
 
   int32 maximumsize;      // if set, the file can grow until this size is reached
 
   int32 maximumsize;      // if set, the file can grow until this size is reached
 
   int32 isreadyonly;      // 0 = writeable, <> = read-only
 
   int32 isreadyonly;      // 0 = writeable, <> = read-only

Revision as of 08:54, 22 May 2009

This is a custom made archive file for the Ultima Online Gold Demo.

The archive is divided in 2 area's:

 header area (dynamic in size, the size is a multiple of 280 bytes)
 data area (dynanamic in size)

The header area consists of minimum 1 header and can contain up to 3000 files. More files are simply not supported by the code. If the filename in the header is equal to "@@@.@@@" then the end of the header area is reached. The end of the header area marks the beginning of the data area.

The file is encrypted using the GOST block cipher. Each header is encrypted seperatly, the data of each file is encrypted in blocks of 4KB (4096 bytes). The same encryption/decryption key is used for the entire arhive.

One header entry is 280 bytes in size.

struct datheader {

 char filename[260];      // 260 is MAX_PATH in Windows
 int32 filepointer;       // this pointer is relative from the beginning of the data area
 int32 maximumsize;       // if set, the file can grow until this size is reached
 int32 isreadyonly;       // 0 = writeable, <> = read-only
 int32 encryptedsize;     // encrypted filesize (not the actual filesize)
 int32 fileposition;      // internally used by uodemo.exe, not relevant for reading from the archive

};

The actual filesize can be obtained by reading the last int32 in the file data after decryption. This means that for a 0 length file, the encryptedsize will be atleast be 4 bytes (size of one int32).