private void MapView() { var ptr = MapViewOfFile(_sharedMemoryHandle.GetHandle(), FileMapAccess.FileMapRead | FileMapAccess.FileMapWrite, 0, 0, Size); if (ptr == IntPtr.Zero) { throw new InvalidOperationException("File map not valid!"); } if (Size == 0) { var info = new MemoryBasicInformation(); VirtualQuery(ref ptr, ref info, Marshal.SizeOf(info)); Size = info.RegionSize; } ShareMemoryStream = new SharedMemoryStream(ptr, Size); }
private void MapView() { var ptr = MapViewOfFile(_sharedMemoryHandle.GetHandle(), FileMapAccess.FileMapRead | FileMapAccess.FileMapWrite, 0, 0, Size); if (ptr == IntPtr.Zero) { throw new InvalidOperationException("File map not valid!"); } if (Size == 0) { var info = new MemoryBasicInformation(); VirtualQuery(ref ptr, ref info, Marshal.SizeOf(info)); Size = info.RegionSize; } ShareMemoryStream = new SharedMemoryStream(ptr, Size); }