ppb (PPVOID) - output

      A pointer to a variable that will receive the base address of the allocated range of pages.

      OS/2 determines where to allocate the virtual address for the shared memory object.

    pszName (PSZ) - input

      An optional address of the name string associated with the shared memory object to be allocated.

      The name is an ASCIIZ string in the format of an OS/2 file name, and is in the subdirectory, \SHAREMEM\; for example, \SHAREMEM\PUBLIC.DAT.

      To allocate unnamed shared memory, set this parameter to NULL. If you want to use unnamed shared memory, the flag parameter must include either OBJ_GETTABLE or OBJ_GIVEABLE.

    cb (ULONG) - input

      Size, in bytes, of the shared memory object to allocate.

      The size is rounded up to the next page-size boundary. The size of a page is 4KB.

    flag (ULONG) - input

      Allocation attribute and desired access protection flags.

      A set of flags describing the allocation attributes and desired access protection for the shared memory object. Possible values are shown in the following lists:

      Allocation Attributes

      PAG_COMMIT (0x00000010)

        All pages in the shared memory object are initially committed.
      OBJ_GIVEABLE (0x00000200)
        The access to the memory object can be given to another process using the DosGiveSharedMem function.
      OBJ_GETTABLE (0x00000100)
        The memory object can be accessed by another process that knows the address of the memory and calls the DosGetSharedMem function.
      OBJ_TILE (0x00000040)
        The shared memory object must be allocated in the first 512MB of virtual-address space, with 16-bit selectors mapping the memory object.

        The 16-bit selectors are allocated to map the 32-bit object at 64KB boundaries. The figure in the description of the Parameters for DosAllocMem shows how the 16-bit alias selectors map the 32-bit object. Desired Access Protection

      PAG_EXECUTE (0x00000004)
        Execute access to the committed pages in the private memory object is desired.
      PAG_READ (0x00000001)
        Read access is desired.
      PAG_WRITE (0x00000002)
        Write access is desired.
      PAG_GUARD (0x00000008),
        Access to the committed pages in the private memory object causes a "guard page entered" condition to be raised in the subject process.
      At least one of the bits of PAG_READ, PAG_WRITE, or PAG_EXECUTE must be set.

    ulrc (APIRET) - returns

      Return Code.

      DosAllocSharedMem returns one of the following values:

    • NO_ERROR 8
        ERROR_NOT_ENOUGH_MEMORY
      87
        ERROR_INVALID_PARAMETER
      95
        ERROR_INTERRUPT
      123
        ERROR_INVALID_NAME
      183
        ERROR_ALREADY_EXISTS
      For a full list of error codes, see Errors.


    [Back] [Next]