INtime SDK Help
ntxMapRtSharedMemory
INtime SDK v7 > About INtime > INtime Kernel > Memory management > ntxMapRtSharedMemory

Obtains a pointer to a shared memory object.

LPVOID ntxMapRtSharedMemory(
    NTXHANDLE hSegment,
);

Parameters

hSegment
Handle to the memory area allocated by the RT application.

Remarks

This call is identical to ntxMapRtSharedMemoryEx with the NTX_MAP_WRITE flag set.

Mapping consumes resources in the Windows process. You can use ntxUnmapRtSharedMemory to return resources.

You can map an address space multiple times. Each operation returns the same pointer value. The first unmap invalidates this pointer.

If the NTX application must operate on data that contains RTHANDLEs, you must convert the handles using ntxImportRtHandle.

Due to Windows limitations, the maximum size you can map in a single call is as follows:

  • Windows - 0xfffff000 bytes

The actual size that you can map depends on the free virtual address space available in your Windows process.

Warning: NTX maintains a cache of mapped memory handles for efficiency. This means that if you attempt to remap a handle that is already mapped, the call will return the cached value rather than recalculating the mapping. This in turn means that it is essential to call ntxUnmapRtSharedMemory when you are finished with a memory handle, otherwise if that handle value is reused and passed back to Windows the results will be unpredictable.

Return Values

A pointer to the address space specified in hSegment.
Success
NULL
Function failed.

Status

E_TYPE 0x8002
hSegment is not an address space.
E_ALIGNMENT
hSegment is not page-aligned on both ends. Use ntxMapRtSharedMemoryEx to map a non-page-aligned shared memory object.
E_LOCATION
hSegment is located in an RT kernel that does not share memory with the host of the NTX application.
E_STATE 0x0007
A call to ntxMapRtSharedMemoryEx was previously made without the NTX_MAP_WRITE flag set.
E_NTX_INTERNAL_ERROR
The DLL could not contact the RT kernel to complete the request.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/nt/include/ntx.h ntx.h ntx.lib
INtime 4.01 (for 64-bit Windows) intime/nt/include/ntx.h ntx.h ntx64.lib
See Also