Opened 15 years ago
Closed 12 years ago
#1080 closed Bugs (fixed)
boost::interprocess win32 global file mapping issue
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | Boost 1.45.0 | Component: | interprocess |
Version: | Severity: | Problem | |
Keywords: | interprocess global shared memory win32 | Cc: |
Description
There is a serious bug in boost::interprocess library. It is unable to create global shared memory between services and simle applications. An exception is thrown ( m_err = 5, m_str = "Access is denied" ) I shortly investigated the way to fix this issue and found that call of CreateFileMappingA winAPI in winapi::create_file_mapping function sets lpAttributes parameter as NULL. To get rid of "Access is denied" error you can reimplement this function as: static inline void * create_file_mapping (void * handle, unsigned long access, unsigned long high_size, unsigned long low_size, const char * name) {
SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd;
InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(&sd, true, NULL, false);
sa.lpSecurityDescriptor = &sd; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle = FALSE; return CreateFileMappingA (handle, &sa, access, high_size, low_size, name);
}
Change History (5)
comment:1 by , 15 years ago
Owner: | set to |
---|
comment:2 by , 15 years ago
Component: | None → interprocess |
---|
follow-up: 4 comment:3 by , 15 years ago
comment:4 by , 15 years ago
Replying to igaztanaga:
Changed SVN adding suggested code. Reporter: close this bug if the problem has completely disappeared.
Problem didn't completely disappeared. You have to pass such security attributes in each WinApi call where SA parameter is required. Or allow users to specify SA by themselves.
comment:5 by , 12 years ago
Milestone: | Boost 1.36.0 → Boost-1.45.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
New permission scheme added for Boost 1.45, the user can specify permissions.
Changed SVN adding suggested code. Reporter: close this bug if the problem has completely disappeared.