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 the Windows' GetLastError function 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 RtCloseHandle. 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.
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/nt/include/iwin32x.h |
iwin32x.h |
iwin32x.lib |
Notes
- This function operates in the Windows portion of your application.
- The iwin32 API also includes an RtCreateSharedMemory function that operates in the real-time portion of your application.
See Also
RtCloseHandle, iwin32x API, iwin32 Overview