Creating a Resource File

To install SPCB information in the SPI.INI file, you first must create a resource file containing all the information about the stream handlers to update or add to the SPI.INI profile. The fields and the order of these fields should match the example shown in the example that follows.

#include <os2.h>
#include <os2me.h>

#define  SPI_RESOURCE1                     (SPI_RESOURCE + 1)
#define  SPI_RESOURCE2                     (SPI_RESOURCE + 2)

#define  SPCBHAND_RCVSYNC_GENSYNC_GENTIME
                     (SPCBHAND_RCVSYNC + SPCBHAND_GENSYNC + SPCBHAND_GENTIME)

RCDATA   SPI_RESOURCE
BEGIN
  2                       /* number of stream handlers resources */
END

RCDATA   SPI_RESOURCE1
  BEGIN
     "TESTSYS\0",                        /* Class name      */
     "R3TEST\0",                         /* Handler name    */
      SH_DLL_TYPE,                       /* PDD or DLL flag */
      "R3TEST\0",                        /* PDD or DLL name */
       1,                                /* Number of SPCBs */
       SPCBSIZE,                         /* Length of SPCB  */
       DATATYPE_GENERIC,                 /* Data type       */
       SUBTYPE_NONE,                     /* Sub type        */
       0L,                            /* Internal key     */
       0L,                            /* Data flag        */
       0L,                            /* # of records     */
       1L,                            /* Block size       */
       4096L,                         /* Buffer size      */
       2L,                            /* Min # of buffers */
       4L,                            /* Max # of buffers */
       1L,                            /* # empty buffs to start src */
       2L,                            /* # full buffs to start tgt */
       SPCBBUF_NONCONTIGUOUS,         /* Buffer flag  */
       SPCBHAND_RCVSYNC,              /* Handler flag */
       0L,                            /* Sync tolerance value */
       0L,                            /* Save sync pulse generation */
       0L,                            /* Bytes/unit of time       */
           0L                         /* MMTIME each unit represents */
  END
RCDATA   SPI_RESOURCE2
  BEGIN
     "TESTSYS\0",                /* Class name      */
     "R0TEST\0",                 /* Handler name    */
      SH_PDD_TYPE,               /* PDD or DLL flag */
     "R0TEST.SYS\0",             /* PDD or DLL name */
      2,                         /* Number of SPCBs */
      SPCBSIZE,                  /* Length of SPCB  */
      DATATYPE_ADPCM_AVC,        /* Data type       */
      0L,                        /* Sub type     */
      0L,                        /* Internal key */
      SPCBDATA_CUETIME,          /* Data flag    */
      0L,                        /* # of records */
      1L,                        /* Block size   */
      4096L,                     /* Buffer size  */
      10L,                       /* Min # of buffers */
      10L,                       /* Max # of buffers */
      1L,                        /* # empty buffs to start src */
      1L,                        /* # full buffs to start tgt  */
      SPCBBUF_NONCONTIGUOUS,            /* Buffer flag  */
      SPCBHAND_RCVSYNC_GENSYNC_GENTIME, /* Handler flag */
      0L,                        /* Sync tolerance value */
      0L,                        /* Save sync pulse generation */
      0L,                        /* Bytes/unit of time */
      0L,                        /* MMTIME each unit represents */

      SPCBSIZE,                  /* Length of SPCB */
      DATATYPE_WAVEFORM,         /* Data type    */
      0L,                        /* Sub type     */
      0L,                        /* Internal key */
      SPCBDATA_CUETIME,          /* Data flag    */
      0L,                        /* # of records */
      1L,                        /* Block size   */
      8192L,                     /* Buffer size  */
      10L,                       /* Min # of buffers */
      10L,                       /* Max # of buffers */
      1L,                        /* # empty buffs to start src */
      1L,                        /* # full buffs to start tgt  */
      SPCBBUF_NONCONTIGUOUS,     /* Buffer flag */
      SPCBHAND_RCVSYNC_GENSYNC_GENTIME, /* Handler flag */
      0L,                        /* Sync tolerance value   */
      0L,                        /* Save sync pulse generation */
      0L,                        /* Bytes/unit of time */
      0L                         /* MMTIME each unit represents */
  END

Creating a Stub Routine

After you create a resource file, you must create a stub routine to generate the DLL that contains the resource file. The following example shows an example of a sample stub routine (RCSTUB.C) that is used to create the DLL containing the resource shown in the previous example.

#include <os2.h>
VOID RCSTUB()
{
}


[Back: Installing a Stream Handler]
[Next: Building the DLL Containing the Resource]