Jump to content

mmioIdentifyStorageSystem

From EDM2

The mmioIdentifyStorageSystem function determines which storage system I/O procedure (IOProc) is responsible for a given media data object. While mmioIdentifyFile identifies the *format* of the data (like MIDI or Wave), this function identifies the *container* or *mechanism* (like a DOS file or a BND compound file) where that data resides.

Syntax

#define INCL_MMIOOS2
#include <os2.h>

ULONG mmioIdentifyStorageSystem(PSZ pszFileName, PMMIOINFO pmmioinfo, PFOURCC pfccStorageSystem);

Parameters

pszFileName (PSZ) - input
A pointer to a null-terminated string containing the name of the file or data object to be identified.
pmmioinfo (PMMIOINFO) - input
A pointer to an MMIOINFO structure that may contain additional context for the search. This is typically set to NULL, but it is required when identifying elements within compound files that are not fully qualified.
pfccStorageSystem (PFOURCC) - output
A pointer to a FOURCC variable. Upon successful completion, this variable receives the FOURCC code of the identifying storage system IOProc.

Return Values

rc (ULONG)
Returns a code indicating the result:
  • MMIO_SUCCESS: The storage system was successfully identified (0).
  • MMIO_ERROR: The specified file is not a recognized storage-system type.
  • MMIOERR_INVALID_PARAMETER: An invalid parameter was passed.
  • MMIOERR_INTERNAL_SYSTEM: An internal system error occurred.

> [!TIP] > For detailed information regarding underlying filesystem errors (like "File Not Found"), call mmioGetLastError.

Remarks

This function iterates through the MMIO Manager's internal list of I/O procedures, specifically looking for those flagged as `MMIO_IOPROC_STORAGESYSTEM`.

For each matching IOProc, MMIO sends an `MMIOM_IDENTIFYFILE` message. The first IOProc that claims the file name as a valid data object "wins," and its FOURCC code is returned in the `pfccStorageSystem` parameter.

This is particularly useful for handling compound files (like `.BND` files), where the "storage system" acts as a layer between the OS filesystem and the actual media data.

Example Code

The following example shows how to identify the storage system for an element within a compound file.

   PSZ      pszFileName = "MYBUNDLE.BND+SOUND01.WAV";
   MMIOINFO mmioinfo;
   FOURCC   fccStorageSystem;
   ULONG    rc;

   /* Initialize MMIOINFO */
   memset(&mmioinfo, '\0', sizeof(MMIOINFO));
   
   /* We can hint that we expect a BND container */
   mmioinfo.fccIOProc = FOURCC_BND;

   rc = mmioIdentifyStorageSystem(pszFileName, &mmioinfo, &fccStorageSystem);

   if (rc == MMIO_SUCCESS) {
      if (fccStorageSystem != 0) {
         /* fccStorageSystem now contains the ID of the SS IOProc */
         /* This can be used to set fccChildIOProc for later operations */
         mmioinfo.fccChildIOProc = fccStorageSystem;
      }
   }

Related Functions