An I/O procedure is a message-processing function supplied by an application. An I/O procedure function has the following syntax:
LRESULT FAR PASCAL IOProc(lpmmioinfo, wMsg, lParam1, lParam2)
The lpmmioinfo parameter specifies a far pointer to an MMIOINFO structure associated with the file being accessed.
The wMsg parameter is a UINT and specifies the message being sent by the file I/O manager to the I/O procedure.
The lParam1 parameter is an LPARAM and specifies 32 bits of message-dependent information.
The lParam2 parameter is an LPARAM and specifies 32 bits of message-dependent information.
The return value is message-dependent. If the I/O procedure does not recognize a message, it should return zero.
I/O procedures must respond to the MMIOM_CLOSE, MMIOM_OPEN, MMIOM_READ, MMIOM_WRITE, MMIOM_SEEK, MMIOM_RENAME, and MMIOM_WRITEFLUSH messages. Each of these messages has two parameters. For details about these messages and their parameters, see the Multimedia Programmer's Reference.
You can also create custom messages and send them to your I/O procedure using the mmioSendMessage function. If you define your own messages, be sure they are defined at or above the MMIOM_USER message. For example, the following code fragment defines a message named MMIOM_MYMESSAGE:
#define MMIOM_MYMESSAGE MMIOM_USER + 0
In addition to processing messages, an I/O procedure must maintain the lDiskOffset field in the MMIOINFO structure referenced by the lpmmioinfo parameter. The lDiskOffset field must always contain the file offset to the location that the next MMIOM_READ or MMIOM_WRITE message will access. The offset is specified in bytes and is relative to the beginning of the file. The I/O procedure can use the adwInfo[] field to maintain any required state information. The I/O procedure should not modify any other fields in the MMIOINFO structure.