INtime SDK Help
INtime SDK v7.1 > About INtime > INtime Kernel > Memory management > CreateRtMemoryHandle

Creates a handle for an area of memory in the process' virtual address space. You can use the handle in conjunction with MapRtSharedMemory to share memory among RT processes and between RT and Windows processes.

RTHANDLE CreateRtMemoryHandle(
    PVOID pOffset,   // location of memory to be shared within calling thread's virtual address space
    DWORD cbSize     // size in bytes of contiguous memory to be shared


Offset of the memory area within the calling thread's virtual address space to be shared.
Number of bytes to include in the shared memory area.


Before the microprocessor can access an area of memory in Protected Mode, an RT handle for the memory area must exist in one of the descriptor tables: the GDT or LDT. CreateRtMemoryHandle lets you add an RT handle to the GDT which allows global access to physical memory within the thread's virtual address space.

A segment created with this system call can be deleted by calling DeleteRtMemoryHandle. The memory associated with these handles does not return to the memory pool of the calling thread's process for reallocation when the RT handles are deleted. When the segment is deleted, the GDT slot is returned to the memory manager for reassignment.

Return Values

An RTHANDLE for the shared memory area
Failure. To determine the status, call GetLastRtError.


E_OK 0x0000
No exceptional conditions occurred.
E_MEM 0x0002
Creating an RT handle requires more available physical memory than currently exists.
E_LIMIT 0x0004
Creating the requested RT handle exceeds the process's object limit.
E_SLOT 0x000C
You cannot create more RT objects because the GDT's slots are full.


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/rtbase.h rt.h rt.lib

See Also

Memory management system calls, DeleteRtMemoryHandle