DVP_IdentifyFileBytes(
     HWND:hWnd,
     LPTSTR:lpszName,
     LPBYTE:lpData,
     UINT:uiDataSize,
     LPVIEWERPLUGINFILEINFO:lpVPFileInfo,
     DWORD:dwStreamFlags
)
→ BOOL

Arguments

hWnd

This parameter specifies the parent window handle that should be used to display any error messages if appropriate.

lpszName

Supplies the name of the file, including the full path.

lpData

This parameter points to a buffer containing a chunk of data from the beginning of the file. The size of the buffer is given by the uiDataSize parameter. You must treat this data as read-only.

uiDataSize

Specifies the amount of data pointed to by lpData. Currently this will be 256 bytes unless of course the file in question is smaller than that. You should not make any assumptions about the size of this buffer, however, and it may be increased in the future.

lpVPFileInfo

This parameter points to a VIEWERPLUGINFILEINFO structure that must be filled out if the plugin recognizes and can view the file. See DVP_IdentifyFile for a description of this structure.

dwStreamFlags

If the file is not disk-based but instead is on an FTP site or within a ZIP file, then its data will be read via an IStream data stream. In this instance, the dwStreamFlags parameter may contain information about this data stream. You may use this information to decide whether or not your plugin is to handle this file. The flags currently defined are:

DVPSF_SlowIf set, this flag indicates that the data stream is "slow" - that is, access to the file may potentially take a long time. Currently this is only set for FTP sites.
DVPSF_NoRandomSeekIf set, this flag indicates that the data stream does not support random seeking - that it can only be read sequentially from beginning to end. Currently this will be set for both FTP and ZIP files.

Return value

The DVP_IdentifyFileBytes function must, if appropriate, fill out the VIEWERPLUGINFILEINFO structure in the same way as the DVP_IdentifyFile function and return either TRUE or FALSE to indicate if the file can be handled.

Description

The DVP_IdentifyFileBytes function is called to identify a file based on the file header.

If your plugin specifies the DVPFIF_CanHandleBytes flag, then Directory Opus will call your DVP_IdentifyFileBytes function if possible instead of DVP_IdentifyFile.

This method of file recognition is recommended if you can reliably identify files based on a chunk of data from the start of the file. Currently, this data chunk is 256 bytes in size.