Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


RezDet

Tool

SYNTAX

RezDet resourceFile1 [resourceFile2]… [-b[ig]]
[-d[ump] | -l[ist] | -q[uiet] | -r[awdump] | -s[how] | -t[erse]]
[-noResolve]

DESCRIPTION

The RezDet tool investigates the resource fork of the specified files for damage or inconsistencies. Files are read and checked one at a time, and messages are generated for each error, indicating the cause of the damage.

In determining the source of the errors, RezDet checks that the files meet the following conditions:

The resource fork contains the minimum number of bytes (enough to read a resource header).

The header, resource data list, and resource map do not overlap or contain spaces between them. There should not be any bytes between the end-of-file marker and the end of the resource map.

Each record in the resource data list is used once and only once and the last data item ends exactly where the data list ends.

Each item in the resource type list contains at least one reference; each sequence of referenced items starts where the reference list for the previous resource type item ends; and each item in the reference list is pointed to by one and only one resource type list item.

The resource type list does not contain any duplicates.

Each name in the name list has one and only one reference, and the last name does not point outside the name list.

All names have a nonzero length.

The name list does not contain any duplicates. Note that duplicate names cause an advisory warning rather than a true error and that RezDet does not generate this warning unless you also specify the -d, -r, or -s options.

Each reference list item points to a valid data item and either has a name list offset of -1 or points to a valid name list offset.

Bits 7 (reserved) and 1 (changed) are not set in the resource attributes.

Note
RezDet does not use the Resource Manager and should not crash no matter how corrupt the resource fork of a file is. •

INPUT

One or more files (resourceFile). The RezDet tool does not read standard input.

OUTPUT

Standard output. RezDet writes error messages to diagnostic output. If you specify -d, -l, -r, -s, or -t, the information produced by that option is written to standard output.

Note
For the options in which additional information is retrieved, fields are displayed as hexadecimal or decimal numbers for numeric values, or as a hex dump with associated printable Macintosh characters. The newline ($0D), tab ($09), and null ($00) characters are displayed as ¬ , ∆, and ., respectively. •

ALIAS RESOLUTION

This command resolves all Finder aliases in input file specifications. If you wish to check the resources in a Finder alias file use the -noResolve option to override this behavior.

STATUS

RezDet can return the following status codes:

0

no errors

1

syntax error (invalid options or no files specified)

2

resource format error

3

fatal error--an I/O or program error

PARAMETERS

resourceFile1 [resourceFile2]…

Specifies one or more resource files to be checked.

OPTIONS

-b[ig]

Reads the data for each resource into memory one resource at a time, instead of all at once. This is useful for checking huge resource files,
such as the System file.

Note
Try using this option if RezDet tells you that it ran out of memory or that memory is badly fragmented. •

-d[ump]

Generates the same information as the -s[how] option as well as detailed information about the resource header, type list, name list, resource map, and data list.

-l[ist]

Lists resource types, IDs, names, attributes, and resource sizes. Output appears in the following format:

'type' (ID, name, attributes) [size]

-noResolve

Prevents the resolution of leaf aliases in the input resource file path. This allows the resources in a Finder alias file to be checked.

-q[uiet]

Returns a status code instead of generating error messages.

-r[awdump]

Generates the same information as the -d[ump] option but also dumps the contents of data blocks.

Note
This option can generate huge amounts of output. •

-s[how]

Writes information about individual resource types. For each type, RezDet provides the following information: the number of items of this type, the reference list offset, and detailed information on each ID (including the resource name, if any, resource attributes, data offset, and data length).

-t[erse]

Suppresses all messages that do not explicitly describe errors. Examples of such messages include the name of the current file and the statement that the file is OK in the event that no errors were found. Similar to the -q option, but allows error messages to display.

EXAMPLES

The following command line checks the System file.

RezDet "{SystemFolder}System" -big

If the file is damaged, RezDet returns an error message such as this one:

File "HD:System Folder:System"; ### RezDet -- Data inconsistency, 36 bytes left over.

The following command line removes the Test.c file if its resource fork is damaged.

RezDet Test.c -q || Delete Test.c

LIMITATIONS

The RezDet tool does not validate the file attributes field in the resource map header and ignores the Finder-specific fields in the header and resource map header.

Duplicate resource name warnings are generated when you specify -d, -r, or -s, even if the names belong to resources of different types.

 
 


Last Updated July 2000