The RIFF File Format


Original Documentation

The RIFF (Resource interchange file format) format was created by Microsoft and
is used by many applications like Windows, Corel Draw etc.. It is block
structured, each block has a header ID and a size, so that even a program that
works with an old version of the file format can skip the unknown parts of the
file and work on the known parts of the file. All RIFF blocks begin on a word
boundary so it might be necessary to skip an additional byte. In the present
specification, only one RIFF block per file is allowed, and only the RIFF and
LIST blocks may contain subblocks.

The order of blocks in a RIFF file is not mandatory, so you should always scan
the whole file for the block ID you seek. Throughout this file, the RIFF block
IDs are given in square brackets []. Each ID is always 4 characters dword.

OFFSET              Count TYPE   Description
0000h                   4 char   ID='RIFF'
								 Each RIFF format file has a header with the
								 signature and the size of the following
								 blocks.
0004h                   1 dword  Block size. This size is the size of the block
								 controlled by the RIFF header. Normally this
								 equals the file size.
								 ="BSZ"
0008h                   4 char   Format name. This is the format name of the RIFF
								 file.
After this RIFF header comes the first RIFF record. Each RIFF record has the
following format :
OFFSET              Count TYPE   Description
0000h                   4 char   Signature. This is the description of what is
								 contained in this block.
0004h                   1 dword  Block size. This is the size of the following
								 data block. To get the offset of the next RIFF
								 block record, you have to add this value + 8 to
								 the offset of the current record.

---RiffBLOCK [LIST]
This block contains a string list, again in the RIFF subblock format. This list
is used for messages and/or copyright messages. All strings in the LIST block
share the same format, each block contains one ASCIIZ string - the most common
LIST block is the [INFO] block, which can contain the following subblocks :

[INAM]
The name of the data stored in the file
[ICRD]
Creation date of the file

SEE ALSO:BMP,rDIB,IFF,WAVe,RIFX
OCCURENCES:PC
PROGRAMS:Windows,Corel Draw
REFERENCE:DDJ0994
VALIDATION:FileSize="BSZ"+8

This information is from Corion.net and is used with permission.

More Resources