DosGetSharedMem obtains access to a shared memory object.
Getting access to a shared memory object allocates the virtual address (of the shared memory object) in the virtual-address space of the process.
The virtual address of the gettable shared memory object is the base address assigned when the gettable shared memory object was created. The creating and receiving processes must use some form of InterProcess Communication (IPC) to exchange this value.
The shared memory object specified by the virtual address must be gettable (that is, it must have been created using DosAllocSharedMem with the OBJ_GETTABLE attribute set).
Gettable shared memory objects are mapped at the same virtual address in all processes that obtain access to the shared memory object.
The desired access protection applied to committed pages must be compatible with the access protection granted to the shared memory object when it was created.
With the Intel 80386 processor, execute and read access are equivalent. Also, write access implies both read and execute access.
Error code 31 (ERROR_GEN_FAILURE) is returned when the segment's maximum reference count of 65535 is exceeded.
Note: DosAllocMem and DosAllocSharedMem both allocate a block of memory of the size requested rounded to the nearest page. On OS/2 Warp, the system allocates a 64K object without attributes on every allocation.
For example, for a DosAllocMem call with a size of 1, the following occurs:
Note:
When you allocate a memory object with the PAG_EXECUTE attribute, it is implied that this memory object also has the PAG_READ attribute. However, when querying the attributes of a memory object, you will get the following results: