mmioGetInfo

Syntax

WORD mmioGetInfo(hmmio, lpmmioinfo, wFlags)

This function retrieves information about a file opened with mmioOpen. This information allows the caller to directly access the I/O buffer, if the file is opened for buffered I/O.

Parameters

HMMIO hmmio

Specifies the file handle of the file.

LPMMIOINFO lpmmioinfo

Specifies a far pointer to a caller-allocated MMIOINFO structure that mmioGetInfo fills with information about the file. See the MMIOINFO structure and the mmioOpen function for information about the fields in this structure.

WORD wFlags

Is not used and should be set to zero.

Return Value

The return value is zero if the function is successful.

Comments

To directly access the I/O buffer of a file opened for buffered I/O, use the following fields of the MMIOINFO structure filled by mmioGetInfo:

The pchNext field points to the next byte in the buffer that can be read or written. When you read or write, increment pchNext by the number of bytes read or written.

The pchEndRead field points to one byte past the last valid byte in the buffer that can be read.

The pchEndWrite field points to one byte past the last location in the buffer that can be written.

Once you read or write to the buffer and modify pchNext, do not call any MMIO function except mmioAdvance until you call mmioSetInfo. Call mmioSetInfo when you are finished directly accessing the buffer.

When you reach the end of the buffer specified by pchEndRead or pchEndWrite, call mmioAdvance to fill the buffer from the disk, or write the buffer to the disk. The mmioAdvance function will update the pchNext, pchEndRead, and pchEndWrite fields in the MMIOINFO structure for the file.

Before calling mmioAdvance or mmioSetInfo to flush a buffer to disk, set the MMIO_DIRTY flag in the dwFlags field of the MMIOINFO structure for the file. Otherwise, the buffer will not get written to disk.

Do not decrement pchNext or modify any fields in the MMIOINFO structure other than pchNext and dwFlags. Do not set any flags in dwFlags except MMIO_DIRTY.

See Also

mmioSetInfo, MMIOINFO