[ Home |
Alpha index |
Topic index |
The OS/2 API Project
[ Syntax |
rc = DosGetNamedSharedMem( pBaseAddress,
- PPVOID pBaseAddress (output)
- This is a pointer to the variable that should recieve the base address of the allocated
- PSZ pszSharedMemName (input)
- This an optional address of a name string that is to be associated with the shared
memory block which we are about to allocate. The name should be in the format of an OS/2
filename, and is an ordinary ASCIIZ string. Will be stored in the \SHAREMEM\ subdirectory.
- ULONG ulAttributeFlags (input)
- Flags that describe the desired access protection and allocation attributes.
- 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
DosGetNamedSharedMem is used to get access to a named shared memory block. This will
allocate the virtual address of the memory object into the process's virtual-address space.
If you specify the name of the block, the name string must include the prefix "\SHAREMEM\".
The returned address will be the same as the one returned to the process that created the
/* Pointer to the base address of the allocated memory. */
/* Pointer to the requested name of the memory block */
/* which we are about to allocate. */
/* Flags describing the memory block's characteristics. */
/* Receiving the return code */
/* Name of the shared memory block. */
/* Note the \\SHAREMEM\\ prefix. */
AttributeFlags = PAG_WRITE | PAG_READ | PAG_COMMIT;
/* We request read and write access to the shared memory */
/* block, and also have the pages of the memory block */
/* committed at once within the virtual memory. */
rc = DosGetNamedSharedMem( &BaseAddress, Name, AttributeFlags);
if (rc != 0)
/* We have an error we must take care of. */
DosAllocSharedMem, DosGetSharedMem, DosGiveSharedMem
Stefan Mars -
Last modified March 16/1996
Please send all errors, comments, and suggestions to:
The OS/2 API Project