[ Home |
Alpha index |
Topic index |
The OS/2 API Project
[ Syntax |
rc = DosGetSharedMem( pBaseAddress,
- PVOID pBaseAddress (input)
- This is the base virtual address of the gettable and shared memory block.
- ULONG ulAttributeFlags (input)
- Flags that describe the desired access protection.
- Setting PAG_READ (0x00000001) tells the system that read access is desired.
- Setting PAG_WRITE (0x00000002) tells the system that write access is desired.
- Setting PAG_EXECUTE (0x00000004) tells the system that execute access is
- Setting PAG_GUARD (0x00000008) tells the system that access to the memory object
should cause a guard page exception to be raised, in the subject process.
- At least one of PAG_READ,PAG_WRITE or PAG_EXECUTE must be set.
- APIRET rc
- The following values can be returned
DosGetSharedMem is used to get access to a shared memory block. This will take the virtual
address of the memory block and allocate it to the virtual-address space of the process.
The virtual address should be the same as the one returned when the gettable shared memory
block was created. For the process to know this address, some sort of information exchange
must occur between the process, and the process that created the gettable shared memory
The shared memory must be gettable (it must have been created by DosAllocSharedMem, with OBJ_GETTABLE set).
The desired access protection must be compatible with the access protection that was set
when the gettable shared memory block was created.
/* Pointer to the base address of the allocated memory. */
/* Flags describing the memory block's characteristics. */
/* Recieving the return code */
AttributeFlags = PAG_WRITE | PAG_READ | PAG_COMMIT;
/* We request read and write access to the shared memory */
/* block, and also to have the pages of the memory block */
/* committed at once within the virtual memory. */
rc = DosGetSharedMem( pBaseAddress, ulAttributeFlags);
if (rc != 0)
/* We have an error we must take care of. */
DosAllocSharedMem, DosGetNamedSharedMem, DosGiveSharedMem
Stefan Mars -
Last modified March 16/1996
Please send all errors, comments, and suggestions to:
The OS/2 API Project