mmioInstallIOProc

  LPMMIOPROC mmioInstallIOProc(fccIOProc, pIOProc, dwFlags)    
  FOURCC fccIOProc;    
  LPMMIOPROC pIOProc;    
  DWORD dwFlags;    

The mmioInstallIOProc 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

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.

pIOProc

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

dwFlags

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

Value Meaning

MMIO_INSTALLPROC  
  Installs the specified I/O procedure.
MMIO_GLOBALPROC  
  This flag is a modifier to the install flag,and indicates the I/O procedure should be installed for global use. This flag is ignored on removal or find.
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 for compatibility with 16 bit windows 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 Function

LONG FAR PASCAL IOProc(lpmmioinfo, wMsg, lParam1, lParam2)
LPSTR lpmmioinfo;
UINT wMsg;
LONG lParam1;
LONG 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

lpmmioinfo

Specifies a 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.

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.

lParam1

Specifies a parameter for the message.

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 such as “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. Installing an I/O procedure globally however enables any process to use the procedure.

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 ”). The most recently installed procedure takes precedence, and the most recently installed procedure is the first one to get removed.

When searching for a specified I/O procedure, local procedures are searched first, then global procedures.

See Also

mmioOpen