Skip to content

Commit

Permalink
Merge pull request #107 from leekunpeng/master
Browse files Browse the repository at this point in the history
Fix issue when creating large (> 4GB) shared memory areas on Windows
  • Loading branch information
saprykin committed Apr 19, 2024
2 parents 5c57d0a + fbc1f0b commit a102cf1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CMakeLists.txt.user
.DS_Store
.DS_Store
7 changes: 5 additions & 2 deletions src/pshm-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#define P_SHM_INVALID_HDL NULL
#define P_SHM_SUFFIX "_p_shm_object"

#define HIDWORD(l) ((DWORD)(((DWORDLONG)(l) >> 32) & 0xFFFFFFFF))
#define LODWORD(l) ((DWORD)((DWORDLONG)(l)))

typedef HANDLE pshm_hdl;

struct PShm_ {
Expand Down Expand Up @@ -74,8 +77,8 @@ pp_shm_create_handle (PShm *shm,
if (P_UNLIKELY ((shm->shm_hdl = CreateFileMappingA (INVALID_HANDLE_VALUE,
NULL,
protect,
0,
(DWORD) shm->size,
HIDWORD(shm->size),
LODWORD(shm->size),
shm->platform_key)) == NULL)) {
p_error_set_error_p (error,
(pint) p_error_get_last_ipc (),
Expand Down

0 comments on commit a102cf1

Please sign in to comment.