IsArchive

Far Manager

IsArchive

Check whether the specified file is an archive.
BOOL WINAPI IsArchive(
  const char *Name,
  const unsigned char *Data,
  int DataSize
);

Parameters

Name
Archive name
Data
archive file data (pointer to data of DataSize size relative to the beginning of the file)
DataSize
the size of data passed to the function

Return value

TRUE if the archive type is supported by plugin.

Example

An example of ZIP archive definition (ZIP.CPP)

BOOL WINAPI _export IsArchive(const char *Name,
                      const unsigned char *Data,
                      int DataSize)
{
  for (int I=0;I < DataSize-10;I++)
  {
    const unsigned char *D=Data+I;
    if (D[0]=='P' && D[1]=='K' &&
        D[2]==3   && D[3]==4   &&
        D[8]<15   && D[9]==0)
    {
      SFXSize=I;
      return(TRUE);
    }
  }
  return(FALSE);
}
See also: