(Non-Compound) FileType Key

This key is used by the GetClassFile function to match patterns against various file bytes in a non-compound file. The named values are stored under the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\
\FileType
\<CLSID>
\<n> = <offset, cb, mask, value>

The offset value determines how far from the beginning or end of the file to begin the comparison. If the offset is a negative value, then the comparison will begin from the end of the file minus the offset value. The offset value is a decimal type unless preceded by "0x".

The cb value represents the length in bytes from the beginning to the end of the file. It represents the byte range in the file. The cb value is a decimal unless preceded by "0x".

The mask value specifies a binary value used for masking. Masking is performed by using a logical AND operation, and the byte range specified by offset and cb. If this value is omitted then the bytes will be set to all ones. This value is always hexadecimal.

The value value represents the pattern that must match for a file to be of this FileType. The pattern is used to properly identify a known file format from its contents not by its extension.

Entries under the FileType key are used by the GetClassFile function to match patterns against various file bytes in a non-compound file. FileType has CLSID sub keys, each of which has a series of sub keys \0, \1, \2.... These values contain a pattern that, if matched, yield the indicated CLSID. The following code examples show FileType entries.

\0 = 0, 4, FFFFFFFF, ABCD1234
where the first 4 bytes must be ABCD1234, in that order, or
\1 = 0, 4, FFFFFFFF, 9876543
where they must match 9876543, or
\2 = -4, 4, FEFEFEFE
where the last four bytes in the file must be FEFEFEFE.

See Also

COM Registry Settings | COM Security | Component Services (COM and DCOM) | Enhancing the Security of a Device

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.