MMIOM_OPEN
Appearance
The MMIOM_OPEN message is sent to a Multimedia I/O (MMIO) procedure by the mmioOpen function to request that a file or compound file element be initialized, opened, or deleted. This message serves as the initial handshake that sets up the internal environment for subsequent reading, writing, and seeking operations.
Syntax
rc = mmioSendMessage(hmmio, MMIOM_OPEN, (LONG)pszFileName, lParam2);
Parameters
- pmmioinfo (PMMIOINFO)
- A pointer to an MMIOINFO data structure maintaining the runtime state of the file channel. The I/O procedure utilizes and modifies this block to track internal state markers, error logs, and buffer configurations.
- usMsg (USHORT)
- The message identifier, set to `MMIOM_OPEN`.
- lParam1 (LONG)
- A pointer to a null-terminated string (`pszFileName`) specifying the name or path descriptor of the file or sub-element to be processed.
- lParam2 (LONG)
- This parameter is not used.
Return Value
- rc (ULONG)
- Return codes indicating success or the nature of the initialization failure:
- MMIO_SUCCESS: The specified file target was opened, created, or deleted successfully.
- Otherwise: A standard OS/2 system error code or an MMIO Manager error code is returned.
Remarks
- **Seek Pointer Initialization**: Before dispatching this message, the MMIO Manager initializes the `lDiskOffset` field of the MMIOINFO structure to `0`. If an I/O procedure targets a non-standard logical position or parses a custom nested file header upon opening, it must explicitly correct and update `lDiskOffset` to reflect the true start of the raw data section.
- **Open Flags**: The file behavior is guided by the `ulFlags` field within the MMIOINFO structure (which inherits the `ulOpenFlags` parameter from the original `mmioOpen` call). This dictates options such as read/write access permissions (`MMIO_READ`, `MMIO_WRITE`, `MMIO_READWRITE`) and creation behavior (`MMIO_CREATE`).
- **File Deletion**: If the `MMIO_DELETE` flag is set within `ulFlags`, the purpose of the call changes: the I/O procedure is expected to permanently delete the file specified in lParam1 rather than opening it, returning `MMIO_SUCCESS` upon clean removal.