Suballocating Memory

#define       POOLSIZE   8192              /* Size of storage pool       */
PVOID         pPool;                       /* Base address of pool       */

CTRLSTRUCT1   *Struct1;                    /* Control structure 1        */
CTRLSTRUCT2   *Struct2;                    /* Control structure 2        */

DosAllocMem(&pPool,                        /* Allocate storage for pool  */
            POOLSIZE,                      /* Size of memory object      */
            PAG_READ  |                    /* Allow read access          */
            PAG_WRITE |                    /* Allow write access         */
            PAG_COMMIT);                   /* Commit storage immediately */

DosSubSet(pPool,                           /* Initialize for suballoc    */
          DOS_SUBINIT,                     /* Initialize flag            */
          POOLSIZE);                       /* Size of pool               */

DosSubAlloc(pPool,                         /* Suballocate storage        */
            &Struct1,                      /* Pointer to memory object   */
            sizeof(CTRLSTRUCT1));          /* Size of storage required   */
DosSubAlloc(pPool,                         /* Suballocate storage        */
            &Struct2,                      /* Pointer to memory object   */
            sizeof(CTRLSTRUCT2));          /* Size of storage required   */


[Back: Registering a Guard Page Exception Handler]
[Next: Allocating Shared Memory]