Analyze file type I (COM)

Method

AnalyzeFileTypeEx

Description

This method analyzes a file (or buffer) and attempts to guess its type, detects files of which the file extensions may have been altered, and recursively analyzes contents of archive files.

Function prototype

HRESULT AnalyzeFileTypeEx
(
[in] VARIANT FileName,
[out] VARIANT * SuggestedExtension,
[out] VARIANT * FileTypeLong,
[out, retval] VARIANT * FileTypeShort
)

Arguments

Argument

Description

Data Type

FileName

If FileNameOrBuffer is of type string then it is treated as a file name to be analyzed. Otherwise, if it is a byte array it is treated as a memory buffer that should be analyzed

String (file)

OR

Byte array(buffer)

FileTypeLong

If the pointer that is passed to the method is not null then the VARIANT will be filled with a string describing the file type in detail.

string

SuggestedExtension

If the pointer that is passed to the method is not null then the VARIANT will be filled with the suggested extension type of the file.

string

FileTypeShort

A series of letters that summarize the file type. More details are described in UOther Important Return Types.

string

The string returned in SuggestedExtension is the three letter extension of the filename. The AnalyzeFiletypeEx detection is based on the FileTypeLong returned from the AnalyzeFileType. The SuggestedExtension returns the actual extension of the file, even if it has been altered before scanning the file. If the file comprises of more than one extension, such as executable plus archive, the function returns only the first extension type detected.