Creates a shared memory object.
HANDLE RtCreateSharedMemory(
DWORD flProtect,
DWORD MaximumSizeHigh,
DWORD MaximumSizeLow,
LPCTSTR lpName,
VOID ** location
);
Parameters
flProtect
- Ignored.
MaximumSizeHigh
- Must be zero.
MaximumSizeLow
- The number of bytes to allocate.
lpName
- Pointer to a null-terminated string that specifies the shared memory object name. The name is limited to MAX_PATH characters and can contain any character except the backslash path-separator character (\). Name comparison is case sensitive. Values include:
- NULL
- The shared memory object is created without a name.
- Matches an existing named shared memory object
- Ignores the
MaximumSizeLow
parameter because it was already set by the creation process.
- Matches the name of an existing event, mutex, or semaphore object
- The function fails and GetLastError returns ERROR_INVALID_HANDLE. This occurs because these objects share the same name space.
location
- Pointer to a pointer where the virtual address of the shared memory object is stored.
Remarks
- Multiple processes can have handles of the same shared memory object, enabling use of the object for data sharing. To share an object, a process can specify the name of a shared memory object in a call to RtCreateSharedMemory.
- To close the handle, use CloseHandle. When the process terminates, the system automatically closes the handle. When its last handle closes, the shared memory object is destroyed.
- RtSharedMemory can also be used from a Windows application to create an iwin32 shared memory object.
- Space for shared memory objects comes from an iwin32 virtual memory pool; the maximum size of that pool is configurable in the INtime Node Manager, advanced tab, iwin32 section, SegSize in multiples of 4 Mbytes.
- Use RtUnmapSharedMemory to free the virtual memory associated with this call.
Return Values
- Handle to shared memory object
- Success.
- Handle to existing object and ERROR_ALREADY_EXISTS
- The shared memory object existed before the function call.
- NULL
- Failure.
Requirements
Versions |
Defined in |
Include |
Link to |
INtime 3.0 |
intime/rt/include/iwin32.h |
iwin32.h |
iwin32.lib |
Note
- This function operates in the real-time portion of your application.
- The iwin32x API also includes an RtCreateSharedMemory function that operates in the Windows portion of your application.
See Also
CloseHandle, iwin32 API, iwin32 Overview