mmioInstallIOProc

Syntax

LPMMIOPROC mmioInstallIOProc(fccIOProc, pIOProc, dwFlags)

This function installs or removes a custom I/O procedure. It will also locate an installed I/O procedure, given its corresponding four-character code.

Parameters

FOURCC fccIOProc

Specifies a four-character code identifying the I/O procedure to install, remove, or locate. All characters in this four-character code should be uppercase characters.

LPMMIOPROC pIOProc

Specifies the address of the I/O procedure to install. To remove or locate an I/O procedure, set this parameter to NULL.

DWORD dwFlags

Specifies one of the following flags indicating whether the I/O procedure is being installed, removed, or located:

MMIO_INSTALLPROC

Installs the specified I/O procedure.

MMIO_REMOVEPROC

Removes the specified I/O procedure.

MMIO_FINDPROC

Searches for the specified I/O procedure.

Return Value

The return value is the address of the I/O procedure installed, removed, or located. If there is an error, the return value is NULL.

Comments

If the I/O procedure resides in the application, use MakeProcInstance to get a procedure-instance address and specify this address for pIOProc. You don't need to get a procedure-instance address if the I/O procedure resides in a DLL.

Callback

LONG FAR PASCAL IOProc(lpmmioinfo, wMsg, lParam1, lParam2)

IOProc is a placeholder for the application-supplied function name. The actual name must be exported by including it in a EXPORTS statement in the application's module-definitions file.

Parameters

LPSTR lpmmioinfo

Specifies a far pointer to an MMIOINFO structure containing information about the open file. The I/O procedure must maintain the lDiskOffset field in this structure to indicate the file offset to the next read or write location. The I/O procedure can use the adwInfo[] field to store state information. The I/O procedure should not modify any other fields of the MMIOINFO structure.

WORD wMsg

Specifies a message indicating the requested I/O operation. Messages that can be received include MMIOM_OPEN, MMIOM_CLOSE, MMIOM_READ, MMIOM_WRITE, and MMIOM_SEEK.

LONG lParam1

Specifies a parameter for the message.

LONG lParam2

Specifies a parameter for the message.

Return Value

The return value depends on the message specified by wMsg. If the I/O procedure does not recognize a message, it should return zero.

Comments

The four-character code specified by the fccIOProc field in the MMIOINFO structure associated with a file identifies a filename extension for a custom storage system. When an application calls mmioOpen with a filename like “foo.xyz!bar”, the I/O procedure associated with the four-character code “XYZ ” is called to open the “bar” element of the file “foo.xyz”.

The mmioInstallIOProc function maintains a separate list of installed I/O procedures for each Windows application. Therefore, different applications can use the same I/O procedure identifier for different I/O procedures without conflict.

To share an I/O procedure among applications, the I/O procedure must reside in a DLL called by each application using it. Each application using the shared I/O procedure must call mmioInstallIOProc to install the procedure (or call the DLL to install the procedure on behalf of the application). Each application must call mmioInstallIOProc to remove the I/O procedure before terminating.

If an application calls mmioInstallIOProc more than once to register the same I/O procedure, then it must call mmioInstallIOProc to remove the procedure once for each time it installed the procedure.

mmioInstallIOProc will not prevent an application from installing two different I/O procedures with the same identifier, or installing an I/O procedure with one of the predefined identifiers (“DOS ”, “MEM ”, or “BND ”). The most recently installed procedure takes precedence, and the most recently installed procedure is the first one to get removed.

See Also

mmioOpen