fpGetSubFileInfo()

This function gets information about a subfile in a container file.

Syntax

int (pascal *fpGetSubFileInfo)  (
    void                    *pFile, 
    int                      index,
    KVSubFileInfo           *subFileInfo);

Arguments

pFile The identifier of the main file. This is a file handle returned from fpOpenFile().
index The index number of the subfile for which to retrieve information.
subFileInfo A pointer to the KVSubFileInfo structure, which defines information about the subfile.

Returns

  • If the file information is retrieved, the return value is KVERR_Success.

  • If the file information is not retrieved, the return value is an error code.

Discussion

  • Before retrieving any subfile information, you must get the main file information by calling fpGetMainFileInfo().

  • After the subfile information is retrieved, call fpFreeStruct() to free the memory allocated by this function.

  • If the root node is not enabled, the first subfile is index 0. If the root node is enabled, the first subfile is index 1. The root node is required to recreate a file’s hierarchy. See Create a Root Node.

  • The members subFileInfo->parentIndex and subFileInfo->childArray enable you to recreate a file’s hierarchy. Because childArray retrieves only the first-level children in the subfile, you must call fpGetSubFileInfo() repeatedly until information for the leaf-node children is extracted. See Recreate a File’s Hierarchy.

  • If the subfile is embedded in the main file as a link and is stored externally, subFileInfo->infoFlag is set to KVSubFileInfoFlag_External. For example, the subfile might be an object that was embedded in a Word document by using "Link to File," or an attachment that is referenced in an MBX message. This type of subfile cannot be extracted. You must write code to access the subfile based on the path in the member subFileInfo->subFileName. See KVSubFileInfo.

  • The KVSubFileInfoFlag_External flag is not set for an OLE object that is embedded as a link in a Microsoft PowerPoint file. KeyView can detect linked objects in a Microsoft PowerPoint file only when the object is extracted. See fpExtractSubFile().

Example

KVSubFileInfo    subFileInfo = NULL;
for ( index = 0; index < fileInfo->numSubFiles; index++)
{
  error=extractInterface->fpGetSubFileInfo(pFile,index,&subFileInfo);
  if ( error )
  {
     extractInterface->fpFreeStruct(pFile,subFileInfo);
     subFileInfo = NULL;
  }