rem: driver_name[7 + 4] = '/';  driver_base = OpenLibrary( driver_name, DriverVersion );
add: driver_name[7 + 4] = ':';    driver_base = OpenLibrary( driver_name + 7, DriverVersion );
context: AddModeFile ( UBYTE *filename ){  struct IFFHandle *iff;  struct StoredProperty *name,*data;  struct CollectionItem *ci;  struct TagItem *tag,*tstate;  struct TagItem extratags[]=  {    { AHIDB_Driver,         0 },    { AHIDB_Data,           0 },    { AHIDB_DriverBaseName, (ULONG) "DEVS:AHI" },    { TAG_MORE,             0 }  };  ULONG rc=FALSE;  iff = AllocIFF();  if(iff != NULL)  {    iff->iff_Stream = Open(filename, MODE_OLDFILE);    if(iff->iff_Stream != 0)    {      InitIFFasDOS(iff);      if(!OpenIFF(iff, IFFF_READ))      {        if(!(PropChunk(iff,       ID_AHIM, ID_AUDN)          || PropChunk(iff,       ID_AHIM, ID_AUDD)          || CollectionChunk(iff, ID_AHIM, ID_AUDM)          || StopOnExit(iff,      ID_AHIM, ID_FORM)))        {          if(ParseIFF(iff, IFFPARSE_SCAN) == IFFERR_EOC)          {            name = FindProp(iff,       ID_AHIM, ID_AUDN);            data = FindProp(iff,       ID_AHIM, ID_AUDD);            ci   = FindCollection(iff, ID_AHIM, ID_AUDM);            rc = TRUE;            if(name != NULL)            {              char            driver_name[ 128 ];              struct Library* driver_base;              rc = FALSE;              if( name->sp_Size <= 0 )              {                Req( "%s:\nAUDN chunk has illegal size: %ld.",                      (ULONG) filename, name->sp_Size );              }              else              {                LONG   i;                STRPTR s;                // Make sure string is NUL-terminated                                for( s = (STRPTR) name->sp_Data;                     (APTR) s < name->sp_Data + name->sp_Size;                     ++s )                {                  if( *s == 0 )                  {                    rc = TRUE;                    break;                  }                }                                if( !rc )                {                  Req( "%s:\nAUDN chunk is not NUL-terminated.",                        (ULONG) filename );                }              }                            extratags[0].ti_Data = (ULONG) name->sp_Data;              // Now verify that the driver can really be opened              #ifdef __MORPHOS__              strcpy( driver_name, "MOSSYS:DEVS:AHI/" );              strncat( driver_name, name->sp_Data, 100 );              strcat( driver_name, ".audio" );                            driver_base = OpenLibrary( &driver_name[7], DriverVersion );              if( driver_base == NULL )              {                // Make it MOSSYS:DEVS/AHI/...                //                    ^                driver_name[7 + 4] = '/';                driver_base = OpenLibrary( driver_name, DriverVersion );                if( driver_base == NULL )                {                  rc = FALSE;                }                else                {                  // It is a MOSSYS:DEVS/AHI driver!                  extratags[2].ti_Data = (ULONG) "MOSSYS:DEVS/AHI";                  CloseLibrary( driver_base );                }              }#else              strcpy( driver_name, "DEVS:AHI/" );              strncat( driver_name, name->sp_Data, 100 );              strcat( driver_name, ".audio" );              driver_base = OpenLibrary( driver_name, DriverVersion );              if( driver_base == NULL )              {                rc = FALSE;              }#endif              else              {                CloseLibrary( driver_base );              }            }            if(data != NULL)            {              if( name->sp_Size <= 0 )              {                Req( "%s:\nAUDD chunk has illegal size: %ld.",                      (ULONG) filename, name->sp_Size );                rc = FALSE;              }              extratags[1].ti_Data = (ULONG) data->sp_Data;            }            while(rc && ci != NULL)            {              // Relocate loaded taglist              tstate = (struct TagItem *) ci->ci_Data;              while( rc && ( tag = NextTagItem( &tstate ) ) != NULL )              {                if(tag->ti_Tag & (AHI_TagBaseR ^ AHI_TagBase))                {                  tag->ti_Data += (ULONG) ci->ci_Data;                }                               rc = FALSE;                 switch( tag->ti_Tag )                {                  case AHIDB_Name:                  {                    // Make sure the string is within the chuck and NUL-term.                                        if( tag->ti_Data <  (ULONG) ci->ci_Data ||                         tag->ti_Data >= (ULONG) ci->ci_Data + ci->ci_Size )                    {                      Req( "%s:\nAUDM chunk contains an invalid string.",                            (ULONG) filename );                    }                    else                    {                      LONG   i;                      STRPTR s;                                            // Make sure string is NUL-terminated                                      for( s = (STRPTR) tag->ti_Data;                           (APTR) s < ci->ci_Data + ci->ci_Size;                           ++s )                      {                        if( *s == 0 )                        {                          rc = TRUE;                          break;                        }                      }                    }                                        break;                  }                  default:                    rc = TRUE;                    break;                }                if( !rc )                {                  Req( "%s:\nAUDM chunk contains a string that is not "                       "NUL-terminated.", (ULONG) filename  );                }              }              if( rc )              {                // Link taglists                extratags[3].ti_Data = (ULONG) ci->ci_Data;                rc = AHI_AddAudioMode(extratags);                ci = ci->ci_Next;              }            }          }        }        CloseIFF(iff);      }      Close(iff->iff_Stream);    }    FreeIFF(iff);  }  return rc;}