DosGiveSharedMem gives another process access to a shared memory object.

Giving access to a shared memory object allocates the virtual address (of the shared memory object) in the virtual-address space of the target process. This is similar to the target process' performing a DosGetSharedMem operation on the specified shared memory object.

The virtual address of the giveable shared memory object is the base address assigned when the giveable shared memory object was created. The creating and receiving processes must use some form of InterProcess Communication (IPC) to exchange this value.

Giveable shared memory objects are mapped at the same virtual address in all processes that obtain access to the shared memory object.

The shared memory object specified by the virtual address must be giveable (that is, it must have been created with the OBJ_GIVEABLE attribute set on a call to DosAllocSharedMem).

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.

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:


[Back] [Next]